* Email: remove option to reset cached objects; reset Cached Objects on account-edit

This commit is contained in:
Klaus Leithoff 2014-04-23 09:18:50 +00:00
parent d1151d876e
commit b61c69f3dc
3 changed files with 8 additions and 143 deletions

View File

@ -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)

View File

@ -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 "<h2>".lang('Test Connection and display basic information about the selected profile')."</h2>";
_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 "<hr /><h3 style='color:red'>".lang('IMAP Server')."</h3>";
$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 "<h4 style='color:red'>".lang('Connection Status')."</h4>";
$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 "<h4 style='color:red'>".lang('Sieve Connection Status')."</h4>";
$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 "<hr /><h3 style='color:red'>".lang('Preferences')."</h3>";
_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
*

View File

@ -71,13 +71,6 @@
</td>
<td>{call_mail_hooks::deny_absentnotice}</td>
</tr>
<tr class="row_on">
<td>
<b>{lang_Test_connection}</b><br/>
{lang_Show_Test_Connection_section_and_control_the_level_of_info_displayed??}
</td>
<td>{call_mail_hooks::deny_testconnection}</td>
</tr>
<tr class="row_on">
<td>
<b>{lang_restrict_acl_management}</b><br/>