Dokuwikiのコメント欄が大荒れした時に2chの掲示板のようにID表示のための設定を行いました。
環境
- サーバ構成
- CentOS Linux release 7.4.1708
- Apache 2.4.6
- PHP 7.0.24
- Dokuwikiについて
- 配置場所は/var/www/html/dokuwiki
- DokuwikiのリリースネームはFrusterick Manners
手順
- /var/www/html/dokuwiki/lib/plugins/discussion/action.phpの279行目あたり
$comment['user']['id'] = substr(hash('sha256',hsc($_REQUEST['user'])),0,8);
//$comment['user']['id'] = $_SERVER['REMOTE_USER'];
$comment['user']['id'] = substr(hash('sha256',hsc($_REQUEST['user'])),0,8);
//$comment['user']['id'] = 'test'.hsc($_REQUEST['user']);
- /var/www/html/dokuwiki/lib/plugins/discussion/action.phpの821行目あたり
if ($this->getConf('linkemail') && $mail) {
$head .= $this->email($mail, $showname, 'email fn');
} elseif ($url) {
$head .= $this->external_link($this->_checkURL($url), $showname, 'urlextern url fn');
} else {
$head .= '<span class="fn">'.$showname.'</span>';
}
//追加
if ($user) {
$head .= '<span class="id"> ID:'.$user.'</span>';
}
//ここまで
if ($address) {
$head .= ', <span class="adr">'.$address.'</span>';
}
CDN(CloudFlare)を使っている場合
IPアドレスがxxx.xxx.xxx.xxx,yyy.yyy.yyy.yyyのように通知されますので下記のように対応しました。
- /var/www/html/dokuwiki/lib/plugins/discussion/action.phpの279行目あたり
$comment['user']['id'] = substr(hash('sha256',strstr(hsc($_REQUEST['user']),',')),0,8);
//$comment['user']['id'] = $_SERVER['REMOTE_USER'];
$comment['user']['id'] = substr(hash('sha256',strstr(hsc($_REQUEST['user']),',')),0,8);
//$comment['user']['id'] = 'test'.hsc($_REQUEST['user']);
- /var/www/html/dokuwiki/lib/plugins/discussion/action.phpの821行目あたり
if ($this->getConf('linkemail') && $mail) {
$head .= $this->email($mail, $showname, 'email fn');
} elseif ($url) {
$head .= $this->external_link($this->_checkURL($url), $showname, 'urlextern url fn');
} else {
$head .= '<span class="fn">'.$showname.'</span>';
}
//追加
if ($user) {
$head .= '<span class="id"> ID:'.$user.'</span>';
}
//ここまで
if ($address) {
$head .= ', <span class="adr">'.$address.'</span>';
}
コメント
Fabulous, what a web site it is! This weblog gives useful
data to us, keep it up.
It’s difficult to find knowledgeable people for this subject, however, you seem like you know what you’re talking about! Thanks|