lib/Auth
Aleksander Machniak
machniak at kolabsys.com
Thu Oct 10 09:38:51 CEST 2013
lib/Auth/LDAP.php | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
New commits:
commit 76f8963698d5670e9a750ac0b950a4087eac49e7
Author: Aleksander Machniak <alec at alec.pl>
Date: Thu Oct 10 09:38:22 2013 +0200
Slice page from list result after sorting and ordering, small code improvements
diff --git a/lib/Auth/LDAP.php b/lib/Auth/LDAP.php
index a3c8f83..1833c10 100644
--- a/lib/Auth/LDAP.php
+++ b/lib/Auth/LDAP.php
@@ -1296,21 +1296,18 @@ class LDAP extends Net_LDAP3 {
}
if (!empty($params) && is_array($params)) {
- if (array_key_exists('sort_by', $params)) {
+ if (!empty($params['sort_by'])) {
$this->sort_result_key = $params['sort_by'];
uasort($entries, array($this, 'sort_result'));
}
- if (array_key_exists('page_size', $params) && array_key_exists('page', $params)) {
- if ($result->count() > $params['page_size']) {
- $entries = array_slice($entries, (($params['page'] - 1) * $params['page_size']), $params['page_size'], true);
- }
-
+ if (!empty($params['sort_order']) && $params['sort_order'] == "DESC") {
+ $entries = array_reverse($entries, true);
}
- if (array_key_exists('sort_order', $params) && !empty($params['sort_order'])) {
- if ($params['sort_order'] == "DESC") {
- $entries = array_reverse($entries, true);
+ if (!empty($params['page_size']) && !empty($params['page'])) {
+ if ($result->count() > $params['page_size']) {
+ $entries = array_slice($entries, (($params['page'] - 1) * $params['page_size']), $params['page_size'], true);
}
}
}
More information about the commits
mailing list