adm_list.php 9.41 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
<?php
/*
 ----------------------------------------------------------------------
 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/
 ----------------------------------------------------------------------
 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");
30
include_once("head.php");
31
32
33
34
35
36

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

37
38
$fields = array (
	"show"    => array ("request", "string", ""),
39
	"creator" => array("request", "integer", 0),
Alan Garcia's avatar
Alan Garcia committed
40
	"short"   => array("request", "integer", -1),
41
42
);
getFields($fields);
43

Chantal Bernard-Putz's avatar
Chantal Bernard-Putz committed
44
45
46
47
48
49

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

Alan Garcia's avatar
Alan Garcia committed
50
$subadmin=variable_get("subadmin_restriction", 0);
51

Alan Garcia's avatar
Alan Garcia committed
52
53
54
// If we ask for all account but we aren't "admin" and
// subadmin var is not 1
if ($show=="all" && !$subadmin==1 && $cuid != 2000) {
55
56
57
58
	__("This page is restricted to authorized staff");
	exit();
}

59
$r=$admin->get_list($show == 'all' ? 1 : 0, $creator);
60
61

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

73
&nbsp;
Alan Garcia's avatar
Alan Garcia committed
74
75
76
77
<?php

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

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

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

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

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

// 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
112
113
114
115
<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
116
<?php } ?>
Chantal Bernard-Putz's avatar
Chantal Bernard-Putz committed
117
118
119
120
121
</td>
<td  class="trbtn" colspan="4">
<span class="inav"><a href="adm_list.php?short=1"><?php __("Minimal view"); ?></a></span> &nbsp;
</td>
</tr>
122
<tr>
Chantal Bernard-Putz's avatar
Chantal Bernard-Putz committed
123
124
125
<th></th>
<th><?php __("Account"); ?></th>
<th><?php __("Manager"); ?></th>
126
<th><?php __("Created by") ?></th>
127
<th><?php __("Created on") ?></th>
Chantal Bernard-Putz's avatar
Chantal Bernard-Putz committed
128
<th><?php __("Quotas") ?></th>
129
130
<th><?php __("Last login"); ?></th>
<th><?php __("Last ip"); ?></th>
Chantal Bernard-Putz's avatar
Chantal Bernard-Putz committed
131
<th><?php __("Fails"); ?></th>
132
133
<th><?php __('Expiry') ?></th>
</tr>
134
135
<?php
reset($r);
136

137
138
139
140
141
142
$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
143

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

<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>
183
184
185
<?php
	}

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

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

Chantal Bernard-Putz's avatar
Chantal Bernard-Putz committed
191
192
193
  [&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; 
194

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

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

Alan Garcia's avatar
Alan Garcia committed
256
257
258
259
260
$val=null;
if (isset($r[$z+2*$rz])) {
  $val=$r[$z+2*$rz];
}
 
261
262
263
264
265
266
267
268
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
269
270
271
272
273
		   <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 } ?>
274
		</td>
Chantal Bernard-Putz's avatar
Chantal Bernard-Putz committed
275
		<td style="padding-right: 2px; border-right: 1px solid black; <?php if ($val["su"]) echo "color: red"; ?>"><b><?php echo $val["login"] ?></b></td>
276
277
278
279
280
281
282
283
	</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
284
<tr><td colspan="10"><input type="submit" class="inb" name="submit" value="<?php __("Delete checked accounts"); ?>" /></td></tr>
285
286
</table>
</form>
287
<?php
Chantal Bernard-Putz's avatar
Chantal Bernard-Putz committed
288
 }
289
?>
290
<?php include_once("foot.php"); ?>