From d77ef54fb011f86062393901458942b7882cfbf2 Mon Sep 17 00:00:00 2001 From: sebastian Date: Mon, 9 May 2005 11:16:12 +0000 Subject: [PATCH] *** empty log message *** --- .../modules/htmlUI/var/localizer/auth.inc.php | 50 +++++++++++++++++++ ...elpfunctions.php => helpfunctions.inc.php} | 0 2 files changed, 50 insertions(+) create mode 100755 livesupport/modules/htmlUI/var/localizer/auth.inc.php rename livesupport/modules/htmlUI/var/localizer/{helpfunctions.php => helpfunctions.inc.php} (100%) mode change 100755 => 100644 diff --git a/livesupport/modules/htmlUI/var/localizer/auth.inc.php b/livesupport/modules/htmlUI/var/localizer/auth.inc.php new file mode 100755 index 000000000..fe1fe9937 --- /dev/null +++ b/livesupport/modules/htmlUI/var/localizer/auth.inc.php @@ -0,0 +1,50 @@ +getMessage()); + } + $dbc->setFetchMode(DB_FETCHMODE_ASSOC); + $gb =& new GreenBox($dbc, $config); + + + if (!$data['PHP_AUTH_USER'] || !$data['PHP_AUTH_PW']) { + return FALSE; + } + $sessid = $gb->login($data['PHP_AUTH_USER'], $data['PHP_AUTH_PW']); + if(!$sessid || PEAR::isError($sessid)){ + return FALSE; + } + setcookie($config['authCookieName'], $sessid); + + if ($gb->isMemberOf($gb->getSessUserId($sessid), $gb->getSubjId('Admins')) !== TRUE) { + return FALSE; + } + + $id = $gb->getObjId($data['PHP_AUTH_USER'], $gb->storId); + if(PEAR::isError($id)) { + return FALSE; + } + return TRUE; +} + +function authenticate() +{ + Header("WWW-Authenticate: Basic realm=\"My Realm\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Access denied."; + exit; +} + + +if (!isset($_SERVER['PHP_AUTH_USER'])) { + authenticate(); +} elseif (login($_SERVER) !== TRUE) { + authenticate(); +} +?> diff --git a/livesupport/modules/htmlUI/var/localizer/helpfunctions.php b/livesupport/modules/htmlUI/var/localizer/helpfunctions.inc.php old mode 100755 new mode 100644 similarity index 100% rename from livesupport/modules/htmlUI/var/localizer/helpfunctions.php rename to livesupport/modules/htmlUI/var/localizer/helpfunctions.inc.php