Skip to content

Commit

Permalink
Avoid the filter the Gravatar URL when images are displayed - refs #8003
Browse files Browse the repository at this point in the history
  • Loading branch information
AngelFQC committed Dec 21, 2015
1 parent 0f015fb commit ac29dcd
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion main/inc/ajax/model.ajax.php
Expand Up @@ -750,7 +750,7 @@ function getWhereClause($col, $oper, $val)
$count_skill_by_course[$course_item['code']] = $skills_in_course[$course_item['code']];
}
}
$item['photo'] = Display::img($user_info['avatar_small']);
$item['photo'] = Display::img($user_info['avatar_small'], $user_info['complete_name'], [], false);
$item['currently_learning'] = !empty($count_skill_by_course) ? array_sum($count_skill_by_course) : 0;
}
}
Expand Down
2 changes: 1 addition & 1 deletion main/inc/lib/attendance.lib.php
Expand Up @@ -693,7 +693,7 @@ public function get_users_rel_course($attendance_id = 0, $groupId = null)
$value['result_color_bar'] = $user_faults['color_bar'];
}

$photo = '<img src ="'.$userInfo['avatar_small'].'" />';
$photo = Display::img($userInfo['avatar_small'], $userInfo['complete_name'], [], false);

$value['photo'] = $photo;
$value['firstname'] = $user_data['firstname'];
Expand Down
9 changes: 6 additions & 3 deletions main/inc/lib/display.lib.php
Expand Up @@ -775,15 +775,18 @@ public static function return_icon(
/**
* Returns the htmlcode for an image
*
* @param string $image the filename of the file (in the main/img/ folder
* @param string $image_path the filename of the file (in the main/img/ folder
* @param string $alt_text the alt text (probably a language variable)
* @param array $additional_attributes (for instance height, width, onclick, ...)
* @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())
public static function img($image_path, $alt_text = '', $additional_attributes = array(), $filterPath = true)
{
// Sanitizing the parameter $image_path
$image_path = Security::filter_img_path($image_path);
if ($filterPath) {
$image_path = Security::filter_img_path($image_path);
}

// alt text = the image name if there is none provided (for XHTML compliance)
if ($alt_text == '') {
Expand Down
2 changes: 1 addition & 1 deletion main/inc/lib/document.lib.php
Expand Up @@ -5522,7 +5522,7 @@ public static function build_document_icon_tag($type, $path)
}
}
if ($user_image) {
return Display::img($icon, $basename, array());
return Display::img($icon, $basename, array(), false);
}
return Display::return_icon($icon, $basename, array());
}
Expand Down
2 changes: 1 addition & 1 deletion main/user/user.php
Expand Up @@ -647,7 +647,7 @@ function get_user_data($from, $number_of_items, $column, $direction)
if (api_is_allowed_to_edit(null, true)) {

$userInfo = api_get_user_info($user_id);
$photo = '<img src="'.$userInfo['avatar_small'].'" alt="'.$userInfo['complete_name'].'" title="'.$userInfo['complete_name'].'" />';
$photo = Display::img($userInfo['avatar_small'], $userInfo['complete_name'], [], false);

$temp[] = $user_id;
$temp[] = $photo;
Expand Down

0 comments on commit ac29dcd

Please sign in to comment.