From 8b1d424098e44c04e1765de3bb0b4a33075270c7 Mon Sep 17 00:00:00 2001 From: Adrian Greeve Date: Wed, 27 Nov 2013 14:43:33 +0800 Subject: [PATCH] MDL-43058 reports: updated sql to return fullnames in security check reports. --- report/security/locallib.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/report/security/locallib.php b/report/security/locallib.php index c49f15e5f2a..07dd51e94cb 100644 --- a/report/security/locallib.php +++ b/report/security/locallib.php @@ -508,7 +508,8 @@ function report_security_check_riskxss($detailed=false) { $result->info = get_string('check_riskxss_warning', 'report_security', $count); if ($detailed) { - $users = $DB->get_records_sql("SELECT DISTINCT u.id, u.firstname, u.lastname, u.picture, u.imagealt $sqlfrom", $params); + $userfields = user_picture::fields('u'); + $users = $DB->get_records_sql("SELECT DISTINCT $userfields $sqlfrom", $params); foreach ($users as $uid=>$user) { $users[$uid] = fullname($user); } @@ -710,7 +711,8 @@ function report_security_check_riskadmin($detailed=false) { $result->status = null; $result->link = null; - $sql = "SELECT u.id, u.firstname, u.lastname, u.picture, u.imagealt, u.email + $userfields = user_picture::fields('u'); + $sql = "SELECT $userfields FROM {user} u WHERE u.id IN ($CFG->siteadmins)"; @@ -834,7 +836,8 @@ function report_security_check_riskbackup($detailed=false) { $users = array(); list($sort, $sortparams) = users_order_by_sql('u'); - $rs = $DB->get_recordset_sql("SELECT DISTINCT u.id, u.firstname, u.lastname, u.picture, u.imagealt, u.email, ra.contextid, ra.roleid + $userfields = user_picture::fields('u'); + $rs = $DB->get_recordset_sql("SELECT DISTINCT $userfields, ra.contextid, ra.roleid $sqluserinfo ORDER BY $sort", array_merge($params, $sortparams)); foreach ($rs as $user) {