<?php require_once '../lib/lib.everything.php'; enforce_master_on_off_switch($_SERVER['HTTP_ACCEPT_LANGUAGE']); enforce_api_password($_POST['password']); $context = default_context(False); /**** ... ****/ // Getting the correct form id $form_id = $_GET['id'] ? $_GET['id'] : null; $form = get_form($context->db, $form_id); if (!$form) { die_with_code(400, "I don't know that form"); } if ($_SERVER['REQUEST_METHOD'] == 'POST') { $context->db->query('START TRANSACTION'); foreach ($_POST['fields'] as $_field) { $field = add_form_field($context->db, $form['id'], $_field['name']); if (!$field) { die_with_code(400, "I don't know that field"); } $field['type'] = $_field['type']; $field['label'] = $_field['label']; set_form_field($context->db, $field); } // manually-defined form title from add-form.php wins here $form['title'] = $form['title'] ? $form['title'] : $_POST['title']; $form['http_method'] = $_POST['http_method']; $form['action_url'] = $_POST['action_url']; set_form($context->db, $form); finish_form($context->db, $form['id']); $context->db->query('COMMIT');
<?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($_SERVER['HTTP_ACCEPT_LANGUAGE']); $context = default_context(false); header("Content-Type: application/json"); header("Access-Control-Allow-Origin: *"); $query = <<<EOQ SELECT COUNT(pages.print_id) AS pages, prints.created, prints.composed, prints.orientation, prints.layout, prints.place_woeid, prints.region_woeid, prints.country_woeid, prints.private, prints.cloned, prints.refreshed, pages.provider FROM prints LEFT JOIN pages ON pages.print_id=prints.id GROUP BY prints.id ORDER BY created DESC EOQ; $res = $context->db->query($query); if (PEAR::isError($res)) { die_with_code(500, $res->message); } $rsp = array();