'EmailNotification' => 'includes/UserMailer.php',
'WatchedItem' => 'includes/WatchedItem.php',
'WebRequest' => 'includes/WebRequest.php',
+ 'WebResponse' => 'includes/WebResponse.php',
'FauxRequest' => 'includes/WebRequest.php',
'MediaWiki' => 'includes/Wiki.php',
'WikiError' => 'includes/WikiError.php',
substr( $_SERVER['PATH_INFO'], 1 );
}
}
+
+ private $_response;
/**
* Recursively strips slashes from the given array;
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;
+ }
+
}
/**
--- /dev/null
+<?php
+
+/*
+ * Allow programs to request this object from WebRequest::response() and handle all outputting (or lack of outputting) via it.
+ */
+
+class WebResponse {
+ function header($string, $replace=true) {
+ header($string,$replace);
+ }
+
+ function setcookie($name, $value, $expire) {
+ global $wgCookiePath, $wgCookieDomain, $wgCookieSecure;
+ setcookie($name,$value,$expire, $wgCookiePath, $wgCookieDomain, $wgCookieSecure);
+ }
+}
+
+?>
\ No newline at end of file