|
12 | 12 | $ldap_search_base = ""; |
13 | 13 | $ldap_search_filter = ""; |
14 | 14 |
|
15 | | -if (!isset($_POST["submit"])) { |
16 | | - $smarty->assign('advanced_search_criteria', $advanced_search_criteria); |
17 | | - $smarty->assign('advanded_search_display_search_objects', $advanded_search_display_search_objects); |
18 | | - |
19 | | - # Check if an attribute is a list type and prepare the list |
20 | | - $ldap_connection = $ldapInstance->connect(); |
21 | | - $ldap = $ldap_connection[0]; |
22 | | - $result = $ldap_connection[1]; |
23 | | - |
24 | | - if ($ldap) { |
25 | | - $item_list = array(); |
26 | | - foreach ( $advanced_search_criteria as $criteria ) { |
27 | | - if ( $attributes_map[$criteria]["type"] === "list" ) { |
28 | | - $item_list[$criteria] = $ldapInstance->get_list( $attributes_list[$criteria]["base"], $attributes_list[$criteria]["filter"], $attributes_list[$criteria]["key"], $attributes_list[$criteria]["value"] ); |
29 | | - } |
| 15 | +$smarty->assign('advanced_search_criteria', $advanced_search_criteria); |
| 16 | +$smarty->assign('advanded_search_display_search_objects', $advanded_search_display_search_objects); |
| 17 | + |
| 18 | +# Check if an attribute is a list type and prepare the list |
| 19 | +$ldap_connection = $ldapInstance->connect(); |
| 20 | +$ldap = $ldap_connection[0]; |
| 21 | +$result = $ldap_connection[1]; |
| 22 | + |
| 23 | +if ($ldap) { |
| 24 | + $item_list = array(); |
| 25 | + foreach ( $advanced_search_criteria as $criteria ) { |
| 26 | + if ( $attributes_map[$criteria]["type"] === "list" ) { |
| 27 | + $item_list[$criteria] = $ldapInstance->get_list( $attributes_list[$criteria]["base"], $attributes_list[$criteria]["filter"], $attributes_list[$criteria]["key"], $attributes_list[$criteria]["value"] ); |
30 | 28 | } |
31 | | - $smarty->assign('item_list', $item_list); |
32 | 29 | } |
33 | | - |
34 | | - $result = "displayform"; |
| 30 | + $smarty->assign('item_list', $item_list); |
35 | 31 | } |
36 | 32 |
|
37 | 33 | if (isset($_POST["type"])) { |
|
50 | 46 | $result_items = $search_result_group_items; |
51 | 47 | } |
52 | 48 |
|
53 | | -if ($result === "") { |
| 49 | +if (!isset($_POST["submit"])) { |
| 50 | + $result = "displayform"; |
| 51 | +} |
54 | 52 |
|
55 | | - require_once("../lib/date.inc.php"); |
| 53 | +if ($result == "") { |
56 | 54 |
|
57 | | - $ldap_connection = $ldapInstance->connect(); |
58 | | - $ldapInstance->ldap_user_base = $ldap_search_base; |
59 | | - $ldap = $ldap_connection[0]; |
60 | | - $result = $ldap_connection[1]; |
| 55 | + require_once("../lib/date.inc.php"); |
61 | 56 |
|
62 | 57 | if ($ldap) { |
63 | 58 |
|
|
176 | 171 | $page = "search"; |
177 | 172 | } |
178 | 173 | } |
| 174 | + } else { |
| 175 | + $page = "error"; |
179 | 176 | } |
180 | 177 | } |
181 | 178 |
|
|
0 commit comments