added oconly notifications; updates #267
and fixed some minor notification bugs
This commit is contained in:
@ -331,6 +331,16 @@
|
||||
ADD INDEX `date` (`cache_id`,`date`,`date_created`)");
|
||||
}
|
||||
|
||||
function dbv_117() // add user profile flag for OConly notifications
|
||||
{
|
||||
if (!sql_field_exists('user','notify_oconly'))
|
||||
{
|
||||
sql("ALTER TABLE `user` ADD COLUMN `notify_oconly` tinyint(1) NOT NULL default '1' AFTER `notify_radius`");
|
||||
sql("UPDATE `user` SET `notify_oconly`=0");
|
||||
// is default-enabled for new users but default-disabled for old users
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// When adding new mutations, take care that they behave well if run multiple
|
||||
// times. This improves robustness of database versioning.
|
||||
|
@ -1433,7 +1433,7 @@ INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('558', 'Don\'t u
|
||||
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('559', 'Don\'t log me out after 15 minutes inaktivity.', '2010-08-28 11:48:04');
|
||||
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('560', 'I\'m taking an PMR walkie talkie on channel 2 with me.', '2010-08-28 11:48:04');
|
||||
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('561', 'Others:', '2010-08-28 11:48:04');
|
||||
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('562', 'Notification about new Geocaches is not activated.', '2010-08-28 11:48:04');
|
||||
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('562', 'Do not notify about new Geocaches.', '2010-08-28 11:48:04');
|
||||
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('563', 'Notify about new Geocaches in a radius of %1 km.', '2010-08-28 11:48:04');
|
||||
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('564', 'Notifications:', '2010-08-28 11:48:04');
|
||||
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('565', 'Home coordinates:', '2010-08-28 11:48:04');
|
||||
@ -1524,7 +1524,7 @@ INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('651', '#timetit
|
||||
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('652', 'Sent day:', '2010-08-28 11:48:04');
|
||||
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('653', 'Sent time and day is only used with daily or weekly delivery.', '2010-08-28 11:48:04');
|
||||
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('654', 'Error while trying to save!', '2010-08-28 11:48:04');
|
||||
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('655', 'Settings stored successfull.', '2010-08-28 11:48:04');
|
||||
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('655', 'Settings have been stored.', '2010-08-28 11:48:04');
|
||||
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('656', 'Watched Geocaches', '2010-08-28 11:48:04');
|
||||
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('657', 'Last found', '2010-08-28 11:48:04');
|
||||
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('658', 'No Geocaches watched.', '2010-08-28 11:48:04');
|
||||
@ -2538,6 +2538,9 @@ INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2112', 'Opencac
|
||||
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2113', 'New Wiki articles', '2010-09-07 20:19:07');
|
||||
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2114', 'Cardinal direction', '2010-09-07 20:19:07');
|
||||
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2115', 'New features', '2010-09-07 20:19:07');
|
||||
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2116', 'Also notify about newly marked %1OConly%2 caches.', '2010-09-07 20:19:07');
|
||||
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2117', 'Do not notify about newly marked %1OConly%2 caches.', '2010-09-07 20:19:07');
|
||||
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2118', 'Notify about newly marked %1OConly%2 caches.', '2010-09-07 20:19:07');
|
||||
|
||||
-- Table sys_trans_ref
|
||||
SET NAMES 'utf8';
|
||||
@ -5016,7 +5019,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 ('147', 'DE', 'Benutzerprofil von %1', '2010-08-28 11:48:06');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('148', 'DE', 'E-Mail senden', '2010-08-28 11:48:06');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('149', 'DE', 'Sonstiges', '2010-08-28 11:48:06');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('150', 'DE', 'Ich nehme ein PMR-Funkgerät auf Kanal 2 mit zum Geocaching', '2010-08-28 11:48:06');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('150', 'DE', 'Ich nehme ein PMR-Funkgerät auf Kanal 2 mit zum Geocaching.', '2010-08-28 11:48:06');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('151', 'DE', 'Registriert\ seit', '2010-08-28 11:48:06');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('152', 'DE', 'Versteckte Geocaches', '2010-08-28 11:48:06');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('153', 'DE', 'Gefundene Geocaches', '2010-08-28 11:48:06');
|
||||
@ -5412,12 +5415,12 @@ INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUE
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('554', 'DE', 'Folgende Einstellungen sind für dein Statistikbild gespeichert:', '2010-08-28 11:48:06');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('555', 'DE', 'Logeinträge anzeigen', '2010-08-28 11:48:06');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('556', 'DE', 'Statistikbild', '2010-08-28 11:48:06');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('558', 'DE', 'Als Vorgabe kein HTML-Editor verwenden.', '2010-08-28 11:48:06');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('558', 'DE', 'Als Vorgabe keinen HTML-Editor verwenden.', '2010-08-28 11:48:06');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('559', 'DE', 'Der automatische Logout 15 Minuten nach Verlassen der Webseite ist deaktiviert.', '2010-08-28 11:48:06');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('560', 'DE', 'Ich nehme ein PMR-Funkgerät auf Kanal 2 mit zum Cachen', '2010-08-28 11:48:06');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('560', 'DE', 'Ich nehme ein PMR-Funkgerät auf Kanal 2 mit zum Cachen.', '2010-08-28 11:48:06');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('561', 'DE', 'Sonstiges:', '2010-08-28 11:48:06');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('562', 'DE', 'Benachrichtigung über neue Caches ist deaktiviert.', '2010-08-28 11:48:06');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('563', 'DE', 'Benachrichtigung über neue Caches im Umkreis von %1 km.', '2010-08-28 11:48:06');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('562', 'DE', 'nicht über neue Caches benachrichtigen', '2010-08-28 11:48:06');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('563', 'DE', 'über neue Caches im Umkreis von %1 km benachrichtigen', '2010-08-28 11:48:06');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('564', 'DE', 'Benachrichtigung:', '2010-08-28 11:48:06');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('565', 'DE', 'Koordinaten:', '2010-08-28 11:48:06');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('566', 'DE', 'Land:', '2010-08-28 11:48:06');
|
||||
@ -5507,7 +5510,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 ('652', 'DE', 'Versenden am:', '2010-08-28 11:48:06');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('653', 'DE', 'Versandstunde und -tag werden nur bei täglichem/wöchentlichem Versand berücksichtigt.', '2010-08-28 11:48:06');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('654', 'DE', 'Fehler beim Speichern!', '2010-08-28 11:48:06');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('655', 'DE', 'Die Einstellungen wurden erfolgreich gespeichert.', '2010-08-28 11:48:06');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('655', 'DE', 'Die Einstellungen wurden gespeichert.', '2010-08-28 11:48:06');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('656', 'DE', 'Beobachtete Geocaches', '2010-08-28 11:48:06');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('657', 'DE', 'zuletzt gefunden', '2010-08-28 11:48:06');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('658', 'DE', 'Keine beobachteten Geocaches gefunden.', '2010-08-28 11:48:06');
|
||||
@ -6521,6 +6524,9 @@ INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUE
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2113', 'DE', 'Neue Wiki-Artikel', '2010-09-10 23:33:33');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2114', 'DE', 'Himmelsrichtung', '2010-09-10 23:33:33');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2115', 'DE', 'Neue Features', '2010-09-10 23:33:33');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2116', 'DE', 'auch über neu markierte %1OConly%2-Caches benachrichtigen', '2010-09-10 23:33:33');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2117', 'DE', 'nicht über neu markierte %1OConly%2-Caches benachrichtigen', '2010-09-10 23:33:33');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2118', 'DE', 'über neu markierte %1OConly%2-Caches benachrichtigen', '2010-09-10 23:33:33');
|
||||
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');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('4', 'EN', 'User', '2010-08-28 11:48:07');
|
||||
@ -6654,7 +6660,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 ('147', 'EN', 'User profile of %1', '2010-08-28 11:48:07');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('148', 'EN', 'Send e-mail', '2010-08-28 11:48:07');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('149', 'EN', 'Others', '2010-08-28 11:48:07');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('150', 'EN', 'I\'m taking a PMR walkie-talkie on channel 2 with me', '2010-08-28 11:48:07');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('150', 'EN', 'I\'m taking a PMR walkie-talkie on channel 2 with me.', '2010-08-28 11:48:07');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('151', 'EN', 'Registered\ since', '2010-08-28 11:48:07');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('152', 'EN', 'Caches hidden', '2010-08-28 11:48:07');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('153', 'EN', 'Caches found', '2010-08-28 11:48:07');
|
||||
@ -8222,7 +8228,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 ('147', 'ES', 'Perfil de usuario de %1', '2010-12-09 00:17:56');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('148', 'ES', 'Enviar email', '2010-12-09 00:17:56');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('149', 'ES', 'Otros', '2010-12-09 00:17:56');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('150', 'ES', 'Voy a tener una radio PMR en el canal 2 conmigo', '2010-12-09 00:17:56');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('150', 'ES', 'Voy a tener una radio PMR en el canal 2 conmigo.', '2010-12-09 00:17:56');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('151', 'ES', 'Registrado\ desde', '2010-12-09 00:17:56');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('152', 'ES', 'Caches Escondidos', '2010-12-09 00:17:56');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('153', 'ES', 'Caches Encontrados', '2010-12-09 00:17:56');
|
||||
@ -8712,7 +8718,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 ('652', 'ES', 'Enviar a:', '2010-12-09 00:17:57');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('653', 'ES', 'tiempo de envío y de día sólo se utilizará para la entrega diaria o semanal.', '2010-12-09 00:17:57');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('654', 'ES', '¡Error al guardar!', '2010-12-09 00:17:57');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('655', 'ES', 'Los ajustes se han guardado correctamente.', '2010-12-09 00:17:57');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('655', 'ES', 'Los ajustes se han guardado.', '2010-12-09 00:17:57');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('656', 'ES', 'Geocache observado', '2010-12-09 00:17:57');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('657', 'ES', 'Últimos encontrados', '2010-12-09 00:17:57');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('658', 'ES', 'Geocaches no observados', '2010-12-09 00:17:57');
|
||||
@ -10266,7 +10272,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 ('652', 'IT', 'Inviata il:', '2010-08-31 20:06:23');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('653', 'IT', 'Ora e giorno di spedizione possono essere specificati solo per invii giornalieri o settimanali.', '2010-09-01 23:49:03');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('654', 'IT', 'Errore nel salvataggio delle impostazioni!', '2010-08-31 20:06:23');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('655', 'IT', 'Impostazioni salvate con successo.', '2010-09-01 23:49:03');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('655', 'IT', 'Impostazioni salvate', '2010-09-01 23:49:03');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('656', 'IT', 'Geocache osservate', '2010-08-31 20:06:23');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('657', 'IT', 'Ultima trovata', '2010-09-01 23:49:03');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('658', 'IT', 'Nessuna geocache osservata.', '2010-08-31 20:06:23');
|
||||
|
@ -513,17 +513,20 @@
|
||||
|
||||
// notify users with matching watch radius about this cache
|
||||
sql_dropProcedure('sp_notify_new_cache');
|
||||
sql("CREATE PROCEDURE sp_notify_new_cache (IN nCacheId INT(10) UNSIGNED, IN nLongitude DOUBLE, IN nLatitude DOUBLE)
|
||||
sql("CREATE PROCEDURE sp_notify_new_cache (IN nCacheId INT(10) UNSIGNED, IN nLongitude DOUBLE, IN nLatitude DOUBLE, IN nType INT(1))
|
||||
BEGIN
|
||||
INSERT IGNORE INTO `notify_waiting` (`id`, `cache_id`, `user_id`, `type`)
|
||||
SELECT NULL, nCacheId, `user`.`user_id`, 1 /* notify_new_cache */
|
||||
FROM `user`
|
||||
/* Throttle email sending after undeliverable mails. See also runwatch.php. */
|
||||
WHERE (`email_problems` = 0 OR DATEDIFF(NOW(),`last_email_problem`) > 1+DATEDIFF(`last_email_problem`,`first_email_problem`))
|
||||
AND NOT ISNULL(`user`.`latitude`)
|
||||
AND NOT ISNULL(`user`.`longitude`)
|
||||
AND `user`.`notify_radius`>0
|
||||
AND (acos(cos((90-nLatitude) * 3.14159 / 180) * cos((90-`user`.`latitude`) * 3.14159 / 180) + sin((90-nLatitude) * 3.14159 / 180) * sin((90-`user`.`latitude`) * 3.14159 / 180) * cos((nLongitude-`user`.`longitude`) * 3.14159 / 180)) * 6370) <= `user`.`notify_radius`;
|
||||
/* type 1 = new cache, 2 = new OConly attribute */
|
||||
IF (nType=1 OR
|
||||
(nType=2 AND (SELECT `notify_oconly` FROM `user`,`caches` WHERE `user`.`user_id`=`caches`.`user_id` AND `caches`.`cache_id`=nCacheId))) THEN
|
||||
INSERT IGNORE INTO `notify_waiting` (`cache_id`, `user_id`, `type`)
|
||||
SELECT nCacheId, `user`.`user_id`, nType /* notify_new_cache */
|
||||
FROM `user`
|
||||
/* Throttle email sending after undeliverable mails. See also runwatch.php. */
|
||||
WHERE (`email_problems` = 0 OR DATEDIFF(NOW(),`last_email_problem`) > 1+DATEDIFF(`last_email_problem`,`first_email_problem`))
|
||||
AND `user`.`latitude`+`user`.`longitude` <> 0
|
||||
AND `user`.`notify_radius`>0
|
||||
AND (acos(cos((90-nLatitude) * 3.14159 / 180) * cos((90-`user`.`latitude`) * 3.14159 / 180) + sin((90-nLatitude) * 3.14159 / 180) * sin((90-`user`.`latitude`) * 3.14159 / 180) * cos((nLongitude-`user`.`longitude`) * 3.14159 / 180)) * 6370) <= `user`.`notify_radius`;
|
||||
END IF;
|
||||
END;");
|
||||
|
||||
// recreate the user statpic on next request
|
||||
@ -619,7 +622,7 @@
|
||||
CALL sp_update_hiddenstat(NEW.`user_id`, NEW.`status`, FALSE);
|
||||
|
||||
IF NEW.`status`=1 THEN
|
||||
CALL sp_notify_new_cache(NEW.`cache_id`, NEW.`longitude`, NEW.`latitude`);
|
||||
CALL sp_notify_new_cache(NEW.`cache_id`, NEW.`longitude`, NEW.`latitude`, 1);
|
||||
END IF;
|
||||
|
||||
/* cleanup/delete reserved waypoint */
|
||||
@ -724,7 +727,7 @@
|
||||
CALL sp_update_hiddenstat(NEW.`user_id`, NEW.`status`, FALSE);
|
||||
END IF;
|
||||
IF OLD.`status`=5 AND NEW.`status`=1 THEN
|
||||
CALL sp_notify_new_cache(NEW.`cache_id`, NEW.`longitude`, NEW.`latitude`);
|
||||
CALL sp_notify_new_cache(NEW.`cache_id`, NEW.`longitude`, NEW.`latitude`, 1);
|
||||
END IF;
|
||||
IF NEW.`status`<>OLD.`status` THEN
|
||||
INSERT INTO `cache_status_modified` (`cache_id`, `date_modified`, `old_state`, `new_state`, `user_id`) VALUES (NEW.`cache_id`, NOW(), OLD.`status`, NEW.`status`, IFNULL(@STATUS_CHANGE_USER_ID,0));
|
||||
@ -1270,6 +1273,7 @@
|
||||
NEW.`node`!=OLD.`node` OR
|
||||
NEW.`date_created`!=OLD.`date_created` OR
|
||||
NEW.`username`!=OLD.`username` OR
|
||||
NEW.`country`!=OLD.`country` OR
|
||||
NEW.`pmr_flag`!=OLD.`pmr_flag` OR
|
||||
NEW.`description`!=OLD.`description` THEN
|
||||
|
||||
@ -1387,6 +1391,13 @@
|
||||
(SELECT `date_created` FROM `caches` WHERE `cache_id`=NEW.`cache_id`) < LEFT(NOW(),10) THEN
|
||||
INSERT IGNORE INTO `caches_attributes_modified` (`cache_id`, `attrib_id`, `date_modified`, `was_set`, `restored_by`) VALUES (NEW.`cache_id`, NEW.`attrib_id`, NOW(), 0, IFNULL(@restoredby,0));
|
||||
END IF;
|
||||
IF (NEW.`attrib_id`=6 AND (SELECT `status` FROM `caches` WHERE `caches`.`cache_id`=NEW.`cache_id`) <= 2) THEN
|
||||
CALL sp_notify_new_cache(
|
||||
NEW.`cache_id`,
|
||||
(SELECT `longitude` FROM `caches` WHERE `caches`.`cache_id`=NEW.`cache_id`),
|
||||
(SELECT `latitude` FROM `caches` WHERE `caches`.`cache_id`=NEW.`cache_id`),
|
||||
2);
|
||||
END IF;
|
||||
END;");
|
||||
|
||||
sql_dropTrigger('cacheAttributesAfterUpdate');
|
||||
@ -1401,7 +1412,15 @@
|
||||
CALL sp_update_cache_listingdate(OLD.`cache_id`);
|
||||
END IF;
|
||||
END IF;
|
||||
/* is not called, otherweise cache_attributes_modified would have to be updated */
|
||||
IF (NEW.`attrib_id`=6 AND OLD.`attrib_id`<>6 AND (SELECT `status` FROM `caches` WHERE `caches`.`cache_id`=NEW.`cache_id`) <= 2) THEN
|
||||
CALL sp_notify_new_cache(
|
||||
NEW.`cache_id`,
|
||||
(SELECT `longitude` FROM `caches` WHERE `caches`.`cache_id`=NEW.`cache_id`),
|
||||
(SELECT `latitude` FROM `caches` WHERE `caches`.`cache_id`=NEW.`cache_id`),
|
||||
2);
|
||||
END IF;
|
||||
/* is not called, otherweise cache_attributes_modified would have to be updated,
|
||||
which would need an extension to restorecaches.php */
|
||||
END;");
|
||||
|
||||
sql_dropTrigger('cacheAttributesAfterDelete');
|
||||
|
@ -36,6 +36,7 @@ CREATE TABLE `user` (
|
||||
`statpic_text` varchar(30) NOT NULL default 'Opencaching',
|
||||
`no_htmledit_flag` tinyint(1) NOT NULL default '0',
|
||||
`notify_radius` int(10) unsigned NOT NULL default '0',
|
||||
`notify_oconly` tinyint(1) NOT NULL default '1',
|
||||
`admin` tinyint(3) unsigned NOT NULL default '0',
|
||||
`data_license` tinyint(1) NOT NULL default '0',
|
||||
`description` mediumtext NOT NULL,
|
||||
|
@ -28,6 +28,7 @@
|
||||
|
||||
// for notifications
|
||||
define('notify_new_cache', 1);
|
||||
define('notify_new_oconly', 2);
|
||||
|
||||
// for ratings
|
||||
define('rating_percentage', 10); // percentage of found caches to be rated
|
||||
|
@ -4,7 +4,8 @@
|
||||
|
||||
Unicode Reminder メモ
|
||||
|
||||
synchronization of processes which must not run concurrently
|
||||
synchronization of processes which must not run concurrently;
|
||||
also used in lib1
|
||||
|
||||
****************************************************************************/
|
||||
|
||||
|
@ -77,6 +77,7 @@ class user
|
||||
$this->reUser->addString('activation_code', '', false);
|
||||
$this->reUser->addBoolean('no_htmledit_flag', false, false);
|
||||
$this->reUser->addInt('notify_radius', 0, false);
|
||||
$this->reUser->addInt('notify_oconly', 1, false);
|
||||
$this->reUser->addInt('admin', 0, false);
|
||||
$this->reUser->addInt('data_license', $opt['logic']['license']['newusers'], false);
|
||||
$this->reUser->addInt('node', 0, false);
|
||||
@ -242,6 +243,14 @@ class user
|
||||
return false;
|
||||
return $this->reUser->setValue('notify_radius', $value+0);
|
||||
}
|
||||
function getNotifyOconly()
|
||||
{
|
||||
return $this->reUser->getValue('notify_oconly') != 0;
|
||||
}
|
||||
function setNotifyOconly($value)
|
||||
{
|
||||
return $this->reUser->setValue('notify_oconly', $value ? 1 : 0);
|
||||
}
|
||||
function getPermanentLogin()
|
||||
{
|
||||
return $this->reUser->getValue('permanent_login_flag');
|
||||
|
@ -91,14 +91,26 @@ function change()
|
||||
|
||||
if (isset($_REQUEST['notifyRadius']))
|
||||
{
|
||||
$tpl->assign('notifyRadius', $_REQUEST['notifyRadius']);
|
||||
if (!$user->setNotifyRadius($_REQUEST['notifyRadius']))
|
||||
$tpl->assign('notifyRadius', $_REQUEST['notifyRadius']+0);
|
||||
if (!$user->setNotifyRadius($_REQUEST['notifyRadius']+0))
|
||||
{
|
||||
$tpl->assign('notifyRadiusError', true);
|
||||
$bError = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_REQUEST['notifyOconly']))
|
||||
{
|
||||
$tpl->assign('notifyOconly', $_REQUEST['notifyOconly']+0);
|
||||
$user->setNotifyOconly($_REQUEST['notifyOconly'] != 0);
|
||||
}
|
||||
else if (isset($_REQUEST['save']))
|
||||
$user->setNotifyOconly(false);
|
||||
|
||||
$oconly_helplink = helppagelink('oconly');
|
||||
$tpl->assign('oconly_helpstart', $oconly_helplink);
|
||||
$tpl->assign('oconly_helpend', $oconly_helplink != '' ? '</a>' : '');
|
||||
|
||||
$coord['lat'] = coordinate::parseRequestLat('coord');
|
||||
$coord['lon'] = coordinate::parseRequestLon('coord');
|
||||
if (($coord['lat'] !== false) && ($coord['lon'] !== false))
|
||||
@ -193,6 +205,12 @@ function assignFromUser($user)
|
||||
$tpl->assign('coordsDecimal', $coords->getFloat());
|
||||
|
||||
$tpl->assign('notifyRadius', $user->getNotifyRadius());
|
||||
|
||||
$tpl->assign('notifyOconly', $user->getNotifyOconly());
|
||||
$oconly_helplink = helppagelink('oconly');
|
||||
$tpl->assign('oconly_helpstart', $oconly_helplink);
|
||||
$tpl->assign('oconly_helpend', $oconly_helplink != '' ? '</a>' : '');
|
||||
|
||||
$tpl->assign('registeredSince', $user->getDateRegistered());
|
||||
|
||||
$tpl->assign('usePMR', $user->getUsePMR());
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
require('./lib2/web.inc.php');
|
||||
require_once('./lib2/logic/user.class.php');
|
||||
|
||||
$tpl->name = 'mywatches';
|
||||
$tpl->menuitem = MNU_MYPROFILE_WATCHES;
|
||||
|
||||
@ -46,8 +47,12 @@
|
||||
$tpl->assign('error', true);
|
||||
}
|
||||
|
||||
$hours = array(); for ($i = 0; $i < 24; $i++) $hours[] = array('value' => $i, 'time' => mktime($i, 0 , 0));
|
||||
$weekdays = array(); for ($i = 1; $i <= 7; $i++) $weekdays[] = array('value' => $i, 'time' => mktime(0, 0, 0, 0, $i+5, 2000));
|
||||
$hours = array();
|
||||
for ($i = 0; $i < 24; $i++)
|
||||
$hours[] = array('value' => $i, 'time' => mktime($i, 0 , 0));
|
||||
$weekdays = array();
|
||||
for ($i = 1; $i <= 7; $i++)
|
||||
$weekdays[] = array('value' => $i, 'time' => mktime(0, 0, 0, 0, $i+5, 2000));
|
||||
|
||||
$tpl->assign('hours', $hours);
|
||||
$tpl->assign('weekdays', $weekdays);
|
||||
@ -75,11 +80,31 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
$rs = sql("SELECT `cache_watches`.`cache_id` AS `cacheid`, `caches`.`wp_oc` AS `wp`, `caches`.`name` AS `name`, `stat_caches`.`last_found` AS `lastfound`, `caches`.`type` AS `type`, `caches`.`status` AS `status`, `ca`.`attrib_id` IS NOT NULL AS `oconly` FROM `cache_watches` INNER JOIN `caches` ON `cache_watches`.`cache_id`=`caches`.`cache_id` INNER JOIN `cache_status` ON `caches`.`status`=`cache_status`.`id` LEFT JOIN `stat_caches` ON `caches`.`cache_id`=`stat_caches`.`cache_id` LEFT JOIN `caches_attributes` `ca` ON `ca`.`cache_id`=`caches`.`cache_id` AND `ca`.`attrib_id`=6 WHERE (`cache_status`.`allow_user_view`=1 OR `caches`.`user_id`='&1') AND `cache_watches`.`user_id`='&1' ORDER BY `caches`.`name`", $login->userid);
|
||||
$rs = sql("
|
||||
SELECT
|
||||
`cache_watches`.`cache_id` AS `cacheid`,
|
||||
`caches`.`wp_oc` AS `wp`,
|
||||
`caches`.`name` AS `name`,
|
||||
`stat_caches`.`last_found` AS `lastfound`,
|
||||
`caches`.`type` AS `type`,
|
||||
`caches`.`status` AS `status`,
|
||||
`ca`.`attrib_id` IS NOT NULL AS `oconly`
|
||||
FROM
|
||||
`cache_watches`
|
||||
INNER JOIN `caches` ON `cache_watches`.`cache_id`=`caches`.`cache_id`
|
||||
INNER JOIN `cache_status` ON `caches`.`status`=`cache_status`.`id`
|
||||
LEFT JOIN `stat_caches` ON `caches`.`cache_id`=`stat_caches`.`cache_id`
|
||||
LEFT JOIN `caches_attributes` `ca` ON `ca`.`cache_id`=`caches`.`cache_id` AND `ca`.`attrib_id`=6
|
||||
WHERE (`cache_status`.`allow_user_view`=1 OR `caches`.`user_id`='&1')
|
||||
AND `cache_watches`.`user_id`='&1'
|
||||
ORDER BY `caches`.`name`",
|
||||
$login->userid);
|
||||
|
||||
$tpl->assign_rs('watches', $rs);
|
||||
sql_free_result($rs);
|
||||
}
|
||||
|
||||
$tpl->assign('action', $action);
|
||||
$tpl->display();
|
||||
|
||||
?>
|
||||
|
@ -117,17 +117,27 @@
|
||||
{if $notifyRadiusError==true}
|
||||
<span class="errormsg">{t}The entered radius is not valid.{/t}</span>
|
||||
{/if}
|
||||
<br />
|
||||
<input type="checkbox" name="notifyOconly" value="1" class="checkbox" {if $notifyOconly}checked="checked"{/if} id="notifyOconly" />
|
||||
<label for="notifyOconly">{t 1=$oconly_helpstart 2=$oconly_helpend}Also notify about newly marked %1OConly%2 caches.{/t}</label>
|
||||
{else}
|
||||
{if $notifyRadius>0}
|
||||
{t 1=$notifyRadius|escape}Notify about new Geocaches in a radius of %1 km.{/t}
|
||||
<br />
|
||||
{if $notifyOconly}
|
||||
{t 1=$oconly_helpstart 2=$oconly_helpend}Notify about newly marked %1OConly%2 caches.{/t}
|
||||
{else}
|
||||
{t 1=$oconly_helpstart 2=$oconly_helpend}Do not notify about newly marked %1OConly%2 caches.{/t}
|
||||
{/if}
|
||||
{else}
|
||||
{t}Notification about new Geocaches is not activated.{/t}
|
||||
{t}Do not notify about new Geocaches.{/t}
|
||||
{/if}
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td class="spacer" colspan="2"></td></tr>
|
||||
|
||||
{if $edit || $usePMR || $permanentLogin || $noHTMLEditor}
|
||||
<tr>
|
||||
<td valign="top">{t}Others:{/t}</td>
|
||||
<td valign="top">
|
||||
@ -137,7 +147,7 @@
|
||||
<br />
|
||||
{else}
|
||||
{if $usePMR==true}
|
||||
<li>{t}I'm taking an PMR walkie talkie on channel 2 with me.{/t}</li>
|
||||
<span class="public-setting">{t}I'm taking an PMR walkie talkie on channel 2 with me.{/t}</span><br />
|
||||
{/if}
|
||||
{/if}
|
||||
{if $edit==true}
|
||||
@ -150,7 +160,7 @@
|
||||
</div>
|
||||
{else}
|
||||
{if $permanentLogin==true}
|
||||
<li>{t}Don't log me out after 15 minutes inaktivity.{/t}</li>
|
||||
{t}Don't log me out after 15 minutes inaktivity.{/t}<br /">
|
||||
{/if}
|
||||
{/if}
|
||||
{if $edit==true}
|
||||
@ -158,13 +168,14 @@
|
||||
<label for="l_no_htmledit">{t}Don't use an HTML editor by default.{/t}</label>
|
||||
<br />
|
||||
{else}
|
||||
{if $useHTMLEditor==true}
|
||||
<li>{t}Don't use an HTML editor by default.{/t}</li>
|
||||
{if $noHTMLEditor}
|
||||
{t}Don't use an HTML editor by default.{/t}
|
||||
{/if}
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td class="spacer" colspan="2"></td></tr>
|
||||
{/if}
|
||||
|
||||
<tr>
|
||||
<td class="public-setting">{t}Registered since{/t}:</td>
|
||||
|
@ -87,7 +87,7 @@
|
||||
{if $error==true}
|
||||
<tr><td colspan="2" class="errormsg">{t}Error while trying to save!{/t}</td></tr>
|
||||
{elseif $saved==true}
|
||||
<tr><td colspan="2" class="successmsg">{t}Settings stored successfull.{/t}</td></tr>
|
||||
<tr><td colspan="2" class="okmsg">{t}Settings have been stored.{/t}</td></tr>
|
||||
{/if}
|
||||
<tr><td class="spacer" colspan="2"></td></tr>
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
Hallo {username},
|
||||
|
||||
soeben wurde in deinem Suchradius ein neuer Cache gemeldet:
|
||||
soeben wurde in deinem Suchradius ein neuer {oconly}Cache gemeldet:
|
||||
---
|
||||
{user} hat am {date} den Cache "{cachename}" versteckt.
|
||||
Entfernung: {distance} {unit} Richtung {bearing}
|
||||
|
24
htdocs/util/notification/notify_newoconly.email
Normal file
24
htdocs/util/notification/notify_newoconly.email
Normal file
@ -0,0 +1,24 @@
|
||||
Hallo {username},
|
||||
|
||||
in deinem Suchradius gibt es einen neuen OConly-Cache:
|
||||
---
|
||||
{user} hat am {date} den Cache "{cachename}" als OConly markiert.
|
||||
Entfernung: {distance} {unit} Richtung {bearing}
|
||||
Typ: {cachetype}
|
||||
Größe: {cachesize}
|
||||
|
||||
Link: http://opencaching.de/{wp_oc}
|
||||
---
|
||||
|
||||
|
||||
Die Einstellungen für deinen Suchradius und die OConly-Benachrichtigungen
|
||||
kannst du unter http://www.opencaching.de/myprofile.php ansehen und bearbeiten.
|
||||
|
||||
Happy Geocaching,
|
||||
das Opencaching.de-Team
|
||||
|
||||
---
|
||||
Diese E-Mail wurde automatisch generiert - bitte nicht antworten. Falls du
|
||||
Kontakt mit Opencaching.de aufnehmen möchtest, kannst unter
|
||||
http://www.opencaching.de/articles.php?page=contact alle Möglichkeiten
|
||||
nachlesen.
|
@ -1,101 +1,93 @@
|
||||
#!/usr/local/bin/php -q
|
||||
<?php
|
||||
/***************************************************************************
|
||||
./util/notification/run_notify.php
|
||||
-------------------
|
||||
begin : August 25 2006
|
||||
|
||||
For license information see doc/license.txt
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
Unicode Reminder メモ
|
||||
|
||||
Ggf. muss die Location des php-Binaries angepasst werden.
|
||||
|
||||
Arbeitet die Tabelle `notify_waiting` ab und verschickt
|
||||
Benachrichtigungsmails ueber neue Caches.
|
||||
|
||||
Processes the `notify_waiting` table and sends notification mails
|
||||
on new caches and new OConly attributes.
|
||||
***************************************************************************/
|
||||
|
||||
// needs absolute rootpath because called as cronjob
|
||||
$rootpath = dirname(__FILE__) . '/../../';
|
||||
|
||||
// chdir to proper directory (needed for cronjobs)
|
||||
chdir(substr(realpath($_SERVER['PHP_SELF']), 0, strrpos(realpath($_SERVER['PHP_SELF']), '/')));
|
||||
|
||||
require_once($rootpath . 'lib/clicompatbase.inc.php');
|
||||
require_once('settings.inc.php');
|
||||
require_once($rootpath . 'lib/consts.inc.php');
|
||||
require_once($rootpath . 'lib2/ProcessSync.class.php');
|
||||
|
||||
// use posix pid-files to lock process
|
||||
if (!CreatePidFile($notifypid))
|
||||
{
|
||||
CleanupAndExit($notifypid, "Another instance is running!");
|
||||
exit;
|
||||
}
|
||||
|
||||
/* begin with some constants */
|
||||
|
||||
$sDateformat = 'Y-m-d H:i:s';
|
||||
|
||||
/* end with some constants */
|
||||
|
||||
/* begin db connect */
|
||||
// db connect
|
||||
db_connect();
|
||||
if ($dblink === false)
|
||||
{
|
||||
echo 'Unable to connect to database';
|
||||
exit;
|
||||
}
|
||||
/* end db connect */
|
||||
|
||||
$rsNotify = sql(" SELECT `notify_waiting`.`id`, `notify_waiting`.`cache_id`, `notify_waiting`.`type`,
|
||||
`user`.`username`,
|
||||
`user2`.`email`, `user2`.`username` as `recpname`, `user2`.`latitude` as `lat1`, `user2`.`longitude` as `lon1`, `user2`.`user_id` as `recid`,
|
||||
`caches`.`name` as `cachename`, `caches`.`date_hidden`, `caches`.`latitude` as `lat2`, `caches`.`longitude` as `lon2`, `caches`.`wp_oc`,
|
||||
`cache_type`.`de` as `cachetype`,
|
||||
`cache_size`.`de` as `cachesize`
|
||||
FROM `notify_waiting`, `caches`, `user`, `user` `user2`, `cache_type`, `cache_size`, `cache_status`
|
||||
WHERE `notify_waiting`.`cache_id`=`caches`.`cache_id`
|
||||
AND `notify_waiting`.`user_id`=`user2`.`user_id`
|
||||
AND `caches`.`user_id`=`user`.`user_id`
|
||||
AND `caches`.`type`=`cache_type`.`id`
|
||||
AND `caches`.`status`=`cache_status`.`id`
|
||||
AND `caches`.`size`=`cache_size`.`id`
|
||||
AND `cache_status`.`allow_user_view`=1");
|
||||
$process_sync = new ProcessSync('run_notify');
|
||||
if ($process_sync->Enter())
|
||||
{
|
||||
// send out everything that has to be sent
|
||||
$rsNotify = sql("
|
||||
SELECT
|
||||
`notify_waiting`.`id`, `notify_waiting`.`cache_id`, `notify_waiting`.`type`,
|
||||
`user`.`username`,
|
||||
`user2`.`email`, `user2`.`username` as `recpname`, `user2`.`latitude` as `lat1`, `user2`.`longitude` as `lon1`, `user2`.`user_id` as `recid`,
|
||||
`caches`.`name` as `cachename`, `caches`.`date_hidden`, `caches`.`latitude` as `lat2`, `caches`.`longitude` as `lon2`, `caches`.`wp_oc`,
|
||||
`cache_type`.`de` as `cachetype`,
|
||||
`cache_size`.`de` as `cachesize`,
|
||||
`cache_status`.`allow_user_view`,
|
||||
`ca`.`attrib_id` IS NOT NULL AS `oconly`
|
||||
FROM `notify_waiting`
|
||||
INNER JOIN `caches` ON `notify_waiting`.`cache_id`=`caches`.`cache_id`
|
||||
INNER JOIN `user` ON `caches`.`user_id`=`user`.`user_id`
|
||||
INNER JOIN `user` `user2` ON `notify_waiting`.`user_id`=`user2`.`user_id`
|
||||
INNER JOIN `cache_type` ON `caches`.`type`=`cache_type`.`id`
|
||||
INNER JOIN `cache_size` ON `caches`.`size`=`cache_size`.`id`
|
||||
INNER JOIN `cache_status` ON `caches`.`status`=`cache_status`.`id`
|
||||
LEFT JOIN `caches_attributes` `ca` ON `ca`.`cache_id`=`caches`.`cache_id` AND `ca`.`attrib_id`=6");
|
||||
|
||||
while($rNotify = sql_fetch_array($rsNotify))
|
||||
{
|
||||
sql("DELETE FROM `notify_waiting` WHERE `id` ='&1'", $rNotify['id']);
|
||||
process_new_cache($rNotify);
|
||||
}
|
||||
mysql_free_result($rsNotify);
|
||||
while ($rNotify = sql_fetch_array($rsNotify))
|
||||
{
|
||||
if ($rNotify['allow_user_view'])
|
||||
process_new_cache($rNotify);
|
||||
sql("DELETE FROM `notify_waiting` WHERE `id` ='&1'", $rNotify['id']);
|
||||
}
|
||||
mysql_free_result($rsNotify);
|
||||
|
||||
$process_sync->Leave();
|
||||
}
|
||||
|
||||
CleanupAndExit($notifypid);
|
||||
|
||||
/* end send out everything that has to be sent */
|
||||
|
||||
function process_new_cache($notify)
|
||||
{
|
||||
global $notify_text, $mailfrom, $mailsubject, $debug, $debug_mailto, $rootpath;
|
||||
global $debug, $debug_mailto, $rootpath;
|
||||
global $mailfrom, $new_cache_subject, $new_oconly_subject;
|
||||
|
||||
//echo "process_new_cache(".$notify['id'].")\n";
|
||||
$fehler = false;
|
||||
$error = false;
|
||||
|
||||
// mail-template lesen
|
||||
switch($notify['type'])
|
||||
switch ($notify['type'])
|
||||
{
|
||||
case notify_new_cache: // Type: new cache
|
||||
$mailbody = read_file($rootpath . 'util/notification/notify_newcache.email');
|
||||
$mailsubject = $new_cache_subject;
|
||||
break;
|
||||
|
||||
case notify_new_oconly: // Type: new OConly flag
|
||||
$mailbody = read_file($rootpath . 'util/notification/notify_newoconly.email');
|
||||
$mailsubject = $new_oconly_subject;
|
||||
break;
|
||||
|
||||
default:
|
||||
$fehler = true;
|
||||
$error = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if(!$fehler)
|
||||
if (!$error)
|
||||
{
|
||||
$mailbody = mb_ereg_replace('{username}', $notify['recpname'], $mailbody);
|
||||
$mailbody = mb_ereg_replace('{date}', date('d.m.Y', strtotime($notify['date_hidden'])), $mailbody);
|
||||
@ -108,8 +100,10 @@ function process_new_cache($notify)
|
||||
$mailbody = mb_ereg_replace('{bearing}', Bearing2Text(calcBearing($notify['lat1'], $notify['lon1'], $notify['lat2'], $notify['lon2'])), $mailbody);
|
||||
$mailbody = mb_ereg_replace('{cachetype}', $notify['cachetype'], $mailbody);
|
||||
$mailbody = mb_ereg_replace('{cachesize}', $notify['cachesize'], $mailbody);
|
||||
$mailbody = mb_ereg_replace('{oconly}', $notify['oconly'] ? 'OConly-' : '', $mailbody);
|
||||
|
||||
$subject = mb_ereg_replace('{cachename}', $notify['cachename'], $mailsubject);
|
||||
$subject = mb_ereg_replace('{oconly}', $notify['oconly'] ? 'OConly-' : '', $subject);
|
||||
|
||||
/* begin send out everything that has to be sent */
|
||||
$email_headers = 'From: "' . $mailfrom . '" <' . $mailfrom . '>';
|
||||
@ -164,90 +158,4 @@ function getToMailDomain($mail)
|
||||
return $domain;
|
||||
}
|
||||
|
||||
//
|
||||
// checks if other instance is running, creates pid-file for locking
|
||||
//
|
||||
function CreatePidFile($PidFile)
|
||||
{
|
||||
if(!CheckDaemon($PidFile))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if(file_exists($PidFile))
|
||||
{
|
||||
echo "Error: Pidfile (".$PidFile.") already present at ".__FILE__.":".__LINE__."!\n";
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if($pidfile = @fopen($PidFile, "w"))
|
||||
{
|
||||
fputs($pidfile, posix_getpid());
|
||||
fclose($pidfile);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "can't create Pidfile $PidFile at ".__FILE__.":".__LINE__."!\n";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// checks if other instance of process is running..
|
||||
//
|
||||
function CheckDaemon($PidFile)
|
||||
{
|
||||
if($pidfile = @fopen($PidFile, "r"))
|
||||
{
|
||||
$pid_daemon = fgets($pidfile, 20);
|
||||
fclose($pidfile);
|
||||
|
||||
$pid_daemon = (int)$pid_daemon;
|
||||
|
||||
// process running?
|
||||
if(posix_kill($pid_daemon, 0))
|
||||
{
|
||||
// yes, good bye
|
||||
echo "Error: process already running with pid=$pid_daemon!\n";
|
||||
false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// no, remove pid_file
|
||||
echo "process not running, removing old pid_file (".$PidFile.")\n";
|
||||
unlink($PidFile);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// deletes pid-file
|
||||
//
|
||||
function CleanupAndExit($PidFile, $message = false)
|
||||
{
|
||||
if($pidfile = @fopen($PidFile, "r"))
|
||||
{
|
||||
$pid = fgets($pidfile, 20);
|
||||
fclose($pidfile);
|
||||
if($pid == posix_getpid())
|
||||
unlink($PidFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "Error: can't delete own pidfile (".$PidFile.") at ".__FILE__.":".__LINE__."!\n";
|
||||
}
|
||||
|
||||
if($message)
|
||||
{
|
||||
echo $message . "\n";
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -8,7 +8,8 @@
|
||||
if (!isset($maildomain)) $maildomain = 'opencaching.de';
|
||||
|
||||
$mailfrom = 'noreply@' . $maildomain;
|
||||
$mailsubject = '[' . $maildomain . '] Neuer Cache: {cachename}';
|
||||
$new_cache_subject = '[' . $maildomain . '] Neuer {oconly}Cache: {cachename}';
|
||||
$new_oconly_subject = '[' . $maildomain . '] Cache wurde als OConly markiert: {cachename}';
|
||||
|
||||
$debug = false;
|
||||
$debug_mailto = 'abc@xyz.de';
|
||||
|
Reference in New Issue
Block a user