$smarty->display('static_submit_intro.tpl'); exit; } if (isset($_SESSION['tab'])) { $selectedtab = $_SESSION['tab']; } else { $selectedtab = 1; } $step = isset($_POST['step']) ? intval($_POST['step']) : 1; if (!empty($_FILES['jpeg_exif']) && $_FILES['jpeg_exif']['error'] != UPLOAD_ERR_NO_FILE) { //Submit Step 1a.. switch ($_FILES['jpeg_exif']['error']) { case 0: if (!filesize($_FILES['jpeg_exif']['tmp_name'])) { $smarty->assign('error', 'Sorry, no file was received - please try again'); } elseif ($uploadmanager->processUpload($_FILES['jpeg_exif']['tmp_name'])) { $smarty->assign('upload_id', $uploadmanager->upload_id); $smarty->assign('transfer_id', $uploadmanager->upload_id); $smarty->assign('preview_url', "/submit.php?preview=" . $uploadmanager->upload_id); $smarty->assign('preview_width', $uploadmanager->upload_width); $smarty->assign('preview_height', $uploadmanager->upload_height); $exif = $uploadmanager->rawExifData; if (!empty($exif['GPS'])) { $conv = new Conversions(); if (is_array($exif['GPS']['GPSLatitude'])) { $deg = FractionToDecimal($exif['GPS']['GPSLatitude'][0]); $min = FractionToDecimal($exif['GPS']['GPSLatitude'][1]); $sec = FractionToDecimal($exif['GPS']['GPSLatitude'][2]); $lat = ExifConvertDegMinSecToDD($deg, $min, $sec); } else { //not sure if this will ever happen but it could?
} if (($_POST['imageclass'][$key] == 'Other' || empty($_POST['imageclass'][$key])) && !empty($_POST['imageclassother'][$key])) { $imageclass = stripslashes($_POST['imageclassother'][$key]); } else { if ($_POST['imageclass'] != 'Other') { $imageclass = stripslashes($_POST['imageclass'][$key]); } } $uploadmanager->setClass(utf8_decode($imageclass)); if ($_POST['pattrib'] == 'other') { $uploadmanager->setCredit(stripslashes(utf8_decode($_POST['pattrib_name']))); $smarty->assign('credit_realname', utf8_decode($_POST['pattrib_name'])); } elseif ($_POST['pattrib'] == 'self') { $uploadmanager->setCredit(''); } $ok = $uploadmanager->processUpload($_FILES[$files_key]['tmp_name']); if ($ok) { $err = $uploadmanager->commit('puploader'); if (empty($err)) { $status[$key] = "ok:" . $uploadmanager->gridimage_id; } else { $status[$key] = $err; } } else { $status[$key] = $uploadmanager->errormsg; } } else { $status[$key] = "Subject Grid Reference: " . $square->errormsg; } if ($_POST['imagetaken'][$key] != '0000-00-00') { $_SESSION['last_imagetaken'] = $_POST['imagetaken'][$key];
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(); }