From 14fd9d195b531084c835109fc7da2a850a7d6e5c Mon Sep 17 00:00:00 2001 From: "Paul S. Owen" Date: Fri, 22 Nov 2002 12:31:33 +0000 Subject: [PATCH] Used foreach ... changed for for for PHP3 compatibility git-svn-id: file:///svn/phpbb/branches/phpBB-2_0_0@3079 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewtopic.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index ed1dd685c2..ef36d204f7 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -445,20 +445,22 @@ if ( count($orig_word) ) // // Was a highlight request part of the URI? // -$highlight_match = ''; +$highlight_match = $highlight = ''; if (isset($HTTP_GET_VARS['highlight'])) { // Split words and phrases $words = explode(' ', trim(htmlspecialchars(urldecode($HTTP_GET_VARS['highlight'])))); - foreach ($words as $word) + for($i = 0; $i < sizeof($words); $i++) { - if (trim($word) != '') + if (trim($words[$i]) != '') { - $highlight_match .= (($highlight_match != '') ? '|' : '') . str_replace('*', '\w*', preg_quote($word, '#')); + $highlight_match .= (($highlight_match != '') ? '|' : '') . str_replace('*', '\w*', preg_quote($words[$i], '#')); } } unset($words); + + $highlight = urlencode($HTTP_GET_VARS['highlight']); } // @@ -584,7 +586,7 @@ if ( $can_watch_topic ) // If we've got a hightlight set pass it on to pagination, // I get annoyed when I lose my highlight after the first page. // -$pagination = ( $highlight_active ) ? generate_pagination("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&postdays=$post_days&postorder=$post_order&highlight=" . urlencode($HTTP_GET_VARS['highlight']), $total_replies, $board_config['posts_per_page'], $start) : generate_pagination("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&postdays=$post_days&postorder=$post_order", $total_replies, $board_config['posts_per_page'], $start); +$pagination = ( $highlight_active ) ? generate_pagination("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&postdays=$post_days&postorder=$post_order&highlight=$highlight", $total_replies, $board_config['posts_per_page'], $start) : generate_pagination("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&postdays=$post_days&postorder=$post_order", $total_replies, $board_config['posts_per_page'], $start); // // Send vars to template @@ -625,7 +627,7 @@ $template->assign_vars(array( 'S_TOPIC_ADMIN' => $topic_mod, 'S_WATCH_TOPIC' => $s_watching_topic, - 'U_VIEW_TOPIC' => append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&start=$start&postdays=$post_days&postorder=$post_order&highlight=" . urlencode($HTTP_GET_VARS['highlight'])), + 'U_VIEW_TOPIC' => append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&start=$start&postdays=$post_days&postorder=$post_order&highlight=$highlight"), 'U_VIEW_FORUM' => $view_forum_url, 'U_VIEW_OLDER_TOPIC' => $view_prev_topic_url, 'U_VIEW_NEWER_TOPIC' => $view_next_topic_url,