$square = new GridSquare();
 $files_key = str_replace('.', '_', $value);
 $filenames[$key] = $_FILES[$files_key]['name'];
 $ok = $square->setByFullGridRef($_POST['grid_reference'][$key]);
 if ($ok) {
     // set up attributes from uploaded data
     $uploadmanager->setSquare($square);
     $uploadmanager->setViewpoint($_POST['photographer_gridref'][$key]);
     $uploadmanager->setDirection($_POST['view_direction'][$key]);
     $uploadmanager->setUse6fig(stripslashes($_POST['use6fig'][$key]));
     $uploadmanager->setTaken($_POST['imagetaken'][$key]);
     $uploadmanager->setTitle(utf8_decode($_POST['title'][$key]));
     $uploadmanager->setTitle2(utf8_decode($_POST['title2'][$key]));
     if ($_POST['comment'][$key] != "comment[{$key}]") {
         //bug? in Picasa sends the name in the value if blank, useful! (but only seems to apply to textareas)
         $uploadmanager->setComment(utf8_decode($_POST['comment'][$key]));
     }
     if ($_POST['comment2'][$key] != "comment2[{$key}]") {
         //bug? in Picasa sends the name in the value if blank, useful! (but only seems to apply to textareas)
         $uploadmanager->setComment2(utf8_decode($_POST['comment2'][$key]));
     }
     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'])));
Beispiel #2
0
 $ok = $square->setByFullGridRef($grid_reference = $_POST['grid_reference'][$key]);
 if ($ok) {
     // set up attributes from uploaded data
     $uploadmanager->setSquare($square);
     $uploadmanager->setViewpoint($_POST['photographer_gridref'][$key]);
     $uploadmanager->setDirection($_POST['view_direction'][$key]);
     $uploadmanager->setUse6fig(stripslashes($_POST['use6fig'][$key]));
     $uploadmanager->setTaken($_POST['imagetaken'][$key]);
     $uploadmanager->setTitle($_POST['title'][$key]);
     $uploadmanager->setTitle2($_POST['title2'][$key]);
     $uploadmanager->setLargestSize($_POST['largestsize'][$key]);
     $uploadmanager->setClearExif($_POST['clearexif']);
     //$uploadmanager->setClearExif($_POST['clearexif'][$key]);
     if ($_POST['comment'][$key] != "comment[{$key}]") {
         //bug? in Picasa sends the name in the value if blank, useful! (but only seems to apply to textareas)
         $uploadmanager->setComment($_POST['comment'][$key]);
     }
     if ($_POST['comment2'][$key] != "comment2[{$key}]") {
         //bug? in Picasa sends the name in the value if blank, useful! (but only seems to apply to textareas)
         $uploadmanager->setComment2($_POST['comment2'][$key]);
     }
     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($imageclass);
     if ($_POST['pattrib'] == 'other') {
         $uploadmanager->setCredit(stripslashes($_POST['pattrib_name']));
Beispiel #3
0
         $smarty->assign('title2', $title2);
         $smarty->assign('comment2', trim(stripslashes($_POST['comment2'])));
         $smarty->assign('user_status', stripslashes($_POST['user_status']));
         if ($ok) {
             $step = 4;
         } else {
             $smarty->assign('errormsg', "Please provide information about this image, see messages below...");
             $smarty->assign_by_ref('error', $error);
             $step = 3;
         }
     }
 } elseif (isset($_POST['finalise'])) {
     //create the image record
     if ($uploadmanager->setUploadId($_POST['upload_id'])) {
         $uploadmanager->setTitle(stripslashes(trim($_POST['title'])));
         $uploadmanager->setComment(stripslashes(trim($_POST['comment'])));
         $uploadmanager->setTitle2(stripslashes(trim($_POST['title2'])));
         $uploadmanager->setComment2(stripslashes(trim($_POST['comment2'])));
         $uploadmanager->setTaken(stripslashes($_POST['imagetaken']));
         $uploadmanager->setClass(stripslashes(trim($_POST['imageclass'])));
         $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('');
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();
}