Example #1
0
             $smarty->assign('error', 'We were unable to process your upload - please try again');
             break;
     }
 } elseif (isset($_POST['savedata'])) {
     //Submit Step 3..
     if (isset($_POST['goback'])) {
         $step = 2;
     } else {
         //preserve the upload id
         if ($uploadmanager->validUploadId($_POST['upload_id'])) {
             $smarty->assign('upload_id', $_POST['upload_id']);
             $uploadmanager->setUploadId($_POST['upload_id']);
         }
         $ok = true;
         //preserve the meta info
         $smarty->reassignPostedDate('imagetaken');
         if ($smarty->get_template_vars('imagetaken') == '0000-00-00') {
             $ok = false;
             $error['imagetaken'] = "Please specify a date for when the photo was taken (even approximate)";
         } elseif (datetimeToTimestamp($smarty->get_template_vars('imagetaken')) > datetimeToTimestamp(date("Y-m-d"))) {
             $ok = false;
             $error['imagetaken'] = "Time machines are not allowed on Planet Geograph";
         }
         if (($_POST['imageclass'] == 'Other' || empty($_POST['imageclass'])) && !empty($_POST['imageclassother'])) {
             $imageclass = stripslashes($_POST['imageclassother']);
         } else {
             if ($_POST['imageclass'] != 'Other') {
                 $imageclass = stripslashes($_POST['imageclass']);
             }
         }
         if (strlen($imageclass) == 0) {
Example #2
0
        $lockedby = $db->getOne("\r\n\t\t\t\tselect \r\n\t\t\t\t\tm.realname\r\n\t\t\t\tfrom\r\n\t\t\t\t\tarticle_lock as l\r\n\t\t\t\t\tinner join user as m using (user_id)\r\n\t\t\t\twhere\r\n\t\t\t\t\tarticle_id = {$page['article_id']}\r\n\t\t\t\t\tand m.user_id != {$USER->user_id}\r\n\t\t\t\tand lock_obtained > date_sub(NOW(),INTERVAL 1 HOUR)");
        if ($lockedby) {
            $smarty->assign('lockedby', $lockedby);
            $template = 'article_locked.tpl';
            $smarty->display($template, $cacheid);
            exit;
        }
        $smarty->assign($page);
        $db->Execute("REPLACE INTO article_lock SET user_id = {$USER->user_id}, article_id = {$page['article_id']}");
    } else {
        $template = 'static_404.tpl';
    }
}
if ($template != 'static_404.tpl' && isset($_POST) && isset($_POST['submit'])) {
    $errors = array();
    $smarty->reassignPostedDate('publish_date');
    $_POST['title'] = preg_replace('/[^\\w-\\., ]+/', '', trim($_POST['title']));
    if (empty($_POST['url']) && !empty($_POST['title'])) {
        $_POST['url'] = $_POST['title'];
    }
    $_POST['url'] = preg_replace('/ /', '-', trim($_POST['url']));
    $_POST['url'] = preg_replace('/[^\\w-]+/', '', $_POST['url']);
    if ($_POST['title'] == "New Article") {
        $errors['title'] = "Please give a meaningful title";
    }
    $gs = new GridSquare();
    if (!empty($_POST['grid_reference'])) {
        if ($gs->setByFullGridRef($_POST['grid_reference'])) {
            $_POST['gridsquare_id'] = $gs->gridsquare_id;
        } else {
            $errors['grid_reference'] = $gs->errormsg;