################################################################################ ## ## Hack Title: phpBB 2.0.8a - 2.0.9 Code Changes ## Hack Version: 1.0.0 ## Hack Author: Complied by Thoul, code by phpBB Group ## Hack Description: All changes in phpBB made between 2.0.8a and 2.0.9. ## ## Compatibility: 2.0.8a ## Installation Level: Easy ## Installation Time: 15 minutes ## ## Files To Edit: 20 ## admin/admin_board.php ## admin/index.php ## common.php ## faq.php ## groupcp.php ## index.php ## memberlist.php ## modcp.php ## posting.php ## privmsg.php ## profile.php ## search.php ## viewonline.php ## viewtopic.php ## includes/bbcode.php ## includes/functions_post.php ## includes/page_header.php ## includes/sessions.php ## includes/usercp_avatar.php ## includes/usercp_viewprofile.php ## ## Support: http://www.phpbbhacks.com/forums ## ################################################################################ ## ## You downloaded this hack from phpBBHacks.com, ## the #1 source for phpBB related downloads. ## ## Please visit http://www.phpbbhacks.com/forums for support. ## ################################################################################ ## ## This hack is released under the GPL License. ## ################################################################################ ## ## BEFORE ADDING THIS HACK TO YOUR FORUM, please be sure to backup ALL ## affected files. ## ################################################################################ ## ##----------[ PLEASE NOTE ]------------------------------ ## ## Once you have completed the code changes, create an install/ directory in ## your forum's root directory, and upload the update_to_209.php file that comes ## in any phpBB 2.0.9 download to the install/ directory. Run update_to_209.php ## by opening it via your web browser, just as you would a normal forum page. ## Afterward, delete the file and the install/ directory so that your forum is ## accessible again. ## ##----------[ OPEN ]------------------------------------- ## admin/admin_board.php ## ##----------[ FIND ]------------------------------------- ## $default_config[$config_name] = $config_value; ## ##----------[ REPLACE WITH ]----------------------------- ## $default_config[$config_name] = str_replace("'", "\'", $config_value); ## ##----------[ OPEN ]------------------------------------- ## admin/index.php ## ##----------[ FIND ]------------------------------------- ## AND u.user_session_time >= " . ( time() - 300 ) . " ## ##----------[ REPLACE WITH ]------------------------------- ## AND s.session_time >= " . ( time() - 300 ) . " ## ##----------[ OPEN ]------------------------------------- ## common.php ## ##----------[ PLEASE NOTE ]------------------------------ ## ## The changes to this file disable automatic registering of global variables. ## This does cause some hacks to stop working. ## ##----------[ FIND ]------------------------------------- ## die("Hacking attempt"); } ## ##----------[ AFTER, ADD ]------------------------------- ## // function unset_vars(&$var) { while (list($var_name, $null) = @each($var)) { unset($GLOBALS[$var_name]); } return; } // ## ##----------[ FIND ]------------------------------------- ## set_magic_quotes_runtime(0); // Disable magic_quotes_runtime ## ##----------[ AFTER, ADD ]------------------------------- ## $ini_val = (@phpversion() >= '4.0.0') ? 'ini_get' : 'get_cfg_var'; // Unset globally registered vars - PHP5 ... hhmmm if (@$ini_val('register_globals') == '1' || strtolower(@$ini_val('register_globals')) == 'on') { $var_prefix = 'HTTP'; $var_suffix = '_VARS'; $test = array('_GET', '_POST', '_SERVER', '_COOKIE', '_ENV'); foreach ($test as $var) { if (is_array(${$var_prefix . $var . $var_suffix})) { unset_vars(${$var_prefix . $var . $var_suffix}); } if (is_array(${$var})) { unset_vars(${$var}); } } if (is_array(${'_FILES'})) { unset_vars(${'_FILES'}); } if (is_array(${'HTTP_POST_FILES'})) { unset_vars(${'HTTP_POST_FILES'}); } } ## ##----------[ FIND ]------------------------------------- ## $images = array(); $lang = array(); ## ##----------[ AFTER, ADD ]------------------------------- ## $nav_links = array(); ## ##----------[ FIND ]------------------------------------- ## if( getenv('HTTP_X_FORWARDED_FOR') != '' ) { $client_ip = ( !empty($HTTP_SERVER_VARS['REMOTE_ADDR']) ) ? $HTTP_SERVER_VARS['REMOTE_ADDR'] : ( ( !empty($HTTP_ENV_VARS['REMOTE_ADDR']) ) ? $HTTP_ENV_VARS['REMOTE_ADDR'] : $REMOTE_ADDR ); $entries = explode(',', getenv('HTTP_X_FORWARDED_FOR')); reset($entries); while (list(, $entry) = each($entries)) { $entry = trim($entry); if ( preg_match("/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/", $entry, $ip_list) ) { $private_ip = array('/^0\./', '/^127\.0\.0\.1/', '/^192\.168\..*/', '/^172\.((1[6-9])|(2[0-9])|(3[0-1]))\..*/', '/^10\..*/', '/^224\..*/', '/^240\..*/'); $found_ip = preg_replace($private_ip, $client_ip, $ip_list[1]); if ($client_ip != $found_ip) { $client_ip = $found_ip; break; } } } } else { $client_ip = ( !empty($HTTP_SERVER_VARS['REMOTE_ADDR']) ) ? $HTTP_SERVER_VARS['REMOTE_ADDR'] : ( ( !empty($HTTP_ENV_VARS['REMOTE_ADDR']) ) ? $HTTP_ENV_VARS['REMOTE_ADDR'] : $REMOTE_ADDR ); } ## ##----------[ REPLACE WITH ]----------------------------- ## // I'm removing HTTP_X_FORWARDED_FOR ... this may well cause other problems such as // private range IP's appearing instead of the guilty routable IP, tough, don't // even bother complaining ... go scream and shout at the idiots out there who feel // "clever" is doing harm rather than good ... karma is a great thing ... :) // $client_ip = ( !empty($HTTP_SERVER_VARS['REMOTE_ADDR']) ) ? $HTTP_SERVER_VARS['REMOTE_ADDR'] : ( ( !empty($HTTP_ENV_VARS['REMOTE_ADDR']) ) ? $HTTP_ENV_VARS['REMOTE_ADDR'] : $REMOTE_ADDR ); ## ##----------[ OPEN ]------------------------------------- ## faq.php ## ##----------[ FIND ]------------------------------------- ## // End session management // ## ##----------[ AFTER, ADD ]------------------------------- ## // Set vars to prevent naughtiness $faq = array(); ## ##----------[ FIND ]------------------------------------- ## make_jumpbox('viewforum.'.$phpEx, $forum_id); ## ##----------[ REPLACE WITH ]----------------------------- ## make_jumpbox('viewforum.'.$phpEx); ## ##----------[ OPEN ]------------------------------------- ## groupcp.php ## ##----------[ FIND ]------------------------------------- ## AND aa.group_id = g.group_id(+)"; ## ##----------[ REPLACE WITH ]----------------------------- ## AND aa.group_id (+) = g.group_id"; ## ##----------[ FIND ]------------------------------------- ## // Select all group that the user is a member of or where the user has // a pending membership. // ## ##----------[ AFTER, ADD ]------------------------------- ## $in_group = array(); ## ##----------[ FIND ]------------------------------------- ## $s_hidden_fields = ''; $template->assign_vars(array( ## ##----------[ REPLACE WITH ]----------------------------- ## $s_hidden_fields = ''; $template->assign_vars(array( ## ##----------[ OPEN ]------------------------------------- ## index.php ## ##----------[ FIND ]------------------------------------- ## message_die(GENERAL_ERROR, 'Could not query categories list', '', __LINE__, __FILE__, $sql); } ## ##----------[ AFTER, ADD ]------------------------------- ## $category_rows = array(); ## ##----------[ OPEN ]------------------------------------- ## memberlist.php ## ##----------[ FIND ]------------------------------------- ## 'ROW_NUMBER' => $i + ( $HTTP_GET_VARS['start'] + 1 ), ## ##----------[ REPLACE WITH ]----------------------------- ## 'ROW_NUMBER' => $i + ( $start + 1 ), ## ##----------[ OPEN ]------------------------------------- ## modcp.php ## ##----------[ FIND ]------------------------------------- ## 'S_FORUM_SELECT' => make_forum_select("new_forum_id", false, $forum_id)) ); for($i = 0; $i < $total_posts; $i++) { $post_id = $postrow[$i]['post_id']; $poster_id = $postrow[$i]['user_id']; ## ##----------[ REPLACE WITH ]----------------------------- ## 'S_FORUM_SELECT' => make_forum_select("new_forum_id", false, $forum_id)) ); // // Define censored word matches // $orig_word = array(); $replacement_word = array(); obtain_word_list($orig_word, $replacement_word); for($i = 0; $i < $total_posts; $i++) { $post_id = $postrow[$i]['post_id']; $poster_id = $postrow[$i]['poster_id']; ## ##----------[ FIND AND DELETE ]------------------------------------- ## // // Define censored word matches // $orig_word = array(); $replacement_word = array(); obtain_word_list($orig_word, $replacement_word); ## ##----------[ OPEN ]------------------------------------- ## posting.php ## ##----------[ FIND ]------------------------------------- ## $params = array('submit' => 'post', 'confirm' => 'confirm', 'preview' => 'preview', 'delete' => 'delete', 'poll_delete' => 'poll_delete', 'poll_add' => 'add_poll_option', 'poll_edit' => 'edit_poll_option', 'mode' => 'mode'); ## ##----------[ REPLACE WITH ]----------------------------- ## $params = array('submit' => 'post', 'preview' => 'preview', 'delete' => 'delete', 'poll_delete' => 'poll_delete', 'poll_add' => 'add_poll_option', 'poll_edit' => 'edit_poll_option', 'mode' => 'mode'); ## ##----------[ FIND ]------------------------------------- ## $$var = ''; } } $params = array('forum_id' => POST_FORUM_URL, 'topic_id' => POST_TOPIC_URL, 'post_id' => POST_POST_URL); ## ##----------[ REPLACE WITH ]----------------------------- ## $$var = ''; } } $confirm = isset($HTTP_POST_VARS['confirm']) ? true : false; $params = array('forum_id' => POST_FORUM_URL, 'topic_id' => POST_TOPIC_URL, 'post_id' => POST_POST_URL); ## ##----------[ OPEN ]------------------------------------- ## privmsg.php ## ##----------[ FIND ]------------------------------------- ## $pm_sql_user .= "AND ( ( pm.privmsgs_to_userid = " . $userdata['user_id'] . " ## ##----------[ AFTER, ADD ]------------------------------- ## $pm_sql_user = "AND ( ( pm.privmsgs_to_userid = " . $userdata['user_id'] . " ## ##----------[ FIND ]------------------------------------- ## $temp_url = append_sid("privmsg.$phpEx?mode=post&" . POST_USERS_URL . "=$poster_id"); ## ##----------[ REPLACE WITH ]----------------------------- ## $temp_url = append_sid("privmsg.$phpEx?mode=post&" . POST_USERS_URL . "=$user_id_from"); ## ##----------[ FIND ]------------------------------------- ## OR privmsgs_type = " . PRIVMSGS_UNERAD_MAIL . " ) "; ## ##----------[ REPLACE WITH ]----------------------------- ## OR privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . " ) "; ## ##----------[ FIND ]------------------------------------- ## $post_new_mesg_url = '' . $lang['Post_new_message'] . ''; ## ##----------[ REPLACE WITH ]----------------------------- ## $post_new_mesg_url = '' . $lang['Send_a_new_message'] . ''; ## ##----------[ FIND ]------------------------------------- ## $limit_msg_time = ''; $post_days = 0; ## ##----------[ REPLACE WITH ]----------------------------- ## $limit_msg_time = $limit_msg_time_total = ''; $msg_days = 0; ## ##----------[ FIND ]------------------------------------- ## 'U_POST_NEW_TOPIC' => $post_new_topic_url) ## ##----------[ REPLACE WITH ]----------------------------- ## 'U_POST_NEW_TOPIC' => append_sid("privmsg.$phpEx?mode=post")) ## ##----------[ OPEN ]------------------------------------- ## profile.php ## ##----------[ FIND ]------------------------------------- ## $mode = ( isset($HTTP_GET_VARS['mode']) ) ? $HTTP_GET_VARS['mode'] : $HTTP_POST_VARS['mode']; ## ##----------[ AFTER, ADD ]------------------------------- ## $mode = htmlspecialchars($mode); ## ##----------[ OPEN ]------------------------------------- ## search.php ## ##----------[ FIND ]------------------------------------- ## $search_time = time() - ( ( ( !empty($HTTP_POST_VARS['search_time']) ) ? intval($HTTP_POST_VARS['search_time']) : intval($HTTP_GET_VARS['search_time']) ) * 86400 ); ## ##----------[ AFTER, ADD ]------------------------------- ## $topic_days = (!empty($HTTP_POST_VARS['search_time'])) ? intval($HTTP_POST_VARS['search_time']) : intval($HTTP_GET_VARS['search_time']); ## ##----------[ FIND ]------------------------------------- ## $search_time = 0; ## ##----------[ AFTER, ADD ]------------------------------- ## $topic_days = 0; ## ##----------[ OPEN ]------------------------------------- ## viewonline.php ## ##----------[ FIND ]------------------------------------- ## 'L_WHOSONLINE' => $lang['Who_is_online'], ## ##----------[ REPLACE WITH ]----------------------------- ## 'L_WHOSONLINE' => $lang['Who_is_Online'], ## ##----------[ OPEN ]------------------------------------- ## viewtopic.php ## ##----------[ FIND ]------------------------------------- ## $session_id = isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_sid']) ? $HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_sid'] : $HTTP_GET_VARS['sid']; ## ##----------[ AFTER, ADD ]------------------------------- ## if (!preg_match('/^[A-Za-z0-9]*$/', $session_id)) { $session_id = ''; } ## ##----------[ OPEN ]------------------------------------- ## includes/bbcode.php ## ##----------[ FIND ]------------------------------------- ## $text = preg_replace("#\[img\]((ht|f)tp://)([^ \?&=\"\n\r\t<]*?(\.(jpg|jpeg|gif|png)))\[/img\]#sie", "'[img:$uid]\\1' . str_replace(' ', '%20', '\\3') . '[/img:$uid]'", $text); ## ##----------[ REPLACE WITH ]----------------------------- ## $text = preg_replace("#\[img\]((http|ftp|https|ftps)://)([^ \?&=\#\"\n\r\t<]*?(\.(jpg|jpeg|gif|png)))\[/img\]#sie", "'[img:$uid]\\1' . str_replace(' ', '%20', '\\3') . '[/img:$uid]'", $text); ## ##----------[ OPEN ]------------------------------------- ## includes/functions_post.php ## ##----------[ FIND ]------------------------------------- ## $page_title = $lang['Review_topic'] . " - $topic_title"; ## ##----------[ REPLACE WITH ]----------------------------- ## $page_title = $lang['Emoticons'] . " - $topic_title"; ## ##----------[ OPEN ]------------------------------------- ## includes/page_header.php ## ##----------[ FIND ]------------------------------------- ## $online_userlist = ''; ## ##----------[ AFTER, ADD ]------------------------------- ## $l_online_users = ''; ## ##----------[ FIND ]------------------------------------- ## $prev_user_ip = ''; ## ##----------[ REPLACE WITH ]----------------------------- ## $prev_user_ip = $prev_session_ip = ''; ## ##----------[ OPEN ]------------------------------------- ## includes/sessions.php ## ##----------[ FIND ]------------------------------------- ## $sessionmethod = SESSION_METHOD_GET; } $last_visit = 0; ## ##----------[ REPLACE WITH ]----------------------------- ## $sessionmethod = SESSION_METHOD_GET; } // if (!preg_match('/^[A-Za-z0-9]*$/', $session_id)) { $session_id = ''; } $last_visit = 0; ## ##----------[ FIND ]------------------------------------- ## $sessionmethod = SESSION_METHOD_GET; } // // Does a session exist? // if ( !empty($session_id) ) ## ##----------[ REPLACE WITH ]----------------------------- ## $sessionmethod = SESSION_METHOD_GET; } // if (!preg_match('/^[A-Za-z0-9]*$/', $session_id)) { $session_id = ''; } // // Does a session exist? // if ( !empty($session_id) ) ## ##----------[ FIND ]------------------------------------- ## $sessionmethod = SESSION_METHOD_GET; } // // Delete existing session // ## ##----------[ REPLACE WITH ]----------------------------- ## $sessionmethod = SESSION_METHOD_GET; } if (!preg_match('/^[A-Za-z0-9]*$/', $session_id)) { return; } // // Delete existing session // ## ##----------[ OPEN ]------------------------------------- ## includes/usercp_avatar.php ## ##----------[ FIND ]------------------------------------- ## if ( !preg_match('#^((http)|(ftp):\/\/[\w\-]+?\.([\w\-]+\.)+[\w]+(:[0-9]+)*\/.*?\.(gif|jpg|jpeg|png)$)#is', $avatar_filename) ) ## ##----------[ REPLACE WITH ]----------------------------- ## if ( !preg_match("#^((ht|f)tp://)([^ \?&=\#\"\n\r\t<]*?(\.(jpg|jpeg|gif|png))$)#is", $avatar_filename) ) ## ##----------[ OPEN ]------------------------------------- ## includes/usercp_viewprofile.php ## ##----------[ FIND ]------------------------------------- ## message_die(GENERAL_ERROR, 'Could not obtain ranks information', '', __LINE__, __FILE__, $sql); } ## ##----------[ AFTER, ADD ]------------------------------- ## $ranksrow = array(); ## ##----------[ SAVE AND CLOSE ALL FILES ]----------------- ## ## End ##