aboutsummaryrefslogtreecommitdiffstats
path: root/config/postfix/postfix.php
diff options
context:
space:
mode:
authorMarcello Coutinho <marcellocoutinho@gmail.com>2014-11-18 16:31:09 -0200
committerMarcello Coutinho <marcellocoutinho@gmail.com>2014-11-18 16:31:09 -0200
commit5de63ed7fed8e7e86686da1346fee0590d8316b2 (patch)
treee2a152af277a2f483c3799e57f91e49a5ba68473 /config/postfix/postfix.php
parentba6565f6b08505fb70f8cec4abec09df42be25f5 (diff)
downloadpfsense-packages-5de63ed7fed8e7e86686da1346fee0590d8316b2.tar.gz
pfsense-packages-5de63ed7fed8e7e86686da1346fee0590d8316b2.tar.bz2
pfsense-packages-5de63ed7fed8e7e86686da1346fee0590d8316b2.zip
Postfix - indent / spaces fixes
Diffstat (limited to 'config/postfix/postfix.php')
-rw-r--r--config/postfix/postfix.php50
1 files changed, 25 insertions, 25 deletions
diff --git a/config/postfix/postfix.php b/config/postfix/postfix.php
index 774c7573..4cf85033 100644
--- a/config/postfix/postfix.php
+++ b/config/postfix/postfix.php
@@ -2,7 +2,7 @@
/*
postfix.php
part of pfSense (https://www.pfsense.org/)
- Copyright (C) 2011-2013 Marcello Coutinho <marcellocoutinho@gmail.com>
+ Copyright (C) 2011-2014 Marcello Coutinho <marcellocoutinho@gmail.com>
based on varnish_view_config.
All rights reserved.
@@ -42,13 +42,13 @@ function get_remote_log(){
$curr_time = time();
$log_time=date('YmdHis',$curr_time);
#get protocol
- if($config['system']['webgui']['protocol'] != "")
+ if($config['system']['webgui']['protocol'] != "")
$synchronizetoip = $config['system']['webgui']['protocol']. "://";
#get port
$port = $config['system']['webgui']['port'];
- #if port is empty lets rely on the protocol selection
+ #if port is empty lets rely on the protocol selection
if($port == "")
- $port =($config['system']['webgui']['protocol'] == "http"?"80":"443");
+ $port =($config['system']['webgui']['protocol'] == "http"?"80":"443");
$synchronizetoip .= $sync_to_ip;
if (is_array($config['installedpackages']['postfixsync']))
foreach($config['installedpackages']['postfixsync']['config'][0]['row'] as $sh){
@@ -59,7 +59,7 @@ function get_remote_log(){
#get remote data
if ($sync_type=='fetch'){
$url= $synchronizetoip . $sync_to_ip;
- print "$sync_to_ip $url, $port\n";
+ print "$sync_to_ip $url, $port\n";
$method = 'pfsense.exec_php';
$execcmd = "require_once('/usr/local/www/postfix.php');\n";
$execcmd .= '$toreturn=get_sql('.$log_time.');';
@@ -93,7 +93,7 @@ function get_remote_log(){
die ("Cannot execute query. $error\n".$update['sql']."\n");
}
else{
- if ($debug=true)
+ if ($debug=true)
print "ok\n";
}
sqlite_close($dbhandle);
@@ -114,12 +114,12 @@ function get_remote_log(){
$resp = $cli->send($msg, "250");
}
}
- }
+ }
}
function get_sql($log_time){
global $config,$xmlrpc_g;
$server=$_SERVER['REMOTE_ADDR'];
-
+
if (is_array($config['installedpackages']['postfixsync']))
foreach($config['installedpackages']['postfixsync']['config'][0]['row'] as $sh){
$sync_to_ip = $sh['ipaddress'];
@@ -141,7 +141,7 @@ function flush_sql($log_time){
function grep_log(){
global $postfix_dir,$postfix_arg,$config,$g;
-
+
$total_lines=0;
$days=array();
$grep="\(MailScanner\|postfix.cleanup\|postfix.smtp\|postfix.error\|postfix.qmgr\)";
@@ -203,7 +203,7 @@ function grep_log(){
#Nov 16 00:00:14 srvch011 postfix/smtp[7363]: 7AEB91F797D: to=<alessandra.bueno@mg.test.com>, relay=mail.mg.test.com[172.25.3.5]:25, delay=39, delays=35/1.1/0.04/2.7, dsn=5.7.1, status=bounced (host mail.mg.test.com[172.25.3.5] said: 550 5.7.1 Unable to relay for alessandra.bueno@mg.test.com (in reply to RCPT TO command))
else if(preg_match("/(\w+\s+\d+\s+[0-9,:]+) (\w+) postfix.\w+\W\d+\W+(\w+): to=\<(.*)\>, relay=(.*), delay=([0-9,.]+), .* dsn=([0-9,.]+), status=(\w+) (.*)/",$line,$email)){
$stm_queue[$day].= "insert or ignore into mail_status (info) values ('".$email[8]."');\n";
- $stm_queue[$day].= "insert or ignore into mail_to (from_id,too,status,status_info,relay,delay,dsn) values ((select id from mail_from where sid='".$email[3]."' and server='".$email[2]."'),'".strtolower($email[4])."',(select id from mail_status where info='".$email[8]."'),'".preg_replace("/(\<|\>|\s+|\'|\")/"," ",$email[9])."','".$email[5]."','".$email[6]."','".$email[7]."');\n";
+ $stm_queue[$day].= "insert or ignore into mail_to (from_id,too,status,status_info,relay,delay,dsn) values ((select id from mail_from where sid='".$email[3]."' and server='".$email[2]."'),'".strtolower($email[4])."',(select id from mail_status where info='".$email[8]."'),'".preg_replace("/(\<|\>|\s+|\'|\")/"," ",$email[9])."','".$email[5]."','".$email[6]."','".$email[7]."');\n";
$stm_queue[$day].= "update or ignore mail_to set status=(select id from mail_status where info='".$email[8]."'), status_info='".preg_replace("/(\<|\>|\s+|\'|\")/"," ",$email[9])."', dsn='".$email[7]."', delay='".$email[6]."', relay='".$email[5]."', too='".strtolower($email[4])."' where from_id in (select id from mail_from where sid='".$email[3]."' and server='".$email[2]."');\n";
}
#Nov 13 01:48:44 srvch011 postfix/cleanup[16914]: D995B1F570B: message-id=<61.40.11745.10E3FBE4@ofertas6>
@@ -223,7 +223,7 @@ function grep_log(){
$stm_queue[$day].= "insert or ignore into mail_status (info) values ('".$email[8]."');\n";
$stm_queue[$day].= "update mail_to set status=(select id from mail_status where info='reject'), status_info='queue file size limit exceeded' where from_id in (select id from mail_from where sid='".$email[3]."' and server='".$email[2]."');\n";
}
-
+
#Nov 9 02:14:57 srvch011 postfix/cleanup[6856]: 617A51F5AC5: warning: header Subject: Mapeamento de Processos from lxalpha.12b.com.br[66.109.29.225]; from=<apache@lxalpha.12b.com.br> to=<ritiele.faria@mail.test.com> proto=ESMTP helo=<lxalpha.12b.com.br>
#Nov 8 09:31:50 srvch011 postfix/cleanup[11471]: 19C281F59C8: reject: header From: "Giuliana Flores - Parceiro do Grupo Virtual" <publicidade@parceiro-grupovirtual.com.br> from pm03-974.auinmeio.com.br[177.70.232.225]; from=<publicidade@parceiro-grupovirtual.com.br> to=<jorge.lustosa@mail.test.com> proto=ESMTP helo=<pm03-974.auinmeio.com.br>: 5.7.1 [SN007]
#Nov 13 00:03:24 srvch011 postfix/cleanup[4192]: 8A5B31F52D2: reject: body http://platform.roastcrack.info/mj0ie6p-48qtiyq from move2.igloojack.info[173.239.63.16]; from=<ljmd6u8lrxke4@move2.igloojack.info> to=<edileva@aasdf..br> proto=SMTP helo=<move2.igloojack.info>: 5.7.1 [BD040]
@@ -271,9 +271,9 @@ function grep_log(){
$status['status_info']=$email[4];
$status['from']=$email[5];
$status['to']=$email[6];
- $status['helo']=$email[7];
+ $status['helo']=$email[7];
$values="'".$status['date']."','".$status['status']."','".$status['status_info']."','".strtolower($status['from'])."','".strtolower($status['to'])."','".$status['helo']."','".$status['server']."'";
- $stm_noqueue[$day].='insert or ignore into mail_noqueue(date,status,status_info,fromm,too,helo,server) values ('.$values.');'."\n";
+ $stm_noqueue[$day].='insert or ignore into mail_noqueue(date,status,status_info,fromm,too,helo,server) values ('.$values.');'."\n";
}
if ($total_lines%1500 == 0){
#save log in database
@@ -295,7 +295,7 @@ function grep_log(){
$stm_queue[$d]="BEGIN;\n";
}
}
-
+
$config=parse_xml_config("{$g['conf_path']}/config.xml", $g['xml_rootobj']);
//print count($config['installedpackages']);
#start db replication if configured
@@ -310,7 +310,7 @@ function grep_log(){
postfix_do_xmlrpc_sync($sync_to_ip, $password,$sync_type);
print "ok\n";
}
-
+
}
function write_db($stm,$table,$days){
@@ -341,7 +341,7 @@ function write_db($stm,$table,$days){
if ($debug=true)
print " writing to local db $day...";
$dbhandle = sqlite_open($postfix_dir.$day.".db", 0666, $error);
- if (!$dbhandle) die ($error);
+ if (!$dbhandle) die ($error);
#file_put_contents("/tmp/".$key.'-'.$update['day'].".sql",gzuncompress(base64_decode($update['sql'])), LOCK_EX);
$ok = sqlite_exec($dbhandle, $stm[$day]."COMMIT;", $error);
if (!$ok){
@@ -356,13 +356,13 @@ function write_db($stm,$table,$days){
}
#write update sql files
if (count ($do_sync) > 0 ){
-
+
foreach($do_sync as $ip)
file_put_contents('/var/db/postfix/'.$ip.'.sql',${$ip},LOCK_EX);
conf_mount_ro();
}
#write local file
-
+
}
function create_db($postfix_db){
@@ -513,14 +513,14 @@ switch ($argv[1]){
'12:','13:','14:','15:','16:','17:','18:','19:','20:','21:','22:','23:'),
'time' => '-03 day');
break;
-
+
default:
die ("invalid parameters\n");
}
# get remote log from remote server
get_remote_log();
# get local log from logfile
-grep_log();
+grep_log();
}
#http client call
@@ -540,7 +540,7 @@ if ($_REQUEST['files']!= ""){
$stm_fetch=array();
$total_result=0;
foreach ($files as $postfix_db)
- if (file_exists($postfix_dir.'/'.$postfix_db)){
+ if (file_exists($postfix_dir.'/'.$postfix_db)){
$dbhandle = sqlite_open($postfix_dir.'/'.$postfix_db, 0666, $error);
if ($_REQUEST['from']!= ""){
$next=($last_next==" and "?" and ":" where ");
@@ -595,7 +595,7 @@ if ($_REQUEST['files']!= ""){
else
$stm .=$next."server = '".$_REQUEST['server']."'";
}
-
+
if ($_REQUEST['status']!= ""){
$next=($last_next==" and "?" and ":" where ");
$last_next=" and ";
@@ -604,7 +604,7 @@ if ($_REQUEST['files']!= ""){
#print "<pre>".$stm;
#$stm = "select * from mail_to,mail_status where mail_to.status=mail_status.id";
$result = sqlite_query($dbhandle, $stm." order by date desc $limit_prefix $limit ");
- #$result = sqlite_query($dbhandle, $stm." $limit_prefix $limit ");
+ #$result = sqlite_query($dbhandle, $stm." $limit_prefix $limit ");
if (preg_match("/\d+/",$_REQUEST['limit'])){
for ($i = 1; $i <= $limit; $i++) {
$row = sqlite_fetch_array($result, SQLITE_ASSOC);
@@ -744,8 +744,8 @@ if ($_REQUEST['files']!= ""){
print '<tr>';
print '<td ><strong>Total:</strong></td>';
print '<td ><strong>'.$total_result.'</strong></td>';
- print '</tr>';
+ print '</tr>';
print '</table>';
- }
+ }
}
?> \ No newline at end of file