Exemplo n.º 1
0
function rcs_store($filename, $data, $logmessage = '')
{
    $efn = escapeshellarg($filename);
    if (file_exists(rcs_filename($filename)) and do_exec("co -f -l {$efn}", &$out) != 0) {
        error('Could not check out file:' . join("<br />", $out));
        return E_SERVFAIL;
    } else {
        if (!file_exists(rcs_filename($filename))) {
            do_exec("rcs -i -U {$filename}");
        }
        if (!succeeds($e = file_store($filename, $data))) {
            return $e;
        } else {
            if ($logmessage) {
                $elm = escapeshellarg($logmessage);
            } else {
                $elm = "'No message'";
            }
            if (do_exec("ci -u -m{$elm} {$efn}", &$out) == 0) {
                chmod($filename, 0666);
                return E_SUCCESS;
            } else {
                error("Could not checkin file: " . join("<br />", $out));
                return E_SERVFAIL;
            }
        }
    }
}
Exemplo n.º 2
0
function replyform_handler($data)
{
    return form($_SERVER['PHP_SELF'], "<small>Careful with this. It's not fully tested.</small>" . br . hidden('reply_to', htmlspecialchars($_GET['to'], ENT_QUOTES, 'UTF-8')) . textarea('reply') . '<textarea name="donotenter" class="donotenter"></textarea>' . br . submit('Reply'));
}
function editform($body = '', $header = array(), $version = '')
{
    if (!is_array($header)) {
        $header = mime_parse_header($header);
    }
    return form($_SERVER['PHP_SELF'], (@$header['robots'] == "NoIndex" ? "<em>This page does not get indexed by search engines</em>" : "") . br . "<h2>The page</h2>" . textarea('data', $body) . br . "<textarea name='donotenter' class='donotenter'></textarea>" . "<h2>A note about this edit:</h2> " . textarea('logmessage', is_logged_in() ? 'Posted by ' . ucfirst(login_get_username()) : '') . br . (@$header['robots'] != "NoIndex" ? checkbox('noindex', FALSE) . " Don't index this page in search engines" . br : "") . hidden('srcversion', $version) . submit('Save') . "for copy and paste: á é í ó ú ü / Á É Í Ó Ú Ü / ç Ç ñ Ñ / ★ ♠ ♣ ♥ ♦ / ¿ ¡ / ¢ £ / © / đ Đ þ Þ ø Ø / ß å Å æ Æ œ Œ / ∞ ≠ ≈ ≢ ≡ / ␄ ␛ / ⑆ ⑇ ⑈ ⑉ / ☢ ☣ / ☥ ☪ ☮ ☯ / ♀ ♂ ☾ ☿ ♁ ♃ ♄ ♅ ♆ ♇ / ♈ ♉ ♊ ♋ ♌ ♍ ♎ ♐ ♏ ♑ ♒ ♓");
}
if ($TITLE) {
    ob_start('wiki_add_title');
}
if ($action == 'new') {
    if (!is_file(rcs_filename($WIKI_PAGEDIR . "{$pagename}"))) {
        exec("rcs -i " . escapeshellarg($WIKI_PAGEDIR . "{$pagename}") . " 2>&1 < /dev/null", $output, $retval);
        if ($retval != 0) {
            http_500();
            while (ob_get_level()) {
                ob_end_clean();
            }
            print "An error occurred creating the page: " . join('', $output);
            ob_exit();
        }
    }
    if (is_file($WIKI_PAGEDIR . "{$pagename}")) {
        http_302($_SERVER['PHP_SELF'] . "?edit");
        ob_exit();
    } else {
        print editform();