Actions

API16

JRequest/clean

From Joomla! Documentation

< API16:JRequest
Revision as of 17:46, 22 March 2010 by Doxiki (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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.

[Edit Descripton]

Description:JRequest/clean

Syntax

static clean()


Returns

void

Defined in

libraries/joomla/environment/request.php

Importing

jimport( 'joomla.environment.request' );

Source Body

public static function clean()
{
        self::_cleanArray($_FILES);
        self::_cleanArray($_ENV);
        self::_cleanArray($_GET);
        self::_cleanArray($_POST);
        self::_cleanArray($_COOKIE);
        self::_cleanArray($_SERVER);
 
        if (isset($_SESSION)) {
                self::_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();
}

[Edit See Also] SeeAlso:JRequest/clean

Examples

<CodeExamplesForm />