Page 1 of 6

[2.0.17] Search latest 24h 48h 72h

Posted: Fri Jun 17, 2005 2:21 pm
by Extensions Robot
MOD Name: Search latest 24h 48h 72h
Author: markus_petrux
MOD Description: This MOD adds a new search feature so it allows to search for posts from latest XX hours. The list of latest hours can be specified from the ACP, also whether to show results as posts or topics.


MOD Version: 1.1.0 (Updated 07/26/05)

Download File: search_latest_24h_48h_72h_v1.1.0.zip
mods overview page: View
File Size: 6026 Bytes

Security Score: 0

Posted: Wed Jun 29, 2005 12:58 am
by wGEric
MOD Validated/Released

Notes:
This MOD allows people to search for posts that were made recently on your board.

Posted: Wed Jun 29, 2005 1:11 am
by markus_petrux
Thanks a lot to all phpBB MODs Team members for your hard work.

~~~~~~~~~~

Space reserved for future comments regarding this MOD.

~~~~~~~~~~

Frech translation can be found here (thanks, Galixte de EzCom):
http://www.phpbb.com/phpBB/viewtopic.ph ... 11#1778511

~~~~~~~~~~

Enjoy! :)

Posted: Wed Jun 29, 2005 1:29 am
by 3Di
Sounds good, i'll try.

Compatibility to CH?

thanks.

Posted: Wed Jun 29, 2005 1:41 am
by markus_petrux
3Di wrote: Compatibility to CH?

Not tested, but browsing the CH code it looks 100% compatible.

Posted: Wed Jun 29, 2005 2:00 am
by devinliao
Parse error: parse error, unexpected T_BOOLEAN_OR in /home/devin/public_html/forum/search.php on line 160

and line 162

thats what i keep getting

#-----[ OPEN ]------------------------------------------------
#
search.php
#
#-----[ FIND ]-----------------------------------------
#
//
// Cycle through options ...
//
if ( $search_id == 'newposts' ||
#
# NOTE --- the previous is a partial search. The line should something like this:
# if ( $search_id == 'newposts' || $search_id == 'egosearch' || $search_id == 'unanswered' || $search_keywords != '' || $search_author != '' )
#
#
#-----[ IN-LINE FIND ]----------------------------------------
#
$search_id == 'newposts'
#
#-----[ IN-LINE AFTER, ADD ]----------------------------------
#
|| $search_id == 'latest'
#
#-----[ FIND ]-----------------------------------------
#
if ( $search_id == 'newposts' ||
#
# NOTE --- the previous is a partial search. The line should something like this:
# if ( $search_id == 'newposts' || $search_id == 'egosearch' || ( $search_author != '' && $search_keywords == '' ) )
#
#
#-----[ IN-LINE FIND ]----------------------------------------
#
$search_id == 'newposts'
#
#-----[ IN-LINE AFTER, ADD ]----------------------------------
#
|| $search_id == 'latest'
#

Posted: Wed Jun 29, 2005 2:12 am
by markus_petrux
Make sure you have correctly applied the IN-LINE actions. You might want to check this KB article:
http://www.phpbb.com/kb/article.php?article_id=150


The result of both changes (around lines 160-162) should (more or less) look like:

Code: Select all

	//
	// Cycle through options ...
	//
	if ( $search_id == 'newposts' || $search_id == 'latest' || $search_id == 'egosearch' || $search_id == 'unanswered' || $search_keywords != '' || $search_author != '' )
	{
		if ( $search_id == 'newposts' || $search_id == 'latest' || $search_id == 'egosearch' || ( $search_author != '' && $search_keywords == '' )  )
		{

Posted: Thu Jun 30, 2005 3:26 am
by devinliao
will it work if i use easymod to install it?

Posted: Thu Jun 30, 2005 3:48 am
by devinliao
Parse error: parse error, unexpected T_BOOLEAN_OR in /home/devin/public_html/forum/search.php on line 157

whihc is || $search_id == 'latest' //

Posted: Thu Jun 30, 2005 3:52 am
by devinliao
it looks fine after deleting that line.

Looks like a eay mod error

Posted: Thu Jun 30, 2005 4:11 am
by rungok
This mod was a very good extension to "Keep unread"-mod, since you will also see the posts you have read in this overview. My wife will be happy now!

:D

Posted: Thu Jun 30, 2005 4:17 am
by devinliao
just not sure, because when i used easy mod it made 2 parts of each line.
Now i just don't see a difference in the board.


http://www.devinliao.2freegigs.com/forum/
http://www.devinliao.2freegigs.com/forum/search.php

language/lang_english/lang_main.php a part of the source

Code: Select all

//
// SQR
//
$lang['Quick_reply_panel'] = 'Super Quick Reply Mod';
$lang['Quick_Reply'] = 'Quick Reply';
$lang['Show_quick_reply'] = 'Show Quick Reply Form';
$lang['sqr']['0'] = 'No';
$lang['sqr']['1'] = 'Yes';
$lang['sqr']['2'] = 'On last page only';
$lang['Quick_reply_mode'] = 'Quick Reply Mode';
$lang['Quick_reply_mode_basic'] = 'Basic';
$lang['Quick_reply_mode_advanced'] = 'Advanced';
$lang['Show_hide_quick_reply_form'] = 'Show/hide quick reply form';


$lang['Admin_reauthenticate'] = 'To administer the board you must re-authenticate yourself.';
$lang['Search_for'] = "Search for";
$lang['Submit_search'] = "Submit Search";

$lang['Global_Announcements'] = 'Global Announcements';
$lang['Announcements'] = 'Announcements';
$lang['Sticky_Topics'] = 'Sticky Topics';
//+MOD: Search latest 24h 48h 72h
$lang['Search_latest'] = "View latest";
$lang['Search_latest_24h'] = "24h";
$lang['Search_latest_48h'] = "48h";
$lang['Search_latest_72h'] = "72h";
//-MOD: Search latest 24h 48h 72h

// ezDownloads MOD
$lang['File_Name'] = 'File Name';
$lang['File_Description'] = 'File Description';
$lang['Uploaded_On'] = 'Uploaded';
$lang['Download_Count'] = 'Downloaded';
$lang['View_File_Comments'] = 'Comments';
$lang['Add_File_Comments'] = 'Add/View';
$lang['Downloads'] = 'Downloads Page';
$lang['Download'] = 'Downloads';
$lang['No_Downloads'] = 'No Downloads Are Currently Available';

//+MOD: Search latest 24h 48h 72h
$lang['Search_latest'] = "View latest";
$lang['Search_latest_24h'] = "24h";
$lang['Search_latest_48h'] = "48h";
$lang['Search_latest_72h'] = "72h";
//-MOD: Search latest 24h 48h 72h

//
// That's all, Folks!
// -------------------------------------------------

//+MOD: DHTML Collapsible FAQ MOD
// Please note: %sHERE%s is used to dynamically building the A HREF tag, do not remove the percent signs (%) around HERE!
$lang['dhtml_faq_noscript'] = "It appears that your browser does not support javascript or it has been disabled in your browser's settings.<br /><br />Please, click %sHERE%s to view a plain HTML version of this FAQ.";
//-MOD: DHTML Collapsible FAQ MOD

?>

includes/page_header.php

Code: Select all

'L_WHOSONLINE_ADMIN' => sprintf($lang['Admin_online_color'], '<span style="color:#' . $theme['fontcolor3'] . '">', '</span>'),
	'L_WHOSONLINE_MOD' => sprintf($lang['Mod_online_color'], '<span style="color:#' . $theme['fontcolor2'] . '">', '</span>'),
//+MOD: Search latest 24h 48h 72h
	'L_SEARCH_LATEST' => $lang['Search_latest'],
	'L_SEARCH_LATEST_24H' => $lang['Search_latest_24h'],
	'U_SEARCH_LATEST_24H' => append_sid('search.'.$phpEx.'?search_id=latest&hours=24'),
	'L_SEARCH_LATEST_48H' => $lang['Search_latest_48h'],
	'U_SEARCH_LATEST_48H' => append_sid('search.'.$phpEx.'?search_id=latest&hours=48'),
	'L_SEARCH_LATEST_72H' => $lang['Search_latest_72h'],
	'U_SEARCH_LATEST_72H' => append_sid('search.'.$phpEx.'?search_id=latest&hours=72'),
//-MOD: Search latest 24h 48h 72h
	'U_SEARCH_UNANSWERED' => append_sid('search.'.$phpEx.'?search_id=unanswered'),
	'U_SEARCH_SELF' => append_sid('search.'.$phpEx.'?search_id=egosearch'),
	'U_SEARCH_NEW' => append_sid('search.'.$phpEx.'?search_id=newposts'),
	'U_INDEX' => append_sid('index.'.$phpEx),

templates/subSilver/index_body.tpl

Code: Select all

  <tr> 
	<td align="left" valign="bottom"><span class="gensmall">
	<!-- BEGIN switch_user_logged_in -->
	{LAST_VISIT_DATE}<br />
	<!-- END switch_user_logged_in -->
	{CURRENT_TIME}<br /></span><span class="nav"><a href="{U_INDEX}" class="nav">{L_INDEX}</a></span></td>
	<td align="right" valign="bottom" class="gensmall">
		<!-- BEGIN switch_user_logged_in -->
		<a href="{U_SEARCH_NEW}" class="gensmall">{L_SEARCH_NEW}</a><br /><a href="{U_SEARCH_SELF}" class="gensmall">{L_SEARCH_SELF}</a><br />
		<!-- END switch_user_logged_in -->
		{L_SEARCH_LATEST}:&nbsp;<a href="{U_SEARCH_LATEST_24H}" class="gensmall">{L_SEARCH_LATEST_24H}</a>&nbsp;<a href="{U_SEARCH_LATEST_48H}" class="gensmall">{L_SEARCH_LATEST_48H}</a>&nbsp;<a href="{U_SEARCH_LATEST_72H}" class="gensmall">{L_SEARCH_LATEST_72H}</a><br />
		<a href="{U_SEARCH_UNANSWERED}" class="gensmall">{L_SEARCH_UNANSWERED}</a></td>
  </tr>
</table>
search.php

Code: Select all

   //
   // Cycle through options ...
   //
   if ( $search_id == 'newposts' || $search_id == 'latest' || $search_id == 'egosearch' || $search_id == 'unanswered' || $search_keywords != '' || $search_author != '' )
   {
      if ( $search_id == 'newposts' || $search_id == 'latest' || $search_id == 'egosearch' || ( $search_author != '' && $search_keywords == '' )  )
      { 
			if ( $search_id == 'newposts' )
			{
				if ( $userdata['session_logged_in'] )
				{
					$sql = "SELECT post_id 
						FROM " . POSTS_TABLE . " 
						WHERE post_time >= " . $userdata['user_lastvisit'];
				}
				else
				{
					redirect(append_sid("login.$phpEx?redirect=search.$phpEx&search_id=newposts", true));
				}

				$show_results = 'topics';
				$sort_by = 0;
				$sort_dir = 'DESC';
			}
//+MOD: Search latest 24h 48h 72h
			else if ( $search_id == 'latest' )
			{
				$latest_hours = intval( isset($HTTP_GET_VARS['hours']) ? $HTTP_GET_VARS['hours'] : 24 );
				$latest_hours = ( ( $latest_hours == 24 || $latest_hours == 48 || $latest_hours == 72 ) ? $latest_hours : 24 );

				$sql = "SELECT post_id 
					FROM " . POSTS_TABLE . " 
					WHERE post_time > " . ( time() - ($latest_hours * 60 * 60) );

				$show_results = 'topics';
				$sort_by = 0;
				$sort_dir = 'DESC';
			}
//-MOD: Search latest 24h 48h 72h
			else if ( $search_id == 'egosearch' )
			{

Posted: Thu Jun 30, 2005 9:27 am
by markus_petrux
devinliao wrote: just not sure, because when i used easy mod it made 2 parts of each line.

If you're running EasyMOD 0.2.0a, then you might want to take a look at this fix, affecting IN-LINE actions:
http://area51.phpbb.com/phpBB/viewtopic ... 767#121767

Though, at a first sight, the code you have posted above looks correct.

Posted: Thu Jun 30, 2005 11:05 pm
by devinliao
ok, will try that, just going to reinstall my forum.

Posted: Fri Jul 01, 2005 6:41 am
by GTI WR6
Hi,

I'm new to the forum Mod uploading process. I just backed up the database and saved it on my pc. then do i apply this mod to the file i just downloaded? and then restore the database by uploading this new file?

I'm sorry for being so ignorant, but I really want to try this. Please help me out if you can.

Thanks.