Alternc  latest
Alternc logiel libre pour l'hébergement
adm_defquotas.php
Go to the documentation of this file.
1 <?php
2 /*
3  ----------------------------------------------------------------------
4  LICENSE
5 
6  This program is free software; you can redistribute it and/or
7  modify it under the terms of the GNU General Public License (GPL)
8  as published by the Free Software Foundation; either version 2
9  of the License, or (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  To read the license please visit http://www.gnu.org/copyleft/gpl.html
17  ----------------------------------------------------------------------
18 */
19 
20 /**
21  * Administrator page to manage default quotas for users
22  *
23  * @copyright AlternC-Team 2000-2017 https://alternc.com/
24  */
25 
26 require_once("../class/config.php");
27 
28 if (!$admin->enabled) {
29  $msg->raise("ERROR", "admin", _("This page is restricted to authorized staff"));
30  echo $msg->msg_html_all();
31  exit();
32 }
33 $fields = array (
34  "synchronise" => array ("get", "integer", "0"),
35 );
37 
38 include_once ("head.php");
39 
40 ?>
41 <h3><?php __("Change the default quotas"); ?></h3>
42 <hr id="topbar"/>
43 <br />
44 <?php
45 if ($synchronise==true) {
46  $quota->synchronise_user_profile();
47  echo "<p class=\"alert alert-info\">";__("User's quotas synchronised");echo "</p>";
48 }
49 
50 $quota->create_missing_quota_profile();
51 
52 echo $msg->msg_html_all();
53 ?>
54 <form method="post" action="adm_dodefquotas.php">
55  <?php csrf_get(); ?>
56 <p>
57 <input type="hidden" name="action" value="add" />
58 <input type="text" name="type" class="int" />
59 <input type="submit" class="inb" value="<?php __("Add account type"); ?>" />
60 </p>
61 </form>
62 
63 <?php
64 ?>
65 <form method="post" action="adm_dodefquotas.php">
66  <?php csrf_get(); ?>
67 <table border="0" cellpadding="4" cellspacing="0">
68 <tr class="lst">
69 <td>
70 <input type="hidden" name="action" value="delete" />
71 <select name="type" id="type" class="inl">
72 <?php
73 foreach($quota->listtype() as $type) {
74  if ($type=="default") continue;
75  echo "<option value=\"$type\">$type</option>\n";
76 }
77 ?></select>
78 </td><td><input type="submit" class="inb" value="<?php __("Delete account type"); ?>" /></td>
79 </tr>
80 </table>
81 </form>
82 <p>
83 <?php __("Here is the list of the quotas on the server for the new accounts. If you want to change them, enter new values"); ?>
84 </p>
85 <span class="inb"><a href="adm_defquotas.php?synchronise=1"><?php __("Synchronise user's quota (only to upper value)"); ?></a></span>
86 
87 <form method="post" action="adm_dodefquotas.php">
88  <?php csrf_get(); ?>
89 <div>
90 <input type="hidden" name="action" value="modify" />
91 <?php
92 $qarray=$quota->qlist();
93 $qlist=$quota->getdefaults();
94 reset($qlist);
95 foreach($qlist as $type => $q) {
96 ?>
97 <div class="info-toggle">
98 <h4 class="toggle-next"><?php echo _("Accounts of type"). " \"$type\"" ?>â–¼</h4>
99 <div class="info-hide" id="div-quot-<?php echo md5($type);?>">
100 <table border="0" cellpadding="4" cellspacing="0" class='tlist'>
101 <tr><th><?php __("Quotas") ?></th><th><?php __("Default Value"); ?></th></tr>
102 <?php
103 foreach($q as $name => $value) {
104  if (!isset($qarray[$name])) continue;
105  $key = $type . ":" . $name;
106 ?>
107 
108 <tr class="lst">
109 <td><label for="<?php echo $key; ?>"><?php echo $qarray[$name] ; ?></label></td>
110 <td><input type="text" class="int" size="16" maxlength="16" name="<?php ehe($key); ?>" id="<?php ehe($key); ?>" value="<?php ehe($value); ?>" /></td></tr>
111 
112 <?php
113  } //foreach
114 ?>
115 </table>
116 <br/>
117 </div>
118 <script type="text/javascript">
119  $("#div-quot-<?php echo md5($type);?>").toggle();
120 </script>
121 </div>
122 <?php
123 }
124 ?>
125 <br/>
126 <input type="submit" class="inb ok" value="<?php __("Edit the default quotas"); ?>" />
127 </div>
128 </form>
129 <script type="text/javascript">
130 $(function(){
131  $(".toggle-next").on("click",function(){
132  var next = $(this).next();
133  next.toggle();
134  })
135 });
136 </script>
137 <?php include_once("foot.php"); ?>
if(! $admin->enabled) $fields
Administrator page to manage default quotas for users.
$qarray
$qlist
exit
Definition: adm_doadd.php:70
$msg
Definition: bootstrap.php:75
$value
__($str)
Definition: functions.php:404
getFields($fields, $requestOnly=false)
Get the Fields of the posted form from $_REQUEST or POST or GET and check their type.
Definition: functions.php:688
csrf_get($return=false)
Give a new CSRF uniq token for a form the session must be up since the CSRF is linked to the session ...
Definition: functions.php:1159
$q
Definition: menu_aws.php:32
if(empty($_POST['key'])||empty($_POST['val'])) $key
Definition: tempovars.php:14