From cc97ea0559af1a92a54dbcdf738ee4d95e67d3ff Mon Sep 17 00:00:00 2001 From: thomascube Date: Sun, 19 Apr 2009 17:44:29 +0000 Subject: Merged branch devel-api (from r2208 to r2387) back into trunk (omitting some sample plugins) --- .../http_authentication/http_authentication.php | 41 ++++++++++++++++++++++ 1 file changed, 41 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..57422a74d --- /dev/null +++ b/plugins/http_authentication/http_authentication.php @@ -0,0 +1,41 @@ +add_hook('startup', array($this, 'startup')); + $this->add_hook('authenticate', array($this, 'authenticate')); + } + + function startup($args) + { + // change action to login + if ($args['task'] == 'mail' && 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']; + } + + return $args; + } + +} + -- cgit v1.2.3