Exemple #1
0
 /**
  * Update the Horde history in case an element was modified
  * outside of Horde.
  *
  * @param string $object_uid Object uid that should be updated.
  * @param int    $mod_ts     Timestamp of the modification.
  * @param string $action     The action that was performed.
  *
  * @return NULL
  */
 private function _updateHistory($object_uid, $mod_ts, $action)
 {
     global $registry;
     if (!isset($registry)) {
         return;
     }
     $app = $registry->getApp();
     if (empty($app) || is_a($app, 'PEAR_Error')) {
         /**
          * Ignore the history if we are not in application
          * context.
          */
         return $app;
     }
     if (!class_exists('Horde_History')) {
         return;
     }
     /* Log the action on this item in the history log. */
     try {
         $GLOBALS['injector']->getInstance('Horde_History')->log($app . ':' . $this->_folder->getShareId() . ':' . $object_uid, array('action' => $action, 'ts' => $mod_ts), true);
     } catch (Horde_Exception $e) {
     }
 }
Exemple #2
0
 function _imapConnect($id)
 {
     global $conf;
     // Handle virtual domains
     list($user, $domain) = explode('@', $id);
     if (empty($domain)) {
         $domain = $conf['kolab']['filter']['email_domain'];
     }
     $calendar_user = $conf['kolab']['filter']['calendar_id'] . '@' . $domain;
     /* Load the authentication libraries */
     $auth = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Auth')->create(isset($conf['auth']['driver']) ? null : 'kolab');
     $authenticated = $auth->authenticate($calendar_user, array('password' => $conf['kolab']['filter']['calendar_pass']), false);
     if (is_a($authenticated, 'PEAR_Error')) {
         $authenticated->code = OUT_LOG | EX_UNAVAILABLE;
         return $authenticated;
     }
     if (!$authenticated) {
         return PEAR::raiseError(sprintf('Failed to authenticate as calendar user: %s', $auth->getLogoutReasonString()), OUT_LOG | EX_UNAVAILABLE);
     }
     @session_start();
     $secret = $GLOBALS['injector']->getInstance('Horde_Secret');
     $_SESSION['__auth'] = array('authenticated' => true, 'userId' => $calendar_user, 'timestamp' => time(), 'credentials' => $secret->write($secret->getKey(), serialize(array('password' => $conf['kolab']['filter']['calendar_pass']))), 'remote_addr' => isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : null);
     /* Kolab IMAP handling */
     require_once 'Horde/Kolab/Storage/List.php';
     $list =& Kolab_List::singleton();
     $default = $list->getForeignDefault($id, 'event');
     if (!$default || is_a($default, 'PEAR_Error')) {
         $default = new Kolab_Folder();
         $default->setList($list);
         $default->setName($conf['kolab']['filter']['calendar_store']);
         //FIXME: The calendar user needs access here
         $attributes = array('default' => true, 'type' => 'event', 'owner' => $id);
         $result = $default->save($attributes);
         if (is_a($result, 'PEAR_Error')) {
             $result->code = OUT_LOG | EX_UNAVAILABLE;
             return $result;
         }
     }
     return $default;
 }