AlternC/bureau/admin/adm_dodefquotas.php

101 lines
3.5 KiB
PHP
Raw Normal View History

<?php
/*
$Id: adm_dodefquotas.php,v 1.3 2006/01/24 05:03:30 joe Exp $
----------------------------------------------------------------------
AlternC - Web Hosting System
Copyright (C) 2006 Le r<EFBFBD>seau 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: Manage the default quotas
----------------------------------------------------------------------
*/
require_once("../class/config.php");
if (!$admin->enabled) {
__("This page is restricted to authorized staff");
exit();
}
2012-08-22 09:46:56 +00:00
$fields = array (
"action" => array ("post", "string", ""),
"type" => array ("post", "string", ""),
"del_confirm" => array ("post", "string", ""),
);
getFields($fields);
2012-08-22 09:46:56 +00:00
if($action == "add") {
if($quota->addtype($type)) {
2012-08-22 09:46:56 +00:00
$error=_("Account type"). " \"".htmlentities($type)."\" "._("added");
} else {
2012-08-22 09:46:56 +00:00
$error=_("Account type"). " \"".htmlentities($type)."\" "._("could not be added");
}
include("adm_defquotas.php");
2012-08-22 09:46:56 +00:00
} else if($action == "delete") {
if($del_confirm == "y"){
if(!empty($type)) {
if($quota->deltype($type)) {
$error=_("Account type"). " \"".htmlentities($type)."\" "._("deleted");
} else {
2012-08-22 09:46:56 +00:00
$error=_("Account type"). " \"".htmlentities($type)."\" "._("could not be deleted");
}
}
include("adm_defquotas.php");
}else{
include("head.php");
?>
2012-08-22 09:46:56 +00:00
<h3><?php printf(_("Deleting quota %s"),$type); ?> : </h3>
<form action="adm_dodefquotas.php" method="post">
<input type="hidden" name="action" value="delete" />
2012-08-22 09:46:56 +00:00
<input type="hidden" name="type" value="<?php echo $type ?>" />
<input type="hidden" name="del_confirm" value="y" />
2013-10-18 09:59:03 +00:00
<p class="alert alert-warning"><?php __("WARNING: Confirm the deletion of the quota"); ?></p>
2012-08-22 09:55:34 +00:00
<p><?php echo $type; ?></p>
<blockquote>
<input type="submit" class="inb ok" name="confirm" value="<?php __("Yes, delete this default quota"); ?>" />&nbsp;&nbsp;
<input type="button" class="inb cancel" name="cancel" value="<?php __("No, don't delete this default quota"); ?>" onclick="document.location='adm_defquotas.php';" />
</blockquote>
</form>
<?php
include("foot.php");
}
2012-08-22 09:46:56 +00:00
} else if($action == "modify") {
reset($_POST);
$c=array();
foreach($_POST as $key => $val) {
if($key == "action")
continue;
list($type, $q) = explode(":", $key, 2);
$c[$type][$q] = abs(floatval($val));
}
if($quota->setdefaults($c)) {
$error=_("Default quotas successfully changed");
} else {
$error=_("Default quotas could not be set.");
}
include("adm_panel.php");
}
?>