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


PHP ezcWebdavServer类代码示例

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


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

示例1: serializeLiveProperty

 /**
  * Returns the XML representation of a live property.
  *
  * Returns a DOMElement, representing the content of the given $property.
  * The newly created element is also appended as a child to the given
  * $parentElement.
  *
  * This method only takes care for {@link ezcWebdavGetContentTypeProperty}
  * and does not add the "charset=..." part to the generated XML output,
  * since Nautilus does not display this nicely. All other properties are
  * dispatched to the default {@link ezcWebdavPropertyHandler}.
  * 
  * @param ezcWebdavLiveProperty $property 
  * @param DOMElement $parentElement 
  * @return DOMElement
  */
 protected function serializeLiveProperty(ezcWebdavLiveProperty $property, DOMElement $parentElement)
 {
     switch (get_class($property)) {
         case 'ezcWebdavGetContentTypeProperty':
             $elementName = 'getcontenttype';
             $elementValue = $property->mime !== null ? $property->mime : null;
             break;
         default:
             return parent::serializeLiveProperty($property, $parentElement);
     }
     $propertyElement = $parentElement->appendChild(ezcWebdavServer::getInstance()->xmlTool->createDomElement($parentElement->ownerDocument, $elementName, $property->namespace));
     if ($elementValue instanceof DOMDocument) {
         $propertyElement->appendChild($dom->importNode($elementValue->documentElement, true));
     } else {
         if (is_array($elementValue)) {
             foreach ($elementValue as $subValue) {
                 $propertyElement->appendChild($subValue);
             }
         } else {
             if (is_scalar($elementValue)) {
                 $propertyElement->nodeValue = $elementValue;
             }
         }
     }
     return $propertyElement;
 }
开发者ID:jordanmanning,项目名称:ezpublish,代码行数:42,代码来源:nautilus.php

示例2: testAuthentication

 /**
  * testAuthentication 
  * 
  * @param mixed $input 
  * @param mixed $output 
  * @return void
  *
  * @dataProvider provideTestData
  */
 public function testAuthentication($input, $output)
 {
     static $num = 0;
     $num++;
     $GLOBALS['EZC_WEBDAV_TRANSPORT_TEST_BODY'] = $input['body'];
     $_SERVER = array_merge($this->serverBase, $input['server']);
     $backend = $this->getBackend();
     ezcWebdavServer::getInstance()->handle($backend);
     if (isset($GLOBALS['EZC_WEBDAV_TRANSPORT_TEST_RESPONSE_HEADERS']['WWW-Authenticate'])) {
         // Replace nounce value with standard one, since this should not be predictable
         $GLOBALS['EZC_WEBDAV_TRANSPORT_TEST_RESPONSE_HEADERS']['WWW-Authenticate']['digest'] = preg_replace('(nonce="[^"]+")', 'nonce="testnonce"', $GLOBALS['EZC_WEBDAV_TRANSPORT_TEST_RESPONSE_HEADERS']['WWW-Authenticate']['digest']);
     }
     // Check for broken DateTime in PHP versions (timestamp time zone issue)
     if (version_compare(PHP_VERSION, '5.2.6', '<')) {
         if ($input['server']['REQUEST_METHOD'] === 'PROPFIND') {
             // PROPFIND responses contain dates in XML
             $this->markTestSkipped('PHP DateTime broken in versions < 5.2.6');
             return;
         }
         if (isset($output['headers']['ETag'])) {
             unset($output['headers']['ETag']);
             unset($GLOBALS['EZC_WEBDAV_TRANSPORT_TEST_RESPONSE_HEADERS']['ETag']);
         }
     }
     $this->assertEquals($output['status'], $GLOBALS['EZC_WEBDAV_TRANSPORT_TEST_RESPONSE_STATUS']);
     $this->assertEquals($output['headers'], $GLOBALS['EZC_WEBDAV_TRANSPORT_TEST_RESPONSE_HEADERS']);
     $this->assertEquals($output['body'], $GLOBALS['EZC_WEBDAV_TRANSPORT_TEST_RESPONSE_BODY']);
 }
开发者ID:bmdevel,项目名称:ezc,代码行数:37,代码来源:server_auth_test.php

示例3: tearDown

 public function tearDown()
 {
     $server = ezcWebdavServer::getInstance();
     $server->auth = null;
     $server->pluginRegistry->unregisterPlugin(new ezcWebdavLockPluginConfiguration());
     $this->backend = null;
     $this->removeTempDir();
 }
开发者ID:zetacomponents,项目名称:webdav,代码行数:8,代码来源:lock_administrator_test.php

示例4: getServer

 protected function getServer(ezcWebdavPathFactory $pathFactory)
 {
     $server = ezcWebdavServer::getInstance();
     $server->reset();
     foreach ($server->configurations as $id => $cfg) {
         // Prepare mock classes, if not done, yet
         if (!class_exists($mockClass = "{$cfg->transportClass}Mock")) {
             eval(sprintf($this->mockClassSource, $cfg->transportClass, $cfg->transportClass));
         }
         // Mock all transports
         $server->configurations[$id]->transportClass = "{$cfg->transportClass}Mock";
         $server->configurations[$id]->pathFactory = $pathFactory;
     }
     $server->auth = new ezcWebdavTestAuth();
     return $server;
 }
开发者ID:zetacomponents,项目名称:webdav,代码行数:16,代码来源:client_test_setup.php

示例5: generatedResponse

 /**
  * Handles responses generated by the backend.
  * 
  * @param ezcWebdavPluginParameters $params 
  * @return ezcWebdavResponse|null
  */
 public function generatedResponse(ezcWebdavPluginParameters $params)
 {
     if (isset($this->handler)) {
         $res = null;
         try {
             $res = $this->handler->generatedResponse($params['response']);
         } catch (Exception $e) {
             if ($this->handler->needsBackendLock) {
                 ezcWebdavServer::getInstance()->backend->unlock();
             }
             throw $e;
         }
         if ($this->handler->needsBackendLock) {
             ezcWebdavServer::getInstance()->backend->unlock();
         }
         return $res;
     }
 }
开发者ID:jacomyma,项目名称:GEXF-Atlas,代码行数:24,代码来源:main.php

示例6: init

 /**
  * Initialize the plugin.
  *
  * This method is called after the server has be initialized to make the
  * plugin setup necessary objects and to retreive necessary information
  * from the server.
  * 
  * @return void
  */
 public function init()
 {
     $srv = ezcWebdavServer::getInstance();
     if (!$srv->backend instanceof ezcWebdavLockBackend) {
         throw new ezcWebdavPluginPreconditionFailedException($this->getNamespace(), 'Backend does not implement ezcWebdavLockBackend.');
     }
     if (!is_object($srv->auth) || !$srv->auth instanceof ezcWebdavLockAuthorizer) {
         throw new ezcWebdavPluginPreconditionFailedException($this->getNamespace(), 'No authorizer available or authorizer does not implement ezcWebdavLockAuthorizer.');
     }
     // @TODO: Check if more sanity checks must be tested?
 }
开发者ID:jacomyma,项目名称:GEXF-Atlas,代码行数:20,代码来源:config.php

示例7: assertSetPropertyFailure

 protected function assertSetPropertyFailure($propertyName, array $propertyValues, $exceptionClass)
 {
     foreach ($propertyValues as $value) {
         try {
             $srv = ezcWebdavServer::getInstance();
             $srv->{$propertyName} = $value;
             $this->fail("Exception not thrown on invalid ___set() value for property '{$propertyName}'.");
         } catch (Exception $e) {
             $this->assertTrue($e instanceof $exceptionClass, "Exception thrown on invalid value set for property '{$propertyName}'. '" . get_class($e) . "' instead of '{$exceptionClass}'.");
         }
     }
 }
开发者ID:zetacomponents,项目名称:webdav,代码行数:12,代码来源:server_test.php

示例8: move

 public function move(ezcWebdavMoveRequest $request)
 {
     global $prefs;
     global $filegallib;
     include_once 'lib/filegals/filegallib.php';
     print_debug("-- HTTP method: MOVE --\n");
     $this->acquireLock();
     // Indicates wheather a destiantion resource has been replaced or not.
     // The success response code depends on this.
     $replaced = false;
     // Extract paths from request
     $source = $request->requestUri;
     $dest = $request->getHeader('Destination');
     // Check authorization
     // Need to do this before checking of node existence is checked, to
     // avoid leaking information
     if (!ezcWebdavServer::getInstance()->isAuthorized($dest, $request->getHeader('Authorization'), ezcWebdavAuthorizer::ACCESS_WRITE)) {
         $this->freeLock();
         return $this->createUnauthorizedResponse($dest, $request->getHeader('Authorization'));
     }
     // Check if resource is available
     if (!$this->nodeExists($source)) {
         $this->freeLock();
         return new ezcWebdavErrorResponse(ezcWebdavResponse::STATUS_404, $source);
     }
     // If source and destination are equal, the request should always fail.
     if ($source === $dest) {
         $this->freeLock();
         return new ezcWebdavErrorResponse(ezcWebdavResponse::STATUS_403, $source);
     }
     // Check if destination resource exists and throw error, when
     // overwrite header is F
     if ($request->getHeader('Overwrite') === 'F' && $this->nodeExists($dest)) {
         $this->freeLock();
         return new ezcWebdavErrorResponse(ezcWebdavResponse::STATUS_412, $dest);
     }
     // Check if the destination parent directory already exists, otherwise
     // bail out.
     if (!$this->nodeExists($destDir = dirname($dest))) {
         $this->freeLock();
         return new ezcWebdavErrorResponse(ezcWebdavResponse::STATUS_409, $dest);
     }
     // Verify If-[None-]Match headers on the $dest if it exists
     if ($this->nodeExists($dest) && ($res = $this->checkIfMatchHeaders($request, $dest)) !== null) {
         $this->freeLock();
         return $res;
     } elseif (($res = $this->checkIfMatchHeaders($request, $destDir)) !== null) {
         // Verify If-[None-]Match headers on the on $dests parent dir, if it
         // does not exist
         $this->freeLock();
         return $res;
     }
     // The destination resource should be deleted if it exists and the
     // overwrite headers is T
     if ($request->getHeader('Overwrite') === 'T' && $this->nodeExists($dest)) {
         // Check sub-sequent authorization on destination
         $authState = $this->recursiveAuthCheck($request, $dest, ezcWebdavAuthorizer::ACCESS_WRITE, true);
         if (count($authState['errors']) !== 0) {
             // Permission denied on deleting destination
             $this->freeLock();
             return $authState['errors'][0];
         }
         $replaced = true;
         if (count($delteErrors = $this->performDelete($dest)) > 0) {
             $this->freeLock();
             return new ezcWebdavMultistatusResponse($delteErrors);
         }
     }
     // All checks are passed, we can actually move now.
     $infos = array();
     $doRename = false;
     $doMove = false;
     foreach (array('source', 'dest') as $k) {
         // Get source and dest infos
         if (($infos[$k] = $filegallib->get_objectid_from_virtual_path(${$k})) !== false) {
             switch ($infos[$k]['type']) {
                 case 'filegal':
                     $infos[$k]['infos'] = $filegallib->get_file_gallery_info($infos[$k]['id']);
                     $infos[$k]['parentId'] = $infos[$k]['infos']['parentId'];
                     $infos[$k]['name'] = $infos[$k]['infos']['name'];
                     break;
                 case 'file':
                     ///TODO: Throw an error if dest is a file, but source is a filegal
                     $infos[$k]['infos'] = $filegallib->get_file($infos[$k]['id']);
                     $infos[$k]['parentId'] = $infos[$k]['infos']['galleryId'];
                     $infos[$k]['name'] = $infos[$k]['infos']['filename'];
                     break;
             }
         } elseif ($k == 'dest') {
             // If dest doesn't exist, it usually means that the file / filegal has to be renamed
             ///TODO: Throw an error if dest is a new filegal, but source is a file
             if (($objectId = $filegallib->get_objectid_from_virtual_path(dirname(${$k}))) !== false && $objectId['type'] == 'filegal') {
                 $infos[$k] = array('id' => $infos['source']['id'], 'type' => $infos['source']['type'], 'infos' => $infos['source']['infos'], 'parentId' => $objectId['id'], 'name' => basename(${$k}));
                 switch ($infos[$k]['type']) {
                     case 'filegal':
                         $infos[$k]['infos']['name'] = $infos[$k]['name'];
                         $infos[$k]['infos']['parentId'] = $infos[$k]['parentId'];
                         break;
                     case 'file':
                         $infos[$k]['infos']['name'] = $infos[$k]['name'];
//.........这里部分代码省略.........
开发者ID:jkimdon,项目名称:cohomeals,代码行数:101,代码来源:File.php

示例9: initServer

 /**
  * Initialializes the WebDAV server used for capturing.
  * 
  * Retrieves the global server singleton and replaces all configured
  * transports with their corresponding mock.
  *
  * @param ezcWebdavPathFactory $pathFactory 
  * @return void
  */
 protected function initServer($ie, $lockPlugin)
 {
     $pathFactory = new ezcWebdavBasicPathFactory('http://' . $_SERVER['HTTP_HOST'] . $this->baseUri);
     $this->server = ezcWebdavServer::getInstance();
     foreach ($this->server->configurations as $id => $transportCfg) {
         // Prepare mock classes, if not done, yet
         if (!class_exists($mockClass = $transportCfg->transportClass . 'Mock', false)) {
             eval(sprintf($this->mockClassSource, $mockClass, $transportCfg->transportClass));
         }
         // Replace with mock config
         $this->server->configurations[$id]->transportClass = $mockClass;
         $this->server->configurations[$id]->pathFactory = $pathFactory;
     }
     $this->server->auth = $ie ? new ezcWebdavTestAuthIe() : new ezcWebdavTestAuth();
     if ($lockPlugin) {
         $this->server->pluginRegistry->registerPlugin(new ezcWebdavLockPluginConfiguration(new ezcWebdavLockPluginOptions(array('backendLockTimeout' => 2000000))));
     }
     $this->server->auth->tokenAssignement = file_exists($this->tokenFile = TMP_DIR . '/tokens.ser') ? unserialize(file_get_contents($this->tokenFile)) : array();
 }
开发者ID:zetacomponents,项目名称:webdav,代码行数:28,代码来源:test_generator.php

示例10: setUp

 protected function setUp()
 {
     ezcWebdavServer::getInstance()->reset();
 }
开发者ID:jacomyma,项目名称:GEXF-Atlas,代码行数:4,代码来源:test_case.php

示例11: authenticateAnonymous

 public function authenticateAnonymous(ezcWebdavAnonymousAuth $data)
 {
     // added by @ds to fix problems with IE6 SP2
     $path = ezcWebdavServer::getInstance()->pathFactory->parseUriToPath($_SERVER['REQUEST_URI']);
     return $path === '/';
 }
开发者ID:runelangseid,项目名称:ezpublish,代码行数:6,代码来源:ezwebdavcontentbackendauth.php

示例12: tearDown

 protected function tearDown()
 {
     ezcWebdavServer::getInstance()->reset();
 }
开发者ID:bmdevel,项目名称:ezc,代码行数:4,代码来源:lock_header_handler_test.php

示例13: extractActiveTokens

 /**
  * Extracts active lock tokens from a lockdiscovery property.
  *
  * Returns an array of string lock tokens, that are active on the affected
  * resource and owned by the currently active user.
  * 
  * @param ezcWebdavLockDiscoveryProperty $lockDiscovery 
  * @param ezcWebdavAuth $authHeader 
  * @return array(string)
  */
 protected function extractActiveTokens(ezcWebdavLockDiscoveryProperty $lockDiscovery = null, ezcWebdavAuth $authHeader)
 {
     $auth = ezcWebdavServer::getInstance()->auth;
     $activeLockTokens = array();
     foreach ($lockDiscovery->activeLock as $activeLock) {
         $token = (string) $activeLock->token;
         if ($auth->ownsLock($authHeader->username, $token)) {
             $activeLockTokens[] = $token;
         }
     }
     return $activeLockTokens;
 }
开发者ID:jacomyma,项目名称:GEXF-Atlas,代码行数:22,代码来源:tools.php

示例14: updateLockProperties

 /**
  * Updates the lock properties on the target.
  *
  * Performs the neccessary PROPPATCH requests to update the lock properties
  * on the target (parent is locked or was lock null before).
  */
 protected function updateLockProperties()
 {
     if (!$this->isParentProp) {
         // No need to update
         return null;
     }
     $lockDiscoveryProp = $this->lockDiscoveryProp !== null ? clone $this->lockDiscoveryProp : new ezcWebdavLockDiscoveryProperty();
     $destParent = dirname($this->request->requestUri);
     foreach ($lockDiscoveryProp->activeLock as $id => $activeLock) {
         if ($activeLock->depth !== ezcWebdavRequest::DEPTH_INFINITY) {
             unset($lockDiscoveryProp->activeLock[$id]);
             continue;
         }
         if ($activeLock->baseUri === null) {
             $activeLock->baseUri = $destParent;
             $activeLock->lastAccess = null;
         }
     }
     $propPatchReq = new ezcWebdavPropPatchRequest($this->request->requestUri);
     ezcWebdavLockTools::cloneRequestHeaders($this->request, $propPatchReq);
     $propPatchReq->validateHeaders();
     $propPatchReq->updates->attach($lockDiscoveryProp, ezcWebdavPropPatchRequest::SET);
     $propPatchRes = ezcWebdavServer::getInstance()->backend->propPatch($propPatchReq);
     if (!$propPatchRes instanceof ezcWebdavPropPatchResponse) {
         throw new ezcWebdavInconsistencyException('Could not patch lock properties on newly created resource/collection.');
     }
 }
开发者ID:jacomyma,项目名称:GEXF-Atlas,代码行数:33,代码来源:mkcol.php

示例15: serializeProperties

 /**
  * Serializes an object of new ezcWebdavPropertyStorage to XML.
  *
  * Attaches all properties of the $storage to the $parentElement XML
  * element in their XML representation.
  * 
  * @param ezcWebdavPropertyStorage $storage 
  * @param DOMElement $parentElement 
  * @return void
  */
 public final function serializeProperties(ezcWebdavPropertyStorage $storage, DOMElement $parentElement)
 {
     foreach ($storage as $property) {
         if ($property instanceof ezcWebdavLiveProperty) {
             $propertyElement = $this->serializeLiveProperty($property, $parentElement);
             // Attempt plugins to parse an unknown live property
             if ($propertyElement === null) {
                 // Plugin hook beforeSerializeLiveProperty
                 $propertyElement = ezcWebdavServer::getInstance()->pluginRegistry->announceHook(__CLASS__, 'serializeUnknownLiveProperty', new ezcWebdavPluginParameters(array('property' => $property, 'xmlTool' => $this->getXmlTool(), 'parentElement' => $parentElement)));
             }
         } else {
             // Plugin hook serializeDeadProperty
             $propertyElement = ezcWebdavServer::getInstance()->pluginRegistry->announceHook(__CLASS__, 'serializeDeadProperty', new ezcWebdavPluginParameters(array('property' => $property, 'xmlTool' => $this->getXmlTool())));
             // No plugin wanted to serialize the propery
             if ($propertyElement === null) {
                 if ($property === false) {
                     var_dump($storage);
                 }
                 $propertyElement = $this->serializeDeadProperty($property, $parentElement);
             }
         }
         if ($propertyElement instanceof DOMNode) {
             $parentElement->appendChild($propertyElement);
         }
     }
 }
开发者ID:jkimdon,项目名称:cohomeals,代码行数:36,代码来源:property_handler.php


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