diff --git a/main/inc/lib/link.lib.php b/main/inc/lib/link.lib.php index a9f5fc6207..15bb226264 100755 --- a/main/inc/lib/link.lib.php +++ b/main/inc/lib/link.lib.php @@ -474,12 +474,11 @@ class Link extends Model /** * * Get link info - * @param int link id - * @param integer $id + * @param int $id * @return array link info * **/ - public static function get_link_info($id) + public static function getLinkInfo($id) { $tbl_link = Database::get_course_table(TABLE_LINK); $course_id = api_get_course_int_id(); @@ -1693,7 +1692,7 @@ class Link extends Model { $course_id = api_get_course_int_id(); $session_id = api_get_session_id(); - $linkInfo = self::get_link_info($linkId); + $linkInfo = self::getLinkInfo($linkId); $categoryId = isset($linkInfo['category_id']) ? $linkInfo['category_id'] : ''; $lpId = isset($_GET['lp_id']) ? Security::remove_XSS($_GET['lp_id']) : null; diff --git a/main/link/link_goto.php b/main/link/link_goto.php index 56a6f162b9..c5e5cf4a37 100755 --- a/main/link/link_goto.php +++ b/main/link/link_goto.php @@ -20,7 +20,7 @@ $this_section = SECTION_COURSES; $linkId = intval($_GET['link_id']); -$linkInfo = Link::get_link_info($linkId); +$linkInfo = Link::getLinkInfo($linkId); $linkUrl = html_entity_decode(Security::remove_XSS($linkInfo['url'])); // Launch event Event::event_link($linkId); diff --git a/main/lp/learnpath.class.php b/main/lp/learnpath.class.php index 9f01db0c4c..2b4caa63d3 100755 --- a/main/lp/learnpath.class.php +++ b/main/lp/learnpath.class.php @@ -12294,9 +12294,12 @@ EOD; $origin = 'learnpath' ) { $session_id = api_get_session_id(); + $course_info = api_get_course_info_by_id($course_id); + $learningPathId = intval($learningPathId); $id_in_path = intval($id_in_path); $lpViewId = intval($lpViewId); + $em = Database::getManager(); $lpItemRepo = $em->getRepository('ChamiloCourseBundle:CLpItem'); /** @var CLpItem $rowItem */ @@ -12310,7 +12313,6 @@ EOD; return -1; } - $course_info = api_get_course_info_by_id($course_id); $course_code = $course_info['code']; $type = $rowItem->getItemType(); $id = empty($rowItem->getPath()) ? '0' : $rowItem->getPath(); @@ -12326,9 +12328,11 @@ EOD; case TOOL_ANNOUNCEMENT: return $main_dir_path.'announcements/announcements.php?ann_id='.$id.'&'.$extraParams; case TOOL_LINK: - $linkInfo = Link::get_link_info($id); - - return $linkInfo['url']; + $linkInfo = Link::getLinkInfo($id); + if (isset($linkInfo['url'])) { + return $linkInfo['url']; + } + return ''; case TOOL_QUIZ: if (empty($id)) { return '';