1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
//------------------------------------------------------------------------------ |
4
|
|
|
// |
5
|
|
|
// eTraxis - Records tracking web-based system |
6
|
|
|
// Copyright (C) 2005-2011 Artem Rodygin |
7
|
|
|
// |
8
|
|
|
// This program is free software: you can redistribute it and/or modify |
9
|
|
|
// it under the terms of the GNU General Public License as published by |
10
|
|
|
// the Free Software Foundation, either version 3 of the License, or |
11
|
|
|
// (at your option) any later version. |
12
|
|
|
// |
13
|
|
|
// This program is distributed in the hope that it will be useful, |
14
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
15
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16
|
|
|
// GNU General Public License for more details. |
17
|
|
|
// |
18
|
|
|
// You should have received a copy of the GNU General Public License |
19
|
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>. |
20
|
|
|
// |
21
|
|
|
//------------------------------------------------------------------------------ |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* @package eTraxis |
25
|
|
|
* @ignore |
26
|
|
|
*/ |
27
|
|
|
|
28
|
|
|
/**#@+ |
29
|
|
|
* Dependency. |
30
|
|
|
*/ |
31
|
|
|
require_once('../engine/engine.php'); |
32
|
|
|
/**#@-*/ |
33
|
|
|
|
34
|
|
|
init_page(LOAD_TAB); |
35
|
|
|
|
36
|
|
|
if (get_user_level() != USER_LEVEL_ADMIN) |
37
|
|
|
{ |
38
|
|
|
debug_write_log(DEBUG_NOTICE, 'User must have admin rights to be allowed.'); |
39
|
|
|
header('Location: ../index.php'); |
40
|
|
|
exit; |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
// generate configuration info |
44
|
|
|
|
45
|
|
|
$xml = '<group>' |
46
|
|
|
. '<text label="' . get_html_resource(RES_STATUS_ID) . '">' . ustrtolower(get_html_resource(LDAP_ENABLED ? RES_ENABLED2_ID : RES_DISABLED2_ID)) . '</text>'; |
47
|
|
|
|
48
|
|
|
if (LDAP_ENABLED) |
49
|
|
|
{ |
50
|
|
|
$ldap_attrs = sprintf("%s = %s", get_html_resource(RES_USERNAME_ID), ustr2html(LDAP_ATTR_LOGIN)) . '%br;' |
51
|
|
|
. sprintf("%s = %s", get_html_resource(RES_FULLNAME_ID), ustr2html(LDAP_ATTR_FULLNAME)) . '%br;' |
52
|
|
|
. sprintf("%s = %s", get_html_resource(RES_EMAIL_ID), ustr2html(LDAP_ATTR_EMAIL)); |
53
|
|
|
|
54
|
|
|
$xml .= '<text label="' . get_html_resource(RES_LDAP_SERVER_ID) . '">' . ustr2html(LDAP_HOST) . '</text>' |
55
|
|
|
. '<text label="' . get_html_resource(RES_PORT_NUMBER_ID) . '">' . ustr2html(LDAP_PORT) . '</text>' |
56
|
|
|
. '<text label="' . get_html_resource(RES_TLS_ID) . '">' . ustrtolower(get_html_resource(LDAP_USE_TLS ? RES_ENABLED2_ID : RES_DISABLED2_ID)) . '</text>' |
57
|
|
|
. '<text label="' . get_html_resource(RES_BASE_DN_ID) . '">' . ustr2html(ustr_replace(';', '%br;', LDAP_BASEDN)) . '</text>' |
58
|
|
|
. '<text label="' . get_html_resource(RES_SEARCH_ACCOUNT_ID) . '">' . ustr2html(LDAP_USERNAME) . '</text>' |
59
|
|
|
. '<text label="' . get_html_resource(RES_LDAP_ATTRIBUTE_ID) . '">' . $ldap_attrs . '</text>' |
60
|
|
|
. '<text label="' . get_html_resource(RES_LDAP_ENUMERATION_ID) . '">' . ustrtolower(get_html_resource(LDAP_ENUMERATION ? RES_ENABLED2_ID : RES_DISABLED2_ID)) . '</text>' |
61
|
|
|
. '<text label="' . get_html_resource(RES_ADMINISTRATORS_ID) . '">' . ustr2html(ustr_replace(',', '%br;', LDAP_ADMINS)) . '</text>'; |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
$xml .= '</group>'; |
65
|
|
|
|
66
|
|
|
echo(xml2html($xml)); |
67
|
|
|
|
68
|
|
|
?> |
|
|
|
|
69
|
|
|
|
Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.
A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.