示例#1
0
 public function __construct($r = null, $t = null, $c = null)
 {
     $this->uri = $_SERVER['REQUEST_URI'];
     $this->path = parse_url($this->uri, PHP_URL_PATH);
     // set up basic delegation concepts (via params or htaccess)
     $this->container = presto_lib::_get('c', $c);
     $this->route = presto_lib::_get('r', $r);
     $this->type = presto_lib::_c(presto_lib::_get('t', $t), 'json');
     $params = $this->params();
     if (!array_key_exists('r', $_GET) || !array_key_exists('t', $_GET) || !array_key_exists('c', $_GET)) {
         presto_lib::_trace("Rewrite delegation setup for {$this->uri} is missing.", json_encode($_GET));
     }
     unset($_GET['t']);
     unset($_GET['r']);
     unset($_GET['c']);
     // pop routing parameters
     // setup request parameters
     $this->method = strtolower($_SERVER['REQUEST_METHOD']);
     $this->action = presto_lib::_c($this->method, 'get');
     // default to GET
     $this->host = $_SERVER['HTTP_HOST'];
     $this->referer = _server('HTTP_REFERER', '');
     $this->refererPath = parse_url($this->referer, PHP_URL_PATH);
     $this->service = strstr($this->host, '.', -1);
     $this->tld = pathinfo($this->host, PATHINFO_EXTENSION);
     $this->scheme = _server_has('HTTPS', 'on') || _server_has('HTTP_X_FORWARDED_PROTO', 'https') || _server_has('HTTP_X_FORWARDED_SSL', 'on') ? 'https' : 'http';
     $this->options = $_GET;
     $_GET = array();
     // discourage use of $_GET
 }