/** * Set data and parse for properties * * @param string data The data */ public function setData($data) { static $trans; parent::setData($data); // Get the NamespacePrefix $ns = $this->getNamespacePrefix(); // Select properties which should be set foreach (array(FALSE => $this->getNode('/' . $ns . ':propertyupdate/' . $ns . ':set/' . $ns . ':prop'), TRUE => $this->getNode('/' . $ns . ':propertyupdate/' . $ns . ':remove/' . $ns . ':prop')) as $remove => $propupdate) { if (!$propupdate) { continue; } // Copied from WebdavPropFindRequest::setData() foreach ($propupdate->children as $node) { $name = $node->getName(); $ns = 'xmlns'; $nsprefix = ''; if (($p = strpos($name, ':')) !== FALSE) { $ns .= ':' . ($nsprefix = substr($name, 0, $p)); $name = substr($name, $p + 1); } $p = new WebdavProperty($name, $this->decode($node->getContent())); if ($nsname = $node->getAttribute($ns)) { $p->setNamespaceName($nsname); if ($nsprefix) { $p->setNamespacePrefix($nsprefix); } } $this->addProperty($p, $remove); } } }
/** * Set data and parse for properties * * @param string data The data */ public function setData($data) { parent::setData($data); // Set properties if (!$this->getNode('/propfind/allprop') && ($propfind = $this->getNode('/propfind/prop'))) { foreach ($propfind->children as $node) { $name = $node->getName(); $ns = 'xmlns'; $nsprefix = ''; if (($p = strpos($name, ':')) !== FALSE) { $ns .= ':' . ($nsprefix = substr($name, 0, $p)); $name = substr($name, $p + 1); } $p = new WebdavProperty($name); if ($nsname = $node->getAttribute($ns)) { $p->setNamespaceName($nsname); if ($nsprefix) { $p->setNamespacePrefix($nsprefix); } } $this->addProperty($p); } } }
/** * Set data and parse for properties * * @param string data The data */ public function setData($data) { parent::setData($data); // locktype $node = $this->getNode('/lockinfo/locktype'); switch ($node->children[0]->name) { case 'read': $lktype = WEBDAV_LOCKTYPE_READ; break; case 'write': // set Propertie $lktype = WEBDAV_LOCKTYPE_WRITE; break; default: $lktype = WEBDAV_LOCKTYPE_UNKNOWN; break; } // Lockscope $node = $this->getNode('/lockinfo/lockscope'); switch ($node->children[0]->name) { case 'exclusive': // READ-LOCK $lkscope = WEBDAV_LOCKSCOPE_EXCL; break; case 'shared': // set Property $lkscope = WEBDAV_LOCKSCOPE_SHARED; break; default: $lkscope = WEBDAV_LOCKSCOPE_UNKNOWN; break; } // Owner $owner = $this->getNode('/lockinfo/owner'); if (($node = $this->getNode('/lockinfo/owner')) !== NULL) { $owner = $node->getSource(0); } else { // If we dont have a user in the request, take it from the authorization if ($this->getUser() !== NULL) { $user = $this->getUser(); $owner = $user->getUsername(); } } // Locktoken if (($node = $this->getNode('/lockinfo/token/href')) != '') { $lktoken = $node->getContent(); } else { $lktoken = $this->getHeader('Lock-Token'); } // Depth switch ($this->getHeader('depth')) { case 0: $depth = 0x0; break; case 'infinity': default: $depth = 'infinity'; break; } return $this->registerLock($owner, $lktype, $lkscope, $lktoken, $this->getPath(), sscanf('Second-%d', $this->getHeader('timeout')), $depth); }