From 5de63ed7fed8e7e86686da1346fee0590d8316b2 Mon Sep 17 00:00:00 2001 From: Marcello Coutinho Date: Tue, 18 Nov 2014 16:31:09 -0200 Subject: Postfix - indent / spaces fixes --- config/postfix/postfix.inc | 126 ++++++++++++++++++++++----------------------- 1 file changed, 63 insertions(+), 63 deletions(-) (limited to 'config/postfix/postfix.inc') diff --git a/config/postfix/postfix.inc b/config/postfix/postfix.inc index 50979f38..8f27680d 100755 --- a/config/postfix/postfix.inc +++ b/config/postfix/postfix.inc @@ -3,7 +3,7 @@ postfix.inc part of the Postfix package for pfSense Copyright (C) 2010 Erik Fonnesbeck - Copyright (C) 2011-2013 Marcello Coutinho + Copyright (C) 2011-2014 Marcello Coutinho All rights reserved. @@ -40,14 +40,14 @@ if ($pf_version > 2.0) define('POSTFIX_LOCALBASE', '/usr/pbi/postfix-' . php_uname("m")); else define('POSTFIX_LOCALBASE','/usr/local'); - + $uname=posix_uname(); if ($uname['machine']=='amd64') ini_set('memory_limit', '250M'); function px_text_area_decode($text){ - return preg_replace('/\r\n/', "\n",base64_decode($text)); + return preg_replace('/\r\n/', "\n",base64_decode($text)); } function px_get_real_interface_address($iface) { @@ -85,8 +85,8 @@ function sync_relay_recipients($via_cron="cron"){ if (!file_exists($ldap_recipients)) system('/usr/bin/touch '. $ldap_recipients); $relay_ldap_recipients=file_get_contents($ldap_recipients); - } - else{ + } + else{ #running via crontab, time to get ldap content. $ldap_temp=array(); foreach ($postfix_recipients_config['row'] as $postfix_ldap) { @@ -121,7 +121,7 @@ function sync_relay_recipients($via_cron="cron"){ print "Total ldap recipients:".count($ldap_all)."\tunique:".count($ldap_unique)."\n"; foreach($ldap_unique as $recipient) $relay_ldap_recipients.=($recipient != ""?preg_replace("/\s+/","",$recipient)." OK\n":""); - + #save ldap relay recipients file_put_contents(POSTFIX_LOCALBASE."/etc/postfix/relay_ldap_recipients.txt",$relay_ldap_recipients, LOCK_EX); } @@ -137,11 +137,11 @@ function sync_relay_recipients($via_cron="cron"){ } if($relay_recipients !="" || $relay_ldap_recipients!="") return("relay_recipient_maps = hash:".POSTFIX_LOCALBASE."/etc/postfix/relay_recipients\n"); - + } function check_cron(){ global $config, $g; - #check crontab + #check crontab $new_cron=array(); $cron_cmd_sqlite = ""; $cron_postfix_sqlite=""; @@ -207,7 +207,7 @@ function check_cron(){ } } } - + #check crontab relay recipients $cron_found=""; if (is_array($config['cron']['item'])){ @@ -224,7 +224,7 @@ function check_cron(){ } } } - #check sqlite update queue + #check sqlite update queue else if(!preg_match("/.usr.local.www.postfix.php/",$cron["command"])){ #keep all non postfix cron cmds if not empty if ($cron["command"] != "") @@ -235,7 +235,7 @@ function check_cron(){ # Check if crontab must be changed to valid recipients cmd if ($postfix_recipients_config['enable_ldap'] || $postfix_recipients_config['enable_url']){ if ($cron_found!=$cron_postfix){ - #update postfix cron schedule + #update postfix cron schedule if (! is_array($cron_found) && $postfix_enabled=="on") $new_cron['item'][]=$cron_postfix; $write_cron=1; @@ -255,7 +255,7 @@ function check_cron(){ } } - #call cron functions + #call cron functions if ($write_cron==1){ $config['cron']=$new_cron; write_config('Postfix - sync remote sqlite database',$backup = false); @@ -271,17 +271,17 @@ function check_cron(){ else $new_crontab .= $line; } - if ($old_cron==1) + if ($old_cron==1) file_put_contents("/etc/crontab",$new_crontab, LOCK_EX); - + #print "
". var_dump($new_cron). var_dump($cron_postfix_sqlite).var_dump($config['cron']);
 			#exit;
-			
-		
+
+
 }
 function sync_package_postfix($via_rpc="no") {
 	global $config;
-	
+
 	log_error("sync_package_postfix called with via_rpc={$via_rpc}");
 	# detect boot process
 	if (is_array($_POST)){
@@ -290,10 +290,10 @@ function sync_package_postfix($via_rpc="no") {
 		else
 			$boot_process="on";
 	}
-		
+
 	if(is_process_running("master") && isset($boot_process) && $via_rpc=="no")
 		return;
-		
+
 	#check patch in /etc/inc/config.
 	$relay_domains = "";
 	$transport = "";
@@ -346,10 +346,10 @@ function sync_package_postfix($via_rpc="no") {
             }
             file_put_contents($sys_log_file,$new_sys_log, LOCK_EX);
             #mwexec('/usr/local/bin/php -q /usr/local/www/postfix_syslog.php');
-            #restart syslog daemon	
+            #restart syslog daemon
             system_syslogd_start();
 		}
-           
+
 	#check_debug
 	if($postfix_config['debug_list'] && $postfix_config['debug_list']!=""){
 	$check_debug ="\n#Debugging postfix\n";
@@ -358,7 +358,7 @@ function sync_package_postfix($via_rpc="no") {
 	}
 	#check relay recipients
 	$all_relay_recipients=sync_relay_recipients('gui');
-	
+
 	$copyright=<< "postfix.sh", "start" => $start, "stop" => $stop));
 
 	sleep(1);
@@ -797,7 +797,7 @@ EOF;
 		mwexec("/usr/local/etc/rc.d/postfix.sh stop");
 		system('/bin/chmod -x /usr/local/etc/rc.d/postfix.sh');
 		}
-		
+
 	conf_mount_ro();
 }
 
@@ -806,11 +806,11 @@ function postfix_validate_input($post, &$input_errors) {
 		if (empty($value))
 			continue;
 		if($key == "greet_time" && !preg_match("/(\d+),(\d+)(s|m|h|w)/",$value))
-				$input_errors[] = "Wrong greet time sintax.";			
+				$input_errors[] = "Wrong greet time sintax.";
 		if($key == "message_size_limit" && !is_numeric($value))
 				$input_errors[] = "Message size limit must be numeric.";
 		if($key == "process_limit" && !is_numeric($value))
-				$input_errors[] = "Process limit must be numeric.";	
+				$input_errors[] = "Process limit must be numeric.";
 		if($key == "freq" && (!preg_match("/^\d+(h|m|d)$/",$value) || $value == 0))
 				$input_errors[] = "A valid number with a time reference is required for the field 'Frequency'";
 		if (substr($key, 0, 2) == "dc" && !is_hostname($value))
@@ -845,7 +845,7 @@ function postfix_php_deinstall_command() {
 
 /* Uses XMLRPC to synchronize the changes to a remote node */
 function postfix_sync_on_changes() {
-	global $config, $g;			
+	global $config, $g;
 	if (is_array($config['installedpackages']['postfixsync']['config'])){
 		$postfix_sync=$config['installedpackages']['postfixsync']['config'][0];
 		$synctimeout = $postfix_sync['synctimeout'];
@@ -877,7 +877,7 @@ function postfix_sync_on_changes() {
 						log_error("[postfix] xmlrpc sync is enabled but there is no system backup hosts to push postfix config.");
 						return;
 					}
-				break;			
+				break;
 			default:
 				return;
 			break;
@@ -905,13 +905,13 @@ function postfix_do_xmlrpc_sync($sync_to_ip,$username,$password,$sync_type,$sync
 
 	if(!$username)
 		$username="admin";
-	
+
 	if(!$password)
 		return;
 
 	if(!$sync_to_ip)
 		return;
-		
+
 	if(!$synctimeout)
 		$synctimeout=120;
 
@@ -923,9 +923,9 @@ function postfix_do_xmlrpc_sync($sync_to_ip,$username,$password,$sync_type,$sync
     $port = $config['system']['webgui']['port'];
     /* if port is empty lets rely on the protocol selection */
     if($port == "") {
-		if($config['system']['webgui']['protocol'] == "http") 
+		if($config['system']['webgui']['protocol'] == "http")
 			$port = "80";
-		else 
+		else
 			$port = "443";
     }
 	$synchronizetoip .= $sync_to_ip;
@@ -948,7 +948,7 @@ function postfix_do_xmlrpc_sync($sync_to_ip,$username,$password,$sync_type,$sync
 			XML_RPC_encode($password),
 			XML_RPC_encode($xml)
 		);
-	
+
 		/* set a few variables needed for sync code borrowed from filter.inc */
 		$url = $synchronizetoip;
 		log_error("Beginning Postfix XMLRPC sync to {$url}:{$port}.");
@@ -973,18 +973,18 @@ function postfix_do_xmlrpc_sync($sync_to_ip,$username,$password,$sync_type,$sync
 		} else {
 			log_error("Postfix XMLRPC sync successfully completed with {$url}:{$port}.");
 		}
-		
+
 		/* tell postfix to reload our settings on the destionation sync host. */
 		$method = 'pfsense.exec_php';
 		$execcmd  = "require_once('/usr/local/pkg/postfix.inc');\n";
 		$execcmd .= "sync_package_postfix('yes');";
-		
+
 		/* assemble xmlrpc payload */
 		$params = array(
 			XML_RPC_encode($password),
 			XML_RPC_encode($execcmd)
 		);
-	
+
 		log_error("postfix XMLRPC reload data {$url}:{$port}.");
 		$msg = new XML_RPC_Message($method, $params);
 		$cli = new XML_RPC_Client('/xmlrpc.php', $url, $port);
-- 
cgit v1.2.3