Source for file HttpRequest.php
Documentation is available at HttpRequest.php
- 1: <?php
- 3: /**
- 4: * Nette Framework
- 5: *
- 6: * Copyright (c) 2004, 2009 David Grudl (http://davidgrudl.com)
- 7: *
- 8: * This source file is subject to the "Nette license" that is bundled
- 9: * with this package in the file license.txt.
- 10: *
- 11: * For more information please see https://nette.org
- 12: *
- 19: */
- 29: /**
- 30: * HttpRequest provides access scheme for request sent via HTTP.
- 31: *
- 35: */
- 37: {
- 70: /********************* URI ****************d*g**/
- 74: /**
- 75: * Returns URL object.
- 78: */
- 80: {
- 83: }
- 85: }
- 89: /**
- 90: * Returns URL object.
- 93: */
- 95: {
- 98: }
- 100: }
- 104: /**
- 105: * Sets request URI filter.
- 110: */
- 112: {
- 120: }
- 122: }
- 126: /**
- 127: * Returns request URI filter.
- 129: */
- 131: {
- 133: }
- 137: /**
- 138: * Detects uri, base path and script path of the request.
- 140: */
- 142: {
- 147: $uri->user = $origUri->user = isset($_SERVER['PHP_AUTH_USER']) ? $_SERVER['PHP_AUTH_USER'] : '';
- 150: // host & port
- 159: }
- 168: }
- 170: // path & query
- 178: }
- 181: }
- 187: $requestUri = preg_replace(array_keys($this->uriFilter[0]), array_values($this->uriFilter[0]), $requestUri);
- 189: $uri->path = preg_replace(array_keys($this->uriFilter[PHP_URL_PATH]), array_values($this->uriFilter[PHP_URL_PATH]), $tmp[0]);
- 194: }
- 196: // normalized uri
- 199: // detect base URI-path - inspired by Zend Framework (c) Zend Technologies USA Inc. (http://www.zend.com), new BSD license
- 212: // Backtrack up the script_filename to find the portion matching php_self
- 224: }
- 226: // Does the scriptPath have anything in common with the request_uri?
- 228: // whole $scriptPath in URL
- 232: // directory portion of $scriptPath in URL
- 236: // no match whatsoever; set it blank
- 241: // If using mod_rewrite or ISAPI_Rewrite strip the script filename
- 242: // out of scriptPath. $pos !== 0 makes sure it is not matching a value
- 243: // from PATH_INFO or QUERY_STRING
- 248: }
- 249: }
- 253: /********************* query, post, files & cookies ****************d*g**/
- 257: /**
- 258: * Returns variable provided to the script via URL query ($_GET).
- 259: * If no key is passed, returns the entire array.
- 263: */
- 265: {
- 268: }
- 278: }
- 279: }
- 283: /**
- 284: * Returns variable provided to the script via POST method ($_POST).
- 285: * If no key is passed, returns the entire array.
- 289: */
- 291: {
- 294: }
- 304: }
- 305: }
- 309: /**
- 310: * Returns HTTP POST data in raw format (only for "application/x-www-form-urlencoded").
- 312: */
- 314: {
- 316: }
- 320: /**
- 321: * Returns uploaded file.
- 324: */
- 326: {
- 329: }
- 337: }
- 338: }
- 340: }
- 344: /**
- 345: * Returns uploaded files.
- 347: */
- 349: {
- 352: }
- 355: }
- 359: /**
- 360: * Returns variable provided to the script via HTTP cookies.
- 364: */
- 366: {
- 369: }
- 379: }
- 380: }
- 384: /**
- 385: * Returns variables provided to the script via HTTP cookies.
- 387: */
- 389: {
- 392: }
- 395: }
- 399: /**
- 400: * Recursively converts and checks encoding.
- 404: */
- 406: {
- 410: }
- 411: }
- 415: /**
- 416: * Initializes $this->query, $this->files, $this->cookies and $this->files arrays
- 418: */
- 420: {
- 425: }
- 428: }
- 431: }
- 439: // remove fucking quotes and check (and optionally convert) encoding
- 449: }
- 452: // invalid key -> ignore
- 461: }
- 469: }
- 471: }
- 473: }
- 475: }
- 476: }
- 477: }
- 479: }
- 482: // structure $files and create HttpUploadedFile objects
- 489: }
- 490: }
- 499: }
- 502: }
- 505: }
- 517: }
- 518: }
- 521: }
- 525: /********************* method & headers ****************d*g**/
- 529: /**
- 530: * Returns HTTP request method (GET, POST, HEAD, PUT, ...). The method is case-sensitive.
- 532: */
- 534: {
- 536: }
- 540: /**
- 541: * Checks if the request method is the given one.
- 544: */
- 546: {
- 547: return isset($_SERVER['REQUEST_METHOD']) ? strcasecmp($_SERVER['REQUEST_METHOD'], $method) === 0 : FALSE;
- 548: }
- 552: /**
- 553: * Checks if the request method is POST.
- 555: */
- 557: {
- 559: }
- 563: /**
- 564: * Return the value of the HTTP header. Pass the header name as the
- 565: * plain, HTTP-specified header name (e.g. 'Accept-Encoding').
- 569: */
- 571: {
- 578: }
- 579: }
- 583: /**
- 584: * Returns all HTTP headers.
- 586: */
- 588: {
- 590: // lazy initialization
- 598: }
- 599: }
- 600: }
- 601: }
- 603: }
- 607: /**
- 608: * Returns referrer.
- 610: */
- 612: {
- 615: }
- 619: /**
- 620: * Is the request is sent via secure channel (https).
- 622: */
- 624: {
- 626: }
- 630: /**
- 631: * Is AJAX request?
- 633: */
- 635: {
- 637: }
- 641: /**
- 642: * Returns the IP address of the remote client.
- 644: */
- 646: {
- 648: }
- 652: /**
- 653: * Returns the host of the remote client.
- 655: */
- 657: {
- 661: }
- 663: }
- 666: }
- 670: /**
- 671: * Parse Accept-Language header and returns prefered language.
- 674: */
- 676: {
- 683: preg_match_all('#(' . implode('|', $langs) . ')(?:-[^\s,;=]+)?\s*(?:;\s*q=([0-9.]+))?#', $s, $matches);
- 687: }
- 695: }
- 696: }
- 699: }
- 701: }