Ejemplo n.º 1
0
 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'])));
     $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 {
Ejemplo n.º 2
0
 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']));
     $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 {
Ejemplo n.º 3
0
             $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('');
         }
         if (!empty($_POST['pattrib_default'])) {
             $USER->setCreditDefault($_POST['pattrib'] == 'other' ? stripslashes($_POST['pattrib_name']) : '');
         }
Ejemplo n.º 4
0
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();
}