forked from mkay/Exim4UI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadminuseradd.php
168 lines (164 loc) · 7.48 KB
/
adminuseradd.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
<?php
include_once dirname(__FILE__) . '/config/variables.php';
include_once dirname(__FILE__) . '/config/authpostmaster.php';
include_once dirname(__FILE__) . '/config/functions.php';
include_once dirname(__FILE__) . '/config/httpheaders.php';
# enforce limit on the maximum number of user accounts in the domain
$query = "SELECT (count(users.user_id) < domains.max_accounts)
OR (domains.max_accounts = 0) AS allowed FROM
users,domains WHERE users.domain_id=domains.domain_id
AND domains.domain_id='{$_SESSION['domain_id']}'
AND (users.type='local' OR users.type='piped')
GROUP BY domains.max_accounts";
$result = $db->query($query);
if ($result->numRows()) {
$row = $result->fetchRow();
}
if (!$row['allowed']) {
header ('Location: adminuser.php?maxaccounts=true');
}
$query = "SELECT * FROM domains WHERE domain_id='{$_SESSION['domain_id']}'";
$result = $db->query($query);
$row = $result->fetchRow();
?>
<!DOCTYPE HTML>
<html lang="en">
<head>
<title><?php echo _('Exim4U') . ': ' . _('Manage Users'); ?></title>
<meta charset="utf-8" />
<link rel="stylesheet" href="css/bootstrap.min.css" />
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/scripts.js"></script>
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body onLoad="document.adminadd.realname.focus()">
<div class="container">
<?php include dirname(__FILE__) . '/config/header.php'; ?>
<div class="navbar">
<div class="navbar-inner">
<ul id="menu" class="nav">
<li><a href="adminuser.php"><?php echo _('Manage Accounts'); ?></a></li>
<li><a href="admin.php"><?php echo _('Main Menu'); ?></a></li>
<li><a href="logout.php"><?php echo _('Logout'); ?></a></li>
</ul>
</div>
</div>
<form name="adminadd" method="post" action="adminuseraddsubmit.php">
<table>
<tr>
<td><?php echo _('Name'); ?>:</td>
<td><input type="text" size="25" name="realname" /></td>
</tr>
<tr>
<td><?php echo _('Address'); ?>:</td>
<td>
<div class="input-append">
<input type="text" size="25" name="localpart" /><span class="add-on">@<?php print $_SESSION['domain']; ?></span>
</div>
</td>
</tr>
<tr>
<td><?php echo _('Password'); ?>:</td>
<td><input type="password" size="25" name="clear" /></td>
</tr>
<tr>
<td><?php echo _('Verify Password'); ?>:</td>
<td><input type="password" size="25" name="vclear"></td>
</tr>
<?php
if ($postmasteruidgid == "yes") {
print '<tr><td>'
. _('UID')
. ':</td><td><input type="text" size="5" name="uid"'
. 'value="'
. $row['uid']
. '" /></td></tr>';
print "<tr><td>"
. _('GID')
. ':</td><td><input type="text" size="5" name="gid"'
. 'value="'
. $row['gid']
. '" /></td></tr>';
}
if ($row['quotas'] > "0") {
print '<tr><td>';
printf (_('Mailbox quota (%s Mb max)'), $row['quotas']);
print ':</td>';
print '<td><div class="input-append"><input type="text" size="5" name="quota" value="'
. $row['quotas']
. '" /><span class="add-on">'
. _('Mb')
. '</span></div></td></tr>';
}
?>
<tr>
<td><?php echo _('Has domain admin privileges?'); ?></td>
<td><input name="admin" type="checkbox" /></td>
</tr>
<?php
if ($row['pipe'] == "1") {
?>
<tr>
<td><?php echo _('Pipe To Command'); ?>:</td>
<td><input type="text" size="25" name="smtp" /></td>
</tr>
<tr>
<td colspan="2">
<?php echo _('Optional'); ?>:
<?php echo _('Pipe all mail to a command (e.g. procmail).'); ?>
<?php echo _('Check box below to enable.'); ?>
</td>
</tr>
<tr>
<td><?php echo _('Enable Piped Command?'); ?></td>
<td><input type="checkbox" name="on_piped"></td>
</tr>
<?php
}
if ($row['spamassassin'] == "1") {
?>
<tr>
<td><?php echo _('Spamassassin'); ?>:</td>
<td><input name="on_spamassassin" type="checkbox" checked /></td>
</tr>
<tr>
<tr>
<td><?php echo _('Enable Spam Box'); ?>:</td>
<td><input name="on_spambox" type="checkbox" checked /></td>
</tr>
<tr>
<td><?php echo _('Enable Spam Box Report'); ?>:</td>
<td><input name="on_spamboxreport" type="checkbox" /></td>
</tr>
<td><?php echo _('Spamassassin Tag Score'); ?>:</td>
<td><input name="sa_tag" size="5" type="text" value="<?php echo $row['sa_tag']; ?>" /></td>
</tr>
<tr>
<td><?php echo _('Spamassassin Discard Score'); ?>:</td>
<td><input name="sa_refuse" size="5" type="text" value="<?php echo $row['sa_refuse']; ?>" /></td>
</tr>
<?php } ?>
<tr>
<td><?php echo _('Maximum Message Size'); ?>:</td>
<td>
<div class="input-append">
<input name="maxmsgsize" size="5" type="text" value="<?php echo $row['maxmsgsize']; ?>" /><span class="add-on">Kb</span>
</div>
</td>
</tr>
<tr>
<td><?php echo _('Enabled'); ?>:</td>
<td><input name="enabled" type="checkbox" checked /></td>
</tr>
<tr>
<td></td>
<td><input class="btn" name="submit" type="submit" value="<?php echo _('Submit'); ?>" /></td>
</tr>
</table>
</form>
</div>
</body>
</html>