MDL-20700 coding style cleanup - cvs keywords removed, closign php tag removed, trail...
[moodle.git] / userpix / upgrade.php
1 <?php
2       // This script updates all users picturesi to remove black border.
5     include('../config.php');
6     include('../lib/gdlib.php');
8     $PAGE->set_url(new moodle_url($CFG->wwwroot.'/userpix/upgrade.php'));
10     require_login();
12     require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
14     if (!$users = $DB->get_records("user", array("picture"=>"1"), "lastaccess DESC", "id,firstname,lastname")) {
15         print_error('nousers');
16     }
18     $title = get_string("users");
20     $PAGE->navbar->add($title);
21     $PAGE->set_title($title);
22     $PAGE->set_heading($title);
23     echo $OUTPUT->header();
25     foreach ($users as $user) {
26         upgrade_profile_image($user->id);
27         $fullname = fullname($user);
28         echo "<a href=\"$CFG->wwwroot/user/view.php?id=$user->id&amp;course=1\"".
29              "title=\"$fullname\">";
30         require_once($CFG->libdir.'/filelib.php');
31         $userpictureurl = get_file_url($user->id.'/f1.jpg', null, 'user');
32         echo '<img src="'. $userpictureurl .'"'.
33             ' style="border:0px; width:100px; height:100px" alt="'.$fullname.'" />';
34         echo "</a> \n";
35     }
37     echo $OUTPUT->footer();