~cdparra/gelee/trunk

« back to all changes in this revision

Viewing changes to webui/ecosystem/workspace/ecosystem/uwa-server-original/server/lib/Zend/Controller/Request/Apache404.php

  • Committer: parra
  • Date: 2010-03-15 02:39:02 UTC
  • Revision ID: svn-v4:ac5bba68-f036-4e09-846e-8f32731cc928:trunk/gelee:1433
merged gelee at svn

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
/**
 
3
 * Zend Framework
 
4
 *
 
5
 * LICENSE
 
6
 *
 
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.
 
14
 *
 
15
 * @category   Zend
 
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
 
19
 */
 
20
 
 
21
/** Zend_Controller_Request_Exception */
 
22
require_once 'Zend/Controller/Request/Exception.php';
 
23
 
 
24
/** Zend_Controller_Request_Http */
 
25
require_once 'Zend/Controller/Request/Http.php';
 
26
 
 
27
/** Zend_Uri */
 
28
require_once 'Zend/Uri.php';
 
29
 
 
30
/**
 
31
 * Zend_Controller_Request_Apache404
 
32
 *
 
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
 
37
 *
 
38
 * In each case, the URL to check against is found in REDIRECT_URL, not
 
39
 * REQUEST_URI.
 
40
 *
 
41
 * @uses       Zend_Controller_Request_Http
 
42
 * @package    Zend_Controller
 
43
 * @subpackage Request
 
44
 */
 
45
class Zend_Controller_Request_Apache404 extends Zend_Controller_Request_Http
 
46
{
 
47
    public function setRequestUri($requestUri = null)
 
48
    {
 
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'];
 
60
                }
 
61
            } else {
 
62
                return $this;
 
63
            }
 
64
        } elseif (!is_string($requestUri)) {
 
65
            return $this;
 
66
        } else {
 
67
            // Set GET items, if available
 
68
            $_GET = array();
 
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);
 
73
                $_GET = $vars;
 
74
            }
 
75
        }
 
76
 
 
77
        $this->_requestUri = $requestUri;
 
78
        return $this;
 
79
    }
 
80
}