7
* This source file is subject to the new BSD license that is bundled
8
* with this package in the file LICENSE.txt.
9
* It is also available through the world-wide-web at this URL:
10
* http://framework.zend.com/license/new-bsd
11
* If you did not receive a copy of the license and are unable to
12
* obtain it through the world-wide-web, please send an email
13
* to license@zend.com so we can send you a copy immediately.
16
* @package Zend_Controller
17
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
18
* @license http://framework.zend.com/license/new-bsd New BSD License
21
/** Zend_Controller_Request_Exception */
22
require_once 'Zend/Controller/Request/Exception.php';
24
/** Zend_Controller_Request_Http */
25
require_once 'Zend/Controller/Request/Http.php';
28
require_once 'Zend/Uri.php';
31
* Zend_Controller_Request_Apache404
33
* HTTP request object for use with Zend_Controller family. Extends basic HTTP
34
* request object to allow for two edge cases when using Apache:
35
* - Using Apache's 404 handler instead of mod_rewrite to direct requests
36
* - Using the PT flag in rewrite rules
38
* In each case, the URL to check against is found in REDIRECT_URL, not
41
* @uses Zend_Controller_Request_Http
42
* @package Zend_Controller
45
class Zend_Controller_Request_Apache404 extends Zend_Controller_Request_Http
47
public function setRequestUri($requestUri = null)
49
if ($requestUri === null) {
50
if (isset($_SERVER['HTTP_X_REWRITE_URL'])) { // check this first so IIS will catch
51
$requestUri = $_SERVER['HTTP_X_REWRITE_URL'];
52
} elseif (isset($_SERVER['REDIRECT_URL'])) { // Check if using mod_rewrite
53
$requestUri = $_SERVER['REDIRECT_URL'];
54
} elseif (isset($_SERVER['REQUEST_URI'])) {
55
$requestUri = $_SERVER['REQUEST_URI'];
56
} elseif (isset($_SERVER['ORIG_PATH_INFO'])) { // IIS 5.0, PHP as CGI
57
$requestUri = $_SERVER['ORIG_PATH_INFO'];
58
if (!empty($_SERVER['QUERY_STRING'])) {
59
$requestUri .= '?' . $_SERVER['QUERY_STRING'];
64
} elseif (!is_string($requestUri)) {
67
// Set GET items, if available
69
if (false !== ($pos = strpos($requestUri, '?'))) {
70
// Get key => value pairs and set $_GET
71
$query = substr($requestUri, $pos + 1);
72
parse_str($query, $vars);
77
$this->_requestUri = $requestUri;