diff --git a/bin/dbsv-update.php b/bin/dbsv-update.php
index 5e44bd77..e33a62fc 100644
--- a/bin/dbsv-update.php
+++ b/bin/dbsv-update.php
@@ -173,7 +173,7 @@
sql("ALTER TABLE `cache_reports` ADD INDEX `userid` (`userid`)");
}
- function dbv_108() // automatic email-bounce processiong
+ function dbv_108() // automatic email-bounce processing
{
if (!sql_field_exists('user','last_email_problem'))
sql("ALTER TABLE `user` ADD COLUMN `last_email_problem` datetime default NULL AFTER `email_problems`");
@@ -181,10 +181,46 @@
sql("ALTER TABLE `user` ADD COLUMN `mailing_problems` int(10) unsigned NOT NULL default '0' AFTER `last_email_problem`");
}
- function dbv_109() // improved email-bounce processiong
+ function dbv_109() // improved email-bounce processing
{
if (!sql_field_exists('user','first_email_problem'))
sql("ALTER TABLE `user` ADD COLUMN `first_email_problem` date default NULL AFTER `email_problems`");
}
+ function dbv_110() // move adoption history to separate table
+ {
+ if (!sql_table_exists('cache_adoptions'))
+ {
+ sql(
+ "CREATE TABLE `cache_adoptions` (
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `cache_id` int(10) unsigned NOT NULL,
+ `date` datetime NOT NULL,
+ `from_user_id` int(10) unsigned NOT NULL,
+ `to_user_id` int(10) unsigned NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `cache_id` (`cache_id`,`date`)
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1");
+
+ $rs = sql("SELECT `id`, `date_created`, `objectid1`, `logtext`
+ FROM `logentries`
+ WHERE `eventid`=5
+ ORDER BY `date_created`, `id`");
+ while ($rLog = sql_fetch_assoc($rs))
+ {
+ preg_match('/Cache (\d+) has changed the owner from userid (\d+) to (\d+) by (\d+)/',
+ $rLog['logtext'], $matches);
+ if (count($matches) != 5)
+ die("unknown adoption log entry format for ID " . $rLog['id'] . "\n");
+ sql("INSERT INTO `cache_adoptions`
+ (`cache_id`,`date`,`from_user_id`,`to_user_id`)
+ VALUES ('&1','&2','&3','&4')",
+ $rLog['objectid1'], $rLog['date_created'], $matches[2], $matches[3]);
+ }
+ sql_free_result($rs);
+
+ // We keep the old entries in 'logentries' for the case something went wrong here.
+ }
+ }
+
?>
\ No newline at end of file
diff --git a/htdocs/adminreports.php b/htdocs/adminreports.php
index 9ffcdf96..1eea2ae5 100644
--- a/htdocs/adminreports.php
+++ b/htdocs/adminreports.php
@@ -144,7 +144,7 @@
$tpl->assign('adminid', $record['adminid']);
$tpl->assign('adminnick', $record['adminnick']);
$tpl->assign('reason', $record['reason']);
- $tpl->assign('note', $record['note']);
+ $tpl->assign('note', trim($record['note']));
$tpl->assign('status', $record['status']);
$tpl->assign('created', $record['date_created']);
$tpl->assign('lastmodified', $record['lastmodified']);
diff --git a/htdocs/config2/settings-dist.inc.php b/htdocs/config2/settings-dist.inc.php
index 77f8c66c..d44118ff 100644
--- a/htdocs/config2/settings-dist.inc.php
+++ b/htdocs/config2/settings-dist.inc.php
@@ -368,9 +368,10 @@
// fill_gaps = false: continue with the last waypoint
$opt['logic']['waypoint_pool']['fill_gaps'] = false;
- /* Automatic system user actions
+ /* Username for cronjobs or CLI tools
+ * is used e.g. for cache auto-archiving and auto-publishing
*/
- $opt['logic']['systemuser']['user'] = ''; // enter an active username to enable auto archiving
+ $opt['logic']['systemuser']['user'] = '';
/* Purge log files - age in days (0 = keep infinite)
*/
@@ -405,6 +406,7 @@
/* cronjob
*/
$opt['cron']['pidfile'] = $opt['rootpath'] . 'cache2/runcron.pid';
+ $opt['cron']['username'] = 'apache'; // system username for cronjobs
/* phpbb news integration (index.php)
*
@@ -437,10 +439,11 @@
$opt['cron']['sitemaps']['generate'] = true;
$opt['cron']['sitemaps']['submit'] = false;
- /* Geokret cronjob
+ /* other cronjobs
*/
$opt['cron']['geokrety']['run'] = true;
+ $opt['cron']['autoarchive']['run'] = false;
/* E-Mail settings
*
diff --git a/htdocs/doc/sql/static-data/data.sql b/htdocs/doc/sql/static-data/data.sql
index c1930bce..500f169c 100644
--- a/htdocs/doc/sql/static-data/data.sql
+++ b/htdocs/doc/sql/static-data/data.sql
@@ -2487,11 +2487,16 @@ INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2065', 'Guest',
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2066', 'Open chat in a new tab/window', '2013-04-25 23:00:00');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2067', 'Status', '2013-05-28 16:51:40');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2068', 'since June 2013', '2013-05-28 16:51:40');
-INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2069', 'since February 2012', '2013-05-28 16:51:40');
+INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2069', 'since deletion date February 2012', '2013-05-28 16:51:40');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2070', 'One ore more emails to this user could not be delivered. It might be a good idea to additionally log comments on the user\'s geocaches, and/or trying to contact him/her through other channels like a message board account or another geocaching platform.', '2013-05-28 16:51:40');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2071', 'This cache has been \"temporarily unavailable\" for more than one year now; therefore it is being archived automatically. The owner may decide to maintain the cache and re-enable the listing.', '2013-05-28 16:51:40');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2072', 'This event took place more than five weeks ago; therefore it is being archived automatically. The owner may re-enable the listing if it should stay active for some exceptional reason.', '2013-05-28 16:51:40');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2073', 'This user account is disabled.', '2013-05-28 16:51:40');
+INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2074', 'Adoptions_', '2013-05-28 16:51:40');
+INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2075', 'since September 2012', '2013-05-28 16:51:40');
+INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2076', 'From Owner', '2013-05-28 16:51:40');
+INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2077', 'To Owner', '2013-05-28 16:51:40');
+INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2078', 'Maintenance', '2013-05-28 16:51:40');
-- Table sys_trans_ref
SET NAMES 'utf8';
@@ -4983,7 +4988,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 ('158', 'DE', 'Französisch', '2010-08-28 11:48:06');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('159', 'DE', 'Englisch', '2010-08-28 11:48:06');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('160', 'DE', 'Deutsch', '2010-08-28 11:48:06');
-INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('161', 'DE', 'Vorsicht: Wenn Du diese Option verwenden, vergiss niemals auf Logout zu klicken, wenn Du dich von einem PC aus angemeldet hast der auch Fremden zugänglich ist. Ansonsten könnte ein Fremder Deine persönlichen Account-Daten auslesen und ändern.', '2010-08-28 11:48:06');
+INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('161', 'DE', 'Vorsicht: Wenn du diese Option verwenden, vergiss niemals auf Logout zu klicken, wenn du dich von einem PC aus angemeldet hast der auch Fremden zugänglich ist. Ansonsten könnte ein Fremder deine persönlichen Account-Daten auslesen und ändern.', '2010-08-28 11:48:06');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('162', 'DE', 'Simbabwe', '2010-08-28 11:48:06');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('163', 'DE', 'Sambia', '2010-08-28 11:48:06');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('164', 'DE', 'Südafrika', '2010-08-28 11:48:06');
@@ -5413,11 +5418,11 @@ INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUE
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('601', 'DE', 'Folgender Sicherheits-Code wurde generiert: %1', '2010-08-28 11:48:06');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('602', 'DE', 'Der Sicherheits-Code bleibt drei Tage gültig.', '2010-08-28 11:48:06');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('603', 'DE', 'Dein neues Passwort kannst du unter %1newpw.php eingeben.', '2010-08-28 11:48:06');
-INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('604', 'DE', 'Um ein neues Passwort einzugeben, musst Du zunächst einen Sicherheits-Code anfordern. Dieser wird per E-Mail an Dich gesendet.', '2010-08-28 11:48:06');
+INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('604', 'DE', 'Um ein neues Passwort einzugeben, musst du zunächst einen Sicherheits-Code anfordern. Dieser wird per E-Mail an dich gesendet.', '2010-08-28 11:48:06');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('605', 'DE', 'Die E-Mail-Adresse gehört zu keinem gültigen Benutzer.', '2010-08-28 11:48:06');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('606', 'DE', 'Dir wurde eine E-Mail mit dem Sicherheits-Code zugesandt.', '2010-08-28 11:48:06');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('607', 'DE', 'Der Sicherheitscode konnte wegen eines Fehlers nicht gesendet werden.', '2010-08-28 11:48:06');
-INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('608', 'DE', 'Gib bitten deine E-Mail-Adresse, den Sicherheitscode und das neue Passwort ein. Der Sicherheitscode bleibt drei Tage gültig; danach musst Du ihn ggf. erneut anfordern.', '2010-08-28 11:48:06');
+INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('608', 'DE', 'Gib bitte deine E-Mail-Adresse, den Sicherheitscode und das neue Passwort ein. Der Sicherheitscode bleibt drei Tage gültig; danach musst du ihn ggf. erneut anfordern.', '2010-08-28 11:48:06');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('609', 'DE', 'Der angegebene Benutzer ist noch nicht aktiviert.', '2010-08-28 11:48:06');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('610', 'DE', 'Sicherheitscode:', '2010-08-28 11:48:06');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('611', 'DE', 'Der Sicherheitscode ist abgelaufen. Fordere bitte einen neuen an.', '2010-08-28 11:48:06');
@@ -6431,11 +6436,16 @@ INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUE
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2066', 'DE', 'Chat in neuem Tab/Fenster öffnen', '2013-04-25 23:00:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2067', 'DE', 'Status', '2013-04-25 23:00:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2068', 'DE', 'seit Juni 2013', '2013-04-25 23:00:00');
-INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2069', 'DE', 'seit Februar 2012', '2013-04-25 23:00:00');
+INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2069', 'DE', 'seit Löschdatum Februar 2012', '2013-04-25 23:00:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2070', 'DE', 'Eine oder mehrere Emails an diesen Benutzer konnten nicht zugestellt werden. Es könnte ratsam sein, Hinweise zu seinen Caches zusätzlich zu loggen, und ihn ggf. über weitere Adressen wie z.B. Forenaccounts oder andere Geocaching-Plattformen zu kontaktieren.', '2013-04-25 23:00:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2071', 'DE', 'Dieser Cache ist seit mehr als einem Jahr „momentan nicht verfügbar“; daher wird er automatisch archiviert. Er kann vom Besitzer jederzeit instand gesetzt und reaktiviert werden.', '2013-04-25 23:00:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2072', 'DE', 'Dieses Event fand vor über fünf Wochen statt; daher wird es automatisch archiviert. Das Listing kann vom Owner selbst reaktiviert werden, falls es aus besonderen Gründen weiter aktiv bleiben soll.', '2013-04-25 23:00:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2073', 'DE', 'Dieser Benutzer ist deaktiviert.', '2013-04-25 23:00:00');
+INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2074', 'DE', 'Adoptionen', '2013-04-25 23:00:00');
+INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2075', 'DE', 'seit September 2012', '2013-04-25 23:00:00');
+INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2076', 'DE', 'Alter Besitzer', '2013-04-25 23:00:00');
+INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2077', 'DE', 'Neuer Besitzer', '2013-04-25 23:00:00');
+INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2078', 'DE', 'Wartung', '2013-04-25 23:00:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('1', 'EN', 'Reorder IDs \r', '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');
@@ -7995,11 +8005,16 @@ INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUE
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2066', 'EN', 'Open chat in a new tab/window', '2013-02-19 05:48:07');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2067', 'EN', 'Status', '2013-04-25 23:00:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2068', 'EN', 'since June 2013', '2013-04-25 23:00:00');
-INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2069', 'EN', 'since February 2012', '2013-04-25 23:00:00');
+INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2069', 'EN', 'since deletion date February 2012', '2013-04-25 23:00:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2070', 'EN', 'One ore more emails to this user could not be delivered. It might be a good idea to additionally log comments on the user\'s geocaches, and/or trying to contact him/her through other channels like a message board account or another geocaching platform.', '2013-04-25 23:00:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2071', 'EN', 'This cache has been \"temporarily unavailable\" for more than one year now; therefore it is being archived automatically. The owner may decide to maintain the cache and re-enable the listing.', '2013-04-25 23:00:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2072', 'EN', 'This event took place more than five weeks ago; therefore it is being archived automatically. The owner may re-enable the listing if it should stay active for some exceptional reason.', '2013-04-25 23:00:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2073', 'EN', 'This user account is disabled.', '2013-04-25 23:00:00');
+INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2074', 'EN', 'Adoptions', '2013-04-25 23:00:00');
+INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2075', 'EN', 'since September 2012', '2013-04-25 23:00:00');
+INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2076', 'EN', 'From Owner', '2013-04-25 23:00:00');
+INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2077', 'EN', 'To Owner', '2013-04-25 23:00:00');
+INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2078', 'EN', 'Maintenance', '2013-04-25 23:00:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('1', 'ES', 'Reordenar ID', '2010-12-09 00:17:55');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2', 'ES', 'La base de datos no se pudo conectar.', '2010-12-09 00:17:55');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('3', 'ES', 'En pruebas - por favor, no entre.', '2010-12-09 00:17:55');
diff --git a/htdocs/doc/sql/stored-proc/maintain.php b/htdocs/doc/sql/stored-proc/maintain.php
index 2419f17c..a780e5ca 100644
--- a/htdocs/doc/sql/stored-proc/maintain.php
+++ b/htdocs/doc/sql/stored-proc/maintain.php
@@ -710,6 +710,10 @@
/* logpw needs not to be saved */
/* for further explanation see restorecaches.php */
END IF;
+ IF NEW.`user_id`!=OLD.`user_id` THEN
+ INSERT INTO `cache_adoptions` (`cache_id`,`date`,`from_user_id`,`to_user_id`)
+ VALUES (NEW.`cache_id`, NEW.`last_modified`, OLD.`user_id`, NEW.`user_id`);
+ END IF;
IF NEW.`user_id`!=OLD.`user_id` OR NEW.`status`!=OLD.`status` THEN
CALL sp_update_hiddenstat(OLD.`user_id`, OLD.`status`, TRUE);
CALL sp_update_hiddenstat(NEW.`user_id`, NEW.`status`, FALSE);
diff --git a/htdocs/doc/sql/tables/cache_adoptions.sql b/htdocs/doc/sql/tables/cache_adoptions.sql
new file mode 100644
index 00000000..5e907cd1
--- /dev/null
+++ b/htdocs/doc/sql/tables/cache_adoptions.sql
@@ -0,0 +1,11 @@
+SET NAMES 'utf8';
+DROP TABLE IF EXISTS `cache_adoptions`;
+CREATE TABLE IF NOT EXISTS `cache_adoptions` (
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `cache_id` int(10) unsigned NOT NULL,
+ `date` datetime NOT NULL,
+ `from_user_id` int(10) unsigned NOT NULL,
+ `to_user_id` int(10) unsigned NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `cache_id` (`cache_id`,`date`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
diff --git a/htdocs/editlog.php b/htdocs/editlog.php
index 132aa661..ce0a5936 100644
--- a/htdocs/editlog.php
+++ b/htdocs/editlog.php
@@ -104,7 +104,7 @@
$log_time_minute = isset($_POST['logminute']) ? trim($_POST['logminute']) : (substr($log_record['date'],11) == "00:00:00" ? "" : date('i', strtotime($log_record['date'])));
$top_option = isset($_POST['ratingoption']) ? $_POST['ratingoption']+0 : 0;
$top_cache = isset($_POST['rating']) ? $_POST['rating']+0 : 0;
- $oc_team_comment = isset($_POST['teamcomment']) ? ($_POST['teamcomment'] != 0) : ($log_record['oc_team_comment'] == '1');
+ $oc_team_comment = isset($_POST['submitform']) ? @$_POST['teamcomment']+0 : ($log_record['oc_team_comment'] == 1);
$log_pw = '';
$use_log_pw = (($log_record['logpw'] == NULL) || ($log_record['logpw'] == '')) ? false : true;
@@ -222,7 +222,7 @@
}
// ignore unauthorized team comments
- if (!teamcomment_allowed($log_record['cache_id'], $log_type))
+ if (!teamcomment_allowed($log_record['cache_id'], $log_type, $log_record['oc_team_comment']))
$oc_team_comment = 0;
//store?
@@ -289,8 +289,7 @@
$selected = ($log_record['logtype'] == $logtype ? ' selected="selected"' : '');
$logtypeoptions .= '' . "\n";
}
-
- if (teamcomment_allowed($log_record['cache_id'],3))
+ if (teamcomment_allowed($log_record['cache_id'], 3, $log_record['oc_team_comment']))
tpl_set_var('teamcommentoption',
mb_ereg_replace('{chk_sel}', ($oc_team_comment ? 'checked' : ''), $teamcomment_field));
else
diff --git a/htdocs/lang/de/ocstyle/editcache.inc.php b/htdocs/lang/de/ocstyle/editcache.inc.php
index 1a992959..47c6f3fb 100644
--- a/htdocs/lang/de/ocstyle/editcache.inc.php
+++ b/htdocs/lang/de/ocstyle/editcache.inc.php
@@ -63,7 +63,7 @@
.
.
-
- The managing comittee are (as of August 31, 2012):
+ The managing comittee are (as of July 06, 2013):
The Opencaching Deutschland e.V. (e.V. = registered association) was founded on June 9, 2012 as new operator of the Opencaching.de website (OC), and to ensure future development of OC. The association may also support other upcoming Opencaching projects.
-Where is the association located?
+Where is the association located?
The association's registered address is at Bad Homburg vor der Höhe near Frankfurt/Main. We chose this place because it is a central location in Germany. Eventually, the location is not important as the association nearly solely acts online. General meetings, board sessions and conferences on further development of Opencaching.de take place via TeamSpeak. We use E-Mail and – of course – our Forum.
-What do I pay as Opencaching Deutschland member?
+What do I pay as Opencaching Deutschland member?
Membership is free for active members (ordentliche Mitglieder) who directly contribute time and work to the Opencaching.de project. We are always looking for software developers and testes, graphic designers, photographers, lectors, support people, documenters etc.! If you don't have the time for this, you may become passive member (Fördermitglied). The minimum fee for passive members is 1 Euro per month.
-Where do I find the association's statutes?
+Where do I find the association's statutes?
You cand download the current statutes here (in German).
-Where do I find the membership application form?
+Where do I find the membership application form?
You can download the application form here (in German).
-I would like to support Opencaching, but I don't want do join the association. What else can I do?
+I would like to support Opencaching, but I don't want do join the association. What else can I do?
We depend on your donations to finance the technical operation of the website. We will be glad to recieve you support via our donations page; a few Euros will already help us.
-Where can I ask further questions on the association?
+Where can I ask further questions on the association?
You are welcome to contact the chairman at verein@opencaching.de.
diff --git a/htdocs/util/publish_caches/run_publish.php b/htdocs/util/publish_caches/run_publish.php
deleted file mode 100644
index 2e269c23..00000000
--- a/htdocs/util/publish_caches/run_publish.php
+++ /dev/null
@@ -1,60 +0,0 @@
-#!/usr/local/bin/php -q
-
\ No newline at end of file
diff --git a/htdocs/util/publish_caches/settings-dist.inc.php b/htdocs/util/publish_caches/settings-dist.inc.php
deleted file mode 100644
index d3671a01..00000000
--- a/htdocs/util/publish_caches/settings-dist.inc.php
+++ /dev/null
@@ -1,4 +0,0 @@
-
\ No newline at end of file
diff --git a/htdocs/util2/cron/modules/cache_autoarchive.class.php b/htdocs/util2/cron/modules/autoarchive_caches.class.php
similarity index 85%
rename from htdocs/util2/cron/modules/cache_autoarchive.class.php
rename to htdocs/util2/cron/modules/autoarchive_caches.class.php
index c33d3c4c..a1a70aa5 100644
--- a/htdocs/util2/cron/modules/cache_autoarchive.class.php
+++ b/htdocs/util2/cron/modules/autoarchive_caches.class.php
@@ -16,16 +16,18 @@ checkJob(new autoarchive());
class autoarchive
{
var $name = 'autoarchive';
- var $interval = 120; // provisonal minimum interval for initial archiving
+ var $interval = 3600; // once per hour
function run()
{
global $opt, $login;
- if ($login->system_login($opt['logic']['systemuser']['user']))
+ if ($opt['cron']['autoarchive']['run'])
{
- if ($login->hasAdminPriv(ADMIN_USER))
+ if (!$login->logged_in())
+ echo $this->name . ": not logged in / no system user configured\n";
+ elseif ($login->hasAdminPriv(ADMIN_USER))
{
$this->archive_disabled_caches();
$this->archive_events();
@@ -43,10 +45,10 @@ class autoarchive
$rs = sql("SELECT `caches`.`cache_id`
FROM `caches`
WHERE `caches`.`status`=2 AND `caches`.`type`<>6
- AND IFNULL((SELECT MAX(`date_modified`) FROM `cache_status_modified` `csm` WHERE `csm`.`cache_id`=`caches`.`cache_id`),`caches`.`listing_last_modified`) < NOW() - INTERVAL 365 DAY
+ AND IFNULL((SELECT MAX(`date_modified`) FROM `cache_status_modified` `csm` WHERE `csm`.`cache_id`=`caches`.`cache_id`),`caches`.`listing_last_modified`) < NOW() - INTERVAL 366 DAY
GROUP BY `caches`.`cache_id`
ORDER BY `caches`.`listing_last_modified`
- LIMIT 1"); // provisional limit for initial archiving
+ LIMIT 3"); // limit to avoid mass emails and spam-filter triggers
while ($rCache = sql_fetch_assoc($rs))
{
$this->archive_cache(
@@ -68,7 +70,7 @@ class autoarchive
WHERE `caches`.`type`=6 AND `caches`.`status`=1
AND GREATEST(`date_hidden`,`date_created`) < NOW() - INTERVAL 35 DAY
ORDER BY `date_hidden`
- LIMIT 1"); // provisonal limit for initial archiving
+ LIMIT 1");
while ($rCache = sql_fetch_assoc($rs))
{
$this->archive_cache(
@@ -97,7 +99,9 @@ class autoarchive
// create log
$log->setType(cachelog::LOGTYPE_ARCHIVED, true);
$log->setOcTeamComment(true);
- $log->setDate(date('Y-m-d H:i'));
+ $log->setDate(date('Y-m-d'));
+ // Log without time, so that owner reactions will always appear AFTER
+ // the system log, no matter if logged with or without date.
// create log text in appropriate language
$translated_comment = $translate->t($comment, '','',0,'',1, $cache->getDefaultDescLanguage());
diff --git a/htdocs/util2/cron/modules/geokrety.class.php b/htdocs/util2/cron/modules/geokrety.class.php
index 0066267b..3cefd365 100644
--- a/htdocs/util2/cron/modules/geokrety.class.php
+++ b/htdocs/util2/cron/modules/geokrety.class.php
@@ -3,10 +3,16 @@
* For license information see doc/license.txt
*
* Unicode Reminder メモ
+ *
+ * Import new data from geokrety.org.
+ *
+ * See util2/geokrety for check and repair functions.
+ * See discussion in http://redmine.opencaching.de/issues/18.
***************************************************************************/
checkJob(new geokrety());
+
class geokrety
{
var $name = 'geokrety';
@@ -39,7 +45,9 @@ class geokrety
$this->removeXML($path);
- $modifiedsince = strtotime(getSysConfig('geokrety_lastupdate', '2005-01-01 00:00:00'));
+ // Changed default-value for getSysConfig() from '2005-01-01 00:00:00' to 'NOW - 9d 12h'
+ // to safely stay in api-limit, even when client and server are in different time zones.
+ $modifiedsince = strtotime(getSysConfig('geokrety_lastupdate', date($opt['db']['dateformat'], time() - 60*60*24*9.5)));
if (!@copy('http://geokrety.org/export.php?modifiedsince=' . date('YmdHis', $modifiedsince - 1), $path))
return false;
@@ -129,7 +137,7 @@ class geokrety
$typeid = $this->GetNodeAttribute($element, 'type', 'id')+0;
$typename = $this->GetNodeValue($element, 'type');
$this->checkGeoKretType($typeid, $typename);
-
+
$description = html_entity_decode($this->GetNodeValue($element, 'description'));
$datecreated = strtotime($this->GetNodeValue($element, 'datecreated'));
@@ -139,34 +147,46 @@ class geokrety
$longitude = $this->GetNodeAttribute($element, 'position', 'longitude')+0;
$latitude = $this->GetNodeAttribute($element, 'position', 'latitude')+0;
- sql("INSERT INTO `gk_item` (`id`, `name`, `description`, `userid`, `datecreated`, `distancetravelled`,
- `latitude`, `longitude`, `typeid`, `stateid`)
- VALUES ('&1', '&2', '&3', '&4', '&5', '&6',
- '&7', '&8', '&9', '&10')
- ON DUPLICATE KEY UPDATE `name`='&2', `description`='&3', `userid`='&4', `datecreated`='&5',
- `distancetravelled`='&6', `latitude`='&7', `longitude`='&8', `typeid`='&9', `stateid`='&10'",
- $id, $name, $description, $userid, date($opt['db']['dateformat'], $datecreated), $distancetravelled,
- $latitude, $longitude, $typeid, $state);
+ sql("INSERT INTO `gk_item`
+ (`id`, `name`, `description`, `userid`, `datecreated`, `distancetravelled`, `latitude`, `longitude`, `typeid`, `stateid`)
+ VALUES
+ ('&1', '&2', '&3', '&4', '&5', '&6', '&7', '&8', '&9', '&10')
+ ON DUPLICATE KEY UPDATE
+ `name`='&2', `description`='&3', `userid`='&4', `datecreated`='&5', `distancetravelled`='&6', `latitude`='&7', `longitude`='&8', `typeid`='&9', `stateid`='&10'",
+ $id, $name, $description, $userid, date($opt['db']['dateformat'], $datecreated), $distancetravelled, $latitude, $longitude, $typeid, $state);
-/* we are using now the moves to update waypoints */
-/*
- sql("DELETE FROM `gk_item_waypoint` WHERE id='&1'", $id);
+ // Deleting and inserting item-waypoints if they have not changed will
+ // update caches.meta_last_modified -> caches.okapi_syncbase and thus trigger
+ // OKAPI changelog actions. This probably can be ignored as OKAPI will verify
+ // if data has really changed.
// update associated waypoints
+ /**
+ * This does not work properly, because geokret.waypoints does NOT contain the
+ * current location of the Kret but something like the last cache where it was logged.
+ * Evaluating the 'state' fielt might help, but for now, we import waypoint data
+ * from the moves instead.
+
+ sql("DELETE FROM `gk_item_waypoint` WHERE id='&1'", $id);
$waypoints = $element->getElementsByTagName('waypoints');
- if ($waypoints->length == 1)
+ if ($waypoints->length > 0)
{
$wpItems = $waypoints->item(0)->getElementsByTagName('waypoint');
for ($i = 0; $i < $wpItems->length; $i++)
{
$wp = $wpItems->item($i)->nodeValue;
if ($wp != '')
- sql("INSERT INTO `gk_item_waypoint` (`id`, `wp`) VALUES ('&1', '&2')", $id, $wp);
+ sql("INSERT INTO `gk_item_waypoint`
+ (`id`, `wp`)
+ VALUES
+ ('&1', '&2')",
+ $id, $wp);
}
}
-*/
+ */
}
+
function importMove($element)
{
global $opt;
@@ -190,19 +210,19 @@ class geokrety
$logtypename = $this->GetNodeValue($element, 'logtype');
$this->checkMoveType($logtypeid, $logtypename);
- sql("INSERT INTO `gk_move` (`id`, `itemid`, `latitude`, `longitude`, `datemoved`, `datelogged`,
- `userid`, `comment`, `logtypeid`)
- VALUES ('&1', '&2', '&3', '&4', '&5', '&6',
- '&7', '&8', '&9')
- ON DUPLICATE KEY UPDATE `itemid`='&2', `latitude`='&3', `longitude`='&4', `datemoved`='&5',
- `datelogged`='&6', `userid`='&7', `comment`='&8', `logtypeid`='&9'",
- $id, $gkid, $latitude, $longitude, date($opt['db']['dateformat'], $datemoved), date($opt['db']['dateformat'], $datelogged),
- $userid, $comment, $logtypeid);
- sql("DELETE FROM `gk_move_waypoint` WHERE id='&1'", $id);
+ sql("INSERT INTO `gk_move`
+ (`id`, `itemid`, `latitude`, `longitude`, `datemoved`, `datelogged`, `userid`, `comment`, `logtypeid`)
+ VALUES
+ ('&1', '&2', '&3', '&4', '&5', '&6', '&7', '&8', '&9')
+ ON DUPLICATE KEY UPDATE
+ `itemid`='&2', `latitude`='&3', `longitude`='&4', `datemoved`='&5', `datelogged`='&6', `userid`='&7', `comment`='&8', `logtypeid`='&9'",
+ $id, $gkid, $latitude, $longitude, date($opt['db']['dateformat'], $datemoved), date($opt['db']['dateformat'], $datelogged), $userid, $comment, $logtypeid);
+
+ sql("DELETE FROM `gk_move_waypoint` WHERE id='&1'", $id);
// update associated waypoints
$waypoints = $element->getElementsByTagName('waypoints');
- if ($waypoints->length == 1)
+ if ($waypoints->length > 0)
{
$wpItems = $waypoints->item(0)->getElementsByTagName('waypoint');
for ($i = 0; $i < $wpItems->length; $i++)
@@ -213,16 +233,25 @@ class geokrety
}
}
- // now update the current gk-waypoints based on the last move
- sql("DELETE FROM `gk_item_waypoint` WHERE `id`='&1'", $gkid);
- $rs = sql("SELECT * FROM `gk_move` WHERE `itemid`='&1' AND `logtypeid`!=2 ORDER BY `datemoved` DESC LIMIT 1", $gkid);
+ // update the current gk-waypoints based on the last move
+ sql("DELETE FROM `gk_item_waypoint` WHERE `id`='&1'", $gkid);
+ $rs = sql("
+ SELECT `id`,`logtypeid` FROM `gk_move`
+ WHERE `itemid`='&1' AND `logtypeid`!=2
+ ORDER BY `datemoved` DESC LIMIT 1",
+ $gkid);
$r = sql_fetch_assoc($rs);
sql_free_result($rs);
if ($r === false) return;
- if ($r['logtypeid'] == 0 || $r['logtypeid'] == 3)
+ if ($r['logtypeid'] == 0 /* dropped */ || $r['logtypeid'] == 3 /* seen in */)
{
- sql("INSERT INTO `gk_item_waypoint` (`id`, `wp`) SELECT '&1' AS `id`, `wp` FROM `gk_move_waypoint` WHERE `id`='&2' AND `wp`!=''", $gkid, $id);
+ sql("
+ INSERT INTO `gk_item_waypoint` (`id`, `wp`)
+ SELECT '&1' AS `id`, `wp`
+ FROM `gk_move_waypoint`
+ WHERE `id`='&2' AND `wp`!=''",
+ $gkid, $r['id']); // "late log" bugfix: replaced $id paramter by $r['id']
}
else
{
@@ -230,11 +259,13 @@ class geokrety
}
}
+
function checkGeoKretType($id, $name)
{
sql("INSERT INTO `gk_item_type` (`id`, `name`) VALUES ('&1', '&2') ON DUPLICATE KEY UPDATE `name`='&2'", $id, $name);
}
+
function checkUser($id, $name)
{
if ($id == 0) return;
@@ -242,11 +273,13 @@ class geokrety
sql("INSERT INTO `gk_user` (`id`, `name`) VALUES ('&1', '&2') ON DUPLICATE KEY UPDATE `name`='&2'", $id, $name);
}
+
function checkMoveType($id, $name)
{
sql("INSERT INTO `gk_move_type` (`id`, `name`) VALUES ('&1', '&2') ON DUPLICATE KEY UPDATE `name`='&2'", $id, $name);
}
+
function GetNodeValue(&$domnode, $element)
{
$subnode = $domnode->getElementsByTagName($element);
@@ -256,6 +289,7 @@ class geokrety
return $subnode->item(0)->nodeValue;
}
+
function GetNodeAttribute(&$domnode, $element, $attr)
{
$subnode = $domnode->getElementsByTagName($element);
diff --git a/htdocs/util2/cron/modules/publish_caches.class.php b/htdocs/util2/cron/modules/publish_caches.class.php
index 84263a53..15c284f0 100644
--- a/htdocs/util2/cron/modules/publish_caches.class.php
+++ b/htdocs/util2/cron/modules/publish_caches.class.php
@@ -16,6 +16,8 @@ class publish_caches
function run()
{
+ global $login;
+
$rsPublish = sql("SELECT `cache_id`, `user_id` FROM `caches` WHERE `status`=5 AND NOT ISNULL(`date_activate`) AND `date_activate`<=NOW()");
while($rPublish = sql_fetch_array($rsPublish))
{
@@ -23,6 +25,7 @@ class publish_caches
$cacheid = $rPublish['cache_id'];
// update cache status to active
+ sql("SET @STATUS_CHANGE_USER_ID='&1'", $login->userid);
sql("UPDATE `caches` SET `status`=1, `date_activate`=NULL WHERE `cache_id`='&1'", $cacheid);
}
sql_free_result($rsPublish);
diff --git a/htdocs/util2/cron/modules/purge_logs.class.php b/htdocs/util2/cron/modules/purge_logs.class.php
index 45c8eede..3bfc680b 100644
--- a/htdocs/util2/cron/modules/purge_logs.class.php
+++ b/htdocs/util2/cron/modules/purge_logs.class.php
@@ -29,6 +29,10 @@ class purge_logs
if ($opt['logic']['logs']['purge_userdata'] > 0)
sql("DELETE FROM `logentries` WHERE date_created < NOW() - INTERVAL &1 DAY AND eventid IN (6,7)",
$opt['logic']['logs']['purge_userdata']);
+
+ // Type 5 events = adoptions are still recorded here and preliminary archived,
+ // but may be discarded after verifying that they are not used anywhere.
+ // Adoptions are now in cache_adoptions table.
}
}
diff --git a/htdocs/util2/cron/runcron.php b/htdocs/util2/cron/runcron.php
index 5499ad05..d80947bf 100644
--- a/htdocs/util2/cron/runcron.php
+++ b/htdocs/util2/cron/runcron.php
@@ -11,20 +11,28 @@
*
***************************************************************************/
- $opt['rootpath'] = '../../';
-
- // chdir to proper directory (needed for cronjobs)
- chdir(substr(realpath($_SERVER['PHP_SELF']), 0, strrpos(realpath($_SERVER['PHP_SELF']), '/')));
-
+ $opt['rootpath'] = dirname(__FILE__) . '/../../';
require($opt['rootpath'] . 'lib2/cli.inc.php');
+ // test for user who runs the cronjob
+ $processUser = posix_getpwuid(posix_geteuid());
+ if ($processUser['name'] != $opt['cron']['username'])
+ die("ERROR: runcron must be run by '" . $opt['cron']['username'] . "' but was called by '" . $processUser['name'] . "'\n".
+ "Try something like 'sudo -u ".$opt['cron']['username']." php runcron.php'.\n");
+
// use posix pid-files to lock process
if (!CreatePidFile($opt['cron']['pidfile']))
{
- CleanupAndExit($opt['cron']['pidfile'], "Another instance is running!");
- exit;
+ CleanupAndExit($opt['cron']['pidfile'], "Another instance is running!");
+ exit;
}
+ // Run as system user, if possible.
+ // This is relevant e.g. for publishing and for auto-archiving caches.
+ if ($opt['logic']['systemuser']['user'] != '')
+ if (!$login->system_login($opt['logic']['systemuser']['user']))
+ die("ERROR: runcron system user login failed");
+
$modules_dir = $opt['rootpath'] . 'util2/cron/modules/';
$hDir = opendir($modules_dir);
diff --git a/htdocs/util/publish_caches/.htaccess b/htdocs/util2/geokrety/.htaccess
similarity index 71%
rename from htdocs/util/publish_caches/.htaccess
rename to htdocs/util2/geokrety/.htaccess
index d75c7092..0a83c864 100644
--- a/htdocs/util/publish_caches/.htaccess
+++ b/htdocs/util2/geokrety/.htaccess
@@ -1,4 +1,4 @@
-
+
Order Deny,Allow
Deny from All
diff --git a/htdocs/util2/geokrety/check-waypoints.php b/htdocs/util2/geokrety/check-waypoints.php
new file mode 100644
index 00000000..baa11d94
--- /dev/null
+++ b/htdocs/util2/geokrety/check-waypoints.php
@@ -0,0 +1,63 @@
+2
+ ORDER BY `datemoved` DESC, `id` DESC
+ LIMIT 1",
+ 0, $rItem['id']);
+
+ $rsWp = sql("
+ SELECT `wp` FROM `gk_move_waypoint`
+ LEFT JOIN `gk_move` ON `gk_move`.`id`=`gk_move_waypoint`.`id`
+ WHERE `gk_move`.`id`='&1' AND `logtypeid` IN (0,3)",
+ $lastmove);
+ while ($rWp = sql_fetch_assoc($rsWp))
+ $itemwps[$rItem['id']][$rWp['wp']]['movewp'] = true;
+ sql_free_result($rsWp);
+ }
+ sql_free_result($rsItems);
+
+ // test for missing waypoints
+ ksort($itemwps);
+ foreach ($itemwps as $itemid => $wps)
+ foreach ($wps as $wp => $flags)
+ if (isset($flags['itemwp']) && !isset($flags['movewp']))
+ if (sql_value("SELECT COUNT(*) FROM `gk_move`, `gk_move_waypoint`
+ WHERE `gk_move`.`itemid`='&1'
+ AND `gk_move`.`logtypeid`<>2
+ AND `gk_move_waypoint`.`id`=`gk_move`.`id`
+ AND `gk_move_waypoint`.`wp`='&2'",
+ 0, $itemid, $wp) == 0)
+ echo "item ".$itemid.": ".$wp." is missing in gk_move_waypoint\n";
+ else
+ echo "item ".$itemid.": ".$wp." is not the current wp in gk_move_waypoint\n";
+ else if (isset($flags['movewp']) && !isset($flags['itemwp']))
+ echo "item ".$itemid.": ".$wp." is missing in gk_item_waypoint\n";
+
+?>
diff --git a/htdocs/util2/geokrety/fix-waypoints.php b/htdocs/util2/geokrety/fix-waypoints.php
new file mode 100644
index 00000000..c0ec1e1c
--- /dev/null
+++ b/htdocs/util2/geokrety/fix-waypoints.php
@@ -0,0 +1,50 @@
+2
+ /* TODO: How does Geokrety.org order moves with same date? We assume by ID: */
+ ORDER BY `datemoved` DESC, `id` DESC
+ LIMIT 1",
+ 0, $rItem['id']);
+
+ $rsWp = sql("
+ INSERT INTO `gk_item_waypoint`
+ (SELECT `gk_move`.`itemid`, `gk_move_waypoint`.`wp`
+ FROM `gk_move_waypoint`
+ LEFT JOIN `gk_move` ON `gk_move`.`id`=`gk_move_waypoint`.`id`
+ WHERE `gk_move`.`id`='&1' AND `logtypeid` IN (0,3) AND `wp`<>''
+ )",
+ $lastmove);
+ }
+ sql_free_result($rsItems);
+
+?>
diff --git a/htdocs/util2/license/process-old-disabled-users.php b/htdocs/util2/license/process-old-disabled-users.php
index eb92c677..4254c2a1 100644
--- a/htdocs/util2/license/process-old-disabled-users.php
+++ b/htdocs/util2/license/process-old-disabled-users.php
@@ -12,7 +12,7 @@
***************************************************************************/
$opt['rootpath'] = '../../';
- require_once($opt['rootpath'] . 'lib2/web.inc.php');
+ require_once($opt['rootpath'] . 'lib2/cli.inc.php');
require_once($opt['rootpath'] . 'lib2/logic/user.class.php');
$login->admin = ADMIN_USER;