switch (self::$order) {
case 'received':
- $this->max_id = $request['last_received'] ?? $this->max_id;
+ $this->maxId = $request['last_received'] ?? $this->maxId;
break;
case 'created':
- $this->max_id = $request['last_created'] ?? $this->max_id;
+ $this->maxId = $request['last_created'] ?? $this->maxId;
break;
case 'uriid':
- $this->max_id = $request['last_uriid'] ?? $this->max_id;
+ $this->maxId = $request['last_uriid'] ?? $this->maxId;
break;
default:
self::$order = 'commented';
- $this->max_id = $request['last_commented'] ?? $this->max_id;
+ $this->maxId = $request['last_commented'] ?? $this->maxId;
}
}
if (!empty($this->itemUriId)) {
$conditionStrings = DBA::mergeConditions($conditionStrings, ['uri-id' => $this->itemUriId]);
} else {
- if (isset($this->max_id)) {
+ if (isset($this->maxId)) {
switch (self::$order) {
case 'received':
- $conditionStrings = DBA::mergeConditions($conditionStrings, ["`received` < ?", $this->max_id]);
+ $conditionStrings = DBA::mergeConditions($conditionStrings, ["`received` < ?", $this->maxId]);
break;
case 'commented':
- $conditionStrings = DBA::mergeConditions($conditionStrings, ["`commented` < ?", $this->max_id]);
+ $conditionStrings = DBA::mergeConditions($conditionStrings, ["`commented` < ?", $this->maxId]);
break;
case 'created':
- $conditionStrings = DBA::mergeConditions($conditionStrings, ["`created` < ?", $this->max_id]);
+ $conditionStrings = DBA::mergeConditions($conditionStrings, ["`created` < ?", $this->maxId]);
break;
case 'uriid':
- $conditionStrings = DBA::mergeConditions($conditionStrings, ["`uri-id` < ?", $this->max_id]);
+ $conditionStrings = DBA::mergeConditions($conditionStrings, ["`uri-id` < ?", $this->maxId]);
break;
}
}
- if (isset($this->min_id)) {
+ if (isset($this->minId)) {
switch (self::$order) {
case 'received':
- $conditionStrings = DBA::mergeConditions($conditionStrings, ["`received` > ?", $this->min_id]);
+ $conditionStrings = DBA::mergeConditions($conditionStrings, ["`received` > ?", $this->minId]);
break;
case 'commented':
- $conditionStrings = DBA::mergeConditions($conditionStrings, ["`commented` > ?", $this->min_id]);
+ $conditionStrings = DBA::mergeConditions($conditionStrings, ["`commented` > ?", $this->minId]);
break;
case 'created':
- $conditionStrings = DBA::mergeConditions($conditionStrings, ["`created` > ?", $this->min_id]);
+ $conditionStrings = DBA::mergeConditions($conditionStrings, ["`created` > ?", $this->minId]);
break;
case 'uriid':
- $conditionStrings = DBA::mergeConditions($conditionStrings, ["`uri-id` > ?", $this->min_id]);
+ $conditionStrings = DBA::mergeConditions($conditionStrings, ["`uri-id` > ?", $this->minId]);
break;
}
}
}
- if (isset($this->min_id) && !isset($this->max_id)) {
+ if (isset($this->minId) && !isset($this->maxId)) {
// min_id quirk: querying in reverse order with min_id gets the most recent rows, regardless of how close
// they are to min_id. We change the query ordering to get the expected data, and we need to reverse the
// order of the results.
$items = DBA::selectToArray($table, [], DBA::mergeConditions($conditionFields, $conditionStrings), $params);
// min_id quirk, continued
- if (isset($this->min_id) && !isset($this->max_id)) {
+ if (isset($this->minId) && !isset($this->maxId)) {
$items = array_reverse($items);
}
/** @var string */
protected $selectedTab;
/** @var mixed */
- protected $min_id;
+ protected $minId;
/** @var mixed */
- protected $max_id;
+ protected $maxId;
/** @var string */
protected $accountTypeString;
/** @var int */
}
if (!empty($request['item'])) {
- $item = Post::selectFirst(['parent', 'parent-uri-id'], ['id' => $request['item']]);
+ $item = Post::selectFirst(['parent', 'parent-uri-id'], ['id' => $request['item']]);
$this->itemUriId = $item['parent-uri-id'] ?? 0;
} else {
$this->itemUriId = 0;
}
- $this->min_id = $request['min_id'] ?? null;
- $this->max_id = $request['max_id'] ?? null;
+ $this->minId = $request['min_id'] ?? null;
+ $this->maxId = $request['max_id'] ?? null;
$this->noSharer = !empty($request['no_sharer']);
}
}
$query_parameters = [];
- if (!empty($this->min_id)) {
- $query_parameters['min_id'] = $this->min_id;
+ if (!empty($this->minId)) {
+ $query_parameters['min_id'] = $this->minId;
}
- if (!empty($this->max_id)) {
- $query_parameters['max_id'] = $this->max_id;
+ if (!empty($this->maxId)) {
+ $query_parameters['max_id'] = $this->maxId;
}
$path_all = $path . (!empty($query_parameters) ? '?' . http_build_query($query_parameters) : '');
$condition = DBA::mergeConditions($condition, ["NOT `uri-id` IN (SELECT `uri-id` FROM `post-user` WHERE `post-user`.`uid` = ? AND `post-user`.`uri-id` = `post-engagement`.`uri-id`)", $this->session->getLocalUserId()]);
}
- if (isset($this->max_id)) {
- $condition = DBA::mergeConditions($condition, ["`created` < ?", $this->max_id]);
+ if (isset($this->maxId)) {
+ $condition = DBA::mergeConditions($condition, ["`created` < ?", $this->maxId]);
}
- if (isset($this->min_id)) {
- $condition = DBA::mergeConditions($condition, ["`created` > ?", $this->min_id]);
+ if (isset($this->minId)) {
+ $condition = DBA::mergeConditions($condition, ["`created` > ?", $this->minId]);
// Previous page case: we want the items closest to min_id but for that we need to reverse the query order
- if (!isset($this->max_id)) {
+ if (!isset($this->maxId)) {
$params['order']['created'] = false;
}
}
}
// Previous page case: once we get the relevant items closest to min_id, we need to restore the expected display order
- if (empty($this->itemUriId) && isset($this->min_id) && !isset($this->max_id)) {
+ if (empty($this->itemUriId) && isset($this->minId) && !isset($this->maxId)) {
$items = array_reverse($items);
}
// If we're looking at a "previous page", the lookup continues forward in time because the list is
// sorted in chronologically decreasing order
- if (isset($this->min_id)) {
- $this->min_id = $items[0]['commented'];
+ if (isset($this->minId)) {
+ $this->minId = $items[0]['commented'];
} else {
// In any other case, the lookup continues backwards in time
- $this->max_id = $items[count($items) - 1]['commented'];
+ $this->maxId = $items[count($items) - 1]['commented'];
}
$items = $this->selectItems();
$condition = DBA::mergeConditions($condition, ["NOT `uri-id` IN (SELECT `uri-id` FROM `post-user` WHERE `post-user`.`uid` = ? AND `post-user`.`uri-id` = `post-thread-user-view`.`uri-id`)", $this->session->getLocalUserId()]);
}
- if (isset($this->max_id)) {
- $condition = DBA::mergeConditions($condition, ["`commented` < ?", $this->max_id]);
+ if (isset($this->maxId)) {
+ $condition = DBA::mergeConditions($condition, ["`commented` < ?", $this->maxId]);
}
- if (isset($this->min_id)) {
- $condition = DBA::mergeConditions($condition, ["`commented` > ?", $this->min_id]);
+ if (isset($this->minId)) {
+ $condition = DBA::mergeConditions($condition, ["`commented` > ?", $this->minId]);
// Previous page case: we want the items closest to min_id but for that we need to reverse the query order
- if (!isset($this->max_id)) {
+ if (!isset($this->maxId)) {
$params['order']['commented'] = false;
}
}
}
// Previous page case: once we get the relevant items closest to min_id, we need to restore the expected display order
- if (empty($this->itemUriId) && isset($this->min_id) && !isset($this->max_id)) {
+ if (empty($this->itemUriId) && isset($this->minId) && !isset($this->maxId)) {
$items = array_reverse($items);
}