adm_list.php 9.44 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
$fields = array (
	"show"    => array ("request", "string", ""),
43
	"creator" => array("request", "integer", 0),
Alan Garcia's avatar
Alan Garcia committed
44
	"short"   => array("request", "integer", -1),
45
46
);
getFields($fields);
47

Chantal Bernard-Putz's avatar
Chantal Bernard-Putz committed
48
49
50
51
52
53

if ($short!=-1) {
  $mem->adminpref($short);
  $mem->user["admlist"]=$short;
 }

54
55
56
$subadmin=variable_get("subadmin_restriction");

if ($subadmin==0 && $show && $cuid != 2000)
57
58
59
60
61
{
	__("This page is restricted to authorized staff");
	exit();
}

62
63

$r=$admin->get_list($show == 'all' ? 1 : 0, $creator);
64
65

?>
Chantal Bernard-Putz's avatar
Chantal Bernard-Putz committed
66
<h3><?php __("AlternC account list"); ?></h3>
67
68
<hr id="topbar"/>
<br />
69
<?php
70
	if (isset($error) && $error ) {
71
72
73
74
	  echo "<p class=\"error\">$error</p>";
	}
?>
<p>
Chantal Bernard-Putz's avatar
Chantal Bernard-Putz committed
75
76
<?php __("Here is the list of hosted AlternC accounts"); ?> (<?php printf(_("%s accounts"),count($r)); ?>)

77
&nbsp;
78
<?php if($show != 'all') {
79
  echo '<p><span class="ina"><a href="adm_list.php?show=all">' . _('List all AlternC accounts') . '</a></span>';
80
  if ($subadmin!=0 || $cuid==2000) {
81
82
83
84
    $list_creators = $admin->get_creator_list();
    $infos_creators = array();

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

    if (count($infos_creators)) {
89
      echo ' ('._("Or only the accounts of:")." ". implode(', ', $infos_creators) . ')';
90
    }
91
    echo "</p>";
92
  }
93
} else {
94
  echo '<p><span class="ina"><a href="adm_list.php">' . _('List only my accounts') . '</a></span></p>';
95
} ?>
96
97
  <p><span class="ina"><a href="adm_add.php"><?php __("Create a new AlternC account"); ?></a></span></p>

98
99
100
<?php
if (!is_array($r)) {
  echo "<p class=\"error\">"._("No account defined for now")."</p>";
101
} else {
102
103
104
?>

<form method="post" action="adm_dodel.php">
105
<?php
106
107
108
109
110

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

if ($mem->user["admlist"]==0) { // Normal (large) mode
?>
Chantal Bernard-Putz's avatar
Chantal Bernard-Putz committed
111
112
113
114
<table class="tlist">
<tr><td colspan="6">
<?php  if (count($r)>5) { ?>
<input type="submit" class="inb" name="submit" value="<?php __("Delete checked accounts"); ?>" />
Alan Garcia's avatar
Alan Garcia committed
115
<?php } ?>
Chantal Bernard-Putz's avatar
Chantal Bernard-Putz committed
116
117
118
119
120
</td>
<td  class="trbtn" colspan="4">
<span class="inav"><a href="adm_list.php?short=1"><?php __("Minimal view"); ?></a></span> &nbsp;
</td>
</tr>
121
<tr>
Chantal Bernard-Putz's avatar
Chantal Bernard-Putz committed
122
123
124
<th></th>
<th><?php __("Account"); ?></th>
<th><?php __("Manager"); ?></th>
125
<th><?php __("Created by") ?></th>
126
<th><?php __("Created on") ?></th>
Chantal Bernard-Putz's avatar
Chantal Bernard-Putz committed
127
<th><?php __("Quotas") ?></th>
128
129
<th><?php __("Last login"); ?></th>
<th><?php __("Last ip"); ?></th>
Chantal Bernard-Putz's avatar
Chantal Bernard-Putz committed
130
<th><?php __("Fails"); ?></th>
131
132
<th><?php __('Expiry') ?></th>
</tr>
133
134
<?php
reset($r);
135

136
137
138
139
140
141
$col=1;
while (list($key,$val)=each($r))
	{
	$col=3-$col;
?>
	<tr class="lst<?php echo $col; ?>">
Chantal Bernard-Putz's avatar
Chantal Bernard-Putz committed
142

143
144
<?php
 if ($val["su"]) { ?>
Chantal Bernard-Putz's avatar
Chantal Bernard-Putz committed
145
		   <td>&nbsp;</td>
146
<?php } else { ?>
147
 <td><input type="checkbox" class="inc" name="d[]" id="user_<?php echo $val["uid"]; ?>" value="<?php echo $val["uid"]; ?>" /></td>
148
<?php } ?>
149
		<td <?php if ($val["su"]) echo "style=\"color: red\""; ?>><label for="user_<?php echo $val["uid"]; ?>"><b><?php echo $val["login"] ?></b></label></td>
150
		<td><a href="mailto:<?php echo $val["mail"]; ?>"><?php echo $val["nom"]." ".$val["prenom"] ?></a>&nbsp;</td>
151
		<td><?php echo $val["parentlogin"] ?></td>
152
		<td><?php echo format_date('%3$d-%2$d-%1$d',$val["created"]); ?></td>
153
154
155
		<td><?php echo $val["type"] ?></td>
		<td><?php echo $val["lastlogin"] ?></td>
                <td><?php echo $val["lastip"] ?></td>
156
		<td><?php echo $val["lastfail"] ?></td>
157
158
		<td><div class="<?php echo 'exp' . $admin->renew_get_status($val['uid']) ?>"><?php echo $admin->renew_get_expiry($val['uid']) ?></div></td>
	</tr>
Chantal Bernard-Putz's avatar
Chantal Bernard-Putz committed
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181

<tr class="lst<?php echo $col; ?>" >
<td></td><td></td>
<td colspan="8" >
<div id="admlistbtn">
<span class="ina<?php if ($col==2) echo "v"; ?> lst<?php echo $col; ?>">
  <a href="adm_login.php?id=<?php echo $val["uid"];?>"><?php __("Connect as"); ?></a>
</span>&nbsp;
	&nbsp;
<span class="ina<?php if ($col==2) echo "v"; ?> lst<?php echo $col; ?>" >
  <a href="adm_edit.php?uid=<?php echo $val["uid"] ?>"><?php __("Edit"); ?></a>
</span>&nbsp;
<span class="ina<?php if ($col==2) echo "v"; ?> lst<?php echo $col; ?>" >
  <a href="adm_quotaedit.php?uid=<?php echo $val["uid"] ?>"><?php __("Quotas"); ?></a>
</span>&nbsp;
	<?php if (!$val["su"]) { ?>
<span class="ina<?php if ($col==2) echo "v"; ?> lst<?php echo $col; ?>" >
  <a href="adm_deactivate.php?uid=<?php echo $val["uid"] ?>"><?php __("Disable"); ?></a>
</span>&nbsp;
	  <?php } ?>
</div>
</td>
</tr>
182
183
184
<?php
	}

Chantal Bernard-Putz's avatar
Chantal Bernard-Putz committed
185
} // NORMAL MODE
186

Chantal Bernard-Putz's avatar
Chantal Bernard-Putz committed
187
if ($mem->user["admlist"]==1) { // SHORT MODE
188
189
?>

Chantal Bernard-Putz's avatar
Chantal Bernard-Putz committed
190
191
192
  [&nbsp;<?php __("C"); ?>&nbsp;] <?php __("Connect as"); ?> &nbsp; &nbsp; 
  [&nbsp;<?php __("E"); ?>&nbsp;] <?php __("Edit"); ?> &nbsp; &nbsp; 
  [&nbsp;<?php __("Q"); ?>&nbsp;] <?php __("Quotas"); ?> &nbsp; &nbsp; 
193

Chantal Bernard-Putz's avatar
Chantal Bernard-Putz committed
194
195
196
197
<table class="tlist">
<tr><td colspan="4">
<?php  if (count($r)>50) { ?>
<input type="submit" class="inb" name="submit" value="<?php __("Delete checked accounts"); ?>" />
Alan Garcia's avatar
Alan Garcia committed
198
<?php } ?>
Chantal Bernard-Putz's avatar
Chantal Bernard-Putz committed
199
200
201
202
203
</td>
<td  class="trbtn" colspan="5">
<span class="inav"><a href="adm_list.php?short=0"><?php __("Complete view"); ?></a></span>
</td>
</tr>
204
<tr>
205
206
207
   <th colspan="2"> </th><th><?php __("Account"); ?></th>
   <th colspan="2"> </th><th><?php __("Account"); ?></th>
   <th colspan="2"> </th><th><?php __("Account"); ?></th>
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
</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 { ?>
224
 <td align="center"><input type="checkbox" class="inc" name="d[]" value="<?php echo $val["uid"]; ?>" /></td>
225
226
<?php } ?>
		<td align="center">
Chantal Bernard-Putz's avatar
Chantal Bernard-Putz committed
227
228
229
230
231
		   <a href="adm_login.php?id=<?php echo $val["uid"];?>" target="_parent">[&nbsp;<?php __("C"); ?>&nbsp;]</a>
		   <a href="adm_edit.php?uid=<?php echo $val["uid"] ?>">[&nbsp;<?php __("E"); ?>&nbsp;]</a>
<?php		  if($admin->checkcreator($val['uid'])) { ?>
		   <a href="adm_quotaedit.php?uid=<?php echo $val["uid"] ?>">[&nbsp;<?php __("Q"); ?>&nbsp;]</a>
							  <?php } ?>
232
		</td>
Chantal Bernard-Putz's avatar
Chantal Bernard-Putz committed
233
		<td style="padding-right: 2px; border-right: 1px solid black; <?php if ($val["su"]) echo "color: red"; ?>"><b><?php echo $val["login"] ?></b></td>
234
235
236
237
238
239
240
241
242
243
<?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">
Chantal Bernard-Putz's avatar
Chantal Bernard-Putz committed
244
245
246
247
248
		   <a href="adm_login.php?id=<?php echo $val["uid"];?>" target="_parent">[&nbsp;<?php __("C"); ?>&nbsp;]</a>
		   <a href="adm_edit.php?uid=<?php echo $val["uid"] ?>">[&nbsp;<?php __("E"); ?>&nbsp;]</a>
<?php		  if($admin->checkcreator($val['uid'])) { ?>
		   <a href="adm_quotaedit.php?uid=<?php echo $val["uid"] ?>">[&nbsp;<?php __("Q"); ?>&nbsp;]</a>
							  <?php } ?>
249
		</td>
Chantal Bernard-Putz's avatar
Chantal Bernard-Putz committed
250
		<td style="padding-right: 2px; border-right: 1px solid black; <?php if ($val["su"]) echo "color: red"; ?>"><b><?php echo $val["login"] ?></b></td>
251
252
253
254
<?php

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

Alan Garcia's avatar
Alan Garcia committed
255
256
257
258
259
$val=null;
if (isset($r[$z+2*$rz])) {
  $val=$r[$z+2*$rz];
}
 
260
261
262
263
264
265
266
267
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">
Chantal Bernard-Putz's avatar
Chantal Bernard-Putz committed
268
269
270
271
272
		   <a href="adm_login.php?id=<?php echo $val["uid"];?>" target="_parent">[&nbsp;<?php __("C"); ?>&nbsp;]</a>
		   <a href="adm_edit.php?uid=<?php echo $val["uid"] ?>">[&nbsp;<?php __("E"); ?>&nbsp;]</a>
<?php		  if($admin->checkcreator($val['uid'])) { ?>
		   <a href="adm_quotaedit.php?uid=<?php echo $val["uid"] ?>">[&nbsp;<?php __("Q"); ?>&nbsp;]</a>
							  <?php } ?>
273
		</td>
Chantal Bernard-Putz's avatar
Chantal Bernard-Putz committed
274
		<td style="padding-right: 2px; border-right: 1px solid black; <?php if ($val["su"]) echo "color: red"; ?>"><b><?php echo $val["login"] ?></b></td>
275
276
277
278
279
280
281
282
	</tr>
<?php
	} else echo "<td style=\"padding-right: 2px; border-right: 1px solid;\" colspan=\"3\"></td></tr>";
} // for loop
} // Short Mode


?>
Chantal Bernard-Putz's avatar
Chantal Bernard-Putz committed
283
<tr><td colspan="10"><input type="submit" class="inb" name="submit" value="<?php __("Delete checked accounts"); ?>" /></td></tr>
284
285
</table>
</form>
286
<?php
Chantal Bernard-Putz's avatar
Chantal Bernard-Putz committed
287
 }
288
?>
289
<?php include_once("foot.php"); ?>