3 require_once 'config.inc.php';
4 require_once 'user_validate.php';
5 require_once 'helper.php';
9 if (! defined($_SESSION['__ROOT__']) && empty($_SESSION['__ROOT__'])) {
12 header('Location: ' . WEB_ROOT
. 'error.html');
16 require_once 'persistens.php';
18 $user = $_SESSION['user_settings'];
20 if ($user->getRole() !== 0) {
23 header('Location: ' . WEB_ROOT
. 'error.html');
27 $db = Persistens
::getInstance(DBDRIVER
);
29 if (count($_POST) > 0) {
31 (isset($_POST['enable']) && $_POST['enable'] == 'on') ?
1 : 0,
33 (isset($_POST['tls']) && $_POST['tls'] == 'on') ?
1 : 0,
37 if (($res = $db->setLdapConfig($config)) === true)
38 $pageView = "<p style=\"text-align: center\">
39 LDAP configuration was successfully updated</p>";
41 $pageView = "<p style=\"text-align: center\">$res</p>";
44 $config = $db->getLdapConfig();
45 if (! is_array($config) && $config) {
48 header('Location: ' . WEB_ROOT
. 'error.html');
52 $enable = ($config['enable']) ?
' checked="checked"' : '';
53 $tls = ($config['tls']) ?
' checked="checked"' : '';
54 $dns = $config['dns'];
55 $base_dn = $config['base_dn'];
56 $user_attr = $config['user_attr'];
58 <form action
="{$_SERVER['PHP_SELF']}" method
="post">
59 <table
class="config">
61 <th
>Setting
</th
><th
>Current
</th
>
64 <td
class="config">LDAP enabled
</td
>
66 <input name
="enable" type
="checkbox"$enable/>
70 <td
class="config">URL
</td
>
72 <input size
="30" name
="dns" type
="text" value
="$dns"/>
76 <td
class="config">Use TLS
</td
>
78 <input name
="tls" type
="checkbox"$tls/>
82 <td
class="config">Base DN
</td
>
84 <input size
="30" name
="base_dn" type
="text" value
="$base_dn"/>
88 <td
class="config">User ATTR
</td
>
90 <input name
="user_attr" type
="text" value
="$user_attr"/>
94 <td
class="config" colspan
="2" style
="text-align: center">
95 <input type
="submit" name
="setting" value
="Submit changes"/>
101 After enabling LDAP users will be authenticated by LDAP
and when
102 a user logs on
for the first time an account will automatically
103 be created using the username provided by LDAP
. If the user
104 account is removed from LDAP the account will be deactivated but
105 remain in webcal until deleted by the admin user
.<br
/>
107 If your LDAP server is located here
: <span
class="bold">ldap
.foo
.tld
108 </span
> on either port
109 389 or 636 then URL is
:<br
/>
110 Without
SSL (389): <span
class="bold">ldap
://</span>ldap.foo.tld<br/>
111 With
SSL (636): <span
class="bold">ldaps
://</span>ldap.foo.tld<br/>
112 With
TLS (389): <span
class="bold">ldap
://</span>ldap.foo.tld and
113 <span
class="bold">check
"Use TLS"</span
><br
/>
114 If your LDAP server is listen on
8389 then this port number must
115 be added to the URL like ldap
://ldap.foo.tld<span class="bold">:8389</span><br/>
117 If your Bind DN is the following
: uid
=username
,ou
=people
,dc
=foo
,
118 dc
=tld then
"Base DN" and "User ATTR" has to look like this
:<br
/>
119 Base DN
: <span
class="bold">ou
=people
,dc
=foo
,dc
=tld
</span
><br
/>
120 User ATTR
: <span
class="bold">uid
</span
><br
/>
121 If your Bind DN is the following
: cn
=username
,dc
=foo
,dc
=tld then
122 "Base DN" and "User ATTR" has to look like this
:<br
/>
123 Base DN
: <span
class="bold">dc
=foo
,dc
=tld
</span
><br
/>
124 User ATTR
: <span
class="bold">cn
</span
>
129 include TOP_FOLDER
.'/include/header.inc.php';
130 include TOP_FOLDER
.'/include/menu.inc.php';
132 print "<div id=\"ui\">$pageView</div>";
134 include TOP_FOLDER
.'/include/footer.inc.php';