From c66972f2cb89e65a8bbf8e39d42e8e479f7eb8dc Mon Sep 17 00:00:00 2001 From: Adrian Lang Date: Wed, 4 Nov 2009 11:01:15 +0100 Subject: Emit less E_NOTICEs and E_STRICTs Changes of behaviour are: * Allow the user name, title & description \e2\80\9c0\e2\80\9d * Default to Port 443 if using HTTPS * Set $INFO['isadmin'] and $INFO['ismanager'] to \e2\80\9cfalse\e2\80\9d even if no user is logged in * Do not pass empty fragment field in the event data for event ACTION_SHOW_REDIRECT * Handle chunked encoding in HTTPClient darcs-hash:20091104100115-e4919-5cf6397d4a457e3f98a8ca49fbdab03f2147721d.gz --- inc/init.php | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'inc/init.php') diff --git a/inc/init.php b/inc/init.php index 32a3d46a9..6fb9559ce 100644 --- a/inc/init.php +++ b/inc/init.php @@ -219,7 +219,7 @@ if (get_magic_quotes_gpc() && !defined('MAGIC_QUOTES_STRIPPED')) { $_REQUEST = array_merge($_GET,$_POST); // we don't want a purge URL to be digged -if($_REQUEST['purge'] && $_SERVER['HTTP_REFERER']) unset($_REQUEST['purge']); +if(isset($_REQUEST['purge']) && $_SERVER['HTTP_REFERER']) unset($_REQUEST['purge']); // disable gzip if not available if($conf['compression'] == 'bz2' && !function_exists('bzopen')){ @@ -413,8 +413,8 @@ function getBaseURL($abs=null){ $dir = str_replace('\\','/',$dir); // bugfix for weird WIN behaviour $dir = preg_replace('#//+#','/',"/$dir/"); // ensure leading and trailing slashes - //handle script in lib/exe dir - $dir = preg_replace('!lib/exe/$!','',$dir); + //handle script in lib/exe dir + $dir = preg_replace('!lib/exe/$!','',$dir); //handle script in lib/plugins dir $dir = preg_replace('!lib/plugins/.*$!','',$dir); @@ -426,23 +426,27 @@ function getBaseURL($abs=null){ if($conf['baseurl']) return rtrim($conf['baseurl'],'/').$dir; //split hostheader into host and port - list($host,$port) = explode(':',$_SERVER['HTTP_HOST']); - if(!$port) $port = $_SERVER['SERVER_PORT']; - if(!$port) $port = 80; - + $addr = explode(':',$_SERVER['HTTP_HOST']); + $host = $addr[0]; + $port = ''; + if (isset($addr[1])) { + $port = $addr[1]; + } elseif (isset($_SERVER['SERVER_PORT'])) { + $port = $_SERVER['SERVER_PORT']; + } if(!is_ssl()){ $proto = 'http://'; if ($port == '80') { - $port=''; + $port = ''; } }else{ $proto = 'https://'; if ($port == '443') { - $port=''; + $port = ''; } } - if($port) $port = ':'.$port; + if($port !== '') $port = ':'.$port; return $proto.$host.$port.$dir; } @@ -456,7 +460,8 @@ function getBaseURL($abs=null){ * @returns bool true when SSL is active */ function is_ssl(){ - if (preg_match('/^(|off|false|disabled)$/i',$_SERVER['HTTPS'])){ + if (!isset($_SERVER['HTTPS']) || + preg_match('/^(|off|false|disabled)$/i',$_SERVER['HTTPS'])){ return false; }else{ return true; -- cgit v1.2.3