some search.php refactoring; fixed 'ignore' checkbox

This commit is contained in:
following
2013-07-18 12:11:25 +02:00
parent e0cce5c679
commit a7879a0bce
5 changed files with 34 additions and 24 deletions
+4
View File
@@ -58,6 +58,10 @@
define('MAX_LOGENTRIES_ON_CACHEPAGE', 5);
define('MAX_PICTURES_PER_GALLERY_PAGE', 48); // must be multiple of 6
// threshold for caches to be marked as "new"
// changed from 7 to 14 -- following 2013/6/17
$NEWCACHES_DAYS = 14;
// constants for user options (must match values in DB!)
define('USR_OPT_GMZOOM', 1);
define('USR_OPT_SHOWSTATS', 5);
+16 -7
View File
@@ -31,9 +31,9 @@
function search_output()
{
global $opt, $tpl, $login;
global $newcache_days, $showonmap;
global $calledbysearch, $options, $lat_rad, $lon_rad, $distance_unit;
global $opt, $tpl, $login, $NEWCACHES_DAYS;
global $search_in_gm, $search_in_gm_zip;
global $called_by_search, $called_by_profile_query, $options, $lat_rad, $lon_rad, $distance_unit;
global $startat, $caches_per_page, $sql;
$tpl->name = 'search.result.caches';
@@ -76,7 +76,7 @@ function search_output()
// decide if the cache is new
$dDiff = abs(dateDiff('d', $rCache['date_created'], date('Y-m-d')));
$rCache['isnew'] = ($dDiff <= $newcache_days);
$rCache['isnew'] = ($dDiff <= $NEWCACHES_DAYS);
// get last logs
if ($options['sort'] != 'bymylastlog' || !$login->logged_in())
@@ -113,8 +113,6 @@ function search_output()
$pager = new pager('search.php?queryid=' . $options['queryid'] . '&startat={offset}', 2, 9);
$pager->make_from_offset($startat, $resultcount, $caches_per_page);
$tpl->assign('showonmap', $showonmap);
// downloads
$tpl->assign('queryid', $options['queryid']);
@@ -133,7 +131,18 @@ function search_output()
$tpl->assign('distanceunit', $distance_unit);
$tpl->assign('displayownlogs', $options['sort'] == 'bymylastlog');
$tpl->assign('search_headline_caches', $calledbysearch);
$tpl->assign('search_headline_caches', $called_by_search);
if ($called_by_profile_query)
{
$tpl->assign('search_in_gm', '');
$tpl->assign('search_in_gm_zip', '');
}
else
{
$tpl->assign('search_in_gm', $search_in_gm);
$tpl->assign('search_in_gm_zip', $search_in_gm_zip);
}
$tpl->display();
}