You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
89 lines
2.1 KiB
89 lines
2.1 KiB
<?php
|
|
/**
|
|
* Класс для работы с переменными окружения.
|
|
*
|
|
* @copyright
|
|
* @link
|
|
* @package Majestic
|
|
* @subpackage Core
|
|
* @since
|
|
* @version SVN: $Id$
|
|
* @filesource $URL$
|
|
*/
|
|
final class Env
|
|
{
|
|
static public $params = array();
|
|
|
|
static function Get($var, $default = false)
|
|
{
|
|
return isset($_GET[$var]) ? $_GET[$var] : $default;
|
|
}
|
|
|
|
static function Post($var, $default = false)
|
|
{
|
|
return isset($_POST[$var]) ? $_POST[$var] : $default;
|
|
}
|
|
|
|
static function Server($var, $default = false)
|
|
{
|
|
return isset($_SERVER[$var]) ? $_SERVER[$var] : $default;
|
|
}
|
|
|
|
static function Session($var, $default = false)
|
|
{
|
|
return isset($_SESSION[$var]) ? $_SESSION[$var] : $default;
|
|
}
|
|
|
|
static function getCookie($var, $default = false)
|
|
{
|
|
return isset($_COOKIE[$var]) ? $_COOKIE[$var] : $default;
|
|
}
|
|
|
|
static function setCookie($var, $value, $time = 0, $path = '/')
|
|
{
|
|
return setcookie($var, $value, $time, $path);
|
|
}
|
|
|
|
static function getParam($var, $default = false)
|
|
{
|
|
return isset(self::$params[$var]) ? self::$params[$var] : $default;
|
|
}
|
|
|
|
static function setParam($var, $val)
|
|
{
|
|
self::$params[$var] = $val;
|
|
}
|
|
|
|
static function setParams($params=array())
|
|
{
|
|
self::$params = self::$params + $params;
|
|
}
|
|
|
|
static public function Files($name = '', $default = array(), $param = false)
|
|
{
|
|
if(!isset($_FILES)){
|
|
return $default;
|
|
}
|
|
if(empty($name)){
|
|
return $_FILES;
|
|
}
|
|
$res = isset($_FILES[$name]) ? $_FILES[$name] : $default;
|
|
return $param ? $res[$param] : $res;
|
|
}
|
|
|
|
/**
|
|
* Получить цену ставки
|
|
*
|
|
* @param integer $dis - некое число от кооторого считается скидка
|
|
*/
|
|
static public function getBidCost($dis = 0)
|
|
{
|
|
$cost = Load::model('Settings')->get('bid_base_price');
|
|
if ($dis > 0 && $dis <= 100) {
|
|
return $cost - intval($dis);
|
|
}
|
|
|
|
return $cost;
|
|
}
|
|
}
|
|
?>
|