目录

关闭sitemap

1. 通过disable action实现

在local.php文件中输入以下内容,即可关闭sitemap网站地图功能

$conf['disableactions'] = 'index';

注:这个是全局性的行为,即永久关闭sitemap功能,不会因为登录用户的不同而呈现不同的行为。

2. 修改源码实现(推荐方式)

修改文件 inc / Menu / SiteMenu.php,实现仅管理员可以使用'Recent', 'Media', 'Index'功能。

    protected $types = array(
        //'Recent', // comment out stuff not required
        //'Media',
        //'Index'     // leave sitemap for spiders
    );
 
    // add this function
    // remove the "&& $INFO['isadmin']" to allow all logged in users to see options
    public function __construct(){
        global $INPUT;
        global $INFO;
        if($INPUT->server->str('REMOTE_USER') && $INFO['isadmin']){
            $this->types = array( 'Recent', 'Media', 'Index' );
        }
    }

功能说明:

标识 功能说明
index sitemap
recent 列出最近修改
media 媒体管理器

2.1 我自己的修改代码

修改文件 inc / Menu / SiteMenu.php,实现仅vip组的用户可以使用'Recent', 'Media', 'Index'功能。

    // remove the "&& $INFO['isadmin']" to allow all logged in users to see options
    public function __construct(){
        global $INPUT;
        global $INFO;
 
        #如果是管理员
        #if($INPUT->server->str('REMOTE_USER') && $INFO['isadmin']){
      
        #用户命名
        #if($INPUT->server->str('REMOTE_USER') && ($INFO['userinfo']['name'] == 'xxx')){
      
        #用户组数组第0个
        if($INPUT->server->str('REMOTE_USER') && ($INFO['userinfo']['grps'][0] == 'vip')){
            $this->types = array( 'Recent', 'Media', 'Index' );
        }
    }

Action Modes aka. do Modes

List of possible action modes (may be incomplete yet) with their descriptions. These actions are usually caused by supplying an according ?do= parameter to the doku.php dispatcher. The knowledge of the current mode may be useful for making templates more dynamic or write action plugins. The current can be accessed via the global $ACT variable.

The action modes are handled in the Action Router.

The description at this page should reflect the state of the last released version of DokuWiki. Changes between versions (very rare) can be inspected by comparing the code of releases at https://github.com/splitbrain/dokuwiki/releases.

Page actions

editing process

other functions

Site actions

main functions

different views