Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> RavenNuke(tm) v2.5x
Author Message
neralex
Site Admin



Joined: Aug 22, 2007
Posts: 1774

PostPosted: Tue Oct 02, 2012 10:37 am Reply with quote

I have a little bit played with the ForumsCollapsing block and with the first run i got an sql error in the log file.

Code:
Code: 1064 - Message: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND ug.user_pending = 0 AND a.group_id = ug.group_id' at line 1

SQL was: SELECT a.forum_id, auth_view, auth_read, a.auth_mod FROM `nuke_bbauth_access` a, `nuke_bbuser_group` ug WHERE ug.user_id = AND ug.user_pending = 0 AND a.group_id = ug.group_id
 remote addr: 127.0.0.1


It seems the problem is the variable "$userdata['user_id']" inside the sql query. If the user isn't logged on then is the variable empty. How can i solve it?

Code:
      /*

      * If the user isn't logged on then all we need do is check if the forum
      * has the type set to ALL, if yes they are good to go, if not then they
      * are denied access
      */
      $u_access = array();

      $sql = 'SELECT a.forum_id, ' . $a_sql . ', a.auth_mod '
               . 'FROM `' . $prefix . '_bbauth_access` a, `' . $prefix . '_bbuser_group` ug '
                . 'WHERE ug.user_id = ' . $userdata['user_id']
                   . ' AND ug.user_pending = 0'
                  . ' AND a.group_id = ug.group_id';
      $result = $db->sql_query($sql);

      if ( $row = $db->sql_fetchrow($result) ) {
         do{
               $u_access[$row['forum_id']][] = $row;
         } while( $row = $db->sql_fetchrow($result) );
      }
 
View user's profile Send private message
kguske
Site Admin



Joined: Jun 04, 2004
Posts: 6433

PostPosted: Tue Oct 02, 2012 11:50 am Reply with quote

I'm not sure this will solve the problem, but you should be able to insert:
Code:


if (empty($userdata['user_id'])) $userdata['user_id'] = 0;

before the $sql variable is set. That will at least address the SQL syntax issue. If you can test the SQL with that and post the results, it will help determine how to permanently address this.

_________________
I search, therefore I exist...
nukeSEO - nukeFEED - nukePIE - nukeSPAM - nukeWYSIWYG
 
View user's profile Send private message
neralex







PostPosted: Tue Oct 02, 2012 12:33 pm Reply with quote

After that, i get the next error:

Code:
Notice: Undefined index: user_level in F:\wamp\www\rn\blocks\block-ForumsCollapsing.php on line 423


Now i have tried this one and i get no error:

Code:
      if (isset($userdata['user_id'])) {

         $sql = 'SELECT a.forum_id, ' . $a_sql . ', a.auth_mod '
                  . 'FROM `' . $prefix . '_bbauth_access` a, `' . $prefix . '_bbuser_group` ug '
                   . 'WHERE ug.`user_id` = ' . $userdata['user_id']
                     . ' AND ug.`user_pending` = 0'
                     . ' AND a.`group_id` = ug.`group_id`';
         $result = $db->sql_query($sql);
   
         if ( $row = $db->sql_fetchrow($result) ) {
            do{
                  $u_access[$row['forum_id']][] = $row;
            } while( $row = $db->sql_fetchrow($result) );
         }
      }


But the question is from where comes the variable $userdata and for what is this query, because nothing is different after this change. Should ensure that the private threads are hidden?
 
kguske







PostPosted: Tue Oct 02, 2012 12:52 pm Reply with quote

That is what I meant - I am not sure if this will solve the problem. I think you are correct that this is related to private threads, but need to confirm.
 
neralex







PostPosted: Tue Oct 02, 2012 1:15 pm Reply with quote

If i try the hide the jump boxes, then i get a big list of undefined constants.

Code:
Notice: Use of undefined constant AUTH_ALL - assumed 'AUTH_ALL' in ...\blocks\block-ForumsCollapsing.php on line 443


Notice: Use of undefined constant AUTH_REG - assumed 'AUTH_REG' in ...\blocks\block-ForumsCollapsing.php on line 446

Notice: Use of undefined constant AUTH_ACL - assumed 'AUTH_ACL' in ...\blocks\block-ForumsCollapsing.php on line 449

Notice: Use of undefined constant AUTH_MOD - assumed 'AUTH_MOD' in ...\blocks\block-ForumsCollapsing.php on line 452

Notice: Use of undefined constant AUTH_ADMIN - assumed 'AUTH_ADMIN' in ...\blocks\block-ForumsCollapsing.php on line 455

Notice: Use of undefined constant AUTH_ALL - assumed 'AUTH_ALL' in ...\blocks\block-ForumsCollapsing.php on line 443

Notice: Use of undefined constant AUTH_REG - assumed 'AUTH_REG' in ...\blocks\block-ForumsCollapsing.php on line 446

Notice: Use of undefined constant AUTH_ACL - assumed 'AUTH_ACL' in ...\blocks\block-ForumsCollapsing.php on line 449

Notice: Use of undefined constant AUTH_MOD - assumed 'AUTH_MOD' in ...\blocks\block-ForumsCollapsing.php on line 452

Notice: Use of undefined constant AUTH_ADMIN - assumed 'AUTH_ADMIN' in ...\blocks\block-ForumsCollapsing.php on line 455

Notice: Use of undefined constant AUTH_ALL - assumed 'AUTH_ALL' in ...\blocks\block-ForumsCollapsing.php on line 443

Notice: Use of undefined constant AUTH_REG - assumed 'AUTH_REG' in ...\blocks\block-ForumsCollapsing.php on line 446

Notice: Use of undefined constant AUTH_ACL - assumed 'AUTH_ACL' in ...\blocks\block-ForumsCollapsing.php on line 449

Notice: Use of undefined constant AUTH_MOD - assumed 'AUTH_MOD' in ...\blocks\block-ForumsCollapsing.php on line 452

Notice: Use of undefined constant AUTH_ADMIN - assumed 'AUTH_ADMIN' in ...\blocks\block-ForumsCollapsing.php on line 455

Notice: Use of undefined constant AUTH_ALL - assumed 'AUTH_ALL' in ...\blocks\block-ForumsCollapsing.php on line 443

Notice: Use of undefined constant AUTH_REG - assumed 'AUTH_REG' in ...\blocks\block-ForumsCollapsing.php on line 446

Notice: Use of undefined constant AUTH_ACL - assumed 'AUTH_ACL' in ...\blocks\block-ForumsCollapsing.php on line 449

Notice: Use of undefined constant AUTH_MOD - assumed 'AUTH_MOD' in ...\blocks\block-ForumsCollapsing.php on line 452

Notice: Use of undefined constant AUTH_ADMIN - assumed 'AUTH_ADMIN' in ...\blocks\block-ForumsCollapsing.php on line 455

Notice: Use of undefined constant AUTH_MOD - assumed 'AUTH_MOD' in ...\blocks\block-ForumsCollapsing.php on line 472

Notice: Use of undefined constant AUTH_MOD - assumed 'AUTH_MOD' in ...\blocks\block-ForumsCollapsing.php on line 472
 
Palbin
Site Admin



Joined: Mar 30, 2006
Posts: 2583
Location: Pittsburgh, Pennsylvania

PostPosted: Tue Oct 02, 2012 1:36 pm Reply with quote

I will give it a quick look tonight if I have time.

_________________
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan. 
View user's profile Send private message
neralex







PostPosted: Tue Oct 02, 2012 1:45 pm Reply with quote

cool. Thx!
 
neralex







PostPosted: Tue Oct 02, 2012 2:50 pm Reply with quote

Another little issue is the not "shorted" link of the search of user's postings. If you use the shortlinks and you click on the Top Posters' usernames, then you get an incorrect link.

Code:
            . '<a href="forums.html?amp;file=search&amp;mode=results&amp;search_author=' . $username . '" ' . $staffTitle . '>Posts:</a>'

            . '&nbsp;<a href="forums.html?amp;file=search&amp;mode=results&amp;search_author=' . $username . '" ' . $staffTitle . '>' . $user_posts . '</a>&nbsp;</td>';


In the default settings is the shorted link only available for the module and not for all areas.

maybe:

Code:
   if (defined('TNSL_USE_SHORTLINKS')) {

      $searchposts = 'fsearch-author-' . $username . '.html';
   } else {
      $searchposts = 'forums.html?amp;file=search&amp;mode=results&amp;search_author=' . $username;
   }
 
montego
Site Admin



Joined: Aug 29, 2004
Posts: 9457
Location: Arizona

PostPosted: Sat Oct 06, 2012 8:34 am Reply with quote

NO, I would not embed if (defined('TNSL_USE_SHORTLINKS')) into the code. Completely unnecessary. This is a block, so the corresponding GTB-*.php script for that block needs to be looked at... I will try and take a look at it today.

_________________
Where Do YOU Stand?
HTML Newsletter::ShortLinks::Mailer::Downloads and more... 
View user's profile Send private message Visit poster's website
Palbin







PostPosted: Sat Oct 06, 2012 9:05 am Reply with quote

neralex, do you have error reporting on? Are you getting any php warnings?
 
Palbin







PostPosted: Sat Oct 06, 2012 10:20 am Reply with quote

Try this [ Only registered users can see links on this board! Get registered or login! ]

Specifically look at the "auth" function and the require_once I moved to the top.
 
Palbin







PostPosted: Sat Oct 06, 2012 10:30 am Reply with quote

neralex wrote:
Another little issue is the not "shorted" link of the search of user's postings. If you use the shortlinks and you click on the Top Posters' usernames, then you get an incorrect link.

Code:
            . '<a href="forums.html?amp;file=search&amp;mode=results&amp;search_author=' . $username . '" ' . $staffTitle . '>Posts:</a>'

            . '&nbsp;<a href="forums.html?amp;file=search&amp;mode=results&amp;search_author=' . $username . '" ' . $staffTitle . '>' . $user_posts . '</a>&nbsp;</td>';


In the default settings is the shorted link only available for the module and not for all areas.

maybe:

Code:
   if (defined('TNSL_USE_SHORTLINKS')) {

      $searchposts = 'fsearch-author-' . $username . '.html';
   } else {
      $searchposts = 'forums.html?amp;file=search&amp;mode=results&amp;search_author=' . $username;
   }


Remove the "mode=results&amp;" from the two links.
 
neralex







PostPosted: Sat Oct 06, 2012 12:13 pm Reply with quote

Thank you Palbin, it works!

Palbin wrote:
neralex, do you have error reporting on? Are you getting any php warnings?


I have error reporting on! Now with your code without an error!
 
doffer83
Worker
Worker



Joined: Apr 17, 2011
Posts: 117
Location: Amsterdam

PostPosted: Fri Sep 27, 2013 11:04 am Reply with quote

neralex wrote:


Now i have tried this one and i get no error:

Code:
      if (isset($userdata['user_id'])) {

         $sql = 'SELECT a.forum_id, ' . $a_sql . ', a.auth_mod '
                  . 'FROM `' . $prefix . '_bbauth_access` a, `' . $prefix . '_bbuser_group` ug '
                   . 'WHERE ug.`user_id` = ' . $userdata['user_id']
                     . ' AND ug.`user_pending` = 0'
                     . ' AND a.`group_id` = ug.`group_id`';
         $result = $db->sql_query($sql);
   
         if ( $row = $db->sql_fetchrow($result) ) {
            do{
                  $u_access[$row['forum_id']][] = $row;
            } while( $row = $db->sql_fetchrow($result) );
         }
      }




I find the same error in the log file many times.. should I use your code to resolve it ??

regards

_________________
We are sorry that Tony Soprano is dead, We wish Assad the Syrian maffia boss had died instead. RIP Tony 
View user's profile Send private message Visit poster's website
neralex







PostPosted: Sat Sep 28, 2013 5:08 am Reply with quote

It should work, make a backup of the old block-file, create a new one with the same name, make the changes and try it. Smile
 
neralex







PostPosted: Wed Dec 27, 2017 4:39 am Reply with quote

While testing the php7 prepared version of RN251, I stumbled again over this issue. I added Plabin's fix in the new package.

For manually fix open: /blocks/block-ForumsCollapsing.php

find:
php Code:
if ($showJumpBoxes) {

if(!defined('IN_PHPBB')) define('IN_PHPBB', TRUE);
require_once NUKE_MODULES_DIR . 'Forums/includes/constants.php';
$sql = 'SELECT c.cat_id, c.cat_title, c.cat_order

remove:
php Code:
	if(!defined('IN_PHPBB')) define('IN_PHPBB', TRUE);

require_once NUKE_MODULES_DIR . 'Forums/includes/constants.php';


find (on top):
php Code:
global $admin, $bgcolor1, $bgcolor2, $currentlang, $db, $language, $prefix, $sitename, $textcolor1, $textcolor2, $user, $userinfo, $user_prefix;

add after:
php Code:
if(!defined('IN_PHPBB')) define('IN_PHPBB', TRUE);

require_once NUKE_MODULES_DIR . 'Forums/includes/constants.php';


find:
php Code:
if (!function_exists('auth')) {

function auth($userdata) {
global $db, $prefix;

$a_sql = 'auth_view, auth_read';
$auth_fields = array('auth_view', 'auth_read');

/*
* We need to pull the auth information on the all forums
*/

$sql = 'SELECT forum_id, ' . $a_sql
. ' FROM `' . $prefix . '_bbforums`';
$result = $db->sql_query($sql);

if ( !($f_access = $db->sql_fetchrowset($result)) ) {
return array();
}

/*
* If the user isn't logged on then all we need do is check if the forum
* has the type set to ALL, if yes they are good to go, if not then they
* are denied access
*/
$u_access = array();

$sql = 'SELECT a.forum_id, ' . $a_sql . ', a.auth_mod '
. 'FROM `' . $prefix . '_bbauth_access` a, `' . $prefix . '_bbuser_group` ug '
. 'WHERE ug.user_id = ' . $userdata['user_id']
. ' AND ug.user_pending = 0'
. ' AND a.group_id = ug.group_id';
$result = $db->sql_query($sql);

if ( $row = $db->sql_fetchrow($result) ) {
do{
$u_access[$row['forum_id']][] = $row;
} while( $row = $db->sql_fetchrow($result) );
}

/*
* Is user an admin?
*/
$is_admin = ( $userdata['user_level'] == 2 ) ? TRUE : 0;

$auth_user = array();
for($i = 0; $i < count($auth_fields); $i++) {
$key = $auth_fields[$i];

/*
* If the type if ACL, MOD or ADMIN then we need to see if the user has specific permissions
* to do whatever it is they want to do ... to do this we pull relevant information for the
* user (and any groups they belong to)
*
* Now we compare the users access level against the forums. We assume here that a moderator
* and admin automatically have access to an ACL forum, similarly we assume admins meet an
* auth requirement of MOD
*/
for($k = 0; $k < count($f_access); $k++) {
$value = $f_access[$k][$key];
$f_forum_id = $f_access[$k]['forum_id'];
$u_access[$f_forum_id] = isset($u_access[$f_forum_id]) ? $u_access[$f_forum_id] : array();
switch( $value ) {
case AUTH_ALL:
$auth_user[$f_forum_id][$key] = TRUE;
break;
case AUTH_REG:
$auth_user[$f_forum_id][$key] = TRUE;
break;
case AUTH_ACL:
$auth_user[$f_forum_id][$key] = auth_check_user(AUTH_ACL, $key, $u_access[$f_forum_id], $is_admin);
break;
case AUTH_MOD:
$auth_user[$f_forum_id][$key] = auth_check_user(AUTH_MOD, 'auth_mod', $u_access[$f_forum_id], $is_admin);
break;
case AUTH_ADMIN:
$auth_user[$f_forum_id][$key] = $is_admin;
break;
default:
$auth_user[$f_forum_id][$key] = 0;
break;
}
}
}

/*
* Is user a moderator?
*/
for($k = 0; $k < count($f_access); $k++) {
$f_forum_id = $f_access[$k]['forum_id'];

$u_access[$f_forum_id] = isset($u_access[$f_forum_id]) ? $u_access[$f_forum_id] : array();
$auth_user[$f_forum_id]['auth_mod'] = auth_check_user(AUTH_MOD, 'auth_mod', $u_access[$f_forum_id], $is_admin);
}

return $auth_user;
}
}


replace it with:
php Code:
if (!function_exists('auth')) {

function auth($userdata) {
global $db, $prefix, $user;

$a_sql = 'auth_view, auth_read';
$auth_fields = array('auth_view', 'auth_read');

/*
* We need to pull the auth information on the all forums
*/

$sql = 'SELECT forum_id, ' . $a_sql
. ' FROM `' . $prefix . '_bbforums`';
$result = $db->sql_query($sql);

if ( !($f_access = $db->sql_fetchrowset($result)) ) {
return array();
}

/*
* If the user isn't logged on then all we need do is check if the forum
* has the type set to ALL, if yes they are good to go, if not then they
* are denied access
*/
$u_access = array();

if (is_user($user)) {
$sql = 'SELECT a.forum_id, ' . $a_sql . ', a.auth_mod '
. 'FROM `' . $prefix . '_bbauth_access` a, `' . $prefix . '_bbuser_group` ug '
. 'WHERE ug.user_id = ' . $userdata['user_id']
. ' AND ug.user_pending = 0'
. ' AND a.group_id = ug.group_id';
$result = $db->sql_query($sql);

if ( $row = $db->sql_fetchrow($result) ) {
do{
$u_access[$row['forum_id']][] = $row;
} while( $row = $db->sql_fetchrow($result) );
}
/*
* Is user an admin?
*/
$is_admin = ( $userdata['user_level'] == 2 ) ? TRUE : 0;
} else {
$is_admin = 0;
}

$auth_user = array();
for($i = 0; $i < count($auth_fields); $i++) {
$key = $auth_fields[$i];

/*
* If the type if ACL, MOD or ADMIN then we need to see if the user has specific permissions
* to do whatever it is they want to do ... to do this we pull relevant information for the
* user (and any groups they belong to)
*
* Now we compare the users access level against the forums. We assume here that a moderator
* and admin automatically have access to an ACL forum, similarly we assume admins meet an
* auth requirement of MOD
*/
for($k = 0; $k < count($f_access); $k++) {
$value = $f_access[$k][$key];
$f_forum_id = $f_access[$k]['forum_id'];
$u_access[$f_forum_id] = isset($u_access[$f_forum_id]) ? $u_access[$f_forum_id] : array();
switch( $value ) {
case AUTH_ALL:
$auth_user[$f_forum_id][$key] = TRUE;
break;
case AUTH_REG:
$auth_user[$f_forum_id][$key] = TRUE;
break;
case AUTH_ACL:
$auth_user[$f_forum_id][$key] = auth_check_user(AUTH_ACL, $key, $u_access[$f_forum_id], $is_admin);
break;
case AUTH_MOD:
$auth_user[$f_forum_id][$key] = auth_check_user(AUTH_MOD, 'auth_mod', $u_access[$f_forum_id], $is_admin);
break;
case AUTH_ADMIN:
$auth_user[$f_forum_id][$key] = $is_admin;
break;
default:
$auth_user[$f_forum_id][$key] = 0;
break;
}
}
}

/*
* Is user a moderator?
*/
for($k = 0; $k < count($f_access); $k++) {
$f_forum_id = $f_access[$k]['forum_id'];

$u_access[$f_forum_id] = isset($u_access[$f_forum_id]) ? $u_access[$f_forum_id] : array();
$auth_user[$f_forum_id]['auth_mod'] = auth_check_user(AUTH_MOD, 'auth_mod', $u_access[$f_forum_id], $is_admin);
}

return $auth_user;
}
}


I notcied that the same sql-error exists in the /blocks/block-Forums.php:

find:
php Code:
if (!function_exists('auth')) {

function auth($userdata) {
global $db, $prefix;

$a_sql = 'auth_view, auth_read';
$auth_fields = array('auth_view', 'auth_read');

/*
* We need to pull the auth information on the all forums
*/

$sql = 'SELECT forum_id, ' . $a_sql
. ' FROM `' . $prefix . '_bbforums`';
$result = $db->sql_query($sql);

if ( !($f_access = $db->sql_fetchrowset($result)) ) {
return array();
}

/*
* If the user isn't logged on then all we need do is check if the forum
* has the type set to ALL, if yes they are good to go, if not then they
* are denied access
*/
$u_access = array();

$sql = 'SELECT a.forum_id, ' . $a_sql . ', a.auth_mod '
. 'FROM `' . $prefix . '_bbauth_access` a, `' . $prefix . '_bbuser_group` ug '
. 'WHERE ug.user_id = ' . $userdata['user_id']
. ' AND ug.user_pending = 0'
. ' AND a.group_id = ug.group_id';
$result = $db->sql_query($sql);

if ( $row = $db->sql_fetchrow($result) ) {
do{
$u_access[$row['forum_id']][] = $row;
} while( $row = $db->sql_fetchrow($result) );
}

/*
* Is user an admin?
*/
$is_admin = ( $userdata['user_level'] == 2 ) ? TRUE : 0;

$auth_user = array();
for($i = 0; $i < count($auth_fields); $i++) {
$key = $auth_fields[$i];

/*
* If the type if ACL, MOD or ADMIN then we need to see if the user has specific permissions
* to do whatever it is they want to do ... to do this we pull relevant information for the
* user (and any groups they belong to)
*
* Now we compare the users access level against the forums. We assume here that a moderator
* and admin automatically have access to an ACL forum, similarly we assume admins meet an
* auth requirement of MOD
*/
for($k = 0; $k < count($f_access); $k++) {
$value = $f_access[$k][$key];
$f_forum_id = $f_access[$k]['forum_id'];
$u_access[$f_forum_id] = isset($u_access[$f_forum_id]) ? $u_access[$f_forum_id] : array();
switch( $value ) {
case AUTH_ALL:
$auth_user[$f_forum_id][$key] = TRUE;
break;
case AUTH_REG:
$auth_user[$f_forum_id][$key] = TRUE;
break;
case AUTH_ACL:
$auth_user[$f_forum_id][$key] = auth_check_user(AUTH_ACL, $key, $u_access[$f_forum_id], $is_admin);
break;
case AUTH_MOD:
$auth_user[$f_forum_id][$key] = auth_check_user(AUTH_MOD, 'auth_mod', $u_access[$f_forum_id], $is_admin);
break;
case AUTH_ADMIN:
$auth_user[$f_forum_id][$key] = $is_admin;
break;
default:
$auth_user[$f_forum_id][$key] = 0;
break;
}
}
}

/*
* Is user a moderator?
*/
for($k = 0; $k < count($f_access); $k++) {
$f_forum_id = $f_access[$k]['forum_id'];

$u_access[$f_forum_id] = isset($u_access[$f_forum_id]) ? $u_access[$f_forum_id] : array();
$auth_user[$f_forum_id]['auth_mod'] = auth_check_user(AUTH_MOD, 'auth_mod', $u_access[$f_forum_id], $is_admin);
}

return $auth_user;
}
}


replace it with:
php Code:
if (!function_exists('auth')) {

function auth($userdata) {
global $db, $prefix, $user;

$a_sql = 'auth_view, auth_read';
$auth_fields = array('auth_view', 'auth_read');

/*
* We need to pull the auth information on the all forums
*/

$sql = 'SELECT forum_id, ' . $a_sql
. ' FROM `' . $prefix . '_bbforums`';
$result = $db->sql_query($sql);

if ( !($f_access = $db->sql_fetchrowset($result)) ) {
return array();
}

/*
* If the user isn't logged on then all we need do is check if the forum
* has the type set to ALL, if yes they are good to go, if not then they
* are denied access
*/
$u_access = array();

if (is_user($user)) {
$sql = 'SELECT a.forum_id, ' . $a_sql . ', a.auth_mod '
. 'FROM `' . $prefix . '_bbauth_access` a, `' . $prefix . '_bbuser_group` ug '
. 'WHERE ug.user_id = ' . $userdata['user_id']
. ' AND ug.user_pending = 0'
. ' AND a.group_id = ug.group_id';
$result = $db->sql_query($sql);

if ( $row = $db->sql_fetchrow($result) ) {
do{
$u_access[$row['forum_id']][] = $row;
} while( $row = $db->sql_fetchrow($result) );
}
/*
* Is user an admin?
*/
$is_admin = ( $userdata['user_level'] == 2 ) ? TRUE : 0;
} else {
$is_admin = 0;
}

$auth_user = array();
for($i = 0; $i < count($auth_fields); $i++) {
$key = $auth_fields[$i];

/*
* If the type if ACL, MOD or ADMIN then we need to see if the user has specific permissions
* to do whatever it is they want to do ... to do this we pull relevant information for the
* user (and any groups they belong to)
*
* Now we compare the users access level against the forums. We assume here that a moderator
* and admin automatically have access to an ACL forum, similarly we assume admins meet an
* auth requirement of MOD
*/
for($k = 0; $k < count($f_access); $k++) {
$value = $f_access[$k][$key];
$f_forum_id = $f_access[$k]['forum_id'];
$u_access[$f_forum_id] = isset($u_access[$f_forum_id]) ? $u_access[$f_forum_id] : array();
switch( $value ) {
case AUTH_ALL:
$auth_user[$f_forum_id][$key] = TRUE;
break;
case AUTH_REG:
$auth_user[$f_forum_id][$key] = TRUE;
break;
case AUTH_ACL:
$auth_user[$f_forum_id][$key] = auth_check_user(AUTH_ACL, $key, $u_access[$f_forum_id], $is_admin);
break;
case AUTH_MOD:
$auth_user[$f_forum_id][$key] = auth_check_user(AUTH_MOD, 'auth_mod', $u_access[$f_forum_id], $is_admin);
break;
case AUTH_ADMIN:
$auth_user[$f_forum_id][$key] = $is_admin;
break;
default:
$auth_user[$f_forum_id][$key] = 0;
break;
}
}
}

/*
* Is user a moderator?
*/
for($k = 0; $k < count($f_access); $k++) {
$f_forum_id = $f_access[$k]['forum_id'];

$u_access[$f_forum_id] = isset($u_access[$f_forum_id]) ? $u_access[$f_forum_id] : array();
$auth_user[$f_forum_id]['auth_mod'] = auth_check_user(AUTH_MOD, 'auth_mod', $u_access[$f_forum_id], $is_admin);
}

return $auth_user;
}
}
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> RavenNuke(tm) v2.5x

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©