From 43f88d13cb8c435e80960efad87cc3340ef40d7a Mon Sep 17 00:00:00 2001 From: kkalev Date: Tue, 20 Aug 2002 14:49:56 +0000 Subject: [PATCH] Add support for the max results setting in the user find page --- htdocs/find.php3 | 5 ++++- lib/ldap/find.php3 | 2 +- lib/sql/find.php3 | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/htdocs/find.php3 b/htdocs/find.php3 index aa9014f..d33dcae 100644 --- a/htdocs/find.php3 +++ b/htdocs/find.php3 @@ -47,6 +47,8 @@ if ($find_user == 1){ EOM; foreach ($found_users as $user){ + if ($user == '') + $user = '-'; $num++; $msg .= << @@ -57,7 +59,8 @@ EOM; } $msg .= "\n"; } - + else + $msg = "No users found
\n"; } ?>
diff --git a/lib/ldap/find.php3 b/lib/ldap/find.php3 index 72a353c..fdf6ea4 100644 --- a/lib/ldap/find.php3 +++ b/lib/ldap/find.php3 @@ -8,7 +8,7 @@ if ($ds) { require('../lib/ldap/attrmap.php3'); $attr = $attrmap[$radius_attr]; } - $sr=@ldap_search($ds,"$config[ldap_base]", "$attr=*$search*",array('uid')); + $sr=@ldap_search($ds,"$config[ldap_base]", "$attr=*$search*",array('uid'),0,$max_results); if (($info = @ldap_get_entries($ds, $sr))){ for ($i = 0; $i < $info["count"]; $i++) $found_users[] = $info[$i]['uid'][0]; diff --git a/lib/sql/find.php3 b/lib/sql/find.php3 index d2ddd70..22d2e5b 100644 --- a/lib/sql/find.php3 +++ b/lib/sql/find.php3 @@ -12,7 +12,7 @@ if ($link){ $attr = ($search_IN == 'name') ? 'Name' : 'Department'; $res = @da_sql_query($link,$config, "SELECT UserName FROM $config[sql_user_info_table] WHERE - $attr LIKE '%$search%';"); + $attr LIKE '%$search%' LIMIT $max_results;"); if ($res){ while(($row = @da_sql_fetch_array($res,$config))) $found_users[] = $row[UserName]; @@ -25,7 +25,7 @@ if ($link){ $table = ($attr_type[$radius_attr] == 'checkItem') ? $config[sql_check_table] : $config[sql_reply_table]; $attr = $attrmap[$radius_attr]; $res = @da_sql_query($link,$config, - "SELECT UserName FROM $table WHERE Attribute = '$attr' AND Value LIKE '%$search%';"); + "SELECT UserName FROM $table WHERE Attribute = '$attr' AND Value LIKE '%$search%' LIMIT $max_results;"); if ($res){ while(($row = @da_sql_fetch_array($res,$config))) $found_users[] = $row[UserName]; -- 2.39.5