source: trunk/bureau/admin/adm_dodefquotas.php @ 992

Revision 992, 2.4 KB checked in by joe, 7 years ago (diff)

Ajout de vérifications additionelles/meilleure atomicité.

Line 
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*/
32require_once("../class/config.php");
33
34if (!$admin->enabled) {
35        __("This page is restricted to authorized staff");
36        exit();
37}
38
39if($_POST["action"] == "add") {
40  $type = $_POST['type'];
41
42  if($quota->addtype($type)) {
43    $error=_("Account type"). " \"$type\" "._("added");
44  } else {
45    $error=_("Account type"). " \"$type\" "._("could not be added");
46  }
47  include("adm_defquotas.php");
48} else if($_POST["action"] == "delete") {
49  if($_POST['type']) {
50    if($quota->deltype($_POST['type'])) {
51      $error=_("Account type"). " \"$type\" "._("deleted");
52    } else {
53      $error=_("Account type"). " \"$type\" "._("could not be deleted");
54    }
55  }
56  include("adm_defquotas.php");
57} else if($_POST["action"] == "modify") {
58  reset($_POST);
59  $c=array();
60  foreach($_POST as $key => $val) {
61    if($key == "action")
62      continue;
63
64    list($type, $q) = explode(":", $key, 2);
65    $c[$type][$q] = abs(intval($val));
66  }
67
68  if($quota->setdefaults($c)) {
69    $error=_("Default quotas successfully changed");
70  } else {
71    $error=_("Default quotas could not be set.");
72  }
73  include("adm_panel.php");
74}
75?>
Note: See TracBrowser for help on using the repository browser.