adm_list.php 7.76 KB
Newer Older
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
<?php
/*
 $Id: adm_list.php,v 1.11 2006/01/24 05:03:30 joe Exp $
 ----------------------------------------------------------------------
 AlternC - Web Hosting System
 Copyright (C) 2006 Le rseau Koumbit Inc.
 http://koumbit.org/
 Copyright (C) 2002 by the AlternC Development Team.
 http://alternc.org/
 ----------------------------------------------------------------------
 Based on:
 Valentin Lacambre's web hosting softwares: http://altern.org/
 ----------------------------------------------------------------------
 LICENSE

 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License (GPL)
 as published by the Free Software Foundation; either version 2
 of the License, or (at your option) any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 To read the license please visit http://www.gnu.org/copyleft/gpl.html
 ----------------------------------------------------------------------
 Original Author of file: Benjamin Sonntag
 Purpose of file: Show the member list
 TODO : Add a Next / Previous system in case of big lists...
 ----------------------------------------------------------------------
*/
require_once("../class/config.php");

if (!$admin->enabled) {
	__("This page is restricted to authorized staff");
	exit();
}

$r=$admin->get_list($_REQUEST['show'] == 'all' ? 1 : 0);

include("head.php");
?>
</head>
<body>
<h3><?php __("Member list"); ?></h3>
<?php
	if ($error) {
	  echo "<p class=\"error\">$error</p>";
	}
?>
<p>
<?php __("Here is the list of hosted members"); ?>
<?php if($_REQUEST['show'] != 'all') {
55
  echo '<br /><a href="adm_list.php?show=all">' . _('List all the accounts') . '</a>';
56
} else {
57
  echo '<br /><a href="adm_list.php">' . _('List only my accounts') . '</a>';
58
} ?>
59
60
  <br /><a href="adm_add.php"><?php __("Create a new member"); ?></a>
  <br /><a href="<?php echo $_SERVER["SCRIPT_NAME"]; ?>"><?php __("Update this page"); ?></a>
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
</p>
<?php
if (!is_array($r)) {
  echo "<p class=\"error\">"._("No account defined for now")."</p>";
} else { 
?>

<form method="post" action="adm_dodel.php">
<?php 

// Depending on the admin's choice, let's show a short list or a long list.

if ($mem->user["admlist"]==0) { // Normal (large) mode
?>
<table cellspacing="0" cellpadding="4">
76
77
78
79
80
81
82
83
84
85
86
<tr>
<th colspan="5">&nbsp;</th>
<th><?php __("Username"); ?></th>
<th><?php echo _("Surname")." "._("First Name")."<br />("._("Email address").")"; ?></th>
<th><?php __("Created by") ?></th>
<th><?php __("Account type") ?></th>
<th><?php __("Last login"); ?></th>
<th><?php __("Last fail"); ?></th>
<th><?php __("Last ip"); ?></th>
<th><?php __('Expiry') ?></th>
</tr>
87
88
<?php
reset($r);
89

90
91
92
93
94
95
$col=1;
while (list($key,$val)=each($r))
	{
	$col=3-$col;
?>
	<tr class="lst<?php echo $col; ?>">
96
97
98
99

<?php
		  if($admin->checkcreator($val['uid'])) {
 if ($val["su"]) { ?>
100
101
102
			<td>&nbsp;</td>
<?php } else { ?>
 <td align="center"><input type="checkbox" class="inc" name="d[]" value="<?php echo $val["uid"]; ?>" /></td>
103
104
<?php }
 ?>
105
106
		<td align="center"><a href="adm_edit.php?uid=<?php echo $val["uid"] ?>"><?php __("Edit"); ?></a></td>
		<td align="center"><a href="adm_quotaedit.php?uid=<?php echo $val["uid"] ?>"><?php __("Quotas"); ?></a></td>
107
		<td align="center"><a href="adm_deactivate.php?uid=<?php echo $val["uid"] ?>"><?php __("Deactivate"); ?></a></td>
108
109
110
111
112
113
		<td align="center"><?php
		if (!$val["enabled"])
			echo "<img src=\"icon/encrypted.png\" width=\"16\" height=\"16\" alt=\""._("Locked Account")."\" />";
		else {
		?>
			<a href="adm_login.php?id=<?php echo $val["uid"];?>" target="_parent"><?php __("Connect as"); ?></a>
114
		<?php } ?>
115
		</td>
116
117
		    <?php
		    } else { 
118
		      echo "<td colspan=\"5\"></td>"; 
119
120
121
		    }
 ?>

122
123
		<td <?php if ($val["su"]) echo "style=\"color: red\""; ?>><?php echo $val["login"] ?></td>
		<td><a href="mailto:<?php echo $val["mail"]; ?>"><?php echo $val["nom"]." ".$val["prenom"] ?></a>&nbsp;</td>
124
		<td><?php echo $val["parentlogin"] ?></td>
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
		<td><?php echo $val["type"] ?></td>
		<td><?php echo $val["lastlogin"] ?></td>
		<td><?php echo $val["lastfail"] ?></td>
                <td><?php echo $val["lastip"] ?></td>
		<td><div class="<?php echo 'exp' . $admin->renew_get_status($val['uid']) ?>"><?php echo $admin->renew_get_expiry($val['uid']) ?></div></td>
	</tr>
<?php
	}

} // Normal Mode

if ($mem->user["admlist"]==1) { // Short mode TODO : make 3 columns instead of 2  + XHTML compliance instead of 1px img trick ;)
?>


<table cellspacing="0" cellpadding="0">
<tr>
	<th colspan="2">&nbsp;</th><th><?php __("Username"); ?></th>
	<th colspan="2">&nbsp;</th><th><?php __("Username"); ?></th>
	<th colspan="2">&nbsp;</th><th><?php __("Username"); ?></th>
</tr>
<?php
reset($r);
$col=1;

$rz=ceil(count($r)/3);

for($z=0;$z<$rz;$z++)
	{
	$col=3-$col;
$val=$r[$z];
?>
	<tr class="lst<?php echo $col; ?>">
<?php if ($val["su"]) { ?>
			<td>&nbsp;</td>
<?php } else { ?>
 <td align="center"><input type="checkbox" class="inc" name="d[]" value="<?php echo $val["uid"]; ?>"></td>
<?php } ?>
		<td align="center">
		<a href="adm_edit.php?uid=<?php echo $val["uid"] ?>"><?php __("E"); ?></a>
		<a href="adm_quotaedit.php?uid=<?php echo $val["uid"] ?>"><?php __("Q"); ?></a>
		<?php
		if (!$val["enabled"])
			echo "<img src=\"icon/encrypted.png\" width=\"16\" height=\"16\" alt=\""._("Locked Account")."\">";
		else {
		?>
			<a href="adm_login.php?id=<?php echo $val["uid"];?>" target="_parent"><?php __("C"); ?></a>
		<?php } ?>
		</td>
		<td style="padding-right: 2px; border-right: 1px solid; <?php if ($val["su"]) echo "color: red"; ?>"><?php echo $val["login"] ?></td>
<?php
$val=$r[$z+$rz];
if (is_array($val)) {
?>
<?php if ($val["su"]) { ?>
			<td>&nbsp;</td>
<?php } else { ?>
 <td align="center"><input type="checkbox" class="inc" name="d[]" value="<?php echo $val["uid"]; ?>"></td>
<?php } ?>
		<td align="center">
		<a href="adm_edit.php?uid=<?php echo $val["uid"] ?>"><?php __("E"); ?></a>
		<a href="adm_quotaedit.php?uid=<?php echo $val["uid"] ?>"><?php __("Q"); ?></a>
		<?php
		if (!$val["enabled"])
			echo "<img src=\"icon/encrypted.png\" width=\"16\" height=\"16\" alt=\""._("Locked Account")."\">";
		else {
		  if($admin->checkcreator($val['uid'])) {
		?>
			<a href="adm_login.php?id=<?php echo $val["uid"];?>" target="_parent"><?php __("C"); ?></a>
		<?php } } ?>
		</td>
		<td style="padding-right: 2px; border-right: 1px solid; <?php if ($val["su"]) echo "color: red"; ?>"><?php echo $val["login"] ?></td>
<?php

} else echo "<td style=\"padding-right: 2px; border-right: 1px solid;\" colspan=\"3\"></td></tr>";

$val=$r[$z+2*$rz];
if (is_array($val)) {
?>
<?php if ($val["su"]) { ?>
			<td>&nbsp;</td>
<?php } else { ?>
 <td align="center"><input type="checkbox" class="inc" name="d[]" value="<?php echo $val["uid"]; ?>"></td>
<?php } ?>
		<td align="center">
		<a href="adm_edit.php?uid=<?php echo $val["uid"] ?>"><?php __("E"); ?></a>
		<a href="adm_quotaedit.php?uid=<?php echo $val["uid"] ?>"><?php __("Q"); ?></a>
		<?php
		if (!$val["enabled"])
			echo "<img src=\"icon/encrypted.png\" width=\"16\" height=\"16\" alt=\""._("Locked Account")."\">";
		else {
		?>
			<a href="adm_login.php?id=<?php echo $val["uid"];?>" target="_parent"><?php __("C"); ?></a>
		<?php } ?>
		</td>
		<td style="padding-right: 2px; border-right: 1px solid; <?php if ($val["su"]) echo "color: red"; ?>"><?php echo $val["login"] ?></td>
	</tr>
<?php
	} else echo "<td style=\"padding-right: 2px; border-right: 1px solid;\" colspan=\"3\"></td></tr>";
} // for loop
} // Short Mode


?>
<tr><td colspan="9"><input type="submit" class="inb" name="submit" value="<?php __("Delete checked accounts"); ?>" /></td></tr>
</table>
</form>
232
<?php
233
   printf("<p>"._("%s accounts")."</p>",count($r));
234
235
 } 
?>
236
237
</body>
</html>