MediaWiki

提供: xField wiki
ナビゲーションに移動 検索に移動

匿名ユーザーのときはページと議論にする[編集]

skins/MonoBook.php

        <div id="p-cactions" class="portlet">
                <h5><?php $this->msg('views') ?></h5>
                <div class="pBody">
                        <ul><?php
                                foreach($this->data['content_actions'] as $key => $tab) {
 +                                  if  ($this->data['loggedin']==1
 +                                  or ($this->data['loggedin']==0 and $key == 'nstab-main')
 +                                  or ($this->data['loggedin']==0 and $key == 'talk')
 +                                  //or ($this->data['loggedin']==0 and $key == 'viewsource')
 +                                  //or ($this->data['loggedin']==0 and $key == 'history')
 +                                  ) {
                                        echo '
                                 <li id="' . Sanitizer::escapeId( "ca-$key" ) . '"';
                                        if( $tab['class'] ) {
                                                echo ' class="'.htmlspecialchars($tab['class']).'"';
                                        }
                                        echo '><a href="'.htmlspecialchars($tab['href']).'"';
                                        # We don't want to give the watch tab an accesskey if the
                                        # page is being edited, because that conflicts with the
                                        # accesskey on the watch checkbox.  We also don't want to
                                        # give the edit tab an accesskey, because that's fairly su-
                                        # perfluous and conflicts with an accesskey (Ctrl-E) often
                                        # used for editing in Safari.
                                        if( in_array( $action, array( 'edit', 'submit' ) )
                                        && in_array( $key, array( 'edit', 'watch', 'unwatch' ))) {
                                                echo $skin->tooltip( "ca-$key" );
                                        } else {
                                                echo $skin->tooltipAndAccesskey( "ca-$key" );
                                        }
                                        echo '>'.htmlspecialchars($tab['text']).'</a></li>';
 +                                  }
                                } ?>

                        </ul>
                </div>
        </div>

index.phpを非表示にする[編集]

LocalSetting と Apache の Rewrite を利用して行う
以下は /wiki/ にWikiがある場合の設定例です。

LocalSettings.php

$wgScriptPath   = "/wiki";
$wgArticlePath  =  "$wgScriptPath/$1";

httpd.conf

<Directory "/path/to/wiki">
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.+)$ /wiki/index.php?title=$1 [L,QSA]
</Directory>