From b61c69f3dc21d11daa42097cae808a80d2e45a73 Mon Sep 17 00:00:00 2001 From: Klaus Leithoff Date: Wed, 23 Apr 2014 09:18:50 +0000 Subject: [PATCH] * Email: remove option to reset cached objects; reset Cached Objects on account-edit --- mail/inc/class.mail_hooks.inc.php | 34 +++------ mail/inc/class.mail_ui.inc.php | 110 ------------------------------ mail/templates/default/config.tpl | 7 -- 3 files changed, 8 insertions(+), 143 deletions(-) diff --git a/mail/inc/class.mail_hooks.inc.php b/mail/inc/class.mail_hooks.inc.php index f940d7da4c..3c04de614c 100644 --- a/mail/inc/class.mail_hooks.inc.php +++ b/mail/inc/class.mail_hooks.inc.php @@ -123,15 +123,6 @@ class mail_hooks $prefAllowManageFolders = $no_yes; - $test_connection = array( - 'full' => lang('yes, show all debug information available for the user'), - 'nocredentials' => lang('yes, but mask all usernames and passwords'), - 'nopasswords' => lang('yes, but mask all passwords'), - 'basic' => lang('yes, show basic info only'), - 'reset' => lang('yes, only trigger connection reset'), - 'none' => lang('no'), - ); - $forwardOptions = array( 'asmail' => lang('forward as attachment'), 'inline' => lang('forward inline'), @@ -454,16 +445,7 @@ class mail_hooks 'admin' => False, 'forced' => '0', ), - 'prefcontroltestconnection' => array( - 'type' => 'select', - 'label' => 'Test connection', - 'help' => 'Show Test Connection section and control the level of info displayed?', - 'name' => 'prefcontroltestconnection', - 'values' => $test_connection, - 'xmlrpc' => True, - 'admin' => False, - 'forced' => '0', - ),*/ + */ 'prefaskformove' => array( 'type' => 'select', 'label' => 'Confirm move to folder', @@ -592,10 +574,6 @@ class mail_hooks "','_blank',640,480,'yes')", ); } - if (self::access('testconnection')) - { - $file['Test Connection'] = egw::link('/index.php','menuaction=mail.mail_ui.TestConnection&appname=mail'); - } // display them all display_sidebox($appname,$menu_title,$file); /* @@ -665,11 +643,15 @@ class mail_hooks $preferences = $prefs->read(); // TODO: no possibility to set that at this time; always use INBOX if (empty($preferences['mail']['notify_folders'])) return true;//$preferences['mail']['notify_folders']='INBOX'; - //error_log(__METHOD__.__LINE__.array2string($preferences['mail']['notify_folders'])); +/* //error_log(__METHOD__.__LINE__.array2string($preferences['mail']['notify_folders'])); if(!isset($preferences['mail']['notify_folders'])||empty($preferences['mail']['notify_folders'])||$preferences['mail']['notify_folders']=='none') { return true; //no pref set for notifying - exit } - $notify_folders = explode(',', $preferences['mail']['notify_folders']); +*/ + foreach(emailadmin_account::search($only_current_user=true, $just_name=true) as $acc_id => $identity_name) + { + $folders2notify[$acc_id] = emailadmin_notifications::read($acc_id,$GLOBALS['egw_info']['user']['account_id']); + } if(count($notify_folders) == 0) { return true; //no folders configured for notifying - exit } @@ -786,7 +768,7 @@ class mail_hooks * Example: if (!mail_hooks::access("managerfolders")) return; * * @param string $feature "createaccounts", "managefolders", "forwards", "notifications", "filters", - * "notificationformailviaemail", "editfilterrules", "absentnotice", "testconnection", "aclmanagement" + * "notificationformailviaemail", "editfilterrules", "absentnotice", "aclmanagement" * @return boolean true if user has access, false if not */ public static function access($feature) diff --git a/mail/inc/class.mail_ui.inc.php b/mail/inc/class.mail_ui.inc.php index 4a18c690fc..db059bdc4b 100644 --- a/mail/inc/class.mail_ui.inc.php +++ b/mail/inc/class.mail_ui.inc.php @@ -35,7 +35,6 @@ class mail_ui 'loadEmailBody' => True, 'importMessage' => True, 'importMessageFromVFS2DraftAndDisplay'=>True, - 'TestConnection' => True, 'subscription' => True, ); @@ -641,115 +640,6 @@ class mail_ui return $etpl->exec('mail.mail_ui.index',$content,$sel_options,$readonlys,$preserv); } - /** - * Test Connection - * Simple Test, resets the active connections cachedObjects / ImapServer - */ - function TestConnection () - { - // load translations - translation::add_app('mail'); - - common::egw_header(); - parse_navbar(); - //$GLOBALS['egw']->framework->sidebox(); - //$GLOBALS['egw_info']['user']['preferences']['mail']; - $preferences =& $this->mail_bo->mailPreferences; - - if ($preferences['prefcontroltestconnection'] == 'none') die('You should not be here!'); - - if (isset($GLOBALS['egw_info']['user']['preferences']['mail']['ActiveProfileID'])) - $icServerID = (int)$GLOBALS['egw_info']['user']['preferences']['mail']['ActiveProfileID']; - //_debug_array($this->mail_bo->mailPreferences); - if (is_object($preferences)) $imapServer = $this->mail_bo->icServer; - if (isset($imapServer->ImapServerId) && !empty($imapServer->ImapServerId)) - { - $icServerID = $GLOBALS['egw_info']['user']['preferences']['mail']['ActiveProfileID'] = $imapServer->ImapServerId; - } - echo "

".lang('Test Connection and display basic information about the selected profile')."

"; - - _debug_array('Connection Reset triggered:'.$connectionReset.' for Profile with ID:'.$icServerID); - emailadmin_imapbase::unsetCachedObjects($icServerID); -/* - if (mail_bo::$idna2) - { - _debug_array('Umlautdomains supported (see Example below)'); - $dom = 'füßler.com'; - $encDom = mail_bo::$idna2->encode($dom); - _debug_array(array('source'=>$dom,'result'=>array('encoded'=>$encDom,'decoded'=>mail_bo::$idna2->decode($encDom)))); - } -*/ - if ($preferences['prefcontroltestconnection'] == 'reset') exit; - - echo "

".lang('IMAP Server')."

"; - - $this->mail_bo->reopen('INBOX'); -/* - unset($imapServer->_connectionErrorObject); - $sieveServer = clone $imapServer; -*/ - if (!empty($imapServer->adminPassword)) $imapServer->adminPassword='**********************'; - if ($preferences['prefcontroltestconnection'] == 'nopasswords' || $preferences['prefcontroltestconnection'] == 'nocredentials') - { - if (!empty($imapServer->password)) $imapServer->password='**********************'; - } - if ($preferences['prefcontroltestconnection'] == 'nocredentials') - { - if (!empty($imapServer->adminUsername)) $imapServer->adminUsername='++++++++++++++++++++++'; - if (!empty($imapServer->username)) $imapServer->username='++++++++++++++++++++++'; - if (!empty($imapServer->loginName)) $imapServer->loginName='++++++++++++++++++++++'; - } - if ($preferences['prefcontroltestconnection'] <> 'basic') - { - _debug_array($imapServer); - } - else - { - _debug_array(array('ImapServerId' =>$imapServer->ImapServerId, - 'host'=>$imapServer->acc_imap_host, - 'port'=>$imapServer->acc_imap_port, - 'validatecert'=>$imapServer->validatecert)); - } - - echo "

".lang('Connection Status')."

"; - $lE = false; - if ($eO && $eO->message) - { - _debug_array($eO->message); - $lE = true; - } - _debug_array(($lE?'':lang('Successfully connected'))); - - $suF = $this->mail_bo->getSpecialUseFolders(); - if (is_array($suF) && !empty($suF)) _debug_array(array(lang('Server supports Special-Use Folders')=>$suF)); - - $sievebo = mail_bo::getInstance(false, $icServerID, false, $oldIMAPObject=true); - $sieveServer = $sievebo->icServer; - if(($sieveServer instanceof defaultimap) && $sieveServer->enableSieve) { - $scriptName = (!empty($GLOBALS['egw_info']['user']['preferences']['mail']['sieveScriptName'])) ? $GLOBALS['egw_info']['user']['preferences']['mail']['sieveScriptName'] : 'felamimail'; - $sieveServer->getScript($scriptName); - $rules = $sieveServer->retrieveRules($sieveServer->scriptName,true); - $vacation = $sieveServer->getVacation($sieveServer->scriptName); - echo "

".lang('Sieve Connection Status')."

"; - $isSieveError = egw_cache::getCache(egw_cache::INSTANCE,'email','icServerSIEVE_connectionError'.trim($GLOBALS['egw_info']['user']['account_id']),$callback=null,$callback_params=array(),$expiration=60*15); - if ($isSieveError[$icServerID]) - { - _debug_array($isSieveError[$icServerID]); - } - else - { - _debug_array(array(lang('Successfully connected'),$rules)); - } - } - - echo "

".lang('Preferences')."

"; - _debug_array($preferences); - //error_log(__METHOD__.__LINE__.' ImapServerId:'.$imapServer->ImapServerId.' Prefs:'.array2string($preferences->preferences)); - //error_log(__METHOD__.__LINE__.' ImapServerObject:'.array2string($imapServer)); - - common::egw_footer(); - } - /** * Ajax callback to subscribe / unsubscribe a Mailbox of an account * diff --git a/mail/templates/default/config.tpl b/mail/templates/default/config.tpl index b1b9e1e192..e94b80db7d 100755 --- a/mail/templates/default/config.tpl +++ b/mail/templates/default/config.tpl @@ -71,13 +71,6 @@ {call_mail_hooks::deny_absentnotice} - - - {lang_Test_connection}
- {lang_Show_Test_Connection_section_and_control_the_level_of_info_displayed??} - - {call_mail_hooks::deny_testconnection} - {lang_restrict_acl_management}