Showing with 25 additions and 4 deletions.
  1. +6 −0 data/.htaccess
  2. +6 −2 mappa/generator.php
  3. +13 −2 radar/confirm.php
6 changes: 6 additions & 0 deletions data/.htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,9 @@
Deny from all
Allow from 127.0.0.1
</Files>

<Files radar_pending.txt>
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Files>
8 changes: 6 additions & 2 deletions mappa/generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@

require_once ('../funzioni.php');

function notify_mail ($message) {
mail ('webmaster@linux.it', 'notifica script mappa LugMap', $message . "\n", 'From: linux.it <webmaster@linux.it>' . "\r\n");
}

/*
Scopiazzato da http://www.phpbuilder.com/board/showthread.php?t=10287962
*/
Expand Down Expand Up @@ -195,7 +199,7 @@ function save_geocache () {

function write_geo_file ($name, $contents) {
if (file_put_contents ($name, $contents) === false)
echo "Errore nel salvataggio del file geografico per la LugMap\n";
notify_mail ("Errore nel salvataggio del file geografico per la LugMap");
}

init_geocache ();
Expand Down Expand Up @@ -301,7 +305,7 @@ function write_geo_file ($name, $contents) {
array_push ($output->features, $point);
}
else {
echo "Impossibile gestire la zona '$zone', si consiglia l'analisi manuale\n";
notify_mail ("Impossibile gestire la zona '$zone', si consiglia l'analisi manuale");
}
}
}
Expand Down
15 changes: 13 additions & 2 deletions radar/confirm.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,35 @@
$mail = null;
$prov = null;

$now = time ();
$pending = array ();
$data = file ('../data/radar_pending.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);

foreach ($data as $d) {
list ($m, $p, $u) = explode ('|', $d);
list ($m, $p, $u, $d) = explode ('|', $d);

if ($u == $_GET ['id']) {
$mail = $m;
$prov = $p;
$valid_row = $d;
break;
}
else {
/*
Le registrazioni piu' vecchie di (circa...)
10 giorni vengono eliminate
*/
if ($now - strtotime ($d) < 864000)
$pending [] = $d;
}

unset ($m);
unset ($p);
unset ($u);
}

file_put_contents ('../data/radar_pending.txt', join ("\n", $pending));
unset ($data);
unset ($pending);

if ($mail != null) {
$valid = array ();
Expand Down