DOKU_CONF define for config directory #479

darcs-hash:20050729155457-7ad00-94554865259e4cbd6a1c75bb62a93f37304adbf0.gz
This commit is contained in:
Andreas Gohr 2005-07-29 17:54:57 +02:00
parent 9f830448ee
commit e7cb32dcb5
8 changed files with 40 additions and 37 deletions

View File

@ -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 <frank@schokilade.de>
*/
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 <frank@schokilade.de>
*/
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 --- //

View File

@ -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();
}

View File

@ -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);

View File

@ -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);

View File

@ -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);
}
}

View File

@ -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');
/**

View File

@ -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
{

View File

@ -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()