|
From: OryNider <ory...@us...> - 2008-02-08 07:38:59
|
Update of /cvsroot/mxbb/mx_phpbb/includes In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv30619 Modified Files: forum_hack.php Log Message: upgrade Index: forum_hack.php =================================================================== RCS file: /cvsroot/mxbb/mx_phpbb/includes/forum_hack.php,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** forum_hack.php 8 Feb 2008 04:26:20 -0000 1.29 --- forum_hack.php 8 Feb 2008 07:38:55 -0000 1.30 *************** *** 319,323 **** // We have a problem here, when p denotes a pm_id, and not a post_id!!!!!!!!!!!!!!!!!!! // ! if ( $sql ) { if ( !( $result = $db->sql_query( $sql ) ) ) --- 319,323 ---- // We have a problem here, when p denotes a pm_id, and not a post_id!!!!!!!!!!!!!!!!!!! // ! if ($sql) { if ( !( $result = $db->sql_query( $sql ) ) ) *************** *** 436,440 **** // ! // Redirect phpBB login calls to Mx-Publisher // if ($script_name == 'login') --- 436,440 ---- // ! // Redirect phpBB login calls to mxBB // if ($script_name == 'login') *************** *** 800,810 **** // Replaces same function in function.php // -------------------------------------------------------------------------------- ! function make_jumpbox( $action, $match_forum_id = 0 ) { // // Replaces same function in function.php // ! make_jumpbox( $this->phpbb_url . $action, $match_forum_id ); } // -------------------------------------------------------------------------------- --- 800,949 ---- // Replaces same function in function.php // -------------------------------------------------------------------------------- ! function make_jumpbox($action, $match_forum_id = 0) { // // Replaces same function in function.php // ! $this->make_jumpbox_ref($this->phpbb_url . $action, $match_forum_id); ! } ! ! function make_jumpbox_ref($action, $match_forum_id, &$forums_list) ! { ! global $template, $userdata, $lang, $db, $nav_links, $phpEx, $SID; ! ! // $is_auth = auth(AUTH_VIEW, AUTH_LIST_ALL, $userdata); ! ! $sql = "SELECT c.cat_id, c.cat_title, c.cat_order ! FROM " . CATEGORIES_TABLE . " c, " . FORUMS_TABLE . " f ! WHERE f.cat_id = c.cat_id ! GROUP BY c.cat_id, c.cat_title, c.cat_order ! ORDER BY c.cat_order"; ! if ( !($result = $db->sql_query($sql)) ) ! { ! mx_message_die(GENERAL_ERROR, "Couldn't obtain category list.", "", __LINE__, __FILE__, $sql); ! } ! ! $category_rows = array(); ! while ( $row = $db->sql_fetchrow($result) ) ! { ! $category_rows[] = $row; ! } ! ! if ( $total_categories = count($category_rows) ) ! { ! $sql = "SELECT * ! FROM " . FORUMS_TABLE . " ! ORDER BY cat_id, forum_order"; ! if ( !($result = $db->sql_query($sql)) ) ! { ! mx_message_die(GENERAL_ERROR, 'Could not obtain forums information', '', __LINE__, __FILE__, $sql); ! } ! ! $boxstring = '<select name="' . POST_FORUM_URL . '" onchange="if(this.options[this.selectedIndex].value != -1){ forms[\'jumpbox\'].submit() }"><option value="-1">' . $lang['Select_forum'] . '</option>'; ! ! $forum_rows = array(); ! while ( $row = $db->sql_fetchrow($result) ) ! { ! $forum_rows[] = $row; ! ! // Begin Simple Subforums MOD ! $forums_list[] = $row; ! // End Simple Subforums MOD ! } ! ! if ( $total_forums = count($forum_rows) ) ! { ! for($i = 0; $i < $total_categories; $i++) ! { ! $boxstring_forums = ''; ! for($j = 0; $j < $total_forums; $j++) ! { ! if ( !$forum_rows[$j]['forum_parent'] && $forum_rows[$j]['cat_id'] == $category_rows[$i]['cat_id'] && $forum_rows[$j]['auth_view'] <= AUTH_REG ) ! { ! ! // if ( !$forum_rows[$j]['forum_parent'] && $forum_rows[$j]['cat_id'] == $category_rows[$i]['cat_id'] && $is_auth[$forum_rows[$j]['forum_id']]['auth_view'] ) ! // { ! ! // Begin Simple Subforums MOD ! $id = $forum_rows[$j]['forum_id']; ! // End Simple Subforums MOD ! ! $selected = ( $forum_rows[$j]['forum_id'] == $match_forum_id ) ? 'selected="selected"' : ''; ! $boxstring_forums .= '<option value="' . $forum_rows[$j]['forum_id'] . '"' . $selected . '>' . $forum_rows[$j]['forum_name'] . '</option>'; ! ! // ! // Add an array to $nav_links for the Mozilla navigation bar. ! // 'chapter' and 'forum' can create multiple items, therefore we are using a nested array. ! // ! $nav_links['chapter forum'][$forum_rows[$j]['forum_id']] = array ( ! 'url' => mx_append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=" . $forum_rows[$j]['forum_id']), ! 'title' => $forum_rows[$j]['forum_name'] ! ); ! ! // Begin Simple Subforums MOD ! for( $k = 0; $k < $total_forums; $k++ ) ! { ! if ( $forum_rows[$k]['forum_parent'] == $id && $forum_rows[$k]['cat_id'] == $category_rows[$i]['cat_id'] && $forum_rows[$k]['auth_view'] <= AUTH_REG ) ! { ! // if ( $forum_rows[$k]['forum_parent'] == $id && $forum_rows[$k]['cat_id'] == $category_rows[$i]['cat_id'] && $is_auth[$forum_rows[$k]['forum_id']]['auth_view'] ) ! // { ! $selected = ( $forum_rows[$k]['forum_id'] == $match_forum_id ) ? 'selected="selected"' : ''; ! $boxstring_forums .= '<option value="' . $forum_rows[$k]['forum_id'] . '"' . $selected . '>-- ' . $forum_rows[$k]['forum_name'] . '</option>'; ! ! // ! // Add an array to $nav_links for the Mozilla navigation bar. ! // 'chapter' and 'forum' can create multiple items, therefore we are using a nested array. ! // ! $nav_links['chapter forum'][$forum_rows[$k]['forum_id']] = array ( ! 'url' => mx_append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=" . $forum_rows[$k]['forum_id']), ! 'title' => $forum_rows[$k]['forum_name'] ! ); ! ! } ! } ! // End Simple Subforums MOD ! ! } ! } ! ! if ( $boxstring_forums != '' ) ! { ! $boxstring .= '<option value="-1"> </option>'; ! $boxstring .= '<option value="-1">' . $category_rows[$i]['cat_title'] . '</option>'; ! $boxstring .= '<option value="-1">----------------</option>'; ! $boxstring .= $boxstring_forums; ! } ! } ! } ! ! $boxstring .= '</select>'; ! } ! else ! { ! $boxstring .= '<select name="' . POST_FORUM_URL . '" onchange="if(this.options[this.selectedIndex].value != -1){ forms[\'jumpbox\'].submit() }"></select>'; ! } ! ! // Let the jumpbox work again in sites having additional session id checks. ! // if ( !empty($SID) ) ! // { ! $boxstring .= '<input type="hidden" name="sid" value="' . $userdata['session_id'] . '" />'; ! // } ! ! $template->set_filenames(array( ! 'jumpbox' => 'jumpbox.tpl') ! ); ! $template->assign_vars(array( ! 'L_GO' => $lang['Go'], ! 'L_JUMP_TO' => $lang['Jump_to'], ! 'L_SELECT_FORUM' => $lang['Select_forum'], ! ! 'S_JUMPBOX_SELECT' => $boxstring, ! 'S_JUMPBOX_ACTION' => append_sid($action)) ! ); ! $template->assign_var_from_handle('JUMPBOX', 'jumpbox'); ! ! return; } + // -------------------------------------------------------------------------------- *************** *** 816,820 **** // Replaces same function in function.php // ! return generate_pagination( $this->full_url( $base_url ), $num_items, $per_page, $start_item, $add_prevnext_text ); } --- 955,959 ---- // Replaces same function in function.php // ! return phpBB2::generate_pagination( $this->full_url( $base_url ), $num_items, $per_page, $start_item, $add_prevnext_text ); } *************** *** 1363,1371 **** // Commment out the main includes // ! $cashcode = preg_replace('#^(.?include).*(extension).*(\r\n?|\n)#m','// Mx-Publisher: Removed include extension.inc' . "\n", $cashcode); ! $cashcode = preg_replace('#^(.?include).*(common).*(\r\n?|\n)#m','// Mx-Publisher: Removed include common.php' . "\n", $cashcode); // ! // Remove some includes already included by Mx-Publisher // $cashcode = preg_replace ("/include(.*)bbcode/", "//", $cashcode); --- 1502,1510 ---- // Commment out the main includes // ! $cashcode = preg_replace('#^(.?include).*(extension).*(\r\n?|\n)#m','// mxBB: Removed include extension.inc' . "\n", $cashcode); ! $cashcode = preg_replace('#^(.?include).*(common).*(\r\n?|\n)#m','// mxBB: Removed include common.php' . "\n", $cashcode); // ! // Remove some includes already included by mxBB // $cashcode = preg_replace ("/include(.*)bbcode/", "//", $cashcode); *************** *** 1375,1379 **** // NOTE: This regex will only work if "global" is stated on a new line... // ! //$cashcode = preg_replace('#^(.?).*(global)(.*?)($)(.*?)(\r\n?|\n)#m', '// Mx-Publisher rewrite of global, to instance $this in this function' . "\n " . 'global $phpbb_root_path, \\3', $cashcode); // --- 1514,1518 ---- // NOTE: This regex will only work if "global" is stated on a new line... // ! //$cashcode = preg_replace('#^(.?).*(global)(.*?)($)(.*?)(\r\n?|\n)#m', '// mxBB rewrite of global, to instance $this in this function' . "\n " . 'global $phpbb_root_path, \\3', $cashcode); // *************** *** 1402,1406 **** // Remove def of IN_PHPBB // ! $code = preg_replace('#^(.?define).*(IN_PHPBB).*(\r\n?|\n)#m','// Mx-Publisher: Removed IN_PHPBB def' . "\n", $code); // --- 1541,1545 ---- // Remove def of IN_PHPBB // ! $code = preg_replace('#^(.?define).*(IN_PHPBB).*(\r\n?|\n)#m','// mxBB: Removed IN_PHPBB def' . "\n", $code); // *************** *** 1418,1423 **** // Commment out the main includes // ! $code = preg_replace('#^(.?include).*(extension).*(\r\n?|\n)#m','// Mx-Publisher: Removed include extension.inc' . "\n", $code); ! $code = preg_replace('#^(.?include).*(common).*(\r\n?|\n)#m','// Mx-Publisher: Removed include common.php' . "\n", $code); --- 1557,1562 ---- // Commment out the main includes // ! $code = preg_replace('#^(.?include).*(extension).*(\r\n?|\n)#m','// mxBB: Removed include extension.inc' . "\n", $code); ! $code = preg_replace('#^(.?include).*(common).*(\r\n?|\n)#m','// mxBB: Removed include common.php' . "\n", $code); *************** *** 1425,1430 **** // Commment out the page_header and page_tail includes // ! $code = preg_replace('#^(.?).*(include).*(page_header).*(\r\n?|\n)#m','// Mx-Publisher: Removed include page_header.php' . "\n", $code); ! $code = preg_replace('#^(.?).*(include).*(page_tail).*(\r\n?|\n)#m',"// Mx-Publisher: Removed include page_tail.php" . "\n" . 'return;' . "\n", $code); --- 1564,1569 ---- // Commment out the page_header and page_tail includes // ! $code = preg_replace('#^(.?).*(include).*(page_header).*(\r\n?|\n)#m','// mxBB: Removed include page_header.php' . "\n", $code); ! $code = preg_replace('#^(.?).*(include).*(page_tail).*(\r\n?|\n)#m',"// mxBB: Removed include page_tail.php" . "\n" . 'return;' . "\n", $code); *************** *** 1436,1440 **** // ! // Replace common phpBB functions with Mx-Publisher alternatives // $code = str_replace('append_sid(', '$mx_forum->append_sid(', $code); --- 1575,1579 ---- // ! // Replace common phpBB functions with mxBB alternatives // $code = str_replace('append_sid(', '$mx_forum->append_sid(', $code); *************** *** 1445,1448 **** --- 1584,1588 ---- $code = str_replace('redirect(', '$mx_forum->redirect(', $code); $code = str_replace('make_jumpbox(', '$mx_forum->make_jumpbox(', $code); + $code = str_replace('make_jumpbox_ref(', '$mx_forum->make_jumpbox_ref(', $code); $code = str_replace('smilies_pass(', '$mx_forum->smilies_pass(', $code); $code = str_replace('generate_smilies(\'inline\',', '$mx_forum->generate_smilies(\'inline\',', $code); *************** *** 1453,1457 **** // ! // Remove some includes already included by Mx-Publisher // $code = preg_replace ("/include(.*)functions_select/", "//", $code); --- 1593,1597 ---- // ! // Remove some includes already included by mxBB // $code = preg_replace ("/include(.*)functions_select/", "//", $code); *************** *** 1464,1468 **** // NOTE: This regex will only work if "global" is stated on a new line... // ! $code = preg_replace('#^(.?).*(global)(.*?)($)(.*?)(\r\n?|\n)#m', '// Mx-Publisher rewrite of global, to instance $this in this function' . "\n " . 'global $mx_forum, \\3', $code); // --- 1604,1608 ---- // NOTE: This regex will only work if "global" is stated on a new line... // ! $code = preg_replace('#^(.?).*(global)(.*?)($)(.*?)(\r\n?|\n)#m', '// mxBB rewrite of global, to instance $this in this function' . "\n " . 'global $mx_forum, \\3', $code); // |