[fix] missing delete account button in long account list

This commit is contained in:
alban 2014-03-26 18:51:22 +01:00
parent 34594c884f
commit 2793eb73f9
1 changed files with 213 additions and 203 deletions

View File

@ -1,69 +1,70 @@
<?php <?php
/* /*
---------------------------------------------------------------------- ----------------------------------------------------------------------
AlternC - Web Hosting System AlternC - Web Hosting System
Copyright (C) 2006 Le réseau Koumbit Inc. Copyright (C) 2006 Le r<EFBFBD>seau Koumbit Inc.
http://koumbit.org/ http://koumbit.org/
Copyright (C) 2002 by the AlternC Development Team. Copyright (C) 2002 by the AlternC Development Team.
http://alternc.org/ http://alternc.org/
---------------------------------------------------------------------- ----------------------------------------------------------------------
LICENSE LICENSE
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License (GPL) modify it under the terms of the GNU General Public License (GPL)
as published by the Free Software Foundation; either version 2 as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version. of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
To read the license please visit http://www.gnu.org/copyleft/gpl.html To read the license please visit http://www.gnu.org/copyleft/gpl.html
---------------------------------------------------------------------- ----------------------------------------------------------------------
Original Author of file: Benjamin Sonntag Original Author of file: Benjamin Sonntag
Purpose of file: Show the member list Purpose of file: Show the member list
---------------------------------------------------------------------- ----------------------------------------------------------------------
*/ */
require_once("../class/config.php"); require_once("../class/config.php");
include_once("head.php"); include_once("head.php");
if (!$admin->enabled) { if (!$admin->enabled) {
__("This page is restricted to authorized staff"); __("This page is restricted to authorized staff");
include_once('foot.php'); include_once('foot.php');
exit(); exit();
} }
$fields = array ( $fields = array(
"show" => array ("request", "string", ""), "show" => array("request", "string", ""),
"creator" => array("request", "integer", 0), "creator" => array("request", "integer", 0),
"short" => array("request", "integer", -1), "short" => array("request", "integer", -1),
"pattern" => array("post", "string", "*"), "pattern" => array("post", "string", "*"),
"pattern_type" => array("post", "string", "login"), "pattern_type" => array("post", "string", "login"),
); );
getFields($fields); getFields($fields);
if (empty($pattern)) $pattern="*"; if (empty($pattern))
$pattern = "*";
if ($short!=-1) { if ($short != -1) {
$mem->adminpref($short); $mem->adminpref($short);
$mem->user["admlist"]=$short; $mem->user["admlist"] = $short;
} }
$subadmin=variable_get("subadmin_restriction", 0); $subadmin = variable_get("subadmin_restriction", 0);
// If we ask for all account but we aren't "admin" and // If we ask for all account but we aren't "admin" and
// subadmin var is not 1 // subadmin var is not 1
if ($show=="all" && !$subadmin==1 && $cuid != 2000) { if ($show == "all" && !$subadmin == 1 && $cuid != 2000) {
__("This page is restricted to authorized staff"); __("This page is restricted to authorized staff");
include('foot.php'); include('foot.php');
exit(); exit();
} }
if ($pattern && $pattern_type) { if ($pattern && $pattern_type) {
$r=$admin->get_list($show == 'all' ? 1 : 0, $creator, $pattern, $pattern_type); $accountList = $admin->get_list($show == 'all' ? 1 : 0, $creator, $pattern, $pattern_type);
} else { } else {
$r = FALSE; $accountList = FALSE;
} }
?> ?>
@ -72,198 +73,207 @@ if ($pattern && $pattern_type) {
<?php <?php
// Depending on the admin's choice, let's show a short list or a long list. // Depending on the admin's choice, let's show a short list or a long list.
if ($mem->user["admlist"]==0) { // Normal (large) mode if ($mem->user["admlist"] == 0) { // Normal (large) mode
?> ?>
<p><span class="ina" style="float: right;"><a href="adm_list.php?short=1"><?php __("Minimal view"); ?></a></span></p> <p><span class="ina" style="float: right;"><a href="adm_list.php?short=1"><?php __("Minimal view"); ?></a></span></p>
<?php <?php
} else { } else {
?> ?>
<p><span class="ina" style="float:right;"><a href="adm_list.php?short=0"><?php __("Complete view"); ?></a></span></p> <p><span class="ina" style="float:right;"><a href="adm_list.php?short=0"><?php __("Complete view"); ?></a></span></p>
<?php <?php
} }
?> ?>
<fieldset style="clear:both;"> <fieldset style="clear:both;">
<legend><?php __("Filters"); ?></legend> <legend><?php __("Filters"); ?></legend>
<form method="post" action="adm_list.php" > <form method="post" action="adm_list.php" >
<p> <p>
<label for="pattern_type_login"><?php __("Search for a Login"); ?></label><input type="radio" name="pattern_type" value="login" id="pattern_type_login" <?php if (!$pattern_type || $pattern_type === 'login') echo ' checked="checked" '; ?>/>&nbsp; <label for="pattern_type_login"><?php __("Search for a Login"); ?></label><input type="radio" name="pattern_type" value="login" id="pattern_type_login" <?php if (!$pattern_type || $pattern_type === 'login') echo ' checked="checked" '; ?>/>&nbsp;
<label for="pattern_type_domain"><?php __("Search for a Domain"); ?></label><input type="radio" name="pattern_type" value="domaine" id="pattern_type_domain" <?php if ($pattern_type === 'domaine') echo ' checked="checked" '; ?>/> <label for="pattern_type_domain"><?php __("Search for a Domain"); ?></label><input type="radio" name="pattern_type" value="domaine" id="pattern_type_domain" <?php if ($pattern_type === 'domaine') echo ' checked="checked" '; ?>/>
<input type="text" id="pattern" name="pattern" value="<?php echo $pattern ?>"/> <input type="submit" class="inb filter" value="<?php __("submit"); ?>" /> <input type="text" id="pattern" name="pattern" value="<?php echo $pattern ?>"/> <input type="submit" class="inb filter" value="<?php __("submit"); ?>" />
</p> </p>
</form> </form>
<?php <?php
$list_creators = $admin->get_creator_list(); $list_creators = $admin->get_creator_list();
if ($subadmin==1 || $cuid==2000) { if ($subadmin == 1 || $cuid == 2000) {
if($show != 'all') { if ($show != 'all') {
echo '<p><span class="inb filter"><a href="adm_list.php?show=all">' . _('List all AlternC accounts') . '</a></span>'; echo '<p><span class="inb filter"><a href="adm_list.php?show=all">' . _('List all AlternC accounts') . '</a></span>';
if ($subadmin==1 || $cuid==2000) {
$infos_creators = array();
foreach ($list_creators as $key => $val) { if ($subadmin == 1 || $cuid == 2000) {
$infos_creators[] = '<a href="adm_list.php?creator=' . $val['uid'] . '">' . $val['login'] . '</a>'; $infos_creators = array();
foreach ($list_creators as $key => $val) {
$infos_creators[] = '<a href="adm_list.php?creator=' . $val['uid'] . '">' . $val['login'] . '</a>';
}
if (count($infos_creators)) {
echo ' (' . _("Or only the accounts of:") . " " . implode(', ', $infos_creators) . ')';
}
}
echo "</p>";
} else { // if show != all
echo '<p><span class="ina filter"><a href="adm_list.php">' . _('List only my accounts') . '</a></span></p>';
} }
}// END ($subadmin==1 || $cuid==2000)
if (count($infos_creators)) { ?>
echo ' ('._("Or only the accounts of:")." ". implode(', ', $infos_creators) . ')';
}
}
echo "</p>";
} else { // if show != all
echo '<p><span class="ina filter"><a href="adm_list.php">' . _('List only my accounts') . '</a></span></p>';
}
}// END ($subadmin==1 || $cuid==2000)
?>
</fieldset> </fieldset>
<?php
if ( !empty($error) ) {
echo '<p class="alert alert-danger">' , $error, '</p>';
}
<?php
if (!empty($error)) {
echo '<p class="alert alert-danger">', $error, '</p>';
}
?> ?>
<p> <p>
<?php __("Here is the list of hosted AlternC accounts"); ?> (<?php printf(_("%s accounts"),count($r)); ?>) <?php __("Here is the list of hosted AlternC accounts"); ?> (<?php printf(_("%s accounts"), count($accountList)); ?>)
</p> </p>
<p><span class="ina add"><a href="adm_add.php"><?php __("Create a new AlternC account"); ?></a></span></p> <p><span class="ina add"><a href="adm_add.php"><?php __("Create a new AlternC account"); ?></a></span></p>
<?php <?php
if (!is_array($r) || empty($r) ) { if (!is_array($accountList) || empty($accountList)) {
echo '<p class="alert alert-danger">'._("No account defined for now").'</p>'; echo '<p class="alert alert-danger">' . _("No account defined for now") . '</p>';
include('foot.php'); include('foot.php');
} }
?> ?>
<form method="post" action="adm_dodel.php"> <form method="post" action="adm_dodel.php">
<?php <?php
// Depending on the admin's choice, let's show a short list or a long list. // Depending on the admin's choice, let's show a short list or a long list.
if ($mem->user["admlist"]==0) { // Normal (large) mode if ($mem->user["admlist"] == 0) { // Normal (large) mode
?> ?>
<p> <p>
<?php if (count($r)>5) { ?> <?php if (count($accountList) > 5) { ?>
<input type="submit" class="inb delete" name="submit" value="<?php __("Delete checked accounts"); ?>" /> <input type="submit" class="inb delete" name="submit" value="<?php __("Delete checked accounts"); ?>" />
<?php } ?> <?php } ?>
</p> </p>
<table class="tlist" style="clear:both;"> <table class="tlist" style="clear:both;">
<tr> <tr>
<th></th> <th></th>
<th><?php __("Account"); ?></th> <th><?php __("Account"); ?></th>
<th><?php __("Manager"); ?></th> <th><?php __("Manager"); ?></th>
<th><?php __("Created by") ?></th> <th><?php __("Created by") ?></th>
<th><?php __("Created on") ?></th> <th><?php __("Created on") ?></th>
<th><?php __("Quotas") ?></th> <th><?php __("Quotas") ?></th>
<th><?php __("Last login"); ?></th> <th><?php __("Last login"); ?></th>
<th><?php __("Last ip"); ?></th> <th><?php __("Last ip"); ?></th>
<th><?php __("Fails"); ?></th> <th><?php __("Fails"); ?></th>
<th><?php __('Expiry') ?></th> <th><?php __('Expiry') ?></th>
</tr> </tr>
<?php <?php
reset($r); reset($accountList);
$col=1; $col = 1;
while (list($key,$val)=each($r)) { while (list($key, $val) = each($accountList)) {
$col=3-$col; $col = 3 - $col;
?> ?>
<tr class="lst<?php echo $col; ?>"> <tr class="lst<?php echo $col; ?>">
<?php <?php if ($val["su"]) { ?>
if ($val["su"]) { ?> <td id="user_<?php echo $val["uid"]; ?>">&nbsp;</td>
<td id="user_<?php echo $val["uid"]; ?>">&nbsp;</td> <?php } else { ?>
<?php } else { ?> <td><input type="checkbox" class="inc" name="d[]" id="user_<?php echo $val["uid"]; ?>" value="<?php echo $val["uid"]; ?>" /></td>
<td><input type="checkbox" class="inc" name="d[]" id="user_<?php echo $val["uid"]; ?>" value="<?php echo $val["uid"]; ?>" /></td> <?php } // val['su'] ?>
<?php } // val['su'] ?> <td <?php if ($val["su"]) echo 'style="color: red"'; ?>><label for="user_<?php echo $val["uid"]; ?>"><b><?php echo $val["login"] ?></b></label></td>
<td <?php if ($val["su"]) echo 'style="color: red"'; ?>><label for="user_<?php echo $val["uid"]; ?>"><b><?php echo $val["login"] ?></b></label></td> <td><a title="<?php __("Send an email"); ?>" href="mailto:<?php echo $val["mail"]; ?>"><?php echo $val["nom"] . " " . $val["prenom"] ?></a>&nbsp;</td>
<td><a title="<?php __("Send an email");?>" href="mailto:<?php echo $val["mail"]; ?>"><?php echo $val["nom"]." ".$val["prenom"] ?></a>&nbsp;</td> <td><?php echo $val["parentlogin"] ?></td>
<td><?php echo $val["parentlogin"] ?></td> <td><?php echo format_date(_('%3$d-%2$d-%1$d'), $val["created"]); ?></td>
<td><?php echo format_date(_('%3$d-%2$d-%1$d'),$val["created"]); ?></td> <td><?php echo $val["type"] ?></td>
<td><?php echo $val["type"] ?></td> <td><?php echo $val["lastlogin"] ?></td>
<td><?php echo $val["lastlogin"] ?></td> <td><?php echo $val["lastip"] ?></td>
<td><?php echo $val["lastip"] ?></td> <td><?php echo $val["lastfail"] ?></td>
<td><?php echo $val["lastfail"] ?></td> <td><div class="<?php echo 'exp' . $admin->renew_get_status($val['uid']) ?>"><?php echo $admin->renew_get_expiry($val['uid']) ?></div></td>
<td><div class="<?php echo 'exp' . $admin->renew_get_status($val['uid']) ?>"><?php echo $admin->renew_get_expiry($val['uid']) ?></div></td> </tr>
</tr>
<tr class="lst<?php echo $col; ?>" >
<td/><td ><i><?php echo _("DB:").' '.$val['db_server_name']?></i></td>
<td colspan="8" >
<div id="admlistbtn">
<span class="ina<?php if ($col==2) echo "v"; ?>">
<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"; ?>" >
<a href="adm_edit.php?uid=<?php echo $val["uid"] ?>"><?php __("Edit"); ?></a>
</span>&nbsp;
<span class="ina<?php if ($col==2) echo "v"; ?>" >
<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"; ?>" >
<a href="adm_deactivate.php?uid=<?php echo $val["uid"] ?>"><?php __("Disable"); ?></a>
</span>&nbsp;
<?php } ?>
</div>
</td>
</tr>
<?php
} // while (list($key,$val)=each($r)) {
echo '</table></form><br/>';
<tr class="lst<?php echo $col; ?>" >
<td/><td ><i><?php echo _("DB:") . ' ' . $val['db_server_name'] ?></i></td>
<td colspan="8" >
<div id="admlistbtn">
<span class="ina<?php if ($col == 2) echo "v"; ?>">
<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"; ?>" >
<a href="adm_edit.php?uid=<?php echo $val["uid"] ?>"><?php __("Edit"); ?></a>
</span>&nbsp;
<span class="ina<?php if ($col == 2) echo "v"; ?>" >
<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"; ?>" >
<a href="adm_deactivate.php?uid=<?php echo $val["uid"] ?>"><?php __("Disable"); ?></a>
</span>&nbsp;
<?php } ?>
</div>
</td>
</tr>
<?php
} // while (list($key,$val)=each($accountList)) {
?>
</table>
<br/>
<p>
<input type="submit" class="inb" name="submit" value="<?php __("Delete checked accounts"); ?>" /></p>
</form>
<?php
} // NORMAL MODE } // NORMAL MODE
if ($mem->user["admlist"]==1) { // SHORT MODE if ($mem->user["admlist"] == 1) { // SHORT MODE
?> ?>
[&nbsp;<?php __("C"); ?>&nbsp;] <?php __("Connect as"); ?> &nbsp; &nbsp; [&nbsp;<?php __("C"); ?>&nbsp;] <?php __("Connect as"); ?> &nbsp; &nbsp;
[&nbsp;<?php __("E"); ?>&nbsp;] <?php __("Edit"); ?> &nbsp; &nbsp; [&nbsp;<?php __("E"); ?>&nbsp;] <?php __("Edit"); ?> &nbsp; &nbsp;
[&nbsp;<?php __("Q"); ?>&nbsp;] <?php __("Quotas"); ?> &nbsp; &nbsp; [&nbsp;<?php __("Q"); ?>&nbsp;] <?php __("Quotas"); ?> &nbsp; &nbsp;
<p> <p>
<?php if (count($r)>50) { ?> <?php if (count($accountList) > 50) { ?>
<input type="submit" class="inb" name="submit" value="<?php __("Delete checked accounts"); ?>" /> <input type="submit" class="inb" name="submit" value="<?php __("Delete checked accounts"); ?>" />
<?php } // finc count > 50 ?> <?php } // finc count > 50 ?>
</p> </p>
<table class="tlist" style="clear:both;"> <table class="tlist" style="clear:both;">
<tr> <tr>
<th colspan="2"> </th><th><?php __("Account"); ?></th> <th colspan="2"> </th><th><?php __("Account"); ?></th>
<th colspan="2"> </th><th><?php __("Account"); ?></th> <th colspan="2"> </th><th><?php __("Account"); ?></th>
<th colspan="2"> </th><th><?php __("Account"); ?></th> <th colspan="2"> </th><th><?php __("Account"); ?></th>
</tr> </tr>
<?php <?php
reset($r); reset($accountList);
$count_r = 0; $count_r = 0;
foreach ($r as $val) { foreach ($accountList as $val) {
if ( ($count_r % 3) == 0 ) { echo '<tr class="lst">'; } if (($count_r % 3) == 0) {
echo '<tr class="lst">';
}
if ($val["su"]) { if ($val["su"]) {
echo '<td>&nbsp;</td>'; echo '<td>&nbsp;</td>';
} else { } else {
echo '<td align="center"><input type="checkbox" class="inc" name="d[]" value="'.$val["uid"].'" id="id_c_'.$val["uid"].'" /></td>'; echo '<td align="center"><input type="checkbox" class="inc" name="d[]" value="' . $val["uid"] . '" id="id_c_' . $val["uid"] . '" /></td>';
} // if $val["su"] ?> } // if $val["su"]
<td align="center"> ?>
<a href="adm_login.php?id=<?php echo $val["uid"];?>" title="<?php __("Connect as"); ?>">[&nbsp;<?php __("C"); ?>&nbsp;]</a> <td align="center">
<a href="adm_edit.php?uid=<?php echo $val["uid"] ?>" title="<?php __("Edit"); ?>">[&nbsp;<?php __("E"); ?>&nbsp;]</a> <a href="adm_login.php?id=<?php echo $val["uid"]; ?>" title="<?php __("Connect as"); ?>">[&nbsp;<?php __("C"); ?>&nbsp;]</a>
<?php if($admin->checkcreator($val['uid'])) { ?> <a href="adm_edit.php?uid=<?php echo $val["uid"] ?>" title="<?php __("Edit"); ?>">[&nbsp;<?php __("E"); ?>&nbsp;]</a>
<a href="adm_quotaedit.php?uid=<?php echo $val["uid"] ?>" title="<?php __("Quotas"); ?>">[&nbsp;<?php __("Q"); ?>&nbsp;]</a><?php <?php if ($admin->checkcreator($val['uid'])) { ?>
} // $admin->checkcreator <a href="adm_quotaedit.php?uid=<?php echo $val["uid"] ?>" title="<?php __("Quotas"); ?>">[&nbsp;<?php __("Q"); ?>&nbsp;]</a><?php
$creator_name = ( ($val['creator'] == '0')?_("himself"):$list_creators[$val['creator']]['login']) ?> } // $admin->checkcreator
</td> $creator_name = ( ($val['creator'] == '0') ? _("himself") : $list_creators[$val['creator']]['login'])
<td style="padding-right: 2px; border-right: 1px solid black; <?php if ($val["su"]) echo "color: red"; ?>"><b><label title="<?php printf(_("Creator: %s"), $creator_name);?>" for="id_c_<?php echo $val["uid"]; ?>"><?php echo $val["login"] ?></label></b></td> ?>
<?php </td>
if ( ($count_r % 3) == 2 ) { echo '</tr>'; } <td style="padding-right: 2px; border-right: 1px solid black; <?php if ($val["su"]) echo "color: red"; ?>"><b><label title="<?php printf(_("Creator: %s"), $creator_name); ?>" for="id_c_<?php echo $val["uid"]; ?>"><?php echo $val["login"] ?></label></b></td>
++$count_r; <?php
} // foreach $r if (($count_r % 3) == 2) {
?> echo '</tr>';
</table> }
<p><input type="submit" class="inb" name="submit" value="<?php __("Delete checked accounts"); ?>" /></p> ++$count_r;
</form> } // foreach $accountList
<?php ?>
</table>
<p><input type="submit" class="inb" name="submit" value="<?php __("Delete checked accounts"); ?>" /></p>
</form>
<?php
} // SHORT MODE } // SHORT MODE
include_once("foot.php"); include_once("foot.php");
?> ?>