-
Notifications
You must be signed in to change notification settings - Fork 1
/
domain_edit_attributes.php
274 lines (253 loc) · 9.22 KB
/
domain_edit_attributes.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
<?php
// edit attributes of all users of the domain
// $Id: domain_edit_attributes.php,v 2.64 2007-09-29 21:15:09 turbo Exp $
//
// {{{ Setup session etc
require("./include/pql_session.inc");
require($_SESSION["path"]."/include/pql_config.inc");
require($_SESSION["path"]."/include/config_plugins.inc");
$_pql = new pql($_SESSION["USER_HOST"], $_SESSION["USER_DN"], $_SESSION["USER_PASS"]);
$url["domain"] = pql_format_urls($_REQUEST["domain"]);
$url["rootdn"] = pql_format_urls($_REQUEST["rootdn"]);
$url["user"] = pql_format_urls($_REQUEST["user"]);
include($_SESSION["path"]."/header.html");
// }}}
// {{{ Forward back to users detail page
function attribute_forward($msg) {
global $url;
if($_REQUEST["user"]) {
$link = "user_detail.php?rootdn=" . $url["rootdn"]
. "&domain=" . $url["domain"]
. "&user=". $url["user"]
. "&view=" . $_REQUEST["view"] . "&msg=$msg";
} elseif(preg_match('/^config_detail/', $_REQUEST["view"])) {
// Very special sircumstances - we've deleted an administrator from the config_details/ROOTDN page!
$tmp = explode('/', $_REQUEST["view"]);
$link = "config_detail.php?view=".$tmp[1];
} elseif($_REQUEST["administrator"]) {
// Administrators is _always_ added/change here, NOT from user_edit_attribute.php
// as one would think. I.e. when giving a user access to branch from the
// 'User details->User access' page...
$url["user"] = pql_format_urls($_REQUEST["user"]);
$url["administrator"] = pql_format_urls($_REQUEST["administrator"]);
$link = "user_detail.php?rootdn=" . $url["rootdn"]
. "&domain=" . $url["domain"]
. "&user=" . $url["administrator"]
. "&view=" . $_REQUEST["view"] . "&msg=$msg";
} else
$link = "domain_detail.php?rootdn=" . $url["rootdn"]
. "&domain=" . $url["domain"]
. "&view=" . $_REQUEST["view"] . "&msg=$msg";
if(pql_get_define("PQL_CONF_DEBUG_ME") and file_exists($_SESSION["path"]."/.DEBUG_PROFILING")) {
$now = pql_format_return_unixtime();
echo "Now: <b>$now</b><br>";
}
pql_header($link);
}
// }}}
// {{{ Select and load attribute plugin file
$plugin = pql_plugin_get_filename(pql_plugin_get($_REQUEST["attrib"]));
if(!$plugin) {
die("<span class=\"error\">".pql_complete_constant($LANG->_('ERROR: No plugin file defined for attribute \i%attrib%\I'),
array('attrib' => $_REQUEST["attrib"]))."</span>");
} elseif(!file_exists($_SESSION["path"]."/include/$plugin")) {
die("<span class=\"error\">".pql_complete_constant($LANG->_('ERROR: Plugin file defined for attribute \i%attrib%\I does not exists'),
array('attrib' => $_REQUEST["attrib"]))."!</span>");
}
if(pql_get_define("PQL_CONF_DEBUG_ME")) {
echo "include: include/$plugin<br>";
}
include($_SESSION["path"]."/include/$plugin");
// }}}
// {{{ Get the organization name, or the DN if it's unset
$orgname = $_pql->get_attribute($_REQUEST["domain"], pql_get_define("PQL_ATTR_O"));
if(!$orgname) {
$orgname = urldecode($_REQUEST["domain"]);
}
if(is_array($orgname)) {
$orgname = $orgname[0];
}
$_REQUEST["orgname"] = $orgname;
// }}}
?>
<span class="title1"><?php echo pql_complete_constant($LANG->_('Change %what% for domain %domain%'), array('what' => $LANG->_('default values'), 'domain' => $_REQUEST["orgname"])); ?>
</span>
<br><br>
<?php
// {{{ Pages that call us
// * with 'type=':
// domain_detail.php
// tables/domain_details-aci.inc
//
// * with 'submit=':
// domain_detail.php
// tables/config_details-branch.inc
// tables/domain_details-aci.inc
// tables/domain_details-default.inc
// tables/domain_details-owner.inc
// tables/user_details-access.inc
//
// * with 'action=':
// tables/config_details-branch.inc
// tables/domain_details-default.inc
// tables/domain_details-owner.inc
// tables/domain_details-automount.inc
// tables/user_details-access.inc
//
// * with 'set=':
// tables/domain_details-users_chval.inc
//
// * Values for type/submit/action:
// type={edit,delete,moveup,movedown,host,del}
// submit=[1-4]
// action={modify,delete,add}
//
// * Values for attrib:
// OpenLDAPaci autoCreateUserName mobile
// accountStatus baseHomeDir o
// additionalDomainName baseMailDir postalAddress
// administrator baseQuota postalCode
// deliveryMode defaultDomain postOfficeBox
// ezmlmAdministrator defaultPasswordScheme registeredAddress
// mailHost ezmlmVirtualUser st
// mailQuota facsimileTelePhoneNumber street
// seeAlso info streetAddress
// startWithAdvancedMode l telePhoneNumber
// autoCreateMailAddress maximumDomainUsers userNamePrefix
// autoCreatePassWord maximumMailingLists userNamePrefixLength
// vatNumber simscanspamassassin simscanclamantivirus
// simscantrophie automountinformation
//
// * Files that manages the attribs above:
// include/attrib.accountstatus.inc
// include/attrib.aci.inc
// include/attrib.additionaldomainname.inc
// include/attrib.administrator.inc
// include/attrib.basehomedir.inc
// include/attrib.basemaildir.inc
// include/attrib.defaultdomain.inc
// include/attrib.defaultpasswordscheme.inc
// include/attrib.deliverymode.inc
// include/attrib.domaintoggle.inc
// include/attrib.ezmlmuser.inc
// include/attrib.mailhost.inc
// include/attrib.mailquota.inc
// include/attrib.maximumdomainusers.inc
// include/attrib.maximummailinglists.inc
// include/attrib.outlook.inc
// include/attrib.usernameprefix.inc
// include/attrib.usertoggle.inc
// include/attrib.automount.inc
// }}}
if(!$_REQUEST["type"]) {
if (!empty($_REQUEST["action"])) { // DLW: I'm wingining it here.
$_REQUEST["type"] = $_REQUEST["action"];
} elseif($_REQUEST['attrib'] == sprintf("%s", pql_get_define("PQL_ATTR_ISACTIVE")) or
$_REQUEST['attrib'] == sprintf("%s", pql_get_define("PQL_ATTR_MODE")) or
$_REQUEST['attrib'] == sprintf("%s", pql_get_define("PQL_ATTR_MAILALTERNATE")) or
$_REQUEST['attrib'] == sprintf("%s", pql_get_define("PQL_ATTR_QUOTA_VALUE"))) {
$_REQUEST["type"] = 'fulldomain';
} else {
$_REQUEST["type"] = 'modify';
}
}
if(pql_get_define("PQL_CONF_DEBUG_ME")) {
echo "REQUEST:";
ksort($_REQUEST);
printr($_REQUEST);
}
// -------------------
// Select what to do
// {{{ submit == 1
if(@$_REQUEST["submit"] == 1) {
// Called from:
// tables/domain_details-dnszone.inc
// tables/domain_details-options.inc
if($_REQUEST["attrib"] == sprintf("%s", pql_get_define("PQL_ATTR_BASEQUOTA"))) {
attribute_save("modify");
} else {
if(attribute_check($_REQUEST["type"]))
attribute_save($_REQUEST["type"]);
else
attribute_print_form($_REQUEST["type"]);
}
// }}}
// {{{ submit == 2
} elseif(@$_REQUEST["submit"] == 2) {
// Support for changing domain defaults
// Called from:
// tables/domain_details-aci.inc
// tables/domain_details-automount.inc (when deleting and saving)
if($_REQUEST["type"] != 'delete') {
if(attribute_check()) {
if($_REQUEST["type"])
attribute_save($_REQUEST["type"]);
else
attribute_save("modify");
} else {
attribute_print_form();
}
} else
attribute_save("delete");
// }}}
// {{{ submit == 3
} elseif(@$_REQUEST["submit"] == 3) {
// Support for changing domain administrator
// Called from:
// tables/domain_details-aci.inc
// tables/domain_details-default.inc
// tables/domain_details-owner.inc
attribute_print_form($_REQUEST["type"]);
// }}}
// {{{ submit == 4
} elseif(@$_REQUEST["submit"] == 4) {
// SAVE change of domain administrator, mailinglist admin and contact person
// Called from:
// tables/domain_details-aci.inc
// tables/domain_details-default.inc
// tables/domain_details-owner.inc
// tables/user_details-access.inc
// Administrator in branch
// Administrate webservers
// Administrate DNS
if($_REQUEST["action"])
attribute_save($_REQUEST["action"]);
elseif($_REQUEST["type"])
attribute_save($_REQUEST["type"]);
// }}}
// {{{ submit == else
} else {
if($_REQUEST["attrib"] == sprintf("%s", pql_get_define("PQL_ATTR_BASEQUOTA"))) {
attribute_init();
attribute_print_form();
} elseif(($_REQUEST["attrib"] == sprintf("%s", pql_get_define("PQL_ATTR_AUTOCREATE_USERNAME"))) or
($_REQUEST["attrib"] == sprintf("%s", pql_get_define("PQL_ATTR_AUTOCREATE_MAILADDRESS"))) or
($_REQUEST["attrib"] == sprintf("%s", pql_get_define("PQL_ATTR_AUTOCREATE_PASSWORD"))) or
($_REQUEST["attrib"] == sprintf("%s", pql_get_define("PQL_ATTR_SIMSCAN_SPAM"))) or
($_REQUEST["attrib"] == sprintf("%s", pql_get_define("PQL_ATTR_SIMSCAN_CLAM"))) or
($_REQUEST["attrib"] == sprintf("%s", pql_get_define("PQL_ATTR_SIMSCAN_TROPHIE"))) or
($_REQUEST["attrib"] == sprintf("%s", pql_get_define("PQL_ATTR_LOCK_USERNAME"))) or
($_REQUEST["attrib"] == sprintf("%s", pql_get_define("PQL_ATTR_LOCK_EMAILADDRESS"))) or
($_REQUEST["attrib"] == sprintf("%s", pql_get_define("PQL_ATTR_LOCK_DOMAINADDRESS"))) or
($_REQUEST["attrib"] == sprintf("%s", pql_get_define("PQL_ATTR_LOCK_PASSWORD"))) or
($_REQUEST["attrib"] == sprintf("%s", pql_get_define("PQL_ATTR_LOCK_ACCOUNTTYPE"))) or
($_REQUEST["attrib"] == sprintf("%s", pql_get_define("PQL_ATTR_START_IN_MY_ACCOUNT"))))
// A toggle or boolean change - jump to 'save changes' directly
attribute_save();
else
attribute_print_form($_REQUEST["type"]);
}
// }}}
?>
</body>
</html>
<?php
pql_flush();
/*
* Local variables:
* mode: php
* mode: font-lock
* tab-width: 4
* End:
*/
?>