R48738 - /trunk/emailadmin/inc/class.emailadmin_account.inc.php

Author: ralfbecker
New Revision: 48738

URL: http://svn.stylite.de/viewvc/egroupware?rev=48738&view=rev
Log:
it is quicker to try connection, assuming we want to do that anyway, instead of reading user-data

Modified:
trunk/emailadmin/inc/class.emailadmin_account.inc.php

Modified: trunk/emailadmin/inc/class.emailadmin_account.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/emailadmin/inc/class.emailadmin_account.inc.php?rev=48738&r1=48737&r2=48738&view=diff

— trunk/emailadmin/inc/class.emailadmin_account.inc.php (original)
+++ trunk/emailadmin/inc/class.emailadmin_account.inc.php Thu Sep 25 10:34:20 2014
@@ -308,13 +308,35 @@
*
* Checks if an imap host, username and for managaged mail-servers accountStatus=“active” and NOT deliveryMode=“forwardOnly” is set
*

    • return boolean
  • */
  • public function is_imap()
  • {
  •   return !empty($this->acc_imap_host) && !empty($this->acc_imap_username) && !empty($this->acc_imap_password) &&
    
  •   	($this->acc_smtp_type == 'emailadmin_smtp' ||
    
  •   		$this->deliveryMode != emailadmin_smtp::FORWARD_ONLY && $this->accountStatus == emailadmin_smtp::MAIL_ENABLED);
    
    • @param boolean $try_connect =true true: try connecting for validation, false: read user-data to determine it’s imap
    • (matters only for imap servers managed by EGroupware!)
    • @return boolean
  • */

  • public function is_imap($try_connect=true)

  • {

  •   if (empty($this->acc_imap_host) || empty($this->acc_imap_username) || empty($this->acc_imap_password))
    
  •   {
    
  •   	return false;	// no imap host or credentials
    
  •   }
    
  •   // if we are not managing the mail-server, we do NOT need to check deliveryMode and accountStatus
    
  •   if ($this->acc_smtp_type == 'emailadmin_smtp')
    
  •   {
    
  •   	return true;
    
  •   }
    
  •   // it is quicker to try connection, assuming we want to do that anyway, instead of reading user-data
    
  •   if ($try_connect)
    
  •   {
    
  •   	// as querying user-data is a lot slower then just trying to connect, and we need probably need to connect anyway, we try that
    
  •   	$imap = $this->imapserver();
    
  •   	try {
    
  •   		$imap->login();
    
  •   		return true;
    
  •   	}
    
  •   	catch (Exception $ex) {
    
  •   		unset($ex);
    
  •   	}
    
  •   }
    
  •   return $this->deliveryMode != emailadmin_smtp::FORWARD_ONLY && $this->accountStatus == emailadmin_smtp::MAIL_ENABLED;
    

    }

    /**


Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk


eGroupWare-cvs mailing list
eGroupWare-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/egroupware-cvs