summaryrefslogtreecommitdiff
path: root/inc/init.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/init.php')
-rw-r--r--inc/init.php83
1 files changed, 29 insertions, 54 deletions
diff --git a/inc/init.php b/inc/init.php
index b53167e3c..819d92bdc 100644
--- a/inc/init.php
+++ b/inc/init.php
@@ -5,13 +5,12 @@
// start timing Dokuwiki execution
function delta_time($start=0) {
- list($usec, $sec) = explode(" ", microtime());
- return ((float)$usec+(float)$sec)-((float)$start);
+ return microtime(true)-((float)$start);
}
define('DOKU_START_TIME', delta_time());
global $config_cascade;
-$config_cascade = '';
+$config_cascade = array();
// if available load a preload config file
$preload = fullpath(dirname(__FILE__)).'/preload.php';
@@ -52,10 +51,9 @@ global $cache_authname;
global $cache_metadata;
$cache_metadata = array();
-//set the configuration cascade - but only if its not already been set in preload.php
-if (empty($config_cascade)) {
- include(DOKU_INC.'inc/config_cascade.php');
-}
+// always include 'inc/config_cascade.php'
+// previously in preload.php set fields of $config_cascade will be merged with the defaults
+include(DOKU_INC.'inc/config_cascade.php');
//prepare config array()
global $conf;
@@ -200,10 +198,6 @@ init_creationmodes();
init_paths();
init_files();
-// automatic upgrade to script versions of certain 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;
@@ -224,6 +218,9 @@ if (!defined('NOSESSION')) {
auth_setup();
}
+// setup mail system
+mail_setup();
+
/**
* Checks paths from config file
*/
@@ -277,6 +274,7 @@ 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');
@@ -291,6 +289,7 @@ function init_files(){
nice_die("$file is not writable. Check your permissions settings!");
}
}
+ */
}
/**
@@ -420,14 +419,27 @@ function getBaseURL($abs=null){
if($conf['baseurl']) return rtrim($conf['baseurl'],'/').$dir;
//split hostheader into host and port
- $addr = explode(':',$_SERVER['HTTP_HOST']);
- $host = $addr[0];
- $port = '';
- if (isset($addr[1])) {
- $port = $addr[1];
- } elseif (isset($_SERVER['SERVER_PORT'])) {
+ if(isset($_SERVER['HTTP_HOST'])){
+ $parsed_host = parse_url('http://'.$_SERVER['HTTP_HOST']);
+ $host = $parsed_host['host'];
+ $port = $parsed_host['port'];
+ }elseif(isset($_SERVER['SERVER_NAME'])){
+ $parsed_host = parse_url('http://'.$_SERVER['SERVER_NAME']);
+ $host = $parsed_host['host'];
+ $port = $parsed_host['port'];
+ }else{
+ $host = php_uname('n');
+ $port = '';
+ }
+
+ if(!$port && isset($_SERVER['SERVER_PORT'])) {
$port = $_SERVER['SERVER_PORT'];
}
+
+ if(is_null($port)){
+ $port = '';
+ }
+
if(!is_ssl()){
$proto = 'http://';
if ($port == '80') {
@@ -463,43 +475,6 @@ function is_ssl(){
}
/**
- * Append a PHP extension to a given file and adds an exit call
- *
- * This is used to migrate some old configfiles. An added PHP extension
- * ensures the contents are not shown to webusers even if .htaccess files
- * do not work
- *
- * @author Jan Decaluwe <jan@jandecaluwe.com>
- */
-function scriptify($file) {
- // checks
- if (!is_readable($file)) {
- return;
- }
- $fn = $file.'.php';
- if (@file_exists($fn)) {
- return;
- }
- $fh = fopen($fn, 'w');
- if (!$fh) {
- nice_die($fn.' is not writable. Check your permission settings!');
- }
- // write php exit hack first
- fwrite($fh, "# $fn\n");
- fwrite($fh, '# <?php exit()?>'."\n");
- fwrite($fh, "# Don't modify the lines above\n");
- fwrite($fh, "#\n");
- // copy existing lines
- $lines = file($file);
- foreach ($lines as $line){
- fwrite($fh, $line);
- }
- fclose($fh);
- //try to rename the old file
- io_rename($file,"$file.old");
-}
-
-/**
* print a nice message even if no styles are loaded yet.
*/
function nice_die($msg){