From ba0fe9a9eb651b498c29017412f94d27c6383256 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Wed, 19 Nov 2014 20:30:06 +0000 Subject: [PATCH] explicitly set login-type from mail-account for smtp plugins, otherwise we depend on no longer updated config from setup --- emailadmin/inc/class.emailadmin_account.inc.php | 7 ++----- emailadmin/inc/class.emailadmin_bo.inc.php | 1 - emailadmin/inc/class.emailadmin_smtp.inc.php | 6 ++++-- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/emailadmin/inc/class.emailadmin_account.inc.php b/emailadmin/inc/class.emailadmin_account.inc.php index 132004dcdd..1cd20db551 100644 --- a/emailadmin/inc/class.emailadmin_account.inc.php +++ b/emailadmin/inc/class.emailadmin_account.inc.php @@ -434,6 +434,7 @@ class emailadmin_account implements ArrayAccess $smtp->username = $params['acc_smtp_username']; $smtp->password = $params['acc_smtp_password']; $smtp->defaultDomain = $params['acc_domain']; + $smtp->loginType = $params['acc_imap_login_type']; return $smtp; } @@ -1317,7 +1318,6 @@ class emailadmin_account implements ArrayAccess */ static function get_default_acc_id($smtp=false) { - //error_log(__METHOD__.__LINE__.'Smtp?'.array2string($smtp)); try { foreach(emailadmin_account::search(true, 'params') as $acc_id => $params) @@ -1326,8 +1326,6 @@ class emailadmin_account implements ArrayAccess { if (!$params['acc_smtp_host'] || !$params['acc_smtp_port']) continue; // check requirement of session, which is not available in async service! - //error_log(__METHOD__.__LINE__.array2string($params)); - //error_log(__METHOD__.__LINE__.'is async:'.array2string($GLOBALS['egw_info']['flags']['async-service'])); if (isset($GLOBALS['egw_info']['flags']['async-service'])) { if ($params['acc_smtp_auth_session']) continue; @@ -1338,17 +1336,16 @@ class emailadmin_account implements ArrayAccess } catch (Exception $x) { + unset($x); continue; } if ($account->acc_smtp_pw_enc == emailadmin_credentials::USER) continue; - //error_log(__METHOD__.__LINE__.array2string($account->params)); } } else { if (!$params['acc_imap_host'] || !$params['acc_imap_port']) continue; $account = new emailadmin_account($params); - //error_log(__METHOD__.__LINE__.' '.$acc_id.':'.array2string($account)); // continue if we have either no imap username or password if (!$account->is_imap()) continue; } diff --git a/emailadmin/inc/class.emailadmin_bo.inc.php b/emailadmin/inc/class.emailadmin_bo.inc.php index 08b133477f..aead61a848 100644 --- a/emailadmin/inc/class.emailadmin_bo.inc.php +++ b/emailadmin/inc/class.emailadmin_bo.inc.php @@ -52,7 +52,6 @@ class emailadmin_bo function __construct($_profileID=false,$_restoreSesssion=true) { - parent::__construct(self::APP,self::TABLE,null,'',true); //error_log(__METHOD__.function_backtrace()); if (!is_object($GLOBALS['emailadmin_bo'])) { diff --git a/emailadmin/inc/class.emailadmin_smtp.inc.php b/emailadmin/inc/class.emailadmin_smtp.inc.php index 46171c53c6..99ffd9815a 100644 --- a/emailadmin/inc/class.emailadmin_smtp.inc.php +++ b/emailadmin/inc/class.emailadmin_smtp.inc.php @@ -67,6 +67,8 @@ class emailadmin_smtp var $defaultDomain; + var $loginType; + /** * Constructor * @@ -214,13 +216,13 @@ class emailadmin_smtp * @param int|array $account account_id or whole account array with values for keys * @param string $domain=null domain, default use $this->defaultDomain * @param string $mail_login_type=null standard(uid), vmailmgr(uid@domain), email or uidNumber, - * default use $GLOBALS['egw_info']['server']['mail_login_type'] + * default use $this->loginType * @return string */ /*static*/ public function mailbox_addr($account,$domain=null,$mail_login_type=null) { if (is_null($domain)) $domain = $this->defaultDomain; - if (is_null($mail_login_type)) $mail_login_type = $GLOBALS['egw_info']['server']['mail_login_type']; + if (is_null($mail_login_type)) $mail_login_type = $this->loginType; switch($mail_login_type) {