diff --git a/htdocs/doc/sql/static-data/data.sql b/htdocs/doc/sql/static-data/data.sql index def9ecb1..ea42ecaa 100644 --- a/htdocs/doc/sql/static-data/data.sql +++ b/htdocs/doc/sql/static-data/data.sql @@ -2599,6 +2599,7 @@ INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2171', 'Please INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2172', 'Yes, I want to recieve mailings about news and actions on opencaching.de. (max. 2-5 per year)', '2013-11-03 10:09:14'); INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2173', 'No, I dont\'t want any mailings about news and actions on opencaching.de.', '2013-11-03 10:09:14'); INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2174', 'Newsletter:', '2013-11-03 10:09:14'); +INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2176', 'Planned events', '2013-11-03 10:09:14'); -- Table sys_trans_ref SET NAMES 'utf8'; @@ -6687,6 +6688,7 @@ INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUE INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2172', 'DE', 'Ja, ich möchte Informationen zu Neuigkeiten und Aktionen auf opencaching.de per Email erhalten. (max. 2-5 pro Jahr)', '2013-11-03 10:09:14'); INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2173', 'DE', 'Nein, ich möchte keine Informationen zu Neuigkeiten und Aktionen auf opencaching.de per Email erhalten.', '2013-11-03 10:09:14'); INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2174', 'DE', 'Newsletter:', '2013-11-03 10:09:14'); +INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2176', 'DE', 'Geplante Events', '2013-11-03 10:09:14'); INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('1', 'EN', 'Reorder IDs', '2010-09-02 00:15:30'); INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2', 'EN', 'The database could not be reconnected.', '2010-08-28 11:48:07'); INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('3', 'EN', 'Testing – please do not login', '2010-08-28 11:48:07'); diff --git a/htdocs/index.php b/htdocs/index.php index d2898e80..b0937c37 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -97,6 +97,9 @@ // get newest events $tpl->assign_rs('events', $getNew->rsForSmarty('event')); + // get total event count for all countries + $tpl->assign('total_events', sql_value_slave( + "SELECT COUNT(*) FROM `caches` WHERE `type`=6 AND `date_hidden` >= curdate() AND `status`=1", 0)); // get newest caches $tpl->assign_rs('newcaches', $getNew->rsForSmarty('cache')); diff --git a/htdocs/newcaches.php b/htdocs/newcaches.php index 3b00f4e3..2b0cbdde 100644 --- a/htdocs/newcaches.php +++ b/htdocs/newcaches.php @@ -11,6 +11,8 @@ $startat = isset($_REQUEST['startat']) ? $_REQUEST['startat']+0 : 0; $country = isset($_REQUEST['country']) ? $_REQUEST['country'] : ''; + $cachetype = isset($_REQUEST['cachetype']) ? $_REQUEST['cachetype']+0 : 0; + $bEvents = ($cachetype == 6); $perpage = 100; $startat -= $startat % $perpage; @@ -27,12 +29,16 @@ { require($opt['rootpath'] . 'lib2/logic/cacheIcon.inc.php'); + $cachetype_condition = ($cachetype ? " AND `caches`.`type` = " . sql_escape($cachetype) : ""); + if ($bEvents) + $cachetype_condition .= " AND `date_hidden` >= curdate()"; + $date_field = ($bEvents ? 'date_hidden' : 'date_created'); $newCaches = array(); $rsNewCaches = sql_slave( "SELECT `caches`.`cache_id` `cacheid`, `caches`.`wp_oc` `wpoc`, `caches`.`name` `cachename`, `caches`.`type`, `caches`.`country` `country`, - `caches`.`date_created` `date_created`, + `caches`.`$date_field` `date_created`, IFNULL(`sys_trans_text`.`text`,`countries`.`en`) AS `country_name`, `user`.`user_id` `userid`, `user`.`username` `username`, `ca`.`attrib_id` IS NOT NULL AS `oconly` @@ -42,7 +48,8 @@ LEFT JOIN `sys_trans_text` ON `sys_trans_text`.`trans_id` = `countries`.`trans_id` AND `sys_trans_text`.`lang` = '" . sql_escape($opt['template']['locale']) . "' LEFT JOIN `caches_attributes` `ca` ON `ca`.`cache_id`=`caches`.`cache_id` AND `ca`.`attrib_id`=6 - WHERE `caches`.`status` = 1" . ($country ? " AND `caches`.`country`='" . sql_escape($country) . "'" : "") . " + WHERE `caches`.`status` = 1" . ($country ? " AND `caches`.`country`='" . sql_escape($country) . "'" : "") . + $cachetype_condition . " ORDER BY `caches`.`date_created` DESC LIMIT " . ($startat+0) . ', ' . ($perpage+0)); // see also write_newcaches_urls() in sitemap.class.php @@ -52,15 +59,16 @@ $tpl->assign('newCaches', $newCaches); $startat = isset($_REQUEST['startat']) ? $_REQUEST['startat']+0 : 0; + $cacheype_par = ($cachetype ? "&cachetype=$cachetype" : ""); if ($country == '') { - $count = sql_value_slave("SELECT COUNT(*) FROM `caches` WHERE `caches`.`status`=1", 0); - $pager = new pager("newcaches.php?startat={offset}"); + $count = sql_value_slave("SELECT COUNT(*) FROM `caches` WHERE `caches`.`status`=1" . $cachetype_condition, 0); + $pager = new pager("newcaches.php?startat={offset}" . $cacheype_par); } else { - $count = sql_value_slave("SELECT COUNT(*) FROM `caches` WHERE `caches`.`status`=1 AND `caches`.`country`='&1'", 0, $country); - $pager = new pager("newcaches.php?country=".$country."&startat={offset}"); + $count = sql_value_slave("SELECT COUNT(*) FROM `caches` WHERE `caches`.`status`=1 AND `caches`.`country`='&1'" . $cachetype_condition, 0, $country); + $pager = new pager("newcaches.php?country=".$country."&startat={offset}" . $cacheype_par); } $pager->make_from_offset($startat, $count, 100); @@ -77,6 +85,8 @@ WHERE `countries`.`short`='&1'", '', $country, $opt['template']['locale']) ); } + + $tpl->assign('events', $bEvents); } $tpl->display(); diff --git a/htdocs/templates2/ocstyle/newcaches.tpl b/htdocs/templates2/ocstyle/newcaches.tpl index 922024f3..2641a8f4 100644 --- a/htdocs/templates2/ocstyle/newcaches.tpl +++ b/htdocs/templates2/ocstyle/newcaches.tpl @@ -6,7 +6,7 @@ {* OCSTYLE *}