source: extensions/Ldap_Login/admin/configuration.php @ 27284

Last change on this file since 27284 was 27284, checked in by 22decembre, 10 years ago

change destination of the form from admin-ldap_login-… to admin-Ldap_Login-…

File size: 1.8 KB
Line 
1<?php
2if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
3
4global $template;
5$template->set_filenames( array('plugin_admin_content' => dirname(__FILE__).'/configuration.tpl') );
6$template->assign(
7  array(
8    'PLUGIN_ACTION' => get_root_url().'admin.php?page=plugin-Ldap_Login-configuration',
9    'PLUGIN_CHECK' => get_root_url().'admin.php?page=plugin-Ldap_Login-configuration',
10    ));
11
12$me = new Ldap();
13$me->load_config();
14//$me = get_plugin_data($plugin_id);
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_USE_SSL', $me->config['ld_use_ssl']);
21$template->assign('LD_BINDPW',  $me->config['ld_bindpw']);
22$template->assign('LD_BINDDN',  $me->config['ld_binddn']);
23
24if (isset($_POST['save'])){
25        $me->config['host']      = $_POST['HOST'];
26        $me->config['basedn']    = $_POST['BASEDN'];
27        $me->config['port']      = $_POST['PORT'];
28        $me->config['ld_attr']   = $_POST['LD_ATTR'];
29        $me->config['ld_binddn'] = $_POST['LD_BINDDN'];
30        $me->config['ld_bindpw'] = $_POST['LD_BINDPW'];
31
32        if (isset($_POST['LD_USE_SSL'])){
33                $me->config['ld_use_ssl'] = True;
34        } else {
35                $me->config['ld_use_ssl'] = False;
36        }
37}
38
39// Save LDAP configuration
40if (isset($_POST['save'])){
41        $me->save_config();
42}
43
44// Check LDAP configuration
45if (isset($_POST['check_ldap'])){
46$check = $me->ldap_name($_POST['USERNAME']);
47$error = $me->check_ldap();
48
49        if ($me->ldap_bind_as($_POST['USERNAME'],$_POST['PASSWORD'])){
50        $template->assign('LD_CHECK_LDAP','<p style="color:green;">Configuration LDAP OK : '.$check.'</p>');
51        }
52        else {
53        $template->assign('LD_CHECK_LDAP','<p style="color:red;">Error :'.$error.' test '.$me->config['uri'].' '.$check.'</p>');
54        }
55}
56
57$template->assign_var_from_handle( 'ADMIN_CONTENT', 'plugin_admin_content');
58?>
Note: See TracBrowser for help on using the repository browser.