X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=classes%2Fenv.php;h=7a2144ffd6bcc544f786979405f433e6bc1bd4b7;hb=90e4106093ff5c8c60d0642c15e78184ebcb28ac;hp=5b6a2b9d6fc8cbb845dedfda86d0876535c2d641;hpb=f09d3319de8a65f5eb11ce0e73a3dc08a72c4091;p=platal.git diff --git a/classes/env.php b/classes/env.php index 5b6a2b9..7a2144f 100644 --- a/classes/env.php +++ b/classes/env.php @@ -1,6 +1,6 @@ cookie_ns . $key; - setcookie($key, $value, time() + 86400 * $days, $globals->cookie_path); - $_COOKIE[$key] = $value; + if (!$secure || @$_SERVER['HTTPS']) { + setcookie($key, $value, time() + 86400 * $days, $globals->cookie_path, '', + $secure, $secure); + $_COOKIE[$key] = $value; + } } public static function v($key, $default = null) @@ -255,8 +258,8 @@ class Cookie public static function i($key, $default = 0) { - $i = Cookie::_get($key, $default); - return is_numeric($i) ? intval($i) : $default; + $i = to_integer(Cookie::_get($key, $default)); + return $i === false ? $default : $i; } public static function l(array $keys)