|
From: Jon O. <jon...@us...> - 2008-07-12 20:24:23
|
Update of /cvsroot/mxbb/core/includes/sessions/phpbb2 In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv21282/sessions/phpbb2 Modified Files: core.php session.php Log Message: Removed mx_functions_phpbb.php -> backend loaded. Index: core.php =================================================================== RCS file: /cvsroot/mxbb/core/includes/sessions/phpbb2/core.php,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** core.php 11 Jul 2008 23:03:30 -0000 1.5 --- core.php 12 Jul 2008 20:24:15 -0000 1.6 *************** *** 79,82 **** --- 79,149 ---- return $auth_data_sql; } + + /** + * function mx_acl_getfignore() + * $auth_level_read can be a value or array; + * $ignore_forum_ids can have this sintax: forum_id(1), forum_id(2), ..., forum_is(n); + * 1st test 25.06.2008 by FlorinCB + */ + function mx_acl_getfignore($auth_level_read, $ignore_forum_ids) + { + global $phpbb_root_path, $mx_user; + + $ignore_forum_ids = ($ignore_forum_ids) ? $ignore_forum_ids : ''; + + $auth_user = array(); + + if (is_array($auth_level_read)) + { + foreach ($auth_level_read as $auth_level) + { + $auth_user = $this->auth($auth_level, AUTH_LIST_ALL, $mx_user->data); + + if ($num_forums = count($auth_user)) + { + while ( list($forum_id, $auth_mod) = each($auth_user) ) + { + $unauthed = false; + + if (!$auth_mod[$auth_level] && ( strstr($ignore_forum_ids,$auth_mod['forum_id']) === FALSE)) + { + $unauthed = true; + } + + if ($unauthed) + { + $ignore_forum_ids .= ($ignore_forum_ids) ? ',' . $forum_id : $forum_id; + } + } + } + unset($auth_level_read); + } + } + elseif ($auth_level_read) + { + $auth_user = $this->auth($auth_level_read, AUTH_LIST_ALL, $mx_user->data); + + if ($num_forums = count($auth_user)) + { + while ( list($forum_id, $auth_mod) = each($auth_user) ) + { + $unauthed = false; + + if (!$auth_mod[$auth_level] && ( strstr($ignore_forum_ids,$auth_mod['forum_id']) === FALSE)) + { + $unauthed = true; + } + + if ($unauthed) + { + $ignore_forum_ids .= ($ignore_forum_ids) ? ',' . $forum_id : $forum_id; + } + } + } + + } + $ignore_forum_ids = ($ignore_forum_ids) ? $ignore_forum_ids : 0; + return $ignore_forum_ids; + } } *************** *** 158,173 **** define('PORTAL_VERSION', $portal_config['portal_version']); ! if( @file_exists($phpbb_root_path . 'includes/class_config.' . $phpEx) && @file_exists($phpbb_root_path . 'includes/class_groups.' . $phpEx) ) ! { ! include($mx_root_path . 'includes/mx_functions_ch.'.$phpEx); ! } ! else ! { ! // ! // Grab phpBB global variables, re-cache if necessary ! // - optional parameter to enable/disable cache for config data. If enabled, remember to refresh the MX-Publisher cache whenever updating phpBB config settings ! // - true: enable cache, false: disable cache ! $board_config = $this->obtain_phpbb_config(false); ! } $script_name_phpbb = preg_replace('/^\/?(.*?)\/?$/', "\\1", trim($board_config['script_path'])) . '/'; --- 225,233 ---- define('PORTAL_VERSION', $portal_config['portal_version']); ! // ! // Grab phpBB global variables, re-cache if necessary ! // - optional parameter to enable/disable cache for config data. If enabled, remember to refresh the MX-Publisher cache whenever updating phpBB config settings ! // - true: enable cache, false: disable cache ! $board_config = $this->obtain_phpbb_config(false); $script_name_phpbb = preg_replace('/^\/?(.*?)\/?$/', "\\1", trim($board_config['script_path'])) . '/'; *************** *** 302,311 **** /** ! * _load_file * * @param unknown_type $force_shared * @access private */ ! function _load_file($force_shared) { global $mx_root_path, $phpbb_root_path, $phpEx; --- 362,371 ---- /** ! * load_file * * @param unknown_type $force_shared * @access private */ ! function load_file($force_shared) { global $mx_root_path, $phpbb_root_path, $phpEx; *************** *** 333,336 **** --- 393,533 ---- /** + * dss_rand + * + * @param unknown_type $force_shared + * @access private + */ + function dss_rand($force_shared) + { + global $db, $portal_config, $board_config, $dss_seeded; + + $val = $board_config['rand_seed'] . microtime(); + $val = md5($val); + $board_config['rand_seed'] = md5($board_config['rand_seed'] . $val . 'a'); + + if($dss_seeded !== true) + { + $sql = "UPDATE " . CONFIG_TABLE . " SET + config_value = '" . $board_config['rand_seed'] . "' + WHERE config_name = 'rand_seed'"; + + if( !$db->sql_query($sql) ) + { + mx_message_die(GENERAL_ERROR, "Unable to reseed PRNG", "", __LINE__, __FILE__, $sql); + } + + $dss_seeded = true; + } + + return substr($val, 4, 16); + } + + function make_jumpbox($action, $match_forum_id = 0) + { + global $template, $userdata, $lang, $db, $nav_links, $phpEx, $SID; + + // $is_auth = auth(AUTH_VIEW, AUTH_LIST_ALL, $userdata); + + $sql = "SELECT c.cat_id, c.cat_title, c.cat_order + FROM " . CATEGORIES_TABLE . " c, " . FORUMS_TABLE . " f + WHERE f.cat_id = c.cat_id + GROUP BY c.cat_id, c.cat_title, c.cat_order + ORDER BY c.cat_order"; + if ( !($result = $db->sql_query($sql)) ) + { + message_die(GENERAL_ERROR, "Couldn't obtain category list.", "", __LINE__, __FILE__, $sql); + } + + $category_rows = array(); + while ( $row = $db->sql_fetchrow($result) ) + { + $category_rows[] = $row; + } + + if ( $total_categories = count($category_rows) ) + { + $sql = "SELECT * + FROM " . FORUMS_TABLE . " + ORDER BY cat_id, forum_order"; + if ( !($result = $db->sql_query($sql)) ) + { + message_die(GENERAL_ERROR, 'Could not obtain forums information', '', __LINE__, __FILE__, $sql); + } + + $boxstring = '<select name="' . POST_FORUM_URL . '" onchange="if(this.options[this.selectedIndex].value != -1){ forms[\'jumpbox\'].submit() }"><option value="-1">' . $lang['Select_forum'] . '</option>'; + + $forum_rows = array(); + while ( $row = $db->sql_fetchrow($result) ) + { + $forum_rows[] = $row; + } + + if ( $total_forums = count($forum_rows) ) + { + for($i = 0; $i < $total_categories; $i++) + { + $boxstring_forums = ''; + for($j = 0; $j < $total_forums; $j++) + { + if ( $forum_rows[$j]['cat_id'] == $category_rows[$i]['cat_id'] && $forum_rows[$j]['auth_view'] <= AUTH_REG ) + { + + // if ( $forum_rows[$j]['cat_id'] == $category_rows[$i]['cat_id'] && $is_auth[$forum_rows[$j]['forum_id']]['auth_view'] ) + // { + $selected = ( $forum_rows[$j]['forum_id'] == $match_forum_id ) ? 'selected="selected"' : ''; + $boxstring_forums .= '<option value="' . $forum_rows[$j]['forum_id'] . '"' . $selected . '>' . $forum_rows[$j]['forum_name'] . '</option>'; + + // + // Add an array to $nav_links for the Mozilla navigation bar. + // 'chapter' and 'forum' can create multiple items, therefore we are using a nested array. + // + $nav_links['chapter forum'][$forum_rows[$j]['forum_id']] = array ( + 'url' => mx_append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=" . $forum_rows[$j]['forum_id']), + 'title' => $forum_rows[$j]['forum_name'] + ); + + } + } + + if ( $boxstring_forums != '' ) + { + $boxstring .= '<option value="-1"> </option>'; + $boxstring .= '<option value="-1">' . $category_rows[$i]['cat_title'] . '</option>'; + $boxstring .= '<option value="-1">----------------</option>'; + $boxstring .= $boxstring_forums; + } + } + } + + $boxstring .= '</select>'; + } + else + { + $boxstring .= '<select name="' . POST_FORUM_URL . '" onchange="if(this.options[this.selectedIndex].value != -1){ forms[\'jumpbox\'].submit() }"></select>'; + } + + // Let the jumpbox work again in sites having additional session id checks. + // if ( !empty($SID) ) + // { + $boxstring .= '<input type="hidden" name="sid" value="' . $userdata['session_id'] . '" />'; + // } + + $template->set_filenames(array( + 'jumpbox' => 'jumpbox.tpl') + ); + $template->assign_vars(array( + 'L_GO' => $lang['Go'], + 'L_JUMP_TO' => $lang['Jump_to'], + 'L_SELECT_FORUM' => $lang['Select_forum'], + + 'S_JUMPBOX_SELECT' => $boxstring, + 'S_JUMPBOX_ACTION' => mx_append_sid($action)) + ); + $template->assign_var_from_handle('JUMPBOX', 'jumpbox'); + + return; + } + + /** * Backend specific Page Header data * *************** *** 561,563 **** --- 758,798 ---- } } + + /** + * Get 'Poll Select' html select list. + * + * Quick and handy function to generate a dropdown select list for current phpbb polls + * + * @param string $default_poll select idfield = id + * @param string $select_name select name + * @return string (html) + */ + function poll_select($default_poll, $select_name = 'Poll_Topic_id') + { + global $db; + + $style_select = '<select name="' . $select_name . '">'; + $selected = ( $default_poll == 0 ) ? ' selected="selected"' : ''; + $style_select .= '<option value="0"' . $selected . '>' . 'The most recent' . "</option>\n"; + + $sql = "SELECT topic_id, vote_text + FROM " . VOTE_DESC_TABLE . " + ORDER BY vote_text, topic_id"; + + if( !($result = $db->sql_query($sql)) ) + { + mx_message_die(GENERAL_ERROR, "Couldn't query polls table", '', __LINE__, __FILE__, $sql); + } + + while( $row = $db->sql_fetchrow($result) ) + { + $selected = ( $row['topic_id'] == $default_poll ) ? ' selected="selected"' : ''; + $style_select .= '<option value="' . $row['topic_id'] . '"' . $selected . '>' . $row['vote_text'] . "</option>\n"; + } + $style_select .= '</select>'; + + unset($row); + $db->sql_freeresult($result); + return $style_select; + } ?> \ No newline at end of file Index: session.php =================================================================== RCS file: /cvsroot/mxbb/core/includes/sessions/phpbb2/session.php,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** session.php 10 Jul 2008 23:23:16 -0000 1.11 --- session.php 12 Jul 2008 20:24:16 -0000 1.12 *************** *** 23,29 **** class session { - // - // phpBB3 duplicates - // var $cookie_data = array(); var $page = array(); --- 23,26 ---- *************** *** 71,75 **** function session_begin($user_id, $user_ip, $page_id, $auto_create = 0, $enable_autologin = 0, $admin = 0) { ! global $db, $board_config; global $mx_request_vars, $SID; --- 68,72 ---- function session_begin($user_id, $user_ip, $page_id, $auto_create = 0, $enable_autologin = 0, $admin = 0) { ! global $db, $board_config, $mx_backend; global $mx_request_vars, $SID; *************** *** 222,226 **** if ( !$db->sql_query($sql) || !$db->sql_affectedrows() ) { ! $session_id = md5(mx_dss_rand()); $sql = "INSERT INTO " . SESSIONS_TABLE . " --- 219,223 ---- if ( !$db->sql_query($sql) || !$db->sql_affectedrows() ) { ! $session_id = md5($mx_backend->dss_rand()); $sql = "INSERT INTO " . SESSIONS_TABLE . " *************** *** 554,558 **** function session_reset_keys($user_id, $user_ip) { ! global $db, $userdata, $board_config; $key_sql = ($user_id == $userdata['user_id'] && !empty($userdata['session_key'])) ? "AND key_id != '" . md5($userdata['session_key']) . "'" : ''; --- 551,555 ---- function session_reset_keys($user_id, $user_ip) { ! global $db, $userdata, $board_config, $mx_backend; $key_sql = ($user_id == $userdata['user_id'] && !empty($userdata['session_key'])) ? "AND key_id != '" . md5($userdata['session_key']) . "'" : ''; *************** *** 578,582 **** if ( !empty($key_sql) ) { ! $auto_login_key = mx_dss_rand() . mx_dss_rand(); $current_time = time(); --- 575,579 ---- if ( !empty($key_sql) ) { ! $auto_login_key = $mx_backend->dss_rand() . $mx_backend->dss_rand(); $current_time = time(); |