|
@ -94,8 +94,14 @@ $table->setup(); |
|
|
|
|
|
|
|
|
// Work out direction of sort required. |
|
|
// Work out direction of sort required. |
|
|
$sortcolumns = $table->get_sort_columns(); |
|
|
$sortcolumns = $table->get_sort_columns(); |
|
|
// Now do sorting if specified. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Sanity check $sort var before including in sql. Make sure it matches a known column. |
|
|
|
|
|
$allowedsort = array_diff(array_keys($table->columns), $table->column_nosort); |
|
|
|
|
|
if (!in_array($sort, $allowedsort)) { |
|
|
|
|
|
$sort = ''; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Now do sorting if specified. |
|
|
$orderby = ' ORDER BY percentage ASC'; |
|
|
$orderby = ' ORDER BY percentage ASC'; |
|
|
if (!empty($sort)) { |
|
|
if (!empty($sort)) { |
|
|
$direction = ' DESC'; |
|
|
$direction = ' DESC'; |
|
|