From 195b28c865907362e81dbf0fbaf96f340bbc4631 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Mon, 18 Oct 2010 22:07:31 +0200 Subject: remove deprecated scriptify() mechanism --- inc/init.php | 41 ----------------------------------------- 1 file changed, 41 deletions(-) (limited to 'inc/init.php') diff --git a/inc/init.php b/inc/init.php index b53167e3c..bf7815178 100644 --- a/inc/init.php +++ b/inc/init.php @@ -200,10 +200,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; @@ -462,43 +458,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 - */ -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, '# '."\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. */ -- cgit v1.2.3 From 5ec3fefc5fc0983d6fdc0efdaed2e78e0d09a868 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Fri, 5 Nov 2010 11:18:31 +0100 Subject: handle mailfrom replacements in a central place FS#2091 --- inc/init.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'inc/init.php') diff --git a/inc/init.php b/inc/init.php index bf7815178..ed4409729 100644 --- a/inc/init.php +++ b/inc/init.php @@ -220,6 +220,9 @@ if (!defined('NOSESSION')) { auth_setup(); } +// setup mail system +mail_setup(); + /** * Checks paths from config file */ -- cgit v1.2.3 From 5627186c2f8b450460892f0247dbbb5f8d4369b4 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Sat, 18 Dec 2010 10:07:04 +0100 Subject: more robust hostname detection as discussed in http://www.freelists.org/post/dokuwiki/git-changes-20101209,7 --- inc/init.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'inc/init.php') diff --git a/inc/init.php b/inc/init.php index ed4409729..3b438f15b 100644 --- a/inc/init.php +++ b/inc/init.php @@ -419,12 +419,16 @@ 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'])){ + list($host,$port) = explode(':',$_SERVER['HTTP_HOST']); + }elseif(isset($_SERVER['SERVER_NAME'])){ + list($host,$port) = explode(':',$_SERVER['SERVER_NAME']); + }else{ + $host = php_uname('n'); + $port = ''; + } + + if(!$port && isset($_SERVER['SERVER_PORT'])) { $port = $_SERVER['SERVER_PORT']; } if(!is_ssl()){ -- cgit v1.2.3 From 9b41be2446ea725a496f34b28ac4db84bece57c9 Mon Sep 17 00:00:00 2001 From: Tom N Harris Date: Wed, 29 Dec 2010 03:50:05 -0500 Subject: Indexer v3 Rewrite part two, update uses of indexer --- inc/init.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'inc/init.php') diff --git a/inc/init.php b/inc/init.php index ed4409729..1dc31a31f 100644 --- a/inc/init.php +++ b/inc/init.php @@ -276,6 +276,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'); @@ -290,6 +291,7 @@ function init_files(){ nice_die("$file is not writable. Check your permissions settings!"); } } + */ } /** -- cgit v1.2.3 From 204b27c8e0c1bcfa6810ee45bd12fda3f5d83960 Mon Sep 17 00:00:00 2001 From: Michael Hamann Date: Sun, 16 Jan 2011 22:23:54 +0100 Subject: Fix getBaseURL for literal IPv6 addresses in URLs (RFC 2732) + test case --- inc/init.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'inc/init.php') diff --git a/inc/init.php b/inc/init.php index 3b438f15b..6f4ba1ca9 100644 --- a/inc/init.php +++ b/inc/init.php @@ -420,9 +420,13 @@ function getBaseURL($abs=null){ //split hostheader into host and port if(isset($_SERVER['HTTP_HOST'])){ - list($host,$port) = explode(':',$_SERVER['HTTP_HOST']); + $parsed_host = parse_url('http://'.$_SERVER['HTTP_HOST']); + $host = $parsed_host['host']; + $port = $parsed_host['port']; }elseif(isset($_SERVER['SERVER_NAME'])){ - list($host,$port) = explode(':',$_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 = ''; @@ -431,6 +435,11 @@ function getBaseURL($abs=null){ if(!$port && isset($_SERVER['SERVER_PORT'])) { $port = $_SERVER['SERVER_PORT']; } + + if(is_null($port)){ + $port = ''; + } + if(!is_ssl()){ $proto = 'http://'; if ($port == '80') { -- cgit v1.2.3 From cca94fbcfc035dabe5597e8565671c84862268e9 Mon Sep 17 00:00:00 2001 From: Roland Hager Date: Sun, 6 Feb 2011 19:57:16 +0000 Subject: made config cascade more flexible --- inc/init.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'inc/init.php') diff --git a/inc/init.php b/inc/init.php index 6f4ba1ca9..d632bd8f8 100644 --- a/inc/init.php +++ b/inc/init.php @@ -11,7 +11,7 @@ function delta_time($start=0) { 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 +52,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; -- cgit v1.2.3 From ac4be4d7b593a3b1762bd1ffb4f6ac9a5f22edd4 Mon Sep 17 00:00:00 2001 From: Piyush Mishra Date: Mon, 21 Mar 2011 19:18:34 +0530 Subject: Minor: Edited the delta_time function for php5 --- inc/init.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'inc/init.php') diff --git a/inc/init.php b/inc/init.php index 772f85c77..819d92bdc 100644 --- a/inc/init.php +++ b/inc/init.php @@ -5,8 +5,7 @@ // 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()); -- cgit v1.2.3