|
|
|
@ -737,9 +737,8 @@ function api_protect_course_script($print_headers = false) { |
|
|
|
|
* @author Roan Embrechts |
|
|
|
|
*/ |
|
|
|
|
function api_protect_admin_script($allow_sessions_admins = false) { |
|
|
|
|
if (!api_is_platform_admin($allow_sessions_admins)) { |
|
|
|
|
include api_get_path(INCLUDE_PATH).'header.inc.php'; |
|
|
|
|
api_not_allowed(); |
|
|
|
|
if (!api_is_platform_admin($allow_sessions_admins)) { |
|
|
|
|
api_not_allowed(true); |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
return true; |
|
|
|
@ -879,9 +878,9 @@ function _api_format_user($user) { |
|
|
|
|
} else { |
|
|
|
|
$result['mail'] = $user['mail']; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$user_id = intval($user['user_id']); |
|
|
|
|
$result['picture_uri'] = $user['picture_uri']; |
|
|
|
|
$result['user_id'] = intval($user['user_id']); |
|
|
|
|
$result['user_id'] = $user_id; |
|
|
|
|
$result['official_code'] = $user['official_code']; |
|
|
|
|
$result['status'] = $user['status']; |
|
|
|
|
$result['auth_source'] = $user['auth_source']; |
|
|
|
@ -908,6 +907,26 @@ function _api_format_user($user) { |
|
|
|
|
$result['last_login'] = $last_login; |
|
|
|
|
// Kept for historical reasons |
|
|
|
|
$result['lastLogin'] = $last_login; |
|
|
|
|
|
|
|
|
|
//Getting user avatar |
|
|
|
|
|
|
|
|
|
$picture_filename = trim($user['picture_uri']); |
|
|
|
|
$avatar = api_get_path(WEB_CODE_PATH).'img/unknown.jpg'; |
|
|
|
|
$avatar_small = api_get_path(WEB_CODE_PATH).'img/unknown_22.jpg'; |
|
|
|
|
$dir = 'upload/users/'.$user_id.'/'; |
|
|
|
|
if (!empty($picture_filename) && api_is_anonymous() ) { |
|
|
|
|
if (api_get_setting('split_users_upload_directory') === 'true') { |
|
|
|
|
$dir = 'upload/users/'.substr((string)$user_id, 0, 1).'/'.$user_id.'/'; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
$image_sys_path = api_get_path(SYS_CODE_PATH).$dir.$picture_filename; |
|
|
|
|
if (file_exists($image_sys_path) && !is_dir($image_sys_path)) { |
|
|
|
|
$avatar = api_get_path(WEB_CODE_PATH).$dir.$picture_filename; |
|
|
|
|
$avatar_small = api_get_path(WEB_CODE_PATH).$dir.'small_'.$picture_filename; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$result['avatar'] = $avatar; |
|
|
|
|
$result['avatar_small'] = $avatar_small; |
|
|
|
|
return $result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|