w/s
[lhc/web/wiklou.git] / includes / WebRequest.php
index 7b43c8d..39f9cb8 100644 (file)
@@ -62,15 +62,19 @@ class WebRequest {
        }
 
        /**
-        * Extract the PATH_INFO variable even when it isn't a reasonable
-        * value. On some large webhosts, PATH_INFO includes the script
-        * path as well as everything after it.
+        * Extract relevant query arguments from the http request uri's path
+        * to be merged with the normal php provided query arguments.
+        * Tries to use the REQUEST_URI data if available and parses it
+        * according to the wiki's configuration looking for any known pattern.
+        *
+        * If the REQUEST_URI is not provided we'll fall back on the PATH_INFO
+        * provided by the server if any and use that to set a 'title' parameter.
         *
         * @param $want string: If this is not 'all', then the function
         * will return an empty array if it determines that the URL is
         * inside a rewrite path.
         *
-        * @return Array: 'title' key is the title of the article.
+        * @return Array: Any query arguments found in path matches.
         */
        static public function getPathInfo( $want = 'all' ) {
                // PATH_INFO is mangled due to http://bugs.php.net/bug.php?id=31892
@@ -93,7 +97,7 @@ class WebRequest {
                                        // Abort to keep from breaking...
                                        return $matches;
                                }
-                               
+
                                $router = new PathRouter;
 
                                // Raw PATH_INFO style
@@ -120,13 +124,6 @@ class WebRequest {
 
                                global $wgVariantArticlePath, $wgContLang;
                                if( $wgVariantArticlePath ) {
-                                       /*$variantPaths = array();
-                                       foreach( $wgContLang->getVariants() as $variant ) {
-                                               $variantPaths[$variant] =
-                                                       str_replace( '$2', $variant, $wgVariantArticlePath );
-                                       }
-                                       $router->add( $variantPaths, array( 'parameter' => 'variant' ) );*/
-                                       // Maybe actually this?
                                        $router->add( $wgVariantArticlePath,
                                                array( 'variant' => '$2'),
                                                array( '$2' => $wgContLang->getVariants() )
@@ -546,7 +543,7 @@ class WebRequest {
         * @return Array
         */
         public function getQueryValues() {
-               return $_GET;
+               return $_GET;
         }
 
        /**
@@ -746,6 +743,7 @@ class WebRequest {
         * @return integer
         */
        public function getFileSize( $key ) {
+               wfDeprecated( __METHOD__, '1.17' );
                $file = new WebRequestUpload( $this, $key );
                return $file->getSize();
        }
@@ -958,6 +956,7 @@ HTML;
         * @return bool
         */
        public function isPathInfoBad( $extWhitelist = array() ) {
+               wfDeprecated( __METHOD__, '1.17' );
                global $wgScriptExtension;
                $extWhitelist[] = ltrim( $wgScriptExtension, '.' );
                return IEUrlExtension::areServerVarsBad( $_SERVER, $extWhitelist );
@@ -1007,6 +1006,8 @@ HTML;
        /**
         * Fetch the raw IP from the request
         *
+        * @since 1.19
+        *
         * @return String
         */
        protected function getRawIP() {
@@ -1020,6 +1021,9 @@ HTML;
        /**
         * Work out the IP address based on various globals
         * For trusted proxies, use the XFF client IP (first of the chain)
+        * 
+        * @since 1.19
+        *
         * @return string
         */
        public function getIP() {
@@ -1200,7 +1204,7 @@ class FauxRequest extends WebRequest {
         * @param $wasPosted Bool: whether to treat the data as POST
         * @param $session Mixed: session array or null
         */
-       public function __construct( $data, $wasPosted = false, $session = null ) {
+       public function __construct( $data = array(), $wasPosted = false, $session = null ) {
                if( is_array( $data ) ) {
                        $this->data = $data;
                } else {