From e5f65d6730b990fbd5531b0d28088a99ce60e69e Mon Sep 17 00:00:00 2001 From: "Paul S. Owen" Date: Wed, 9 Jan 2002 23:35:41 +0000 Subject: [PATCH] Fix bug #501353 git-svn-id: file:///svn/phpbb/trunk@1830 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewtopic.php | 201 +++++++++++++++++++++----------------------- 1 file changed, 95 insertions(+), 106 deletions(-) diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index bc96e31d38..07a9b02bd7 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -429,6 +429,46 @@ $orig_word = array(); $replacement_word = array(); obtain_word_list($orig_word, $replacement_word); +// +// Censor topic title +// +if( count($orig_word) ) +{ + $topic_title = preg_replace($orig_word, $replacement_word, $topic_title); +} + +// +// Was a highlight request part of the URI? Yes, this idea was +// taken from vB but we did already have a highlighter in place +// in search itself ... it's just been extended a bit! +// +if( isset($HTTP_GET_VARS['highlight']) ) +{ + $highlight_match = array(); + $highlight_replace = array(); + + // + // Split words and phrases + // + $words = explode(" ", trim(urldecode($HTTP_GET_VARS['highlight']))); + + for($i = 0; $i < count($words); $i++) + { + if( trim($words[$i]) != "" ) + { + $highlight_match[] = "#\b(" . str_replace("\*", ".*?", phpbb_preg_quote($words[$i], "#")) . ")(?!.*?<\/a>)(?!.*?\[/url\])\b#i"; + $highlight_replace[] = "\\1"; + } + } + + $highlight_active = ( count($highlight_match) ) ? true : false; + +} +else +{ + $highlight_active = false; +} + // // Post, reply and other URL generation for // templating vars @@ -482,7 +522,6 @@ else // Set a cookie for this topic // setcookie($board_config['cookie_name'] . "_t_$topic_id", time(), 0, $board_config['cookie_path'], $board_config['cookie_domain'], $board_config['cookie_secure']); -//session_send_cookie("_t_$topic_id", time(), 0); // // Load templates @@ -509,80 +548,22 @@ $template->assign_vars(array( "TOPIC_ID" => $topic_id, "TOPIC_TITLE" => $topic_title, - "L_DISPLAY_POSTS" => $lang['Display_posts'], - "L_RETURN_TO_TOP" => $lang['Return_to_top'], - - "S_TOPIC_LINK" => POST_TOPIC_URL, - "S_SELECT_POST_DAYS" => $select_post_days, - "S_SELECT_POST_ORDER" => $select_post_order, - "S_POST_DAYS_ACTION" => append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=" . $topic_id . "&start=$start")) - -); - -$page_title = $lang['View_topic'] ." - $topic_title"; -include($phpbb_root_path . 'includes/page_header.'.$phpEx); - -// -// End header -// - -// -// Censor topic title -// -if( count($orig_word) ) -{ - $topic_title = preg_replace($orig_word, $replacement_word, $topic_title); -} - -// -// Was a highlight request part of the URI? Yes, this idea was -// taken from vB but we did already have a highlighter in place -// in search itself ... it's just been extended a bit! -// - -if( isset($HTTP_GET_VARS['highlight']) ) -{ - $highlight_match = array(); - $highlight_replace = array(); - - // - // Split words and phrases - // - $words = explode(" ", trim(urldecode($HTTP_GET_VARS['highlight']))); - - for($i = 0; $i < count($words); $i++) - { - if( trim($words[$i]) != "" ) - { - $highlight_match[] = "#\b(" . str_replace("\*", ".*?", phpbb_preg_quote($words[$i], "#")) . ")(?!.*?<\/a>)(?!.*?\[/url\])\b#i"; - $highlight_replace[] = "\\1"; - } - } - - $highlight_active = ( count($highlight_match) ) ? true : false; - -} -else -{ - $highlight_active = false; -} - -$template->assign_vars(array( - "FORUM_NAME" => $forum_name, - "TOPIC_TITLE" => $topic_title, + "IMG_POST" => $post_img, + "IMG_REPLY" => $reply_img, "L_POSTED" => $lang['Posted'], "L_POST_SUBJECT" => $lang['Post_subject'], "L_VIEW_NEXT_TOPIC" => $lang['View_next_topic'], "L_VIEW_PREVIOUS_TOPIC" => $lang['View_previous_topic'], - "L_POST_NEW_TOPIC" => $post_alt, "L_POST_REPLY_TOPIC" => $reply_alt, - "L_BACK_TO_TOP" => $lang['Back_to_top'], + "L_DISPLAY_POSTS" => $lang['Display_posts'], - "IMG_POST" => $post_img, - "IMG_REPLY" => $reply_img, + "S_TOPIC_LINK" => POST_TOPIC_URL, + "S_SELECT_POST_DAYS" => $select_post_days, + "S_SELECT_POST_ORDER" => $select_post_order, + "S_POST_DAYS_ACTION" => append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=" . $topic_id . "&start=$start"), "U_VIEW_FORUM" => $view_forum_url, "U_VIEW_OLDER_TOPIC" => $view_prev_topic_url, @@ -591,6 +572,15 @@ $template->assign_vars(array( "U_POST_REPLY_TOPIC" => $reply_topic_url) ); +// +// Output page header +// +$page_title = $lang['View_topic'] ." - $topic_title"; +include($phpbb_root_path . 'includes/page_header.'.$phpEx); +// +// End header +// + // // Does this topic contain a voting element? // @@ -759,13 +749,13 @@ for($i = 0; $i < $total_posts; $i++) switch( $postrow[$i]['user_avatar_type'] ) { case USER_AVATAR_UPLOAD: - $poster_avatar = "\"\""; + $poster_avatar = ''; break; case USER_AVATAR_REMOTE: - $poster_avatar = "\"\""; + $poster_avatar = '\"\""; break; case USER_AVATAR_GALLERY: - $poster_avatar = "\"\""; + $poster_avatar = ''; break; } } @@ -795,16 +785,15 @@ for($i = 0; $i < $total_posts; $i++) // // Set them to empty string initially, in case we don't find a rank for this dude. // - $poster_rank = ""; - $rank_image = ""; - + $poster_rank = ''; + $rank_image = ''; if( $postrow[$i]['user_id'] == ANONYMOUS ) { // // This is redundant, but some day we might wanna stick in a rank for anon. posts. // - $poster_rank = ""; - $rank_image = ""; + $poster_rank = ''; + $rank_image = ''; } else if( $postrow[$i]['user_rank'] ) { @@ -813,7 +802,7 @@ for($i = 0; $i < $total_posts; $i++) if( $postrow[$i]['user_rank'] == $ranksrow[$j]['rank_id'] && $ranksrow[$j]['rank_special'] ) { $poster_rank = $ranksrow[$j]['rank_title']; - $rank_image = ( $ranksrow[$j]['rank_image'] ) ? '' . $poster_rank . '
' : ""; + $rank_image = ( $ranksrow[$j]['rank_image'] ) ? '' . $poster_rank . '
' : ''; } } } @@ -824,7 +813,7 @@ for($i = 0; $i < $total_posts; $i++) if( $postrow[$i]['user_posts'] >= $ranksrow[$j]['rank_min'] && !$ranksrow[$j]['rank_special'] ) { $poster_rank = $ranksrow[$j]['rank_title']; - $rank_image = ( $ranksrow[$j]['rank_image'] ) ? '' . $poster_rank . '
' : ""; + $rank_image = ( $ranksrow[$j]['rank_image'] ) ? '' . $poster_rank . '
' : ''; } } } @@ -840,83 +829,83 @@ for($i = 0; $i < $total_posts; $i++) if( $poster_id != ANONYMOUS ) { - $profile_img = "\"""; + $profile_img = '' . $lang['Read_profile'] . ''; - $pm_img = "\"""; + $pm_img = '' . $lang['Send_private_message'] . ''; if( !empty($postrow[$i]['user_viewemail']) || $is_auth['auth_mod'] ) { $email_uri = ( $board_config['board_email_form'] ) ? append_sid("profile.$phpEx?mode=email&" . POST_USERS_URL ."=" . $poster_id) : "mailto:" . $postrow[$i]['user_email']; - $email_img = "\"""; + $email_img = '' . $lang['Send_email'] . ''; } else { - $email_img = ""; + $email_img = ''; } - $www_img = ($postrow[$i]['user_website']) ? "\""" : ""; + $www_img = ($postrow[$i]['user_website']) ? '' . $lang['Visit_website'] . '' : ''; if( !empty($postrow[$i]['user_icq']) ) { - $icq_status_img = ""; - $icq_add_img = "\"""; + $icq_status_img = ''; + $icq_add_img = '' . $lang['ICQ'] . ''; } else { - $icq_status_img = ""; - $icq_add_img = ""; + $icq_status_img = ''; + $icq_add_img = ''; } - $aim_img = ( $postrow[$i]['user_aim'] ) ? "\""" : ""; + $aim_img = ( $postrow[$i]['user_aim'] ) ? '' . $lang['AIM'] . '' : ''; - $msn_img = ( $postrow[$i]['user_msnm'] ) ? "\""" : ""; + $msn_img = ( $postrow[$i]['user_msnm'] ) ? '' . $lang['MSNM'] . '' : ''; - $yim_img = ( $postrow[$i]['user_yim'] ) ? "\""" : ""; + $yim_img = ( $postrow[$i]['user_yim'] ) ? '' . $lang['YIM'] . '' : ''; } else { - $profile_img = ""; - $pm_img = ""; - $email_img = ""; - $www_img = ""; - $icq_status_img = ""; - $icq_add_img = ""; - $aim_img = ""; - $msn_img = ""; - $yim_img = ""; + $profile_img = ''; + $pm_img = ''; + $email_img = ''; + $www_img = ''; + $icq_status_img = ''; + $icq_add_img = ''; + $aim_img = ''; + $msn_img = ''; + $yim_img = ''; } - $quote_img = "\"""; + $quote_img = '' . $lang['Reply_with_quote'] . ''; - $search_img = ""; + $search_img = ''; if( ( $userdata['user_id'] == $poster_id && $is_auth['auth_edit'] ) || $is_auth['auth_mod'] ) { - $edit_img = "\"""; + $edit_img = '' . $lang['Edit_delete_post'] . ''; } else { - $edit_img = ""; + $edit_img = ''; } if( $is_auth['auth_mod'] ) { - $ip_img = "\"""; + $ip_img = '' . $lang['View_IP'] . ''; - $delpost_img = "\"""; + $delpost_img = '' . $lang['Delete_post'] . ''; } else { - $ip_img = ""; + $ip_img = ''; if( $userdata['user_id'] == $poster_id && $is_auth['auth_delete'] && $i == $total_replies - 1 ) { - $delpost_img = "\"""; + $delpost_img = '' . $lang['Delete_post'] . ''; } else { - $delpost_img = ""; + $delpost_img = ''; } }