eZPublish  4.5
eZHTTPTool Class Reference

Provides access to HTTP post,get and session variables. More...

Public Member Functions

 attribute ($attr)
 
 attributes ()
 
 createPostVarsFromImageButtons ()
 
 eZHTTPTool ()
 
 getSessionKey ()
 Return the session id. More...
 
 getVariable ($var, $fallbackValue=null)
 
 hasAttribute ($attr)
 
 hasGetVariable ($var)
 
 hasPostVariable ($var)
 
 hasSessionVariable ($name, $forceStart=true)
 Check if session variable $name exists. More...
 
 hasVariable ($var)
 
 postVariable ($var, $fallbackValue=null)
 
 removeSessionVariable ($name)
 Unset the session variable $name. More...
 
 sessionID ()
 Return the session id. More...
 
sessionVariable ($name, $fallbackValue=null)
 Get session variable $name. More...
 
 setGetVariable ($var, $value)
 
 setPostVariable ($var, $value)
 
 setSessionID ($sessionKey)
 Sets a new session id. More...
 
 setSessionKey ($sessionKey)
 Sets a new session id. More...
 
 setSessionVariable ($name, $value)
 Sets the session variable $name to value $value. More...
 
 variable ($var, $fallbackValue=null)
 

Static Public Member Functions

static createRedirectUrl ($path, $parameters=array())
 
static getDataByURL ($url, $justCheckURL=false, $userAgent=false)
 
static headerVariable ($headerName, $headerData)
 
static instance ()
 Return a unique instance of the eZHTTPTool class. More...
 
static parseHTTPResponse (&$response, &$header, &$body)
 
static password ()
 
static redirect ($path, $parameters=array(), $status=false, $encodeURL=true)
 Performs an HTTP redirect. More...
 
static removeMagicQuotes ()
 
static sendHTTPRequest ($uri, $port=false, $postParameters=false, $userAgent= 'eZ Publish', $passthrough=true, array $cookies=array())
 Sends a http request to the specified host. More...
 
static username ()
 

Detailed Description

Provides access to HTTP post,get and session variables.

See PHP manual on Predefined Variables for more information.

Member Function Documentation

eZHTTPTool::attribute (   $attr)
Returns
the value for the attribute $attr or null if the attribute does not exist.
eZHTTPTool::attributes ( )
Returns
the attributes for this object.

Referenced by hasAttribute().

eZHTTPTool::createPostVarsFromImageButtons ( )
static eZHTTPTool::createRedirectUrl (   $path,
  $parameters = array() 
)
static

Sends a redirect path to the browser telling it to load the new path. By default only $path is required, other parameters will be fetched automatically to create a HTTP/1.1 compatible header. The input $parameters may contain the following keys.

  • host - the name of the host, default will fetch the currenty hostname
  • protocol - which protocol to use, default will use HTTP
  • port - the port on the host
  • username - a username which is required to login on the site
  • password - if username is supplied this password will be used for authentication

The path may be specified relativily rel/ative, from root /a/root, with hostname change //myhost.com/a/root/rel/ative, with protocol http://myhost.com/a/root/rel/ative. Also port may be placed in the path string. It is recommended that the path only contain a plain root path and instead send the rest as optional parameters, the support for different kinds of paths is only incase you get URLs externally which contains any of the above cases.

Note
The redirection does not happen immedietaly and the script execution will continue.

Referenced by redirect().

eZHTTPTool::eZHTTPTool ( )

Initializes the class. Use eZHTTPTool::instance to get a single instance.

Referenced by instance().

static eZHTTPTool::getDataByURL (   $url,
  $justCheckURL = false,
  $userAgent = false 
)
static
Parameters
$url
$justCheckURLif true, we should check url only not downloading data.
Returns
data from $url, false if invalid URL

Referenced by eZRSSImport\getRSSVersion().

eZHTTPTool::getSessionKey ( )

Return the session id.

Deprecated:
Since 4.4, use ->sessionID instead!
Returns
string
eZHTTPTool::getVariable (   $var,
  $fallbackValue = null 
)
Returns
the HTTP get variable $var, or $fallbackValue if the get variable does not exist, or null if $fallbackValue is omitted.
See Also
variable
eZHTTPTool::hasAttribute (   $attr)
Returns
true if the attribute $attr exist.
eZHTTPTool::hasGetVariable (   $var)
Returns
true if the HTTP get variable $var exist.
See Also
hasVariable
eZHTTPTool::hasPostVariable (   $var)
Returns
true if the HTTP post variable $var exist.
See Also
hasVariable
eZHTTPTool::hasSessionVariable (   $name,
  $forceStart = true 
)

Check if session variable $name exists.

Parameters
string$name
bool$forceStartForce session start if true (default)
Returns
bool|null Null if session has not started and $forceStart is false
eZHTTPTool::hasVariable (   $var)
Returns
true if the HTTP post/get variable $var exists.
See Also
hasPostVariable
static eZHTTPTool::headerVariable (   $headerName,
  $headerData 
)
static

Sets the header variable $headerName to have the data $headerData.

Note
Calls PHPs header() with a constructed string.

Referenced by redirect().

static eZHTTPTool::instance ( )
static

Return a unique instance of the eZHTTPTool class.

Returns
eZHTTPTool

Referenced by eZUser\_loginUser(), eZModule\actionParameter(), eZShopOperationCollection\activateOrder(), eZURLOperator\applyQuotes(), eZContentBrowse\browse(), eZSearch\buildSearchArray(), eZContentClass\canInstantiateClassList(), checkNodeActions(), checkNodeAssignments(), checkNodeMovements(), checkRelationActions(), checkRelationAssignments(), eZUserLoginHandler\checkUser(), eZUser\checkUser(), eZUser\cleanup(), eZContentUpload\cleanup(), eZContentUpload\cleanupAll(), eZTemplateCompiler\compilationFilename(), eZWizardBaseClassLoader\createClass(), eZModule\currentAction(), eZBasket\currentBasket(), eZWishList\currentWishList(), eZCollaborationItemHandler\customInput(), eZObjectRelationListType\customObjectAttributeHTTPAction(), datatypeBasicFetchData(), datatypeDescribeFetchData(), eZMultiOption2Type\editTemplate(), eZModuleOperationInfo\execute(), eZStaticCache\executeActions(), eZContentObjectEditHandler\executeInputHandlers(), eZRole\expireCache(), eZCheckUser(), eZContentBrowse\eZContentBrowse(), eZContentUpload\eZContentUpload(), eZSetupCheckExecutable(), eZSetupFetchPersistenceList(), eZSetupRunTests(), eZSetupSetPersistencePostVariable(), eZWizardBase\eZWizardBase(), eZDefaultShopAccountHandler\fetchAccountInformation(), eZShopFunctionCollection\fetchBasket(), eZContentObjectStateGroup\fetchHTTPPersistentVariables(), eZContentObjectState\fetchHTTPPersistentVariables(), eZUserDiscountRule\fetchIDListByUserID(), eZContentObject\fetchInput(), eZContentObject\fixupInput(), eZUserLoginHandler\forceLogin(), eZPaymentGatewayType\getCurrentGatewayType(), getHTTPVariable(), eZContentObject\handleAllCustomHTTPActions(), eZContentObject\handleCustomHTTPActions(), eZModule\hasActionParameter(), eZCollaborationItemHandler\hasCustomInput(), eZUser\instance(), eZCollaborationItemHandler\isCustomAction(), eZPreferences\isStoredInSession(), eZLDAPUser\loginUser(), eZTextFileUser\loginUser(), eZUser\logoutCurrent(), eZURLOperator\modify(), eZUserLoginHandler\preCheck(), processDropdownLimitations(), eZRedirectManager\redirectURI(), eZContentBrowse\result(), sectionEditActionCheck(), eZUserLoginHandler\sessionCleanup(), eZPreferences\sessionCleanup(), eZContentUpload\setResult(), stateEditActionCheck(), eZModuleOperationInfo\storeBodyMemento(), eZStaticCache\storeCache(), eZPreferences\storedSessionValue(), eZPreferences\storeInSession(), storeNodeAssignments(), eZModuleOperationInfo\storeOperationMemento(), templateOperatorBasicFetchData(), templateOperatorDescribeFetchData(), eZContentUpload\upload(), eZURLOperator\urlTransformation(), eZContentObject\validateInput(), eZContentObjectEditHandler\validateInputHandlers(), eZPreferences\value(), and eZPreferences\values().

static eZHTTPTool::parseHTTPResponse ( $response,
$header,
$body 
)
static
static eZHTTPTool::password ( )
static

Returns password from HTTP authentication or false if not logged in. See http://en.php.net/features.http-auth why you can`t safely use $_SERVER['PHP_AUTH_PW'].

eZHTTPTool::postVariable (   $var,
  $fallbackValue = null 
)
Returns
the HTTP post variable $var, or $fallbackValue if the post variable does not exist , or null if $fallbackValue is omitted.
See Also
variable
static eZHTTPTool::redirect (   $path,
  $parameters = array(),
  $status = false,
  $encodeURL = true 
)
static

Performs an HTTP redirect.

Parameters
$pathThe path to redirect
$parameters
See Also
createRedirectUrl()
Parameters
$statusThe HTTP status code as a string
$encodeURLEncode the URL. This should normally be true, but may be set to false to avoid double encoding when redirect() is called twice.

Referenced by eZUserLoginHandler\checkUser(), eZUser\instance(), and eZSSLZone\switchIfNeeded().

static eZHTTPTool::removeMagicQuotes ( )
static

Referenced by eZHTTPTool().

eZHTTPTool::removeSessionVariable (   $name)

Unset the session variable $name.

Parameters
string$name
Returns
bool
static eZHTTPTool::sendHTTPRequest (   $uri,
  $port = false,
  $postParameters = false,
  $userAgent = 'eZ Publish',
  $passthrough = true,
array  $cookies = array() 
)
static

Sends a http request to the specified host.

Using https:// requires compiled in OpenSSL support.

Parameters
string$urihttp/https address or only path to send request to current eZ Publish instance examples: http://ez.no, https://secure.ez.no or content/view/full/2
int | false$portWhich port to connect to, default 80, uses port in $uri if present when $port = false
array | false$postParametersOptional post parameters array, if no post parameters are present, a GET request will be sent
string$userAgentUser agent string, default will be 'eZ Publish'
bool$passthroughWill send result directly to client, default: true
array$cookiesOptional hash of cookie name => values to add to http header
Returns
string|false String if http request, or false if an error occurs. If $passthrough = true, program will end here and send result directly to client.

Referenced by eZStepSiteTypes\downloadFile(), and eZECBHandler\requestRates().

eZHTTPTool::sessionID ( )

Return the session id.

Returns
string
& eZHTTPTool::sessionVariable (   $name,
  $fallbackValue = null 
)

Get session variable $name.

Parameters
string$name
mixed$fallbackValueReturn this if session has not started OR name is undefined if null(default), then force start session and return null if undefined.
Returns
mixed ByRef
eZHTTPTool::setGetVariable (   $var,
  $value 
)

Sets the get variable $var to $value.

See Also
getVariable
eZHTTPTool::setPostVariable (   $var,
  $value 
)

Sets the post variable $var to $value.

See Also
postVariable
eZHTTPTool::setSessionID (   $sessionKey)

Sets a new session id.

Parameters
string$sessionKeyAllowed characters in the range a-z A-Z 0-9 , (comma) and - (minus)
Returns
string Current(old) session id
eZHTTPTool::setSessionKey (   $sessionKey)

Sets a new session id.

Deprecated:
Since 4.4, use ->setSessionID instead!
Parameters
string$sessionKeyAllowed characters in the range a-z A-Z 0-9 , (comma) and - (minus)
Returns
string Current(old) session id
eZHTTPTool::setSessionVariable (   $name,
  $value 
)

Sets the session variable $name to value $value.

Parameters
string$name
mixed$value
static eZHTTPTool::username ( )
static

Returns username from HTTP authentication or false if not logged in. See http://en.php.net/features.http-auth why you can`t safely use $_SERVER['PHP_AUTH_USER'].

eZHTTPTool::variable (   $var,
  $fallbackValue = null 
)
Returns
the HTTP post/get variable $var, or $fallbackValue if the post/get variable does not exist , or null if $fallbackValue is omitted.
See Also
postVariable

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