* eMail: is_a compatibility vs. php5.3.8 resolving to instanceof operator

This commit is contained in:
Klaus Leithoff 2011-09-12 15:26:38 +00:00
parent 711280c17e
commit 7b0942d998
6 changed files with 27 additions and 27 deletions

View File

@ -277,7 +277,7 @@
{ {
if ($this->mailPreferences) { if ($this->mailPreferences) {
$icServer = $this->mailPreferences->getIncomingServer(0); $icServer = $this->mailPreferences->getIncomingServer(0);
if(is_a($icServer,'defaultimap')) { if(($icServer instanceof defaultimap)) {
// if not connected, try opening an admin connection // if not connected, try opening an admin connection
if (!$icServer->_connected) $this->openConnection(0,true); if (!$icServer->_connected) $this->openConnection(0,true);
$icServer->addAccount($_hookValues); $icServer->addAccount($_hookValues);
@ -285,7 +285,7 @@
} }
$ogServer = $this->mailPreferences->getOutgoingServer(0); $ogServer = $this->mailPreferences->getOutgoingServer(0);
if(is_a($ogServer,'defaultsmtp')) { if(($ogServer instanceof defaultsmtp)) {
$ogServer->addAccount($_hookValues); $ogServer->addAccount($_hookValues);
} }
} }
@ -599,7 +599,7 @@
{ {
if ($this->mailPreferences) { if ($this->mailPreferences) {
$icServer = $this->mailPreferences->getIncomingServer(0); $icServer = $this->mailPreferences->getIncomingServer(0);
if(is_a($icServer,'defaultimap')) { if(($icServer instanceof defaultimap)) {
//try to connect with admin rights, when not connected //try to connect with admin rights, when not connected
if (!$icServer->_connected) $this->openConnection(0,true); if (!$icServer->_connected) $this->openConnection(0,true);
$icServer->deleteAccount($_hookValues); $icServer->deleteAccount($_hookValues);
@ -607,7 +607,7 @@
} }
$ogServer = $this->mailPreferences->getOutgoingServer(0); $ogServer = $this->mailPreferences->getOutgoingServer(0);
if(is_a($ogServer,'defaultsmtp')) { if(($ogServer instanceof defaultsmtp)) {
$ogServer->deleteAccount($_hookValues); $ogServer->deleteAccount($_hookValues);
} }
} }
@ -1432,7 +1432,7 @@
// does the folder exist??? // does the folder exist???
$folderInfo = $this->icServer->getMailboxes('', $_folderName, true); $folderInfo = $this->icServer->getMailboxes('', $_folderName, true);
if(is_a($folderInfo, 'PEAR_Error') || !is_array($folderInfo[0])) { if(($folderInfo instanceof PEAR_Error) || !is_array($folderInfo[0])) {
if (self::$debug) error_log(__METHOD__." returned Info for folder $_folderName:".print_r($folderInfo->message,true)); if (self::$debug) error_log(__METHOD__." returned Info for folder $_folderName:".print_r($folderInfo->message,true));
return false; return false;
} }
@ -2085,7 +2085,7 @@
function getHierarchyDelimiter() function getHierarchyDelimiter()
{ {
$HierarchyDelimiter = '/'; $HierarchyDelimiter = '/';
if(is_a($this->icServer,'defaultimap')) if(($this->icServer instanceof defaultimap))
{ {
$HierarchyDelimiter = $this->icServer->getHierarchyDelimiter(); $HierarchyDelimiter = $this->icServer->getHierarchyDelimiter();
if (PEAR::isError($HierarchyDelimiter)) $HierarchyDelimiter = '/'; if (PEAR::isError($HierarchyDelimiter)) $HierarchyDelimiter = '/';
@ -2888,10 +2888,10 @@
//try to connect //try to connect
if (!$this->icServer->_connected) $this->openConnection(); if (!$this->icServer->_connected) $this->openConnection();
} }
if(is_a($this->icServer,'defaultimap')) $folderInfo[$_folder] = $this->icServer->mailboxExist($_folder); if(($this->icServer instanceof defaultimap)) $folderInfo[$_folder] = $this->icServer->mailboxExist($_folder);
//error_log(__METHOD__.__LINE__.' Folder Exists:'.$folderInfo[$_folder]); //error_log(__METHOD__.__LINE__.' Folder Exists:'.$folderInfo[$_folder]);
if(is_a($folderInfo[$_folder], 'PEAR_Error') || $folderInfo[$_folder] !== true) if(($folderInfo[$_folder] instanceof PEAR_Error) || $folderInfo[$_folder] !== true)
{ {
return false; return false;
} else { } else {
@ -3077,12 +3077,12 @@
function updateAccount($_hookValues) function updateAccount($_hookValues)
{ {
if (is_object($this->mailPreferences)) $icServer = $this->mailPreferences->getIncomingServer(0); if (is_object($this->mailPreferences)) $icServer = $this->mailPreferences->getIncomingServer(0);
if(is_a($icServer,'defaultimap')) { if(($icServer instanceof defaultimap)) {
$icServer->updateAccount($_hookValues); $icServer->updateAccount($_hookValues);
} }
if (is_object($this->mailPreferences)) $ogServer = $this->mailPreferences->getOutgoingServer(0); if (is_object($this->mailPreferences)) $ogServer = $this->mailPreferences->getOutgoingServer(0);
if(is_a($ogServer,'defaultsmtp')) { if(($ogServer instanceof defaultsmtp)) {
$ogServer->updateAccount($_hookValues); $ogServer->updateAccount($_hookValues);
} }
} }

View File

@ -42,7 +42,7 @@
self::saveSessionData(); self::saveSessionData();
} }
//error_log(__METHOD__.print_r($this->sessionData,true)); //error_log(__METHOD__.print_r($this->sessionData,true));
if (isset($this->sessionData['profileData']) && is_a($this->sessionData['profileData'],'ea_preferences')) { if (isset($this->sessionData['profileData']) && ($this->sessionData['profileData'] instanceof ea_preferences)) {
$this->profileData = $this->sessionData['profileData']; $this->profileData = $this->sessionData['profileData'];
} }
} }
@ -86,7 +86,7 @@
function getAccountData(&$_profileData, $_accountID=NULL) function getAccountData(&$_profileData, $_accountID=NULL)
{ {
#echo "<p>backtrace: ".function_backtrace()."</p>\n"; #echo "<p>backtrace: ".function_backtrace()."</p>\n";
if(!is_a($_profileData, 'ea_preferences')) if(!($_profileData instanceof ea_preferences))
die(__FILE__.': '.__LINE__); die(__FILE__.': '.__LINE__);
$accountData = parent::getAccountData($GLOBALS['egw_info']['user']['account_id'],$_accountID); $accountData = parent::getAccountData($GLOBALS['egw_info']['user']['account_id'],$_accountID);
@ -136,7 +136,7 @@
function getAllAccountData(&$_profileData) function getAllAccountData(&$_profileData)
{ {
if(!is_a($_profileData, 'ea_preferences')) if(!($_profileData instanceof ea_preferences))
die(__FILE__.': '.__LINE__); die(__FILE__.': '.__LINE__);
$AllAccountData = parent::getAccountData($GLOBALS['egw_info']['user']['account_id'],'all'); $AllAccountData = parent::getAccountData($GLOBALS['egw_info']['user']['account_id'],'all');
#_debug_array($accountData); #_debug_array($accountData);
@ -185,7 +185,7 @@
function getUserDefinedIdentities() function getUserDefinedIdentities()
{ {
$profileData = $this->boemailadmin->getUserProfile('felamimail'); $profileData = $this->boemailadmin->getUserProfile('felamimail');
if(!is_a($profileData, 'ea_preferences') || !is_a($profileData->ic_server[0], 'defaultimap')) { if(!($profileData instanceof ea_preferences) || !($profileData->ic_server[0] instanceof defaultimap)) {
return false; return false;
} }
if($profileData->userDefinedAccounts || $profileData->userDefinedIdentities) { if($profileData->userDefinedAccounts || $profileData->userDefinedIdentities) {
@ -204,14 +204,14 @@
function getPreferences($getUserDefinedProfiles=true) function getPreferences($getUserDefinedProfiles=true)
{ {
if (isset($this->sessionData['profileData']) && is_a($this->sessionData['profileData'],'ea_preferences')) { if (isset($this->sessionData['profileData']) && ($this->sessionData['profileData'] instanceof ea_preferences)) {
$this->profileData = $this->sessionData['profileData']; $this->profileData = $this->sessionData['profileData'];
} }
if(!is_a($this->profileData,'ea_preferences')) { if(!($this->profileData instanceof ea_preferences)) {
$imapServerTypes = $this->boemailadmin->getIMAPServerTypes(); $imapServerTypes = $this->boemailadmin->getIMAPServerTypes();
$profileData = $this->boemailadmin->getUserProfile('felamimail'); $profileData = $this->boemailadmin->getUserProfile('felamimail');
if(!is_a($profileData, 'ea_preferences') || !is_a($profileData->ic_server[0], 'defaultimap')) { if(!($profileData instanceof ea_preferences) || !($profileData->ic_server[0] instanceof defaultimap)) {
return false; return false;
} }
if($profileData->userDefinedAccounts && $GLOBALS['egw_info']['user']['apps']['felamimail'] && $getUserDefinedProfiles) { if($profileData->userDefinedAccounts && $GLOBALS['egw_info']['user']['apps']['felamimail'] && $getUserDefinedProfiles) {
@ -221,15 +221,15 @@
if($accountData['active']) { if($accountData['active']) {
// replace the global defined IMAP Server // replace the global defined IMAP Server
if(is_a($accountData['icServer'],'defaultimap')) if(($accountData['icServer'] instanceof defaultimap))
$profileData->setIncomingServer($accountData['icServer'],0); $profileData->setIncomingServer($accountData['icServer'],0);
// replace the global defined SMTP Server // replace the global defined SMTP Server
if(is_a($accountData['ogServer'],'defaultsmtp')) if(($accountData['ogServer'] instanceof defaultsmtp))
$profileData->setOutgoingServer($accountData['ogServer'],0); $profileData->setOutgoingServer($accountData['ogServer'],0);
// replace the global defined identity // replace the global defined identity
if(is_a($accountData['identity'],'ea_identity')) { if(($accountData['identity'] instanceof ea_identity)) {
//_debug_array($profileData); //_debug_array($profileData);
$rememberIdentities = $profileData->identities; $rememberIdentities = $profileData->identities;
$profileData->setIdentity($accountData['identity'],0); $profileData->setIdentity($accountData['identity'],0);

View File

@ -719,7 +719,7 @@ class felamimail_hooks
} }
if (is_object($preferences)) $icServer = $preferences->getIncomingServer(0); if (is_object($preferences)) $icServer = $preferences->getIncomingServer(0);
if(is_a($icServer, 'defaultimap')) { if(($icServer instanceof defaultimap)) {
if($icServer->enableSieve) if($icServer->enableSieve)
{ {
$linkData = array $linkData = array
@ -748,7 +748,7 @@ class felamimail_hooks
} }
if (is_object($preferences)) $ogServer = $preferences->getOutgoingServer(0); if (is_object($preferences)) $ogServer = $preferences->getOutgoingServer(0);
if(is_a($ogServer, 'defaultsmtp')) { if(($ogServer instanceof defaultsmtp)) {
if($ogServer->editForwardingAddress) if($ogServer->editForwardingAddress)
{ {
$linkData = array $linkData = array

View File

@ -546,7 +546,7 @@
$refreshURL = $GLOBALS['egw']->link('/index.php',$linkData); $refreshURL = $GLOBALS['egw']->link('/index.php',$linkData);
$this->t->set_var('reloadView',$refreshURL); $this->t->set_var('reloadView',$refreshURL);
// display a warning if vacation notice is active // display a warning if vacation notice is active
if(is_a($imapServer,'defaultimap') && $imapServer->enableSieve) { if(($imapServer instanceof defaultimap) && $imapServer->enableSieve) {
$imapServer->retrieveRules($imapServer->scriptName); $imapServer->retrieveRules($imapServer->scriptName);
$vacation = $imapServer->getVacation($imapServer->scriptName); $vacation = $imapServer->getVacation($imapServer->scriptName);
//_debug_array($vacation); //_debug_array($vacation);

View File

@ -123,7 +123,7 @@ require_once(EGW_INCLUDE_ROOT.'/felamimail/inc/class.felamimail_bosignatures.inc
$mailPrefs = $this->bofelamimail->getMailPreferences(); $mailPrefs = $this->bofelamimail->getMailPreferences();
$ogServer = $mailPrefs->getOutgoingServer(0); $ogServer = $mailPrefs->getOutgoingServer(0);
if(!is_a($ogServer, 'defaultsmtp') || !$ogServer->editForwardingAddress) { if(!($ogServer instanceof defaultsmtp) || !$ogServer->editForwardingAddress) {
die('You should not be here!'); die('You should not be here!');
} }

View File

@ -87,9 +87,9 @@
$icServer = $this->bofelamimail->icServer; $icServer = $this->bofelamimail->icServer;
if(is_a($icServer,'defaultimap') && $icServer->enableSieve) { if(($icServer instanceof defaultimap) && $icServer->enableSieve) {
$this->bosieve = $icServer; $this->bosieve = $icServer;
$this->timed_vacation = is_a($icServer,'cyrusimap') && $icServer->enableCyrusAdmin && $this->timed_vacation = ($icServer instanceof cyrusimap) && $icServer->enableCyrusAdmin &&
$icServer->adminUsername && $icServer->adminPassword; $icServer->adminUsername && $icServer->adminPassword;
} else { } else {
die('Sieve not activated'); die('Sieve not activated');
@ -584,7 +584,7 @@
$newVacation['status'] = get_var('vacationStatus',array('POST')); $newVacation['status'] = get_var('vacationStatus',array('POST'));
if (empty($preferences->preferences['prefpreventforwarding']) || if (empty($preferences->preferences['prefpreventforwarding']) ||
$preferences->preferences['prefpreventforwarding'] == 0 ) # || $preferences->preferences['prefpreventforwarding'] == 0 ) # ||
#is_a($ogServer, 'defaultsmtp') || $ogServer->editForwardingAddress) #($ogServer instanceof defaultsmtp) || $ogServer->editForwardingAddress)
{ {
$newVacation['forwards'] = get_var('vacation_forwards',array('POST')); $newVacation['forwards'] = get_var('vacation_forwards',array('POST'));
} }