Commit 21fe3aadbcd3888800760f4ec2c0948d4b0b4ae9

Authored by Frederik Lindenaar
1 parent 1ccfe953

Fixed order of processing form data, after submit the new data is now shown

Closes: #1
Showing 1 changed file with 11 additions and 12 deletions
admin/configuration.php
... ... @@ -13,15 +13,7 @@ $me = new Ldap();
13 13 $me->load_config();
14 14 //$me = get_plugin_data($plugin_id);
15 15  
16   -$template->assign('HOST', $me->config['host']);
17   -$template->assign('BASEDN', $me->config['basedn']); // racine !
18   -$template->assign('PORT', $me->config['port']);
19   -$template->assign('LD_ATTR', $me->config['ld_attr']);
20   -$template->assign('LD_GROUP', $me->config['ld_group']);
21   -$template->assign('LD_USE_SSL', $me->config['ld_use_ssl']);
22   -$template->assign('LD_BINDPW', $me->config['ld_bindpw']);
23   -$template->assign('LD_BINDDN', $me->config['ld_binddn']);
24   -
  16 +// Save LDAP configuration when submitted
25 17 if (isset($_POST['save'])){
26 18 $me->config['host'] = $_POST['HOST'];
27 19 $me->config['basedn'] = $_POST['BASEDN'];
... ... @@ -36,10 +28,7 @@ if (isset($_POST['save'])){
36 28 } else {
37 29 $me->config['ld_use_ssl'] = False;
38 30 }
39   -}
40 31  
41   -// Save LDAP configuration
42   -if (isset($_POST['save'])){
43 32 $me->save_config();
44 33 }
45 34  
... ... @@ -71,5 +60,15 @@ if (isset($_POST['check_ldap'])){
71 60 }
72 61 }
73 62  
  63 +// And build up the form with the new values
  64 +$template->assign('HOST', $me->config['host']);
  65 +$template->assign('BASEDN', $me->config['basedn']); // racine !
  66 +$template->assign('PORT', $me->config['port']);
  67 +$template->assign('LD_ATTR', $me->config['ld_attr']);
  68 +$template->assign('LD_GROUP', $me->config['ld_group']);
  69 +$template->assign('LD_USE_SSL', $me->config['ld_use_ssl']);
  70 +$template->assign('LD_BINDPW', $me->config['ld_bindpw']);
  71 +$template->assign('LD_BINDDN', $me->config['ld_binddn']);
  72 +
74 73 $template->assign_var_from_handle( 'ADMIN_CONTENT', 'plugin_admin_content');
75 74 ?>
... ...