コード例 #1
0
ファイル: mod_comment.php プロジェクト: akinomyoga/lwiki
function comment_generate_html($ipaddr, $date, $name, $body, $count)
{
    // ID
    $hash = lwiki_hash($ipaddr);
    // トリップ
    $p = mb_strpos($name, '#');
    if ($p !== false) {
        $hash .= '◆' . lwiki_hash(mb_substr($name, $p + 1), '6cf73f4c8c4d');
        $name = mb_substr($name, 0, $p);
    }
    // head
    $html_name = '<span class="comment-name">' . $name . '</span>';
    $html_date = '<span class="comment-date">' . $date . '</span>';
    $html_hash = '<span class="comment-hash">' . $hash . '</span>';
    $html_head = '<p class="comment-head" data-comment-number="' . $count . '">' . $html_name . ' ' . $html_date . ' ' . $html_hash . '</p>';
    // body
    $html_body = \lwiki\convert\convert($body);
    $html_body = preg_replace('/(^|<br\\/><br\\/>)(<br\\/>)+/', '$1', $html_body);
    $html_body = '<div class="comment-body">' . $html_body . '</div>';
    $html_holder = '<div class="comment-holder" id="lwiki-comment-' . $count . '" data-comment-source="' . htmlspecialchars($body) . '">' . $html_head . PHP_EOL . $html_body . '</div>';
    return $html_holder . PHP_EOL;
}
コード例 #2
0
ファイル: lib.lwiki.php プロジェクト: akinomyoga/lwiki
     if ($level > $config_max_level) {
         $level = $config_max_level;
         $cont = mb_substr($head, $config_max_level) . $cont;
     }
     $attrs = ' class="lwiki-header"';
     // id は " #" で指定する (前に空白を少なくとも1つ置く)。
     $id = false;
     if (preg_match('/\\s+\\#([\\-\\w._]+)$/u', $cont, $m, PREG_OFFSET_CAPTURE)) {
         $cont = substr($cont, 0, $m[0][1]);
         $id = $m[1][0];
     }
     $tag = 'h' . ($level + 1);
     $cont = $conv->iconvert($cont);
     $text = lwc_html_gettext($cont);
     if ($id === false) {
         $id = 'anchor-' . lwiki_hash($text . mt_rand(), '0f01437fac2b5f2f');
     }
     $attrs .= ' id="' . $id . '"';
     $conv->header_append($level, '<a class="lwiki-internal-link" href="#' . $id . '">' . htmlspecialchars($text) . '</a>');
     return '<' . $tag . $attrs . '>' . $cont . $partial_edit . '</' . $tag . '>' . PHP_EOL;
 case '+':
 case '-':
     $list = new lwc_list($conv);
     for (;;) {
         $result = $list->process1($head, $content, $i);
         if ($result === false) {
             return $list->html() . htmlspecialchars($head);
         }
         $pos = $i;
         if ($result === true) {
             return $list->html();
コード例 #3
0
ファイル: lib.page-edit.php プロジェクト: akinomyoga/lwiki
function _calculate_xsrfhash($edithash)
{
    global $lwiki_config_fingerPrint;
    global $lwiki_global_userIdentifier;
    return lwiki_hash($edithash . ':' . $lwiki_global_userIdentifier, $lwiki_config_fingerPrint . ':wgSzOglkPfKqmAion');
}
コード例 #4
0
ファイル: page.list.php プロジェクト: akinomyoga/lwiki
    $page_date = @lwiki_datetime(@filemtime('./.lwiki/data/' . $page));
    $url_read = htmlspecialchars(lwiki_link_page($page_id));
    $url_diff = htmlspecialchars(lwiki_link_page($page_id, 'hist=last'));
    $htmlPageName = htmlspecialchars($page_name);
    $htmlPageDate = htmlspecialchars($page_date) . ' [<a href="' . $url_diff . '">差分</a>]';
    echo '<tr><td><a href="' . $url_read . '">' . $htmlPageName . '</a></td><td></td><td>' . $htmlPageDate . '</td></tr>' . PHP_EOL;
}
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;
コード例 #5
0
ファイル: index.php プロジェクト: akinomyoga/lwiki
function page_modified_date()
{
    global $pageid, $pageinfo;
    if ($pageinfo !== false) {
        $f = explode('/', $pageinfo[0]);
        $ipaddr = $f[0];
        $date = $f[1];
    } else {
        $ipaddr = '';
        $date = @lwiki_datetime(@filemtime('.lwiki/data/page.' . $pageid . '.htm'));
    }
    $line = $date;
    if ($ipaddr != null && $ipaddr != '') {
        $line .= ' by ' . lwiki_hash($ipaddr);
    }
    return $line;
}
コード例 #6
0
ファイル: page.hist.php プロジェクト: akinomyoga/lwiki
echo page_modified_date();
?>
</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>