Author: Michael Slusarz (slusarz@horde.org)
Example #1
0
 private function _getDriver($driver)
 {
     if ($driver == self::PEAR) {
         /** PEAR-Net_IMAP is not E_STRICT */
         $this->old_error_reporting = error_reporting(E_ALL & ~E_STRICT);
     }
     if (!isset($this->sharedFixture->drivers[$driver])) {
         switch ($driver) {
             case self::MOCK:
                 $connection = new Horde_Kolab_Storage_Driver_Mock($this->group);
                 break;
             case self::CCLIENT:
                 $connection = new Horde_Kolab_Storage_Driver_Cclient($this->group);
                 break;
             case self::PEAR:
                 $client = new Net_IMAP($this->sharedFixture->conf['host'], 143, false);
                 $client->login($this->sharedFixture->conf['user'], $this->sharedFixture->conf['pass']);
                 $connection = new Horde_Kolab_Storage_Driver_Pear($client, $this->group);
                 break;
             case self::IMAP_SOCKET:
                 $params = array('hostspec' => $this->sharedFixture->conf['host'], 'username' => $this->sharedFixture->conf['user'], 'password' => $this->sharedFixture->conf['pass'], 'debug' => $this->sharedFixture->conf['debug'], 'port' => 143, 'secure' => false);
                 $client = Horde_Imap_Client::factory('socket', $params);
                 $client->login();
                 $connection = new Horde_Kolab_Storage_Driver_Imap($client, $this->group);
                 break;
             default:
                 exit("Undefined storage driver!\n");
         }
         $this->sharedFixture->drivers[$driver] = $connection;
     }
     return $this->sharedFixture->drivers[$driver];
 }
Example #2
0
 /**
  * Return the Horde_Kolab_Storage:: instance.
  *
  * @return Horde_Kolab_Storage The storage handler.
  */
 public function getStorage()
 {
     $configuration = $this->_injector->getInstance('Horde_Kolab_Storage_Configuration');
     $owner = $this->_injector->getInstance('Horde_Kolab_FreeBusy_Owner');
     $user = $this->_injector->getInstance('Horde_Kolab_FreeBusy_Param_User');
     list($user, $pass) = $user->getCredentials();
     $params = array('hostspec' => $owner->getResourceServer(), 'username' => $user, 'password' => $pass, 'secure' => true);
     $imap = Horde_Imap_Client::factory('socket', $params);
     //@todo: The Group package needs to be converted to H4
     require_once 'Horde/Group.php';
     $master = new Horde_Kolab_Storage_Driver_Imap($imap, Group::singleton());
     return new Horde_Kolab_Storage($master, $params);
 }
Example #3
0
 /**
  * Create the IMAP client.
  *
  * @param array $params The connection parameters for the IMAP client.
  *
  * @return Horde_Imap_Client_Base The IMAP client.
  */
 public function create($params)
 {
     return Horde_Imap_Client::factory('Socket', $params);
 }