From 22f944e36ab353400a1df6e30c3843a67d6d5260 Mon Sep 17 00:00:00 2001 From: Martin Dougiamas Date: Mon, 3 May 2010 12:40:51 +0000 Subject: [PATCH] MDL-22156 Added placeholder to avoid Postgres barfing on the quotes. Spotted by David M --- repository/recent/repository.class.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/repository/recent/repository.class.php b/repository/recent/repository.class.php index 0afa04e1268..9c9fbc6af3a 100755 --- a/repository/recent/repository.class.php +++ b/repository/recent/repository.class.php @@ -65,9 +65,12 @@ class repository_recent extends repository { private function get_recent_files($limitfrom = 0, $limit = DEFAULT_RECENT_FILES_NUM) { global $USER, $DB; - $sql = 'SELECT DISTINCT pathnamehash, contextid, itemid, filearea, filepath, filename FROM {files} WHERE userid = ? AND filename <> "." ORDER BY timecreated DESC'; - $params = array('userid'=>$USER->id); - $rs = $DB->get_recordset_sql($sql, array('userid'=>$USER->id), $limitfrom, $limit); + $sql = 'SELECT DISTINCT pathnamehash, contextid, itemid, filearea, filepath, filename + FROM {files} + WHERE userid = ? AND filename <> ? + ORDER BY timecreated DESC'; + $params = array('userid'=>$USER->id, 'filename'=>'.'); + $rs = $DB->get_recordset_sql($sql, $params, $limitfrom, $limit); $result = array(); foreach ($rs as $file_record) { $info = array();