diff options
author | Craig Andrews <candrews@integralblue.com> | 2009-11-16 00:19:19 -0500 |
---|---|---|
committer | Craig Andrews <candrews@integralblue.com> | 2009-11-16 00:19:19 -0500 |
commit | 6470ccd1b869808d2fca530b9ee53e6a574646c4 (patch) | |
tree | 36ee00e9149c8e8eae0292d553b516505be01593 | |
parent | b843ea6c4a0a3ee5f294571a52c6e2e52d3140d0 (diff) |
getSubscribers and getSubscriptions were not handling the case where limit=null correctly
-rw-r--r-- | classes/Profile.php | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/classes/Profile.php b/classes/Profile.php index 7c1e9db33..9348248af 100644 --- a/classes/Profile.php +++ b/classes/Profile.php @@ -310,10 +310,12 @@ class Profile extends Memcached_DataObject 'AND subscription.subscribed != subscription.subscriber ' . 'ORDER BY subscription.created DESC '; - if (common_config('db','type') == 'pgsql') { - $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset; - } else { - $qry .= ' LIMIT ' . $offset . ', ' . $limit; + if ($offset>0 && !is_null($limit)){ + if (common_config('db','type') == 'pgsql') { + $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset; + } else { + $qry .= ' LIMIT ' . $offset . ', ' . $limit; + } } $profile = new Profile(); @@ -333,11 +335,13 @@ class Profile extends Memcached_DataObject 'AND subscription.subscribed != subscription.subscriber ' . 'ORDER BY subscription.created DESC '; - if ($offset) { - if (common_config('db','type') == 'pgsql') { - $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset; - } else { - $qry .= ' LIMIT ' . $offset . ', ' . $limit; + if ($offset>0 && !is_null($limit)){ + if ($offset) { + if (common_config('db','type') == 'pgsql') { + $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset; + } else { + $qry .= ' LIMIT ' . $offset . ', ' . $limit; + } } } |