functions.inc.php:

- smtp_get_admin_email(), domain_postcreation(), domain_postdeletion(): 
  use Config::read instead of $CONF
- smtp_get_response(): whitespace fixes



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1532 a1433add-5e2c-0410-b055-b7f2511e0802
pull/2/head
Christian Boltz 11 years ago
parent ba7ebe7adb
commit 43f2591d93

@ -1158,9 +1158,9 @@ function smtp_mail ($to, $from, $data, $body = "") {
* @return String - username/mail address * @return String - username/mail address
*/ */
function smtp_get_admin_email() { function smtp_get_admin_email() {
global $CONF; $admin_email = Config::read('admin_email');
if(isset($CONF['admin_email']) && !empty($CONF['admin_email'])) if(!empty($admin_email))
return $CONF['admin_email']; return $admin_email;
else else
return authentication_get_username(); return authentication_get_username();
} }
@ -1174,11 +1174,11 @@ function smtp_get_admin_email() {
function smtp_get_response ($fh) { function smtp_get_response ($fh) {
$res =''; $res ='';
do { do {
$line = fgets($fh, 256); $line = fgets($fh, 256);
$res .= $line; $res .= $line;
} }
while (preg_match("/^\d\d\d\-/", $line)); while (preg_match("/^\d\d\d\-/", $line));
return $res; return $res;
} }
@ -1644,13 +1644,11 @@ function mailbox_postdeletion($username,$domain) {
Returns: boolean. Returns: boolean.
*/ */
# TODO: move to DomainHandler # TODO: move to DomainHandler
# TODO: use Config::read instead of $CONF
# TODO: replace "print" with $this->errormsg (or infomsg?) # TODO: replace "print" with $this->errormsg (or infomsg?)
function domain_postcreation($domain) { function domain_postcreation($domain) {
global $CONF; $script=Config::read('domain_postcreation_script');
$confpar='domain_postcreation_script';
if (!isset($CONF[$confpar]) || empty($CONF[$confpar])) { if (empty($script)) {
return true; return true;
} }
@ -1660,7 +1658,7 @@ function domain_postcreation($domain) {
} }
$cmdarg1=escapeshellarg($domain); $cmdarg1=escapeshellarg($domain);
$command=$CONF[$confpar]." $cmdarg1"; $command= "$script $cmdarg1";
$retval=0; $retval=0;
$output=array(); $output=array();
$firstline=''; $firstline='';
@ -1679,13 +1677,11 @@ function domain_postcreation($domain) {
Returns: boolean. Returns: boolean.
*/ */
# TODO: move to DomainHandler (after moving the delete code there) # TODO: move to DomainHandler (after moving the delete code there)
# TODO: use Config::read instead of $CONF
# TODO: replace "print" with $this->errormsg (or infomsg?) # TODO: replace "print" with $this->errormsg (or infomsg?)
function domain_postdeletion($domain) { function domain_postdeletion($domain) {
global $CONF; $script=Config::read('domain_postdeletion_script');
$confpar='domain_postdeletion_script';
if (!isset($CONF[$confpar]) || empty($CONF[$confpar])) { if (empty($script)) {
return true; return true;
} }
@ -1695,7 +1691,7 @@ function domain_postdeletion($domain) {
} }
$cmdarg1=escapeshellarg($domain); $cmdarg1=escapeshellarg($domain);
$command=$CONF[$confpar]." $cmdarg1"; $command= "$script $cmdarg1";
$retval=0; $retval=0;
$output=array(); $output=array();
$firstline=''; $firstline='';

Loading…
Cancel
Save