%PDF- %PDF-
Direktori : /www/varak.net/mail2.varak.net_old/libraries/afterlogic/common/utils/ |
Current File : //www/varak.net/mail2.varak.net_old/libraries/afterlogic/common/utils/get.php |
<?php /* * Copyright 2004-2014, AfterLogic Corp. * Licensed under AGPLv3 license or AfterLogic license * if commercial version of the product was purchased. * See the LICENSE file for a full license statement. */ /** * @package Api */ class CGet { /** * @var bool */ public static $bIsMagicQuotesOn = false; private function __construct() {} /** * @param string $sKey * @return bool */ public static function Has($sKey) { return (isset($_GET[$sKey])); } /** * @param string $sKey * @param mixed $nmDefault = null * @return mixed */ public static function Get($sKey, $nmDefault = null) { return (isset($_GET[$sKey])) ? self::_stripSlashesValue($_GET[$sKey]) : $nmDefault; } /** * @param string $sKey * @param mixed $mValue */ public static function Set($sKey, $mValue) { $_GET[$sKey] = $mValue; } /** * @param mixed $mValue * @return mixed */ private static function _stripSlashesValue($mValue) { if (!self::$bIsMagicQuotesOn) { return $mValue; } $sType = gettype($mValue); if ($sType === 'string') { return stripslashes($mValue); } else if ($sType === 'array') { $aReturnValue = array(); $mValueKeys = array_keys($mValue); foreach($mValueKeys as $sKey) { $aReturnValue[$sKey] = self::_stripSlashesValue($mValue[$sKey]); } return $aReturnValue; } else { return $mValue; } } } CGet::$bIsMagicQuotesOn = (bool) ini_get('magic_quotes_gpc');