1<?php 2/** 3 * Dokuwiki Action Plugin "Show Init Page" 4 * 5 * Show a defined Init-Page on "Access Denied" and/or Startpage 6 * 7 * @author Christian Eder <target@servus.at> 8 * @author Marcel Pennewiss <opensource@pennewiss.de> 9 * @author Till Biskup <till@till-biskup.de> 10 */ 11 12if(!defined('DOKU_INC')) die(); 13if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); 14 15require_once(DOKU_PLUGIN.'action.php'); 16 17class action_plugin_showinitpage extends DokuWiki_Action_Plugin { 18 19 /** 20 * Register its handlers with the dokuwiki's event controller 21 */ 22 function register(Doku_Event_Handler $controller) { 23 # TPL_CONTENT_DISPLAY is called before and after content of wikipage 24 # is written to output buffer 25 $controller->register_hook( 26 'ACTION_HEADERS_SEND', 'AFTER', $this, 'redirect_whole_content' 27 ); 28 } 29 30 /** 31 * Handle the event 32 */ 33 function redirect_whole_content(&$event, $param) { 34 global $ACT; 35 global $ID; 36 global $conf; 37 38 // Redirect on: 39 // Access denied + ACL = NONE + Not Searchpage + (Startpage OR not Startonly configured) 40 if (($ACT === 'denied') 41 && auth_quickaclcheck($ID) == AUTH_NONE 42 && $ACT != 'search' 43 && ($ID === $conf['start'] || $this->getConf('initpagestartonly') === 0)) 44 { 45 $rurl=$this->getConf('initpageurl'); 46 send_redirect(wl($rurl,'',true)); 47 } 48 } 49 50} 51 52