From: Michael M Slusarz Date: Tue, 3 Mar 2009 06:55:04 +0000 (-0700) Subject: Various POP3 changes/fixes. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=82ba98934760971b553c6149df78a37acad20ac1;p=horde.git Various POP3 changes/fixes. --- diff --git a/imp/config/servers.php.dist b/imp/config/servers.php.dist index 3a356dca2..46e9c7f02 100644 --- a/imp/config/servers.php.dist +++ b/imp/config/servers.php.dist @@ -21,12 +21,12 @@ * * protocol: (string) Either 'pop' or 'imap' (DEFAULT). * - * If using 'pop' you will connect to a POP3 mail server and all - * folder options will be automatically turned off (POP3 does - * not support folders). If you want folders (and for much - * improved performance) it is HIGHLY RECOMMENDED that IMAP should - * be used instead. The PHP imap module must be built into PHP in - * order to use a POP3 server. + * 'imap' requires a IMAP4rev1 (RFC 3501) compliant server. + * + * 'pop' requires a POP3 (RFC 1939) compliant server. All folder + * options will be automatically turned off (POP3 does + * not support folders). Other advanced functions will also be + * disabled (e.g. caching, searching, sorting). * * secure: (mixed) One of the following values: * 'ssl' - Use SSL to connect to the server. diff --git a/imp/docs/INSTALL b/imp/docs/INSTALL index 40b34827b..1b3a89a19 100644 --- a/imp/docs/INSTALL +++ b/imp/docs/INSTALL @@ -110,7 +110,7 @@ To function properly, IMP **requires** the following: See http://www.php.net/openssl for information on compiling OpenSSL into PHP. - b. tidy ``--with-tidy`` (PHP 5+ only) + b. tidy ``--with-tidy`` The tidy PHP extension is required if you want IMP to sanitize the output of HTML messages before displaying to the user and if you want @@ -118,68 +118,13 @@ To function properly, IMP **requires** the following: composition mode. See ``imp/config/mime_drivers.php.dist`` for further instructions on how to enable this feature. - The following PHP options are **OPTIONAL** and only required for certain - configurations: - - a. POP3 support ``--with-imap`` - - ** This extensions is only required for POP3 servers. If accessing ** - ** mail via IMAP, this extension is NOT necessary. ** - - IMP **requires** the PHP imap extension to provide POP3 support. - To compile the imap extension, the UW-IMAP c-client library must be - present on your system. For help with compiling the imap extension into - PHP, you can view the PHP imap manual entry: - - http://www.php.net/imap - - Because installation of the imap extension can be a non-trivial matter, - further configuration help/advice follows. - - The UW-IMAP c-client library is available from - - ftp://ftp.cac.washington.edu/imap/ - - The most recent code is normally located in a file named 'imap.tar.Z'. - - After building the c-client library (instructions are at the top of - the Makefile in the base directory of the UW imap package), you may - need to rename the compiled library file so the local build system can - find it. For example, compilation of c-client results in a file named - 'c-client.a' in the 'c-client' directory. On Linux (at least) this file - needs to be renamed or linked to libc-client.a, e.g.: - - ln -s c-client.a libc-client.a - - IMP can use POP3-SSL if available. SSL support needs to be built-in to - both the c-client library and the PHP extension (see the - ``--with-imap-ssl`` configure option to PHP). - - If using TLS or SSL to connect to the POP3 server, OpenSSL support is - **required** in PHP. See `OpenSSL Support`_ below. - - .. Tip:: If you notice strange behavior when running IMP (e.g. blank - screens when accessing certain messages, blank message bodies) - you should always try recompiling PHP with a different version - of c-client. The different versions of the c-client library and - PHP do not always work well together, and often all it takes is - to recompile with a different c-client version and the problems - will go away. - - .. Tip:: If running the webserver changerooted (i.e. the default setting - on OpenBSD), you may need additional configuration on your - system to ensure the c-client library works properly. - See: `Configuring c-client for changerooted webservers`_ - - .. _`Configuring c-client for changerooted webservers`: http://lists.horde.org/archives/imp/Week-of-Mon-20050321/041502.html - 3. The following PEAR modules: (See `horde/docs/INSTALL`_ for instructions on installing PEAR modules) a. Auth_SASL [OPTIONAL] - Auth_SASL is required if your IMAP server uses CRAM-MD5 or DIGEST-MD5 - authentication. + Auth_SASL is required only if your IMAP server uses CRAM-MD5 or + DIGEST-MD5 authentication. 4. The following PECL modules: (See `horde/docs/INSTALL`_ for instructions on installing PECL modules) diff --git a/imp/js/src/imp.js b/imp/js/src/imp.js index e9f76744b..6925d9d85 100644 --- a/imp/js/src/imp.js +++ b/imp/js/src/imp.js @@ -88,9 +88,9 @@ IMP.unblockImages = function(e) document.observe('dom:loaded', function() { // If menu is present, attach event handlers to folder switcher. - var tmp = $('menuform'); + var tmp = $('openfoldericon'); if (tmp) { - tmp.observe('change', IMP.menuFolderSubmit.bind(IMP)); - $('openfoldericon').down().observe('click', IMP.menuFolderSubmit.bind(IMP, true)); + $('menuform').observe('change', IMP.menuFolderSubmit.bind(IMP)); + tmp.down().observe('click', IMP.menuFolderSubmit.bind(IMP, true)); } }); diff --git a/imp/lib/Fetchmail/imap.php b/imp/lib/Fetchmail/imap.php index cb2aba3ae..5f13b36c1 100644 --- a/imp/lib/Fetchmail/imap.php +++ b/imp/lib/Fetchmail/imap.php @@ -124,7 +124,7 @@ class IMP_Fetchmail_imap extends IMP_Fetchmail ); try { - $this->_ob = Horde_Imap_Client::getInstance(($protocols[$this->_params['protocol']]['string'] == 'imap') ? 'Socket' : 'Cclient_pop3', $imap_config); + $this->_ob = Horde_Imap_Client::getInstance(($protocols[$this->_params['protocol']]['string'] == 'imap') ? 'Socket' : 'Socket_Pop3', $imap_config); } catch (Horde_Imap_Client_Exception $e) { throw new Horde_Exception(_("Cannot connect to the remote mail server: ") . $e->getMessage()); } diff --git a/imp/lib/IMP.php b/imp/lib/IMP.php index c809714f5..c1c906aaa 100644 --- a/imp/lib/IMP.php +++ b/imp/lib/IMP.php @@ -658,7 +658,9 @@ class IMP $menu->add(Util::nocacheUrl(Horde::applicationUrl('folders.php')), _("_Folders"), 'folders/folder.png'); } - $menu->add($menu_search_url, _("_Search"), 'search.png', $registry->getImageDir('horde')); + if ($_SESSION['imp']['protocol'] != 'pop') { + $menu->add($menu_search_url, _("_Search"), 'search.png', $registry->getImageDir('horde')); + } if (($_SESSION['imp']['protocol'] != 'pop') && $prefs->getValue('fetchmail_menu')) { @@ -1152,6 +1154,15 @@ class IMP 'limit' => false ); + /* Restrict POP3 sorting to arrival only. Although possible to + * abstract other sorting methods, all other methods require a + * download of all messages, which is too much overhead.*/ + if ($_SESSION['imp']['protocol'] == 'pop') { + $ob['by'] = Horde_Imap_Client::SORT_ARRIVAL; + $ob['limit'] = true; + return $ob; + } + /* Can't do threaded searches in search mailboxes. */ if (!self::threadSortAvailable($mbox)) { if ($ob['by'] == Horde_Imap_Client::SORT_THREAD) { @@ -1194,7 +1205,8 @@ class IMP */ static public function threadSortAvailable($mbox) { - return !$GLOBALS['imp_search']->isSearchMbox($mbox) && + return ($_SESSION['imp']['protocol'] == 'imap') && + !$GLOBALS['imp_search']->isSearchMbox($mbox) && (!$GLOBALS['prefs']->getValue('use_trash') || !$GLOBALS['prefs']->getValue('use_vtrash') || $GLOBALS['imp_search']->isVTrashFolder($mbox)); diff --git a/imp/lib/Imap.php b/imp/lib/Imap.php index 7eb8d9d0b..b5957ac59 100644 --- a/imp/lib/Imap.php +++ b/imp/lib/Imap.php @@ -195,7 +195,7 @@ class IMP_Imap } try { - $ob = Horde_Imap_Client::getInstance(($protocol == 'imap') ? 'Socket' : 'Cclient_pop3', $imap_config); + $ob = Horde_Imap_Client::getInstance(($protocol == 'imap') ? 'Socket' : 'Socket_Pop3', $imap_config); } catch (Horde_Imap_Client_Exception $e) { return false; } diff --git a/imp/mailbox.php b/imp/mailbox.php index 7d9dda68f..170022253 100644 --- a/imp/mailbox.php +++ b/imp/mailbox.php @@ -451,22 +451,24 @@ if (isset($filter_url)) { $hdr_template->set('filter', Horde::link($filter_url, sprintf(_("Apply Filters to %s"), $rawtitle)) . Horde::img('filters.png', _("Apply Filters")) . ''); } $hdr_template->set('search', false); -if (!$search_mbox) { - $hdr_template->set('search', Horde::link(Util::addParameter(Horde::applicationUrl('search.php'), 'search_mailbox', $imp_mbox['mailbox']), sprintf(_("Search %s"), $rawtitle)) . Horde::img('search.png', _("Search"), '', $graphicsdir) . ''); - if (!$readonly) { - $hdr_template->set('empty', Horde::link(Util::addParameter($mailbox_imp_url, array('actionID' => 'empty_mailbox', 'mailbox' => $imp_mbox['mailbox'], 'mailbox_token' => $mailbox_token)), _("Empty folder"), '', '', "ImpMessage.confirmDialog(this.href, '" . addslashes(_("Are you sure you wish to delete all mail in this folder?")) . "'); return false;") . Horde::img('empty_spam.png', _("Empty folder")) . ''); - } -} else { - if ($imp_search->isEditableVFolder()) { - $edit_search = sprintf(_("Edit Virtual Folder Definition for %s"), htmlspecialchars($rawtitle)); - $hdr_template->set('delete_vfolder', Horde::link($imp_search->deleteURL(), sprintf(_("Delete Virtual Folder Definition for %s"), htmlspecialchars($rawtitle)), null, null, "if (confirm('" . addslashes(_("Are you sure you want to delete this Virtual Folder Definition?")) . "')) { return true; } else { return false; }") . Horde::img('delete.png', sprintf(_("Delete Virtual Folder Definition for %s"), $rawtitle), '', $graphicsdir) . ''); +if ($_SESSION['imp']['protocol'] != 'pop') { + if (!$search_mbox) { + $hdr_template->set('search', Horde::link(Util::addParameter(Horde::applicationUrl('search.php'), 'search_mailbox', $imp_mbox['mailbox']), sprintf(_("Search %s"), $rawtitle)) . Horde::img('search.png', _("Search"), '', $graphicsdir) . ''); + if (!$readonly) { + $hdr_template->set('empty', Horde::link(Util::addParameter($mailbox_imp_url, array('actionID' => 'empty_mailbox', 'mailbox' => $imp_mbox['mailbox'], 'mailbox_token' => $mailbox_token)), _("Empty folder"), '', '', "ImpMessage.confirmDialog(this.href, '" . addslashes(_("Are you sure you wish to delete all mail in this folder?")) . "'); return false;") . Horde::img('empty_spam.png', _("Empty folder")) . ''); + } } else { - if (!$vfolder) { - $edit_search = _("Edit Search Query"); + if ($imp_search->isEditableVFolder()) { + $edit_search = sprintf(_("Edit Virtual Folder Definition for %s"), htmlspecialchars($rawtitle)); + $hdr_template->set('delete_vfolder', Horde::link($imp_search->deleteURL(), sprintf(_("Delete Virtual Folder Definition for %s"), htmlspecialchars($rawtitle)), null, null, "if (confirm('" . addslashes(_("Are you sure you want to delete this Virtual Folder Definition?")) . "')) { return true; } else { return false; }") . Horde::img('delete.png', sprintf(_("Delete Virtual Folder Definition for %s"), $rawtitle), '', $graphicsdir) . ''); + } else { + if (!$vfolder) { + $edit_search = _("Edit Search Query"); + } + } + if (isset($edit_search)) { + $hdr_template->set('search', Horde::link($imp_search->editURL(), $edit_search) . Horde::img('edit.png', $edit_search, '', $graphicsdir) . ''); } - } - if (isset($edit_search)) { - $hdr_template->set('search', Horde::link($imp_search->editURL(), $edit_search) . Horde::img('edit.png', $edit_search, '', $graphicsdir) . ''); } } $hdr_template->set('msgcount', $msg_count); diff --git a/imp/message.php b/imp/message.php index 962b25d1b..4ee665895 100644 --- a/imp/message.php +++ b/imp/message.php @@ -515,7 +515,7 @@ if (!IMP::$printMode) { $a_template->set('redirect', Horde::widget(IMP::composeLink(array(), array('actionID' => 'redirect_compose') + $compose_params), _("Redirect"), 'widget', '', '', _("Redirec_t"), true)); } - if (isset($imp_search) && !$imp_search->searchMboxID()) { + if (IMP::threadSortAvailable($imp_mbox['mailbox'])) { $a_template->set('show_thread', Horde::widget(Util::addParameter(IMP::generateIMPUrl('thread.php', $imp_mbox['mailbox'], $index, $mailbox_name), array('start' => $msgindex)), _("View Thread"), 'widget', '', '', _("_View Thread"), true)); } diff --git a/imp/search.php b/imp/search.php index fb3c88dbe..8acc38ffd 100644 --- a/imp/search.php +++ b/imp/search.php @@ -19,6 +19,13 @@ require_once dirname(__FILE__) . '/lib/base.php'; require_once 'Horde/Help.php'; +/* Redirect back to the mailbox if searching is not allowed. */ +if ($_SESSION['imp']['protocol'] == 'pop') { + $notification->push(_("Searching is not available with a POP3 server."), 'horde.error'); + header('Location: ' . Horde::applicationUrl('mailbox.php', true)); + exit; +} + $actionID = Util::getFormData('actionID'); $edit_query = Util::getFormData('edit_query'); $edit_query_vfolder = Util::getFormData('edit_query_vfolder'); diff --git a/imp/test.php b/imp/test.php index 308d31202..14e7d3598 100644 --- a/imp/test.php +++ b/imp/test.php @@ -24,7 +24,7 @@ function _doConnectionTest() 'secure' => ($_POST['port'] == 'yes') ); - $driver = ($_POST['server_type'] == 'imap') ? 'Socket' : 'Cclient_pop3'; + $driver = ($_POST['server_type'] == 'imap') ? 'Socket' : 'Socket_Pop3'; try { $imap_client = Horde_Imap_Client::getInstance($driver, $imap_config); @@ -158,11 +158,6 @@ $module_list = array( 'error' => 'IMP requires the idn module (installed via PECL) in order to handle Internationalized Domain Names.', 'fatal' => false ), - 'imap' => array( - 'descrip' => 'IMAP Support', - 'error' => 'IMP requires the imap module to interact with the mail server. It is required ONLY for POP3 access.', - 'fatal' => false - ), 'openssl' => array( 'descrip' => 'OpenSSL Support', 'error' => 'The openssl module is required to use S/MIME in IMP. Compile PHP with --with-openssl to activate.',