Fix function doc, use correct cast int.

pull/2487/head
jmontoyaa 9 years ago
parent e08ae50d9b
commit 52ea8738c0
  1. 2
      main/inc/lib/api.lib.php
  2. 4
      main/lp/learnpath.class.php
  3. 4
      main/lp/lp_add_item.php

@ -2121,7 +2121,7 @@ function api_set_anonymous() {
*/ */
function api_get_session_id() function api_get_session_id()
{ {
return Session::read('id_session', 0); return (int) Session::read('id_session', 0);
} }
/** /**

@ -2610,7 +2610,7 @@ class learnpath
/** /**
* Gets the learnpath session id * Gets the learnpath session id
* @return string Learnpath theme * @return int
*/ */
public function get_lp_session_id() public function get_lp_session_id()
{ {
@ -2618,7 +2618,7 @@ class learnpath
error_log('New LP - In learnpath::get_lp_session_id()', 0); error_log('New LP - In learnpath::get_lp_session_id()', 0);
} }
if (!empty ($this->lp_session_id)) { if (!empty ($this->lp_session_id)) {
return $this->lp_session_id; return (int) $this->lp_session_id;
} else { } else {
return 0; return 0;
} }

@ -29,7 +29,6 @@ $is_allowed_to_edit = api_is_allowed_to_edit(null, false);
$listUrl = api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?action=view&lp_id='.$learnpath_id.'&'.api_get_cidreq().'&isStudentView=true'; $listUrl = api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?action=view&lp_id='.$learnpath_id.'&'.api_get_cidreq().'&isStudentView=true';
if (!$is_allowed_to_edit) { if (!$is_allowed_to_edit) {
error_log('New LP - User not authorized in lp_add_item.php');
header("Location: $listUrl"); header("Location: $listUrl");
exit; exit;
} }
@ -41,10 +40,9 @@ if (empty($learnPath)) {
api_not_allowed(); api_not_allowed();
} }
if ((int)$learnPath->get_lp_session_id() != (int)api_get_session_id()) { if ($learnPath->get_lp_session_id() != api_get_session_id()) {
// You cannot edit an LP from a base course. // You cannot edit an LP from a base course.
header("Location: $listUrl"); header("Location: $listUrl");
exit; exit;
} }

Loading…
Cancel
Save