$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]; } if (!empty($_POST['grid_reference']) && $square->natgrlen > 4) {
$imageclass = stripslashes($_POST['imageclassother'][$key]); } else { if ($_POST['imageclass'] != 'Other') { $imageclass = stripslashes($_POST['imageclass'][$key]); } } $uploadmanager->setClass($imageclass); if ($_POST['pattrib'] == 'other') { $uploadmanager->setCredit(stripslashes($_POST['pattrib_name'])); $smarty->assign('credit_realname', $_POST['pattrib_name']); } elseif ($_POST['pattrib'] == 'self') { $uploadmanager->setCredit(''); } $ok = $uploadmanager->setUploadId($_POST['upload_id'][$key]); if ($ok) { $err = $uploadmanager->commit(isset($_GET['nofrills']) ? 'nofrills' : 'submit2'); 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]; } if (!empty($_POST['grid_reference']) && $square->natgrlen > 4) {
$uploadmanager->setViewpoint(stripslashes($_POST['photographer_gridref'])); $uploadmanager->setDirection(stripslashes($_POST['view_direction'])); $uploadmanager->setUse6fig(stripslashes($_POST['use6fig'])); $uploadmanager->setUserStatus(stripslashes($_POST['user_status'])); $uploadmanager->setLargestSize($_POST['largestsize']); $uploadmanager->setClearExif($_POST['clearexif']); if ($_POST['pattrib'] == 'other') { $uploadmanager->setCredit(stripslashes($_POST['pattrib_name'])); $smarty->assign('credit_realname', $_POST['pattrib_name']); } elseif ($_POST['pattrib'] == 'self') { $uploadmanager->setCredit(''); } if (!empty($_POST['pattrib_default'])) { $USER->setCreditDefault($_POST['pattrib'] == 'other' ? stripslashes($_POST['pattrib_name']) : ''); } $err = $uploadmanager->commit('submit', true); //we will call cleanup later. if ($_POST['imagetaken'] != '0000-00-00') { $_SESSION['last_imagetaken'] = $_POST['imagetaken']; } if (!empty($_POST['grid_reference']) && $square->natgrlen > 4) { $_SESSION['last_grid_reference'] = $_POST['grid_reference']; } if (!empty($_POST['photographer_gridref'])) { $_SESSION['last_photographer_gridref'] = $_POST['photographer_gridref']; } $clear_cache = 1; if (!$err) { $smarty->assign('gridimage_id', $uploadmanager->gridimage_id); } }
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(); }