If we are passed an empty string for $order, still create valid
SQL. Some callers in 1.9 seem to not care about order, passing
an explicit ''. Shocking! ;-)
}
$coursefields = 'c.' .join(',c.', $fields);
+ $sort = trim($sort);
+ if ($sort !== '') {
+ $sort = "ORDER BY $sort";
+ }
+
$sysctx = get_context_instance(CONTEXT_SYSTEM);
if (has_cap_fad($cap, $sysctx, $ad, $doanything)) {
//
ON c.category=cc.id
JOIN {$CFG->prefix}context ctx
ON (c.id=ctx.instanceid AND ctx.contextlevel=".CONTEXT_COURSE.")
- ORDER BY $sort ";
+ $sort ";
$rs = get_recordset_sql($sql);
} else {
//
WHERE ra.id IS NOT NULL
OR rc.id IS NOT NULL
$catclause
- ORDER BY $sort ";
+ $sort ";
$rs = get_recordset_sql($sql);
}
$courses = array();