From 1810c13b55b01043620fd81a65ce6e84cccc429c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Mon, 23 Dec 2013 09:09:10 +0100 Subject: PHP_AUTH_USER isn't available when using php as cgi --- inc/poche/Poche.class.php | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'inc/poche') diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index adec9b28..4b26574d 100644 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php @@ -446,7 +446,7 @@ class Poche $themes = $this->getInstalledThemes(); $languages = $this->getInstalledLanguages(); $token = $this->user->getConfigValue('token'); - $http_auth = (isset($_SERVER['PHP_AUTH_USER']))?true:false; + $http_auth = (isset($_SERVER['PHP_AUTH_USER']) || isset($_SERVER['REMOTE_USER'])) ? true : false; $tpl_vars = array( 'themes' => $themes, 'languages' => $languages, @@ -649,14 +649,18 @@ class Poche * it redirects the user to the $referer link * @return array */ - private function credentials() { - if(isset($_SERVER['PHP_AUTH_USER'])) { - return array($_SERVER['PHP_AUTH_USER'],'php_auth'); - } - if(!empty($_POST['login']) && !empty($_POST['password'])) { - return array($_POST['login'],$_POST['password']); - } - return array(false,false); + private function credentials() { + if(isset($_SERVER['PHP_AUTH_USER'])) { + return array($_SERVER['PHP_AUTH_USER'],'php_auth'); + } + if(!empty($_POST['login']) && !empty($_POST['password'])) { + return array($_POST['login'],$_POST['password']); + } + if(isset($_SERVER['REMOTE_USER'])) { + return array($_SERVER['REMOTE_USER'],'http_auth'); + } + + return array(false,false); } /** -- cgit v1.2.3