Fixing define PHP errorPHP warning/notices avoided

skala
Julio Montoya 13 years ago
parent 8c57e73fe4
commit 554b3f706e
  1. 24
      main/inc/lib/main_api.lib.php

@ -1012,6 +1012,11 @@ function api_get_user_courses($userid, $fetch_session = true) {
*/
function _api_format_user($user, $add_password = false) {
$result = array();
if (api_is_anonymous()) {
return $user;
}
if (isset($user['firstname']) && isset($user['lastname'])) {
$firstname = $user['firstname'];
$lastname = $user['lastname'];
@ -2117,7 +2122,7 @@ function api_is_platform_admin($allow_sessions_admins = false) {
return true;
}
global $_user;
return $allow_sessions_admins && $_user['status'] == SESSIONADMIN;
return $allow_sessions_admins && isset($_user['status']) && $_user['status'] == SESSIONADMIN;
}
/**
@ -2353,7 +2358,7 @@ function api_is_coach($session_id = 0, $course_code = null) {
*/
function api_is_session_admin() {
global $_user;
return $_user['status'] == SESSIONADMIN;
return isset($_user['status']) && $_user['status'] == SESSIONADMIN;
}
/**
@ -2362,7 +2367,7 @@ function api_is_session_admin() {
*/
function api_is_drh() {
global $_user;
return $_user['status'] == DRH;
return isset($_user['status']) && $_user['status'] == DRH;
}
/**
@ -2371,7 +2376,7 @@ function api_is_drh() {
*/
function api_is_student() {
global $_user;
return $_user['status'] == STUDENT;
return isset($_user['status']) && $_user['status'] == STUDENT;
}
/**
@ -2380,7 +2385,7 @@ function api_is_student() {
*/
function api_is_teacher() {
global $_user;
return $_user['status'] == COURSEMANAGER;
return isset($_user['status']) && $_user['status'] == COURSEMANAGER;
}
/**
@ -3486,9 +3491,12 @@ function api_get_visual_theme() {
if (api_get_setting('user_selected_theme') == 'true') {
$user_info = api_get_user_info();
$user_theme = $user_info['theme'];
if (!empty($user_theme)) {
$visual_theme = $user_theme; // User's theme.
if (isset($user_info['theme'])) {
$user_theme = $user_info['theme'];
if (!empty($user_theme)) {
$visual_theme = $user_theme; // User's theme.
}
}
}

Loading…
Cancel
Save