Add api_set_cookie() to enabled secure (if needed) and httponly

BT#18542 BT#18541
pull/3825/head
Julio Montoya 5 years ago
parent 6cc95dd18a
commit 5b85a6b74d
  1. 12
      main/inc/lib/api.lib.php
  2. 2
      main/inc/lib/userportal.lib.php

@ -8730,6 +8730,12 @@ function api_is_allowed_in_course()
return Session::read('is_allowed_in_course');
}
function api_set_cookie($name, $value, $expires = 0)
{
$expires = (int) $expires;
setcookie($name, $value, $expires, '', '', api_is_https(), true);
}
/**
* Set the cookie to go directly to the course code $in_firstpage
* after login.
@ -8738,7 +8744,7 @@ function api_is_allowed_in_course()
*/
function api_set_firstpage_parameter($value)
{
setcookie('GotoCourse', $value);
api_set_cookie('GotoCourse', $value);
}
/**
@ -8747,7 +8753,7 @@ function api_set_firstpage_parameter($value)
*/
function api_delete_firstpage_parameter()
{
setcookie('GotoCourse', '', time() - 3600);
api_set_cookie('GotoCourse', '', time() - 3600);
}
/**
@ -9096,7 +9102,7 @@ function api_get_users_status_ignored_in_reports($format = 'array')
*/
function api_set_site_use_cookie_warning_cookie()
{
setcookie('ChamiloUsesCookies', 'ok', time() + 31556926);
api_set_cookie('ChamiloUsesCookies', 'ok', time() + 31556926);
}
/**

@ -75,7 +75,7 @@ class IndexManager
*/
public static function setDefaultMyCourseView($view, $userId)
{
setcookie('defaultMyCourseView'.$userId, $view);
api_set_cookie('defaultMyCourseView'.$userId, $view);
}
/**

Loading…
Cancel
Save