Code: Select all
$show_results = 'topics';
Code: Select all
$show_results = 'posts';
Code: Select all
##############################################################
## MOD Title: Search latest 24h 48h 72h
## MOD Author: markus_petrux < [email protected] > (Markus) http://www.phpmix.com
## MOD Description: This MOD adds a new search feature so it allows to search for
## posts from latest 24, 48 or 72 hours (results as topics).
## MOD Version: 1.0.2
##
## Installation Level: (Easy)
## Installation Time: 5 Minutes
## Files To Edit: 4
## language/lang_english/lang_main.php
## includes/page_header.php
## templates/subSilver/index_body.tpl
## search.php
## Included Files: none
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/
##############################################################
## Author Notes:
##
## - MOD related comments:
## Tested with phpBB 2.0.15
## This MOD is EasyMOD friendly.
##
##############################################################
## MOD History:
##
## 2005/06/17 - 1.0.2
## - Changed the way the links are constructed, so all HTML/CSS attributes
## are now moved to the template, for easy adaption to other styles.
##
## 2005/01/31 - 1.0.0
## - Initial release
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#------[ OPEN ]--------------------------------------
#
language/lang_english/lang_main.php
#
#------[ FIND ]--------------------------------------
#
//
// That's all, Folks!
// -------------------------------------------------
#
#------[ BEFORE, ADD ]-----------------------------
#
//+MOD: Search latest 24h 48h 72h
$lang['Search_latest'] = "View latest";
// Begin additions by MoLew
$lang['Search_latest_2h'] = "2h";
$lang['Search_latest_4h'] = "4h";
$lang['Search_latest_8h'] = "8h";
$lang['Search_latest_12h'] = "12h";
// End MoLew's additions
$lang['Search_latest_24h'] = "24h";
$lang['Search_latest_48h'] = "48h";
$lang['Search_latest_72h'] = "72h";
//-MOD: Search latest 24h 48h 72h
#
#-----[ OPEN ]------------------------------------------
#
includes/page_header.php
#
#-----[ FIND ]-----------------------------------------
# NOTE --- the following is a partial search. The line should something like this:
# 'L_WHOSONLINE_MOD' => sprintf($lang['Mod_online_color'], '<span style="color:#' . $theme['fontcolor2'] . '">', '</span>'),
#
'L_WHOSONLINE_MOD' =>
#
#-----[ AFTER, ADD ]----------------------------------
#
//+MOD: Search latest 24h 48h 72h
'L_SEARCH_LATEST' => $lang['Search_latest'],
// Begin additions by MoLew
'L_SEARCH_LATEST_2H' => $lang['Search_latest_2h'],
'U_SEARCH_LATEST_2H' => append_sid('search.'.$phpEx.'?search_id=latest&hours=2'),
'L_SEARCH_LATEST_4H' => $lang['Search_latest_4h'],
'U_SEARCH_LATEST_4H' => append_sid('search.'.$phpEx.'?search_id=latest&hours=4'),
'L_SEARCH_LATEST_8H' => $lang['Search_latest_8h'],
'U_SEARCH_LATEST_8H' => append_sid('search.'.$phpEx.'?search_id=latest&hours=8'),
'L_SEARCH_LATEST_12H' => $lang['Search_latest_12h'],
'U_SEARCH_LATEST_12H' => append_sid('search.'.$phpEx.'?search_id=latest&hours=12'),
// End additions by MoLew
'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
#
#-----[ OPEN ]-----------------------------------------
#
templates/subSilver/index_body.tpl
#
#-----[ FIND ]-----------------------------------------
#
<a href="{U_SEARCH_UNANSWERED}" class="gensmall">{L_SEARCH_UNANSWERED}</a></td>
#
#------[ BEFORE, ADD ]-----------------------------
#
# This entire section edited by MoLew!
#
{L_SEARCH_LATEST}<br />
<a href="{U_SEARCH_LATEST_2H}" class="gensmall">{L_SEARCH_LATEST_2H}</a> <a href="{U_SEARCH_LATEST_4H}" class="gensmall">{L_SEARCH_LATEST_4H}</a> <a href="{U_SEARCH_LATEST_8H}" class="gensmall">{L_SEARCH_LATEST_8H}</a> <a href="{U_SEARCH_LATEST_12H}" class="gensmall">{L_SEARCH_LATEST_12H}</a> <br />
<a href="{U_SEARCH_LATEST_24H}" class="gensmall">{L_SEARCH_LATEST_24H}</a> <a href="{U_SEARCH_LATEST_48H}" class="gensmall">{L_SEARCH_LATEST_48H}</a> <a href="{U_SEARCH_LATEST_72H}" class="gensmall">{L_SEARCH_LATEST_72H}</a><br />
#
#-----[ 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'
#
#-----[ FIND ]------------------------------------------------
#
else if ( $search_id == 'egosearch' )
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
# Original Mod Lines:
#
# //+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
#
# Mod lines edited by MoLew:
#
//+MOD: Search latest 24h 48h 72h
else if ( $search_id == 'latest' )
{
$latest_hours = intval( isset($HTTP_GET_VARS['hours']) ? $HTTP_GET_VARS['hours'] : 2 );
$latest_hours = ( ( $latest_hours == 2 || $latest_hours == 4 || $latest_hours == 8 || $latest_hours == 12 || $latest_hours == 24 || $latest_hours == 48 || $latest_hours == 72 ) ? $latest_hours : 2 );
$sql = "SELECT post_id
FROM " . POSTS_TABLE . "
WHERE post_time > " . ( time() - ($latest_hours * 60 * 60) );
$show_results = 'posts';
$sort_by = 0;
$sort_dir = 'DESC';
}
//-MOD: Search latest 24h 48h 72h
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
Code: Select all
#
#------[ SQL ]--------------------------------------
#
INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_latest_hours', '24,48,72');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_latest_results', 'topics');