tbrehm
2009-10-28 4a5426596f30ca2c71357377fc7705766b2599b4
Implemented: FS#851 - Add client wide website quota (group quota)
12 files modified
77 ■■■■■ changed files
install/sql/ispconfig3.sql 2 ●●●●● patch | view | raw | blame | history
interface/web/client/form/client.tform.php 14 ●●●●● patch | view | raw | blame | history
interface/web/client/form/client_template.tform.php 14 ●●●●● patch | view | raw | blame | history
interface/web/client/form/reseller.tform.php 14 ●●●●● patch | view | raw | blame | history
interface/web/client/lib/lang/en_client.lng 1 ●●●● patch | view | raw | blame | history
interface/web/client/lib/lang/en_client_template.lng 1 ●●●● patch | view | raw | blame | history
interface/web/client/lib/lang/en_reseller.lng 1 ●●●● patch | view | raw | blame | history
interface/web/client/templates/client_edit_limits.htm 4 ●●●● patch | view | raw | blame | history
interface/web/client/templates/client_template_edit_limits.htm 4 ●●●● patch | view | raw | blame | history
interface/web/client/templates/reseller_edit_limits.htm 4 ●●●● patch | view | raw | blame | history
interface/web/sites/lib/lang/en_web_domain.lng 1 ●●●● patch | view | raw | blame | history
interface/web/sites/web_domain_edit.php 17 ●●●●● patch | view | raw | blame | history
install/sql/ispconfig3.sql
@@ -82,6 +82,7 @@
  `default_webserver` int(11) unsigned NOT NULL default '1',
  `limit_web_ip` text,
  `limit_web_domain` int(11) NOT NULL default '-1',
  `limit_web_quota` int(11) NOT NULL default '-1',
  `web_php_options` varchar(255) NOT NULL default 'no,fast-cgi,cgi,mod,suphp',
  `limit_web_subdomain` int(11) NOT NULL default '-1',
  `limit_web_aliasdomain` int(11) NOT NULL default '-1',
@@ -138,6 +139,7 @@
  `limit_spamfilter_policy` int(11) NOT NULL default '0',
  `limit_web_ip` text,
  `limit_web_domain` int(11) NOT NULL default '-1',
  `limit_web_quota` int(11) NOT NULL default '-1',
  `limit_web_subdomain` int(11) NOT NULL default '-1',
  `limit_web_aliasdomain` int(11) NOT NULL default '-1',
  `limit_ftp_user` int(11) NOT NULL default '-1',
interface/web/client/form/client.tform.php
@@ -529,6 +529,20 @@
            'rows'        => '',
            'cols'        => ''
        ),
        'limit_web_quota' => array (
            'datatype'    => 'INTEGER',
            'formtype'    => 'TEXT',
            'validators'    => array (     0 => array (    'type'    => 'ISINT',
                                                        'errmsg'=> 'limit_web_quota_error_notint'),
                                    ),
            'default'    => '-1',
            'value'        => '',
            'separator'    => '',
            'width'        => '10',
            'maxlength'    => '10',
            'rows'        => '',
            'cols'        => ''
        ),
        'web_php_options' => array (
            'datatype'    => 'VARCHAR',
            'formtype'    => 'CHECKBOXARRAY',
interface/web/client/form/client_template.tform.php
@@ -297,6 +297,20 @@
            'rows'        => '',
            'cols'        => ''
        ),
        'limit_web_quota' => array (
            'datatype'    => 'INTEGER',
            'formtype'    => 'TEXT',
            'validators'    => array (     0 => array (    'type'    => 'ISINT',
                                                        'errmsg'=> 'limit_web_quota_error_notint'),
                                    ),
            'default'    => '-1',
            'value'        => '',
            'separator'    => '',
            'width'        => '10',
            'maxlength'    => '10',
            'rows'        => '',
            'cols'        => ''
        ),
        'limit_web_aliasdomain' => array (
            'datatype'    => 'INTEGER',
            'formtype'    => 'TEXT',
interface/web/client/form/reseller.tform.php
@@ -515,6 +515,20 @@
            'rows'        => '',
            'cols'        => ''
        ),
        'limit_web_quota' => array (
            'datatype'    => 'INTEGER',
            'formtype'    => 'TEXT',
            'validators'    => array (     0 => array (    'type'    => 'ISINT',
                                                        'errmsg'=> 'limit_web_quota_error_notint'),
                                    ),
            'default'    => '-1',
            'value'        => '',
            'separator'    => '',
            'width'        => '10',
            'maxlength'    => '10',
            'rows'        => '',
            'cols'        => ''
        ),
        'web_php_options' => array (
            'datatype'    => 'VARCHAR',
            'formtype'    => 'CHECKBOXARRAY',
interface/web/client/lib/lang/en_client.lng
@@ -91,4 +91,5 @@
$wb["ssh_chroot_txt"] = 'SSH-Chroot Options';
$wb["web_php_options_txt"] = 'PHP Options';
$wb["limit_client_error"] = 'The max. number of clients is reached.';
$wb["limit_web_quota_txt"] = 'Web Quota';
?>
interface/web/client/lib/lang/en_client_template.lng
@@ -54,4 +54,5 @@
$wb["limit_cron_error_notint"] = 'The cron limit must be a number.';
$wb["limit_cron_error_frequency"] = 'The cron frequency limit must be a number.';
$wb["error_template_name_empty"] = 'Please enter a Template name';
$wb["limit_web_quota_txt"] = 'Web Quota';
?>
interface/web/client/lib/lang/en_reseller.lng
@@ -90,4 +90,5 @@
$wb["web_php_options_txt"] = 'PHP Options';
$wb["limit_client_error"] = 'The max. number of clients is reached.';
$wb["limit_client_error_positive"] = 'The number of clients must be > 0';
$wb["limit_web_quota_txt"] = 'Web Quota';
?>
interface/web/client/templates/client_edit_limits.htm
@@ -103,6 +103,10 @@
          <label for="limit_web_domain">{tmpl_var name='limit_web_domain_txt'}</label>
        <input name="limit_web_domain" id="limit_web_domain" value="{tmpl_var name='limit_web_domain'}" size="10" maxlength="10" type="text" class="textInput formLengthLimit" />
            </div>
      <div class="ctrlHolder">
          <label for="limit_web_quota">{tmpl_var name='limit_web_quota_txt'}</label>
        <input name="limit_web_quota" id="limit_web_quota" value="{tmpl_var name='limit_web_quota'}" size="10" maxlength="10" type="text" class="textInput formLengthLimit" />&nbsp;MB
      </div>
      <div class="ctrlHolder">
                <p class="label">{tmpl_var name='web_php_options_txt'}</p>
                    <div class="multiField">
interface/web/client/templates/client_template_edit_limits.htm
@@ -61,6 +61,10 @@
          <label for="limit_web_domain">{tmpl_var name='limit_web_domain_txt'}</label>
        <input name="limit_web_domain" id="limit_web_domain" value="{tmpl_var name='limit_web_domain'}" size="10" maxlength="10" type="text" class="textInput formLengthLimit" />
            </div>
      <div class="ctrlHolder">
          <label for="limit_web_quota">{tmpl_var name='limit_web_quota_txt'}</label>
        <input name="limit_web_quota" id="limit_web_quota" value="{tmpl_var name='limit_web_quota'}" size="10" maxlength="10" type="text" class="textInput formLengthLimit" />&nbsp;MB
      </div>
      <div class="ctrlHolder">
          <label for="limit_web_aliasdomain">{tmpl_var name='limit_web_aliasdomain_txt'}</label>
        <input name="limit_web_aliasdomain" id="limit_web_aliasdomain" value="{tmpl_var name='limit_web_aliasdomain'}" size="10" maxlength="10" type="text" class="textInput formLengthLimit" />
interface/web/client/templates/reseller_edit_limits.htm
@@ -88,6 +88,10 @@
          <label for="limit_web_domain">{tmpl_var name='limit_web_domain_txt'}</label>
        <input name="limit_web_domain" id="limit_web_domain" value="{tmpl_var name='limit_web_domain'}" size="10" maxlength="10" type="text" class="textInput formLengthLimit" />
            </div>
      <div class="ctrlHolder">
          <label for="limit_web_quota">{tmpl_var name='limit_web_quota_txt'}</label>
        <input name="limit_web_quota" id="limit_web_quota" value="{tmpl_var name='limit_web_quota'}" size="10" maxlength="10" type="text" class="textInput formLengthLimit" />&nbsp;MB
      </div>
      <div class="ctrlHolder">
                <p class="label">{tmpl_var name='web_php_options_txt'}</p>
                    <div class="multiField">
interface/web/sites/lib/lang/en_web_domain.lng
@@ -48,4 +48,5 @@
$wb["client_group_id_txt"] = 'Client';
$wb["stats_password_txt"] = 'Webstatistics password';
$wb["allow_override_txt"] = 'Allow Override';
$wb["limit_web_quota_free_txt"] = 'Max. available Harddisk Quota';
?>
interface/web/sites/web_domain_edit.php
@@ -214,7 +214,22 @@
        if($_SESSION["s"]["user"]["typ"] != 'admin') {
            // Get the limits of the client
            $client_group_id = $_SESSION["s"]["user"]["default_group"];
            $client = $app->db->queryOneRecord("SELECT limit_web_domain, default_webserver, parent_client_id FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
            $client = $app->db->queryOneRecord("SELECT limit_web_domain, default_webserver, parent_client_id, limit_web_quota FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
            //* Check the website quota
            if(isset($_POST["hd_quota"]) && $client["limit_web_quota"] >= 0) {
                $tmp = $app->db->queryOneRecord("SELECT sum(hd_quota) as webquota FROM web_domain WHERE domain_id != ".intval($this->id)." AND sys_groupid = $client_group_id");
                $webquota = $tmp["webquota"] / 1024 / 1024;
                $new_web_quota = intval($this->dataRecord["hd_quota"]);
                if(($webquota + $new_web_quota > $client["limit_web_quota"]) || ($new_web_quota == -1 && $client["limit_web_quota"] != -1)) {
                    $max_free_quota = floor($client["limit_web_quota"] - $webquota);
                    $app->tform->errorMessage .= $app->tform->lng("limit_web_quota_free_txt").": ".$max_free_quota."<br>";
                    // Set the quota field to the max free space
                    $this->dataRecord["hd_quota"] = $max_free_quota;
                }
                unset($tmp);
                unset($tmp_quota);
            }
            
            // When the record is updated
            if($this->id > 0) {