-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathadminuser.php
More file actions
136 lines (130 loc) · 5.47 KB
/
adminuser.php
File metadata and controls
136 lines (130 loc) · 5.47 KB
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
<?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';
if (isset($_GET['LETTER'])) {
$letter = strtolower($_GET['LETTER']);
} else {
$letter = '';
}
if (!isset($_POST['searchfor'])) {
$_POST['searchfor'] = '';
}
if (!isset($_POST['field']) || ($_POST['field'] != 'localpart')) {
$_POST['field'] = 'realname';
}
?>
<!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>
<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="adminuseradd.php"><?php echo _('Add User'); ?></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>
<?php
alpha_menu($alphausers)
?>
<form name="search" method="post" action="adminuser.php">
<div class="input-prepend input-append">
<span class="add-on"><?php echo _('Search'); ?>:</span>
<input type="text" size="20" name="searchfor" value="<?php echo $_POST['searchfor']; ?>" />
<?php echo _('in'); ?>
<select name="field">
<option value="realname" <?php if ($_POST['field'] == 'realname') {
echo 'selected="selected"';
} ?>><?php echo _('User'); ?></option>
<option value="localpart" <?php if ($_POST['field'] == 'localpart') {
echo "selected=\"selected\"";
} ?>><?php echo _('Email address'); ?></option>
</select>
<input class="btn" type="submit" name="search" value="<?php echo _('search'); ?>" />
</div>
</form>
<h4><?php
$query = "SELECT count(users.user_id)
AS used, max_accounts
FROM domains,users
WHERE users.domain_id='{$_SESSION['domain_id']}'
AND domains.domain_id=users.domain_id
AND (users.type='local' OR users.type='piped')
GROUP BY max_accounts";
$result = $db->query($query);
$row = $result->fetchRow();
if (($result->numRows()) && $row['max_accounts']) {
print "({$row['used']} of {$row['max_accounts']})";
}
?></h4>
<table>
<tr>
<th></th>
<th><?php echo _('User'); ?></th>
<th><?php echo _('Email address'); ?></th>
<th><?php echo _('Admin'); ?></th>
</tr>
<?php
$query = "SELECT user_id, localpart, realname, admin, enabled
FROM users
WHERE domain_id = '{$_SESSION['domain_id']}'
AND (type = 'local' OR type= 'piped')";
if ($alphausers AND $letter != '') {
$query .= " AND lower(localpart) LIKE lower('{$letter}%')";
} elseif ($_POST['searchfor'] != '') {
$query .= ' AND '
. $_POST['field']
. ' LIKE "%'
. $_POST['searchfor']
. '%"';
}
$query .= ' ORDER BY realname';
$result = $db->query($query);
while ($row = $result->fetchRow()) {
print '<tr>';
print '<td><a href="adminuserdelete.php?user_id='
. $row['user_id']
. '&localpart='
. $row['localpart']
. '">';
print '<img title="Delete '
. $row['realname']
. '" src="images/trashcan.gif" alt="trashcan"></a></td>';
print '<td><a href="adminuserchange.php?user_id=' . $row['user_id']
. '&localpart=' . $row['localpart']
. '" title="' . _('Click to modify')
. $row['realname']
. '">'
. $row['realname']
. '</a></td>';
print '<td>' . $row['localpart'] .'@'. $_SESSION['domain'] . '</td>';
print '<td>';
if ($row['admin'] == 1) {
print '<img src="images/check.gif" title="'
. $row['realname']
. _(' is an administrator')
. '">';
}
print "</td></tr>\n";
}
?>
</table>
</div>
</body>
</html>