diff options
-rw-r--r-- | inc/HTTPClient.php | 17 | ||||
-rw-r--r-- | inc/auth.php | 5 | ||||
-rw-r--r-- | inc/auth/ad.class.php | 2 | ||||
-rw-r--r-- | inc/html.php | 10 |
4 files changed, 20 insertions, 14 deletions
diff --git a/inc/HTTPClient.php b/inc/HTTPClient.php index 43b00034c..a9afef9f9 100644 --- a/inc/HTTPClient.php +++ b/inc/HTTPClient.php @@ -222,7 +222,7 @@ class HTTPClient { $path = $uri['path']; if(empty($path)) $path = '/'; if(!empty($uri['query'])) $path .= '?'.$uri['query']; - $port = $uri['port']; + if(isset($uri['port']) && !empty($uri['port'])) $port = $uri['port']; if(isset($uri['user'])) $this->user = $uri['user']; if(isset($uri['pass'])) $this->pass = $uri['pass']; @@ -235,7 +235,7 @@ class HTTPClient { }else{ $request_url = $path; $server = $server; - if (empty($port)) $port = ($uri['scheme'] == 'https') ? 443 : 80; + if (!isset($port)) $port = ($uri['scheme'] == 'https') ? 443 : 80; } // add SSL stream prefix if needed - needs SSL support in PHP @@ -506,12 +506,13 @@ class HTTPClient { */ function _parseHeaders($string){ $headers = array(); - $lines = explode("\n",$string); - foreach($lines as $line){ - list($key,$val) = explode(':',$line,2); - $key = strtolower(trim($key)); - $val = trim($val); - if(empty($val)) continue; + if (!preg_match_all('/^\s*([\w-]+)\s*:\s*([\S \t]+)\s*$/m', $string, + $matches, PREG_SET_ORDER)) { + return $headers; + } + foreach($matches as $match){ + list(, $key, $val) = $match; + $key = strtolower($key); if(isset($headers[$key])){ if(is_array($headers[$key])){ $headers[$key][] = $val; diff --git a/inc/auth.php b/inc/auth.php index 6bc4f8673..f2de4424e 100644 --- a/inc/auth.php +++ b/inc/auth.php @@ -194,10 +194,11 @@ function auth_login($user,$pass,$sticky=false,$silent=false){ }else{ // read cookie information list($user,$sticky,$pass) = auth_getCookie(); - // get session info - $session = $_SESSION[DOKU_COOKIE]['auth']; if($user && $pass){ // we got a cookie - see if we can trust it + + // get session info + $session = $_SESSION[DOKU_COOKIE]['auth']; if(isset($session) && $auth->useSessionCache($user) && ($session['time'] >= time()-$conf['auth_security_timeout']) && diff --git a/inc/auth/ad.class.php b/inc/auth/ad.class.php index 41e9d854b..5478d64b9 100644 --- a/inc/auth/ad.class.php +++ b/inc/auth/ad.class.php @@ -126,7 +126,7 @@ class auth_ad extends auth_basic { * at least these fields: * * name string full name of the user - * mail string email addres of the user + * mail string email address of the user * grps array list of groups the user is in * * This LDAP specific function returns the following diff --git a/inc/html.php b/inc/html.php index 1e02ac9ce..98ee8a496 100644 --- a/inc/html.php +++ b/inc/html.php @@ -876,7 +876,7 @@ function html_diff($text='',$intro=true){ // array in rev2. $rev1 = $REV; - if(is_array($_REQUEST['rev2'])){ + if (is_array($_REQUEST['rev2'])){ $rev1 = (int) $_REQUEST['rev2'][0]; $rev2 = (int) $_REQUEST['rev2'][1]; @@ -948,8 +948,12 @@ function html_diff($text='',$intro=true){ '<br />'.$l_user.' '.$l_sum; } - if($r_rev){ - $r_info = getRevisionInfo($ID,$r_rev,true); + $_r_rev = $r_rev; + if (!$_r_rev) { + $_r_rev = @filemtime(wikiFN($ID)); + } + if($_r_rev){ + $r_info = getRevisionInfo($ID,$_r_rev,true); if($r_info['user']){ $r_user = editorinfo($r_info['user']); if(auth_ismanager()) $r_user .= ' ('.$r_info['ip'].')'; |