MDL-14279: use get_file_url instead of checking $CFG->slashargument manually (merge...
[moodle.git] / userpix / upgrade.php
CommitLineData
0f363686 1<?php // $Id$
2 // This script updates all users picturesi to remove black border.
3
4
5 include('../config.php');
6 include('../lib/gdlib.php');
7
8 require_login();
9
ef35441d 10 require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
0be6f678 11
5d910388 12 if (!$users = $DB->get_records("user", array("picture"=>"1"), "lastaccess DESC", "id,firstname,lastname")) {
28800f02 13 print_error('nousers');
0f363686 14 }
0be6f678 15
0f363686 16 $title = get_string("users");
0be6f678 17
18 print_header($title, $title, build_navigation(array(array('name' => $title, 'link' => null, 'type' => 'misc'))));
19
0f363686 20 foreach ($users as $user) {
21 upgrade_profile_image($user->id);
22 $fullname = fullname($user);
23 echo "<a href=\"$CFG->wwwroot/user/view.php?id=$user->id&amp;course=1\"".
24 "title=\"$fullname\">";
5a254a29 25 require_once($CFG->libdir.'/filelib.php');
26 $userpictureurl = get_file_url($user->id.'/f1.jpg', null, 'user');
27 echo '<img src="'. $userpictureurl .'"'.
28 ' style="border:0px; width:100px; height:100px" alt="'.$fullname.'" />';
0f363686 29 echo "</a> \n";
30 }
0be6f678 31
0f363686 32 print_footer();
33
34?>