当前位置: 首页>>代码示例>>PHP>>正文


PHP Sabre_DAV_Server类代码示例

本文整理汇总了PHP中Sabre_DAV_Server的典型用法代码示例。如果您正苦于以下问题:PHP Sabre_DAV_Server类的具体用法?PHP Sabre_DAV_Server怎么用?PHP Sabre_DAV_Server使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Sabre_DAV_Server类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: serialize

 /**
  * serialize 
  * 
  * @param DOMElement $prop 
  * @return void
  */
 public function serialize(Sabre_DAV_Server $server, DOMElement $prop)
 {
     $doc = $prop->ownerDocument;
     foreach ($this->locks as $lock) {
         $activeLock = $doc->createElementNS('DAV:', 'd:activelock');
         $prop->appendChild($activeLock);
         $lockScope = $doc->createElementNS('DAV:', 'd:lockscope');
         $activeLock->appendChild($lockScope);
         $lockScope->appendChild($doc->createElementNS('DAV:', 'd:' . ($lock->scope == Sabre_DAV_Locks_LockInfo::EXCLUSIVE ? 'exclusive' : 'shared')));
         $lockType = $doc->createElementNS('DAV:', 'd:locktype');
         $activeLock->appendChild($lockType);
         $lockType->appendChild($doc->createElementNS('DAV:', 'd:write'));
         /* {DAV:}lockroot */
         if (!self::$hideLockRoot) {
             $lockRoot = $doc->createElementNS('DAV:', 'd:lockroot');
             $activeLock->appendChild($lockRoot);
             $href = $doc->createElementNS('DAV:', 'd:href');
             $href->appendChild($doc->createTextNode($server->getBaseUri() . $lock->uri));
             $lockRoot->appendChild($href);
         }
         $activeLock->appendChild($doc->createElementNS('DAV:', 'd:depth', $lock->depth == Sabre_DAV_Server::DEPTH_INFINITY ? 'infinity' : $lock->depth));
         $activeLock->appendChild($doc->createElementNS('DAV:', 'd:timeout', 'Second-' . $lock->timeout));
         if ($this->revealLockToken) {
             $lockToken = $doc->createElementNS('DAV:', 'd:locktoken');
             $activeLock->appendChild($lockToken);
             $lockToken->appendChild($doc->createElementNS('DAV:', 'd:href', 'opaquelocktoken:' . $lock->token));
         }
         $activeLock->appendChild($doc->createElementNS('DAV:', 'd:owner', $lock->owner));
     }
 }
开发者ID:kumarsivarajan,项目名称:mollify,代码行数:36,代码来源:LockDiscovery.php

示例2: testBrief

 function testBrief()
 {
     $httpRequest = new Sabre_HTTP_Request(array('HTTP_BRIEF' => 't'));
     $server = new Sabre_DAV_Server();
     $server->httpRequest = $httpRequest;
     $this->assertEquals(array('strict' => false, 'lenient' => false, 'wait' => null, 'return-asynch' => false, 'return-minimal' => true, 'return-representation' => false), $server->getHTTPPrefer());
 }
开发者ID:adamchau,项目名称:teamdisk,代码行数:7,代码来源:HTTPPreferParsingTest.php

示例3: serialize

 /**
  * serialize
  *
  * @param Sabre_DAV_Server $server
  * @param DOMElement $dom
  * @return void
  */
 public function serialize(Sabre_DAV_Server $server, DOMElement $dom)
 {
     $document = $dom->ownerDocument;
     $properties = $this->responseProperties;
     $xresponse = $document->createElement('d:response');
     $dom->appendChild($xresponse);
     $uri = Sabre_DAV_URLUtil::encodePath($this->href);
     // Adding the baseurl to the beginning of the url
     $uri = $server->getBaseUri() . $uri;
     $xresponse->appendChild($document->createElement('d:href', $uri));
     // The properties variable is an array containing properties, grouped by
     // HTTP status
     foreach ($properties as $httpStatus => $propertyGroup) {
         // The 'href' is also in this array, and it's special cased.
         // We will ignore it
         if ($httpStatus == 'href') {
             continue;
         }
         // If there are no properties in this group, we can also just carry on
         if (!count($propertyGroup)) {
             continue;
         }
         $xpropstat = $document->createElement('d:propstat');
         $xresponse->appendChild($xpropstat);
         $xprop = $document->createElement('d:prop');
         $xpropstat->appendChild($xprop);
         $nsList = $server->xmlNamespaces;
         foreach ($propertyGroup as $propertyName => $propertyValue) {
             $propName = null;
             preg_match('/^{([^}]*)}(.*)$/', $propertyName, $propName);
             // special case for empty namespaces
             if ($propName[1] == '') {
                 $currentProperty = $document->createElement($propName[2]);
                 $xprop->appendChild($currentProperty);
                 $currentProperty->setAttribute('xmlns', '');
             } else {
                 if (!isset($nsList[$propName[1]])) {
                     $nsList[$propName[1]] = 'x' . count($nsList);
                 }
                 // If the namespace was defined in the top-level xml namespaces, it means
                 // there was already a namespace declaration, and we don't have to worry about it.
                 if (isset($server->xmlNamespaces[$propName[1]])) {
                     $currentProperty = $document->createElement($nsList[$propName[1]] . ':' . $propName[2]);
                 } else {
                     $currentProperty = $document->createElementNS($propName[1], $nsList[$propName[1]] . ':' . $propName[2]);
                 }
                 $xprop->appendChild($currentProperty);
             }
             if (is_scalar($propertyValue)) {
                 $text = $document->createTextNode($propertyValue);
                 $currentProperty->appendChild($text);
             } elseif ($propertyValue instanceof Sabre_DAV_PropertyInterface) {
                 $propertyValue->serialize($server, $currentProperty);
             } elseif (!is_null($propertyValue)) {
                 throw new Sabre_DAV_Exception('Unknown property value type: ' . gettype($propertyValue) . ' for property: ' . $propertyName);
             }
         }
         $xpropstat->appendChild($document->createElement('d:status', $server->httpResponse->getStatusMessage($httpStatus)));
     }
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:67,代码来源:Response.php

示例4: serialize

 /**
  * Serializes this property.
  *
  * It will additionally prepend the href property with the server's base uri.
  * 
  * @param Sabre_DAV_Server $server 
  * @param DOMElement $dom 
  * @return void
  */
 public function serialize(Sabre_DAV_Server $server, DOMElement $dom)
 {
     $prefix = $server->xmlNamespaces['DAV:'];
     $elem = $dom->ownerDocument->createElement($prefix . ':href');
     $elem->nodeValue = ($this->autoPrefix ? $server->getBaseUri() : '') . $this->href;
     $dom->appendChild($elem);
 }
开发者ID:kumarsivarajan,项目名称:mollify,代码行数:16,代码来源:Href.php

示例5: testLockEtc

 function testLockEtc()
 {
     mkdir(SABRE_TEMPDIR . '/mstest');
     $tree = new Sabre_DAV_FS_Directory(SABRE_TEMPDIR . '/mstest');
     $server = new Sabre_DAV_Server($tree);
     $server->debugExceptions = true;
     $locksBackend = new Sabre_DAV_Locks_Backend_File(SABRE_TEMPDIR . '/locksdb');
     $locksPlugin = new Sabre_DAV_Locks_Plugin($locksBackend);
     $server->addPlugin($locksPlugin);
     $response1 = new Sabre_HTTP_ResponseMock();
     $server->httpRequest = $this->getLockRequest();
     $server->httpResponse = $response1;
     $server->exec();
     $this->assertEquals('HTTP/1.1 201 Created', $server->httpResponse->status);
     $this->assertTrue(isset($server->httpResponse->headers['Lock-Token']));
     $lockToken = $server->httpResponse->headers['Lock-Token'];
     //sleep(10);
     $response2 = new Sabre_HTTP_ResponseMock();
     $server->httpRequest = $this->getLockRequest2();
     $server->httpResponse = $response2;
     $server->exec();
     $this->assertEquals('HTTP/1.1 201 Created', $server->httpResponse->status);
     $this->assertTrue(isset($server->httpResponse->headers['Lock-Token']));
     //sleep(10);
     $response3 = new Sabre_HTTP_ResponseMock();
     $server->httpRequest = $this->getPutRequest($lockToken);
     $server->httpResponse = $response3;
     $server->exec();
     $this->assertEquals('HTTP/1.1 204 No Content', $server->httpResponse->status);
 }
开发者ID:ZerGabriel,项目名称:friendica-addons,代码行数:30,代码来源:MSWordTest.php

示例6: testBeforeMethodNoExport

 function testBeforeMethodNoExport()
 {
     $p = new Sabre_CalDAV_ICSExportPlugin();
     $s = new Sabre_DAV_Server();
     $s->addPlugin($p);
     $this->assertNull($p->beforeMethod('GET', 'UUID-123467'));
 }
开发者ID:rolwi,项目名称:koala,代码行数:7,代码来源:ICSExportPluginTest.php

示例7: indexAction

 public function indexAction()
 {
     // Set the root directory
     $webdavPath = Phprojekt::getInstance()->getConfig()->webdavPath;
     if (Phprojekt_Auth::isLoggedIn()) {
         $project = new Project_Models_Project();
         $project = $project->find(1);
         $rootDirectory = new WebDAV_Models_ProjectDirectory($project);
     } else {
         // Some clients seem to send some queries without http auth. We need the dummy to serve those.
         $rootDirectory = new WebDAV_Models_EmptyDir();
     }
     // The server object is responsible for making sense out of the WebDAV protocol
     $server = new Sabre_DAV_Server($rootDirectory);
     $server->setBaseUri($this->view->baseUrl('index.php/WebDAV/index/index/'));
     // The lock manager is reponsible for making sure users don't overwrite each others changes.
     // Change 'data' to a different directory, if you're storing your data somewhere else.
     $lockBackend = new Sabre_DAV_Locks_Backend_File($webdavPath . 'data/locks');
     $lockPlugin = new Sabre_DAV_Locks_Plugin($lockBackend);
     $server->addPlugin($lockPlugin);
     // Authentication
     $authBackend = new WebDAV_Helper_Auth();
     $authPlugin = new Sabre_DAV_Auth_Plugin($authBackend, 'WebDAV');
     $server->addPlugin($authPlugin);
     // All we need to do now, is to fire up the server
     $server->exec();
 }
开发者ID:RainyBlueSky,项目名称:PHProjekt,代码行数:27,代码来源:IndexController.php

示例8: testGetCurrentUserPrincipal

 /**
  * @depends testInit
  */
 function testGetCurrentUserPrincipal()
 {
     $fakeServer = new Sabre_DAV_Server(new Sabre_DAV_ObjectTree(new Sabre_DAV_SimpleDirectory('bla')));
     $plugin = new Sabre_DAV_Auth_Plugin(new Sabre_DAV_Auth_MockBackend(), 'realm');
     $fakeServer->addPlugin($plugin);
     $fakeServer->broadCastEvent('beforeMethod', array('GET', '/'));
     $this->assertEquals('admin', $plugin->getCurrentUser());
 }
开发者ID:RainyBlueSky,项目名称:PHProjekt,代码行数:11,代码来源:PluginTest.php

示例9: initialize

 /**
  * Initializes the plugin 
  * 
  * @param Sabre_DAV_Server $server 
  * @return void
  */
 public function initialize(Sabre_DAV_Server $server)
 {
     $this->server = $server;
     $server->subscribeEvent('beforeGetProperties', array($this, 'beforeGetProperties'));
     $server->xmlNamespaces[Sabre_CalDAV_Plugin::NS_CALDAV] = 'cal';
     $server->resourceTypeMapping['Sabre_CalDAV_ICalendar'] = '{urn:ietf:params:xml:ns:caldav}calendar';
     array_push($server->protectedProperties, '{' . Sabre_CalDAV_Plugin::NS_CALDAV . '}schedule-calendar-transp', '{' . Sabre_CalDAV_Plugin::NS_CALDAV . '}schedule-default-calendar-URL', '{' . Sabre_CalDAV_Plugin::NS_CALDAV . '}schedule-tag');
 }
开发者ID:rodrigofns,项目名称:ExpressoLivre3,代码行数:14,代码来源:PluginAutoSchedule.php

示例10: initialize

 /**
  * This initializes the plugin.
  *
  * This function is called by Sabre_DAV_Server, after
  * addPlugin is called.
  *
  * This method should set up the required event subscriptions.
  *
  * @param Sabre_DAV_Server $server
  * @return void
  */
 public function initialize(Sabre_DAV_Server $server)
 {
     $server->xmlNamespaces[self::NS_OWNCLOUD] = 'oc';
     $server->protectedProperties[] = '{' . self::NS_OWNCLOUD . '}id';
     $this->server = $server;
     $this->server->subscribeEvent('beforeGetProperties', array($this, 'beforeGetProperties'));
     $this->server->subscribeEvent('afterCreateFile', array($this, 'sendFileIdHeader'));
     $this->server->subscribeEvent('afterWriteContent', array($this, 'sendFileIdHeader'));
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:20,代码来源:filesplugin.php

示例11: testResourceType

 function testResourceType()
 {
     $tree = array(new Sabre_CardDAV_DirectoryMock('directory'));
     $server = new Sabre_DAV_Server($tree);
     $plugin = new Sabre_CardDAV_Plugin();
     $server->addPlugin($plugin);
     $props = $server->getProperties('directory', array('{DAV:}resourcetype'));
     $this->assertTrue($props['{DAV:}resourcetype']->is('{' . Sabre_CardDAV_Plugin::NS_CARDDAV . '}directory'));
 }
开发者ID:ZerGabriel,项目名称:friendica-addons,代码行数:9,代码来源:IDirectoryTest.php

示例12: testSetBadNode

 public function testSetBadNode()
 {
     $tree = array(new Sabre_DAV_SimpleCollection('foo'));
     $server = new Sabre_DAV_Server($tree);
     $server->addPlugin(new Sabre_DAVACL_Plugin());
     $result = $server->updateProperties('foo', array('{DAV:}group-member-set' => new Sabre_DAV_Property_HrefList(array('bar', 'baz')), '{DAV:}bar' => 'baz'));
     $expected = array('href' => 'foo', '403' => array('{DAV:}group-member-set' => null), '424' => array('{DAV:}bar' => null));
     $this->assertEquals($expected, $result);
 }
开发者ID:ZerGabriel,项目名称:friendica-addons,代码行数:9,代码来源:PluginUpdatePropertiesTest.php

示例13: testUpdatePropertiesEventSuccess

 function testUpdatePropertiesEventSuccess()
 {
     $tree = array(new Sabre_DAV_SimpleDirectory('foo'));
     $server = new Sabre_DAV_Server($tree);
     $server->subscribeEvent('updateProperties', array($this, 'updatepropsuccess'));
     $result = $server->updateProperties('foo', array('{DAV:}foo' => 'bar', '{DAV:}foo2' => 'bla'));
     $expected = array('href' => 'foo', '200' => array('{DAV:}foo' => null), '201' => array('{DAV:}foo2' => null));
     $this->assertEquals($expected, $result);
 }
开发者ID:rolwi,项目名称:koala,代码行数:9,代码来源:ServerUpdatePropertiesTest.php

示例14: setUp

 function setUp()
 {
     $this->backend = new Sabre_CardDAV_Backend_Mock();
     $principalBackend = new Sabre_DAVACL_MockPrincipalBackend();
     $tree = array(new Sabre_CardDAV_AddressBookRoot($principalBackend, $this->backend), new Sabre_DAVACL_PrincipalCollection($principalBackend));
     $this->plugin = new Sabre_CardDAV_Plugin();
     $this->plugin->directories = array('directory');
     $this->server = new Sabre_DAV_Server($tree);
     $this->server->addPlugin($this->plugin);
     $this->server->debugExceptions = true;
 }
开发者ID:ZerGabriel,项目名称:friendica-addons,代码行数:11,代码来源:AbstractPluginTest.php

示例15: testReportPassThrough

 function testReportPassThrough()
 {
     $fakeServer = new Sabre_DAV_Server(new Sabre_DAV_ObjectTree(new Sabre_DAV_SimpleDirectory('bla')));
     $plugin = new Sabre_DAV_Auth_Plugin(new Sabre_DAV_Auth_MockBackend(), 'realm');
     $fakeServer->addPlugin($plugin);
     $request = new Sabre_HTTP_Request(array('REQUEST_METHOD' => 'REPORT', 'HTTP_CONTENT_TYPE' => 'application/xml', 'REQUEST_URI' => '/'));
     $request->setBody('<?xml version="1.0"?><s:somereport xmlns:s="http://www.rooftopsolutions.nl/NS/example" />');
     $fakeServer->httpRequest = $request;
     $fakeServer->httpResponse = new Sabre_HTTP_ResponseMock();
     $fakeServer->exec();
     $this->assertEquals('HTTP/1.1 501 Not Implemented', $fakeServer->httpResponse->status);
 }
开发者ID:Gninety,项目名称:Microweber,代码行数:12,代码来源:PluginTest.php


注:本文中的Sabre_DAV_Server类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。