Minor - format code, validate type

pull/3766/head^2
Julio Montoya 5 years ago
parent d939402d83
commit 25e79827e2
  1. 3
      main/calendar/agenda.php
  2. 1
      main/calendar/planification.php
  3. 4
      main/inc/lib/agenda.lib.php

@ -1,4 +1,5 @@
<?php <?php
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
// use anonymous mode when accessing this course tool // use anonymous mode when accessing this course tool
@ -16,7 +17,7 @@ $action = isset($_GET['action']) ? Security::remove_XSS($_GET['action']) : null;
$url = null; $url = null;
if (empty($action)) { if (empty($action)) {
if (!empty($course_info)) { if (!empty($course_info)) {
$url = api_get_path(WEB_CODE_PATH).'calendar/agenda_js.php?type=course'.'&'.api_get_cidreq(); $url = api_get_path(WEB_CODE_PATH).'calendar/agenda_js.php?type=course&'.api_get_cidreq();
} else { } else {
$url = api_get_path(WEB_CODE_PATH).'calendar/agenda_js.php?'; $url = api_get_path(WEB_CODE_PATH).'calendar/agenda_js.php?';
} }

@ -1,4 +1,5 @@
<?php <?php
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Component\Utils\ChamiloApi; use Chamilo\CoreBundle\Component\Utils\ChamiloApi;

@ -1,4 +1,5 @@
<?php <?php
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
/** /**
@ -154,8 +155,9 @@ class Agenda
*/ */
public function setType($type) public function setType($type)
{ {
$type = (string) trim($type);
$typeList = $this->getTypes(); $typeList = $this->getTypes();
if (in_array($type, $typeList)) { if (in_array($type, $typeList, true)) {
$this->type = $type; $this->type = $type;
} }
} }

Loading…
Cancel
Save