<?php require_once '../lib/lib.everything.php'; enforce_master_on_off_switch($_SERVER['HTTP_ACCEPT_LANGUAGE']); $context = default_context(True); /**** ... ****/ $atlas_data = array(); if ($_POST['atlas_location']) { $atlas_data['atlas_location'] = $_POST['atlas_location']; } if ($_POST['atlas_provider']) { $atlas_data['atlas_provider'] = $_POST['atlas_provider']; } if ($_POST['atlas_title']) { $atlas_data['atlas_title'] = $_POST['atlas_title']; } if ($_POST['atlas_text']) { $atlas_data['atlas_text'] = $_POST['atlas_text']; } $context->sm->assign('atlas_data', $atlas_data); if ($_GET['error'] == 'no_response') { $context->sm->assign('error', 'We could not find that place. Please try again.'); } // TODO: check whether search is currently working // pass $error_nosearch to template if (is_logged_in()) { $user_mbtiles = get_mbtiles_by_user_id($context->db, $context->user['id']); if ($user_mbtiles) { $context->sm->assign('user_mbtiles', $user_mbtiles); } }
<?php require_once '../lib/lib.everything.php'; enforce_master_on_off_switch(); /*** ... ***/ $dirname = $_POST['dirname'] ? $_POST['dirname'] : null; $redirect = preg_match('#^http://#', $_POST['redirect']) ? $_POST['redirect'] : null; $expiration = $_POST['expiration'] ? $_POST['expiration'] : null; $file = is_array($_FILES['file']) ? $_FILES['file'] : null; if (strtotime($expiration) < time()) { die_with_code(401, "Sorry, expiration date {$expiration} has come and gone - " . date('r', strtotime($expiration))); } if ($file['error'] > 0) { die_with_code(400, "Sorry, encountered error #{$file['error']} (see http://us.php.net/manual/en/features.file-upload.errors.php)"); } $posted_signature = $_POST['signature'] ? $_POST['signature'] : null; $expected_signature = sign_post_details($dirname, $expiration, API_PASSWORD); if ($posted_signature != $expected_signature) { die_with_code(401, 'Sorry, bad signature'); } if (is_array($file) && is_uploaded_file($file['tmp_name'])) { $object_id = rtrim($dirname, '/') . '/' . ltrim($file['name'], '/'); $content_bytes = file_get_contents($file['tmp_name']); $url = post_file_local($object_id, $content_bytes); } if ($redirect) { $redirect = new Net_URL($redirect); $redirect->addQueryString('url', $url); $redirect = $redirect->getURL(); } if ($redirect) {