|
From: Jon O. <jon...@us...> - 2008-07-11 22:46:09
|
Update of /cvsroot/mxbb/core/includes/sessions/phpbb2 In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv7216/sessions/phpbb2 Modified Files: core.php Log Message: Moving phpbb_auth to backends... Index: core.php =================================================================== RCS file: /cvsroot/mxbb/core/includes/sessions/phpbb2/core.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** core.php 11 Jul 2008 22:00:23 -0000 1.3 --- core.php 11 Jul 2008 22:46:06 -0000 1.4 *************** *** 15,18 **** --- 15,89 ---- } + // + // 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); + + include_once($phpbb_root_path . 'includes/functions.' . $phpEx); // In case we need old functions... + include_once($mx_root_path . 'includes/sessions/phpbb2/auth.' . $phpEx); + + /** + * 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. + // + $is_auth_ary = $this->auth(AUTH_VIEW, AUTH_LIST_ALL, $userdata); + + // + // 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 ) + { + if( ($is_auth_row['auth_view']) ) + { + $auth_data_sql .= ( $auth_data_sql != '' ) ? ', ' . $fid : $fid; + } + } + + 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(); /** |