Suche per Default auf Zeitraum beschränken

Allgemeiner Support zum phpBB 2 Board und phpBB 2 Modifikationen
Forumsregeln
Auch wenn hier der Support für phpBB 2 weiterhin aufrecht erhalten bleibt, weisen wir darauf hin, dass das phpBB 2 nicht mehr offiziell unterstützt und weiterentwickelt wird!
Antworten
Benutzeravatar
oxpus
Administrator
Beiträge: 28735
Registriert: Mo 27.Jan, 2003 22:13
Wohnort: Bad Wildungen
Kontaktdaten:

Suche per Default auf Zeitraum beschränken

Beitrag von oxpus »

Mit diesem Snippet wird die Suche per default auf einen bestimmten Zeitraum begrenzt.

Code: Alles auswählen

#
#-----[ OPEN ]-----
#
search.php

#
#-----[ FIND ]-----
#
if ( !empty($HTTP_POST_VARS['search_time']) || !empty($HTTP_GET_VARS['search_time']))
{
	$search_time = time() - ( ( ( !empty($HTTP_POST_VARS['search_time']) ) ? intval($HTTP_POST_VARS['search_time']) : intval($HTTP_GET_VARS['search_time']) ) * 60 );
	$topic_days = (!empty($HTTP_POST_VARS['search_time'])) ? intval($HTTP_POST_VARS['search_time']) : intval($HTTP_GET_VARS['search_time']);
}
else
{
	$search_time = 0;
	$topic_days = 0;
}

#
#-----[ REPLACE WITH ]-----
#
$default_search_timespan = 14; // Change this value to the days you will set as default timespan. Regard the possible values in the array $previous_days()!!!

if ( !empty($HTTP_POST_VARS['search_time']) || !empty($HTTP_GET_VARS['search_time']))
{
	$search_time = time() - ( ( ( !empty($HTTP_POST_VARS['search_time']) ) ? intval($HTTP_POST_VARS['search_time']) : intval($HTTP_GET_VARS['search_time']) ) * 86400 );
	$topic_days = (!empty($HTTP_POST_VARS['search_time'])) ? intval($HTTP_POST_VARS['search_time']) : intval($HTTP_GET_VARS['search_time']);
	$search_time = ((time() - $search_time) <= 0 ) ? 0 : $search_time;
	$topic_days = ($topic_days == -1 ) ? 0 : $topic_days;
}
else
{
	$search_time = time() - ($default_search_timespan * 86400);
	$topic_days = $default_search_timespan;
}

#
#-----[ FIND ]-----
#
$previous_days = array(0, 1, 7, 14, 30, 90, 180, 364);

#
#-----[ REPLACE WITH ]-----
#
$previous_days = array(-1, 1, 7, 14, 30, 90, 180, 364);


#
#-----[ SAVE/CLOSE ALL FILES ]-----
#
# EoM
Karsten Ude
-={ Das Mädchen für alles }=-
Kein Support per Messenger, Email oder PN! Unaufgeforderte Nachrichten werden ignoriert!
No support per Messenger, Email or PM. Each unasked message will be ignored!
Antworten