public function execute(Sabel_Bus $bus) { if ($bus->has("request")) { $request = $bus->get("request"); } else { $uri = $this->getRequestUri($bus); $request = new Sabel_Request_Object($uri); if (SBL_SECURE_MODE) { $_GET = remove_nullbyte($_GET); $_POST = remove_nullbyte($_POST); } $request->setGetValues($_GET); $request->setPostValues($_POST); $this->setFiles($request); if (isset($_SERVER["REQUEST_METHOD"])) { $request->method($_SERVER["REQUEST_METHOD"]); } $httpHeaders = array(); foreach ($_SERVER as $key => $val) { if (strpos($key, "HTTP") === 0) { $httpHeaders[$key] = $val; } } $request->setHttpHeaders($httpHeaders); $bus->set("request", $request); } l("REQUEST URI: /" . $request->getUri(true)); // Ajax request. if ($request->getHttpHeader("X-Requested-With") === "XMLHttpRequest") { $bus->set("NO_LAYOUT", true); $bus->set("IS_AJAX_REQUEST", true); } }
protected function httpGet($uri, $session = null, $maxRedirects = 0) { $request = new Sabel_Request_Object(normalize_uri($uri)); if (isset($parsedUrl["query"]) && !empty($parsedUrl["query"])) { parse_str($parsedUrl["query"], $get); $request->setGetValues($get); } return $this->request($request, $session, $maxRedirects); }
protected function httpGet($uri, $session = null, $maxRedirects = 0) { $uri = trim(preg_replace("@/{2,}@", "/", $uri, "/")); $parsedUrl = parse_url("http://localhost/{$uri}"); $request = new Sabel_Request_Object(ltrim($parsedUrl["path"], "/")); if (isset($parsedUrl["query"]) && !empty($parsedUrl["query"])) { parse_str($parsedUrl["query"], $get); $request->setGetValues($get); } return $this->request($request, $session, $maxRedirects); }
public function testIsGetSet() { $request = new Sabel_Request_Object(""); $this->assertFalse($request->hasGetValue("a")); $request->setGetValues(array("a" => "1", "b" => "")); $this->assertTrue($request->hasGetValue("a")); $this->assertFalse($request->hasGetValue("b")); $this->assertTrue($request->isGetSet("a")); $this->assertTrue($request->isGetSet("b")); }