Merge branch '2014.11' into 2015.11
authorPhilipp Schüle <p.schuele@metaways.de>
Mon, 9 May 2016 12:02:00 +0000 (14:02 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Mon, 9 May 2016 12:02:00 +0000 (14:02 +0200)
1  2 
tine20/Calendar/Frontend/WebDAV/Container.php
tine20/Tinebase/FileSystem.php

@@@ -343,6 -343,11 +343,11 @@@ class Calendar_Frontend_WebDAV_Containe
      
      /**
       * (non-PHPdoc)
+      *
+      * changed href from URI format /path/to/targetid to urn:uuid:id format due to el capitano ical client
+      * see:
+      * https://service.metaways.net/Ticket/Display.html?id=145985
+      *
       * @see \Sabre\CalDAV\IShareableCalendar::getShares()
       */
      public function getShares()
              
              switch ($grant->account_type) {
                  case 'anyone':
-                     $href       = '/principals/groups/anyone';
+                     // was: '/principals/groups/anyone'
+                     $href       = 'urn:uuid:anyone';
                      $commonName = 'Anyone';
                      break;
                  
                      } catch (Tinebase_Exception_NotFound $tenf) {
                          continue;
                      }
-                      
-                     $href       = '/principals/groups/' . $list->list_id;
+                     // was: '/principals/groups/'
+                     $href       = 'urn:uuid:' . $list->list_id;
                      $commonName = $list->name;
                      
                      break;
                      
                  case 'user':
+                     if ((string)$this->_container->owner_id === (string)$grant->account_id) {
+                         continue;
+                     }
                      try {
                          $contact = Tinebase_User::getInstance()->getUserByPropertyFromSqlBackend('accountId', $grant->account_id);
                      } catch (Tinebase_Exception_NotFound $tenf) {
                          continue;
                      }
-                      
-                     $href       = '/principals/users/' . $contact->contact_id;
+                     // was: '/principals/users/'
+                     $href       = 'urn:uuid:' . $contact->contact_id;
                      $commonName = $contact->accountDisplayName;
                      break;
              }
      {
          return true;
      }
 +
 +    /**
 +     * returns the changes happened since the provided syncToken which is the content sequence
 +     *
 +     * @param string $syncToken
 +     * @return array
 +     */
 +    public function getChanges($syncToken)
 +    {
 +        $result = parent::getChanges($syncToken);
 +
 +        $newResult = array();
 +        $backend = Calendar_Controller_Event::getInstance()->getBackend();
 +
 +        foreach ($result as $action => $value) {
 +            if (!is_array($value)) {
 +                $newResult[$action] = $value;
 +                continue;
 +            }
 +
 +            $uids = $backend->getUidOfBaseEvents(array_keys($value));
 +
 +            $newResult[$action] = array();
 +            foreach($uids as $row) {
 +                $newResult[$action][$row[0]] = $row[0] . $this->_suffix;
 +            }
 +        }
 +
 +        return $newResult;
 +    }
  }
@@@ -65,7 -65,7 +65,7 @@@ class Tinebase_FileSystem implements Ti
          $this->_fileObjectBackend  = new Tinebase_Tree_FileObject();
          $this->_treeNodeBackend    = new Tinebase_Tree_Node();
          
 -        if (! Setup_Controller::getInstance()->isFilesystemAvailable()) {
 +        if (! Tinebase_Core::isFilesystemAvailable()) {
              throw new Tinebase_Exception_Backend('No base path (filesdir) configured or path not writeable');
          }
          
              }
          }
          
-         $missingPathParts = array_diff($this->_splitPath($path), $pathParts);
+         $missingPathParts = array_diff_assoc($this->_splitPath($path), $pathParts);
          
          foreach ($missingPathParts as $pathPart) {
              $node = $this->_treeNodeBackend->getChild($parentNode, $pathPart);
              
-             // keep track of current path posistion
+             // keep track of current path position
              array_push($pathParts, $pathPart);
              
              // add found path to statCache
              $nodeId = $nodeId->getArrayOfIds();
              $operator = 'in';
          } else {
 -            $nodeId = $_nodeId;
              $operator = 'equals';
          }