if ($matche[1] == '1/0') { renderAjax(array('success' => false, 'message' => 'GPX version 1/0 is not supported, please use version 1/0/1. ' . '<a href="http://www.geocaching.com/account/ManagePreferences.aspx">Check your preferences</a>')); } $display_toc = isset($_POST['toc']) && $_POST['toc'] == "true" ? true : false; $display_note = isset($_POST['note']) && $_POST['note'] == "true" ? true : false; $display_short_desc = isset($_POST['short_desc']) && $_POST['short_desc'] == "true" ? true : false; $display_long_desc = isset($_POST['long_desc']) && $_POST['long_desc'] == "true" ? true : false; $display_hint = isset($_POST['hint']) && $_POST['hint'] == "true" ? true : false; $display_logs = isset($_POST['logs']) && $_POST['logs'] == "true" ? true : false; $display_spoilers = isset($_POST['spoilers']) && $_POST['spoilers'] == "true" ? true : false; $hint_encrypted = isset($_POST['hint_encrypted']) && $_POST['hint_encrypted'] == "true" ? true : false; $display_waypoints = isset($_POST['waypoints']) && $_POST['waypoints'] == "true" ? true : false; $sort_by = isset($_POST['sort_by']) && in_array($_POST['sort_by'], $available_sorts) ? $_POST['sort_by'] : $available_sorts[0]; $pagebreak = isset($_POST['pagebreak']) && $_POST['pagebreak'] == "true" ? true : false; $images = isset($_POST['images']) && $_POST['images'] == "true" ? true : false; $rdbk = new Georoadbook(); if (!$rdbk->create($_POST['gpx'])) { renderAjax(array('success' => false)); } $options = array('display_note' => $display_note, 'display_short_desc' => $display_short_desc, 'display_long_desc' => $display_long_desc, 'display_hint' => $display_hint, 'display_logs' => $display_logs, 'display_waypoints' => $display_waypoints, 'display_spoilers' => $display_spoilers, 'sort_by' => $sort_by, 'pagebreak' => $pagebreak); $rdbk->convertXmlToHtml($_POST['locale'], $options)->cleanHtml(); // Table of content if ($display_toc) { $rdbk->addToc(); } // remove images from short and long description if ($images) { $rdbk->removeImages($display_short_desc); } // Hint if ($display_hint && $hint_encrypted) {
<?php require dirname(__DIR__) . '/include/config.php'; Georoadbook::ajaxRequestOnly(); if (!array_key_exists('page-size', $_POST) || !array_key_exists('orientation', $_POST) || !array_key_exists('margin-left', $_POST) || !array_key_exists('margin-right', $_POST) || !array_key_exists('margin-top', $_POST) || !array_key_exists('margin-bottom', $_POST) || !array_key_exists('header-align', $_POST) || !array_key_exists('header-text', $_POST) || !array_key_exists('header-pagination', $_POST) || !array_key_exists('footer-align', $_POST) || !array_key_exists('footer-text', $_POST) || !array_key_exists('footer-pagination', $_POST)) { header("HTTP/1.0 400 Bad Request"); exit(0); } $rdbk = new Georoadbook($_POST['id']); if (!file_exists($rdbk->html_file) || !is_readable($rdbk->html_file)) { header("HTTP/1.0 404 Not Found"); exit(0); } $options_css = array('page_size' => $_POST['page-size'], 'orientation' => $_POST['orientation'], 'margin_left' => (int) $_POST['margin-left'], 'margin_right' => (int) $_POST['margin-right'], 'margin_top' => (int) $_POST['margin-top'], 'margin_bottom' => (int) $_POST['margin-bottom'], 'header_align' => $_POST['header-align'], 'header_text' => $_POST['header-text'], 'header_pagination' => $_POST['header-pagination'] == "true" ? 1 : 0, 'footer_align' => $_POST['footer-align'], 'footer_text' => $_POST['footer-text'], 'footer_pagination' => $_POST['footer-pagination'] == "true" ? 1 : 0); $rdbk->saveOptions($options_css); if (array_key_exists('real_export', $_POST) && $_POST['real_export'] == "false") { renderAjax(array('success' => true)); } if (!$rdbk->export()) { renderAjax(array('success' => false, 'error' => $rdbk->result)); } renderAjax(array('success' => true, 'size' => round(filesize($rdbk->pdf_file) / 1024 / 1024, 2), 'link' => '<a href="/roadbook/' . basename($rdbk->html_file) . '?pdf">Download your roadbook now</a>'));
<?php require dirname(__DIR__) . '/include/config.php'; Georoadbook::ajaxRequestOnly(); if (!array_key_exists('id', $_POST)) { header("HTTP/1.0 400 Bad Request"); exit(0); } $rdbk = new Georoadbook($_POST['id']); $rdbk->delete(); renderAjax(array('success' => true));
<?php require dirname(__DIR__) . '/include/config.php'; if (!array_key_exists('roadbook', $_GET)) { header("HTTP/1.0 404 Not Found"); exit(0); } Twig_Autoloader::register(); $loader = new Twig_Loader_Filesystem(TEMPLATE_DIR); $twig = new Twig_Environment($loader, array('debug' => false, 'cache' => false)); $rdbk = new Georoadbook($_GET['roadbook']); if (!file_exists($rdbk->html_file) || !is_readable($rdbk->html_file)) { header("HTTP/1.0 404 Not Found"); exit(0); } if (array_key_exists('pdf', $_GET)) { $rdbk->downloadPdf(); } if (array_key_exists('zip', $_GET)) { $rdbk->downloadZip(); } if (array_key_exists('raw', $_GET)) { $twig_vars = array('style' => $rdbk->getCustomCss(), 'content' => file_get_contents($rdbk->html_file)); echo $twig->render('raw.tpl', $twig_vars); exit(0); } $twig_vars = array('language' => $language, 'roadbook_id' => $rdbk->id, 'roadbook_content' => file_get_contents($rdbk->html_file), 'last_modification' => 'Last saved: ' . $rdbk->getLastSavedDate()); if (class_exists('ZipArchive')) { $twig_vars['available_zip'] = true; } if (file_exists($rdbk->pdf_file)) {
<?php require dirname(__DIR__) . '/include/config.php'; Georoadbook::ajaxRequestOnly(); if (!array_key_exists('id', $_POST) || !array_key_exists('content', $_POST)) { header("HTTP/1.0 400 Bad Request"); exit(0); } $rdbk = new Georoadbook($_POST['id']); //hack, bug in TinyMCE $html = preg_replace('/<head>\\s*<\\/head>/m', '<head><meta charset="utf-8" /><title>My roadbook</title><link type="text/css" rel="stylesheet" href="../design/roadbook.css" media="all" /></head>', $_POST['content'], 1); $rdbk->saveFile($rdbk->html_file, $html); if (!$rdbk->saveFile($rdbk->html_file, $_POST['content'])) { renderAjax(array('success' => false)); } renderAjax(array('success' => true, 'last_modification' => 'Last saved: ' . $rdbk->getLastSavedDate()));