Location: PHPKode > projects > Breeze CMS - A PHP Content Manage System > libs/Ice/Http/Request.class.php
<?php
class Ice_Http_Request
{
    function Ice_Http_Request()
    {
        
    }
    
    function getGet()
    {
        return !empty($_GET) ? $_GET : array();
    }

    function setGet($getArray)
    {
        foreach($getArray as $key => $value)
        {
            $_GET["$key"] = $value;
        }
        
        return true;
    }

    function getPost()
    {
        return !empty($_POST) ? $_POST : array();
    }
    
    function getRequest()
    {
        return !empty($_REQUEST) ? $_REQUEST : array();
    }
    
    function getCookie()
    {
        return !empty($_COOKIE) ? $_COOKIE : array();
    }
    
    function getSession()
    {
        return !empty($_SESSION) ? $_SESSION : array();
    }
    
    function setSession($sessionVars)
    {
        foreach( $sessionVars as $key => $value ) {
            $_SESSION["$key"] = $value;
        }
        
        return true;
    }
    
    function getRequestValue($key)
    {
		$request = Ice_Http_Ice_Http_Request::getRequest();
        if (isset($request[$key]))
		    return($request[$key]);   
        return '';
    }
    
    function setRequest($requestVars)
    {
        foreach( $requestVars as $key => $value ) {
            $_REQUEST["$key"] = $value;
        }
        
        return true;
    }
    
    function setRequestValue( $key, $value )
    {
        $request = Ice_Http_Ice_Http_Request::getRequest();
        $request["$key"] = $value;
        Ice_Http_Request::setRequest($request);
            
        return true;
    }
    
    function magicQuotesFilter()
    {
        if (!get_magic_quotes_gpc())
        {
            return;
        }
        
        $input = array(Ice_Http_Request::getGet(), Ice_Http_Request::getPost(), Ice_Http_Request::getCookie(), Ice_Http_Request::getRequest());
        while (list($k,$v) = each($input))
        {
            foreach ($v as $key => $val)
            {
                if (!is_array($val))
                {
                    $input[$k][$key] = stripslashes($val);
                    continue;
                }
    		  $input[] = $input[$k][$key];
            }
        }
        Ice_Http_Request::setRequest($input);
        
        unset($input);
    }
    
    /**
     * addslashes value
     * @param mix $value
     * @return mix
     */
    function _addslashes($value) {
    	if (is_array($value))
    	{
    		foreach ($value AS $k => $v)
    		{
    			$value[$k] = Ice_Http_Request::_addslashes($v);
    		}
    	}
    	else
    	{
    		return addslashes($value);
    	}
    	
    	return $value;
    }
    
    /**
     * htmlspecialchars value
     * @param mix $value
     * @return mix
     */
    function _htmlspecialchars($value) {
    	if (is_array($value))
    	{
    		foreach ($value AS $k => $v)
    		{
    			$value[$k] = Ice_Http_Request::_htmlspecialchars($v);
    		}
    	}
    	else
    	{
    		return htmlspecialchars($value);
    	}
    	
    	return $value;
    }
}
Return current item: Breeze CMS - A PHP Content Manage System