<?php
/***************************************************************************
- * Copyright (C) 2003-2008 Polytechnique.org *
+ * Copyright (C) 2003-2010 Polytechnique.org *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
unset($_COOKIE[$key]);
}
- public static function set($key, $value, $days) {
+ public static function set($key, $value, $days, $secure = false) {
global $globals;
$key = $globals->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)