forked from web-cyradm/web-cyradm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
adminuser.php
169 lines (144 loc) · 4.1 KB
/
adminuser.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
if (!defined('WC_BASE')) define('WC_BASE', dirname(__FILE__));
$ref=WC_BASE."/index.php";
if ($ref!=$_SERVER['SCRIPT_FILENAME']){
header("Location: index.php");
exit();
}
?>
<!-- ############################## Start adminuser.php ###################################### -->
<tr>
<td width="10"> </td>
<td valign="top">
<h3>
<?php print _("Browse admins");?>
</h3>
<?php
if ($authorized) {
$query = "SELECT * FROM adminuser";
$row_pos = (empty($_GET['row_pos']))?(0):($_GET['row_pos']);
# Fist query is for displaying
$result = $handle->limitQuery($query,$row_pos,10);
# second query is needed to get the total of administrators
$result2 = $handle->Query($query);
$cnt = $result->numRows();
$total = $result2->numRows();
?>
<p>
<?php print _("Total administrators") . ": " . $total;
print "<br>"._("Displaying from position:")." ".($row_pos+1);
?>
</p>
<table cellspacing="2" cellpadding="0">
<tr>
<td class="navi">
<a class="navilink" href="index.php?action=newadminuser&domain=<?php echo $_GET['domain']; ?>"><?php print _("Add administator"); ?></a>
</td>
<?php
$prev = $row_pos - 10;
$next = $row_pos + 10;
if ($row_pos < 10){
$_linkP = '#';
} else {
$_linkP = 'index.php?action=adminuser&domain=' . $_GET['domain'] . '&row_pos=' . $prev;
}
if ($next >= $total){
$_linkN = '#';
} else {
$_linkN = 'index.php?action=adminuser&domain=' . $_GET['domain'] . '&row_pos=' . $next;
}
?>
<td class="navi">
<a class="navilink" href="<?php echo $_linkP; ?>"><?php print _("Previous 10 entries");?></a>
</td>
<td class="navi">
<a class="navilink" href="<?php echo $_linkN; ?>"><?php print _("Next 10 entries");?></a>
</td>
</tr>
</table>
<table border="0">
<tbody>
<tr>
<th colspan="2">
<?php print _("action");?>
</th>
<th>
<?php print _("Adminname");?>
</th>
<th>
<?php print _("domain");?>
</th>
<th>
<?php print _("admin type");?>
</th>
</tr>
<?php
for ($c = 0; $c < $cnt; $c++){
if ($c%2==0){
$cssrow = "row1";
} else {
$cssrow = "row2";
}
$row = $result->fetchRow(DB_FETCHMODE_ASSOC, $c);
$username = $row['username'];
$query2 = "SELECT * FROM domainadmin WHERE adminuser='$username'";
$result2 = $handle->query($query2);
$cnt2 = $result2->numRows();
$row2 = $result2->fetchRow(DB_FETCHMODE_ASSOC, 0);
$domainname = $row2['domain_name'];
$type = $row['type'];
?>
<tr class="<?php echo $cssrow;?>">
<td valign="middle">
<a href="index.php?action=editadminuser&username=<?php echo $username; ?>&domain=<?php echo $_GET['domain']; ?>&row_pos=<?php print $row_pos;?>"><?php
print _("Edit adminuser");
?></a>
</td>
<td valign="middle">
<a href="index.php?action=deleteadminuser&username=<?php echo $username; ?>&domain=<?php echo $_GET['domain']; ?>"><?php
print _("Delete adminuser");
?></a>
</td>
<td valign="middle">
<?php echo $username;?>
</td>
<td valign="middle">
<?php
for ($i = 0; $i < $cnt2; $i++){
$row2 = $result2->fetchRow(DB_FETCHMODE_ASSOC, $i);
$domainname = $row2['domain_name'];
if ($type){
print "$domainname<br>";
}
}
if ($type==0){
print _("All domains");
}
if (empty($domainname) && $type!=0){
print "<font color=\"red\">";
print _("None");
print "</font>";
}
?>
</td>
<td valign="middle">
<?php
if ($type == 0){
print _("Superuser");
} elseif ($type == 1){
print _("Domain Master");
}
?>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
<?php
}
?>
</td>
</tr>
<!-- ############################### End adminuser.php ############################################# -->