*/ function remove_magic_quotes(&$array) { foreach (array_keys($array) as $key) { if (is_array($array[$key])) { remove_magic_quotes($array[$key]); }else { $array[$key] = stripslashes($array[$key]); } } } /** * Returns the full absolute URL to the directory where * DokuWiki is installed in (includes a trailing slash) * * @author Andreas Gohr */ function getBaseURL($abs=false){ global $conf; //if canonical url enabled always return absolute if($conf['canonical']) $abs = true; if($conf['basedir']){ $dir = $conf['basedir']; }elseif($_SERVER['DOCUMENT_ROOT'] && $_SERVER['SCRIPT_FILENAME']){ $dir = preg_replace ('/^'.preg_quote($_SERVER['DOCUMENT_ROOT'],'/').'/','', $_SERVER['SCRIPT_FILENAME']); $dir = dirname('/'.$dir).'/'; }else{ $dir = dirname($_SERVER['PHP_SELF']).'/'; } $dir = str_replace('\\','/',$dir); #bugfix for weird WIN behaviour $dir = preg_replace('#//+#','/',$dir); //finish here for relative URLs if(!$abs) return $dir; $port = ':'.$_SERVER['SERVER_PORT']; //remove port from hostheader as sent by IE $host = preg_replace('/:.*$/','',$_SERVER['HTTP_HOST']); // see if HTTPS is enabled - apache leaves this empty when not available, // IIS sets it to 'off', 'false' and 'disabled' are just guessing if (preg_match('/^(|off|false|disabled)$/i',$_SERVER['HTTPS'])){ $proto = 'http://'; if ($_SERVER['SERVER_PORT'] == '80') { $port=''; } }else{ $proto = 'https://'; if ($_SERVER['SERVER_PORT'] == '443') { $port=''; } } return $proto.$host.$port.$dir; } //Setup VIM: ex: et ts=2 enc=utf-8 :