fix stuff regarding getSpecialUsefolders and defaultvalue of sievescriptname

This commit is contained in:
Klaus Leithoff 2013-12-17 12:16:11 +00:00
parent d82075e86b
commit 491495e32d
5 changed files with 25 additions and 17 deletions

View File

@ -821,8 +821,14 @@ class mail_bo
if(($this->hasCapability('SPECIAL-USE')))
{
//error_log(__METHOD__.__LINE__);
$ret = $this->icServer->getSpecialUseFolders();
if (PEAR::isError($ret))
try
{
$ret = $this->icServer->getSpecialUseFolders();
} catch (Exception $e)
{
$ret=null;
}
if (empty($ret))
{
$_specialUseFolders[$this->icServer->ImapServerId]=array();
}
@ -831,11 +837,11 @@ class mail_bo
foreach ($ret as $k => $f)
{
if (isset($f['ATTRIBUTES']) && !empty($f['ATTRIBUTES']) &&
!in_array('\\NonExistent',$f['ATTRIBUTES']))
!in_array('\\nonexistent',$f['ATTRIBUTES']))
{
foreach (self::$autoFolders as $i => $n) // array('Drafts', 'Templates', 'Sent', 'Trash', 'Junk', 'Outbox');
{
if (in_array('\\'.$n,$f['ATTRIBUTES'])) $_specialUseFolders[$this->icServer->ImapServerId][$f['MAILBOX']] = $n;
if (in_array('\\'.strtolower($n),$f['ATTRIBUTES'])) $_specialUseFolders[$this->icServer->ImapServerId][$f['MAILBOX']] = $n;
}
}
}

View File

@ -668,7 +668,7 @@ class mail_hooks
'name' => 'sieveScriptName',
'xmlrpc' => True,
'admin' => False,
'forced' => 'mail',
'forced' => 'felamimail',//old, but since its historic, and we want access to the old rules, ...
),
'prefcontroltestconnection' => array(
'type' => 'select',

View File

@ -64,10 +64,10 @@ class mail_sieve
if(empty($GLOBALS['egw_info']['user']['preferences']['mail']['sieveScriptName']))
{
$GLOBALS['egw']->preferences->add('mail','sieveScriptName','mail', 'forced');
$GLOBALS['egw']->preferences->add('mail','sieveScriptName','felamimail', 'forced');
$GLOBALS['egw']->preferences->save_repository();
}
$this->scriptName = (!empty($GLOBALS['egw_info']['user']['preferences']['mail']['sieveScriptName'])) ? $GLOBALS['egw_info']['user']['preferences']['mail']['sieveScriptName'] : 'mail' ;
$this->scriptName = (!empty($GLOBALS['egw_info']['user']['preferences']['mail']['sieveScriptName'])) ? $GLOBALS['egw_info']['user']['preferences']['mail']['sieveScriptName'] : 'felamimail' ;
$this->displayCharset = $GLOBALS['egw']->translation->charset();
$this->botranslation =& $GLOBALS['egw']->translation;
$profileID = 0;

View File

@ -383,7 +383,7 @@ class mail_ui
//$GLOBALS['egw']->framework->sidebox();
$preferences =& $this->mail_bo->mailPreferences;
if ($preferences->preferences['prefcontroltestconnection'] == 'none') die('You should not be here!');
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'];
@ -406,7 +406,7 @@ class mail_ui
_debug_array(array('source'=>$dom,'result'=>array('encoded'=>$encDom,'decoded'=>mail_bo::$idna2->decode($encDom))));
}
*/
if ($preferences->preferences['prefcontroltestconnection'] == 'reset') exit;
if ($preferences['prefcontroltestconnection'] == 'reset') exit;
echo "<hr /><h3 style='color:red'>".lang('IMAP Server')."</h3>";
$this->mail_bo->reopen('INBOX');
@ -415,17 +415,17 @@ class mail_ui
$sieveServer = clone $imapServer;
*/
if (!empty($imapServer->adminPassword)) $imapServer->adminPassword='**********************';
if ($preferences->preferences['prefcontroltestconnection'] == 'nopasswords' || $preferences->preferences['prefcontroltestconnection'] == 'nocredentials')
if ($preferences['prefcontroltestconnection'] == 'nopasswords' || $preferences['prefcontroltestconnection'] == 'nocredentials')
{
if (!empty($imapServer->password)) $imapServer->password='**********************';
}
if ($preferences->preferences['prefcontroltestconnection'] == 'nocredentials')
if ($preferences['prefcontroltestconnection'] == 'nocredentials')
{
if (!empty($imapServer->adminUsername)) $imapServer->adminUsername='++++++++++++++++++++++';
if (!empty($imapServer->username)) $imapServer->username='++++++++++++++++++++++';
if (!empty($imapServer->loginName)) $imapServer->loginName='++++++++++++++++++++++';
}
if ($preferences->preferences['prefcontroltestconnection'] <> 'basic')
if ($preferences['prefcontroltestconnection'] <> 'basic')
{
_debug_array($imapServer);
}
@ -453,9 +453,11 @@ class mail_ui
$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'] : 'mail';
$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);
@ -470,9 +472,9 @@ class mail_ui
_debug_array(array(lang('Successfully connected'),$rules));
}
}
*/
echo "<hr /><h3 style='color:red'>".lang('Preferences')."</h3>";
_debug_array($preferences->preferences);
_debug_array($preferences);
//error_log(__METHOD__.__LINE__.' ImapServerId:'.$imapServer->ImapServerId.' Prefs:'.array2string($preferences->preferences));
//error_log(__METHOD__.__LINE__.' ImapServerObject:'.array2string($imapServer));
if (is_object($preferences)) $activeIdentity =& $preferences->getIdentity($icServerID, true);

View File

@ -522,7 +522,7 @@ app.classes.mail = AppJS.extend(
// Leave if we're here and there is nothing selected, too many, or no data
if(typeof selected == 'undefined' || selected.length == 0 || selected.length > 1 || typeof dataElem =='undefined')
{
this.et2.getWidgetById('button[showAllAddresses]').set_class('et2_button ui-button mail_DisplayNone');
if (this.et2.getWidgetById('button[showAllAddresses]')) this.et2.getWidgetById('button[showAllAddresses]').set_class('et2_button ui-button mail_DisplayNone');
this.et2.getWidgetById('previewAttachmentArea').set_value({content:[]});
this.et2.getWidgetById('previewAttachmentArea').set_class('previewAttachmentArea noContent mail_DisplayNone');
var IframeHandle = this.et2.getWidgetById('messageIFRAME');