API16

JRequest/clean

< API16:JRequest

The "API16" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.

Description

Cleans the request from script injection.



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();
}



Examples

Code Examples


Advertisement