diff --git a/main/inc/ajax/exercise.ajax.php b/main/inc/ajax/exercise.ajax.php index 5637788ae2..c9c30e4cfb 100755 --- a/main/inc/ajax/exercise.ajax.php +++ b/main/inc/ajax/exercise.ajax.php @@ -140,7 +140,10 @@ switch ($action) { GROUP by question_id ) as count_table"; $result_count = Database::query($sql); - $count_questions = Database::fetch_array($result_count,'ASSOC'); + $count_questions = Database::fetch_array( + $result_count, + 'ASSOC' + ); $count_questions = $count_questions['count_question_id']; $row['count_questions'] = $count_questions; diff --git a/main/inc/lib/api.lib.php b/main/inc/lib/api.lib.php index 9885999efc..abeda17b37 100644 --- a/main/inc/lib/api.lib.php +++ b/main/inc/lib/api.lib.php @@ -1459,8 +1459,10 @@ function api_get_user_info( $apcVar = null; $user = false; $cacheAvailable = api_get_configuration_value('apc'); + if (empty($user_id)) { $userFromSession = Session::read('_user'); + if (isset($userFromSession)) { if (!empty($cacheAvailable)) { $apcVar = api_get_configuration_value('apc_prefix') . 'userinfo_' . $userFromSession['user_id']; diff --git a/main/inc/lib/banner.lib.php b/main/inc/lib/banner.lib.php index dca8c0b673..a83b73ff61 100755 --- a/main/inc/lib/banner.lib.php +++ b/main/inc/lib/banner.lib.php @@ -552,20 +552,19 @@ function return_breadcrumb($interbreadcrumb, $language_file, $nameTools) switch (api_get_setting('breadcrumbs_course_homepage')) { case 'get_lang': - - $navigation_item['title'] = Display::return_icon('home.png', get_lang('CourseHomepageLink'), null, ICON_SIZE_TINY); + $navigation_item['title'] = Display::return_icon('home.png', get_lang('CourseHomepageLink'), [], ICON_SIZE_TINY); break; case 'course_code': - $navigation_item['title'] = Display::return_icon('home.png', $_course['official_code'], null, ICON_SIZE_TINY).' '.$_course['official_code']; + $navigation_item['title'] = Display::return_icon('home.png', $_course['official_code'], [], ICON_SIZE_TINY).' '.$_course['official_code']; break; case 'session_name_and_course_title': - $navigation_item['title'] = Display::return_icon('home.png', $_course['name'].$my_session_name, null, ICON_SIZE_TINY).' '.$course_title.$my_session_name; + $navigation_item['title'] = Display::return_icon('home.png', $_course['name'].$my_session_name, [], ICON_SIZE_TINY).' '.$course_title.$my_session_name; break; default: if (api_get_session_id() != -1 ) { - $navigation_item['title'] = Display::return_icon('home.png', $_course['name'].$my_session_name, null, ICON_SIZE_TINY).' '.$course_title.$my_session_name; + $navigation_item['title'] = Display::return_icon('home.png', $_course['name'].$my_session_name, [], ICON_SIZE_TINY).' '.$course_title.$my_session_name; } else { - $navigation_item['title'] = Display::return_icon('home.png', $_course['name'], null, ICON_SIZE_TINY).' '.$course_title; + $navigation_item['title'] = Display::return_icon('home.png', $_course['name'], [], ICON_SIZE_TINY).' '.$course_title; } break; } diff --git a/main/inc/lib/course_home.lib.php b/main/inc/lib/course_home.lib.php index 5e65ba3a54..79d1323c84 100755 --- a/main/inc/lib/course_home.lib.php +++ b/main/inc/lib/course_home.lib.php @@ -1290,7 +1290,7 @@ class CourseHome $html .= Display::return_icon( substr($navigation_item['image'], 0, -3).'png', $navigation_item['name'], - null, + [], ICON_SIZE_MEDIUM ); $html .= ' '; diff --git a/main/inc/lib/display.lib.php b/main/inc/lib/display.lib.php index d52fd708fc..e32cd5ca2e 100755 --- a/main/inc/lib/display.lib.php +++ b/main/inc/lib/display.lib.php @@ -805,7 +805,6 @@ class Display if ($return_only_path) { return $icon; - } $img = self::img($icon, $alt_text, $additional_attributes); @@ -827,7 +826,7 @@ class Display * @param boolean $filterPath Optional. Whether filter the image path. Default is true * @author Julio Montoya 2010 */ - public static function img($image_path, $alt_text = '', $additional_attributes = array(), $filterPath = true) + public static function img($image_path, $alt_text = '', $additional_attributes = null, $filterPath = true) { if (empty($image_path)) { // For some reason, the call to img() happened without a proper @@ -848,6 +847,10 @@ class Display $alt_text = basename($image_path); } + if (empty($additional_attributes)) { + $additional_attributes = []; + } + $additional_attributes['src'] = $image_path; if (empty($additional_attributes['alt'])) { diff --git a/main/inc/lib/template.lib.php b/main/inc/lib/template.lib.php index 70ea5f6e6b..3c89049dd2 100755 --- a/main/inc/lib/template.lib.php +++ b/main/inc/lib/template.lib.php @@ -801,8 +801,14 @@ class Template } } - $this->assign('online_button', Display::return_icon('statusonline.png', null, null, ICON_SIZE_ATOM)); - $this->assign('offline_button',Display::return_icon('statusoffline.png', null, null, ICON_SIZE_ATOM)); + $this->assign( + 'online_button', + Display::return_icon('statusonline.png', null, [], ICON_SIZE_ATOM) + ); + $this->assign( + 'offline_button', + Display::return_icon('statusoffline.png', null, [], ICON_SIZE_ATOM) + ); // Get language iso-code for this page - ignore errors $this->assign('document_language', api_get_language_isocode()); @@ -894,7 +900,7 @@ class Template //@todo move this in the template $rightFloatMenu = ''; - $iconBug = Display::return_icon('bug.png', get_lang('ReportABug'), null, ICON_SIZE_LARGE); + $iconBug = Display::return_icon('bug.png', get_lang('ReportABug'), [], ICON_SIZE_LARGE); if (api_get_setting('show_link_bug_notification') == 'true' && $this->user_is_logged_in) { $rightFloatMenu = '
@@ -905,7 +911,7 @@ class Template if (api_get_setting('show_link_ticket_notification') == 'true' && $this->user_is_logged_in) { // by default is project_id = 1 - $iconTicket = Display::return_icon('bug.png', get_lang('Ticket'), null, ICON_SIZE_LARGE); + $iconTicket = Display::return_icon('bug.png', get_lang('Ticket'), [], ICON_SIZE_LARGE); $courseInfo = api_get_course_info(); $courseParams = ''; if (!empty($courseInfo)) {