Update of /cvsroot/mxbb/core/includes/shared/phpbb3/includes In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv24843 Modified Files: bbcode.php functions.php functions_admin.php functions_hook.php functions_module.php functions_posting.php Log Message: 2.9.x -> 3.0.0 b1 updated load_file() method new panel admincp (in development), index_jon.php some code cleanup Many updates for phpbb3 backend. Details are given in our current To-DO discussion Index: functions.php =================================================================== RCS file: /cvsroot/mxbb/core/includes/shared/phpbb3/includes/functions.php,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** functions.php 3 Jun 2008 20:04:14 -0000 1.16 --- functions.php 15 Jun 2008 21:01:41 -0000 1.17 *************** *** 18,21 **** --- 18,22 ---- // + // MODIFICATIONS: // Common global functions // Fixes for MX-Publisher: *************** *** 102,106 **** { reset($default); ! list($sub_key_type, $sub_type) = each(current($default)); $sub_type = gettype($sub_type); $sub_type = ($sub_type == 'array') ? 'NULL' : $sub_type; --- 103,108 ---- { reset($default); ! $default = current($default); ! list($sub_key_type, $sub_type) = each($default); $sub_type = gettype($sub_type); $sub_type = ($sub_type == 'array') ? 'NULL' : $sub_type; *************** *** 211,214 **** --- 213,236 ---- /** + * Return formatted string for filesizes + */ + function get_formatted_filesize($bytes, $add_size_lang = true) + { + global $user; + + if ($bytes >= pow(2, 20)) + { + return ($add_size_lang) ? round($bytes / 1024 / 1024, 2) . ' ' . $user->lang['MIB'] : round($bytes / 1024 / 1024, 2); + } + + if ($bytes >= pow(2, 10)) + { + return ($add_size_lang) ? round($bytes / 1024, 2) . ' ' . $user->lang['KIB'] : round($bytes / 1024, 2); + } + + return ($add_size_lang) ? ($bytes) . ' ' . $user->lang['BYTES'] : ($bytes); + } + + /** * Determine whether we are approaching the maximum execution time. Should be called once * at the beginning of the script in which it's used. *************** *** 225,229 **** if (empty($max_execution_time)) { ! $max_execution_time = (function_exists('ini_get')) ? (int) ini_get('max_execution_time') : (int) get_cfg_var('max_execution_time'); // If zero, then set to something higher to not let the user catch the ten seconds barrier. --- 247,251 ---- if (empty($max_execution_time)) { ! $max_execution_time = (function_exists('ini_get')) ? (int) @ini_get('max_execution_time') : (int) @get_cfg_var('max_execution_time'); // If zero, then set to something higher to not let the user catch the ten seconds barrier. *************** *** 608,615 **** function add_form_key($form_name) { ! global $board_config, $template, $mx_user, $mx_acp; $now = time(); ! $token_sid = ($mx_user->data['user_id'] == ANONYMOUS && !empty($board_config['form_token_sid_guests'])) ? $mx_user->session_id : ''; ! $token = sha1($now . $mx_user->data['user_form_salt'] . $form_name . $token_sid); $s_fields = build_hidden_fields(array( --- 630,637 ---- function add_form_key($form_name) { ! global $board_config, $template, $user, $mx_acp; $now = time(); ! $token_sid = ($user->data['user_id'] == ANONYMOUS && !empty($board_config['form_token_sid_guests'])) ? $user->session_id : ''; ! $token = sha1($now . $user->data['user_form_salt'] . $form_name . $token_sid); $s_fields = build_hidden_fields(array( *************** *** 617,628 **** 'form_token' => $token, )); ! if ( defined( 'IN_ADMIN' ) && is_object( $mx_acp ) ) ! { ! $mx_acp->template->assign_var( 'S_FORM_TOKEN' , $s_fields ); ! } ! else ! { ! $template->assign_var( 'S_FORM_TOKEN', $s_fields ); ! } } --- 639,643 ---- 'form_token' => $token, )); ! $template->assign_var( 'S_FORM_TOKEN', $s_fields ); } *************** *** 638,642 **** function check_form_key( $form_name, $timespan = false, $return_page = '', $trigger = false, $minimum_time = false ) { ! global $board_config, $mx_user; if ( $timespan === false ) { --- 653,657 ---- function check_form_key( $form_name, $timespan = false, $return_page = '', $trigger = false, $minimum_time = false ) { ! global $board_config, $user; if ( $timespan === false ) { *************** *** 658,664 **** if ( ( $diff >= $minimum_time ) && ( ( $diff <= $timespan ) || $timespan == -1 ) ) { ! $token_sid = ( $mx_user->data['user_id'] == ANONYMOUS && !empty( $board_config['form_token_sid_guests'] ) ) ? $mx_user->session_id : ''; ! $key = sha1( $creation_time . $mx_user->data['user_form_salt'] . $form_name . $token_sid ); if ( $key === $token ) { --- 673,679 ---- if ( ( $diff >= $minimum_time ) && ( ( $diff <= $timespan ) || $timespan == -1 ) ) { ! $token_sid = ( $user->data['user_id'] == ANONYMOUS && !empty( $board_config['form_token_sid_guests'] ) ) ? $user->session_id : ''; ! $key = sha1( $creation_time . $user->data['user_form_salt'] . $form_name . $token_sid ); if ( $key === $token ) { *************** *** 683,687 **** function group_create( &$group_id, $type, $name, $desc, $group_attributes, $allow_desc_bbcode = false, $allow_desc_urls = false, $allow_desc_smilies = false ) { ! global $phpbb_root_path, $board_config, $db, $mx_user, $file_upload; $error = array(); --- 698,702 ---- function group_create( &$group_id, $type, $name, $desc, $group_attributes, $allow_desc_bbcode = false, $allow_desc_urls = false, $allow_desc_smilies = false ) { ! global $phpbb_root_path, $board_config, $db, $user, $file_upload; $error = array(); *************** *** 704,708 **** if ( !utf8_strlen( $name ) || utf8_strlen( $name ) > 60 ) { ! $error[] = ( !utf8_strlen( $name ) ) ? $mx_user->lang['GROUP_ERR_USERNAME'] : $mx_user->lang['GROUP_ERR_USER_LONG']; } --- 719,723 ---- if ( !utf8_strlen( $name ) || utf8_strlen( $name ) > 60 ) { ! $error[] = ( !utf8_strlen( $name ) ) ? $user->lang['GROUP_ERR_USERNAME'] : $user->lang['GROUP_ERR_USER_LONG']; } *************** *** 710,719 **** if ( !empty( $err ) ) { ! $error[] = $mx_user->lang[$err]; } if ( !in_array( $type, array( GROUP_OPEN, GROUP_CLOSED, GROUP_HIDDEN, GROUP_SPECIAL, GROUP_FREE ) ) ) { ! $error[] = $mx_user->lang['GROUP_ERR_TYPE']; } --- 725,734 ---- if ( !empty( $err ) ) { ! $error[] = $user->lang[$err]; } if ( !in_array( $type, array( GROUP_OPEN, GROUP_CLOSED, GROUP_HIDDEN, GROUP_SPECIAL, GROUP_FREE ) ) ) { ! $error[] = $user->lang['GROUP_ERR_TYPE']; } *************** *** 819,823 **** } ! $name = ( $type == GROUP_SPECIAL ) ? $mx_user->lang['G_' . $name] : $name; //add_log( 'admin', $log, $name ); --- 834,838 ---- } ! $name = ( $type == GROUP_SPECIAL ) ? $user->lang['G_' . $name] : $name; //add_log( 'admin', $log, $name ); *************** *** 1763,1767 **** while ($row = $db->sql_fetchrow($result)) { ! if (!in_array(base_convert($row['topic_id'], 10, 36), array_keys($check_forum))) { $unread = true; --- 1778,1782 ---- while ($row = $db->sql_fetchrow($result)) { ! if (!isset($check_forum[base_convert($row['topic_id'], 10, 36)])) { $unread = true; *************** *** 1984,1987 **** --- 1999,2003 ---- $template->assign_vars(array( $tpl_prefix . 'BASE_URL' => $base_url, + 'A_' . $tpl_prefix . 'BASE_URL' => addslashes($base_url), $tpl_prefix . 'PER_PAGE' => $per_page, *************** *** 2110,2114 **** global $board_config, $user; ! $server_name = (!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : getenv('SERVER_NAME'); $server_port = (!empty($_SERVER['SERVER_PORT'])) ? (int) $_SERVER['SERVER_PORT'] : (int) getenv('SERVER_PORT'); --- 2126,2130 ---- global $board_config, $user; ! $server_name = $user->host; $server_port = (!empty($_SERVER['SERVER_PORT'])) ? (int) $_SERVER['SERVER_PORT'] : (int) getenv('SERVER_PORT'); *************** *** 3266,3272 **** function smiley_text($text, $force_option = false) { ! global $board_config, $mx_user, $phpbb_root_path; ! if ($force_option || !$board_config['allow_smilies'] || !$mx_user->optionget('viewsmilies')) { return preg_replace('#<!\-\- s(.*?) \-\-><img src="\{SMILIES_PATH\}\/.*? \/><!\-\- s\1 \-\->#', '\1', $text); --- 3282,3288 ---- function smiley_text($text, $force_option = false) { ! global $board_config, $user, $phpbb_root_path; ! if ($force_option || !$board_config['allow_smilies'] || !$user->optionget('viewsmilies')) { return preg_replace('#<!\-\- s(.*?) \-\-><img src="\{SMILIES_PATH\}\/.*? \/><!\-\- s\1 \-\->#', '\1', $text); Index: functions_hook.php =================================================================== RCS file: /cvsroot/mxbb/core/includes/shared/phpbb3/includes/functions_hook.php,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** functions_hook.php 22 Feb 2008 23:03:55 -0000 1.12 --- functions_hook.php 15 Jun 2008 21:01:41 -0000 1.13 *************** *** 17,24 **** } - mx_page::load_file( 'functions'); - mx_page::load_file( 'functions_module'); - mx_page::load_file( 'message_parser'); - class mx_phpbb3_admin { --- 17,20 ---- *************** *** 139,142 **** --- 135,139 ---- { global $phpbb_root_path, $phpEx, $mx_request_vars, $phpbb_admin_path, $template; + $admin_panel_script_path = $phpbb_root_path . 'includes/acp/acp_'. $this->action_scripts[$panel] . '.' . $phpEx; *************** *** 145,154 **** return "echo '<div class=\"errorbox\">phpbb3 admin nanel not found<br/>$admin_panel_script_path</div>';"; } $script = trim( file_get_contents( $phpbb_root_path . 'adm/index.' . $phpEx ) ); $preg_array = array( '#(<\?(php)?|\?>)#si' => '', '#\$php(Ex|bb_root_path|bb_admin_path) = [^;]*;#si' => '// MX_ACP_REPLACE \0', ! '#(include|require)\(([^)]*)\)[^;]*#s' => 'mx_page::load_file(\2)', '#\$user#si' => '$mx_user', '#\$auth#si' => '$phpbb_auth', '#([^_])append_sid#si' => '\1mx_append_sid', '#\$module_id[ \t][^;]*;#si' => "\$module_id = '" . $this->action_scripts[$panel] . "';", --- 142,157 ---- return "echo '<div class=\"errorbox\">phpbb3 admin nanel not found<br/>$admin_panel_script_path</div>';"; } + $script = trim( file_get_contents( $phpbb_root_path . 'adm/index.' . $phpEx ) ); + $preg_array = array( '#(<\?(php)?|\?>)#si' => '', '#\$php(Ex|bb_root_path|bb_admin_path) = [^;]*;#si' => '// MX_ACP_REPLACE \0', ! '#\$user->session_begin[^;]*;#si' => '// MX_ACP_REPLACE \0', ! '#\$auth->acl\(\$user->data\)[^;]*;#si' => '// MX_ACP_REPLACE \0', ! '#\$user->setup[^;]*;#si' => '// MX_ACP_REPLACE \0', ! '#(include|require)\(([^)]*)\)[^;]*#s' => '// MX_ACP_REPLACE mx_page::load_file(\2, \'phpbb3\')', '#\$user#si' => '$mx_user', '#\$auth#si' => '$phpbb_auth', + '#\$config#si' => '$board_config', '#([^_])append_sid#si' => '\1mx_append_sid', '#\$module_id[ \t][^;]*;#si' => "\$module_id = '" . $this->action_scripts[$panel] . "';", *************** *** 162,172 **** '#display\(\'body\'\);#si' => "display('panel');", '#(garbage_collection|exit_handler)\(\);#si' => 'phpBB3::\1();', ! '#\$template->#si' => '$mx_acp->template->', ! '#adm_page_footer\(\);#si' => '$mx_acp->_template_assign_vars();$mx_acp->template->pparse(\'panel\');', '#global #si' => 'global $mx_acp, ', ); $func_cnt = preg_match_all( "#\nfunction ([^(]*)\\(#si", $script, $func_match ); mx_page::load_file( 'utf/utf_tools'); for( $i = 0; $i < $func_cnt; $i++ ) { --- 165,177 ---- '#display\(\'body\'\);#si' => "display('panel');", '#(garbage_collection|exit_handler)\(\);#si' => 'phpBB3::\1();', ! //'#\$template->#si' => '$mx_acp->template->', ! '#adm_page_footer\(\);#si' => '$mx_acp->_template_assign_vars();$template->pparse(\'panel\');', '#global #si' => 'global $mx_acp, ', ); + $func_cnt = preg_match_all( "#\nfunction ([^(]*)\\(#si", $script, $func_match ); mx_page::load_file( 'utf/utf_tools'); + for( $i = 0; $i < $func_cnt; $i++ ) { *************** *** 178,181 **** --- 183,187 ---- } } + $script = preg_replace( array_keys( $preg_array ), $preg_array, $script ); return $script; Index: functions_module.php =================================================================== RCS file: /cvsroot/mxbb/core/includes/shared/phpbb3/includes/functions_module.php,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** functions_module.php 12 Feb 2008 06:29:31 -0000 1.11 --- functions_module.php 15 Jun 2008 21:01:42 -0000 1.12 *************** *** 446,450 **** '#get_username_string\(#si' => 'mx_get_username_string(', '#global#si' => 'global $mx_acp,', ! '#\$template-#si' => '$mx_acp->template-', '#trigger_error\(([^,)]*)([,\)])#si' => '$mx_acp->mx_message_die_acp( GENERAL_MESSAGE, \1 \2 ', '#\$mx_acp->template->assign_vars#si' => 'foreach( $mx_user->lang as $key => $value) --- 446,450 ---- '#get_username_string\(#si' => 'mx_get_username_string(', '#global#si' => 'global $mx_acp,', ! //'#\$template-#si' => '$mx_acp->template-', '#trigger_error\(([^,)]*)([,\)])#si' => '$mx_acp->mx_message_die_acp( GENERAL_MESSAGE, \1 \2 ', '#\$mx_acp->template->assign_vars#si' => 'foreach( $mx_user->lang as $key => $value) *************** *** 732,736 **** // Select first id we can get ! if (!$current_id && (in_array($item_ary['id'], array_keys($this->module_cache['parents'])) || $item_ary['id'] == $this->p_id)) { $current_id = $item_ary['id']; --- 732,736 ---- // Select first id we can get ! if (!$current_id && (isset($this->module_cache['parents'][$item_ary['id']]) || $item_ary['id'] == $this->p_id)) { $current_id = $item_ary['id']; *************** *** 765,769 **** $tpl_ary = array( 'L_TITLE' => $item_ary['lang'], ! 'S_SELECTED' => (in_array($item_ary['id'], array_keys($this->module_cache['parents'])) || $item_ary['id'] == $this->p_id) ? true : false, 'U_TITLE' => $u_title ); --- 765,769 ---- $tpl_ary = array( 'L_TITLE' => $item_ary['lang'], ! 'S_SELECTED' => (isset($this->module_cache['parents'][$item_ary['id']]) || $item_ary['id'] == $this->p_id) ? true : false, 'U_TITLE' => $u_title ); *************** *** 774,778 **** $tpl_ary = array( 'L_TITLE' => $item_ary['lang'], ! 'S_SELECTED' => (in_array($item_ary['id'], array_keys($this->module_cache['parents'])) || $item_ary['id'] == $this->p_id) ? true : false, 'U_TITLE' => $u_title ); --- 774,778 ---- $tpl_ary = array( 'L_TITLE' => $item_ary['lang'], ! 'S_SELECTED' => (isset($this->module_cache['parents'][$item_ary['id']]) || $item_ary['id'] == $this->p_id) ? true : false, 'U_TITLE' => $u_title ); *************** *** 838,842 **** } ! $mx_acp->template->set_filenames(array( 'body' => $this->get_tpl_name()) ); --- 838,842 ---- } ! $template->set_filenames(array( 'body' => $this->get_tpl_name()) ); Index: functions_admin.php =================================================================== RCS file: /cvsroot/mxbb/core/includes/shared/phpbb3/includes/functions_admin.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** functions_admin.php 5 Feb 2008 14:51:27 -0000 1.3 --- functions_admin.php 15 Jun 2008 21:01:41 -0000 1.4 *************** *** 18,26 **** // ! // Fixes for MX-Publisher: // $config -> $board_config // $cache -> $mx_cache - // $user -> $mx_user // $auth -> $phpbb_auth // append_sid -> mx3_append_sid // get_username_string -> mx_get_username_string --- 18,26 ---- // ! // MODIFICATIONS: // $config -> $board_config // $cache -> $mx_cache // $auth -> $phpbb_auth + // $user -> $mx_user // append_sid -> mx3_append_sid // get_username_string -> mx_get_username_string *************** *** 108,112 **** $item_data['right_id'] = $row['right_id'] + 2; } ! $sql = "UPDATE $sql_table SET left_id = {$item_data['left_id']}, right_id = {$item_data['right_id']} --- 108,112 ---- $item_data['right_id'] = $row['right_id'] + 2; } ! $sql = "UPDATE $sql_table SET left_id = {$item_data['left_id']}, right_id = {$item_data['right_id']} *************** *** 207,211 **** global $mx_user; ! $size_types_text = array($mx_user->lang['BYTES'], $mx_user->lang['KB'], $mx_user->lang['MB']); $size_types = array('b', 'kb', 'mb'); --- 207,211 ---- global $mx_user; ! $size_types_text = array($mx_user->lang['BYTES'], $mx_user->lang['KIB'], $mx_user->lang['MIB']); $size_types = array('b', 'kb', 'mb'); *************** *** 927,931 **** while ($row = $db->sql_fetchrow($result)) { ! $remaining[] = $row['post_msg_id']; } $db->sql_freeresult($result); --- 927,931 ---- while ($row = $db->sql_fetchrow($result)) { ! $remaining[] = $row['post_msg_id']; } $db->sql_freeresult($result); *************** *** 951,955 **** while ($row = $db->sql_fetchrow($result)) { ! $remaining[] = $row['post_msg_id']; } $db->sql_freeresult($result); --- 951,955 ---- while ($row = $db->sql_fetchrow($result)) { ! $remaining[] = $row['post_msg_id']; } $db->sql_freeresult($result); *************** *** 989,993 **** while ($row = $db->sql_fetchrow($result)) { ! $remaining[] = $row['topic_id']; } $db->sql_freeresult($result); --- 989,993 ---- while ($row = $db->sql_fetchrow($result)) { ! $remaining[] = $row['topic_id']; } $db->sql_freeresult($result); *************** *** 1026,1030 **** $db->sql_query($sql); break; ! default: $sql = 'SELECT t.topic_id --- 1026,1030 ---- $db->sql_query($sql); break; ! default: $sql = 'SELECT t.topic_id *************** *** 1093,1102 **** // Now add the information... $sql_ary = array(); ! foreach ($posted as $mx_user_id => $topic_row) { foreach ($topic_row as $topic_id) { $sql_ary[] = array( ! 'user_id' => (int) $mx_user_id, 'topic_id' => (int) $topic_id, 'topic_posted' => 1, --- 1093,1102 ---- // Now add the information... $sql_ary = array(); ! foreach ($posted as $user_id => $topic_row) { foreach ($topic_row as $topic_id) { $sql_ary[] = array( ! 'user_id' => (int) $user_id, 'topic_id' => (int) $topic_id, 'topic_posted' => 1, *************** *** 1224,1228 **** $db->sql_query($sql); break; ! default: $sql = 'SELECT t1.topic_id --- 1224,1228 ---- $db->sql_query($sql); break; ! default: $sql = 'SELECT t1.topic_id *************** *** 2246,2259 **** $result = $db->sql_query($sql); ! $mx_usernames_ary = array(); while ($row = $db->sql_fetchrow($result)) { ! $mx_usernames_ary[$row['user_id']] = $row['username']; } ! foreach ($hold_ary as $mx_user_id => $forum_id_ary) { // Do not continue if user does not exist ! if (!isset($mx_usernames_ary[$mx_user_id])) { continue; --- 2246,2259 ---- $result = $db->sql_query($sql); ! $usernames_ary = array(); while ($row = $db->sql_fetchrow($result)) { ! $usernames_ary[$row['user_id']] = $row['username']; } ! foreach ($hold_ary as $user_id => $forum_id_ary) { // Do not continue if user does not exist ! if (!isset($usernames_ary[$user_id])) { continue; *************** *** 2264,2269 **** $sql_ary[] = array( 'forum_id' => (int) $forum_id, ! 'user_id' => (int) $mx_user_id, ! 'username' => (string) $mx_usernames_ary[$mx_user_id], 'group_id' => 0, 'group_name' => '' --- 2264,2269 ---- $sql_ary[] = array( 'forum_id' => (int) $forum_id, ! 'user_id' => (int) $user_id, ! 'username' => (string) $usernames_ary[$user_id], 'group_id' => 0, 'group_name' => '' *************** *** 2342,2346 **** * View log */ ! function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id = 0, $topic_id = 0, $mx_user_id = 0, $limit_days = 0, $sort_by = 'l.log_time DESC') { global $db, $mx_user, $phpbb_auth, $phpEx, $phpbb_root_path, $phpbb_admin_path; --- 2342,2346 ---- * View log */ ! function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id = 0, $topic_id = 0, $user_id = 0, $limit_days = 0, $sort_by = 'l.log_time DESC') { global $db, $mx_user, $phpbb_auth, $phpEx, $phpbb_root_path, $phpbb_admin_path; *************** *** 2376,2382 **** case 'user': $log_type = LOG_USERS; ! $sql_forum = 'AND l.reportee_id = ' . (int) $mx_user_id; break; ! case 'users': $log_type = LOG_USERS; --- 2376,2382 ---- case 'user': $log_type = LOG_USERS; ! $sql_forum = 'AND l.reportee_id = ' . (int) $user_id; break; ! case 'users': $log_type = LOG_USERS; *************** *** 2388,2392 **** $sql_forum = ''; break; ! default: return; --- 2388,2392 ---- $sql_forum = ''; break; ! default: return; *************** *** 2567,2579 **** * Update foes - remove moderators and administrators from foe lists... */ ! function update_foes($group_id = false, $mx_user_id = false) { global $db, $phpbb_auth; // update foes for some user ! if (is_array($mx_user_id) && sizeof($mx_user_id)) { $sql = 'DELETE FROM ' . ZEBRA_TABLE . ' ! WHERE ' . $db->sql_in_set('zebra_id', $mx_user_id) . ' AND foe = 1'; $db->sql_query($sql); --- 2567,2579 ---- * Update foes - remove moderators and administrators from foe lists... */ ! function update_foes($group_id = false, $user_id = false) { global $db, $phpbb_auth; // update foes for some user ! if (is_array($user_id) && sizeof($user_id)) { $sql = 'DELETE FROM ' . ZEBRA_TABLE . ' ! WHERE ' . $db->sql_in_set('zebra_id', $user_id) . ' AND foe = 1'; $db->sql_query($sql); *************** *** 2638,2652 **** $result = $db->sql_query($sql); ! $mx_users = array(); while ($row = $db->sql_fetchrow($result)) { ! $mx_users[] = (int) $row['user_id']; } $db->sql_freeresult($result); ! if (sizeof($mx_users)) ! { $sql = 'DELETE FROM ' . ZEBRA_TABLE . ' ! WHERE ' . $db->sql_in_set('zebra_id', $mx_users) . ' AND foe = 1'; $db->sql_query($sql); --- 2638,2652 ---- $result = $db->sql_query($sql); ! $users = array(); while ($row = $db->sql_fetchrow($result)) { ! $users[] = (int) $row['user_id']; } $db->sql_freeresult($result); ! if (sizeof($users)) ! { $sql = 'DELETE FROM ' . ZEBRA_TABLE . ' ! WHERE ' . $db->sql_in_set('zebra_id', $users) . ' AND foe = 1'; $db->sql_query($sql); *************** *** 2662,2668 **** foreach ($phpbb_auth->acl_get_list(false, array('a_', 'm_'), false) as $forum_id => $forum_ary) { ! foreach ($forum_ary as $phpbb_auth_option => $mx_user_ary) { ! $perms = array_merge($perms, $mx_user_ary); } } --- 2662,2668 ---- foreach ($phpbb_auth->acl_get_list(false, array('a_', 'm_'), false) as $forum_id => $forum_ary) { ! foreach ($forum_ary as $phpbb_auth_option => $user_ary) { ! $perms = array_merge($perms, $user_ary); } } *************** *** 2681,2685 **** * Lists inactive users */ ! function view_inactive_users(&$mx_users, &$mx_user_count, $limit = 0, $offset = 0, $limit_days = 0, $sort_by = 'user_inactive_time DESC') { global $db, $mx_user; --- 2681,2685 ---- * Lists inactive users */ ! function view_inactive_users(&$users, &$user_count, $limit = 0, $offset = 0, $limit_days = 0, $sort_by = 'user_inactive_time DESC') { global $db, $mx_user; *************** *** 2690,2697 **** (($limit_days) ? " AND user_inactive_time >= $limit_days" : ''); $result = $db->sql_query($sql); ! $mx_user_count = (int) $db->sql_fetchfield('user_count'); $db->sql_freeresult($result); ! if ($offset >= $mx_user_count) { $offset = ($offset - $limit < 0) ? 0 : $offset - $limit; --- 2690,2697 ---- (($limit_days) ? " AND user_inactive_time >= $limit_days" : ''); $result = $db->sql_query($sql); ! $user_count = (int) $db->sql_fetchfield('user_count'); $db->sql_freeresult($result); ! if ($offset >= $user_count) { $offset = ($offset - $limit < 0) ? 0 : $offset - $limit; *************** *** 2726,2731 **** break; } ! ! $mx_users[] = $row; } --- 2726,2731 ---- break; } ! ! $users[] = $row; } *************** *** 2736,2740 **** * Lists warned users */ ! function view_warned_users(&$mx_users, &$mx_user_count, $limit = 0, $offset = 0, $limit_days = 0, $sort_by = 'user_warnings DESC') { global $db; --- 2736,2740 ---- * Lists warned users */ ! function view_warned_users(&$users, &$user_count, $limit = 0, $offset = 0, $limit_days = 0, $sort_by = 'user_warnings DESC') { global $db; *************** *** 2746,2750 **** ORDER BY $sort_by"; $result = $db->sql_query_limit($sql, $limit, $offset); ! $mx_users = $db->sql_fetchrowset($result); $db->sql_freeresult($result); --- 2746,2750 ---- ORDER BY $sort_by"; $result = $db->sql_query_limit($sql, $limit, $offset); ! $users = $db->sql_fetchrowset($result); $db->sql_freeresult($result); *************** *** 2754,2758 **** ' . (($limit_days) ? "AND user_last_warning >= $limit_days" : ''); $result = $db->sql_query($sql); ! $mx_user_count = (int) $db->sql_fetchfield('user_count'); $db->sql_freeresult($result); --- 2754,2758 ---- ' . (($limit_days) ? "AND user_last_warning >= $limit_days" : ''); $result = $db->sql_query($sql); ! $user_count = (int) $db->sql_fetchfield('user_count'); $db->sql_freeresult($result); *************** *** 2889,2900 **** } ! if ($database_size !== false) ! { ! $database_size = ($database_size >= 1048576) ? sprintf('%.2f ' . $mx_user->lang['MB'], ($database_size / 1048576)) : (($database_size >= 1024) ? sprintf('%.2f ' . $mx_user->lang['KB'], ($database_size / 1024)) : sprintf('%.2f ' . $mx_user->lang['BYTES'], $database_size)); ! } ! else ! { ! $database_size = $mx_user->lang['NOT_AVAILABLE']; ! } return $database_size; --- 2889,2893 ---- } ! $database_size = ($database_size !== false) ? get_formatted_filesize($database_size) : $mx_user->lang['NOT_AVAILABLE']; return $database_size; *************** *** 2913,2917 **** @fputs($fsock, "HOST: $host\r\n"); @fputs($fsock, "Connection: close\r\n\r\n"); ! $file_info = ''; $get_info = false; --- 2906,2910 ---- @fputs($fsock, "HOST: $host\r\n"); @fputs($fsock, "Connection: close\r\n\r\n"); ! $file_info = ''; $get_info = false; *************** *** 2952,2956 **** } } ! return $file_info; } --- 2945,2949 ---- } } ! return $file_info; } *************** *** 2968,2972 **** $expire_date = time() - ($board_config['warnings_expire_days'] * 86400); ! $warning_list = $mx_user_list = array(); $sql = 'SELECT * FROM ' . WARNINGS_TABLE . " --- 2961,2965 ---- $expire_date = time() - ($board_config['warnings_expire_days'] * 86400); ! $warning_list = $user_list = array(); $sql = 'SELECT * FROM ' . WARNINGS_TABLE . " *************** *** 2977,2981 **** { $warning_list[] = $row['warning_id']; ! $mx_user_list[$row['user_id']] = isset($mx_user_list[$row['user_id']]) ? ++$mx_user_list[$row['user_id']] : 1; } $db->sql_freeresult($result); --- 2970,2974 ---- { $warning_list[] = $row['warning_id']; ! $user_list[$row['user_id']] = isset($user_list[$row['user_id']]) ? ++$user_list[$row['user_id']] : 1; } $db->sql_freeresult($result); *************** *** 2988,2996 **** WHERE ' . $db->sql_in_set('warning_id', $warning_list); $db->sql_query($sql); ! ! foreach ($mx_user_list as $mx_user_id => $value) { $sql = 'UPDATE ' . USERS_TABLE . " SET user_warnings = user_warnings - $value ! WHERE user_id = $mx_user_id"; $db->sql_query($sql); } --- 2981,2989 ---- WHERE ' . $db->sql_in_set('warning_id', $warning_list); $db->sql_query($sql); ! ! foreach ($user_list as $user_id => $value) { $sql = 'UPDATE ' . USERS_TABLE . " SET user_warnings = user_warnings - $value ! WHERE user_id = $user_id"; $db->sql_query($sql); } *************** *** 3009,3012 **** --- 3002,3028 ---- global $db; + // Here we check permission consistency + + // Sometimes, it can happen permission tables having forums listed which do not exist + $sql = 'SELECT forum_id + FROM ' . FORUMS_TABLE; + $result = $db->sql_query($sql); + + $forum_ids = array(0); + while ($row = $db->sql_fetchrow($result)) + { + $forum_ids[] = $row['forum_id']; + } + $db->sql_freeresult($result); + + // Delete those rows from the acl tables not having listed the forums above + $sql = 'DELETE FROM ' . ACL_GROUPS_TABLE . ' + WHERE ' . $db->sql_in_set('forum_id', $forum_ids, true); + $db->sql_query($sql); + + $sql = 'DELETE FROM ' . ACL_USERS_TABLE . ' + WHERE ' . $db->sql_in_set('forum_id', $forum_ids, true); + $db->sql_query($sql); + set_config('database_last_gc', time(), true); } Index: functions_posting.php =================================================================== RCS file: /cvsroot/mxbb/core/includes/shared/phpbb3/includes/functions_posting.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** functions_posting.php 12 Feb 2008 10:54:05 -0000 1.2 --- functions_posting.php 15 Jun 2008 21:01:42 -0000 1.3 *************** *** 10,14 **** /** ! * @ignore */ if (!defined('IN_PORTAL')) --- 10,14 ---- /** ! * @ignore */ if (!defined('IN_PORTAL')) *************** *** 620,623 **** --- 620,628 ---- if ($config['img_imagick'] && function_exists('passthru')) { + if (substr($config['img_imagick'], -1) !== '/') + { + $config['img_imagick'] .= '/'; + } + @passthru(escapeshellcmd($config['img_imagick']) . 'convert' . ((defined('PHP_OS') && preg_match('#^win#i', PHP_OS)) ? '.exe' : '') . ' -quality 85 -antialias -sample ' . $new_width . 'x' . $new_height . ' "' . str_replace('\\', '/', $source) . '" +profile "*" "' . str_replace('\\', '/', $destination) . '"'); *************** *** 662,665 **** --- 667,676 ---- { $new_image = imagecreate($new_width, $new_height); + + if ($new_image === false) + { + return false; + } + imagecopyresized($new_image, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height); } *************** *** 667,670 **** --- 678,687 ---- { $new_image = imagecreatetruecolor($new_width, $new_height); + + if ($new_image === false) + { + return false; + } + imagecopyresampled($new_image, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height); } *************** *** 767,774 **** } ! $download_link = append_sid("{$phpbb_root_path}download.$phpEx", 'mode=view&id=' . (int) $attach_row['attach_id'], true, ($attach_row['is_orphan']) ? $user->session_id : false); $template->assign_block_vars('attach_row', array( 'FILENAME' => basename($attach_row['real_filename']), 'FILE_COMMENT' => $attach_row['attach_comment'], 'ATTACH_ID' => $attach_row['attach_id'], --- 784,792 ---- } ! $download_link = append_sid("{$phpbb_root_path}download/file.$phpEx", 'mode=view&id=' . (int) $attach_row['attach_id'], true, ($attach_row['is_orphan']) ? $user->session_id : false); $template->assign_block_vars('attach_row', array( 'FILENAME' => basename($attach_row['real_filename']), + 'A_FILENAME' => addslashes(basename($attach_row['real_filename'])), 'FILE_COMMENT' => $attach_row['attach_comment'], 'ATTACH_ID' => $attach_row['attach_id'], *************** *** 923,927 **** " . ((!$auth->acl_get('m_approve', $forum_id)) ? 'AND p.post_approved = 1' : '') . ' ' . (($mode == 'post_review') ? " AND p.post_id > $cur_post_id" : '') . ' ! ORDER BY p.post_time DESC'; $result = $db->sql_query_limit($sql, $config['posts_per_page']); --- 941,946 ---- " . ((!$auth->acl_get('m_approve', $forum_id)) ? 'AND p.post_approved = 1' : '') . ' ' . (($mode == 'post_review') ? " AND p.post_id > $cur_post_id" : '') . ' ! ORDER BY p.post_time '; ! $sql .= ($mode == 'post_review') ? 'ASC' : 'DESC'; $result = $db->sql_query_limit($sql, $config['posts_per_page']); Index: bbcode.php =================================================================== RCS file: /cvsroot/mxbb/core/includes/shared/phpbb3/includes/bbcode.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** bbcode.php 12 Feb 2008 10:54:05 -0000 1.2 --- bbcode.php 15 Jun 2008 21:01:41 -0000 1.3 *************** *** 1,14 **** <?php ! /** * * @package phpBB3 * @version $Id$ ! * @copyright (c) 2005 phpBB Group ! * @license http://opensource.org/licenses/gpl-license.php GNU Public License * */ /** ! * @ignore */ if (!defined('IN_PORTAL')) --- 1,14 ---- <?php ! /** * * @package phpBB3 * @version $Id$ ! * @copyright (c) 2005 phpBB Group ! * @license http://opensource.org/licenses/gpl-license.php GNU Public License * */ /** ! * @ignore */ if (!defined('IN_PORTAL')) *************** *** 17,20 **** --- 17,25 ---- } + // + // MODIFICATIONS: + // None + // + /** * BBCode class *************** *** 81,84 **** --- 86,90 ---- $bbcodes_set = $bitfield->get_all_set(); + $undid_bbcode_specialchars = false; foreach ($bbcodes_set as $bbcode_id) { *************** *** 101,104 **** --- 107,118 ---- if (sizeof($preg['search'])) { + // we need to turn the entities back into their original form to allow the + // search patterns to work properly + if (!$undid_bbcode_specialchars) + { + $message = str_replace(array(':', '.'), array(':', '.'), $message); + $undid_bbcode_specialchars = true; + } + $message = preg_replace($preg['search'], $preg['replace'], $message); $preg = array('search' => array(), 'replace' => array()); *************** *** 165,172 **** { // To circumvent replacing newlines with <br /> for the generated html, ! // we just remove newlines here. We do not do this within the admin panel to ! // let the admin lay out his html code nicely ! $row['bbcode_tpl'] = str_replace(array("\n", "\r"), '', $row['bbcode_tpl']); ! $row['second_pass_replace'] = str_replace(array("\n", "\r"), '', $row['second_pass_replace']); $rowset[$row['bbcode_id']] = $row; --- 179,185 ---- { // To circumvent replacing newlines with <br /> for the generated html, ! // we use carriage returns here. They are later changed back to newlines ! $row['bbcode_tpl'] = str_replace("\n", "\r", $row['bbcode_tpl']); ! $row['second_pass_replace'] = str_replace("\n", "\r", $row['second_pass_replace']); $rowset[$row['bbcode_id']] = $row; *************** *** 342,346 **** // to replace all {VARS} to corresponding backreferences // Note that backreferences are numbered from bbcode_match ! if (preg_match_all('/\{(URL|EMAIL|TEXT|COLOR|NUMBER)[0-9]*\}/', $rowset[$bbcode_id]['bbcode_match'], $m)) { foreach ($m[0] as $i => $tok) --- 355,359 ---- // to replace all {VARS} to corresponding backreferences // Note that backreferences are numbered from bbcode_match ! if (preg_match_all('/\{(URL|LOCAL_URL|EMAIL|TEXT|SIMPLETEXT|IDENTIFIER|COLOR|NUMBER)[0-9]*\}/', $rowset[$bbcode_id]['bbcode_match'], $m)) { foreach ($m[0] as $i => $tok) *************** *** 392,396 **** { global $user; ! $bbcode_hardtpl = array( 'b_open' => '<span style="font-weight: bold">', --- 405,409 ---- { global $user; ! $bbcode_hardtpl = array( 'b_open' => '<span style="font-weight: bold">', |