1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-07 07:06:30 +02:00

Loose false check for e_tree_model sim. pagination

e_tree_model::prepareSimulatedPagination() did not correctly handle the
count-only condition because of an incorrectly written emptiness check.

Fixes: #3034
This commit is contained in:
Deltik
2018-02-15 13:59:13 -06:00
parent a4b972cb9f
commit 0bbaaf4c6c

View File

@@ -3530,17 +3530,17 @@ class e_tree_model extends e_front_model
$db_query = $this->getParam('db_query');
$db_query = preg_replace_callback("/LIMIT ([\d]+)[ ]*(?:,|OFFSET){0,1}[ ]*([\d]*)/i", function($matches)
{
// Count only
if (empty($matches[2]))
{
$this->setParam('db_limit_count', $matches[1]);
}
// Offset and count
if (isset($matches[2]))
else
{
$this->setParam('db_limit_offset', $matches[1]);
$this->setParam('db_limit_count', $matches[2]);
}
// Count only
else
{
$this->setParam('db_limit_count', $matches[1]);
}
return "";
}, $db_query);