Exemple #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)));
Exemple #2
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()));