adm_list.php 8.39 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
<?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");
34
include_once("head.php");
35
36
37
38
39
40

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

41
42
43
44
45
$fields = array (
	"show"    => array ("request", "string", ""),
	"creator_id" => array("request", "integer", 2000),
);
getFields($fields);
46

47
48
49
50
51
52
53
if ($show && $cuid != 2000)
{
	__("This page is restricted to authorized staff");
	exit();
}

$r=$admin->get_list($show == 'all' ? 1 : 0, $creator_id);
54
55
56
57
58
59
60
61
62
63

?>
<h3><?php __("Member list"); ?></h3>
<?php
	if ($error) {
	  echo "<p class=\"error\">$error</p>";
	}
?>
<p>
<?php __("Here is the list of hosted members"); ?>
64
&nbsp;
65
<?php if($_REQUEST['show'] != 'all') {
66
  echo '<br /><a href="adm_list.php?show=all">' . _('List all the accounts') . '</a>';
67
68
69
70
71
72
73
74
75
76
77
78
  if ($cuid == 2000) {
    $list_creators = $admin->get_creator_list();
    $infos_creators = array();

    foreach ($list_creators as $key => $val) {
      $infos_creators[] = '<a href="adm_list.php?show_all&creator=' . $val['uid'] . '">' . $val['login'] . '</a>';
    }

    if (count($infos_creators)) {
      echo ' (' . implode(', ', $infos_creators) . ')';
    }
  }
79
} else {
80
  echo '<br /><a href="adm_list.php">' . _('List only my accounts') . '</a>';
81
} ?>
82
83
  <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>
84
85
86
87
</p>
<?php
if (!is_array($r)) {
  echo "<p class=\"error\">"._("No account defined for now")."</p>";
88
} else {
89
90
91
?>

<form method="post" action="adm_dodel.php">
92
<?php
93
94
95
96
97
98

// 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">
99
100
101
102
103
104
105
106
107
108
109
<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>
110
111
<?php
reset($r);
112

113
114
115
116
117
118
$col=1;
while (list($key,$val)=each($r))
	{
	$col=3-$col;
?>
	<tr class="lst<?php echo $col; ?>">
119
120
121
<?php
		  if($admin->checkcreator($val['uid'])) {
 if ($val["su"]) { ?>
122
123
124
			<td>&nbsp;</td>
<?php } else { ?>
 <td align="center"><input type="checkbox" class="inc" name="d[]" value="<?php echo $val["uid"]; ?>" /></td>
125
<?php } ?>
126
127
		<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>
128
		<td align="center"><a href="adm_deactivate.php?uid=<?php echo $val["uid"] ?>"><?php __("Deactivate"); ?></a></td>
129
130
131
132
		<td align="center"><?php
		if (!$val["enabled"])
			echo "<img src=\"icon/encrypted.png\" width=\"16\" height=\"16\" alt=\""._("Locked Account")."\" />";
		else {
133
		  if($admin->checkcreator($val['uid'])) {
134
		?>
135
			<a href="adm_login.php?id=<?php echo $val["uid"];?>"><?php __("Connect as"); ?></a>
136
		<?php } } ?>
137
		</td>
138
139
		    <?php
		    } else { 
140
		      echo "<td colspan=\"5\"></td>"; 
141
142
		    }
 ?>
143
144
		<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>
145
		<td><?php echo $val["parentlogin"] ?></td>
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
		<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 { ?>
182
 <td align="center"><input type="checkbox" class="inc" name="d[]" value="<?php echo $val["uid"]; ?>" /></td>
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
<?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>
253
<?php
254
   printf("<p>"._("%s accounts")."</p>",count($r));
255
256
 } 
?>
257
<?php include_once("foot.php"); ?>