FauxRequest Class Reference
[HTTP]

WebRequest clone which takes values from a provided array. More...

Inherits WebRequest.

List of all members.

Public Member Functions

 __construct ($data, $wasPosted=false, $session=null)
 getText ($name, $default= '')
 Fetch a text string from the given array or return $default if it's not set.
 getValues ()
 Extracts the given named values into an array.
 wasPosted ()
 Returns true if the present request was reached by a POST operation, false otherwise (GET, HEAD, or command-line).
 checkSessionCookie ()
 Returns true if there is a session cookie set.
 getRequestURL ()
 Return the path portion of the request URI.
 appendQuery ($query)
 Take an arbitrary query and rewrite the present URL to include it.
 getHeader ($name)
 Get a request header, or false if it isn't set.
 setHeader ($name, $val)
 getSessionData ($key)
 setSessionData ($key, $data)
 Set session data.
 isPathInfoBad ()
 Returns true if the PATH_INFO ends with an extension other than a script extension.

Private Member Functions

 notImplemented ($method)

Private Attributes

 $wasPosted = false
 $session = array()
 $response


Detailed Description

WebRequest clone which takes values from a provided array.

Definition at line 730 of file WebRequest.php.


Constructor & Destructor Documentation

FauxRequest::__construct ( data,
wasPosted = false,
session = null 
)

Parameters:
$data Array of *non*-urlencoded key => value pairs, the fake GET/POST values
$wasPosted Bool: whether to treat the data as POST

Definition at line 740 of file WebRequest.php.

References WebRequest::$data, $session, $wasPosted, and wasPosted().


Member Function Documentation

FauxRequest::appendQuery ( query  ) 

Take an arbitrary query and rewrite the present URL to include it.

Parameters:
$query String: query string fragment; do not include initial '?'
Returns:
string

Reimplemented from WebRequest.

Definition at line 776 of file WebRequest.php.

References notImplemented().

FauxRequest::checkSessionCookie (  ) 

Returns true if there is a session cookie set.

This does not necessarily mean that the user is logged in!

If you want to check for an open session, use session_id() instead; that will also tell you if the session was opened during the current request (in which case the cookie will be sent back to the client at the end of the script run).

Returns:
bool

Reimplemented from WebRequest.

Definition at line 768 of file WebRequest.php.

FauxRequest::getHeader ( name  ) 

Get a request header, or false if it isn't set.

Parameters:
$name String: case-insensitive header name

Reimplemented from WebRequest.

Definition at line 780 of file WebRequest.php.

References $name.

FauxRequest::getRequestURL (  ) 

Return the path portion of the request URI.

Returns:
string

Reimplemented from WebRequest.

Definition at line 772 of file WebRequest.php.

References notImplemented().

FauxRequest::getSessionData ( key  ) 

Reimplemented from WebRequest.

Definition at line 788 of file WebRequest.php.

FauxRequest::getText ( name,
default = '' 
)

Fetch a text string from the given array or return $default if it's not set.

is stripped from the text, and with some language modules there is an input transliteration applied. This should generally be used for form <textarea> and <input> fields. Used for user-supplied freeform text input (for which input transformations may be required - e.g. Esperanto x-coding).

Parameters:
$name string
$default string: optional
Returns:
string

Reimplemented from WebRequest.

Definition at line 755 of file WebRequest.php.

References $name, and WebRequest::getVal().

FauxRequest::getValues (  ) 

Extracts the given named values into an array.

If no arguments are given, returns all input values. No transformation is performed on the values.

Reimplemented from WebRequest.

Definition at line 760 of file WebRequest.php.

FauxRequest::isPathInfoBad (  ) 

Returns true if the PATH_INFO ends with an extension other than a script extension.

This could confuse IE for scripts that send arbitrary data which is not HTML but may be detected as such.

Various past attempts to use the URL to make this check have generally run up against the fact that CGI does not provide a standard method to determine the URL. PATH_INFO may be mangled (e.g. if cgi.fix_pathinfo=0), but only by prefixing it with the script name and maybe some other stuff, the extension is not mangled. So this should be a reasonably portable way to perform this security check.

Also checks for anything that looks like a file extension at the end of QUERY_STRING, since IE 6 and earlier will use this to get the file type if there was no dot before the question mark (bug 28235).

Reimplemented from WebRequest.

Definition at line 797 of file WebRequest.php.

FauxRequest::notImplemented ( method  )  [private]

Definition at line 751 of file WebRequest.php.

Referenced by appendQuery(), getRequestURL(), and setSessionData().

FauxRequest::setHeader ( name,
val 
)

Definition at line 784 of file WebRequest.php.

References $name.

FauxRequest::setSessionData ( key,
data 
)

Set session data.

Parameters:
$key String Name of key in $_SESSION
$data mixed

Reimplemented from WebRequest.

Definition at line 793 of file WebRequest.php.

References notImplemented().

FauxRequest::wasPosted (  ) 

Returns true if the present request was reached by a POST operation, false otherwise (GET, HEAD, or command-line).

Note that values retrieved by the object may come from the GET URL etc even on a POST request.

Returns:
bool

Reimplemented from WebRequest.

Definition at line 764 of file WebRequest.php.

Referenced by __construct().


Member Data Documentation

FauxRequest::$response [private]

Definition at line 733 of file WebRequest.php.

FauxRequest::$session = array() [private]

Definition at line 732 of file WebRequest.php.

Referenced by __construct().

FauxRequest::$wasPosted = false [private]

Definition at line 731 of file WebRequest.php.

Referenced by __construct().


The documentation for this class was generated from the following file:

Generated on Sat Apr 30 22:57:37 2011 for MediaWiki by  doxygen 1.5.9