Source for file HttpRequest.php
Documentation is available at HttpRequest.php
- 1: <?php
- 3: /**
- 4: * Nette Framework
- 5: *
- 11: */
- 15: /**
- 16: * HttpRequest provides access scheme for request sent via HTTP.
- 17: *
- 20: *
- 34: */
- 36: {
- 69: /********************* URI ****************d*g**/
- 73: /**
- 74: * Returns URL object.
- 76: */
- 78: {
- 81: }
- 83: }
- 87: /**
- 88: * Sets URL object.
- 91: */
- 93: {
- 99: }
- 103: /**
- 104: * Returns URL object.
- 106: */
- 108: {
- 111: }
- 113: }
- 117: /**
- 118: * Sets request URI filter.
- 123: */
- 125: {
- 133: }
- 135: }
- 139: /**
- 140: * Returns request URI filter.
- 142: */
- 144: {
- 146: }
- 150: /**
- 151: * Detects uri, base path and script path of the request.
- 153: */
- 155: {
- 161: // host & port
- 170: }
- 179: }
- 181: // path & query
- 189: }
- 192: }
- 200: $requestUri = preg_replace(array_keys($this->uriFilter[0]), array_values($this->uriFilter[0]), $requestUri);
- 202: $uri->path = preg_replace(array_keys($this->uriFilter[PHP_URL_PATH]), array_values($this->uriFilter[PHP_URL_PATH]), $tmp[0]);
- 206: // normalized uri
- 209: // detect base URI-path - inspired by Zend Framework (c) Zend Technologies USA Inc. (http://www.zend.com), new BSD license
- 223: // Backtrack up the script_filename to find the portion matching php_self
- 234: }
- 236: // Does the scriptPath have anything in common with the request_uri?
- 238: // whole $scriptPath in URL
- 242: // directory portion of $scriptPath in URL
- 246: // no match whatsoever; set it blank
- 251: // If using mod_rewrite or ISAPI_Rewrite strip the script filename
- 252: // out of scriptPath. $pos !== 0 makes sure it is not matching a value
- 253: // from PATH_INFO or QUERY_STRING
- 258: }
- 261: }
- 265: /********************* query, post, files & cookies ****************d*g**/
- 269: /**
- 270: * Returns variable provided to the script via URL query ($_GET).
- 271: * If no key is passed, returns the entire array.
- 275: */
- 277: {
- 280: }
- 290: }
- 291: }
- 295: /**
- 296: * Returns variable provided to the script via POST method ($_POST).
- 297: * If no key is passed, returns the entire array.
- 301: */
- 303: {
- 306: }
- 316: }
- 317: }
- 321: /**
- 322: * Returns HTTP POST data in raw format (only for "application/x-www-form-urlencoded").
- 324: */
- 326: {
- 328: }
- 332: /**
- 333: * Returns uploaded file.
- 336: */
- 338: {
- 341: }
- 344: }
- 348: /**
- 349: * Returns uploaded files.
- 351: */
- 353: {
- 356: }
- 359: }
- 363: /**
- 364: * Returns variable provided to the script via HTTP cookies.
- 368: */
- 370: {
- 373: }
- 383: }
- 384: }
- 388: /**
- 389: * Returns variables provided to the script via HTTP cookies.
- 391: */
- 393: {
- 396: }
- 399: }
- 403: /**
- 404: * Recursively converts and checks encoding.
- 408: */
- 410: {
- 414: }
- 416: }
- 420: /**
- 421: * Initializes $this->query, $this->files, $this->cookies and $this->files arrays
- 423: */
- 425: {
- 430: $this->query = $filter ? filter_input_array(INPUT_GET, FILTER_UNSAFE_RAW) : (empty($_GET) ? array() : $_GET);
- 431: }
- 432: $this->post = $filter ? filter_input_array(INPUT_POST, FILTER_UNSAFE_RAW) : (empty($_POST) ? array() : $_POST);
- 433: $this->cookies = $filter ? filter_input_array(INPUT_COOKIE, FILTER_UNSAFE_RAW) : (empty($_COOKIE) ? array() : $_COOKIE);
- 441: // remove fucking quotes and check (and optionally convert) encoding
- 451: }
- 454: // invalid key -> ignore
- 463: }
- 471: }
- 473: }
- 475: }
- 477: }
- 478: }
- 479: }
- 481: }
- 484: // structure $files and create HttpUploadedFile objects
- 492: }
- 493: }
- 502: }
- 505: }
- 508: }
- 520: }
- 521: }
- 524: }
- 528: /********************* method & headers ****************d*g**/
- 532: /**
- 533: * Returns HTTP request method (GET, POST, HEAD, PUT, ...). The method is case-sensitive.
- 535: */
- 537: {
- 539: }
- 543: /**
- 544: * Checks if the request method is the given one.
- 547: */
- 549: {
- 550: return isset($_SERVER['REQUEST_METHOD']) ? strcasecmp($_SERVER['REQUEST_METHOD'], $method) === 0 : FALSE;
- 551: }
- 555: /**
- 556: * Checks if the request method is POST.
- 558: */
- 560: {
- 562: }
- 566: /**
- 567: * Return the value of the HTTP header. Pass the header name as the
- 568: * plain, HTTP-specified header name (e.g. 'Accept-Encoding').
- 572: */
- 574: {
- 581: }
- 582: }
- 586: /**
- 587: * Returns all HTTP headers.
- 589: */
- 591: {
- 593: // lazy initialization
- 601: }
- 602: }
- 603: }
- 604: }
- 606: }
- 610: /**
- 611: * Returns referrer.
- 613: */
- 615: {
- 618: }
- 622: /**
- 623: * Is the request is sent via secure channel (https).
- 625: */
- 627: {
- 629: }
- 633: /**
- 634: * Is AJAX request?
- 636: */
- 638: {
- 640: }
- 644: /**
- 645: * Returns the IP address of the remote client.
- 647: */
- 649: {
- 651: }
- 655: /**
- 656: * Returns the host of the remote client.
- 658: */
- 660: {
- 664: }
- 666: }
- 669: }
- 673: /**
- 674: * Parse Accept-Language header and returns prefered language.
- 677: */
- 679: {
- 686: preg_match_all('#(' . implode('|', $langs) . ')(?:-[^\s,;=]+)?\s*(?:;\s*q=([0-9.]+))?#', $s, $matches);
- 690: }
- 698: }
- 699: }
- 702: }
- 704: }