Ejemplo n.º 1
0
 /**
  * Set a cookie, secure if possible
  * @param object $request request details
  * @param string $name cookie name
  * @param string $value cookie value
  * @param string $lifetime cookie lifetime
  * @param string $path cookie path
  * @param string $domain cookie domain
  * @param string $html_only set html only cookie flag
  * @return void
  */
 public function secure_cookie($request, $name, $value, $lifetime = 0, $path = '', $domain = '', $html_only = true)
 {
     if ($name == 'hm_reload_folders') {
         return Hm_Functions::setcookie($name, $value);
     }
     if ($request->tls) {
         $secure = true;
     } else {
         $secure = false;
     }
     if (!$path && isset($request->path)) {
         $path = $request->path;
     }
     if (!$domain && array_key_exists('SERVER_NAME', $request->server) && strtolower($request->server['SERVER_NAME']) != 'localhost') {
         $domain = $request->server['SERVER_NAME'];
     }
     return Hm_Functions::setcookie($name, $value, $lifetime, $path, $domain, $secure, $html_only);
 }