* @category Horde * @copyright 2010-2017 Horde LLC * @license http://www.horde.org/licenses/gpl GPL * @package IMP */ class IMP_Test extends Horde_Test { /** */ protected $_moduleList = array( 'openssl' => array( 'descrip' => 'OpenSSL Support', 'error' => 'The OpenSSL extension is required for S/MIME support and to securely connect to the remote IMAP/POP3 server.' ) ); /** */ protected $_settingsList = array( 'file_uploads' => array( 'error' => 'file_uploads must be enabled to use various features of IMP. See the INSTALL file for more information.', 'setting' => true ) ); /** */ protected $_pearList = array(); /** */ protected $_appList = array( 'ingo' => array( 'error' => 'Ingo provides mail filtering capabilities to IMP.', 'version' => '3.0' ), 'kronolith' => array( 'error' => 'Kronolith provides calendaring capabilities to IMP.', 'version' => '4.0' ), 'nag' => array( 'error' => 'Nag allows tasks to be directly created from e-mail data.', 'version' => '4.0' ), 'turba' => array( 'error' => 'Turba provides addressbook/contacts capabilities to IMP.', 'version' => '4.0' ) ); /** */ public function __construct() { parent::__construct(); $this->_fileList += array( 'config/backends.php' => null, 'config/mime_drivers.php' => null, 'config/prefs.php' => null ); } /** */ public function appTests() { $ret = '
Namespace Information' . ''; try { $namespaces = $imap_client->getNamespaces( array(), array('ob_return' => true) ); foreach ($namespaces as $val) { switch ($val->type) { case $val::NS_PERSONAL: $type = 'Personal'; break; case $val::NS_OTHER: $type = 'Other Users\''; break; case $val::NS_SHARED: $type = 'Shared'; break; } $ret .= 'NAMESPACE: "' . htmlspecialchars($val->name) . "\"\n" . 'DELIMITER: ' . htmlspecialchars($val->delimiter) . "\n" . 'TYPE: ' . htmlspecialchars($type) . "\n\n"; } } catch (Horde_Imap_Client_Exception $e) { $this->_errorMsg($e); } $ret .= '
IMAP server capabilities:' . ''; try { foreach ($imap_client->capability() as $key => $val) { if (is_array($val)) { foreach ($val as $val2) { $ret .= htmlspecialchars($key) . '=' . htmlspecialchars($val2) . "\n"; } } else { $ret .= htmlspecialchars($key) . "\n"; } } } catch (Horde_Imap_Client_Exception $e) { $this->_errorMsg($e); } $ret .= '
Does IMAP server support UTF-8 in search queries? '; if ($imap_client->validSearchCharset('UTF-8')) { $ret .= 'YES'; } else { $ret .= 'NO'; } $ret .= ''; try { $id_info = $imap_client->getID(); if (!empty($id_info)) { $ret .= '
IMAP server information:'; } } catch (Horde_Imap_Client_Exception $e) { // Ignore lack of ID capability. } } else { $ret .= 'Checking for the UIDL capability: '; if ($imap_client->queryCapability('UIDL')) { $ret .= 'SUCCESS'; } else { return $this->_errorMsg(new Exception('The POP3 server does not support the *REQUIRED* UIDL capability.')); } } return $ret; } /** * Return error message from mail server testing. * * @return string HTML output. */ protected function _errorMsg($e) { return 'ERROR - The server returned the following error message:' . ''; foreach ($id_info as $key => $val) { $ret .= htmlspecialchars("$key: $val") . "\n"; } $ret .= '
' . $e->getMessage() . ''; } }