|
From: Jon O. <jon...@us...> - 2008-07-11 22:46:09
|
Update of /cvsroot/mxbb/core/includes In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv7216 Modified Files: mx_functions_phpbb.php Log Message: Moving phpbb_auth to backends... Index: mx_functions_phpbb.php =================================================================== RCS file: /cvsroot/mxbb/core/includes/mx_functions_phpbb.php,v retrieving revision 1.73 retrieving revision 1.74 diff -C2 -d -r1.73 -r1.74 *** mx_functions_phpbb.php 10 Jul 2008 23:02:05 -0000 1.73 --- mx_functions_phpbb.php 11 Jul 2008 22:46:04 -0000 1.74 *************** *** 15,142 **** } - // - // First off, include common vanilla phpBB functions, from our shared dir - // Note: These functions will later be accessible wrapped as phpBBX::orig_functionname() - // - include($mx_root_path . 'includes/shared/phpbb2/includes/functions.' . $phpEx); - include($mx_root_path . 'includes/shared/phpbb3/includes/functions.' . $phpEx); - - // - // Switch - // - switch (PORTAL_BACKEND) - { - case 'internal': - case 'phpbb2': - include_once($phpbb_root_path . 'includes/functions.' . $phpEx); // In case we need old functions... - include_once($mx_root_path . 'includes/sessions/phpbb2/auth.' . $phpEx); - break; - case 'phpbb3': - include_once($mx_root_path . 'includes/sessions/phpbb3/auth.' . $phpEx); - break; - } - - /** - * Permission/Auth class - * - * @package MX-Publisher - * - */ - class phpbb_auth extends phpbb_auth_base - { - /** - * get_auth_forum - * - * @param unknown_type $mode - * @return unknown - */ - function get_auth_forum($mode = 'phpbb') - { - global $userdata, $mx_root_path, $phpEx; - - // - // Try to reuse auth_view query result. - // - $userdata_key = 'mx_get_auth_' . $mode . $userdata['user_id']; - if( !empty($userdata[$userdata_key]) ) - { - $auth_data_sql = $userdata[$userdata_key]; - return $auth_data_sql; - } - - // - // Now, this tries to optimize DB access involved in auth(), - // passing AUTH_LIST_ALL will load info for all forums at once. - // - if( $mode == 'kb' ) - { - if (file_exists($mx_root_path . 'modules/mx_kb/kb/includes/functions_auth.' . $phpEx)) - { - include_once($mx_root_path . 'modules/mx_kb/kb/includes/functions_auth.' . $phpEx); - $mx_kb_auth = new mx_kb_auth(); - $mx_kb_auth->auth(AUTH_VIEW, AUTH_LIST_ALL, $userdata); - $is_auth_ary = $mx_kb_auth->auth_user; - } - else - { - include_once($mx_root_path . 'modules/mx_kb/includes/functions_kb_auth.' . $phpEx); - $is_auth_ary = auth(AUTH_VIEW, AUTH_LIST_ALL, $userdata); - } - } - else - { - switch (PORTAL_BACKEND) - { - case 'internal': - case 'phpbb2': - $is_auth_ary = $this->auth(AUTH_VIEW, AUTH_LIST_ALL, $userdata); - break; - case 'phpbb3': - $is_auth_ary = $this->acl_getf('f_read', false); - //die('get_forum_auth'.var_export($is_auth_ary)); - break; - } - } - - // - // Loop through the list of forums to retrieve the ids for - // those with AUTH_VIEW allowed. - // - $auth_data_sql = ''; - foreach( $is_auth_ary as $fid => $is_auth_row ) - { - switch (PORTAL_BACKEND) - { - case 'internal': - case 'phpbb2': - if( ($is_auth_row['auth_view']) ) - { - $auth_data_sql .= ( $auth_data_sql != '' ) ? ', ' . $fid : $fid; - } - break; - case 'phpbb3': - if( ($is_auth_row['f_read']) ) - { - $auth_data_sql .= ( $auth_data_sql != '' ) ? ', ' . $fid : $fid; - } - break; - } - } - - if( empty($auth_data_sql) ) - { - $auth_data_sql = -1; - } - - $userdata[$userdata_key] = $auth_data_sql; - return $auth_data_sql; - } - } - - // - // Init the phpbb_auth class - // - $phpbb_auth = new phpbb_auth(); - /** * function mx_acl_getfignore() --- 15,18 ---- |