Example #1
0
function generate_ancestor_links($pageTitle)
{
    global $page_title;
    if ($pageTitle === null) {
        $pageTitle = $page_title;
    }
    $elems = explode('/', $pageTitle);
    $title = '';
    $name = '';
    $ht = '';
    for ($i = 0, $ilast = count($elems) - 1; $i < $ilast; $i++) {
        $title .= $elems[$i];
        $name .= $elems[$i];
        $id = urlencode($title);
        if (file_exists('.lwiki/data/page.' . $id . '.htm')) {
            $url_read = lwiki_link_page($id);
            $ht .= '<a href="' . $url_read . '">' . htmlspecialchars($name) . '</a><span class="lwiki-linkbar-separator">/</span>';
            $name = '';
        } else {
            $name .= '/';
        }
        $title .= '/';
    }
    $name .= $elems[$ilast];
    $ht .= '<b>' . htmlspecialchars($name) . '</b>';
    return $ht;
}
Example #2
0
function output_comment_form()
{
    global $pageid;
    global $comment_name;
    global $comment_body;
    global $comment_action;
    global $comment_error;
    $html_captcha = lwiki_auth_generate();
    $action = $comment_action;
    if ($action == '') {
        $action = lwiki_link_page($pageid);
    }
    echo '<div id="comment-form" style="width:400px;text-ailgn:center;border:1px solid gray;padding:10px 20px;">';
    if ($comment_error != '') {
        echo '  ' . $comment_error;
    }
    echo '  <form method="post" action="' . htmlspecialchars($action) . '">';
    echo '    <input type="hidden" name="type" value="comment_add" />';
    echo '    <input type="hidden" name="sigma" value="' . htmlspecialchars(_calculate_xsrfhash()) . '" />';
    echo '    <p style="margin:0.5em 0;">名前: <input type="text" name="name" size="20" value="' . htmlspecialchars($comment_name) . '"/></p>';
    echo '    <textarea name="body" rows="5" style="width:390px;padding:5px;">' . htmlspecialchars($comment_body) . '</textarea>';
    echo '    <div style="text-align:center;margin:0.5em;">';
    echo '      ' . $html_captcha . '<input type="submit" name="comment_post" value="投稿" />';
    echo '    </div>';
    echo '  </form>';
    echo '</div>';
}
Example #3
0
function sidebar_begin_holder($title, $haslinkbar = false)
{
    $title = htmlspecialchars($title);
    echo '<div class="lwiki-menu-holder">' . PHP_EOL;
    echo "<h1>{$title}</h1>" . PHP_EOL;
    if ($haslinkbar) {
        $url_main = htmlspecialchars(lwiki_link_page());
        $url_list = htmlspecialchars(lwiki_link_page(null, 'mode=list'));
        $url_edit = htmlspecialchars(lwiki_link_page('Menu', 'mode=edit'));
        echo '<p class="lwiki-page-wikilinks">' . PHP_EOL;
        echo '[ <a href="' . $url_main . '">表紙</a> | <a href="' . $url_list . '">一覧</a> ]' . PHP_EOL;
        echo '  [ <a href="' . $url_edit . '">目次編集</a> ]' . PHP_EOL;
        echo '</p>' . PHP_EOL;
    }
    echo '<div class="lwiki-page-content">' . PHP_EOL;
}
Example #4
0
        $frag_title = '編集:' . $ht_page_title;
    }
}
$frag_content = htmlspecialchars($edit_session->content());
$frag_edithash = htmlspecialchars($edit_session->edithash());
$frag_xsrfhash = htmlspecialchars($edit_session->xsrfhash());
$frag_remarks = htmlspecialchars($_POST['remarks']);
$frag_partlength = $edit_session->is_part() ? '<input type="hidden" name="partlength" value="' . $edit_session->partlength() . '" />' . PHP_EOL : '';
lwiki\page\begin_document($frag_title, '<meta name="robots" content="none" />' . PHP_EOL);
echo '<p class="lwiki-linkbar-main">';
$url_main = htmlspecialchars(lwiki_link_page());
$url_list = htmlspecialchars(lwiki_link_page(null, 'mode=list'));
echo '[ <a href="' . $url_main . '">表紙</a>' . ' | <a href="' . $url_list . '">一覧</a> ]';
$url_read = htmlspecialchars(lwiki_link_page($pageid));
$url_hist = htmlspecialchars(lwiki_link_page($pageid, 'mode=hist'));
$url_diff = htmlspecialchars(lwiki_link_page($pageid, 'hist=last'));
echo ' [ <a href="' . $url_read . '">' . $ht_page_title . '</a>' . ' | <b>編集</b>' . ' | <a href="' . $url_hist . '">履歴</a>' . ' - <a href="' . $url_diff . '">差分</a>]' . PHP_EOL;
echo '</p>';
echo '<p class="lwiki-linkbar-modified">' . page_modified_date() . '</p>';
echo '<div class="lwiki-page-content">';
if ($lwiki_edit_error != '') {
    echo "{$lwiki_edit_error}";
}
echo '<form method="post" action="' . $frag_action . '" style="width:600px;" id="lwiki_form_edit">';
echo '  ' . $frag_partlength;
echo '  <input type="hidden" name="edithash" value="' . $frag_edithash . '" />';
echo '  <input type="hidden" name="sigma" value="' . $frag_xsrfhash . '" />';
echo '  <textarea name="content" rows="20" style="width:590px;padding:5px;">' . $frag_content . '</textarea>';
echo '  <div><label>備考: <input type="text" style="width:500px;" name="remarks" value="' . $frag_remarks . '" /></label></div>';
echo '  <div style="text-align:center;margin:0.5em;">';
echo '    ' . $frag_captcha;
Example #5
0
 private static function generate_editlink_default($_pageid, $mark)
 {
     $mark = urlencode($mark);
     $url_edit = htmlspecialchars(lwiki_link_page($_pageid, "mode=edit&part={$mark}"));
     return '<a class="lwiki-edit-partial" href="' . $url_edit . '">[編集]</a>';
 }
Example #6
0
<p class="lwiki-linkbar-modified"><?php 
echo page_modified_date();
?>
</p>
<div class="lwiki-page-content">
<?php 
// content
$fname_content = '.lwiki/data/page.' . $pageid . '.htm';
$content_exists = file_exists($fname_content);
if ($content_exists) {
    include $fname_content;
} else {
    echo '<p><b>Error</b>: 指定された名前「<b>' . $ht_page_title . '</b> (' . $pageid . ')」のページは存在しません。</p>';
}
// comment
if ($content_exists) {
    echo '<h2 class="comment">コメント</h2>';
    $comment_content = @file_get_contents(".lwiki/data/{$comment_id}.htm");
    if ($comment_content == '') {
        echo "<p>コメントは未だありません</p>";
    } else {
        lwiki_include_string($comment_content);
    }
    $comment_action = lwiki_link_page($pageid) . '#comment-form';
    require_once ".lwiki/lib/mod_comment.php";
    \lwiki\comment\output_comment_form();
}
?>
</div>
<?php 
lwiki\page\end_document();
Example #7
0
}
echo '</table>' . PHP_EOL;
$editlogs = @file('./.lwiki/data/log.edit.txt');
if ($editlogs != null && count($editlogs)) {
    echo '<h2>最近のページ編集</h2>';
    echo '<ul>';
    $htmlContent = '';
    foreach ($editlogs as $editlog) {
        $fields = explode('/', $editlog);
        $edit_auth = lwiki_hash(urldecode($fields[0]));
        $edit_date = urldecode($fields[1]);
        $edit_page = urldecode($fields[2]);
        $edit_hist = trim($fields[3]);
        $edit_pageid = $fields[2];
        $htmlAuth = htmlspecialchars($edit_auth);
        $htmlDate = htmlspecialchars($edit_date);
        $htmlPage = htmlspecialchars($edit_page);
        $url_diff = htmlspecialchars(lwiki_link_page($edit_pageid, "hist={$edit_hist}"));
        $url_read = htmlspecialchars(lwiki_link_page($edit_pageid));
        $htmlDiffLink = '[<a href="' . $url_diff . '">差分</a>]';
        $htmlPageLink = '<a href="' . $url_read . '">' . $htmlPage . '</a>';
        $htmlLine = '<li>' . $htmlDate . ' ' . $htmlDiffLink . ' ' . $htmlPageLink . ' by ' . $htmlAuth . '</li>';
        $htmlContent = $htmlLine . PHP_EOL . $htmlContent;
    }
    echo $htmlContent;
    echo '</ul>';
}
?>
</div>
<?php 
lwiki\page\end_document();
Example #8
0
            include ".lwiki/lib/page.diff.php";
            exit;
        }
        if (@$_GET['command'] == 'comment-regenerate') {
            require_once ".lwiki/lib/mod_comment.php";
            \lwiki\comment\comment_regenerate();
        } else {
            if (@$_GET['command'] == 'page-convert') {
                require_once ".lwiki/lib/lib.page-edit.php";
                \lwiki\edit\page_convert();
            }
        }
        // コメント追加
        $comment_name = @$_COOKIE['comment-name'];
        $comment_body = "";
        if (@$_POST['type'] == 'comment_add') {
            require_once ".lwiki/lib/mod_comment.php";
            $comment_added = \lwiki\comment\comment_add();
            if ($comment_added) {
                $comment_name = $_POST['name'];
                setcookie('comment-name', $comment_name);
                header('Location: ' . lwiki_link_page($pageid));
                // flush post data
                exit;
            } else {
                $comment_body = $_POST['body'];
            }
        }
        include ".lwiki/lib/page.read.php";
        break;
}
Example #9
0
</p>
<div class="lwiki-page-content">
<?php 
if ($_GET['mode'] == 'hist') {
    $fname_hist = '.lwiki/data/page.' . $pageid . '.hist';
    if (file_exists($fname_hist)) {
        echo '<table class="lwiki-single lwiki-center">' . PHP_EOL;
        echo '<tr><th>版</th><th>更新日時</th><th>編集者</th><th>註</th><th>履歴容量</th></tr>';
        $html = '';
        $lines = file($fname_hist);
        $iline = 0;
        foreach ($lines as $line) {
            $fields = explode('/', $line);
            $hist_auth = htmlspecialchars(lwiki_hash($fields[0]));
            $hist_date = htmlspecialchars(urldecode($fields[1]));
            $hist_remk = htmlspecialchars(urldecode($fields[3]));
            $hist_size = (substr($fields[2], 0, 1) == '!' ? 'Δ' : '') . (strlen($line) + 1) . 'B';
            $hist_line = '<tr><td>v' . $iline . '</td>' . '<td><a href="' . htmlspecialchars(lwiki_link_page($pageid, "hist={$iline}")) . '">' . $hist_date . '</a></td>' . '<td>' . $hist_auth . '</td><td>' . $hist_remk . '</td><td>' . $hist_size . '</td></tr>';
            $html = $hist_line . PHP_EOL . $html;
            $iline++;
        }
        echo $html;
        echo '</table>' . PHP_EOL;
    } else {
        echo '<p><b>Error</b>: 履歴はありません。</p>' . PHP_EOL;
    }
}
?>
</div>
<?php 
lwiki\page\end_document();
Example #10
0
if ($h2 + 1 < count($lines)) {
    $diff_links .= '<a href="' . htmlspecialchars(lwiki_link_page($pageid, 'hist=' . ($h2 + 1))) . '">次</a>';
} else {
    $diff_links .= '<span style="color:gray;">次</span>';
}
//-----------------------------------
lwiki\page\begin_document($hist_title, '<meta name="robots" content="none" />' . PHP_EOL);
?>
<p class="lwiki-linkbar-main">
  <?php 
$url_main = htmlspecialchars(lwiki_link_page());
$url_list = htmlspecialchars(lwiki_link_page(null, 'mode=list'));
echo '[ <a href="' . $url_main . '">表紙</a>' . ' | <a href="' . $url_list . '">一覧</a> ]';
$url_read = htmlspecialchars(lwiki_link_page($pageid));
$url_edit = htmlspecialchars(lwiki_link_page($pageid, 'mode=edit'));
$url_hist = htmlspecialchars(lwiki_link_page($pageid, 'mode=hist'));
echo ' [ <a href="' . $url_read . '">' . $ht_page_title . '</a>' . ' | <a href="' . $url_edit . '">編集</a>' . ' | <a href="' . $url_hist . '">履歴</a> - 差分 ' . $diff_links . ']' . PHP_EOL;
?>
</p>
<p class="lwiki-linkbar-modified"><?php 
echo "{$hist2_date} by {$hist2_auth}";
?>
</p>
<div class="lwiki-page-content">
<?php 
if ($_hist->error_message) {
    echo $_hist->error_message;
}
?>
<h2>Wikiソース差分</h2>
<p><?php