Mage_Core_Helper_Http Class Reference

Inheritance diagram for Mage_Core_Helper_Http:

Mage_Core_Helper_Abstract

List of all members.

Public Member Functions

 authValidate ($headers=null)
 authFailed ()


Detailed Description

Default rss helper

Author:
Magento Core Team <core@magentocommerce.com>

Definition at line 32 of file Http.php.


Member Function Documentation

authFailed (  ) 

Definition at line 74 of file Http.php.

00075     {
00076         Mage::app()->getResponse()
00077             ->setHeader('HTTP/1.1','401 Unauthorized')
00078             ->setHeader('WWW-Authenticate','Basic realm="RSS Feeds"')
00079             ->setBody('<h1>401 Unauthorized</h1>')
00080             ->sendResponse();
00081         exit;
00082     }

authValidate ( headers = null  ) 

Definition at line 34 of file Http.php.

00035     {
00036         if(!is_null($headers)) {
00037             $_SERVER = $headers;
00038         }
00039 
00040         $user = '';
00041         $pass = '';
00042         // moshe's fix for CGI
00043         if (empty($_SERVER['HTTP_AUTHORIZATION'])) {
00044             foreach ($_SERVER as $k=>$v) {
00045                 if (substr($k, -18)==='HTTP_AUTHORIZATION' && !empty($v)) {
00046                     $_SERVER['HTTP_AUTHORIZATION'] = $v;
00047                     break;
00048                 }
00049             }
00050         }
00051 
00052         if (isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_PW'])) {
00053             $user = $_SERVER['PHP_AUTH_USER'];
00054             $pass = $_SERVER['PHP_AUTH_PW'];
00055         }
00056         //  IIS Note::  For HTTP Authentication to work with IIS,
00057         // the PHP directive cgi.rfc2616_headers must be set to 0 (the default value).
00058         elseif (!empty($_SERVER['HTTP_AUTHORIZATION'])) {
00059             $auth = $_SERVER['HTTP_AUTHORIZATION'];
00060             list($user, $pass) = explode(':', base64_decode(substr($auth, strpos($auth, " ") + 1)));
00061         }
00062         elseif (!empty($_SERVER['Authorization'])) {
00063             $auth = $_SERVER['Authorization'];
00064             list($user, $pass) = explode(':', base64_decode(substr($auth, strpos($auth, " ") + 1)));
00065         }
00066 
00067         if(!$user || !$pass) {
00068             $this->authFailed();
00069         }
00070 
00071         return array($user, $pass);
00072     }


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:23:55 2009 for Magento by  doxygen 1.5.8