diff --git a/install/tpl/server.ini.master b/install/tpl/server.ini.master index 20dca2d42faaf5342aad8812d8e22333022d0dc5..4cb2222d72e275362cc9fab6bef1a8766b93af22 100644 --- a/install/tpl/server.ini.master +++ b/install/tpl/server.ini.master @@ -77,6 +77,7 @@ apps_vhost_ip=_default_ apps_vhost_servername= php_open_basedir=[website_path]/web:[website_path]/private:[website_path]/tmp:/var/www/[website_domain]/web:/srv/www/[website_domain]/web:/usr/share/php5:/usr/share/php:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin htaccess_allow_override=All +enable_spdy=y awstats_conf_dir=/etc/awstats awstats_data_dir=/var/lib/awstats awstats_pl=/usr/lib/cgi-bin/awstats.pl diff --git a/interface/web/admin/form/server_config.tform.php b/interface/web/admin/form/server_config.tform.php index 351d4de86c32d00f6055f9c5435fe67f51b10ede..53c184f51e50819d6ca6116d8cd3d0fef29c8677 100644 --- a/interface/web/admin/form/server_config.tform.php +++ b/interface/web/admin/form/server_config.tform.php @@ -321,7 +321,7 @@ $form["tabs"]['mail'] = array( 'datatype' => 'INTEGER', 'formtype' => 'SELECT', 'default' => '2048', - 'value' => array('1024' => 'week (1024)', '2048' => 'normal (2048)', '4096' => 'strong (4096)') + 'value' => array('1024' => 'weak (1024)', '2048' => 'normal (2048)', '4096' => 'strong (4096)') ), 'relayhost_password' => array( 'datatype' => 'VARCHAR', @@ -1024,7 +1024,7 @@ $form["tabs"]['web'] = array( 'enable_spdy' => array ( 'datatype' => 'VARCHAR', 'formtype' => 'CHECKBOX', - 'default' => 'n', + 'default' => 'y', 'value' => array ( 0 => 'n', 1 => 'y' diff --git a/interface/web/sites/web_sites_stats.php b/interface/web/sites/web_sites_stats.php index a6af3dc8a080def6bac72812f6142fcc28430a21..16c40d43ed92990ee7b25c070511dec496ead604 100644 --- a/interface/web/sites/web_sites_stats.php +++ b/interface/web/sites/web_sites_stats.php @@ -42,26 +42,26 @@ class list_action extends listform_actions { $tmp_month = date('m'); $tmp_rec = $app->db->queryOneRecord("SELECT SUM(traffic_bytes) as t FROM web_traffic WHERE hostname = ? AND YEAR(traffic_date) = ? AND MONTH(traffic_date) = ?", $rec['domain'], $tmp_year, $tmp_month); $rec['this_month'] = $app->functions->formatBytes($tmp_rec['t']); - $this->sum_this_month += $app->functions->formatBytes($tmp_rec['t']); + $this->sum_this_month += $tmp_rec['t']; //** Traffic of the current year $tmp_rec = $app->db->queryOneRecord("SELECT sum(traffic_bytes) as t FROM web_traffic WHERE hostname = ? AND YEAR(traffic_date) = ?", $rec['domain'], $tmp_year); $rec['this_year'] = $app->functions->formatBytes($tmp_rec['t']); - $this->sum_this_year += $app->functions->formatBytes($tmp_rec['t']); + $this->sum_this_year += $tmp_rec['t']; //** Traffic of the last month $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"))); $tmp_rec = $app->db->queryOneRecord("SELECT sum(traffic_bytes) as t FROM web_traffic WHERE hostname = ? AND YEAR(traffic_date) = ? AND MONTH(traffic_date) = ?", $rec['domain'], $tmp_year, $tmp_month); $rec['last_month'] = $app->functions->formatBytes($tmp_rec['t']); - $this->sum_last_month += $app->functions->formatBytes($tmp_rec['t']); + $this->sum_last_month += $tmp_rec['t']; //** Traffic of the last year $tmp_year = date('Y', mktime(0, 0, 0, date("m"), date("d"), date("Y")-1)); $tmp_rec = $app->db->queryOneRecord("SELECT sum(traffic_bytes) as t FROM web_traffic WHERE hostname = ? AND YEAR(traffic_date) = ?", $rec['domain'], $tmp_year); $rec['last_year'] = $app->functions->formatBytes($tmp_rec['t']); - $this->sum_last_year += $app->functions->formatBytes($tmp_rec['t']); + $this->sum_last_year += $tmp_rec['t']; //* The variable "id" contains always the index variable $rec['id'] = $rec[$this->idx_key]; @@ -73,10 +73,10 @@ class list_action extends listform_actions { { global $app; - $app->tpl->setVar('sum_this_month', number_format($app->functions->intval($this->sum_this_month), 0, '.', ' ')); - $app->tpl->setVar('sum_this_year', number_format($app->functions->intval($this->sum_this_year), 0, '.', ' ')); - $app->tpl->setVar('sum_last_month', number_format($app->functions->intval($this->sum_last_month), 0, '.', ' ')); - $app->tpl->setVar('sum_last_year', number_format($app->functions->intval($this->sum_last_year), 0, '.', ' ')); + $app->tpl->setVar('sum_this_month', $app->functions->formatBytes($this->sum_this_month)); + $app->tpl->setVar('sum_this_year', $app->functions->formatBytes($this->sum_this_year)); + $app->tpl->setVar('sum_last_month', $app->functions->formatBytes($this->sum_last_month)); + $app->tpl->setVar('sum_last_year', $app->functions->formatBytes($this->sum_last_year)); $app->tpl->setVar('sum_txt', $app->listform->lng('sum_txt')); $app->tpl_defaults(); diff --git a/interface/web/sites/web_vhost_domain_edit.php b/interface/web/sites/web_vhost_domain_edit.php index 5508440ed4aa4ad2490ea22a171220d95beb50ea..af96fd8f7191379671edb86e12c62f83dab616f4 100644 --- a/interface/web/sites/web_vhost_domain_edit.php +++ b/interface/web/sites/web_vhost_domain_edit.php @@ -635,7 +635,7 @@ class page_action extends tform_actions { if(is_array($ssl_domains)) { foreach( $ssl_domains as $ssl_domain) { $selected = ($ssl_domain == $this->dataRecord['ssl_domain'])?'SELECTED':''; - $ssl_domain_select .= "\r\n"; + $ssl_domain_select .= "\r\n"; } } $app->tpl->setVar("ssl_domain", $ssl_domain_select); diff --git a/interface/web/themes/default/assets/javascripts/ispconfig.js b/interface/web/themes/default/assets/javascripts/ispconfig.js index bc5c988a3cea4e2d9eda903be872d8bc72e3a0dd..0416e4043b07c2e942acc021535039da8723bd55 100644 --- a/interface/web/themes/default/assets/javascripts/ispconfig.js +++ b/interface/web/themes/default/assets/javascripts/ispconfig.js @@ -635,7 +635,11 @@ $(document).on('click', 'th[data-column]', function(e) { var dir = $self.attr('data-ordered'); - act = act + '?orderby=' + column; + var separator = '?'; + if(act.indexOf("?") >= 0){ + separator = '&'; + } + act = act + separator + 'orderby=' + column; ISPConfig.submitForm(form, act); $(document).ajaxComplete(function() { diff --git a/interface/web/themes/default/templates/error.tpl.htm b/interface/web/themes/default/templates/error.tpl.htm index f65df61bb374b8e4355a7a287701be0d26556e58..f0c10811c2d9c30bd9554ba2245dc2c272738aa8 100644 --- a/interface/web/themes/default/templates/error.tpl.htm +++ b/interface/web/themes/default/templates/error.tpl.htm @@ -1,5 +1,5 @@
-
ERROR
+
  1. ###ERRORMSG###
  2. diff --git a/interface/web/themes/default/templates/tabbed_form.tpl.htm b/interface/web/themes/default/templates/tabbed_form.tpl.htm index d0a2684352c4b80db8c908e51a073656e98a846d..5560f3e12c733b8f6ef6e4e4336b0c39fe35619b 100644 --- a/interface/web/themes/default/templates/tabbed_form.tpl.htm +++ b/interface/web/themes/default/templates/tabbed_form.tpl.htm @@ -10,7 +10,7 @@
    -
    ERROR
    +
    TODO: IP address is empty.
    diff --git a/server/lib/classes/cron.d/100-mailbox_stats.inc.php b/server/lib/classes/cron.d/100-mailbox_stats.inc.php index 259535ffda989877855f6cb0250baea5d2327f9c..9778b2fc579f35bc5a9b79c8300fb961ab45b9f7 100644 --- a/server/lib/classes/cron.d/100-mailbox_stats.inc.php +++ b/server/lib/classes/cron.d/100-mailbox_stats.inc.php @@ -32,6 +32,9 @@ class cronjob_mailbox_stats extends cronjob { // job schedule protected $_schedule = '0 0 * * *'; + protected $mailbox_traffic = array(); + protected $mail_boxes = array(); + protected $mail_rewrites = array(); /* this function is optional if it contains no custom code */ public function onPrepare() { @@ -164,7 +167,7 @@ class cronjob_mailbox_stats extends cronjob { $cur_line = false; if(file_exists($state_file)) { - $prev_line = parse_mail_log_line(trim(file_get_contents($state_file))); + $prev_line = $this->parse_mail_log_line(trim(file_get_contents($state_file))); //if($prev_line) echo "continuing from previous run, log position: " . $prev_line['message-id'] . " at " . strftime('%d.%m.%Y %H:%M:%S', $prev_line['timestamp']) . "\n"; } @@ -175,7 +178,8 @@ class cronjob_mailbox_stats extends cronjob { while($line = fgets($fp, 8192)) { $l++; //if($l % 1000 == 0) echo "\rline $l"; - $cur_line = parse_mail_log_line($line); + $cur_line = $this->parse_mail_log_line($line); + //print_r($cur_line); if(!$cur_line) continue; if($prev_line) { @@ -190,9 +194,13 @@ class cronjob_mailbox_stats extends cronjob { } } - add_mailbox_traffic($mailbox_traffic, $cur_line['from'], $cur_line['size']); + $this->add_mailbox_traffic($cur_line['from'], $cur_line['size']); + //echo "1\n"; + //print_r($this->mailbox_traffic); foreach($cur_line['to'] as $to) { - add_mailbox_traffic($mailbox_traffic, $to, $cur_line['size']); + $this->add_mailbox_traffic($to, $cur_line['size']); + //echo "2\n"; + //print_r($this->mailbox_traffic); } $last_line = $line; // store for the state file } @@ -207,7 +215,7 @@ class cronjob_mailbox_stats extends cronjob { while($line = fgets($fp, 8192)) { $l++; //if($l % 1000 == 0) echo "\rline $l"; - $cur_line = parse_mail_log_line($line); + $cur_line = $this->parse_mail_log_line($line); if(!$cur_line) continue; if($prev_line) { @@ -265,6 +273,41 @@ class cronjob_mailbox_stats extends cronjob { parent::onAfterRun(); } + + private function parse_mail_log_line($line) { + //Oct 31 17:35:48 mx01 amavis[32014]: (32014-05) Passed CLEAN, [IPv6:xxxxx] [IPv6:xxxxx] -> , Message-ID: , mail_id: xxxxxx, Hits: -1.89, size: 1591, queued_as: xxxxxxx, 946 ms + + if(preg_match('/^(\w+\s+\d+\s+\d+:\d+:\d+)\s+[^ ]+\s+amavis.* <([^>]+)>\s+->\s+((<[^>]+>,)+) .*Message-ID:\s+<([^>]+)>.* size:\s+(\d+),.*$/', $line, $matches) == false) return false; + + $timestamp = strtotime($matches[1]); + if(!$timestamp) return false; + + $to = array(); + $recipients = explode(',', $matches[3]); + foreach($recipients as $recipient) { + $recipient = substr($recipient, 1, -1); + if(!$recipient || $recipient == $matches[2]) continue; + $to[] = $recipient; + } + return array('line' => $line, 'timestamp' => $timestamp, 'size' => $matches[6], 'from' => $matches[2], 'to' => $to, 'message-id' => $matches[5]); + } + + private function add_mailbox_traffic($address, $traffic) { + + $address = strtolower($address); + + if(in_array($address, $this->mail_boxes) == true) { + if(!isset($this->mailbox_traffic[$address])) $this->mailbox_traffic[$address] = 0; + $this->mailbox_traffic[$address] += $traffic; + } elseif(array_key_exists($address, $this->mail_rewrites)) { + foreach($this->mail_rewrites[$address] as $address) { + if(!isset($this->mailbox_traffic[$address])) $this->mailbox_traffic[$address] = 0; + $this->mailbox_traffic[$address] += $traffic; + } + } else { + // this is not a local address - skip it + } + } }