From 275f67a5075df42530c1622733fe908a172e27dc Mon Sep 17 00:00:00 2001 From: "Paul S. Owen" <psotfx@users.sourceforge.net> Date: Wed, 26 Sep 2001 22:35:08 +0000 Subject: [PATCH] Added view newest output for topic search git-svn-id: file:///svn/phpbb/trunk@1094 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/search.php | 23 +++++++++++++------ phpBB/templates/PSO/search_results_topics.tpl | 15 ++++-------- .../subSilver/search_results_topics.tpl | 2 +- 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/phpBB/search.php b/phpBB/search.php index 4662c1f185..287b6e82d1 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -21,8 +21,7 @@ ***************************************************************************/ // -// Massive overhaul for phpBB2, -// originally based on search code +// Massive overhaul for phpBB2, originally based on search code // I knocked together for my own website // // PSO : 2001 @@ -38,8 +37,8 @@ include($phpbb_root_path . 'includes/bbcode.'.$phpEx); function gensearch_sql($searchstring, $override_all = 0) { - $searchchars = array("'[\s]+'", "'\/'", "';'", "'@'", "'&'", "'#'", "'_'", "'|'", "'�'", "'\*'"); - $replacechars = array(" ", "", "", "", " ", "", "", "", " ", "", "%"); + $searchchars = array("'[\s]+'", "'\/'", "';'", "'@'", "'#'", "'_'", "'|'", "'�'", "'\*'"); + $replacechars = array(" ", "", "", "", " ", "", "", " ", "", "%"); $searchstring = trim(preg_replace($searchchars, $replacechars, strip_tags($searchstring))); @@ -194,7 +193,7 @@ function gensearch_sql($searchstring, $override_all = 0) } $findword = $searchlistandtype["AND"][$j]; - $searchstring .= " ( pt.post_text LIKE '% $findword %')"; + $searchstring .= " ( pt.post_text LIKE '$findword')"; }// OR pt.post_text LIKE '$findword %' OR pt.post_text LIKE '% $findword' } elseif($binsearchtype[$i] == "OR" && count($searchlistandtype["OR"])) @@ -211,7 +210,7 @@ function gensearch_sql($searchstring, $override_all = 0) } $findword = $searchlistandtype["OR"][$j]; - $searchstring .= " ( pt.post_text LIKE '% $findword %' )"; + $searchstring .= " ( pt.post_text LIKE '$findword' )"; }// OR pt.post_text LIKE '$findword %' OR pt.post_text LIKE '% $findword' } elseif($binsearchtype[$i] == "NOT" && count($searchlistandtype["NOT"])) @@ -254,7 +253,7 @@ function gensearch_sql($searchstring, $override_all = 0) } } - $searchstring = "($searchstring)"; + $searchstring = "( $searchstring )"; $searchdata[0] = $searchstring; for($i = 0; $i < count($searchforwords); $i++) @@ -939,6 +938,15 @@ if( $query_keywords != "" || $query_author != "" || $search_id ) } } + if($searchset[$i]['post_time'] >= $userdata['session_last_visit']) + { + $newest_post_img = "<a href=\"viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&view=newest\"><img src=\"" . $images['icon_newest_reply'] . "\" alt=\"" . $lang['View_newest_posts'] . "\" border=\"0\" /></a> "; + } + else + { + $newest_post_img = ""; + } + $topic_poster = $searchset[$i]['username']; $last_post_time = create_date($board_config['default_dateformat'], $searchset[$i]['post_time'], $board_config['board_timezone']); @@ -963,6 +971,7 @@ if( $query_keywords != "" || $query_author != "" || $search_id ) "FORUM_ID" => $forum_id, "TOPIC_ID" => $topic_id, "FOLDER" => $folder_image, + "NEWEST_POST_IMG" => $newest_post_img, "TOPIC_POSTER" => $topic_poster, "GOTO_PAGE" => $goto_page, "REPLIES" => $replies, diff --git a/phpBB/templates/PSO/search_results_topics.tpl b/phpBB/templates/PSO/search_results_topics.tpl index f63f825066..7ffb190dfd 100644 --- a/phpBB/templates/PSO/search_results_topics.tpl +++ b/phpBB/templates/PSO/search_results_topics.tpl @@ -1,7 +1,7 @@ <table width="98%" cellspacing="0" cellpadding="4" border="0" align="center"> <tr> - <td align="left" valign="bottom" nowrap="nowrap"><span class="gensmall"><a href="{U_INDEX}">{SITENAME} {L_INDEX}</span></td> + <td align="left" valign="bottom" nowrap="nowrap"><span class="gensmall"><a href="{U_INDEX}">{SITENAME} {L_INDEX}</span></td> </tr> </table> @@ -9,7 +9,7 @@ <tr> <td class="tablebg"><table width="100%" cellpadding="4" cellspacing="1" border="0"> <tr> - <td class="cat" colspan="7" align="center"><span class="cattitle"> <b>{L_SEARCH} - {SEARCH_MATCHES} Matches</b> </span></td> + <td class="cat" colspan="7" align="center"><span class="cattitle"><b>{L_SEARCH} {L_FOUND} <u>{SEARCH_MATCHES}</u> {L_MATCHES}</b></span></td> </tr> <tr> <th width="4%"> </th> @@ -24,22 +24,17 @@ <tr> <td class="row1" align="center" valign="middle"> {searchresults.FOLDER} </td> <td class="row2"> <span class="gensmall"><a href="{searchresults.U_VIEW_FORUM}">{searchresults.FORUM_NAME}</a></span></td> - <td class="row2"> <span class="gensmall">{searchresults.TOPIC_TYPE}<a href="{searchresults.U_VIEW_TOPIC}">{searchresults.TOPIC_TITLE}</a> {searchresults.GOTO_PAGE}</span></td> + <td class="row2"> <span class="gensmall">{searchresults.NEWEST_POST_IMG}{searchresults.TOPIC_TYPE}<a href="{searchresults.U_VIEW_TOPIC}">{searchresults.TOPIC_TITLE}</a> {searchresults.GOTO_PAGE}</span></td> <td class="row1" align="center" valign="middle"><span class="gen">{searchresults.REPLIES}</span></td> <td class="row2" align="center" valign="middle"><span class="gen"><a href="{searchresults.U_TOPIC_POSTER_PROFILE}">{searchresults.TOPIC_POSTER}</a></span></td> <td class="row1" align="center" valign="middle"><span class="gen">{searchresults.VIEWS}</span></td> <td class="row2" align="center" valign="middle" nowrap="nowrap"><span class="gensmall">{searchresults.LAST_POST}</span></td> </tr> <!-- END searchresults --> - <!-- BEGIN nosearchresults --> - <tr> - <td class="row1" colspan="6" height="30" align="center" valign="middle"><span class="gen">{L_NO_TOPICS}</span></td> - </tr> - <!-- END nosearchresults --> <tr> <td class="cat" colspan="7"><table width="100%" cellspacing="0" cellpadding="0" border="0"> <tr> - <td align="left" valign="middle"> <span class="gen">{L_PAGE} <b>{ON_PAGE}</b> {L_OF} <b>{TOTAL_PAGES}</b></span> </td> + <td align="left" valign="middle"> <span class="gen">{L_PAGE} <b>{ON_PAGE}</b> {L_OF} <b>{TOTAL_PAGES}</b></span> </td> <td align="right" valign="middle"><span class="gen">{PAGINATION} </span></td> </tr> </table></td> @@ -55,4 +50,4 @@ <td align="left" valign="top"><span class="gensmall"><b>{S_TIMEZONE}</b></span></td> <td align="right" valign="top" nowrap>{JUMPBOX}</td> </tr> -</table> \ No newline at end of file +</table> diff --git a/phpBB/templates/subSilver/search_results_topics.tpl b/phpBB/templates/subSilver/search_results_topics.tpl index cd9b1b32a8..8b979c9055 100644 --- a/phpBB/templates/subSilver/search_results_topics.tpl +++ b/phpBB/templates/subSilver/search_results_topics.tpl @@ -31,7 +31,7 @@ <tr> <td class="row1" align="center" valign="middle">{searchresults.FOLDER}</td> <td class="row1"><span class="forumlink"><a href="{searchresults.U_VIEW_FORUM}" class="forumlink">{searchresults.FORUM_NAME}</a></span></td> - <td class="row2"><span class="topictitle">{searchresults.TOPIC_TYPE}<a href="{searchresults.U_VIEW_TOPIC}" class="topictitle">{searchresults.TOPIC_TITLE}</a></span><span class="gensmall"> {searchresults.GOTO_PAGE}</span></td> + <td class="row2"><span class="topictitle">{searchresults.NEWEST_POST_IMG}{searchresults.TOPIC_TYPE}<a href="{searchresults.U_VIEW_TOPIC}" class="topictitle">{searchresults.TOPIC_TITLE}</a></span><span class="gensmall"> {searchresults.GOTO_PAGE}</span></td> <td class="row1" align="center" valign="middle"><span class="postdetails">{searchresults.REPLIES}</span></td> <td class="row2" align="center" valign="middle"><span class="name"><a href="{searchresults.U_TOPIC_POSTER_PROFILE}" class="name">{searchresults.TOPIC_POSTER}</a></span></td> <td class="row1" align="center" valign="middle"><span class="postdetails">{searchresults.VIEWS}</span></td>