From: Michael M Slusarz Date: Thu, 25 Jun 2009 21:51:58 +0000 (-0600) Subject: More POP3 disabling - don't allow on-demand filtering X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=f1264bd13cd8eb1255f8078b2691c719c8598a2f;p=horde.git More POP3 disabling - don't allow on-demand filtering --- diff --git a/imp/docs/CHANGES b/imp/docs/CHANGES index 4b7c78611..e8348b66a 100644 --- a/imp/docs/CHANGES +++ b/imp/docs/CHANGES @@ -28,8 +28,8 @@ v5.0-git UIDVALIDITY of mailbox has changed. [mms] Simplify forwarding - always attach entire message. [mms] Remember splitbar position on login/refresh (DIMP). -[mms] Disable some advanced functions if using POP3 driver (caching, - searching, sorting) because it is too resource intensive. +[mms] Disable advanced functions if using POP3 driver (caching, on-demand + filtering, searching, sorting) because it is too resource intensive. [mms] Use native PHP code for POP3 driver (c-client no longer required). [mms] All native IMP code now uses exceptions instead of PEAR_Errors. [mms] Fix wrong charset on filenames when stripping attachments (Bug #7220). diff --git a/imp/docs/INSTALL b/imp/docs/INSTALL index 0347f10f5..33e5adb71 100644 --- a/imp/docs/INSTALL +++ b/imp/docs/INSTALL @@ -158,6 +158,11 @@ To function properly, IMP **requires** the following: The selected IMAP server MUST support IMAP4rev1 (RFC 3501). The selected POP server MUST support POP3 (RFC 1939/STD 53). + .. If using a POP server, caching, on-demand filtering, searching, and + sorting are disabled. + POP3 support is limited essentially to only viewing messages. + An IMAP server is REQUIRED for all other advanced features. + The following items are not required, but are strongly **RECOMMENDED**: 1. Sendmail or equivalent. diff --git a/imp/lib/Imap.php b/imp/lib/Imap.php index b5c615883..a7e9af040 100644 --- a/imp/lib/Imap.php +++ b/imp/lib/Imap.php @@ -161,7 +161,9 @@ class IMP_Imap return false; } - $protocol = isset($server['protocol']) ? strtolower($server['protocol']) : 'imap'; + $protocol = isset($server['protocol']) + ? strtolower($server['protocol']) + : 'imap'; $imap_config = array( 'debug' => isset($server['debug']) ? $server['debug'] : null, diff --git a/imp/lib/api.php b/imp/lib/api.php index e1fe1564b..a35214062 100644 --- a/imp/lib/api.php +++ b/imp/lib/api.php @@ -83,7 +83,7 @@ $_services['mailboxCacheId'] = array( $_services['server'] = array( 'args' => array(), - 'type' => 'string' + 'type' => '{urn:horde}hashHash' ); $_services['favouriteRecipients'] = array( @@ -428,10 +428,15 @@ function _imp_mailboxCacheId($mailbox) } /** - * Returns the currently logged on IMAP server. - * - * @return string The server hostname. Returns null if the user has not - * authenticated into IMP yet. + * Returns information on the currently logged on IMAP server. + * + * @return mixed Returns null if the user has not authenticated into IMP yet. + * Otherwise, an array with the following entries: + *
+ * 'hostspec' - (string) The server hostname.
+ * 'port' - (integer) The server port.
+ * 'protocol' - (string) Either 'imap' or 'pop'.
+ * 
*/ function _imp_server() { @@ -440,10 +445,14 @@ function _imp_server() if (IMP::checkAuthentication(true)) { $imap_obj = unserialize($_SESSION['imp']['imap_ob']); - return $imap_obj->getParam('hostspec'); - } else { - return null; + return array( + 'hostspec' => $imap_obj->getParam('hostspec'), + 'port' => $imap_obj->getParam('hostspec'), + 'protocol' => $_SESSION['imp']['protocol'] + ); } + + return null; } /** diff --git a/ingo/config/backends.php.dist b/ingo/config/backends.php.dist index c86142609..8e5dc0bcc 100644 --- a/ingo/config/backends.php.dist +++ b/ingo/config/backends.php.dist @@ -26,7 +26,8 @@ * * script: (string) The type of Ingo_Script driver this server uses. * Valid options: - * 'imap' - IMAP client side filtering + * 'imap' - IMAP client side filtering (POP3 servers NOT + supported) * 'maildrop' - Maildrop scripts * 'procmail' - Procmail scripts * 'sieve' - Sieve scripts diff --git a/ingo/lib/Script/imap.php b/ingo/lib/Script/imap.php index 9374c5a60..145d29353 100644 --- a/ingo/lib/Script/imap.php +++ b/ingo/lib/Script/imap.php @@ -346,8 +346,13 @@ class Ingo_Script_imap extends Ingo_Script */ public function canApply() { - return $this->performAvailable() && - $GLOBALS['registry']->hasMethod('mail/server'); + if ($this->performAvailable() && + $GLOBALS['registry']->hasMethod('mail/server')) { + $server = $GLOBALS['registry']->call('mail/server'); + return ($server['protocol'] == 'imap'); + } + + return false; } /** @@ -357,11 +362,9 @@ class Ingo_Script_imap extends Ingo_Script */ public function apply() { - if ($this->canApply()) { - return $this->perform(array('mailbox' => 'INBOX')); - } - - return false; + return $this->canApply() + ? $this->perform(array('mailbox' => 'INBOX')) + : false; } }