From: Hendrik Langer Date: Mon, 24 Oct 2011 23:58:37 +0000 (+0200) Subject: set http auth headers for apache+php-cgi work around if variable gets renamed by... X-Git-Tag: v3.0~85^2~8 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=76bfc3b547064a5862f72f9165785aa134d8ce4f;p=nextcloud-server.git set http auth headers for apache+php-cgi work around if variable gets renamed by apache --- diff --git a/lib/base.php b/lib/base.php index c52b4493e01..700236c96c6 100644 --- a/lib/base.php +++ b/lib/base.php @@ -92,6 +92,14 @@ class OC{ $_SERVER['PHP_AUTH_PW'] = strip_tags($password); } + //set http auth headers for apache+php-cgi work around if variable gets renamed by apache + if (isset($_SERVER['REDIRECT_HTTP_AUTHORIZATION']) && preg_match('/Basic\s+(.*)$/i', $_SERVER['REDIRECT_HTTP_AUTHORIZATION'], $matches)) + { + list($name, $password) = explode(':', base64_decode($matches[1])); + $_SERVER['PHP_AUTH_USER'] = strip_tags($name); + $_SERVER['PHP_AUTH_PW'] = strip_tags($password); + } + // calculate the documentroot OC::$DOCUMENTROOT=realpath($_SERVER['DOCUMENT_ROOT']); OC::$SERVERROOT=str_replace("\\",'/',substr(__FILE__,0,-13));