From 7b0942d99853ab3b2b614da5c08f16c043d26558 Mon Sep 17 00:00:00 2001 From: Klaus Leithoff Date: Mon, 12 Sep 2011 15:26:38 +0000 Subject: [PATCH] * eMail: is_a compatibility vs. php5.3.8 resolving to instanceof operator --- felamimail/inc/class.bofelamimail.inc.php | 20 +++++++++---------- felamimail/inc/class.bopreferences.inc.php | 20 +++++++++---------- felamimail/inc/class.felamimail_hooks.inc.php | 4 ++-- felamimail/inc/class.uifelamimail.inc.php | 2 +- felamimail/inc/class.uipreferences.inc.php | 2 +- felamimail/inc/class.uisieve.inc.php | 6 +++--- 6 files changed, 27 insertions(+), 27 deletions(-) diff --git a/felamimail/inc/class.bofelamimail.inc.php b/felamimail/inc/class.bofelamimail.inc.php index baeb2cfe23..0bc5511b9d 100644 --- a/felamimail/inc/class.bofelamimail.inc.php +++ b/felamimail/inc/class.bofelamimail.inc.php @@ -277,7 +277,7 @@ { if ($this->mailPreferences) { $icServer = $this->mailPreferences->getIncomingServer(0); - if(is_a($icServer,'defaultimap')) { + if(($icServer instanceof defaultimap)) { // if not connected, try opening an admin connection if (!$icServer->_connected) $this->openConnection(0,true); $icServer->addAccount($_hookValues); @@ -285,7 +285,7 @@ } $ogServer = $this->mailPreferences->getOutgoingServer(0); - if(is_a($ogServer,'defaultsmtp')) { + if(($ogServer instanceof defaultsmtp)) { $ogServer->addAccount($_hookValues); } } @@ -599,7 +599,7 @@ { if ($this->mailPreferences) { $icServer = $this->mailPreferences->getIncomingServer(0); - if(is_a($icServer,'defaultimap')) { + if(($icServer instanceof defaultimap)) { //try to connect with admin rights, when not connected if (!$icServer->_connected) $this->openConnection(0,true); $icServer->deleteAccount($_hookValues); @@ -607,7 +607,7 @@ } $ogServer = $this->mailPreferences->getOutgoingServer(0); - if(is_a($ogServer,'defaultsmtp')) { + if(($ogServer instanceof defaultsmtp)) { $ogServer->deleteAccount($_hookValues); } } @@ -1432,7 +1432,7 @@ // does the folder exist??? $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)); return false; } @@ -2085,7 +2085,7 @@ function getHierarchyDelimiter() { $HierarchyDelimiter = '/'; - if(is_a($this->icServer,'defaultimap')) + if(($this->icServer instanceof defaultimap)) { $HierarchyDelimiter = $this->icServer->getHierarchyDelimiter(); if (PEAR::isError($HierarchyDelimiter)) $HierarchyDelimiter = '/'; @@ -2888,10 +2888,10 @@ //try to connect 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]); - if(is_a($folderInfo[$_folder], 'PEAR_Error') || $folderInfo[$_folder] !== true) + if(($folderInfo[$_folder] instanceof PEAR_Error) || $folderInfo[$_folder] !== true) { return false; } else { @@ -3077,12 +3077,12 @@ function updateAccount($_hookValues) { if (is_object($this->mailPreferences)) $icServer = $this->mailPreferences->getIncomingServer(0); - if(is_a($icServer,'defaultimap')) { + if(($icServer instanceof defaultimap)) { $icServer->updateAccount($_hookValues); } if (is_object($this->mailPreferences)) $ogServer = $this->mailPreferences->getOutgoingServer(0); - if(is_a($ogServer,'defaultsmtp')) { + if(($ogServer instanceof defaultsmtp)) { $ogServer->updateAccount($_hookValues); } } diff --git a/felamimail/inc/class.bopreferences.inc.php b/felamimail/inc/class.bopreferences.inc.php index 2bb9cbb869..1af9b7ebab 100644 --- a/felamimail/inc/class.bopreferences.inc.php +++ b/felamimail/inc/class.bopreferences.inc.php @@ -42,7 +42,7 @@ self::saveSessionData(); } //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']; } } @@ -86,7 +86,7 @@ function getAccountData(&$_profileData, $_accountID=NULL) { #echo "

backtrace: ".function_backtrace()."

\n"; - if(!is_a($_profileData, 'ea_preferences')) + if(!($_profileData instanceof ea_preferences)) die(__FILE__.': '.__LINE__); $accountData = parent::getAccountData($GLOBALS['egw_info']['user']['account_id'],$_accountID); @@ -136,7 +136,7 @@ function getAllAccountData(&$_profileData) { - if(!is_a($_profileData, 'ea_preferences')) + if(!($_profileData instanceof ea_preferences)) die(__FILE__.': '.__LINE__); $AllAccountData = parent::getAccountData($GLOBALS['egw_info']['user']['account_id'],'all'); #_debug_array($accountData); @@ -185,7 +185,7 @@ function getUserDefinedIdentities() { $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; } if($profileData->userDefinedAccounts || $profileData->userDefinedIdentities) { @@ -204,14 +204,14 @@ 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']; } - if(!is_a($this->profileData,'ea_preferences')) { + if(!($this->profileData instanceof ea_preferences)) { $imapServerTypes = $this->boemailadmin->getIMAPServerTypes(); $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; } if($profileData->userDefinedAccounts && $GLOBALS['egw_info']['user']['apps']['felamimail'] && $getUserDefinedProfiles) { @@ -221,15 +221,15 @@ if($accountData['active']) { // replace the global defined IMAP Server - if(is_a($accountData['icServer'],'defaultimap')) + if(($accountData['icServer'] instanceof defaultimap)) $profileData->setIncomingServer($accountData['icServer'],0); // replace the global defined SMTP Server - if(is_a($accountData['ogServer'],'defaultsmtp')) + if(($accountData['ogServer'] instanceof defaultsmtp)) $profileData->setOutgoingServer($accountData['ogServer'],0); // replace the global defined identity - if(is_a($accountData['identity'],'ea_identity')) { + if(($accountData['identity'] instanceof ea_identity)) { //_debug_array($profileData); $rememberIdentities = $profileData->identities; $profileData->setIdentity($accountData['identity'],0); diff --git a/felamimail/inc/class.felamimail_hooks.inc.php b/felamimail/inc/class.felamimail_hooks.inc.php index 8703a44d37..2856b7365c 100644 --- a/felamimail/inc/class.felamimail_hooks.inc.php +++ b/felamimail/inc/class.felamimail_hooks.inc.php @@ -719,7 +719,7 @@ class felamimail_hooks } if (is_object($preferences)) $icServer = $preferences->getIncomingServer(0); - if(is_a($icServer, 'defaultimap')) { + if(($icServer instanceof defaultimap)) { if($icServer->enableSieve) { $linkData = array @@ -748,7 +748,7 @@ class felamimail_hooks } if (is_object($preferences)) $ogServer = $preferences->getOutgoingServer(0); - if(is_a($ogServer, 'defaultsmtp')) { + if(($ogServer instanceof defaultsmtp)) { if($ogServer->editForwardingAddress) { $linkData = array diff --git a/felamimail/inc/class.uifelamimail.inc.php b/felamimail/inc/class.uifelamimail.inc.php index 475baf5ede..950e66a6ce 100644 --- a/felamimail/inc/class.uifelamimail.inc.php +++ b/felamimail/inc/class.uifelamimail.inc.php @@ -546,7 +546,7 @@ $refreshURL = $GLOBALS['egw']->link('/index.php',$linkData); $this->t->set_var('reloadView',$refreshURL); // 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); $vacation = $imapServer->getVacation($imapServer->scriptName); //_debug_array($vacation); diff --git a/felamimail/inc/class.uipreferences.inc.php b/felamimail/inc/class.uipreferences.inc.php index bd65c53342..ca6c48cc2e 100644 --- a/felamimail/inc/class.uipreferences.inc.php +++ b/felamimail/inc/class.uipreferences.inc.php @@ -123,7 +123,7 @@ require_once(EGW_INCLUDE_ROOT.'/felamimail/inc/class.felamimail_bosignatures.inc $mailPrefs = $this->bofelamimail->getMailPreferences(); $ogServer = $mailPrefs->getOutgoingServer(0); - if(!is_a($ogServer, 'defaultsmtp') || !$ogServer->editForwardingAddress) { + if(!($ogServer instanceof defaultsmtp) || !$ogServer->editForwardingAddress) { die('You should not be here!'); } diff --git a/felamimail/inc/class.uisieve.inc.php b/felamimail/inc/class.uisieve.inc.php index b553bfd9ae..bdacdd5b41 100644 --- a/felamimail/inc/class.uisieve.inc.php +++ b/felamimail/inc/class.uisieve.inc.php @@ -87,9 +87,9 @@ $icServer = $this->bofelamimail->icServer; - if(is_a($icServer,'defaultimap') && $icServer->enableSieve) { + if(($icServer instanceof defaultimap) && $icServer->enableSieve) { $this->bosieve = $icServer; - $this->timed_vacation = is_a($icServer,'cyrusimap') && $icServer->enableCyrusAdmin && + $this->timed_vacation = ($icServer instanceof cyrusimap) && $icServer->enableCyrusAdmin && $icServer->adminUsername && $icServer->adminPassword; } else { die('Sieve not activated'); @@ -584,7 +584,7 @@ $newVacation['status'] = get_var('vacationStatus',array('POST')); if (empty($preferences->preferences['prefpreventforwarding']) || $preferences->preferences['prefpreventforwarding'] == 0 ) # || - #is_a($ogServer, 'defaultsmtp') || $ogServer->editForwardingAddress) + #($ogServer instanceof defaultsmtp) || $ogServer->editForwardingAddress) { $newVacation['forwards'] = get_var('vacation_forwards',array('POST')); }