Skip to content

Commit ccc7e75

Browse files
author
jwarnier
committed
replace double-quotes with single-quotes whenever appropriate and remove exec()s
1 parent 23a9048 commit ccc7e75

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

server/plugins-available/postfix_server_plugin.inc.php

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,13 @@ function update($event_name,$data) {
8080

8181
// get the config
8282
$app->uses("getconf");
83-
$mail_config = $app->getconf->get_server_config($conf["server_id"], 'mail');
83+
$mail_config = $app->getconf->get_server_config($conf['server_id'], 'mail');
8484

8585
copy('/etc/postfix/main.cf','/etc/postfix/main.cf~');
8686

87-
if($mail_config["relayhost"] != '') {
88-
exec("postconf -e 'relayhost = ".$mail_config["relayhost"]."'");
89-
if($mail_config["relayhost_user"] != '' && $mail_config["relayhost_password"] != '') {
87+
if($mail_config['relayhost'] != '') {
88+
exec("postconf -e 'relayhost = ".$mail_config['relayhost']."'");
89+
if($mail_config['relayhost_user'] != '' && $mail_config['relayhost_password'] != '') {
9090
exec("postconf -e 'smtp_sasl_auth_enable = yes'");
9191
} else {
9292
exec("postconf -e 'smtp_sasl_auth_enable = no'");
@@ -95,22 +95,23 @@ function update($event_name,$data) {
9595
exec("postconf -e 'smtp_sasl_security_options ='");
9696

9797
// Store the sasl passwd
98-
$content = $mail_config["relayhost"]." ".$mail_config["relayhost_user"].":".$mail_config["relayhost_password"];
98+
$content = $mail_config['relayhost'].' '.$mail_config['relayhost_user'].':'.$mail_config['relayhost_password'];
9999
file_put_contents('/etc/postfix/sasl_passwd',$content);
100-
exec("chown root:root /etc/postfix/sasl_passwd");
101-
exec("chmod 600 /etc/postfix/sasl_passwd");
102-
exec("postmap /etc/postfix/sasl_passwd");
103-
exec("/etc/init.d/postfix restart");
100+
chmod('/etc/postfix/sasl_passwd', 0600);
101+
chown('/etc/postfix/sasl_passwd', 'root');
102+
chgrp('/etc/postfix/sasl_passwd', 'root');
103+
exec('postmap /etc/postfix/sasl_passwd');
104+
exec($conf['init_scripts'] . '/' . 'postfix restart');
104105

105106
} else {
106107
exec("postconf -e 'relayhost ='");
107108
}
108109

109-
exec("postconf -e 'mailbox_size_limit = ".intval($mail_config["mailbox_size_limit"]*1024*1024)."'");
110-
exec("postconf -e 'message_size_limit = ".intval($mail_config["message_size_limit"]*1024*1024)."'");
110+
exec("postconf -e 'mailbox_size_limit = ".intval($mail_config['mailbox_size_limit']*1024*1024)."'");
111+
exec("postconf -e 'message_size_limit = ".intval($mail_config['message_size_limit']*1024*1024)."'");
111112

112113
}
113114

114115
} // end class
115116

116-
?>
117+
?>

0 commit comments

Comments
 (0)