function datestr($dt) { date_default_timezone_set("Australia/Brisbane"); $tm = strtotime_uk($dt); if ($tm > 0) { return date("Y-m-d H:i:s", $tm); } return "unknown"; }
$float[$k] = true; $money[$k] = true; $null[$k] = false; $hasdata[$k] = false; } if (!$v) { $null[$k] = true; $key[$k] = false; } else { $hasdata[$k] = true; if ($pref_date == "us") { if (!($dt = strtotime($v))) { $dt = strtotime_uk($v); } } else { if (!($dt = strtotime_uk($v))) { $dt = strtotime($v); } } if ($v == "0" or !$dt) { $datecol[$k] = false; } else { if (strlen($v) > 11) { if ($fmt = date_time_format($v)) { $date_time_fmt[$k][$fmt]++; } } if ($fmt = date_format($v)) { $date_fmt[$k][$fmt]++; } if ($fmt = time_format($v)) {
function UploadPicture() { global $CONF; global $xml; global $USER; if (empty($_POST['userid']) || !intval($_POST['userid'])) { $xml['status'] = 'Not Logged In'; returnXML(); } else { $USER = new GeographUser(intval($_POST['userid'])); //TODO: check validation hash? if ($_POST['validation'] != md5($_POST['userid'] . '#' . $CONF['register_confirmation_secret'])) { $xml['status'] = 'User not verified'; returnXML(); } if (!$USER->user_id || !$USER->hasPerm('basic')) { $xml['status'] = 'Not authorised to post'; returnXML(); } } $um = new UploadManager(); $gs = new GridSquare(); // this is the check that we like the client and any image has // come in with the appropriate cc licence $ccl = $_POST['cclicence']; if ($ccl != "I grant you the permission to use this submission " . "under the terms of the Creative Commons by-sa-2.0 licence") { $xml['status'] = 'Bad client submission'; returnXML(); } // validate the grid square - we may be going back to the user // quickly here :-) $gs->setByFullGridRef($_POST['subject']); if ($gs->errormsg != "") { $xml['status'] = $gs->errormsg; returnXML(); } $takendate = strtotime_uk($_POST['date']); if ($takendate > time()) { $xml['status'] = "Date taken in future"; returnXML(); } // set up attributes from uploaded data $um->setSquare($gs); $um->setViewpoint($_POST['photographer']); $um->setDirection($_POST['direction']); $um->setTaken(date('Y-m-d', $takendate)); $um->setTitle($_POST['title']); $um->setComment($_POST['comments']); $um->setClass($_POST['feature']); $um->setUserStatus($_POST['supplemental']); $um->processUpload($_FILES['uploadfile']['tmp_name']); // where there any errors back from the image processing? // if so, JUppy needs to know... if ($um->error != "") { $xml['status'] = $um->error; } else { // so far so good... can we commit the submission? $rc = $um->commit(); if ($rc == "") { //clear user profile $ab = floor($USER->user_id / 10000); $smarty = new GeographPage(); $smarty->clear_cache(null, "user{$ab}|{$USER->user_id}"); $xml['status'] = "OK"; } else { $xml['status'] = $rc; } } returnXML(); }