From 2a9d4360f1b2e6cfbe5a089d984cc91374004d23 Mon Sep 17 00:00:00 2001 From: Julio Date: Thu, 26 Dec 2019 15:11:40 +0100 Subject: [PATCH] Fix PHP erro in LP view --- public/main/forum/viewforum.php | 9 +- public/main/inc/lib/UnserializeApi.php | 6 +- public/main/lp/lp_controller.php | 122 +++++++++++++++---------- public/main/lp/lp_view.php | 8 +- 4 files changed, 89 insertions(+), 56 deletions(-) diff --git a/public/main/forum/viewforum.php b/public/main/forum/viewforum.php index dceb6179d4..1b9efbe55b 100644 --- a/public/main/forum/viewforum.php +++ b/public/main/forum/viewforum.php @@ -95,15 +95,15 @@ if (!empty($groupId)) { } /* Header and Breadcrumbs */ -$my_search = isset($_GET['search']) ? $_GET['search'] : ''; -$my_action = isset($_GET['action']) ? $_GET['action'] : ''; +$my_search = $_GET['search'] ?? ''; +$my_action = $_GET['action'] ?? ''; $logInfo = [ 'tool' => TOOL_FORUM, 'tool_id' => $my_forum, 'tool_id_detail' => 0, 'action' => !empty($my_action) ? $my_action : 'list-threads', - 'action_details' => isset($_GET['content']) ? $_GET['content'] : '', + 'action_details' => $_GET['content'] ?? '', ]; Event::registerLog($logInfo); @@ -147,7 +147,8 @@ if (!empty($groupId)) { } if ('learnpath' == $origin) { - Display::display_reduced_header(); + //Display::display_reduced_header(); + Display::display_no_header(); } else { // The last element of the breadcrumb navigation is already set in interbreadcrumb, so give empty string. Display::display_header(); diff --git a/public/main/inc/lib/UnserializeApi.php b/public/main/inc/lib/UnserializeApi.php index e99ce56c7e..086280f739 100644 --- a/public/main/inc/lib/UnserializeApi.php +++ b/public/main/inc/lib/UnserializeApi.php @@ -100,6 +100,10 @@ class UnserializeApi scormResource::class, Link::class, LpItem::class, + \Chamilo\CourseBundle\Entity\CLp::class, + \Chamilo\CoreBundle\Entity\Course::class, + \Chamilo\CoreBundle\Entity\Resource\ResourceNode::class, + \Chamilo\CoreBundle\Entity\Resource\ResourceType::class, ] ); break; @@ -115,7 +119,7 @@ class UnserializeApi ); } - return Unserialize::unserialize( + return @Unserialize::unserialize( $serialized, ['allowed_classes' => $allowedClasses] ); diff --git a/public/main/lp/lp_controller.php b/public/main/lp/lp_controller.php index 69a6b8b711..ed34191de7 100644 --- a/public/main/lp/lp_controller.php +++ b/public/main/lp/lp_controller.php @@ -47,10 +47,8 @@ $(window).on("load", function () { setFocus(); }); '; -$cidReq = api_get_cidreq(); - -$ajax_url = api_get_path(WEB_AJAX_PATH).'lp.ajax.php?'.$cidReq; -$listUrl = api_get_self().'?action=list&'.$cidReq; +$ajax_url = api_get_path(WEB_AJAX_PATH).'lp.ajax.php?'.api_get_cidreq(); +$listUrl = api_get_self().'?action=list&'.api_get_cidreq(); $htmlHeadXtra[] = '