Only allow explicitly known order types through
This commit is contained in:
parent
f0b3864c7a
commit
13672bccf4
1 changed files with 12 additions and 1 deletions
|
@ -129,7 +129,18 @@ class BaseApi extends BaseModule
|
||||||
$condition = DBA::mergeConditions($condition, ["`uri-id` > ?", intval($request['min_id'])]);
|
$condition = DBA::mergeConditions($condition, ["`uri-id` > ?", intval($request['min_id'])]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
switch ($requested_order) {
|
||||||
|
case TimelineOrderByTypes::RECEIVED:
|
||||||
|
case TimelineOrderByTypes::CHANGED:
|
||||||
|
case TimelineOrderByTypes::EDITED:
|
||||||
|
case TimelineOrderByTypes::CREATED:
|
||||||
|
case TimelineOrderByTypes::COMMENTED:
|
||||||
$order_field = $requested_order;
|
$order_field = $requested_order;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new \Exception("Unrecognized request order: $requested_order");
|
||||||
|
}
|
||||||
|
|
||||||
if (!empty($request['max_id'])) {
|
if (!empty($request['max_id'])) {
|
||||||
$condition = DBA::mergeConditions($condition, ["`$order_field` < ?", DateTimeFormat::convert($request['max_id'], DateTimeFormat::MYSQL)]);
|
$condition = DBA::mergeConditions($condition, ["`$order_field` < ?", DateTimeFormat::convert($request['max_id'], DateTimeFormat::MYSQL)]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue