From 62a83b3bd5813885d964d9fd1509d52bb9c4f12c Mon Sep 17 00:00:00 2001 From: thomascube Date: Wed, 12 Jan 2011 15:47:44 +0000 Subject: Copying plugins to release branch --- .../http_authentication/http_authentication.php | 44 ++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 plugins/http_authentication/http_authentication.php (limited to 'plugins/http_authentication/http_authentication.php') diff --git a/plugins/http_authentication/http_authentication.php b/plugins/http_authentication/http_authentication.php new file mode 100644 index 000000000..a8003cf46 --- /dev/null +++ b/plugins/http_authentication/http_authentication.php @@ -0,0 +1,44 @@ +add_hook('startup', array($this, 'startup')); + $this->add_hook('authenticate', array($this, 'authenticate')); + } + + function startup($args) + { + // change action to login + if (empty($args['action']) && empty($_SESSION['user_id']) + && !empty($_SERVER['PHP_AUTH_USER']) && !empty($_SERVER['PHP_AUTH_PW'])) + $args['action'] = 'login'; + + return $args; + } + + function authenticate($args) + { + if (!empty($_SERVER['PHP_AUTH_USER']) && !empty($_SERVER['PHP_AUTH_PW'])) { + $args['user'] = $_SERVER['PHP_AUTH_USER']; + $args['pass'] = $_SERVER['PHP_AUTH_PW']; + } + + $args['cookiecheck'] = false; + + return $args; + } + +} + -- cgit v1.2.3