diff options
Diffstat (limited to 'inc/init.php')
-rw-r--r-- | inc/init.php | 89 |
1 files changed, 40 insertions, 49 deletions
diff --git a/inc/init.php b/inc/init.php index 6fb9559ce..b53167e3c 100644 --- a/inc/init.php +++ b/inc/init.php @@ -20,6 +20,9 @@ if (@file_exists($preload)) include($preload); // define the include path if(!defined('DOKU_INC')) define('DOKU_INC',fullpath(dirname(__FILE__).'/../').'/'); +// define Plugin dir +if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); + // define config path (packagers may want to change this to /etc/dokuwiki/) if(!defined('DOKU_CONF')) define('DOKU_CONF',DOKU_INC.'conf/'); @@ -51,49 +54,7 @@ global $cache_metadata; //set the configuration cascade - but only if its not already been set in preload.php if (empty($config_cascade)) { - $config_cascade = array( - 'main' => array( - 'default' => array(DOKU_CONF.'dokuwiki.php'), - 'local' => array(DOKU_CONF.'local.php'), - 'protected' => array(DOKU_CONF.'local.protected.php'), - ), - 'acronyms' => array( - 'default' => array(DOKU_CONF.'acronyms.conf'), - 'local' => array(DOKU_CONF.'acronyms.local.conf'), - ), - 'entities' => array( - 'default' => array(DOKU_CONF.'entities.conf'), - 'local' => array(DOKU_CONF.'entities.local.conf'), - ), - 'interwiki' => array( - 'default' => array(DOKU_CONF.'interwiki.conf'), - 'local' => array(DOKU_CONF.'interwiki.local.conf'), - ), - 'license' => array( - 'default' => array(DOKU_CONF.'license.php'), - 'local' => array(DOKU_CONF.'license.local.php'), - ), - 'mediameta' => array( - 'default' => array(DOKU_CONF.'mediameta.php'), - 'local' => array(DOKU_CONF.'mediameta.local.php'), - ), - 'mime' => array( - 'default' => array(DOKU_CONF.'mime.conf'), - 'local' => array(DOKU_CONF.'mime.local.conf'), - ), - 'scheme' => array( - 'default' => array(DOKU_CONF.'scheme.conf'), - 'local' => array(DOKU_CONF.'scheme.local.conf'), - ), - 'smileys' => array( - 'default' => array(DOKU_CONF.'smileys.conf'), - 'local' => array(DOKU_CONF.'smileys.local.conf'), - ), - 'wordblock' => array( - 'default' => array(DOKU_CONF.'wordblock.conf'), - 'local' => array(DOKU_CONF.'wordblock.local.conf'), - ), - ); + include(DOKU_INC.'inc/config_cascade.php'); } //prepare config array() @@ -155,8 +116,6 @@ if(!defined('DOKU_TAB')) define ('DOKU_TAB',"\t"); // define cookie and session id, append server port when securecookie is configured FS#1664 if (!defined('DOKU_COOKIE')) define('DOKU_COOKIE', 'DW'.md5(DOKU_REL.(($conf['securecookie'])?$_SERVER['SERVER_PORT']:''))); -// define Plugin dir -if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); // define main script if(!defined('DOKU_SCRIPT')) define('DOKU_SCRIPT','doku.php'); @@ -245,6 +204,25 @@ init_files(); scriptify(DOKU_CONF.'users.auth'); scriptify(DOKU_CONF.'acl.auth'); +// setup plugin controller class (can be overwritten in preload.php) +$plugin_types = array('admin','syntax','action','renderer', 'helper'); +global $plugin_controller_class, $plugin_controller; +if (empty($plugin_controller_class)) $plugin_controller_class = 'Doku_Plugin_Controller'; + +// load libraries +require_once(DOKU_INC.'inc/load.php'); + +// initialize plugin controller +$plugin_controller = new $plugin_controller_class(); + +// initialize the event handler +global $EVENT_HANDLER; +$EVENT_HANDLER = new Doku_Event_Handler(); + +// setup authentication system +if (!defined('NOSESSION')) { + auth_setup(); +} /** * Checks paths from config file @@ -284,7 +262,7 @@ function init_paths(){ function init_files(){ global $conf; - $files = array( $conf['indexdir'].'/page.idx'); + $files = array($conf['indexdir'].'/page.idx'); foreach($files as $file){ if(!@file_exists($file)){ @@ -297,6 +275,22 @@ function init_files(){ } } } + + # create title index (needs to have same length as page.idx) + $file = $conf['indexdir'].'/title.idx'; + if(!@file_exists($file)){ + $pages = file($conf['indexdir'].'/page.idx'); + $pages = count($pages); + $fh = @fopen($file,'a'); + if($fh){ + for($i=0; $i<$pages; $i++){ + fwrite($fh,"\n"); + } + fclose($fh); + }else{ + nice_die("$file is not writable. Check your permissions settings!"); + } + } } /** @@ -526,7 +520,6 @@ EOT; exit; } - /** * A realpath() replacement * @@ -588,5 +581,3 @@ function fullpath($path,$exists=false){ return $finalpath; } - - |