diff --git a/install/sql/incremental/upd_dev_collection.sql b/install/sql/incremental/upd_dev_collection.sql index e4fd928f7f07d9a87c8cdca4ee2e1ba80cd7ea2a..624d748a52bb52d9869cdb369985ef98647067b7 100644 --- a/install/sql/incremental/upd_dev_collection.sql +++ b/install/sql/incremental/upd_dev_collection.sql @@ -192,3 +192,14 @@ ALTER TABLE `web_domain` ADD `ssl_letsencrypt` enum('n','y') NOT NULL DEFAULT 'n ALTER TABLE `openvz_template` CHANGE `vmguarpages` `vmguarpages` varchar(255) DEFAULT '65536:unlimited'; ALTER TABLE `openvz_template` CHANGE `privvmpages` `privvmpages` varchar(255) DEFAULT '131072:139264'; + +CREATE TABLE `ftp_traffic` ( + `hostname` varchar(255) NOT NULL, + `traffic_date` date NOT NULL, + `in_bytes` bigint(32) unsigned NOT NULL, + `out_bytes` bigint(32) unsigned NOT NULL, + PRIMARY KEY (`hostname`,`traffic_date`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +ALTER TABLE `mail_forwarding` ADD COLUMN `allow_send_as` ENUM('n','y') NOT NULL DEFAULT 'n' AFTER `active`; +UPDATE `mail_forwarding` SET `allow_send_as` = 'y' WHERE `type` = 'alias'; diff --git a/install/sql/ispconfig3.sql b/install/sql/ispconfig3.sql index 672f94bae40e63766b1674d29e0bfe913e9dd864..f77bbf456d4ea2a740f18bbc3e30655890853bfb 100644 --- a/install/sql/ispconfig3.sql +++ b/install/sql/ispconfig3.sql @@ -638,6 +638,20 @@ CREATE TABLE `ftp_user` ( -- -------------------------------------------------------- +-- +-- Table structure for table `ftp_traffic` +-- + +CREATE TABLE `ftp_traffic` ( + `hostname` varchar(255) NOT NULL, + `traffic_date` date NOT NULL, + `in_bytes` bigint(32) unsigned NOT NULL, + `out_bytes` bigint(32) unsigned NOT NULL, + PRIMARY KEY (`hostname`,`traffic_date`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + -- -- Table structure for table `help_faq` -- @@ -800,6 +814,7 @@ CREATE TABLE `mail_forwarding` ( `destination` text, `type` enum('alias','aliasdomain','forward','catchall') NOT NULL default 'alias', `active` enum('n','y') NOT NULL DEFAULT 'n', + `allow_send_as` ENUM('n','y') NOT NULL DEFAULT 'n', `greylisting` enum('n','y' ) NOT NULL DEFAULT 'n', PRIMARY KEY (`forwarding_id`), KEY `server_id` (`server_id`,`source`), diff --git a/install/tpl/mysql-virtual_sender_login_maps.cf.master b/install/tpl/mysql-virtual_sender_login_maps.cf.master index ad2d758b081c576cd384fb14a75602e66a534075..5b7f144f8cb94c5686a388f950651a86d1c9a618 100644 --- a/install/tpl/mysql-virtual_sender_login_maps.cf.master +++ b/install/tpl/mysql-virtual_sender_login_maps.cf.master @@ -1,5 +1,5 @@ user = {mysql_server_ispconfig_user} password = {mysql_server_ispconfig_password} dbname = {mysql_server_database} -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}; +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}; hosts = {mysql_server_ip} \ No newline at end of file diff --git a/interface/lib/classes/quota_lib.inc.php b/interface/lib/classes/quota_lib.inc.php index 8c911397fd6c0ff792e21210338b7a829834f79f..0455dc98b219b7fb98b211d2cff97d248446cfb5 100644 --- a/interface/lib/classes/quota_lib.inc.php +++ b/interface/lib/classes/quota_lib.inc.php @@ -156,6 +156,67 @@ class quota_lib { return $traffic_data; } + + public function get_ftptrafficquota_data($clientid = null, $lastdays = 0) { + global $app; + + $traffic_data = array(); + + // select vhosts (belonging to client) + if($clientid != null){ + $sql_where = " AND sys_groupid = (SELECT default_group FROM sys_user WHERE client_id=?)"; + } + $sites = $app->db->queryAllRecords("SELECT * FROM web_domain WHERE active = 'y' AND (type = 'vhost' OR type = 'vhostsubdomain' OR type = 'vhostalias')".$sql_where, $clientid); + + $hostnames = array(); + $traffic_data = array(); + + foreach ($sites as $site) { + $hostnames[] = $site['domain']; + $traffic_data[$site['domain']]['domain_id'] = $site['domain_id']; + } + + // fetch all traffic-data of selected vhosts + if (!empty($hostnames)) { + $tmp_year = date('Y'); + $tmp_month = date('m'); + // This Month + $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); + foreach ($tmp_recs as $tmp_rec) { + $traffic_data[$tmp_rec['hostname']]['this_month'] = $tmp_rec['t']; + } + // This Year + $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); + foreach ($tmp_recs as $tmp_rec) { + $traffic_data[$tmp_rec['hostname']]['this_year'] = $tmp_rec['t']; + } + + $tmp_year = date('Y', mktime(0, 0, 0, date("m")-1, date("d"), date("Y"))); + $tmp_month = date('m', mktime(0, 0, 0, date("m")-1, date("d"), date("Y"))); + // Last Month + $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); + foreach ($tmp_recs as $tmp_rec) { + $traffic_data[$tmp_rec['hostname']]['last_month'] = $tmp_rec['t']; + } + + $tmp_year = date('Y', mktime(0, 0, 0, date("m"), date("d"), date("Y")-1)); + // Last Year + $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); + foreach ($tmp_recs as $tmp_rec) { + $traffic_data[$tmp_rec['hostname']]['last_year'] = $tmp_rec['t']; + } + + if (is_int($lastdays) && ($lastdays > 0)) { + // Last xx Days + $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); + foreach ($tmp_recs as $tmp_rec) { + $traffic_data[$tmp_rec['hostname']]['lastdays'] = $tmp_rec['t']; + } + } + } + + return $traffic_data; + } public function get_mailquota_data($clientid = null, $readable = true) { global $app; diff --git a/interface/lib/classes/remote.d/sites.inc.php b/interface/lib/classes/remote.d/sites.inc.php index 8770522647db6a66f2386c233df7d1f1cdb965ae..e52e91dbd557e0f5bb25f609c4c3e6a90f9211c1 100644 --- a/interface/lib/classes/remote.d/sites.inc.php +++ b/interface/lib/classes/remote.d/sites.inc.php @@ -980,6 +980,21 @@ class remoting_sites extends remoting { return $app->quota_lib->get_trafficquota_data($client_id, $lastdays); } + public function ftptrafficquota_data($session_id, $client_id, $lastdays = 0) + { + global $app; + $app->uses('quota_lib'); + + if(!$this->checkPerm($session_id, 'trafficquota_get_by_user')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + if ($client_id != null) + $client_id = $app->functions->intval($client_id); + + return $app->quota_lib->get_ftptrafficquota_data($client_id, $lastdays); + } + public function databasequota_get_by_user($session_id, $client_id) { global $app; diff --git a/interface/web/mail/form/mail_alias.tform.php b/interface/web/mail/form/mail_alias.tform.php index d85989517d8db4a7b566e87c7c609fbb2db2692c..a004203622d3c6df0e6b9186a1f8829fa0ee0e66 100644 --- a/interface/web/mail/form/mail_alias.tform.php +++ b/interface/web/mail/form/mail_alias.tform.php @@ -124,6 +124,12 @@ $form["tabs"]['alias'] = array ( 'default' => 'y', 'value' => array(0 => 'n', 1 => 'y') ), + 'allow_send_as' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'y', + 'value' => array(1 => 'y', 0 => 'n') + ), 'greylisting' => array ( 'datatype' => 'VARCHAR', 'formtype' => 'CHECKBOX', diff --git a/interface/web/mail/form/mail_forward.tform.php b/interface/web/mail/form/mail_forward.tform.php index 520f18d54b1393e254b11685905591a81e72afed..3c891506b9e69a64abb916c9ddd3662bea4b6730 100644 --- a/interface/web/mail/form/mail_forward.tform.php +++ b/interface/web/mail/form/mail_forward.tform.php @@ -118,6 +118,12 @@ $form["tabs"]['forward'] = array ( 'default' => 'y', 'value' => array(0 => 'n', 1 => 'y') ), + 'allow_send_as' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'n', + 'value' => array(1 => 'y', 0 => 'n') + ), 'greylisting' => array ( 'datatype' => 'VARCHAR', 'formtype' => 'CHECKBOX', diff --git a/interface/web/mail/lib/lang/de_mail_alias.lng b/interface/web/mail/lib/lang/de_mail_alias.lng index 4115780ad67b23dc6e81ec873e340355407b6747..211f0065fa0e44d05f62798fd1f36a9afebba151 100644 --- a/interface/web/mail/lib/lang/de_mail_alias.lng +++ b/interface/web/mail/lib/lang/de_mail_alias.lng @@ -11,5 +11,7 @@ $wb['duplicate_mailbox_txt'] = 'Es existiert bereits eine E-Mail Konto mit diese $wb['domain_txt'] = 'Domain'; $wb['duplicate_email_alias_txt'] = 'Dieser E-Mail Alias existiert bereits.'; $wb['source_txt'] = 'Alias'; +$wb['send_as_txt'] = 'Senden als'; +$wb['send_as_exp'] = 'Ziel erlauben, den alias als Absender zu benutzen'; $wb['greylisting_txt'] = 'Aktiviere Greylisting'; ?> diff --git a/interface/web/mail/lib/lang/de_mail_forward.lng b/interface/web/mail/lib/lang/de_mail_forward.lng index 15d084526aeb719883999d287eacdacfaa657933..f10d789671ee572ff4f4cdda1acc489c20588480 100644 --- a/interface/web/mail/lib/lang/de_mail_forward.lng +++ b/interface/web/mail/lib/lang/de_mail_forward.lng @@ -7,5 +7,7 @@ $wb['duplicate_mailbox_txt'] = 'Es existiert bereits ein E-Mail Konto mit dieser $wb['domain_txt'] = 'Domain'; $wb['source_txt'] = 'Quell E-Mail Adresse'; $wb['email_error_isemail'] = 'Bitte geben Sie eine gültige E-Mail Adresse an.'; +$wb['send_as_txt'] = 'Senden als'; +$wb['send_as_exp'] = 'Ziel erlauben, die Adresse als Absender zu nutzen (Nur, falls das Ziel intern ist)'; $wb['greylisting_txt'] = 'Aktiviere greylisting'; ?> diff --git a/interface/web/mail/lib/lang/en_mail_alias.lng b/interface/web/mail/lib/lang/en_mail_alias.lng index 6e9d82819658b33e03dda31506dc02dbf1d96db3..80326075b06987d2c4d190612ffb444c5d5120a9 100644 --- a/interface/web/mail/lib/lang/en_mail_alias.lng +++ b/interface/web/mail/lib/lang/en_mail_alias.lng @@ -11,5 +11,7 @@ $wb["duplicate_mailbox_txt"] = 'There is already a mailbox with this email addre $wb['domain_txt'] = 'Domain'; $wb["duplicate_email_alias_txt"] = 'This email alias does already exist.'; $wb["source_txt"] = 'Alias'; +$wb['send_as_txt'] = 'Send as'; +$wb['send_as_exp'] = 'Allow target to send mail using this alias as origin'; $wb['greylisting_txt'] = 'Enable greylisting'; ?> diff --git a/interface/web/mail/lib/lang/en_mail_forward.lng b/interface/web/mail/lib/lang/en_mail_forward.lng index 07046505dee0f0a40fcd83b2d40409ca557ba8d5..adab1138eeacbdf138aa9b56af10de8c2c5ef48a 100644 --- a/interface/web/mail/lib/lang/en_mail_forward.lng +++ b/interface/web/mail/lib/lang/en_mail_forward.lng @@ -7,5 +7,7 @@ $wb["duplicate_mailbox_txt"] = 'There is already a mailbox with this email addre $wb['domain_txt'] = 'Domain'; $wb["source_txt"] = 'Source Email'; $wb['email_error_isemail'] = 'Please enter a valid email address.'; +$wb['send_as_txt'] = 'Send as'; +$wb['send_as_exp'] = 'Allow target to send mail using this address as origin (if target is internal)'; $wb['greylisting_txt'] = 'Enable greylisting'; ?> diff --git a/interface/web/mail/templates/mail_alias_edit.htm b/interface/web/mail/templates/mail_alias_edit.htm index 07d781c676f1381fa3055e728d98ebf459a25c70..04879265f0319fd3b10669d71e5073f5e68b498e 100644 --- a/interface/web/mail/templates/mail_alias_edit.htm +++ b/interface/web/mail/templates/mail_alias_edit.htm @@ -27,6 +27,12 @@ {tmpl_var name='active'} +
{tmpl_var name='search_limit'} | +|||||
---|---|---|---|---|---|
+ | + + | +||||
{tmpl_var name="domain"} | +{tmpl_var name="this_month_in"}/{tmpl_var name="this_month_out"} | +{tmpl_var name="last_month_in"}/{tmpl_var name="last_month_out"} | +{tmpl_var name="this_year_in"}/{tmpl_var name="this_year_out"} | +{tmpl_var name="last_year_in"}/{tmpl_var name="last_year_out"} | ++ |
{tmpl_var name='globalsearch_noresults_text_txt'} | +|||||
{tmpl_var name="sum_txt"} | +{tmpl_var name="sum_this_month"} | +{tmpl_var name="sum_last_month"} | +{tmpl_var name="sum_this_year"} | +{tmpl_var name="sum_last_year"} | ++ |