Skip to content

Commit cab3bca

Browse files
author
A. Täffner
committed
Merge branch 'master' into dns-dnssec
Conflicts: install/sql/incremental/upd_dev_collection.sql
2 parents b19173e + 337473b commit cab3bca

23 files changed

+597
-24
lines changed

install/sql/incremental/upd_dev_collection.sql

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ ALTER TABLE `web_domain` ADD `ssl_letsencrypt` enum('n','y') NOT NULL DEFAULT 'n
193193
ALTER TABLE `openvz_template` CHANGE `vmguarpages` `vmguarpages` varchar(255) DEFAULT '65536:unlimited';
194194
ALTER TABLE `openvz_template` CHANGE `privvmpages` `privvmpages` varchar(255) DEFAULT '131072:139264';
195195

196+
<<<<<<< HEAD
196197

197198
--- DNSSEC-Implementation by dark alex
198199
--- TODO: Review and resolve conflicts if more has been done in that column
@@ -202,3 +203,15 @@ ALTER TABLE `dns_soa`
202203
ADD COLUMN `dnssec_initialized` ENUM('Y','N') NOT NULL DEFAULT 'N',
203204
ADD COLUMN `dnssec_info` TEXT NULL;
204205

206+
=======
207+
CREATE TABLE `ftp_traffic` (
208+
`hostname` varchar(255) NOT NULL,
209+
`traffic_date` date NOT NULL,
210+
`in_bytes` bigint(32) unsigned NOT NULL,
211+
`out_bytes` bigint(32) unsigned NOT NULL,
212+
PRIMARY KEY (`hostname`,`traffic_date`)
213+
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
214+
215+
ALTER TABLE `mail_forwarding` ADD COLUMN `allow_send_as` ENUM('n','y') NOT NULL DEFAULT 'n' AFTER `active`;
216+
UPDATE `mail_forwarding` SET `allow_send_as` = 'y' WHERE `type` = 'alias';
217+
>>>>>>> master

install/sql/ispconfig3.sql

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,20 @@ CREATE TABLE `ftp_user` (
640640

641641
-- --------------------------------------------------------
642642

643+
--
644+
-- Table structure for table `ftp_traffic`
645+
--
646+
647+
CREATE TABLE `ftp_traffic` (
648+
`hostname` varchar(255) NOT NULL,
649+
`traffic_date` date NOT NULL,
650+
`in_bytes` bigint(32) unsigned NOT NULL,
651+
`out_bytes` bigint(32) unsigned NOT NULL,
652+
PRIMARY KEY (`hostname`,`traffic_date`)
653+
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
654+
655+
-- --------------------------------------------------------
656+
643657
--
644658
-- Table structure for table `help_faq`
645659
--
@@ -802,6 +816,7 @@ CREATE TABLE `mail_forwarding` (
802816
`destination` text,
803817
`type` enum('alias','aliasdomain','forward','catchall') NOT NULL default 'alias',
804818
`active` enum('n','y') NOT NULL DEFAULT 'n',
819+
`allow_send_as` ENUM('n','y') NOT NULL DEFAULT 'n',
805820
`greylisting` enum('n','y' ) NOT NULL DEFAULT 'n',
806821
PRIMARY KEY (`forwarding_id`),
807822
KEY `server_id` (`server_id`,`source`),
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
user = {mysql_server_ispconfig_user}
22
password = {mysql_server_ispconfig_password}
33
dbname = {mysql_server_database}
4-
query = SELECT destination FROM mail_forwarding WHERE source = '%s' AND active = 'y' AND type = 'alias' AND server_id = {server_id} UNION SELECT email FROM mail_user WHERE email = '%s' AND disablesmtp = 'n' AND server_id = {server_id};
4+
query = SELECT destination FROM mail_forwarding WHERE source = '%s' AND active = 'y' AND allow_send_as = 'y' AND server_id = {server_id} UNION SELECT email FROM mail_user WHERE email = '%s' AND disablesmtp = 'n' AND server_id = {server_id};
55
hosts = {mysql_server_ip}

interface/lib/classes/quota_lib.inc.php

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,67 @@ public function get_trafficquota_data($clientid = null, $lastdays = 0) {
156156

157157
return $traffic_data;
158158
}
159+
160+
public function get_ftptrafficquota_data($clientid = null, $lastdays = 0) {
161+
global $app;
162+
163+
$traffic_data = array();
164+
165+
// select vhosts (belonging to client)
166+
if($clientid != null){
167+
$sql_where = " AND sys_groupid = (SELECT default_group FROM sys_user WHERE client_id=?)";
168+
}
169+
$sites = $app->db->queryAllRecords("SELECT * FROM web_domain WHERE active = 'y' AND (type = 'vhost' OR type = 'vhostsubdomain' OR type = 'vhostalias')".$sql_where, $clientid);
170+
171+
$hostnames = array();
172+
$traffic_data = array();
173+
174+
foreach ($sites as $site) {
175+
$hostnames[] = $site['domain'];
176+
$traffic_data[$site['domain']]['domain_id'] = $site['domain_id'];
177+
}
178+
179+
// fetch all traffic-data of selected vhosts
180+
if (!empty($hostnames)) {
181+
$tmp_year = date('Y');
182+
$tmp_month = date('m');
183+
// This Month
184+
$tmp_recs = $app->db->queryAllRecords("SELECT hostname, SUM(in_bytes) AS ftp_in, SUM(out_bytes) AS ftp_out FROM ftp_traffic WHERE YEAR(traffic_date) = ? AND MONTH(traffic_date) = ? AND hostname IN ? GROUP BY hostname", $tmp_year, $tmp_month, $hostnames);
185+
foreach ($tmp_recs as $tmp_rec) {
186+
$traffic_data[$tmp_rec['hostname']]['this_month'] = $tmp_rec['t'];
187+
}
188+
// This Year
189+
$tmp_recs = $app->db->queryAllRecords("SELECT hostname, SUM(in_bytes) AS ftp_in, SUM(out_bytes) AS ftp_out FROM ftp_traffic WHERE YEAR(traffic_date) = ? AND hostname IN ? GROUP BY hostname", $tmp_year, $hostnames);
190+
foreach ($tmp_recs as $tmp_rec) {
191+
$traffic_data[$tmp_rec['hostname']]['this_year'] = $tmp_rec['t'];
192+
}
193+
194+
$tmp_year = date('Y', mktime(0, 0, 0, date("m")-1, date("d"), date("Y")));
195+
$tmp_month = date('m', mktime(0, 0, 0, date("m")-1, date("d"), date("Y")));
196+
// Last Month
197+
$tmp_recs = $app->db->queryAllRecords("SELECT hostname, SUM(in_bytes) AS ftp_in, SUM(out_bytes) AS ftp_out FROM ftp_traffic WHERE YEAR(traffic_date) = ? AND MONTH(traffic_date) = ? AND hostname IN ? GROUP BY hostname", $tmp_year, $tmp_month, $hostnames);
198+
foreach ($tmp_recs as $tmp_rec) {
199+
$traffic_data[$tmp_rec['hostname']]['last_month'] = $tmp_rec['t'];
200+
}
201+
202+
$tmp_year = date('Y', mktime(0, 0, 0, date("m"), date("d"), date("Y")-1));
203+
// Last Year
204+
$tmp_recs = $app->db->queryAllRecords("SELECT hostname, SUM(in_bytes) AS ftp_in, SUM(out_bytes) AS ftp_out FROM ftp_traffic WHERE YEAR(traffic_date) = ? AND hostname IN ? GROUP BY hostname", $tmp_year, $hostnames);
205+
foreach ($tmp_recs as $tmp_rec) {
206+
$traffic_data[$tmp_rec['hostname']]['last_year'] = $tmp_rec['t'];
207+
}
208+
209+
if (is_int($lastdays) && ($lastdays > 0)) {
210+
// Last xx Days
211+
$tmp_recs = $app->db->queryAllRecords("SELECT hostname, SUM(in_bytes) AS ftp_in, SUM(out_bytes) AS ftp_out FROM ftp_traffic WHERE (traffic_date >= DATE_SUB(NOW(), INTERVAL ? DAY)) AND hostname IN ? GROUP BY hostname", $lastdays, $hostnames);
212+
foreach ($tmp_recs as $tmp_rec) {
213+
$traffic_data[$tmp_rec['hostname']]['lastdays'] = $tmp_rec['t'];
214+
}
215+
}
216+
}
217+
218+
return $traffic_data;
219+
}
159220

160221
public function get_mailquota_data($clientid = null, $readable = true) {
161222
global $app;

interface/lib/classes/remote.d/sites.inc.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -980,6 +980,21 @@ public function trafficquota_get_by_user($session_id, $client_id, $lastdays = 0)
980980
return $app->quota_lib->get_trafficquota_data($client_id, $lastdays);
981981
}
982982

983+
public function ftptrafficquota_data($session_id, $client_id, $lastdays = 0)
984+
{
985+
global $app;
986+
$app->uses('quota_lib');
987+
988+
if(!$this->checkPerm($session_id, 'trafficquota_get_by_user')) {
989+
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
990+
return false;
991+
}
992+
if ($client_id != null)
993+
$client_id = $app->functions->intval($client_id);
994+
995+
return $app->quota_lib->get_ftptrafficquota_data($client_id, $lastdays);
996+
}
997+
983998
public function databasequota_get_by_user($session_id, $client_id)
984999
{
9851000
global $app;

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -329,9 +329,7 @@
329329
'type' => 'TOLOWER')
330330
),
331331
'validators' => array (
332-
0 => array ( 'type' => 'REGEX',
333-
'regex' => '/^(\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\.[a-z\-]{2,10}){0,1}$/i',
334-
'errmsg'=> 'email_error_isemail'),
332+
0 => array ( 'type' => 'ISEMAIL', 'errmsg'=> 'email_error_isemail'),
335333
1 => array ( 'type' => 'NOTEMPTY',
336334
'errmsg'=> 'email_error_empty'),
337335
),
@@ -502,9 +500,8 @@
502500
2 => array( 'event' => 'SAVE',
503501
'type' => 'TOLOWER')
504502
),
505-
'validators' => array ( 0 => array ( 'type' => 'REGEX',
506-
'regex' => '/^(\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\.[a-z\-]{2,10}){0,1}$/i',
507-
'errmsg'=> 'paypal_email_error_isemail'),
503+
'validators' => array (
504+
0 => array ( 'type' => 'ISEMAIL', 'errmsg'=> 'email_error_isemail'),
508505
),
509506
'default' => '',
510507
'value' => '',

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

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -328,15 +328,8 @@
328328
2 => array( 'event' => 'SAVE','type' => 'TOLOWER')
329329
),
330330
'validators' => array (
331-
0 => array ( 'type' => 'REGEX',
332-
'regex' => '/^(\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\.[a-z\-]{2,10}){0,1}$/i',
333-
'errmsg'=> 'email_error_isemail'),
334-
1 => array ( 'type' => 'NOTEMPTY',
335-
'errmsg'=> 'email_error_empty'),
336-
),
337-
'validators' => array ( 0 => array ( 'type' => 'REGEX',
338-
'regex' => '/^\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\w+\.[a-zA-Z0-9\-]{2,30}$/i',
339-
'errmsg'=> 'email_error_isemail'),
331+
0 => array ( 'type' => 'ISEMAIL', 'errmsg'=> 'email_error_isemail'),
332+
1 => array ( 'type' => 'NOTEMPTY', 'errmsg'=> 'email_error_empty'),
340333
),
341334
'default' => '',
342335
'value' => '',
@@ -505,9 +498,8 @@
505498
2 => array( 'event' => 'SAVE',
506499
'type' => 'TOLOWER')
507500
),
508-
'validators' => array ( 0 => array ( 'type' => 'REGEX',
509-
'regex' => '/^(\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\.[a-z\-]{2,10}){0,1}$/i',
510-
'errmsg'=> 'paypal_email_error_isemail'),
501+
'validators' => array (
502+
0 => array ( 'type' => 'ISEMAIL', 'errmsg'=> 'paypal_email_error_isemail'),
511503
),
512504
'default' => '',
513505
'value' => '',

interface/web/mail/form/mail_alias.tform.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,12 @@
124124
'default' => 'y',
125125
'value' => array(0 => 'n', 1 => 'y')
126126
),
127+
'allow_send_as' => array (
128+
'datatype' => 'VARCHAR',
129+
'formtype' => 'CHECKBOX',
130+
'default' => 'y',
131+
'value' => array(1 => 'y', 0 => 'n')
132+
),
127133
'greylisting' => array (
128134
'datatype' => 'VARCHAR',
129135
'formtype' => 'CHECKBOX',

interface/web/mail/form/mail_forward.tform.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,12 @@
118118
'default' => 'y',
119119
'value' => array(0 => 'n', 1 => 'y')
120120
),
121+
'allow_send_as' => array (
122+
'datatype' => 'VARCHAR',
123+
'formtype' => 'CHECKBOX',
124+
'default' => 'n',
125+
'value' => array(1 => 'y', 0 => 'n')
126+
),
121127
'greylisting' => array (
122128
'datatype' => 'VARCHAR',
123129
'formtype' => 'CHECKBOX',

interface/web/mail/lib/lang/de_mail_alias.lng

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,7 @@ $wb['duplicate_mailbox_txt'] = 'Es existiert bereits eine E-Mail Konto mit diese
1111
$wb['domain_txt'] = 'Domain';
1212
$wb['duplicate_email_alias_txt'] = 'Dieser E-Mail Alias existiert bereits.';
1313
$wb['source_txt'] = 'Alias';
14+
$wb['send_as_txt'] = 'Senden als';
15+
$wb['send_as_exp'] = 'Ziel erlauben, den alias als Absender zu benutzen';
1416
$wb['greylisting_txt'] = 'Aktiviere Greylisting';
1517
?>

0 commit comments

Comments
 (0)