* (bug 6023) Fixed mismatch of 0/NULL for wl_notificationtimestamp; now notification
[lhc/web/wiklou.git] / includes / WebRequest.php
index f4b0294..6b8e944 100644 (file)
@@ -44,6 +44,8 @@ class WebRequest {
                                substr( $_SERVER['PATH_INFO'], 1 );
                }
        }
+       
+       private $_response;
 
        /**
         * Recursively strips slashes from the given array;
@@ -437,6 +439,19 @@ class WebRequest {
                wfDebug( "WebRequest::getFileName() '" . $_FILES[$key]['name'] . "' normalized to '$name'\n" );
                return $name;
        }
+       
+       /**
+        * Return a handle to WebResponse style object, for setting cookies, 
+        * headers and other stuff, for Request being worked on.
+        */
+       function response() {
+               /* Lazy initialization of response object for this request */
+               if (!is_object($this->_response)) {
+                       $this->_response = new WebResponse;
+               } 
+               return $this->_response;
+       }
+       
 }
 
 /**
@@ -445,15 +460,14 @@ class WebRequest {
  * @package MediaWiki
  */
 class FauxRequest extends WebRequest {
-       private
-               $data = null,
-               $wasPosted = false ;
+       var $data = null;
+       var $wasPosted = false;
 
        function FauxRequest( $data, $wasPosted = false ) {
                if( is_array( $data ) ) {
                        $this->data = $data;
                } else {
-                       wfDebugDieBacktrace( "FauxRequest() got bogus data" );
+                       throw new MWException( "FauxRequest() got bogus data" );
                }
                $this->wasPosted = $wasPosted;
        }
@@ -480,11 +494,11 @@ class FauxRequest extends WebRequest {
        }
 
        function getRequestURL() {
-               wfDebugDieBacktrace( 'FauxRequest::getRequestURL() not implemented' );
+               throw new MWException( 'FauxRequest::getRequestURL() not implemented' );
        }
 
        function appendQuery( $query ) {
-               wfDebugDieBacktrace( 'FauxRequest::appendQuery() not implemented' );
+               throw new MWException( 'FauxRequest::appendQuery() not implemented' );
        }
 
 }