Skip to content

Commit

Permalink
MDL-13399 prevent ambiguous column names in get_my_courses
Browse files Browse the repository at this point in the history
  • Loading branch information
skodak committed Feb 18, 2008
1 parent b28a21b commit 8905e7b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/datalib.php
Original file line number Diff line number Diff line change
Expand Up @@ -832,6 +832,16 @@ function get_my_courses($userid, $sort='visible DESC,sortorder ASC', $fields=NUL
$orderby = '';
$sort = trim($sort);
if (!empty($sort)) {
$rawsorts = explode(',', $sort);
$sorts = array();
foreach ($rawsorts as $rawsort) {
$rawsort = trim($rawsort);
if (strpos('c.', $rawsort)) {
$rawsort = substr($rawsort, 2);
}
$sorts[] = trim($rawsort);
}
$sort = 'c.'.implode(',c.', $sorts);
$orderby = "ORDER BY $sort";
}

Expand Down

0 comments on commit 8905e7b

Please sign in to comment.