Copyright 2004-2016 Horde LLC (http://www.horde.org/) See the enclosed file COPYING for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.
Author: Gunnar Wrobel (wrobel@pardus.de)
Example #1
0
File: Base.php Project: horde/horde
 /**
  * Rename a folder.
  *
  * @param string $old The old path of the folder.
  * @param string $new The new path of the folder.
  *
  * @return NULL
  */
 public function renameFolder($old, $new)
 {
     $this->_driver->rename($old, $new);
     foreach ($this->_listeners as $listener) {
         $listener->updateAfterRenameFolder($old, $new);
     }
 }
Example #2
0
 /**
  * Delete the specified messages from this folder.
  *
  * @param array|string $uids Backend id(s) of the message to be deleted.
  */
 public function deleteBackendIds($uids)
 {
     if (!is_array($uids)) {
         $uids = array($uids);
     }
     $this->_driver->deleteMessages($this->_folder->getPath(), $uids);
     $this->_driver->expunge($this->_folder->getPath());
 }
Example #3
0
 /**
  * Initialize the list of defaults.
  */
 private function _initDefaults()
 {
     if (!$this->_defaults->isComplete()) {
         $namespace = $this->_driver->getNamespace();
         foreach ($this->listFolderTypeAnnotations() as $folder => $annotation) {
             if ($annotation->isDefault()) {
                 $this->_defaults->rememberDefault($folder, $annotation->getType(), $namespace->getOwner($folder), $namespace->matchNamespace($folder)->getType() == Horde_Kolab_Storage_Folder_Namespace::PERSONAL);
             }
         }
         $this->_defaults->markComplete();
     }
 }
Example #4
0
 /**
  * Return a data handler for accessing data in the specified folder.
  *
  * @param mixed  $folder       The name of the folder or an instance
  *                             representing the folder.
  * @param string $object_type  The type of data we want to access in the
  *                             folder.
  * @param int    $data_version Format version of the object data.
  *
  * @return Horde_Kolab_Storage_Data The data object.
  */
 public function getData($folder, $object_type = null, $data_version = 1)
 {
     if ($folder instanceof Horde_Kolab_Storage_Folder) {
         $folder_key = $folder->getPath();
     } else {
         $folder_key = $folder;
     }
     $key = join('@', array($data_version, $object_type, $folder_key, $this->_master->getId()));
     if (!isset($this->_data[$key])) {
         if (!$folder instanceof Horde_Kolab_Storage_Folder) {
             $folder = $this->getFolder($folder);
         }
         $this->_data[$key] = $this->_createData($folder, $this->_master, $this->_factory, $object_type, $data_version);
         if (isset($this->_params['logger'])) {
             $this->_data[$key] = new Horde_Kolab_Storage_Data_Decorator_Log($this->_data[$key], $this->_params['logger']);
         }
         $this->_query_set->addDataQuerySet($this->_data[$key]);
     }
     return $this->_data[$key];
 }
Example #5
0
 /**
  * Set the specified folder as default for its current type.
  *
  * @param array  $folder   The folder data.
  * @param string|boolean $previous The previous default folder or false if there was none.
  */
 public function setDefault($folder, $previous = false)
 {
     if (!$this->_cache->hasNamespace()) {
         // Cache not synchronized yet.
         return;
     }
     if ($folder['namespace'] !== Horde_Kolab_Storage_Folder_Namespace::PERSONAL) {
         throw new Horde_Kolab_Storage_List_Exception(sprintf("Unable to mark %s as a default folder. It is not within your personal namespace!", $folder['folder']));
     }
     $annotations = $this->_cache->getFolderTypes();
     if (!isset($annotations[$folder['folder']])) {
         throw new Horde_Kolab_Storage_List_Exception(sprintf("The folder %s has no Kolab type. It cannot be marked as 'default' folder!", $folder['folder']));
     }
     if ($previous) {
         $this->_driver->setAnnotation($previous, Horde_Kolab_Storage_List_Query_List::ANNOTATION_FOLDER_TYPE, $folder['type']);
         $annotations[$previous] = $folder['type'];
     }
     $this->_driver->setAnnotation($folder['folder'], Horde_Kolab_Storage_List_Query_List::ANNOTATION_FOLDER_TYPE, $folder['type'] . '.default');
     $annotations[$folder['folder']] = $folder['type'] . '.default';
     $folder_list = $this->_cache->getFolders();
     $namespace = unserialize($this->_cache->getNamespace());
     $this->_synchronize($namespace, $folder_list, $annotations);
 }
Example #6
0
 /**
  * Expunges messages in the current folder.
  *
  * @param string $folder The folder to expunge.
  *
  * @return NULL
  */
 public function expunge($folder)
 {
     $this->_driver->expunge($folder);
 }
Example #7
0
 /**
  * Set the share parameters.
  *
  * @param string $folder     The folder name.
  * @param array  $parameters The share parameters.
  *
  * @return string The encoded share parameters.
  */
 public function setParameters($folder, array $parameters)
 {
     $this->_driver->setAnnotation($folder, self::ANNOTATION_SHARE_PARAMETERS, base64_encode(serialize($parameters)));
 }
Example #8
0
 /**
  * Set the active sync settings.
  *
  * @param string $folder The folder name.
  * @param array  $data   The active sync settings.
  *
  * @return string The encoded share parameters.
  */
 public function setActiveSync($folder, array $data)
 {
     $this->_driver->setAnnotation($folder, self::ANNOTATION_ACTIVE_SYNC, base64_encode(json_encode($data)));
 }
Example #9
0
File: Base.php Project: horde/horde
 /**
  * Delete the access rights for user on a folder.
  *
  * @param string $folder  The folder to act upon.
  * @param string $user    The user to delete the ACL for
  *
  * @return NULL
  */
 public function deleteAcl($folder, $user)
 {
     $this->_failOnMissingAcl();
     return $this->_driver->deleteAcl($folder, $user);
 }
Example #10
0
 /**
  * Return the namespace handler for the underlying connection.
  *
  * @return Horde_Kolab_Storage_Folder_Namespace The namespace handler.
  */
 public function getNamespace()
 {
     return $this->_driver->getNamespace();
 }