RecentUpload: Difference between revisions

23 bytes added ,  23:03, 23 August 2009
Updated Version to Version 1.3, Updated .php Code & 'Ajax' Code
mNo edit summary
(Updated Version to Version 1.3, Updated .php Code & 'Ajax' Code)
Line 1: Line 1:
{{AddOnBanner|name=RecentUpload|type=HTML & PHP|author=Jason Duncombe|contact=6719jason via Forum|updated=20 Aug 2009|version=1.2}}
{{AddOnBanner|name=RecentUpload|type=HTML & PHP|author=Jason Duncombe|contact=6719jason via Forum|updated=23rd Aug 2009|version=1.3}}


<big>RecentUpload</big> shows a list of files on your webserver and the date and time of their last update.  This is predominately useful for a system admin/website owner as a quick and convenient way to check that Cumulus has been able to upload the necessary data files and webpages to your site.  It is not specific to Cumulus files so you could check other files on your webserver!
<big>RecentUpload</big> shows a list of files on your webserver and the date and time of their last update.  This is predominately useful for a system admin/website owner as a quick and convenient way to check that Cumulus has been able to upload the necessary data files and webpages to your site.  It is not specific to Cumulus files so you could check other files on your webserver!
Line 21: Line 21:
// format: "file nickname", "update frequency", "file url"
// format: "file nickname", "update frequency", "file url"
// - nickname may be "" (will be replaced by url)
// - nickname may be "" (will be replaced by url)
 
// - freq may be "" (will be replaced by 'Unknown')
$nickname[] = "Realtime.txt"; $freq[]="30 Seconds"; $file_url[]="./realtime.txt";
// - file url - valid filepath - COMPULSORY
$nickname[] = "Homepage"; $freq[]="5mins"; $file_url[]="./index.html";
$nickname[] = "Station Records"; $freq[]="5mins"; $file_url[]="./record.html";
$nickname[] = "Station Trends"; $freq[]="5mins"; $file_url[]="./trends.html";
 
// ######### That's it, nothing else to do !
// ######### That's it, nothing else to do !


Line 37: Line 33:
   if(file_exists($file_url[$i])) { // cheap and cheerful existence check
   if(file_exists($file_url[$i])) { // cheap and cheerful existence check
       $when=filemtime($file_url[$i]);
       $when=filemtime($file_url[$i]);
       $this_output .= "<tr><td>" .($nickname[$i] ? $nickname[$i] : $file_url[$i]). "</td><td>" .$freq[$i]. "<td>" .date("m/d/y H:i:s T", $when). "</td><td>" .timediff($file_url[$i]). "</td></tr>\n";
       $this_output .= "<tr><td>" .($nickname[$i] ? $nickname[$i] : $file_url[$i]). "</td><td align=\"center\">" .($freq[$i] ? $freq[$i] : "Unknown"). "<td>" .date("m/d/y H:i:s T", $when). "</td><td align=\"center\">" .timediff($file_url[$i]). "</td></tr>\n";
   } else { // the file is misnamed or not uploaded
   } else { // the file is misnamed or not uploaded
       $this_output .= "<tr><td>" .$file_url[$i]. "</td><td>" .$freq[$i]. "<td><b>NO SUCH FILE !</b></td><td><b>NO SUCH FILE !</b></td></tr>\n";
       $this_output .= "<tr><td><font color=\"#ff0000\" <b>" .$file_url[$i]. "</b></font></td><td align=\"center\">" .($freq[$i] ? $freq[$i] : "Unknown"). "<td align=\"center\"><font color=\"#ff0000\"><b>NO SUCH FILE !</b></font></td><td align=\"center\"><font color=\"#ff0000\"><b>NO SUCH FILE !</b></font></td></tr>\n";
   } // END existence check
   } // END existence check
} // END array loop
} // END array loop
24

edits