示例#1
0
$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) {
    $rdbk->encryptHints();
}
// Spoilers
if ($display_spoilers) {
    $rdbk->addSpoilers();
}
// Waypoints
if ($display_waypoints) {
    $rdbk->addWaypoints();
}
// Parse logs
if ($display_logs) {
    $rdbk->parseMarkdown()->parseBBcode();
}
$rdbk->getOnlyBody();
$rdbk->saveFile($rdbk->html_file, $rdbk->html);
$rdbk->saveFile($rdbk->json_file);
renderAjax(array('success' => true, 'redirect' => 'roadbook/' . basename($rdbk->html_file)));
示例#2
0
<?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));
示例#3
0
<?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>'));
示例#4
0
<?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()));