Exemple #1
0
 /**
  * Create the backend driver.
  *
  * @return mixed The backend driver.
  */
 public function createBackend()
 {
     $config = $this->getParams();
     if (isset($config['secure']) && $config['secure'] == 'ssl') {
         $prefix = 'ssl://';
     } else {
         $prefix = '';
     }
     $client = new Net_IMAP($prefix . $config['host'], $config['port'], isset($config['secure']) && $config['secure'] == 'tls');
     $client->_useUTF_7 = false;
     if (isset($config['debug'])) {
         if ($config['debug'] == 'STDOUT') {
             $client->setDebug(true);
         } else {
             throw new Horde_Kolab_Storage_Exception('This driver does not support debug logging into a file.');
         }
     }
     Horde_Kolab_Storage_Exception_Pear::catchError($client->login($config['username'], $config['password'], true, false));
     return $client;
 }
$startTime = microtime(true);
print "<pre>";
set_include_path('../egw-pear' . PATH_SEPARATOR . '/usr/share/php' . PATH_SEPARATOR . get_include_path());
require_once 'Net/IMAP.php';
print "<h1><span style='color:red;'>ATTENTION: THIS OUTPUT CONTAINS YOUR USERNAME AND PASSWORD!!!</span></h1>";
$elapsedTime = microtime(true) - $startTime;
print "<h1> {$elapsedTime} :: Login as user {$username1} </h1>";
$imapClient = new Net_IMAP($host, $port, $enableSTARTTLS);
$imapClient->setDebug(true);
$imapClient->login($username1, $password1, true, false);
$imapClient->selectMailbox($testFolder);
if (!empty($username2) && !empty($password2)) {
    $elapsedTime = microtime(true) - $startTime;
    print "<h1> {$elapsedTime} :: Login as user {$username2} </h1>";
    $imapClient2 = new Net_IMAP($host);
    $imapClient2->setDebug(true);
    $imapClient2->login($username2, $password2, true, false);
}
$elapsedTime = microtime(true) - $startTime;
print "<h1> {$elapsedTime} :: Getting hierarchy delimiter </h1>";
$delimiter = $imapClient->getHierarchyDelimiter();
print "delimiter is: {$delimiter}<br>";
$elapsedTime = microtime(true) - $startTime;
print "<h1> {$elapsedTime} :: List all folders </h1>";
$imapClient->getMailboxes();
$elapsedTime = microtime(true) - $startTime;
print "<h1> {$elapsedTime} :: List all subscribed folders </h1>";
$imapClient->listsubscribedMailboxes();
$elapsedTime = microtime(true) - $startTime;
print "<h1> {$elapsedTime} :: Checking for ACL support: ";
if ($imapClient->hasCapability('ACL')) {