Hi!
This Mod enabled it search all images since "date".
Files to be Modified:
1.) your Templates/search_form.html
2.) root/search.php
3.) lang/your lang/main.php
Optional: If user login, display how many new images since last visit
4.) includes/page_header.php
5.) lang/yourlang/main.php
6.) templates/your Templates/user_logininfo.html
1.) search in your templates/search_form.html
<td colspan="2" valign="top" class="head1">{lang_search}</td>
</tr>
insert below:
<tr>
<td valign="top" class="row1"><b>{lang_search_by_date}</b></td>
<td class="row1" valign="top">
<input type="text" name="search_date" size="40" value="{search_date}" class="input">
</td>
</tr>
2.) search in root/search.php:
if ($search_keywords != "" && $show_result == 1) {
insert above:
//########################## Start Mod Search all images since (Date) ################################
if(isset($HTTP_POST_VARS['search_date']) || isset($HTTP_GET_VARS['search_date'])){
$search_date= (isset($HTTP_POST_VARS['search_date'])) ? trim($HTTP_POST_VARS['search_date']) : trim($HTTP_GET_VARS['search_date']);
$search_date = preg_replace("#[^-0-9:]#","-", $search_date);
if(!empty($search_date)){
$format = preg_replace("#[^a-zA-Z0-9]#","",$config['date_format']);
$day = strpos($format, 'd');
$month = strpos($format, 'm');
$year = strpos($format, 'Y');
$search_date = explode("-", $search_date);
$hour = 0;
$min = 0;
if((array_key_exists('3', $search_date))){
$search_time = explode(":", $search_date[3]);
$hour = (isset($search_time[0]))? $search_time[0]:0;
$min = (isset($search_time[1]))? $search_time[1]:0;
}
$search_id['search_date'] = "";
if(@checkdate($search_date[$month],$search_date[$day],$search_date[$year]) == true){
$search_id['search_date'] = @mktime($hour,$min, 0, $search_date[$month],$search_date[$day],$search_date[$year]);
$show_result =1;
}
else{
$search_date="";
}
}
}
else{
$search_date="";
}
$search_in = array();
$search_in[0] = '/d/';
$search_in[1] = '/m/';
$search_in[2] = '/Y/';
$search_in[3] = '/H/';
$search_in[4] = '/i/';
$search_out = array();
$search_out[0] = 'dd';
$search_out[1] = 'mm';
$search_out[2] = 'YYYY';
$search_out[3] = 'HH';
$search_out[4] = 'ii';
$date_format = preg_replace($search_in,$search_out,$config['date_format']);
$time_format = preg_replace($search_in,$search_out,$config['time_format']);
$site_template->register_vars("date_format", $date_format." ".$time_format);
//########################## End Mod Search all images since (Date) ################################
2.1) search:
if (!empty($search_id )) {
$site_sess->set_session_var("search_id", serialize($search_id));
insert above:
//############### Start Mod Search all images since (Date) #############
if ($search_date && $show_result == 1) {
$search_id['search_date'] = $search_id['search_date'];
}
//############### End Mod Search all images since (Date) ###############
2.2) search:
$sql_where_query = "";
insert below:
//################## End Mod Search all images since (Date) #################
if(!empty($search_id['search_date'])) {
$sql_where_query .= "AND i.image_date >= ".$search_id['search_date']." ";
}
//################## End Mod Search all images since (Date) #################
2.3) search:
else {
$site_template->register_vars(array(
insert below:
//######### Start Mod Search all images since (Date) ##########
"date_format" => $config['date_format'],
"lang_search_by_date" => $lang['search_by_date'],
//######### End Mod Search all images since (Date) ##########
3.) search in lang/your lang/main.php
//--- Search ------------------------------------------
//-----------------------------------------------------
insert below:
(english)
//########################## Start Mod Search all images since (Date) ################################
$lang['search_by_date'] = "search all images since:<br><span class=\"smalltext\">(Format: <b>{date_format}</b> ) time can be omitted</span>";
//########################## End Mod Search all images since (Date) ##################################
(deutsch)
//########################## Start Mod Search all images since (Date) ##############################
$lang['search_by_date'] = "Suche alle Bilder seit:<br><span class=\"smalltext\">(Format: <b>{date_format}</b> ) Uhrzeit kann weggelassen werden.</span>";
//########################## End Mod Search all images since (Date) ################################
Optional: If user login, display how many new images since last visit.
4.) search in includes/page_header.php:
//-----------------------------------------------------
//--- User Box ----------------------------------------
insert above:
if ($user_info['user_level'] >= USER) {
$sql = "SELECT COUNT(image_id) AS new_images
FROM ".IMAGES_TABLE."
WHERE image_active = 1 AND image_date >= ".$user_info['user_lastvisit']."
";
$result = $site_db->query($sql);
$row = mysql_fetch_object($result);
$how_new = $row->new_images;
$format_date = preg_replace("#[^a-zA-Z0-9]#",".",$config['date_format']);
$format_time = preg_replace("#[^a-zA-Z0-9]#",":",$config['time_format']);
$date_time = $format_date." ".$format_time;
$user_lastvisit = (date('d.m.Y H:i',$user_info['user_lastvisit']));
$search_date_link = ($how_new > 0) ?"<a href=\"".$site_sess->url(ROOT_PATH."search.php?search_date=".$user_lastvisit)." \">".$how_new."</a>": $how_new;
$loginmsg = $lang['last_visit']."<b> ".$search_date_link."</b><br>";
$site_template->register_vars("last_visit",$loginmsg);
}
5.) search in lang/yourlang/main.php:
//--- Search ------------------------------------------
//-----------------------------------------------------
insert below:
(deutsch)
$lang['last_visit'] = "Neue Bilder seit deinen letzten Besuch:";
(english)
$lang['last_visit'] = "New images since your last visit:";
6.) search in templates/your Templates/user_logininfo.html
» <a href="{url_logout}">{lang_logout}</a><br> </td>
</tr>
insert below:
<tr>
<td valign="top" align="left">
{last_visit}
</td>
</tr>
mfg Andi