From 5fec6de4216883e625d7e166f862985d00c99d4a Mon Sep 17 00:00:00 2001 From: thomascube Date: Sat, 27 Nov 2010 14:09:03 +0000 Subject: Copy 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') 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