|
From: Jon O. <jon...@us...> - 2005-12-05 19:25:35
|
Update of /cvsroot/mxbb/core27x In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23896/core27x Modified Files: common.php extension.inc index.php mx_announce.php mx_forum.php mx_google.php mx_language.php mx_login.php mx_online.php mx_poll.php mx_theme.php Log Message: updated Index: mx_poll.php =================================================================== RCS file: /cvsroot/mxbb/core27x/mx_poll.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** mx_poll.php 26 May 2005 21:54:08 -0000 1.2 --- mx_poll.php 5 Dec 2005 19:25:26 -0000 1.3 *************** *** 1,13 **** <?php ! /*************************************************************************** ! * mx-poll.php ! * ------------------- ! * begin : April, 2002 ! * copyright : (C) 2002 MX-System ! * email : su...@mx... ! * ! * $Id$ ! * ! ***************************************************************************/ if( !defined('IN_PORTAL') ) --- 1,21 ---- <?php ! /** ------------------------------------------------------------------------ ! * subject : mx-portal, CMS & portal ! * begin : june, 2002 ! * copyright : (C) 2002-2005 MX-System ! * email : jon...@ho... ! * project site : www.mx-system.com ! * ! * description : ! * ------------------------------------------------------------------------- ! * $Id$ ! */ ! ! /** ! * This program is free software; you can redistribute it and/or modify ! * it under the terms of the GNU General Public License as published by ! * the Free Software Foundation; either version 2 of the License, or ! * (at your option) any later version. ! */ if( !defined('IN_PORTAL') ) *************** *** 76,81 **** $sql = "SELECT vd.vote_id FROM " . VOTE_DESC_TABLE . " vd, " . VOTE_RESULTS_TABLE . " vr ! WHERE vd.topic_id = $topic_id ! AND vr.vote_id = vd.vote_id AND vr.vote_option_id = $vote_option_id GROUP BY vd.vote_id"; --- 84,89 ---- $sql = "SELECT vd.vote_id FROM " . VOTE_DESC_TABLE . " vd, " . VOTE_RESULTS_TABLE . " vr ! WHERE vd.topic_id = $topic_id ! AND vr.vote_id = vd.vote_id AND vr.vote_option_id = $vote_option_id GROUP BY vd.vote_id"; *************** *** 90,95 **** $sql = "SELECT * ! FROM " . VOTE_USERS_TABLE . " ! WHERE vote_id = $vote_id AND vote_user_id = " . $userdata['user_id']; if ( !($result2 = $db->sql_query($sql)) ) --- 98,103 ---- $sql = "SELECT * ! FROM " . VOTE_USERS_TABLE . " ! WHERE vote_id = $vote_id AND vote_user_id = " . $userdata['user_id']; if ( !($result2 = $db->sql_query($sql)) ) *************** *** 101,106 **** { $sql = "UPDATE " . VOTE_RESULTS_TABLE . " ! SET vote_result = vote_result + 1 ! WHERE vote_id = $vote_id AND vote_option_id = $vote_option_id"; if ( !$db->sql_query($sql, BEGIN_TRANSACTION) ) --- 109,114 ---- { $sql = "UPDATE " . VOTE_RESULTS_TABLE . " ! SET vote_result = vote_result + 1 ! WHERE vote_id = $vote_id AND vote_option_id = $vote_option_id"; if ( !$db->sql_query($sql, BEGIN_TRANSACTION) ) *************** *** 113,117 **** if ( !$db->sql_query($sql, END_TRANSACTION) ) { ! mx_message_die(GENERAL_ERROR, "Could not insert user_id for poll", "", __LINE__, __FILE__, $sql); } --- 121,125 ---- if ( !$db->sql_query($sql, END_TRANSACTION) ) { ! mx_message_die(GENERAL_ERROR, "Could not insert user_id for poll", '', __LINE__, __FILE__, $sql); } *************** *** 146,150 **** // Does this topic contain a poll? // ! if ( !empty($topic_id) ) { $s_hidden_fields = ''; --- 154,158 ---- // Does this topic contain a poll? // ! //if ( !empty($forum_topic_data['topic_vote']) ) { $s_hidden_fields = ''; *************** *** 209,213 **** for($i = 0; $i < $vote_options; $i++) { ! $vote_percent = ( $vote_results_sum > 0 ) ? $vote_info[$i]['vote_result'] / $vote_results_sum : 0; $vote_graphic_length = is_numeric($block_size) ? round($vote_percent * ( $block_size - 50 )) : $vote_percent * 400; --- 217,221 ---- for($i = 0; $i < $vote_options; $i++) { ! $vote_percent = ( $vote_results_sum > 0 ) ? $vote_info[$i]['vote_result'] / $vote_results_sum : 0; $vote_graphic_length = is_numeric($block_size) ? round($vote_percent * ( $block_size - 50 )) : $vote_percent * 400; *************** *** 220,224 **** } ! $template->assign_block_vars("poll_option", array( 'POLL_OPTION_CAPTION' => $vote_info[$i]['vote_option_text'], 'POLL_OPTION_RESULT' => $vote_info[$i]['vote_result'], --- 228,232 ---- } ! $template->assign_block_vars('poll_option', array( 'POLL_OPTION_CAPTION' => $vote_info[$i]['vote_option_text'], 'POLL_OPTION_RESULT' => $vote_info[$i]['vote_result'], *************** *** 235,239 **** 'TEMPLATE_ROOT_PATH' => TEMPLATE_ROOT_PATH, 'L_TOTAL_VOTES' => $lang['Total_votes'], ! 'TOTAL_VOTES' => $vote_results_sum) ); --- 243,248 ---- 'TEMPLATE_ROOT_PATH' => TEMPLATE_ROOT_PATH, 'L_TOTAL_VOTES' => $lang['Total_votes'], ! 'TOTAL_VOTES' => $vote_results_sum, ! 'U_URL' => append_sid(PHPBB_URL . "viewtopic.$phpEx?t=$topic_id")) ); *************** *** 287,291 **** $template->pparse('pollbox'); } - } ?> \ No newline at end of file --- 296,301 ---- $template->pparse('pollbox'); } + } + ?> \ No newline at end of file Index: extension.inc =================================================================== RCS file: /cvsroot/mxbb/core27x/extension.inc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** extension.inc 6 May 2005 06:47:57 -0000 1.1 --- extension.inc 5 Dec 2005 19:25:26 -0000 1.2 *************** *** 1,15 **** <?php ! /*************************************************************************** ! * extension.inc ! * ------------------- ! * begin : Saturday, Feb 13, 2001 ! * copyright : (C) 2001 The phpBB Group ! * email : su...@ph... ! * * $Id$ ! * ! * ! ***************************************************************************/ if ( !defined('IN_PORTAL') ) { --- 1,27 ---- <?php ! /** ------------------------------------------------------------------------ ! * subject : mx-portal, CMS & portal ! * begin : june, 2002 ! * copyright : (C) 2002-2005 MX-System ! * email : jon...@ho... ! * project site : www.mx-system.com ! * ! * description : ! * ------------------------------------------------------------------------- ! * copyright : (C) 2001 The phpBB Group ! * email : su...@ph... ! * * $Id$ ! * ! * ! ***************************************************************************/ + /** + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + if ( !defined('IN_PORTAL') ) { Index: mx_online.php =================================================================== RCS file: /cvsroot/mxbb/core27x/mx_online.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** mx_online.php 26 May 2005 21:54:08 -0000 1.2 --- mx_online.php 5 Dec 2005 19:25:26 -0000 1.3 *************** *** 24,27 **** --- 24,28 ---- } + // ================================================================================ // The following code is backported from includes/page_header.php (phpBB 2.0.13) *************** *** 38,194 **** $l_online_users = ''; ! $sql = "SELECT u.username, u.user_id, u.user_allow_viewonline, u.user_level, s.session_logged_in, s.session_ip ! FROM ".USERS_TABLE." u, ".SESSIONS_TABLE." s ! WHERE u.user_id = s.session_user_id ! AND s.session_time >= ".( time() - 300 ) . " ! ORDER BY u.username ASC, s.session_ip ASC"; ! ! if( !($result = $db->sql_query($sql)) ) { - message_die(GENERAL_ERROR, 'Could not obtain user/online information', '', __LINE__, __FILE__, $sql); - } - $userlist_ary = array(); - $userlist_visible = array(); ! $prev_user_id = 0; ! $prev_user_ip = $prev_session_ip = ''; ! while( $row = $db->sql_fetchrow($result) ) ! { ! // User is logged in and therefor not a guest ! if ( $row['session_logged_in'] ) { ! // Skip multiple sessions for one user ! if ( $row['user_id'] != $prev_user_id ) { ! $style_color = ''; ! if ( $row['user_level'] == ADMIN ) ! { ! $row['username'] = '<b>' . $row['username'] . '</b>'; ! $style_color = 'style="color:#' . $theme['fontcolor3'] . '"'; ! } ! else if ( $row['user_level'] == MOD ) ! { ! $row['username'] = '<b>' . $row['username'] . '</b>'; ! $style_color = 'style="color:#' . $theme['fontcolor2'] . '"'; ! } ! if ( $row['user_allow_viewonline'] ) ! { ! $user_online_link = '<a href="' . append_sid(PHPBB_URL."profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $row['user_id']) . '"' . $style_color .'>' . $row['username'] . '</a>'; ! $logged_visible_online++; ! } ! else { ! $user_online_link = '<a href="' . append_sid(PHPBB_URL."profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $row['user_id']) . '"' . $style_color .'><i>' . $row['username'] . '</i></a>'; ! $logged_hidden_online++; } ! if ( $row['user_allow_viewonline'] || $userdata['user_level'] == ADMIN ) { ! $online_userlist .= ( $online_userlist != '' ) ? ', ' . $user_online_link : $user_online_link; } } ! $prev_user_id = $row['user_id']; } ! else { ! // Skip multiple sessions for one user ! if ( $row['session_ip'] != $prev_session_ip ) ! { ! $guests_online++; ! } } ! $prev_session_ip = $row['session_ip']; ! } ! $db->sql_freeresult($result); ! if ( empty($online_userlist) ) ! { ! $online_userlist = $lang['None']; ! } ! $online_userlist = ( ( isset($forum_id) ) ? $lang['Browsing_forum'] : $lang['Registered_users'] ) . ' ' . $online_userlist; ! $total_online_users = $logged_visible_online + $logged_hidden_online + $guests_online; ! if ( $total_online_users > $board_config['record_online_users']) ! { ! $board_config['record_online_users'] = $total_online_users; ! $board_config['record_online_date'] = time(); ! $sql = "UPDATE " . CONFIG_TABLE . " ! SET config_value = '$total_online_users' ! WHERE config_name = 'record_online_users'"; ! if ( !$db->sql_query($sql) ) ! { ! message_die(GENERAL_ERROR, 'Could not update online user record (nr of users)', '', __LINE__, __FILE__, $sql); } ! $sql = "UPDATE " . CONFIG_TABLE . " ! SET config_value = '" . $board_config['record_online_date'] . "' ! WHERE config_name = 'record_online_date'"; ! if ( !$db->sql_query($sql) ) { ! message_die(GENERAL_ERROR, 'Could not update online user record (date)', '', __LINE__, __FILE__, $sql); } - } ! if ( $total_online_users == 0 ) ! { ! $l_t_user_s = $lang['Online_users_zero_total']; ! } ! else if ( $total_online_users == 1 ) ! { ! $l_t_user_s = $lang['Online_user_total']; ! } ! else ! { ! $l_t_user_s = $lang['Online_users_total']; ! } ! if ( $logged_visible_online == 0 ) ! { ! $l_r_user_s = $lang['Reg_users_zero_total']; ! } ! else if ( $logged_visible_online == 1 ) ! { ! $l_r_user_s = $lang['Reg_user_total']; ! } ! else ! { ! $l_r_user_s = $lang['Reg_users_total']; ! } ! if ( $logged_hidden_online == 0 ) ! { ! $l_h_user_s = $lang['Hidden_users_zero_total']; ! } ! else if ( $logged_hidden_online == 1 ) ! { ! $l_h_user_s = $lang['Hidden_user_total']; ! } ! else ! { ! $l_h_user_s = $lang['Hidden_users_total']; ! } ! if ( $guests_online == 0 ) ! { ! $l_g_user_s = $lang['Guest_users_zero_total']; ! } ! else if ( $guests_online == 1 ) ! { ! $l_g_user_s = $lang['Guest_user_total']; ! } ! else ! { ! $l_g_user_s = $lang['Guest_users_total']; } - $l_online_users = sprintf($l_t_user_s, $total_online_users); - $l_online_users .= sprintf($l_r_user_s, $logged_visible_online); - $l_online_users .= sprintf($l_h_user_s, $logged_hidden_online); - $l_online_users .= sprintf($l_g_user_s, $guests_online); - // ================================================================================ // The following code is backported from index.php (phpBB 2.0.13) --- 39,203 ---- $l_online_users = ''; ! //if (defined('SHOW_ONLINE')) { ! $sql = "SELECT u.username, u.user_id, u.user_allow_viewonline, u.user_level, s.session_logged_in, s.session_ip ! FROM ".USERS_TABLE." u, ".SESSIONS_TABLE." s ! WHERE u.user_id = s.session_user_id ! AND s.session_time >= ".( time() - 300 ) . " ! ORDER BY u.username ASC, s.session_ip ASC"; ! if( !($result = $db->sql_query($sql)) ) { ! message_die(GENERAL_ERROR, 'Could not obtain user/online information', '', __LINE__, __FILE__, $sql); ! } ! ! $userlist_ary = array(); ! $userlist_visible = array(); ! ! $prev_user_id = 0; ! $prev_user_ip = $prev_session_ip = ''; ! ! while( $row = $db->sql_fetchrow($result) ) ! { ! // User is logged in and therefor not a guest ! if ( $row['session_logged_in'] ) { ! // Skip multiple sessions for one user ! if ( $row['user_id'] != $prev_user_id ) { ! $style_color = ''; ! if ( $row['user_level'] == ADMIN ) ! { ! $row['username'] = '<b>' . $row['username'] . '</b>'; ! $style_color = 'style="color:#' . $theme['fontcolor3'] . '"'; ! } ! else if ( $row['user_level'] == MOD ) ! { ! $row['username'] = '<b>' . $row['username'] . '</b>'; ! $style_color = 'style="color:#' . $theme['fontcolor2'] . '"'; ! } ! ! if ( $row['user_allow_viewonline'] ) ! { ! $user_online_link = '<a href="' . append_sid(PHPBB_URL."profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $row['user_id']) . '"' . $style_color .'>' . $row['username'] . '</a>'; ! $logged_visible_online++; ! } ! else ! { ! $user_online_link = '<a href="' . append_sid(PHPBB_URL."profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $row['user_id']) . '"' . $style_color .'><i>' . $row['username'] . '</i></a>'; ! $logged_hidden_online++; ! } ! ! if ( $row['user_allow_viewonline'] || $userdata['user_level'] == ADMIN ) ! { ! $online_userlist .= ( $online_userlist != '' ) ? ', ' . $user_online_link : $user_online_link; ! } } ! ! $prev_user_id = $row['user_id']; ! } ! else ! { ! // Skip multiple sessions for one user ! if ( $row['session_ip'] != $prev_session_ip ) { ! $guests_online++; } } ! $prev_session_ip = $row['session_ip']; } ! $db->sql_freeresult($result); ! ! if ( empty($online_userlist) ) { ! $online_userlist = $lang['None']; } ! $online_userlist = ( ( isset($forum_id) ) ? $lang['Browsing_forum'] : $lang['Registered_users'] ) . ' ' . $online_userlist; ! $total_online_users = $logged_visible_online + $logged_hidden_online + $guests_online; ! if ( $total_online_users > $board_config['record_online_users']) ! { ! $board_config['record_online_users'] = $total_online_users; ! $board_config['record_online_date'] = time(); ! $sql = "UPDATE " . CONFIG_TABLE . " ! SET config_value = '$total_online_users' ! WHERE config_name = 'record_online_users'"; ! if ( !$db->sql_query($sql) ) ! { ! message_die(GENERAL_ERROR, 'Could not update online user record (nr of users)', '', __LINE__, __FILE__, $sql); ! } ! $sql = "UPDATE " . CONFIG_TABLE . " ! SET config_value = '" . $board_config['record_online_date'] . "' ! WHERE config_name = 'record_online_date'"; ! if ( !$db->sql_query($sql) ) ! { ! message_die(GENERAL_ERROR, 'Could not update online user record (date)', '', __LINE__, __FILE__, $sql); ! } } ! if ( $total_online_users == 0 ) { ! $l_t_user_s = $lang['Online_users_zero_total']; ! } ! else if ( $total_online_users == 1 ) ! { ! $l_t_user_s = $lang['Online_user_total']; ! } ! else ! { ! $l_t_user_s = $lang['Online_users_total']; } ! if ( $logged_visible_online == 0 ) ! { ! $l_r_user_s = $lang['Reg_users_zero_total']; ! } ! else if ( $logged_visible_online == 1 ) ! { ! $l_r_user_s = $lang['Reg_user_total']; ! } ! else ! { ! $l_r_user_s = $lang['Reg_users_total']; ! } ! if ( $logged_hidden_online == 0 ) ! { ! $l_h_user_s = $lang['Hidden_users_zero_total']; ! } ! else if ( $logged_hidden_online == 1 ) ! { ! $l_h_user_s = $lang['Hidden_user_total']; ! } ! else ! { ! $l_h_user_s = $lang['Hidden_users_total']; ! } ! if ( $guests_online == 0 ) ! { ! $l_g_user_s = $lang['Guest_users_zero_total']; ! } ! else if ( $guests_online == 1 ) ! { ! $l_g_user_s = $lang['Guest_user_total']; ! } ! else ! { ! $l_g_user_s = $lang['Guest_users_total']; ! } ! $l_online_users = sprintf($l_t_user_s, $total_online_users); ! $l_online_users .= sprintf($l_r_user_s, $logged_visible_online); ! $l_online_users .= sprintf($l_h_user_s, $logged_hidden_online); ! $l_online_users .= sprintf($l_g_user_s, $guests_online); } // ================================================================================ // The following code is backported from index.php (phpBB 2.0.13) Index: index.php =================================================================== RCS file: /cvsroot/mxbb/core27x/index.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** index.php 26 May 2005 21:54:08 -0000 1.2 --- index.php 5 Dec 2005 19:25:26 -0000 1.3 *************** *** 1,46 **** <?php ! /*************************************************************************** ! * mx-portal.php ! * ------------------- ! * begin : Juillet, 2002 ! * copyright : (C) 2002 MX-System ! * email : su...@mx... ! * ! * $Id$ ! * ! ***************************************************************************/ ! ! /*************************************************************************** ! * ! * This program is free software; you can redistribute it and/or modify ! * it under the terms of the GNU General Public License as published by ! * the Free Software Foundation; either version 2 of the License, or ! * (at your option) any later version. ! * ! ***************************************************************************/ ! define('IN_PORTAL', 1); ! $mx_root_path = './'; ! include_once($mx_root_path . 'extension.inc'); ! include_once($mx_root_path . 'common.'.$phpEx); ! // ! // Start session management ! // ! $userdata = session_pagestart($user_ip, PAGE_INDEX); ! mx_init_userprefs($userdata); // ! // End session management // ! $view_page = FALSE; // ! // Page selector // ! $page_id = $mx_request_vars->request('page', MX_TYPE_INT, 1); // --- 1,47 ---- <?php ! /** ------------------------------------------------------------------------ ! * subject : mx-portal, CMS & portal ! * author : jon ohlsson, marc morisette and the MX-Team ! * credits : 2001 The phpBB Group ! * begin : june, 2002 ! * copyright : (C) 2002-2005 MX-System ! * email : jon...@ho... ! * project site : www.mx-system.com ! * ! * description : the main mx-portal file ! * ------------------------------------------------------------------------- ! * ! * $Id$ ! */ ! /** ! * This program is free software; you can redistribute it and/or modify ! * it under the terms of the GNU General Public License as published by ! * the Free Software Foundation; either version 2 of the License, or ! * (at your option) any later version. ! */ ! ! //define('MX_DEBUG', 1); ! define( 'IN_PORTAL', 1 ); ! $mx_root_path = "./"; ! include($mx_root_path . 'extension.inc'); ! include($mx_root_path . 'common.' . $phpEx); ! $view_page = false; // ! // Page selector // ! $page_id = $mx_request_vars->request('page', MX_TYPE_INT, 1); // ! // Start session management // ! $userdata = session_pagestart($user_ip, - ( 1000 + $page_id )); ! mx_init_userprefs($userdata); + $view_page = FALSE; // Index: mx_login.php =================================================================== RCS file: /cvsroot/mxbb/core27x/mx_login.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** mx_login.php 6 May 2005 06:47:57 -0000 1.1 --- mx_login.php 5 Dec 2005 19:25:26 -0000 1.2 *************** *** 1,13 **** <?php ! /*************************************************************************** ! * mx_login.php ! * ------------------- ! * begin : April, 2002 ! * copyright : (C) 2002 MX-System ! * email : su...@mx... ! * ! * $Id$ ! * ! ***************************************************************************/ if ( !defined('IN_PORTAL') ) --- 1,22 ---- <?php ! /** ------------------------------------------------------------------------ ! * subject : mx-portal, CMS & portal ! * begin : june, 2002 ! * copyright : (C) 2002-2005 MX-System ! * email : jon...@ho... ! * project site : www.mx-system.com ! * ! * description : ! * ------------------------------------------------------------------------- ! * ! * $Id$ ! */ ! ! /** ! * This program is free software; you can redistribute it and/or modify ! * it under the terms of the GNU General Public License as published by ! * the Free Software Foundation; either version 2 of the License, or ! * (at your option) any later version. ! */ if ( !defined('IN_PORTAL') ) *************** *** 17,40 **** $template->set_filenames(array( ! "body_login" => 'mx_login.tpl') ); $template->assign_vars(array( ! 'BLOCK_SIZE' => $block_size, ! 'S_LOGIN_ACTION' => append_sid('login.'.$phpEx), ! 'L_USERNAME' => $lang['Username'], ! 'L_PASSWORD' => $lang['Password'], ! 'L_LOGIN' => $lang['Login'], ! 'L_TITLE' => $lang['Login'], ! 'L_LOG_ME_IN' => $lang['Log_me_in'], ! 'L_AUTO_LOGIN' => $lang['Log_me_in'], ! 'L_LOGIN_LOGOUT' => $lang['Login']) ! ); ! //if( !$userdata['session_logged_in'] ) ! //{ ! $template->assign_block_vars('switch_user_logged_out', array()); ! $template->pparse("body_login"); ! //} ?> \ No newline at end of file --- 26,46 ---- $template->set_filenames(array( ! 'body_login' => 'mx_login.tpl') ); $template->assign_vars(array( ! 'BLOCK_SIZE' => $block_size, ! 'S_LOGIN_ACTION' => append_sid(PORTAL_URL . "login.$phpEx"), ! 'L_USERNAME' => $lang['Username'], ! 'L_PASSWORD' => $lang['Password'], ! 'L_LOGIN' => $lang['Login'], ! 'L_TITLE' => $lang['Login'], ! 'L_LOG_ME_IN' => $lang['Log_me_in'], ! 'L_AUTO_LOGIN' => $lang['Log_me_in'], ! 'L_LOGIN_LOGOUT' => $lang['Login'] ! )); ! $template->assign_block_vars('switch_user_logged_out', array()); ! $template->pparse('body_login'); ?> \ No newline at end of file Index: common.php =================================================================== RCS file: /cvsroot/mxbb/core27x/common.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** common.php 30 Nov 2005 23:50:44 -0000 1.3 --- common.php 5 Dec 2005 19:25:26 -0000 1.4 *************** *** 1,9 **** <?php ! /*************************************************************************** ! * common.php ! * ------------------- ! * begin : Saturday, Feb 23, 2001 ! * copyright : (C) 2001 The phpBB Group ! * email : su...@ph... * * $Id$ --- 1,12 ---- <?php ! /** ------------------------------------------------------------------------ ! * subject : mx-portal, CMS & portal ! * begin : june, 2002 ! * copyright : (C) 2002-2005 MX-System ! * email : jon...@ho... ! * project site : www.mx-system.com ! * ! * description : ! * ------------------------------------------------------------------------- * * $Id$ *************** *** 12,23 **** ***************************************************************************/ ! /*************************************************************************** ! * ! * This program is free software; you can redistribute it and/or modify ! * it under the terms of the GNU General Public License as published by ! * the Free Software Foundation; either version 2 of the License, or ! * (at your option) any later version. ! * ! ***************************************************************************/ if ( !defined('IN_PORTAL') ) --- 15,24 ---- ***************************************************************************/ ! /** ! * This program is free software; you can redistribute it and/or modify ! * it under the terms of the GNU General Public License as published by ! * the Free Software Foundation; either version 2 of the License, or ! * (at your option) any later version. ! */ if ( !defined('IN_PORTAL') ) *************** *** 28,31 **** --- 29,36 ---- define('IN_PHPBB', 1); + // ================================================================================ + // The following code is based on common.php from phpBB 2.0.14 + // ================================================================================ + // error_reporting (E_ERROR | E_WARNING | E_PARSE); // This will NOT report uninitialized variables *************** *** 83,87 **** unset($input['input']); unset($input['not_unset']); ! while (list($var,) = @each($input)) { --- 88,92 ---- unset($input['input']); unset($input['not_unset']); ! while (list($var,) = @each($input)) { *************** *** 91,95 **** } } ! unset($input); } --- 96,100 ---- } } ! unset($input); } *************** *** 175,182 **** $gen_simple_header = FALSE; ! @include_once($mx_root_path . 'config.'.$phpEx); ! ! if( !defined("MX_INSTALLED") ) { header("Location: ' . $mx_root_path . 'install/mx_install.$phpEx"); --- 180,186 ---- $gen_simple_header = FALSE; + @include_once($mx_root_path . 'config.' . $phpEx); ! if( !defined('MX_INSTALLED') ) { header("Location: ' . $mx_root_path . 'install/mx_install.$phpEx"); *************** *** 185,214 **** str_replace("//", "/", $phpbb_root_path); ! include_once($mx_root_path . 'config.'.$phpEx); ! ! include_once($phpbb_root_path . 'includes/constants.'.$phpEx); ! include_once($mx_root_path . 'includes/template.'.$phpEx); ! include_once($phpbb_root_path . 'includes/sessions.'.$phpEx); ! include_once($phpbb_root_path . 'includes/auth.'.$phpEx); ! include_once($phpbb_root_path . 'includes/functions.'.$phpEx); ! include_once($phpbb_root_path . 'includes/db.'.$phpEx); ! // We do not need this any longer, unset for safety purposes ! unset($dbpasswd); ! include_once($phpbb_root_path . 'includes/functions_selects.'.$phpEx); ! include_once($phpbb_root_path . 'includes/bbcode.'.$phpEx); ! include_once($mx_root_path . 'includes/mx_constants.'.$phpEx); ! include_once($mx_root_path . 'includes/mx_functions.'.$phpEx); include_once($mx_root_path . 'includes/mx_functions_phpbb.' . $phpEx); include_once($mx_root_path . 'includes/mx_auth.' . $phpEx); include_once($mx_root_path . 'includes/mx_cache.' . $phpEx); ! $portal_config = get_info( PORTAL_TABLE, 'portal_id', 1 ); ! ! define('PHPBB_URL', $portal_config[portal_phpbb_url]); ! define('PORTAL_URL', $portal_config[portal_url]); ! define('PORTAL_VERSION', $portal_config[portal_version]); // --- 189,216 ---- str_replace("//", "/", $phpbb_root_path); ! include_once($mx_root_path . 'config.' . $phpEx); ! include_once($phpbb_root_path . 'includes/constants.' . $phpEx); ! include_once($mx_root_path . 'includes/template.' . $phpEx); ! include_once($phpbb_root_path . 'includes/sessions.' . $phpEx); ! include_once($phpbb_root_path . 'includes/auth.' . $phpEx); ! include_once($phpbb_root_path . 'includes/functions.' . $phpEx); ! include_once($phpbb_root_path . 'includes/db.' . $phpEx); ! include_once($phpbb_root_path . 'includes/functions_selects.' . $phpEx); ! include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx); ! include_once($mx_root_path . 'includes/mx_constants.' . $phpEx); ! include_once($mx_root_path . 'includes/mx_functions.' . $phpEx); include_once($mx_root_path . 'includes/mx_functions_phpbb.' . $phpEx); include_once($mx_root_path . 'includes/mx_auth.' . $phpEx); include_once($mx_root_path . 'includes/mx_cache.' . $phpEx); ! // We do not need this any longer, unset for safety purposes ! unset($dbpasswd); ! $portal_config = get_info(PORTAL_TABLE, 'portal_id', 1); ! define('PHPBB_URL', $portal_config['portal_phpbb_url']); ! define('PORTAL_URL', $portal_config['portal_url']); ! define('PORTAL_VERSION', $portal_config['portal_version']); // *************** *** 222,248 **** $mx_cache = new mx_cache(); - // - // Mozilla navigation bar - // Default items that should be valid on all pages. - // Defined here and not in page_header.php so they can be redefined in the code - // - $nav_links['top'] = array ( - 'url' => append_sid( PHPBB_URL ."index.".$phpEx), - 'title' => sprintf($lang['Forum_Index'], $board_config['sitename']) - ); - $nav_links['search'] = array ( - 'url' => append_sid( PHPBB_URL ."search.".$phpEx), - 'title' => $lang['Search'] - ); - $nav_links['help'] = array ( - 'url' => append_sid( PHPBB_URL ."faq.".$phpEx), - 'title' => $lang['FAQ'] - ); - $nav_links['author'] = array ( - 'url' => append_sid( PHPBB_URL ."memberlist.".$phpEx), - 'title' => $lang['Memberlist'] - ); - - // // Obtain and encode users IP // --- 224,227 ---- *************** *** 311,320 **** //-- MX System ! if ( file_exists($phpbb_root_path . 'attach_mod') ) { ! include_once($phpbb_root_path . 'attach_mod/attachment_mod.'.$phpEx); } ! if ( file_exists('install') || file_exists('contrib') ) { mx_message_die(GENERAL_MESSAGE, 'Please ensure both the install/ and contrib/ directories are deleted'); --- 290,299 ---- //-- MX System ! if( file_exists($phpbb_root_path . 'attach_mod') ) { ! include_once($phpbb_root_path . 'attach_mod/attachment_mod.' . $phpEx); } ! if( file_exists('install') || file_exists('contrib') ) { mx_message_die(GENERAL_MESSAGE, 'Please ensure both the install/ and contrib/ directories are deleted'); *************** *** 328,331 **** mx_message_die(GENERAL_MESSAGE, 'Board_disable', 'Information'); } - ?> \ No newline at end of file --- 307,309 ---- Index: mx_google.php =================================================================== RCS file: /cvsroot/mxbb/core27x/mx_google.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** mx_google.php 6 May 2005 06:47:57 -0000 1.1 --- mx_google.php 5 Dec 2005 19:25:26 -0000 1.2 *************** *** 1,14 **** <?php ! /*************************************************************************** ! * mx_google.php ! * ------------------- ! * begin : August, 2002 ! * copyright : (C) 2002 MX-System ! * email : su...@mx... ! * ! * $Id$ ! * ! ***************************************************************************/ ! if ( !defined('IN_PORTAL') ) { --- 1,23 ---- <?php ! /** ------------------------------------------------------------------------ ! * subject : mx-portal, CMS & portal ! * begin : june, 2002 ! * copyright : (C) 2002-2005 MX-System ! * email : jon...@ho... ! * project site : www.mx-system.com ! * ! * description : ! * ------------------------------------------------------------------------- ! * ! * $Id$ ! */ ! ! /** ! * This program is free software; you can redistribute it and/or modify ! * it under the terms of the GNU General Public License as published by ! * the Free Software Foundation; either version 2 of the License, or ! * (at your option) any later version. ! */ ! if ( !defined('IN_PORTAL') ) { *************** *** 17,28 **** $template->set_filenames(array( ! "body_google" => 'mx_google.tpl') ); $template->assign_vars(array( ! 'BLOCK_SIZE' => $block_size, ! 'L_SEARCH' => $lang['Search'], ! 'L_TITLE' => 'Google') ! ); ! $template->pparse("body_google"); ?> \ No newline at end of file --- 26,39 ---- $template->set_filenames(array( ! 'body_google' => 'mx_google.tpl') ); + $template->assign_vars(array( ! 'BLOCK_SIZE' => $block_size, ! 'L_SEARCH' => $lang['Search'], ! 'L_TITLE' => 'Google' ! )); ! ! $template->pparse('body_google'); ?> \ No newline at end of file Index: mx_language.php =================================================================== RCS file: /cvsroot/mxbb/core27x/mx_language.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** mx_language.php 6 May 2005 06:47:57 -0000 1.1 --- mx_language.php 5 Dec 2005 19:25:26 -0000 1.2 *************** *** 1,13 **** <?php ! /*************************************************************************** ! * mx_language.php ! * ------------------- ! * begin : April, 2002 ! * copyright : (C) 2002 MX-System ! * email : su...@mx... ! * ! * $Id$ ! * ! ***************************************************************************/ if ( !defined('IN_PORTAL') ) --- 1,22 ---- <?php ! /** ------------------------------------------------------------------------ ! * subject : mx-portal, CMS & portal ! * begin : june, 2002 ! * copyright : (C) 2002-2005 MX-System ! * email : jon...@ho... ! * project site : www.mx-system.com ! * ! * description : ! * ------------------------------------------------------------------------- ! * ! * $Id$ ! */ ! ! /** ! * This program is free software; you can redistribute it and/or modify ! * it under the terms of the GNU General Public License as published by ! * the Free Software Foundation; either version 2 of the License, or ! * (at your option) any later version. ! */ if ( !defined('IN_PORTAL') ) *************** *** 16,82 **** } ! if( isset($HTTP_POST_VARS['change_default_lang']) && $userdata['user_level'] == ADMIN ) { ! $board_config['default_lang'] = ( isset($HTTP_POST_VARS['default_lang']) ) ? $HTTP_POST_VARS['default_lang'] : $board_config['default_lang']; $sql = "UPDATE " . CONFIG_TABLE . " SET ! config_value = '" . str_replace("\'", "''", $board_config['default_lang']) . "' WHERE config_name = 'default_lang'"; ! if( !$db->sql_query($sql) ) { ! mx_message_die(GENERAL_ERROR, "Failed to update default language configuration for $config_name", "", __LINE__, __FILE__, $sql); } } ! if( isset($HTTP_POST_VARS['change_user_lang']) && $userdata['session_logged_in'] ) { ! $userdata['user_lang'] = ( isset($HTTP_POST_VARS['user_lang']) ) ? $HTTP_POST_VARS['user_lang'] : $board_config['default_lang']; ! $mx_user_id = $userdata['user_id']; ! $sql = "UPDATE " . USERS_TABLE . " SET ! user_lang = '" . str_replace("\'", "''", $userdata['user_lang']) . "' ! WHERE user_id = '$mx_user_id'"; ! if( !$db->sql_query($sql) ) { ! mx_message_die(GENERAL_ERROR, "Failed to update user lang configuration for $config_name", "", __LINE__, __FILE__, $sql); } } $template->set_filenames(array( ! "body_language" => 'mx_language.tpl') ); if ( $userdata['user_level'] == ADMIN ) { ! $template->assign_block_vars("switch_is_admin", array( 'L_CHANGE_NOW' => $lang['Change_default_lang'], ! 'LANG_SELECT' => language_select($board_config['default_lang'], 'default_lang') )); } if ( $userdata['session_logged_in'] ) { ! $template->assign_block_vars("switch_is_user", array( 'L_CHANGE_NOW' => $lang['Change_user_lang'], ! 'LANG_SELECT' => language_select($userdata['user_lang'], 'user_lang') )); } $template->assign_vars(array( ! 'ACTION_URL' => $mx_root_path . "index." . $phpEx . "?page=" . $page_id, ! 'BLOCK_SIZE' => ( !empty( $block_size ) ? $block_size : '100%' ), ! 'L_SELECT_LANG' => $lang['Board_lang'], 'L_CHANGE_NOW' => $lang['Change'], ! 'L_TITLE' => $lang['Portal_lang'], ! 'L_SUBTITLE' => $lang['SELECTGUILANG']) ! ); ! // // Display only when the user is logged in // ! if( $userdata['session_logged_in'] ) { ! $template->pparse("body_language"); } ?> \ No newline at end of file --- 25,94 ---- } ! $language = $mx_request_vars->post('change_default_lang', MX_TYPE_NO_TAGS, ''); ! $language = ( preg_match('#^[a-z_]+$#', $language) ? strip_tags($language) : '' ); ! if ( !empty($language) && $userdata['user_level'] == ADMIN ) { ! $board_config['default_lang'] = $language; $sql = "UPDATE " . CONFIG_TABLE . " SET ! config_value = '$language' WHERE config_name = 'default_lang'"; ! if ( !$db->sql_query($sql) ) { ! mx_message_die(GENERAL_ERROR, "Failed to update default language configuration", '', __LINE__, __FILE__, $sql); } } ! $language = $mx_request_vars->post('change_user_lang', MX_TYPE_NO_TAGS, ''); ! $language = ( preg_match('#^[a-z_]+$#', $language) ? strip_tags($language) : '' ); ! if ( !empty($language) && $userdata['session_logged_in'] ) { ! $userdata['user_lang'] = $language; ! $sql = "UPDATE " . USERS_TABLE . " SET ! user_lang = '$language' ! WHERE user_id = '" . $userdata['user_id'] . "'"; ! if ( !$db->sql_query($sql) ) { ! mx_message_die(GENERAL_ERROR, "Failed to update user lang configuration", '', __LINE__, __FILE__, $sql); } } $template->set_filenames(array( ! 'body_language' => 'mx_language.tpl') ); if ( $userdata['user_level'] == ADMIN ) { ! $template->assign_block_vars('switch_is_admin', array( 'L_CHANGE_NOW' => $lang['Change_default_lang'], ! 'LANG_SELECT' => language_select($board_config['default_lang'], 'default_lang') )); } if ( $userdata['session_logged_in'] ) { ! $template->assign_block_vars('switch_is_user', array( 'L_CHANGE_NOW' => $lang['Change_user_lang'], ! 'LANG_SELECT' => language_select($userdata['user_lang'], 'user_lang') )); } $template->assign_vars(array( ! 'ACTION_URL' => append_sid(PORTAL_URL . "index.$phpEx?page=$page_id"), ! 'BLOCK_SIZE' => ( !empty($block_size) ? $block_size : '100%' ), ! 'L_SELECT_LANG' => $lang['Board_lang'], 'L_CHANGE_NOW' => $lang['Change'], ! 'L_TITLE' => $lang['Portal_lang'], ! 'L_SUBTITLE' => $lang['SELECTGUILANG'] ! )); // // Display only when the user is logged in // ! if ( $userdata['session_logged_in'] ) { ! $template->pparse('body_language'); } + ?> \ No newline at end of file Index: mx_forum.php =================================================================== RCS file: /cvsroot/mxbb/core27x/mx_forum.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** mx_forum.php 26 May 2005 21:54:08 -0000 1.2 --- mx_forum.php 5 Dec 2005 19:25:26 -0000 1.3 *************** *** 1,44 **** <?php ! /*************************************************************************** ! * mx-forum.php ! * ------------------- ! * begin : Saturday, Feb 13, 2001 ! * copyright : (C) 2001 The phpBB Group ! * email : su...@ph... ! * ! * $Id$ ! * ! * ! ***************************************************************************/ ! /*************************************************************************** ! * ! * This program is free software; you can redistribute it and/or modify ! * it under the terms of the GNU General Public License as published by ! * the Free Software Foundation; either version 2 of the License, or ! * (at your option) any later version. ! * ! ***************************************************************************/ if ( !defined('IN_PORTAL') ) { define('IN_PORTAL', 1); ! $mx_root_path = "./"; $include_page_tail = 1; include($mx_root_path . 'extension.inc'); ! include($mx_root_path . 'common.'.$phpEx); - // - // Start session management - // $userdata = session_pagestart($user_ip, PAGE_FORUM); ! mx_init_userprefs($userdata); ! // ! // End session management ! // } $viewcat = ( !empty($HTTP_GET_VARS[POST_CAT_URL]) ) ? $HTTP_GET_VARS[POST_CAT_URL] : -1; --- 1,51 ---- <?php ! /** ------------------------------------------------------------------------ ! * subject : mx-portal, CMS & portal ! * begin : june, 2002 ! * copyright : (C) 2002-2005 MX-System ! * email : jon...@ho... ! * project site : www.mx-system.com ! * ! * description : ! * ------------------------------------------------------------------------- ! * copyright : (C) 2001 The phpBB Group ! * email : su...@ph... ! * ! * $Id$ ! */ ! /** ! * This program is free software; you can redistribute it and/or modify ! * it under the terms of the GNU General Public License as published by ! * the Free Software Foundation; either version 2 of the License, or ! * (at your option) any later version. ! */ if ( !defined('IN_PORTAL') ) { define('IN_PORTAL', 1); ! $mx_root_path = '../../'; $include_page_tail = 1; include($mx_root_path . 'extension.inc'); ! include($mx_root_path . 'common.' . $phpEx); $userdata = session_pagestart($user_ip, PAGE_FORUM); ! mx_init_userprefs($userdata); } + // ================================================================================ + // The following code is based on includes/page_header.php (phpBB 2.0.14) + // ================================================================================ + + $l_timezone = explode('.', $board_config['board_timezone']); + $l_timezone = (count($l_timezone) > 1 && $l_timezone[count($l_timezone)-1] != 0) ? $lang[sprintf('%.1f', $board_config['board_timezone'])] : $lang[number_format($board_config['board_timezone'])]; + + + // ================================================================================ + // The following code is based on index.php (phpBB 2.0.14) + // ================================================================================ + $viewcat = ( !empty($HTTP_GET_VARS[POST_CAT_URL]) ) ? $HTTP_GET_VARS[POST_CAT_URL] : -1; *************** *** 63,70 **** $template->assign_vars(array( ! "META" => '<meta http-equiv="refresh" content="3;url=' .append_sid( PORTAL_URL . "index.$phpEx") . '">') ); ! $message = $lang['Forums_marked_read'] . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid( PORTAL_URL . "index.$phpEx") . '">', '</a> '); mx_message_die(GENERAL_MESSAGE, $message); --- 70,77 ---- $template->assign_vars(array( ! "META" => '<meta http-equiv="refresh" content="3;url=' . append_sid(PORTAL_URL . "index.$phpEx") . '">' ) ); ! $message = $lang['Forums_marked_read'] . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid(PORTAL_URL . "index.$phpEx") . '">', '</a> '); mx_message_die(GENERAL_MESSAGE, $message); *************** *** 88,92 **** $newest_uid = $newest_userdata['user_id']; - if( $total_posts == 0 ) { --- 95,98 ---- *************** *** 120,124 **** // $sql = "SELECT c.cat_id, c.cat_title, c.cat_order ! FROM " . CATEGORIES_TABLE . " c ORDER BY c.cat_order"; if( !($result = $db->sql_query($sql)) ) --- 126,130 ---- // $sql = "SELECT c.cat_id, c.cat_title, c.cat_order ! FROM " . CATEGORIES_TABLE . " c ORDER BY c.cat_order"; if( !($result = $db->sql_query($sql)) ) *************** *** 127,449 **** } while( $category_rows[] = $db->sql_fetchrow($result) ); if( ( $total_categories = count($category_rows) ) ) ! { ! // ! // Define appropriate SQL ! // ! switch(SQL_LAYER) ! { ! case 'postgresql': ! $sql = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id ! FROM " . FORUMS_TABLE . " f, " . POSTS_TABLE . " p, " . USERS_TABLE . " u ! WHERE p.post_id = f.forum_last_post_id ! AND u.user_id = p.poster_id ! UNION ( ! SELECT f.*, NULL, NULL, NULL, NULL ! FROM " . FORUMS_TABLE . " f ! WHERE NOT EXISTS ( ! SELECT p.post_time ! FROM " . POSTS_TABLE . " p ! WHERE p.post_id = f.forum_last_post_id ! ) ! ) ! ORDER BY cat_id, forum_order"; ! break; ! case 'oracle': ! $sql = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id ! FROM " . FORUMS_TABLE . " f, " . POSTS_TABLE . " p, " . USERS_TABLE . " u ! WHERE p.post_id = f.forum_last_post_id(+) ! AND u.user_id = p.poster_id(+) ! ORDER BY f.cat_id, f.forum_order"; ! break; ! default: ! $sql = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id ! FROM (( " . FORUMS_TABLE . " f ! LEFT JOIN " . POSTS_TABLE . " p ON p.post_id = f.forum_last_post_id ) ! LEFT JOIN " . USERS_TABLE . " u ON u.user_id = p.poster_id ) ! ORDER BY f.cat_id, f.forum_order"; ! break; ! } ! if ( !($result = $db->sql_query($sql)) ) ! { ! mx_message_die(GENERAL_ERROR, 'Could not query forums information', '', __LINE__, __FILE__, $sql); ! } ! $forum_data = array(); ! while( $row = $db->sql_fetchrow($result) ) ! { ! $forum_data[] = $row; ! } ! if ( !($total_forums = count($forum_data)) ) ! { ! mx_message_die(GENERAL_MESSAGE, $lang['No_forums']); ! } ! // ! // Obtain a list of topic ids which contain ! // posts made since user last visited ! // ! if ( $userdata['session_logged_in'] ) ! { ! $sql = "SELECT t.forum_id, t.topic_id, p.post_time ! FROM " . TOPICS_TABLE . " t, " . POSTS_TABLE . " p ! WHERE p.post_id = t.topic_last_post_id ! AND p.post_time > " . $userdata['user_lastvisit'] . " ! AND t.topic_moved_id = 0"; ! if ( !($result = $db->sql_query($sql)) ) ! { ! mx_message_die(GENERAL_ERROR, 'Could not query new topic information', '', __LINE__, __FILE__, $sql); ! } ! $new_topic_data = array(); ! while( $topic_data = $db->sql_fetchrow($result) ) ! { ! $new_topic_data[$topic_data['forum_id']][$topic_data['topic_id']] = $topic_data['post_time']; ! } ! } ! // ! // Obtain list of moderators of each forum ! // First users, then groups ... broken into two queries ! // ! $sql = "SELECT aa.forum_id, u.user_id, u.username ! FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE . " g, " . USERS_TABLE . " u ! WHERE aa.auth_mod = " . TRUE . " ! AND g.group_single_user = 1 ! AND ug.group_id = aa.group_id ! AND g.group_id = aa.group_id ! AND u.user_id = ug.user_id ! GROUP BY u.user_id, u.username, aa.forum_id ! ORDER BY aa.forum_id, u.user_id"; ! if ( !($result = $db->sql_query($sql)) ) ! { ! mx_message_die(GENERAL_ERROR, 'Could not query forum moderator information', '', __LINE__, __FILE__, $sql); ! } ! $forum_moderators = array(); ! while( $row = $db->sql_fetchrow($result) ) ! { ! $forum_moderators[$row['forum_id']][] = '<a href="' . append_sid( PHPBB_URL . "profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $row['user_id']) . '">' . $row['username'] . '</a>'; ! } ! $sql = "SELECT aa.forum_id, g.group_id, g.group_name ! FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE . " g ! WHERE aa.auth_mod = " . TRUE . " ! AND g.group_single_user = 0 ! AND g.group_type <> " . GROUP_HIDDEN . " ! AND ug.group_id = aa.group_id ! AND g.group_id = aa.group_id ! GROUP BY g.group_id, g.group_name, aa.forum_id ! ORDER BY aa.forum_id, g.group_id"; ! if ( !($result = $db->sql_query($sql)) ) ! { ! mx_message_die(GENERAL_ERROR, 'Could not query forum moderator information', '', __LINE__, __FILE__, $sql); ! } ! while( $row = $db->sql_fetchrow($result) ) ! { ! $forum_moderators[$row['forum_id']][] = '<a href="' . append_sid( PHPBB_URL . "groupcp.$phpEx?" . POST_GROUPS_URL . "=" . $row['group_id']) . '">' . $row['group_name'] . '</a>'; ! } ! // ! // Find which forums are visible for this user ! // ! $is_auth_ary = array(); ! $is_auth_ary = auth(AUTH_VIEW, AUTH_LIST_ALL, $userdata, $forum_data); ! // ! // Start output of page ! // ! $template->set_filenames(array( ! 'block_forum' => 'mx_forum.tpl') ! ); ! $template->assign_vars(array( ! 'BLOCK_SIZE' => $block_size, ! //'TOTAL_POSTS' => sprintf($l_total_post_s, $total_posts), ! //'TOTAL_USERS' => sprintf($l_total_user_s, $total_users), ! //'NEWEST_USER' => sprintf($lang['Newest_user'], '<a href="' . append_sid( PHPBB_URL . "profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$newest_uid") . '">', $newest_user, '</a>'), ! 'FORUM_IMG' => $images['forum'], ! 'FORUM_NEW_IMG' => $images['forum_new'], ! 'FORUM_LOCKED_IMG' => $images['forum_locked'], ! 'U_PHPBB_ROOT_PATH' => PHPBB_URL, ! 'TEMPLATE_ROOT_PATH' => TEMPLATE_ROOT_PATH, ! ! 'L_FORUM' => $lang['Forum'], ! 'L_TOPICS' => $lang['Topics'], ! 'L_REPLIES' => $lang['Replies'], ! 'L_VIEWS' => $lang['Views'], ! 'L_POSTS' => $lang['Posts'], ! 'L_LASTPOST' => $lang['Last_Post'], ! 'L_NO_NEW_POSTS' => $lang['No_new_posts'], ! 'L_NEW_POSTS' => $lang['New_posts'], ! 'L_NO_NEW_POSTS_LOCKED' => $lang['No_new_posts_locked'], ! 'L_NEW_POSTS_LOCKED' => $lang['New_posts_locked'], ! 'L_ONLINE_EXPLAIN' => $lang['Online_explain'], ! 'L_MODERATOR' => $lang['Moderators'], ! 'L_FORUM_LOCKED' => $lang['Forum_is_locked'], ! 'L_MARK_FORUMS_READ' => $lang['Mark_all_forums'], ! 'U_MARK_READ' => append_sid( PORTAL_URL . "mx_forum.$phpEx?mark=forums")) ! ); ! // ! // Okay, let's build the index ! // ! for($i = 0; $i < $total_categories; $i++) ! { ! $cat_id = $category_rows[$i]['cat_id']; ! // ! // Should we display this category/forum set? ! // ! $display_forums = false; ! for($j = 0; $j < $total_forums; $j++) ! { ! if ( $is_auth_ary[$forum_data[$j]['forum_id']]['auth_view'] && $forum_data[$j]['cat_id'] == $cat_id ) ! { ! $display_forums = true; ! } ! } ! // ! // Yes, we should, so first dump out the category ! // title, then, if appropriate the forum list ! // ! if ( $display_forums ) ! { ! $template->assign_block_vars('catrow', array( ! 'CAT_ID' => $cat_id, ! 'CAT_DESC' => $category_rows[$i]['cat_title'], ! 'U_VIEWCAT' => append_sid( PHPBB_URL . "index.$phpEx?" . POST_CAT_URL . "=$cat_id")) ! ); ! if ( $viewcat == $cat_id || $viewcat == -1 ) ! { ! for($j = 0; $j < $total_forums; $j++) ! { ! if ( $forum_data[$j]['cat_id'] == $cat_id ) ! { ! $forum_id = $forum_data[$j]['forum_id']; ! if ( $is_auth_ary[$forum_id]['auth_view'] ) ! { ! if ( $forum_data[$j]['forum_status'] == FORUM_LOCKED ) ! { ! $folder_image = $images['forum_locked']; ! $folder_alt = $lang['Forum_locked']; ! } ! else ! { ! $unread_topics = false; ! if ( $userdata['session_logged_in'] ) ! { ! if ( !empty($new_topic_data[$forum_id]) ) ! { ! $forum_last_post_time = 0; ! while( list($check_topic_id, $check_post_time) = @each($new_topic_data[$forum_id]) ) ! { ! if ( empty($tracking_topics[$check_topic_id]) ) ! { ! $unread_topics = true; ! $forum_last_post_time = max($check_post_time, $forum_last_post_time); ! } ! else ! { ! if ( $tracking_topics[$check_topic_id] < $check_post_time ) ! { ! $unread_topics = true; ! $forum_last_post_time = max($check_post_time, $forum_last_post_time); ! } ! } ! } ! if ( !empty($tracking_forums[$forum_id]) ) ! { ! if ( $tracking_forums[$forum_id] > $forum_last_post_time ) ! { ! $unread_topics = false; ! } ! } ! if ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all']) ) ! { ! if ( $HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all'] > $forum_last_post_time ) ! { ! $unread_topics = false; ! } ! } ! } ! } ! $folder_image = ( $unread_topics ) ? $images['forum_new'] : $images['forum']; ! $folder_alt = ( $unread_topics ) ? $lang['New_posts'] : $lang['No_new_posts']; ! } ! $posts = $forum_data[$j]['forum_posts']; ! $topics = $forum_data[$j]['forum_topics']; ! if ( $forum_data[$j]['forum_last_post_id'] ) ! { ! $last_post_time = create_date($board_config['default_dateformat'], $forum_data[$j]['post_time'], $board_config['board_timezone']); ! $last_post = $last_post_time . '<br />'; ! $last_post .= ( $forum_data[$j]['user_id'] == ANONYMOUS ) ? ( ($forum_data[$j]['post_username'] != '' ) ? $forum_data[$j]['post_username'] . ' ' : $lang['Guest'] . ' ' ) : '<a href="' . append_sid( PHPBB_URL . "profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '=' . $forum_data[$j]['user_id']) . '">' . $forum_data[$j]['username'] . '</a> '; ! ! $last_post .= '<a href="' . append_sid( PHPBB_URL . "viewtopic.$phpEx?" . POST_POST_URL . '=' . $forum_data[$j]['forum_last_post_id']) . '#' . $forum_data[$j]['forum_last_post_id'] . '"><img src="' . PHPBB_URL . $images['icon_latest_reply'] . '" border="0" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" /></a>'; ! } ! else ! { ! $last_post = $lang['No_Posts']; ! } ! if ( count($forum_moderators[$forum_id]) > 0 ) ! { ! $l_moderators = ( count($forum_moderators[$forum_id]) == 1 ) ? $lang['Moderator'] : $lang['Moderators']; ! $moderator_list = implode(', ', $forum_moderators[$forum_id]); ! } ! else ! { ! $l_moderators = ' '; ! $moderator_list = ' '; ! } ! $row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2']; ! $row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2']; ! $template->assign_block_vars('catrow.forumrow', array( ! 'ROW_COLOR' => '#' . $row_color, ! 'ROW_CLASS' => $row_class, ! 'FORUM_FOLDER_IMG' => $folder_image, ! 'FORUM_NAME' => $forum_data[$j]['forum_name'], ! 'FORUM_DESC' => $forum_data[$j]['forum_desc'], ! 'POSTS' => $forum_data[$j]['forum_posts'], ! 'TOPICS' => $forum_data[$j]['forum_topics'], ! 'LAST_POST' => $last_post, ! 'MODERATORS' => $moderator_list, ! 'L_MODERATOR' => $l_moderators, ! 'L_FORUM_FOLDER_ALT' => $folder_alt, ! 'U_VIEWFORUM' => append_sid( PHPBB_URL . "viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id")) ! ); ! } ! } ! } ! } ! } ! } // for ... categories }// if ... total_categories --- 133,465 ---- } + $category_rows = array(); while( $category_rows[] = $db->sql_fetchrow($result) ); + $db->sql_freeresult($result); if( ( $total_categories = count($category_rows) ) ) ! { ! // ! // Define appropriate SQL ! // ! switch(SQL_LAYER) ! { ! case 'postgresql': ! $sql = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id ! FROM " . FORUMS_TABLE . " f, " . POSTS_TABLE . " p, " . USERS_TABLE . " u ! WHERE p.post_id = f.forum_last_post_id ! AND u.user_id = p.poster_id ! UNION ( ! SELECT f.*, NULL, NULL, NULL, NULL ! FROM " . FORUMS_TABLE . " f ! WHERE NOT EXISTS ( ! SELECT p.post_time ! FROM " . POSTS_TABLE . " p ! WHERE p.post_id = f.forum_last_post_id ! ) ! ) ! ORDER BY cat_id, forum_order"; ! break; ! case 'oracle': ! $sql = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id ! FROM " . FORUMS_TABLE . " f, " . POSTS_TABLE . " p, " . USERS_TABLE . " u ! WHERE p.post_id = f.forum_last_post_id(+) ! AND u.user_id = p.poster_id(+) ! ORDER BY f.cat_id, f.forum_order"; ! break; ! default: ! $sql = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id ! FROM (( " . FORUMS_TABLE . " f ! LEFT JOIN " . POSTS_TABLE . " p ON p.post_id = f.forum_last_post_id ) ! LEFT JOIN " . USERS_TABLE . " u ON u.user_id = p.poster_id ) ! ORDER BY f.cat_id, f.forum_order"; ! break; ! } ! if ( !($result = $db->sql_query($sql)) ) ! { ! mx_message_die(GENERAL_ERROR, 'Could not query forums information', '', __LINE__, __FILE__, $sql); ! } ! $forum_data = array(); ! while( $row = $db->sql_fetchrow($result) ) ! { ! $forum_data[] = $row; ! } ! $db->sql_freeresult($result); ! if ( !($total_forums = count($forum_data)) ) ! { ! mx_message_die(GENERAL_MESSAGE, $lang['No_forums']); ! } ! // ! // Obtain a list of topic ids which contain ! // posts made since user last visited ! // ! if ( $userdata['session_logged_in'] ) ! { ! $sql = "SELECT t.forum_id, t.topic_id, p.post_time ! FROM " . TOPICS_TABLE . " t, " . POSTS_TABLE . " p ! WHERE p.post_id = t.topic_last_post_id ! AND p.post_time > " . $userdata['user_lastvisit'] . " ! AND t.topic_moved_id = 0"; ! if ( !($result = $db->sql_query($sql)) ) ! { ! mx_message_die(GENERAL_ERROR, 'Could not query new topic information', '', __LINE__, __FILE__, $sql); ! } ! $new_topic_data = array(); ! while( $topic_data = $db->sql_fetchrow($result) ) ! { ! $new_topic_data[$topic_data['forum_id']][$topic_data['topic_id']] = $topic_data['post_time']; ! } ! $db->sql_freeresult($result); ! } ! // ! // Obtain list of moderators of each forum ! // First users, then groups ... broken into two queries ! // ! $sql = "SELECT aa.forum_id, u.user_id, u.username ! FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE . " g, " . USERS_TABLE . " u ! WHERE aa.auth_mod = " . TRUE . " ! AND g.group_single_user = 1 ! AND ug.group_id = aa.group_id ! AND g.group_id = aa.group_id ! AND u.user_id = ug.user_id ! GROUP BY u.user_id, ... [truncated message content] |