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; }
header('Location: ' . lwiki_link_page($pageid)); // flush post data } exit; case 'list': include '.lwiki/lib/page.list.php'; exit; case 'hist': include '.lwiki/lib/page.hist.php'; exit; case 'convert': // (preview 等の実装用に content を変換する) require_once '.lwiki/lib/lib.lwiki.php'; require_once '.lwiki/lib/lib.page.php'; /* for \lwiki\page\generate_dynamic_link() */ lwiki_include_string(lwiki\convert\convert($_POST['content'])); exit; default: if (@$_GET['hist'] != '') { 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(); } }
$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; echo ' <input type="submit" name="page_preview" value="プレビュー" />'; echo ' <input type="submit" name="page_update" value="保存" /></div>'; echo '</form>'; //if($_POST['page_preview']||$_POST['page_update']){ require_once '.lwiki/lib/lib.lwiki.php'; echo '<hr/>' . PHP_EOL; echo '<div class="lwiki-page-preview" id="lwiki_page_preview">'; echo '<h1 id="lwiki_page_preview_head">プレビュー:' . $ht_page_title . ($frag_partlength ? ' (部分)' : '') . '</h1>'; lwiki_include_string(\lwiki\convert\convert($edit_session->content())); echo '</div>'; //} echo '</div><!-- end of .lwiki-page-content -->'; lwiki\page\end_document();
lwiki_swap($h1, $h2); } $fields1 = $_hist->get_fields($h1); $hist1_auth = htmlspecialchars(lwiki_hash($fields1[0])); $hist1_date = htmlspecialchars(urldecode($fields1[1])); $_hist->get_source($hist1_wiki, $h1); } else { $hist1_auth = '--'; $hist1_date = '--'; $hist1_wiki = ''; } $fields2 = $_hist->get_fields($h2); $hist2_auth = htmlspecialchars(lwiki_hash($fields2[0])); $hist2_date = htmlspecialchars(urldecode($fields2[1])); $_hist->get_source($hist2_wiki, $h2); $hist2_html = \lwiki\convert\convert($hist2_wiki); $hist_diff = ldiff_lines_lwiki($hist1_wiki, $hist2_wiki); //----------------------------------- // linkbars $h2text = 'v' . $h2; $h1text = $h1 !== false ? 'v' . $h1 : '無'; $hist_title = "差分:{$ht_page_title} ({$h2text}/{$h1text})"; $diff_links = ''; if ($h2 >= 1) { $diff_links .= '<a href="' . htmlspecialchars(lwiki_link_page($pageid, 'hist=' . ($h2 - 1))) . '">前</a>'; } else { $diff_links .= ' <span style="color:gray;">前</span>'; } $diff_links .= " <b>({$h2text}/{$h1text})</b> "; if ($h2 + 1 < count($lines)) { $diff_links .= '<a href="' . htmlspecialchars(lwiki_link_page($pageid, 'hist=' . ($h2 + 1))) . '">次</a>';