diff --git a/inc/admin_acl.php b/inc/admin_acl.php index 15332b3b4..7027fe8dc 100644 --- a/inc/admin_acl.php +++ b/inc/admin_acl.php @@ -43,7 +43,7 @@ function admin_acl_handler(){ } // reload ACL config - $AUTH_ACL = file(DOKU_INC.'conf/acl.auth.php'); + $AUTH_ACL = file(DOKU_CONF.'acl.auth.php'); } /** @@ -117,7 +117,7 @@ function get_acl_config($id){ * @author Frank Schubert */ function admin_acl_add($acl_scope, $acl_user, $acl_level){ - $acl_config = join("",file(DOKU_INC.'conf/acl.auth.php')); + $acl_config = join("",file(DOKU_CONF.'acl.auth.php')); // max level for pagenames is edit if(strpos($acl_scope,'*') === false) { @@ -128,7 +128,7 @@ function admin_acl_add($acl_scope, $acl_user, $acl_level){ $new_config = $acl_config.$new_acl; - return io_saveFile(DOKU_INC.'conf/acl.auth.php', $new_config); + return io_saveFile(DOKU_CONF.'acl.auth.php', $new_config); } /** @@ -137,14 +137,14 @@ function admin_acl_add($acl_scope, $acl_user, $acl_level){ * @author Frank Schubert */ function admin_acl_del($acl_scope, $acl_user){ - $acl_config = file(DOKU_INC.'conf/acl.auth.php'); + $acl_config = file(DOKU_CONF.'acl.auth.php'); $acl_pattern = '^'.preg_quote($acl_scope,'/').'\s+'.$acl_user.'\s+[0-8].*$'; // save all non!-matching #FIXME invert is available from 4.2.0 only! $new_config = preg_grep("/$acl_pattern/", $acl_config, PREG_GREP_INVERT); - return io_saveFile(DOKU_INC.'conf/acl.auth.php', join('',$new_config)); + return io_saveFile(DOKU_CONF.'acl.auth.php', join('',$new_config)); } // --- HTML OUTPUT FUNCTIONS BELOW --- // diff --git a/inc/auth.php b/inc/auth.php index 020520004..463d947a2 100644 --- a/inc/auth.php +++ b/inc/auth.php @@ -31,8 +31,8 @@ if($conf['useacl']){ auth_login($_REQUEST['u'],$_REQUEST['p'],$_REQUEST['r']); //load ACL into a global array - if(is_readable(DOKU_INC.'conf/acl.auth.php')){ - $AUTH_ACL = file(DOKU_INC.'conf/acl.auth.php'); + if(is_readable(DOKU_CONF.'acl.auth.php')){ + $AUTH_ACL = file(DOKU_CONF.'acl.auth.php'); }else{ $AUTH_ACL = array(); } diff --git a/inc/auth/plain.php b/inc/auth/plain.php index 039fb422d..6178f1260 100644 --- a/inc/auth/plain.php +++ b/inc/auth/plain.php @@ -73,7 +73,7 @@ function auth_createUser($user,$pass,$name,$mail){ $mail, $conf['defaultgroup'])); $userline .= "\n"; - $fh = fopen(DOKU_INC.'conf/users.auth.php','a'); + $fh = fopen(DOKU_CONF.'users.auth.php','a'); if($fh){ fwrite($fh,$userline); fclose($fh); @@ -93,10 +93,10 @@ function auth_createUser($user,$pass,$name,$mail){ */ function auth_plain_loadUserData(){ $data = array(); - if(!@file_exists(DOKU_INC.'conf/users.auth.php')){ + if(!@file_exists(DOKU_CONF.'users.auth.php')){ return $data; } - $lines = file(DOKU_INC.'conf/users.auth.php'); + $lines = file(DOKU_CONF.'users.auth.php'); foreach($lines as $line){ $line = preg_replace('/#.*$/','',$line); //ignore comments $line = trim($line); diff --git a/inc/common.php b/inc/common.php index eadef5767..ad4de9ffd 100644 --- a/inc/common.php +++ b/inc/common.php @@ -7,7 +7,7 @@ */ if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/'); - require_once(DOKU_INC.'conf/dokuwiki.php'); + require_once(DOKU_CONF.'dokuwiki.php'); require_once(DOKU_INC.'inc/io.php'); require_once(DOKU_INC.'inc/utf8.php'); require_once(DOKU_INC.'inc/mail.php'); @@ -286,7 +286,7 @@ function checkwordblock(){ if(!$conf['usewordblock']) return false; - $blockfile = file(DOKU_INC.'conf/wordblock.conf'); + $blockfile = file(DOKU_CONF.'wordblock.conf'); //how many lines to read at once (to work around some PCRE limits) if(version_compare(phpversion(),'4.3.0','<')){ //old versions of PCRE define a maximum of parenthesises even if no @@ -860,7 +860,7 @@ function check(){ msg('Cachedir is not writable',-1); } - if(is_writable(DOKU_INC.'conf/users.auth.php')){ + if(is_writable(DOKU_CONF.'users.auth.php')){ msg('conf/users.auth.php is writable',1); }else{ msg('conf/users.auth.php is not writable',0); diff --git a/inc/confutils.php b/inc/confutils.php index 2bcd90b6b..1415d48f6 100644 --- a/inc/confutils.php +++ b/inc/confutils.php @@ -36,9 +36,9 @@ function mimetype($file){ function getMimeTypes() { static $mime = NULL; if ( !$mime ) { - $mime = confToHash(DOKU_INC . 'conf/mime.conf'); - if (@file_exists(DOKU_INC . 'conf/mime.local.conf')) { - $local = confToHash(DOKU_INC . 'conf/mime.local.conf'); + $mime = confToHash(DOKU_CONF.'mime.conf'); + if (@file_exists(DOKU_CONF.'mime.local.conf')) { + $local = confToHash(DOKU_CONF.'mime.local.conf'); $mime = array_merge($mime, $local); } } @@ -53,9 +53,9 @@ function getMimeTypes() { function getAcronyms() { static $acronyms = NULL; if ( !$acronyms ) { - $acronyms = confToHash(DOKU_INC . 'conf/acronyms.conf'); - if (@file_exists(DOKU_INC . 'conf/acronyms.local.conf')) { - $local = confToHash(DOKU_INC . 'conf/acronyms.local.conf'); + $acronyms = confToHash(DOKU_CONF.'acronyms.conf'); + if (@file_exists(DOKU_CONF.'acronyms.local.conf')) { + $local = confToHash(DOKU_CONF.'acronyms.local.conf'); $acronyms = array_merge($acronyms, $local); } } @@ -70,9 +70,9 @@ function getAcronyms() { function getSmileys() { static $smileys = NULL; if ( !$smileys ) { - $smileys = confToHash(DOKU_INC . 'conf/smileys.conf'); - if (@file_exists(DOKU_INC . 'conf/smileys.local.conf')) { - $local = confToHash(DOKU_INC . 'conf/smileys.local.conf'); + $smileys = confToHash(DOKU_CONF.'smileys.conf'); + if (@file_exists(DOKU_CONF.'smileys.local.conf')) { + $local = confToHash(DOKU_CONF.'smileys.local.conf'); $smileys = array_merge($smileys, $local); } } @@ -87,9 +87,9 @@ function getSmileys() { function getEntities() { static $entities = NULL; if ( !$entities ) { - $entities = confToHash(DOKU_INC . 'conf/entities.conf'); - if (@file_exists(DOKU_INC . 'conf/entities.local.conf')) { - $local = confToHash(DOKU_INC . 'conf/entities.local.conf'); + $entities = confToHash(DOKU_CONF.'entities.conf'); + if (@file_exists(DOKU_CONF.'entities.local.conf')) { + $local = confToHash(DOKU_CONF.'entities.local.conf'); $entities = array_merge($entities, $local); } } @@ -104,9 +104,9 @@ function getEntities() { function getInterwiki() { static $wikis = NULL; if ( !$wikis ) { - $wikis = confToHash(DOKU_INC . 'conf/interwiki.conf',true); - if (@file_exists(DOKU_INC . 'conf/interwiki.local.conf')) { - $local = confToHash(DOKU_INC . 'conf/interwiki.local.conf'); + $wikis = confToHash(DOKU_CONF.'interwiki.conf',true); + if (@file_exists(DOKU_CONF.'interwiki.local.conf')) { + $local = confToHash(DOKU_CONF.'interwiki.local.conf'); $wikis = array_merge($wikis, $local); } } diff --git a/inc/init.php b/inc/init.php index 370e308b7..4e59cdbe1 100644 --- a/inc/init.php +++ b/inc/init.php @@ -6,6 +6,9 @@ // define the include path if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/'); + // define config path (packagers may want to change this to /etc/dokuwiki/) + if(!defined('DOKU_CONF')) define('DOKU_CONF',DOKU_INC.'/conf/'); + // set up error reporting to sane values error_reporting(E_ALL ^ E_NOTICE); @@ -14,8 +17,8 @@ $conf = array(); // load the config file(s) - require_once(DOKU_INC.'conf/dokuwiki.php'); - @include_once(DOKU_INC.'conf/local.php'); + require_once(DOKU_CONF.'dokuwiki.php'); + @include_once(DOKU_CONF.'local.php'); //prepare language array global $lang; @@ -70,8 +73,8 @@ init_paths(); // automatic upgrade to script versions of certain files - scriptify(DOKU_INC.'conf/users.auth'); - scriptify(DOKU_INC.'conf/acl.auth'); + scriptify(DOKU_CONF.'users.auth'); + scriptify(DOKU_CONF.'acl.auth'); /** diff --git a/inc/parserutils.php b/inc/parserutils.php index 349e83725..1bf36c5fd 100644 --- a/inc/parserutils.php +++ b/inc/parserutils.php @@ -78,8 +78,8 @@ function p_cached_xhtml($file){ && ((time() - $cachetime) < $conf['cachetime']) // and is cachefile young enough && !isset($_REQUEST['purge']) // no purge param was set && ($cachetime > @filemtime($purge)) // and newer than the purgefile - && ($cachetime > @filemtime(DOKU_INC.'conf/dokuwiki.php')) // newer than the config file - && ($cachetime > @filemtime(DOKU_INC.'conf/local.php')) // newer than the local config file + && ($cachetime > @filemtime(DOKU_CONF.'dokuwiki.php')) // newer than the config file + && ($cachetime > @filemtime(DOKU_CONF.'local.php')) // newer than the local config file && ($cachetime > @filemtime(DOKU_INC.'inc/parser/xhtml.php')) // newer than the renderer && ($cachetime > @filemtime(DOKU_INC.'inc/parser/parser.php')) // newer than the parser && ($cachetime > @filemtime(DOKU_INC.'inc/parser/handler.php')))// newer than the handler @@ -128,8 +128,8 @@ function p_cached_instructions($file,$cacheonly=false){ if( @file_exists($file) // does the source exist && $cachetime > @filemtime($file) // cache is fresh && !isset($_REQUEST['purge']) // no purge param was set - && ($cachetime > @filemtime(DOKU_INC.'conf/dokuwiki.php')) // newer than the config file - && ($cachetime > @filemtime(DOKU_INC.'conf/local.php')) // newer than the local config file + && ($cachetime > @filemtime(DOKU_CONF.'dokuwiki.php')) // newer than the config file + && ($cachetime > @filemtime(DOKU_CONF.'local.php')) // newer than the local config file && ($cachetime > @filemtime(DOKU_INC.'inc/parser/parser.php')) // newer than the parser && ($cachetime > @filemtime(DOKU_INC.'inc/parser/handler.php')))// newer than the handler { diff --git a/inc/template.php b/inc/template.php index ac5ea3d67..2d465e3d3 100644 --- a/inc/template.php +++ b/inc/template.php @@ -7,7 +7,7 @@ */ if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/'); - require_once(DOKU_INC.'conf/dokuwiki.php'); + require_once(DOKU_CONF.'dokuwiki.php'); /** * Wrapper around htmlspecialchars()