Alternc  3.2
Alternc logiel libre pour l'hébergement
 All Data Structures Namespaces Files Functions Variables Pages
adm_dodefquotas.php
Go to the documentation of this file.
1 <?php
2 /*
3  $Id: adm_dodefquotas.php,v 1.3 2006/01/24 05:03:30 joe Exp $
4  ----------------------------------------------------------------------
5  AlternC - Web Hosting System
6  Copyright (C) 2006 Le réseau Koumbit Inc.
7  http://koumbit.org/
8  Copyright (C) 2002 by the AlternC Development Team.
9  http://alternc.org/
10  ----------------------------------------------------------------------
11  Based on:
12  Valentin Lacambre's web hosting softwares: http://altern.org/
13  ----------------------------------------------------------------------
14  LICENSE
15 
16  This program is free software; you can redistribute it and/or
17  modify it under the terms of the GNU General Public License (GPL)
18  as published by the Free Software Foundation; either version 2
19  of the License, or (at your option) any later version.
20 
21  This program is distributed in the hope that it will be useful,
22  but WITHOUT ANY WARRANTY; without even the implied warranty of
23  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24  GNU General Public License for more details.
25 
26  To read the license please visit http://www.gnu.org/copyleft/gpl.html
27  ----------------------------------------------------------------------
28  Original Author of file: Benjamin Sonntag
29  Purpose of file: Manage the default quotas
30  ----------------------------------------------------------------------
31 */
32 require_once("../class/config.php");
33 
34 if (!$admin->enabled) {
35  __("This page is restricted to authorized staff");
36  exit();
37 }
38 $fields = array (
39  "action" => array ("post", "string", ""),
40  "type" => array ("post", "string", ""),
41  "del_confirm" => array ("post", "string", ""),
42 );
44 
45 if($action == "add") {
46 
47  if($quota->addtype($type)) {
48  $error=_("Account type"). " \"".htmlentities($type)."\" "._("added");
49  } else {
50  $error=_("Account type"). " \"".htmlentities($type)."\" "._("could not be added");
51  }
52  include("adm_defquotas.php");
53 } else if($action == "delete") {
54  if($del_confirm == "y"){
55  if(!empty($type)) {
56  if($quota->deltype($type)) {
57  $error=_("Account type"). " \"".htmlentities($type)."\" "._("deleted");
58  } else {
59  $error=_("Account type"). " \"".htmlentities($type)."\" "._("could not be deleted");
60  }
61  }
62  include("adm_defquotas.php");
63  }else{
64  include("head.php");
65  ?>
66  <h3><?php printf(_("Deleting quota %s"),$type); ?> : </h3>
67 
68  <form action="adm_dodefquotas.php" method="post">
69  <input type="hidden" name="action" value="delete" />
70  <input type="hidden" name="type" value="<?php echo $type ?>" />
71  <input type="hidden" name="del_confirm" value="y" />
72  <p class="alert alert-warning"><?php __("WARNING: Confirm the deletion of the quota"); ?></p>
73  <p><?php echo $type; ?></p>
74  <blockquote>
75  <input type="submit" class="inb ok" name="confirm" value="<?php __("Yes, delete this default quota"); ?>" />&nbsp;&nbsp;
76  <input type="button" class="inb cancel" name="cancel" value="<?php __("No, don't delete this default quota"); ?>" onclick="document.location='adm_defquotas.php';" />
77  </blockquote>
78  </form>
79  <?php
80  include("foot.php");
81  }
82 } else if($action == "modify") {
83  reset($_POST);
84  $c=array();
85  foreach($_POST as $key => $val) {
86  if($key == "action")
87  continue;
88 
89  list($type, $q) = explode(":", $key, 2);
90  $c[$type][$q] = abs(floatval($val));
91  }
92 
93  if($quota->setdefaults($c)) {
94  $error=_("Default quotas successfully changed");
95  } else {
96  $error=_("Default quotas could not be set.");
97  }
98  include("adm_panel.php");
99 }
100 ?>