lonwiki.comとして再導入するために1.5.2(2019/09/24現在最新)を導入。
前wikiの1.5.0およびphp5.5からの対応の為にメモの再編集と追記を。
ベースは1.5.0時の設定およびプラグイン導入のメモ書きがベース。
2024/10/26追記
2024年2月頃より、バージョンを1.5.4、phpのバージョンを8.3.8にした。
それにより、動かなくなったり動作が安定しないプラグインがあったため、それも追記。
- //$script_directory_index = 'index.php'; + $script_directory_index = 'index.php';
- $modifier = 'anonymous'; + $modifier = 'ろんさん非公式wiki';
- $modifierlink = 'http://pukiwiki.example.com/'; + $modifierlink = 'https://lonwiki.com/';
- $defaultpage = 'FrontPage'; // Top / Default page + $defaultpage = 'ろんさん非公式wiki'; // Top / Default page
- $nowikiname = 0; + $nowikiname = 1;
- $attach_link = 1; + $attach_link = 0;
- $related_link = 1; + $related_link = 0;
$defaultpage表示時にページタイトルを非表示に。($defaultpageと$page_titleが同一)
67行目辺り
+ <?php if ($title !== $defaultpage) { ?>
<title><?php echo $title ?> - <?php echo $page_title ?></title>
+ <?php } else {?>
+ <title><?php echo $title ?></title>
+ <?php } ?>
padding:0px; border:0px; - margin:auto; text-align:left; color:inherit; background-color:#ccd5dd;
( # (3) url - (?:(?:https?|ftp|news):\/\/|mailto:)[\w\/\@\$()!?&%#:;.,~'=*+-]+ + (?:(?:\+?https?|\+?ftp|\+?news):\/\/|mailto:)[\w\/\@\$()!?&%#:;.,~'=*+-]+ ) (?($s1)\]\]) # close bracket EOD;418行辺り
function toString()
{
if (FALSE) {
$rel = '';
} else {
$rel = ' rel="nofollow"';
}
+ if (preg_match("/^(\+)(.*)/", $this->name, $regs)) {
+ return '<a href="' . $regs[2] . '" target="_blank"' . $rel . '>' . $this->alias . '</a>';
+ }else{
return '<a href="' . $this->name . '"' . $rel . '>' . $this->alias . '</a>';
+ }
}
PukiWiki別窓リンク参考(問題がありましたらご連絡下さい。)591行辺り
function toString()
{
return '<a href="' . $this->url . $this->anchor . '" title="' .
- $this->name . '" rel="nofollow">' . $this->alias . '</a>';
+ $this->name . '" target="_blank rel="nofollow">' . $this->alias . '</a>';
}
// Create and write diff
$oldpostdata = is_page($page) ? join('', get_source($page)) : '';
$diffdata = do_diff($oldpostdata, $postdata);
+ // add client info
+ global $now;
+ $referer = htmlspecialchars($_SERVER['HTTP_REFERER']);
+ $user_agent = htmlspecialchars($_SERVER['HTTP_USER_AGENT']);
+ $diffdata .= "IP:{$_SERVER['REMOTE_ADDR']} TIME:\"$now\" REFERER:\"$referer\" USER_AGENT:\"$user_agent\"\n";
file_write(DIFF_DIR, $page, $diffdata);
// Create backup break;
}
}
-unset($agents, $matches);
+//unset($agents, $matches);
// Profile-related init and setting
define('UA_PROFILE', isset($user_agent['profile']) ? $user_agent['profile'] : '');
美麻Wikiでシステム的に修正している点参考(問題がありましたらご連絡下さい。)class TableCell extends Element
{
var $tag = 'td'; // {td|th}
var $colspan = 1;
var $rowspan = 1;
var $style; // is array('width'=>, 'align'=>...);
+ var $class = '';
function TableCell($text, $is_template = FALSE)
{
$this->__construct($text, $is_template);
}
function __construct($text, $is_template = FALSE)
{
parent::__construct();
$this->style = $matches = array();
- while (preg_match('/^(?:(LEFT|CENTER|RIGHT)|(BG)?COLOR\((#?\w{1,20})\)|SIZE\((\d{1,2})\)|(BOLD)):(.*)$/',
+ while (preg_match('/^(?:(LEFT|CENTER|RIGHT)|(BG)?COLOR\((#?\w{1,20})\)|SIZE\((\d{1,2})\)|(BOLD)|CLASS\(([\w]+)\)):(.*)$/',
$text, $matches)) {
if ($matches[1]) {
$this->style['align'] = 'text-align:' . strtolower($matches[1]) . ';';
- $text = $matches[6];
+ $text = $matches[7];
} else if ($matches[3]) {
$name = $matches[2] ? 'background-color' : 'color';
$this->style[$name] = $name . ':' . htmlsc($matches[3]) . ';';
- $text = $matches[6];
+ $text = $matches[7];
} else if (is_numeric($matches[4])) {
$this->style['size'] = 'font-size:' . htmlsc($matches[4]) . 'px;';
- $text = $matches[6];
+ $text = $matches[7];
} else if ($matches[5]) {
$this->style['bold'] = 'font-weight:bold;';
- $text = $matches[6];
+ $text = $matches[7];
+ } else if ($matches[6]) {
+ $this->class = htmlspecialchars(strtolower($matches[6]));
+ $text = $matches[7];
+ }
} function toString()
{
if ($this->rowspan == 0 || $this->colspan == 0) return '';
- $param = ' class="style_' . $this->tag . '"';
+ if ($this->class == '') {
+ $param = ' class="style_' . $this->tag . '"'; //default
+ } else {
+ $param = ' class="' . $this->class . '"';
+ }
if ($this->rowspan > 1)
$param .= ' rowspan="' . $this->rowspan . '"';
if ($this->colspan > 1) {
$param .= ' colspan="' . $this->colspan . '"';
unset($this->style['width']);
}
if (! empty($this->style))
$param .= ' style="' . join(' ', $this->style) . '"';
return $this->wrap(parent::toString(), $this->tag, $param, FALSE);
}
}前回まではプラグインのs.inc.phpを導入していたが、1.5.2において正常に動作できなかったり、302リダイレクトを利用しているせいでURLが元に戻ってしまうため、他の方法により導入。
参考および導入サイト
PukiWikiのクソ長いURLをURL短縮ライブラリを組み込んで解決する!
こちらに詳しく書いてあるので当ページでの導入メモは省く。
トップページで階層表示がされない為、表示修正。
52行辺り
-if ($page == '' || $page == $defaultpage) return ''; +if ($page == '' || $page == $defaultpage) return PLUGIN_TOPICPATH_TOP_LABEL ." /";
78行辺り
-make_pagelink($defaultpage, PLUGIN_TOPICPATH_TOP_LABEL) . +'<a href="' . $script . '">' . PLUGIN_TOPICPATH_TOP_LABEL . '</a>' .
見た目を変更
<div class="counter">
Counter: {$counter['total']},
today: {$counter['today']},
yesterday: {$counter['yesterday']}
</div>
から
<div class="counter">
total:{$counter['total']}<br>
today:{$counter['today']}<br>
yesterday:{$counter['yesterday']}
</div>
へ変更。- font-size:70%; + font-size:100%; + text-align: right;
define('WHATDAY_HISTORY','history.csv');
を編集。#infobox([テンプレート名]){{
<キー1>=<値>
<キー2>=<値>
}}
を表示させたいページに貼り付ける。:config/plugin/infobox/テンプレート名に新規ページを作り用意する。