本文整理汇总了PHP中Sabre_DAV_Server::exec方法的典型用法代码示例。如果您正苦于以下问题:PHP Sabre_DAV_Server::exec方法的具体用法?PHP Sabre_DAV_Server::exec怎么用?PHP Sabre_DAV_Server::exec使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sabre_DAV_Server
的用法示例。
在下文中一共展示了Sabre_DAV_Server::exec方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: request
/**
* Makes a request, and returns a response object.
*
* You can either pass an isntance of Sabre_HTTP_Request, or an array,
* which will then be used as the _SERVER array.
*
* @param array|Sabre_HTTP_Request $request
* @return Sabre_HTTP_Response
*/
function request($request)
{
if (is_array($request)) {
$request = new Sabre_HTTP_Request($request);
}
$this->server->httpRequest = $request;
$this->server->httpResponse = new Sabre_HTTP_ResponseMock();
$this->server->exec();
return $this->server->httpResponse;
}
示例3: process
public function process()
{
// initialize authentication
$auth = new Sabre_HTTP_DigestAuth();
$auth->setRealm($this->app->config->site->auth_realm);
$auth->init();
// authenticate and get correct user
$email = $auth->getUsername();
$class_name = SwatDBClassMap::get('PinholeAdminUser');
$user = new $class_name();
$user->setDatabase($this->app->db);
if (!$user->loadFromEmail($email) || !$auth->validateA1($user->digest_ha1)) {
$auth->requireLogin();
echo Pinhole::_('Authentication required') . "\n";
exit;
}
// create directory for account and object tree for dav server
$root = new PinholeDavDirectory($this->app, $user);
$tree = new Sabre_DAV_ObjectTree($root);
// create server
$server = new Sabre_DAV_Server($tree);
$server->setBaseUri($this->getDavBaseUri());
// don't save temp files in the database
$tempFilePlugin = new Sabre_DAV_TemporaryFileFilterPlugin($this->getDataDir('dav/temp'));
$server->addPlugin($tempFilePlugin);
// set up lock plugin
$lockBackend = new Sabre_DAV_Locks_Backend_FS($this->getDataDir('dav/locks'));
$lockPlugin = new Sabre_DAV_Locks_Plugin($lockBackend);
$server->addPlugin($lockPlugin);
// also allow regular web browsing
$browserPlugin = new Sabre_DAV_Browser_Plugin(false);
$server->addPlugin($browserPlugin);
// serve it up!
$server->exec();
}
示例4: indexAction
/**
* Fire up the SabreDAV server with our custom backends.
*
* This is mostly copied from the sabredav wiki
*/
public function indexAction()
{
// Backends
$authBackend = new WebDAV_Helper_Auth();
$principalBackend = new Phprojekt_CalDAV_PrincipalBackend();
$calendarBackend = new Calendar2_CalDAV_CalendarBackend();
// Directory tree
$tree = array(new Sabre_DAVACL_PrincipalCollection($principalBackend), new Sabre_CalDAV_CalendarRootNode($principalBackend, $calendarBackend));
$server = new Sabre_DAV_Server($tree);
$server->setBaseUri('/index.php/Calendar2/caldav/index');
// Authentication plugin
$authPlugin = new Sabre_DAV_Auth_Plugin($authBackend, 'CalDAV');
$server->addPlugin($authPlugin);
// CalDAV plugin
$caldavPlugin = new Sabre_CalDAV_Plugin();
$server->addPlugin($caldavPlugin);
// ACL plugin
$aclPlugin = new Sabre_DAVACL_Plugin();
$server->addPlugin($aclPlugin);
// Support for html frontend
$browser = new Sabre_DAV_Browser_Plugin();
$server->addPlugin($browser);
// And off we go!
$server->exec();
}
示例5: 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();
}
示例6: testCalendarMultiGetReportEndBeforeStart
/**
* @depends testCalendarMultiGetReport
*/
function testCalendarMultiGetReportEndBeforeStart()
{
$body = '<?xml version="1.0"?>' . '<c:calendar-multiget xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">' . '<d:prop>' . ' <c:calendar-data>' . ' <c:expand start="20200101T000000Z" end="20110101T000000Z" />' . ' </c:calendar-data>' . ' <d:getetag />' . '</d:prop>' . '<d:href>/calendars/user1/UUID-123467/UUID-2345</d:href>' . '</c:calendar-multiget>';
$request = new Sabre_HTTP_Request(array('REQUEST_METHOD' => 'REPORT', 'REQUEST_URI' => '/calendars/user1', 'HTTP_DEPTH' => '1'));
$request->setBody($body);
$this->server->httpRequest = $request;
$this->server->exec();
$this->assertEquals('HTTP/1.1 400 Bad request', $this->response->status, 'Invalid HTTP status received. Full response body: ' . $this->response->body);
}
示例7: testSimpleCopyCollection
function testSimpleCopyCollection()
{
$serverVars = array('REQUEST_URI' => '/col', 'REQUEST_METHOD' => 'COPY', 'HTTP_DESTINATION' => '/col2');
$request = new Sabre_HTTP_Request($serverVars);
$this->server->httpRequest = $request;
$this->server->exec();
$this->assertEquals('HTTP/1.1 201 Created', $this->response->status, 'Incorrect status received. Full response body: ' . $this->response->body);
$this->assertEquals(array('Content-Length' => '0'), $this->response->headers);
$this->assertEquals('Test contents', file_get_contents(SABRE_TEMPDIR . '/col2/test.txt'));
}
示例8: 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);
}
示例9: frameResponse
public function frameResponse(\FrameResponseObject $frameResponseObject)
{
$root = array(new \SteamDavDirectory($GLOBALS["STEAM"]->get_current_steam_user()->get_workroom()), new \Sabre_DAV_SimpleDirectory("Lesezeichen"), new \Sabre_DAV_SimpleDirectory("Gruppen"), new \Sabre_DAV_SimpleDirectory("Kurse"));
$server = new \Sabre_DAV_Server($root);
$server->setBaseUri("/webdav/index/");
// Support for html frontend
$browser = new \Sabre_DAV_Browser_Plugin();
$server->addPlugin($browser);
// And off we go!
$server->exec();
exit;
}
示例10: gallery
public function gallery()
{
$root = new Gallery3_DAV_Album("");
$tree = new Gallery3_DAV_Tree($root);
// Skip the lock plugin for now, we don't want Finder to get write support for the time being.
// $lock_backend = new Sabre_DAV_Locks_Backend_FS(TMPPATH . "sabredav");
// $lock = new Sabre_DAV_Locks_Plugin($lock_backend);
$filter = new Sabre_DAV_TemporaryFileFilterPlugin(TMPPATH . "sabredav");
$server = new Sabre_DAV_Server($tree);
$server->setBaseUri(url::site("webdav/gallery"));
// $server->addPlugin($lock);
$server->addPlugin($filter);
if ($this->_authenticate()) {
$server->exec();
}
}
示例11: testAdminAccess
/**
* @depends testNoAdminAccess
*/
function testAdminAccess()
{
$principalBackend = new Sabre_DAVACL_MockPrincipalBackend();
$tree = array(new Sabre_DAVACL_MockACLNode('adminonly', array()), new Sabre_DAVACL_PrincipalCollection($principalBackend));
$fakeServer = new Sabre_DAV_Server($tree);
$plugin = new Sabre_DAV_Auth_Plugin(new Sabre_DAV_Auth_MockBackend(), 'realm');
$fakeServer->addPlugin($plugin);
$plugin = new Sabre_DAVACL_Plugin();
$plugin->adminPrincipals = array('principals/admin');
$fakeServer->addPlugin($plugin);
$request = new Sabre_HTTP_Request(array('REQUEST_METHOD' => 'OPTIONS', 'HTTP_DEPTH' => 1, 'REQUEST_URI' => '/adminonly'));
$response = new Sabre_HTTP_ResponseMock();
$fakeServer->httpRequest = $request;
$fakeServer->httpResponse = $response;
$fakeServer->exec();
$this->assertEquals('HTTP/1.1 200 OK', $response->status);
}
示例12: testEverything
/**
* @depends testTreeMove
* @depends testCopyMoveInfo
*/
function testEverything()
{
// Request object
$serverVars = array('REQUEST_METHOD' => 'MOVE', 'REQUEST_URI' => '/webdav/foo', 'HTTP_DESTINATION' => 'http://dev2.tribalos.com/webdav/%C3%A0fo%C3%B3', 'HTTP_OVERWRITE' => 'F');
$request = new Sabre_HTTP_Request($serverVars);
$request->setBody('');
$response = new Sabre_HTTP_ResponseMock();
// Server setup
mkdir(SABRE_TEMPDIR . '/issue33');
$dir = new Sabre_DAV_FS_Directory(SABRE_TEMPDIR . '/issue33');
$dir->createDirectory('foo');
$tree = new Sabre_DAV_ObjectTree($dir);
$server = new Sabre_DAV_Server($tree);
$server->setBaseUri('/webdav/');
$server->httpRequest = $request;
$server->httpResponse = $response;
$server->exec();
$this->assertTrue(file_exists(SABRE_TEMPDIR . '/issue33/' . urldecode('%C3%A0fo%C3%B3')));
}
示例13: requestAction
/**
* Handles a WebDAV request.
*/
public function requestAction()
{
if (!isset($this->_config->resources->sabredav->enabled) || 0 == $this->_config->resources->sabredav->enabled) {
// Render 404
$response = $this->getResponse();
$response->clearAllHeaders();
$response->clearBody();
$response->setHttpResponseCode(404);
$response->sendResponse();
return;
}
$baseUri = $this->view->url('@admin_webdav');
$publicDir = ROOT_PATH . '/public/uploads';
$tmpDir = ROOT_PATH . '/data/tmp';
$auth = new Sabre_HTTP_BasicAuth();
$auth->setRealm('Fizzy');
$authResult = $auth->getUserPass();
if (false === $authResult) {
$auth->requireLogin();
die('Authentication required');
}
list($username, $password) = $authResult;
$authAdapter = new Fizzy_Doctrine_AuthAdapter($username, $password);
$authResult = $authAdapter->authenticate();
if ($authResult->getCode() !== Zend_Auth_Result::SUCCESS) {
$auth->requireLogin();
die('Authentication failed');
}
$publicDirObj = new Sabre_DAV_FS_Directory($publicDir);
$objectTree = new Sabre_DAV_ObjectTree($publicDirObj);
$server = new Sabre_DAV_Server($objectTree);
$server->setBaseUri($baseUri);
if (isset($this->_config->resources->sabredav->browser) && false != $this->_config->resources->sabredav->browser) {
$browser = new Sabre_DAV_Browser_Plugin();
$server->addPlugin($browser);
}
$server->exec();
}
示例14: request
function request(Sabre_HTTP_Request $request)
{
$this->server->httpRequest = $request;
$this->server->exec();
return $this->server->httpResponse;
}
示例15: array
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
// only need filesystem apps
$RUNTIME_APPTYPES = array('filesystem', 'authentication');
OC_App::loadApps($RUNTIME_APPTYPES);
// Backends
$authBackend = new OC_Connector_Sabre_Auth();
$lockBackend = new OC_Connector_Sabre_Locks();
// Create ownCloud Dir
$publicDir = new OC_Connector_Sabre_Directory('');
// Fire up server
$server = new Sabre_DAV_Server($publicDir);
$server->setBaseUri($baseuri);
// Load plugins
$server->addPlugin(new Sabre_DAV_Auth_Plugin($authBackend, 'ownCloud'));
$server->addPlugin(new Sabre_DAV_Locks_Plugin($lockBackend));
$server->addPlugin(new Sabre_DAV_Browser_Plugin(false));
// Show something in the Browser, but no upload
// And off we go!
$server->exec();