Actions

API15

JRequest/clean

From Joomla! Documentation

< API15:JRequest
Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.

Contents

Description

Cleans the request from script injection.

[<! removed edit link to red link >]

<! removed transcluded page call, red link never existed >

Syntax

clean()


Returns

void

Defined in

libraries/joomla/environment/request.php

Importing

jimport( 'joomla.environment.request' );

Source Body

function clean()
{
        JRequest::_cleanArray( $_FILES );
        JRequest::_cleanArray( $_ENV );
        JRequest::_cleanArray( $_GET );
        JRequest::_cleanArray( $_POST );
        JRequest::_cleanArray( $_COOKIE );
        JRequest::_cleanArray( $_SERVER );
 
        if (isset( $_SESSION )) {
                JRequest::_cleanArray( $_SESSION );
        }
 
        $REQUEST        = $_REQUEST;
        $GET            = $_GET;
        $POST           = $_POST;
        $COOKIE         = $_COOKIE;
        $FILES          = $_FILES;
        $ENV            = $_ENV;
        $SERVER         = $_SERVER;
 
        if (isset ( $_SESSION )) {
                $SESSION = $_SESSION;
        }
 
        foreach ($GLOBALS as $key => $value)
        {
                if ( $key != 'GLOBALS' ) {
                        unset ( $GLOBALS [ $key ] );
                }
        }
        $_REQUEST       = $REQUEST;
        $_GET           = $GET;
        $_POST          = $POST;
        $_COOKIE        = $COOKIE;
        $_FILES         = $FILES;
        $_ENV           = $ENV;
        $_SERVER        = $SERVER;
 
        if (isset ( $SESSION )) {
                $_SESSION = $SESSION;
        }
 
        // Make sure the request hash is clean on file inclusion
        $GLOBALS['_JREQUEST'] = array();
}

[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >

Examples

<CodeExamplesForm />