Skip to content

Commit 8d0c6b7

Browse files
committed
Implemented: FS#555 - Implemet traffic quota.
1 parent 2e57537 commit 8d0c6b7

File tree

17 files changed

+246
-9
lines changed

17 files changed

+246
-9
lines changed

install/sql/ispconfig3.sql

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ CREATE TABLE `client` (
9797
`limit_cron` int(11) NOT NULL default '0',
9898
`limit_cron_type` enum('url','chrooted','full') NOT NULL default 'url',
9999
`limit_cron_frequency` int(11) NOT NULL default '5',
100+
`limit_traffic_quota` int(11) NOT NULL default '-1',
100101
`limit_client` int(11) NOT NULL default '0',
101102
`parent_client_id` int(11) unsigned NOT NULL default '0',
102103
`username` varchar(64) default NULL,
@@ -150,6 +151,7 @@ CREATE TABLE `client_template` (
150151
`limit_cron` int(11) NOT NULL default '0',
151152
`limit_cron_type` enum('url','chrooted','full') NOT NULL default 'url',
152153
`limit_cron_frequency` int(11) NOT NULL default '5',
154+
`limit_traffic_quota` int(11) NOT NULL default '-1',
153155
`limit_client` int(11) NOT NULL default '0',
154156
PRIMARY KEY (`template_id`)
155157
) ENGINE=MyISAM AUTO_INCREMENT=1;
@@ -1035,7 +1037,7 @@ CREATE TABLE `web_domain` (
10351037
`system_user` varchar(255) default NULL,
10361038
`system_group` varchar(255) default NULL,
10371039
`hd_quota` bigint(20) NOT NULL default '0',
1038-
`traffic_quota` bigint(20) NOT NULL default '0',
1040+
`traffic_quota` bigint(20) NOT NULL default '-1',
10391041
`cgi` enum('n','y') NOT NULL default 'y',
10401042
`ssi` enum('n','y') NOT NULL default 'y',
10411043
`suexec` enum('n','y') NOT NULL default 'y',
@@ -1061,6 +1063,7 @@ CREATE TABLE `web_domain` (
10611063
`apache_directives` text,
10621064
`php_open_basedir` text,
10631065
`active` enum('n','y') NOT NULL default 'y',
1066+
`traffic_quota_lock` enum('n','y') NOT NULL default 'n',
10641067
PRIMARY KEY (`domain_id`)
10651068
) ENGINE=MyISAM AUTO_INCREMENT=1;
10661069

interface/lib/classes/tform.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1199,7 +1199,7 @@ function isReadonlyTab($tab, $primary_id) {
11991199

12001200
// translation function for forms, tries the form wordbook first and if this fails, it tries the global wordbook
12011201
function lng($msg) {
1202-
global $app;
1202+
global $app,$conf;
12031203

12041204
if(isset($this->wordbook[$msg])) {
12051205
return $this->wordbook[$msg];

interface/web/client/form/client.tform.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -727,6 +727,20 @@
727727
'rows' => '',
728728
'cols' => ''
729729
),
730+
'limit_traffic_quota' => array (
731+
'datatype' => 'INTEGER',
732+
'formtype' => 'TEXT',
733+
'validators' => array ( 0 => array ( 'type' => 'ISINT',
734+
'errmsg'=> 'limit_traffic_quota_error_notint'),
735+
),
736+
'default' => '-1',
737+
'value' => '',
738+
'separator' => '',
739+
'width' => '10',
740+
'maxlength' => '10',
741+
'rows' => '',
742+
'cols' => ''
743+
),
730744
##################################
731745
# END Datatable fields
732746
##################################

interface/web/client/form/client_template.tform.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,20 @@
459459
'rows' => '',
460460
'cols' => ''
461461
),
462+
'limit_traffic_quota' => array (
463+
'datatype' => 'INTEGER',
464+
'formtype' => 'TEXT',
465+
'validators' => array ( 0 => array ( 'type' => 'ISINT',
466+
'errmsg'=> 'limit_traffic_quota_error_notint'),
467+
),
468+
'default' => '-1',
469+
'value' => '',
470+
'separator' => '',
471+
'width' => '10',
472+
'maxlength' => '10',
473+
'rows' => '',
474+
'cols' => ''
475+
),
462476
##################################
463477
# END Datatable fields
464478
##################################

interface/web/client/form/reseller.tform.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -714,6 +714,20 @@
714714
'rows' => '',
715715
'cols' => ''
716716
),
717+
'limit_traffic_quota' => array (
718+
'datatype' => 'INTEGER',
719+
'formtype' => 'TEXT',
720+
'validators' => array ( 0 => array ( 'type' => 'ISINT',
721+
'errmsg'=> 'limit_traffic_quota_error_notint'),
722+
),
723+
'default' => '-1',
724+
'value' => '',
725+
'separator' => '',
726+
'width' => '10',
727+
'maxlength' => '10',
728+
'rows' => '',
729+
'cols' => ''
730+
),
717731
##################################
718732
# END Datatable fields
719733
##################################

interface/web/client/lib/lang/en_client.lng

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,4 +92,6 @@ $wb["ssh_chroot_txt"] = 'SSH-Chroot Options';
9292
$wb["web_php_options_txt"] = 'PHP Options';
9393
$wb["limit_client_error"] = 'The max. number of clients is reached.';
9494
$wb["limit_web_quota_txt"] = 'Web Quota';
95+
$wb["limit_traffic_quota_txt"] = 'Traffic Quota';
96+
$wb["limit_trafficquota_error_notint"] = 'Traffic Quota must be a number.';
9597
?>

interface/web/client/lib/lang/en_client_template.lng

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,6 @@ $wb["limit_cron_error_notint"] = 'The cron limit must be a number.';
5555
$wb["limit_cron_error_frequency"] = 'The cron frequency limit must be a number.';
5656
$wb["error_template_name_empty"] = 'Please enter a Template name';
5757
$wb["limit_web_quota_txt"] = 'Web Quota';
58+
$wb["limit_traffic_quota_txt"] = 'Traffic Quota';
59+
$wb["limit_trafficquota_error_notint"] = 'Traffic Quota must be a number.';
5860
?>

interface/web/client/lib/lang/en_reseller.lng

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,6 @@ $wb["web_php_options_txt"] = 'PHP Options';
9191
$wb["limit_client_error"] = 'The max. number of clients is reached.';
9292
$wb["limit_client_error_positive"] = 'The number of clients must be > 0';
9393
$wb["limit_web_quota_txt"] = 'Web Quota';
94+
$wb["limit_traffic_quota_txt"] = 'Traffic Quota';
95+
$wb["limit_trafficquota_error_notint"] = 'Traffic Quota must be a number.';
9496
?>

interface/web/client/templates/client_edit_limits.htm

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,10 @@ <h2><tmpl_var name="list_head_txt"></h2>
173173
<label for="limit_cron_frequency">{tmpl_var name='limit_cron_frequency_txt'}</label>
174174
<input name="limit_cron_frequency" id="limit_cron_frequency" value="{tmpl_var name='limit_cron_frequency'}" size="10" maxlength="10" type="text" class="textInput formLengthLimit" />
175175
</div>
176+
<div class="ctrlHolder">
177+
<label for="limit_traffic_quota">{tmpl_var name='limit_traffic_quota_txt'}</label>
178+
<input name="limit_traffic_quota" id="limit_traffic_quota" value="{tmpl_var name='limit_traffic_quota'}" size="10" maxlength="10" type="text" class="textInput formLengthLimit" />&nbsp;MB
179+
</div>
176180
</fieldset>
177181

178182
<input type="hidden" name="id" value="{tmpl_var name='id'}">

interface/web/client/templates/client_template_edit_limits.htm

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,10 @@ <h2><tmpl_var name="list_head_txt"></h2>
107107
<label for="limit_cron_frequency">{tmpl_var name='limit_cron_frequency_txt'}</label>
108108
<input name="limit_cron_frequency" id="limit_cron_frequency" value="{tmpl_var name='limit_cron_frequency'}" size="10" maxlength="10" type="text" class="textInput formLengthLimit" />
109109
</div>
110+
<div class="ctrlHolder">
111+
<label for="limit_traffic_quota">{tmpl_var name='limit_traffic_quota_txt'}</label>
112+
<input name="limit_traffic_quota" id="limit_traffic_quota" value="{tmpl_var name='limit_traffic_quota'}" size="10" maxlength="10" type="text" class="textInput formLengthLimit" />&nbsp;MB
113+
</div>
110114
</fieldset>
111115

112116
<input type="hidden" name="id" value="{tmpl_var name='id'}">

0 commit comments

Comments
 (0)