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


PHP Server::exec方法代码示例

本文整理汇总了PHP中Sabre\DAV\Server::exec方法的典型用法代码示例。如果您正苦于以下问题:PHP Server::exec方法的具体用法?PHP Server::exec怎么用?PHP Server::exec使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sabre\DAV\Server的用法示例。


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

示例1: testLockEtc

 function testLockEtc()
 {
     mkdir(SABRE_TEMPDIR . '/mstest');
     $tree = new DAV\FS\Directory(SABRE_TEMPDIR . '/mstest');
     $server = new DAV\Server($tree);
     $server->debugExceptions = true;
     $locksBackend = new Backend\File(SABRE_TEMPDIR . '/locksdb');
     $locksPlugin = new Plugin($locksBackend);
     $server->addPlugin($locksPlugin);
     $response1 = new HTTP\ResponseMock();
     $server->httpRequest = $this->getLockRequest();
     $server->httpResponse = $response1;
     $server->sapi = new HTTP\SapiMock();
     $server->exec();
     $this->assertEquals(201, $server->httpResponse->getStatus(), 'Full response body:' . $response1->getBodyAsString());
     $this->assertTrue(!!$server->httpResponse->getHeaders('Lock-Token'));
     $lockToken = $server->httpResponse->getHeader('Lock-Token');
     //sleep(10);
     $response2 = new HTTP\ResponseMock();
     $server->httpRequest = $this->getLockRequest2();
     $server->httpResponse = $response2;
     $server->exec();
     $this->assertEquals(201, $server->httpResponse->status);
     $this->assertTrue(!!$server->httpResponse->getHeaders('Lock-Token'));
     //sleep(10);
     $response3 = new HTTP\ResponseMock();
     $server->httpRequest = $this->getPutRequest($lockToken);
     $server->httpResponse = $response3;
     $server->exec();
     $this->assertEquals(204, $server->httpResponse->status);
 }
开发者ID:sebbie42,项目名称:casebox,代码行数:31,代码来源:MSWordTest.php

示例2: testLockEtc

 function testLockEtc()
 {
     mkdir(SABRE_TEMPDIR . '/mstest');
     $tree = new DAV\FS\Directory(SABRE_TEMPDIR . '/mstest');
     $server = new DAV\Server($tree);
     $server->debugExceptions = true;
     $locksBackend = new Backend\File(SABRE_TEMPDIR . '/locksdb');
     $locksPlugin = new Plugin($locksBackend);
     $server->addPlugin($locksPlugin);
     $response1 = new 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 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 HTTP\ResponseMock();
     $server->httpRequest = $this->getPutRequest($lockToken);
     $server->httpResponse = $response3;
     $server->exec();
     $this->assertEquals('HTTP/1.1 204 No Content', $server->httpResponse->status);
 }
开发者ID:samj1912,项目名称:repo,代码行数:30,代码来源:MSWordTest.php

示例3: indexAction

 /**
  * @param Request $request
  *
  * @return StreamedResponse
  */
 public function indexAction(Request $request)
 {
     date_default_timezone_set('Europe/Paris');
     $baseUri = $this->generateUrl('caldav');
     $pmanager = $this->get('pmanager');
     // Backends:
     $authBackend = new Auth($pmanager);
     $calendarBackend = new Calendar($pmanager, $this->generateUrl('event_read', [], true), $this->get('cocur_slugify'));
     $principalBackend = new Principals($pmanager);
     $tree = [new Collection($principalBackend), new CalendarRoot($principalBackend, $calendarBackend)];
     $server = new Server($tree);
     $server->setBaseUri($baseUri);
     $server->addPlugin(new AuthPlugin($authBackend, 'SabreDAV'));
     $server->addPlugin(new ACLPlugin());
     $server->addPlugin(new ICSExportPlugin());
     $server->addPlugin(new CalDAVPlugin());
     $server->addPlugin(new SubscriptionsPlugin());
     $server->addPlugin(new SchedulePlugin());
     $server->addPlugin(new SyncPlugin());
     $server->addPlugin(new BrowserPlugin());
     $callback = function () use($server, $request) {
         /* These two lines fix a weird bug
            where SabreDAV wouldn't give the correct answer to a propfind */
         $url = $server->httpRequest->getUrl();
         $server->httpRequest = new SabreRequest($request->getMethod(), $url, $request->headers->all(), $request->getContent());
         $server->exec();
         /* These two lines log the request and the response */
         $responseBody = $server->httpResponse->getBodyAsString();
         $this->logIt($request, $server->httpResponse, $responseBody);
     };
     return new StreamedResponse($callback);
 }
开发者ID:WebschoolPoitiers,项目名称:ODEV2,代码行数:37,代码来源:CalDAVController.php

示例4: init

 function init()
 {
     if (!is_dir('store')) {
         os_mkdir('store', STORAGE_DEFAULT_PERMISSIONS, false);
     }
     $which = null;
     if (argc() > 1) {
         $which = argv(1);
     }
     $profile = 0;
     \App::$page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . z_root() . '/feed/' . $which . '" />' . "\r\n";
     if ($which) {
         profile_load($which, $profile);
     }
     $auth = new \Zotlabs\Storage\BasicAuth();
     $ob_hash = get_observer_hash();
     if ($ob_hash) {
         if (local_channel()) {
             $channel = \App::get_channel();
             $auth->setCurrentUser($channel['channel_address']);
             $auth->channel_id = $channel['channel_id'];
             $auth->channel_hash = $channel['channel_hash'];
             $auth->channel_account_id = $channel['channel_account_id'];
             if ($channel['channel_timezone']) {
                 $auth->setTimezone($channel['channel_timezone']);
             }
         }
         $auth->observer = $ob_hash;
     }
     if ($_GET['davguest']) {
         $_SESSION['davguest'] = true;
     }
     $_SERVER['QUERY_STRING'] = str_replace(array('?f=', '&f='), array('', ''), $_SERVER['QUERY_STRING']);
     $_SERVER['QUERY_STRING'] = strip_zids($_SERVER['QUERY_STRING']);
     $_SERVER['QUERY_STRING'] = preg_replace('/[\\?&]davguest=(.*?)([\\?&]|$)/ism', '', $_SERVER['QUERY_STRING']);
     $_SERVER['REQUEST_URI'] = str_replace(array('?f=', '&f='), array('', ''), $_SERVER['REQUEST_URI']);
     $_SERVER['REQUEST_URI'] = strip_zids($_SERVER['REQUEST_URI']);
     $_SERVER['REQUEST_URI'] = preg_replace('/[\\?&]davguest=(.*?)([\\?&]|$)/ism', '', $_SERVER['REQUEST_URI']);
     $rootDirectory = new \Zotlabs\Storage\Directory('/', $auth);
     // A SabreDAV server-object
     $server = new SDAV\Server($rootDirectory);
     // prevent overwriting changes each other with a lock backend
     $lockBackend = new SDAV\Locks\Backend\File('store/[data]/locks');
     $lockPlugin = new SDAV\Locks\Plugin($lockBackend);
     $server->addPlugin($lockPlugin);
     $is_readable = false;
     // provide a directory view for the cloud in Hubzilla
     $browser = new \Zotlabs\Storage\Browser($auth);
     $auth->setBrowserPlugin($browser);
     $server->addPlugin($browser);
     // Experimental QuotaPlugin
     //	require_once('\Zotlabs\Storage/QuotaPlugin.php');
     //	$server->addPlugin(new \Zotlabs\Storage\\QuotaPlugin($auth));
     ob_start();
     // All we need to do now, is to fire up the server
     $server->exec();
     ob_end_flush();
     killme();
 }
开发者ID:BlaBlaNet,项目名称:hubzilla,代码行数:59,代码来源:Cloud.php

示例5: 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 HTTP\Request('REPORT', '/calendars/user1', ['Depth' => '1']);
     $request->setBody($body);
     $this->server->httpRequest = $request;
     $this->server->exec();
     $this->assertEquals(400, $this->response->status, 'Invalid HTTP status received. Full response body: ' . $this->response->body);
 }
开发者ID:jakobsack,项目名称:sabre-dav,代码行数:12,代码来源:PluginTest.php

示例6: testSimpleCopyCollection

 function testSimpleCopyCollection()
 {
     $serverVars = array('REQUEST_URI' => '/col', 'REQUEST_METHOD' => 'COPY', 'HTTP_DESTINATION' => '/col2');
     $request = new 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'));
 }
开发者ID:TamirAl,项目名称:hubzilla,代码行数:10,代码来源:ServerCopyMoveTest.php

示例7: testSimpleCopyCollection

 function testSimpleCopyCollection()
 {
     $serverVars = array('REQUEST_URI' => '/col', 'REQUEST_METHOD' => 'COPY', 'HTTP_DESTINATION' => '/col2');
     $request = HTTP\Sapi::createFromServerArray($serverVars);
     $this->server->httpRequest = $request;
     $this->server->exec();
     $this->assertEquals(201, $this->response->status, 'Incorrect status received. Full response body: ' . $this->response->body);
     $this->assertEquals(array('X-Sabre-Version' => [Version::VERSION], 'Content-Length' => ['0']), $this->response->getHeaders());
     $this->assertEquals('Test contents', file_get_contents(SABRE_TEMPDIR . '/col2/test.txt'));
 }
开发者ID:sebbie42,项目名称:casebox,代码行数:10,代码来源:ServerCopyMoveTest.php

示例8: testReportPassThrough

 function testReportPassThrough()
 {
     $fakeServer = new DAV\Server(new DAV\SimpleCollection('bla'));
     $plugin = new Plugin(new Backend\Mock(), 'realm');
     $fakeServer->addPlugin($plugin);
     $request = new 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 HTTP\ResponseMock();
     $fakeServer->exec();
     $this->assertEquals('HTTP/1.1 403 Forbidden', $fakeServer->httpResponse->status);
 }
开发者ID:TamirAl,项目名称:hubzilla,代码行数:12,代码来源:PluginTest.php

示例9: testAdminAccess

 /**
  * @depends testNoAdminAccess
  */
 function testAdminAccess()
 {
     $principalBackend = new PrincipalBackend\Mock();
     $tree = array(new MockACLNode('adminonly', array()), new PrincipalCollection($principalBackend));
     $fakeServer = new DAV\Server($tree);
     $plugin = new DAV\Auth\Plugin(new DAV\Auth\Backend\Mock(), 'realm');
     $fakeServer->addPlugin($plugin);
     $plugin = new Plugin();
     $plugin->adminPrincipals = array('principals/admin');
     $fakeServer->addPlugin($plugin);
     $request = new HTTP\Request(array('REQUEST_METHOD' => 'OPTIONS', 'HTTP_DEPTH' => 1, 'REQUEST_URI' => '/adminonly'));
     $response = new HTTP\ResponseMock();
     $fakeServer->httpRequest = $request;
     $fakeServer->httpResponse = $response;
     $fakeServer->exec();
     $this->assertEquals('HTTP/1.1 200 OK', $response->status);
 }
开发者ID:TamirAl,项目名称:hubzilla,代码行数:20,代码来源:PluginAdminTest.php

示例10: init

 function init()
 {
     // workaround for HTTP-auth in CGI mode
     if (x($_SERVER, 'REDIRECT_REMOTE_USER')) {
         $userpass = base64_decode(substr($_SERVER["REDIRECT_REMOTE_USER"], 6));
         if (strlen($userpass)) {
             list($name, $password) = explode(':', $userpass);
             $_SERVER['PHP_AUTH_USER'] = $name;
             $_SERVER['PHP_AUTH_PW'] = $password;
         }
     }
     if (x($_SERVER, 'HTTP_AUTHORIZATION')) {
         $userpass = base64_decode(substr($_SERVER["HTTP_AUTHORIZATION"], 6));
         if (strlen($userpass)) {
             list($name, $password) = explode(':', $userpass);
             $_SERVER['PHP_AUTH_USER'] = $name;
             $_SERVER['PHP_AUTH_PW'] = $password;
         }
     }
     if (!is_dir('store')) {
         os_mkdir('store', STORAGE_DEFAULT_PERMISSIONS, false);
     }
     if (argc() > 1) {
         profile_load(argv(1), 0);
     }
     $auth = new \Zotlabs\Storage\BasicAuth();
     $auth->setRealm(ucfirst(\Zotlabs\Lib\System::get_platform_name()) . ' ' . 'WebDAV');
     $rootDirectory = new \Zotlabs\Storage\Directory('/', $auth);
     // A SabreDAV server-object
     $server = new SDAV\Server($rootDirectory);
     $authPlugin = new \Sabre\DAV\Auth\Plugin($auth);
     $server->addPlugin($authPlugin);
     // prevent overwriting changes each other with a lock backend
     $lockBackend = new SDAV\Locks\Backend\File('store/[data]/locks');
     $lockPlugin = new SDAV\Locks\Plugin($lockBackend);
     $server->addPlugin($lockPlugin);
     // provide a directory view for the cloud in Hubzilla
     $browser = new \Zotlabs\Storage\Browser($auth);
     $auth->setBrowserPlugin($browser);
     // Experimental QuotaPlugin
     // require_once('Zotlabs/Storage/QuotaPlugin.php');
     // $server->addPlugin(new \Zotlabs\Storage\QuotaPlugin($auth));
     // All we need to do now, is to fire up the server
     $server->exec();
     killme();
 }
开发者ID:BlaBlaNet,项目名称:hubzilla,代码行数:46,代码来源:Dav.php

示例11: indexAction

 public function indexAction()
 {
     // Now we're creating a whole bunch of objects
     $rootDirectory = new DAV\FS\Directory('../public');
     // The server object is responsible for making sense out of the WebDAV protocol
     $server = new DAV\Server($rootDirectory);
     // If your server is not on your webroot, make sure the following line has the correct information
     $server->setBaseUri('/list/index');
     // The lock manager is responsible for making sure users don't overwrite each others changes.
     //$lockBackend = new DAV\Locks\Backend\File('../data/locks');
     //$lockPlugin  = new DAV\Locks\Plugin($lockBackend);
     //$server->addPlugin($lockPlugin);
     // This ensures that we get a pretty index in the browser, but it is optional.
     //$server->addPlugin(new DAV\Browser\Plugin(false));
     // All we need to do now, is to fire up the server
     $server->exec();
 }
开发者ID:Xavier94,项目名称:mydav,代码行数:17,代码来源:WebdavController.php

示例12: runServer

 /**
  * Run the server
  */
 public function runServer()
 {
     $pdo = $this->getPdoConnection();
     $principalBackend = new PrincipalBackendTypo3($pdo);
     $tree = [new Collection($principalBackend), new CalendarRoot($principalBackend, new BackendTypo3($pdo))];
     $server = new Server($tree);
     $server->setBaseUri('/CalDav/');
     /* Server Plugins */
     $authPlugin = new AuthPlugin(new AuthBackendTypo3($pdo));
     $server->addPlugin($authPlugin);
     #$aclPlugin = new \Sabre\DAVACL\Plugin();
     #$server->addPlugin($aclPlugin);
     $caldavPlugin = new Plugin();
     $server->addPlugin($caldavPlugin);
     if (GeneralUtility::getApplicationContext()->isDevelopment()) {
         $server->addPlugin(new BrowserPlugin());
     }
     $server->exec();
 }
开发者ID:mkalus,项目名称:calendarize,代码行数:22,代码来源:CalDav.php

示例13: testEverything

 /**
  * @depends testTreeMove
  * @depends testCopyMoveInfo
  */
 function testEverything()
 {
     // Request object
     $serverVars = array('REQUEST_METHOD' => 'MOVE', 'REQUEST_URI' => '/webdav/bar', 'HTTP_DESTINATION' => 'http://dev2.tribalos.com/webdav/%C3%A0fo%C3%B3', 'HTTP_OVERWRITE' => 'F');
     $request = new HTTP\Request($serverVars);
     $request->setBody('');
     $response = new HTTP\ResponseMock();
     // Server setup
     mkdir(SABRE_TEMPDIR . '/issue33');
     $dir = new FS\Directory(SABRE_TEMPDIR . '/issue33');
     $dir->createDirectory('bar');
     $tree = new ObjectTree($dir);
     $server = new 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')));
 }
开发者ID:TamirAl,项目名称:hubzilla,代码行数:23,代码来源:Issue33Test.php

示例14: handleException

/**
 * @param Exception $e
 */
function handleException(Exception $e)
{
    $request = \OC::$server->getRequest();
    // in case the request content type is text/xml - we assume it's a WebDAV request
    $isXmlContentType = strpos($request->getHeader('Content-Type'), 'text/xml');
    if ($isXmlContentType === 0) {
        // fire up a simple server to properly process the exception
        $server = new Server();
        if (!$e instanceof RemoteException) {
            // we shall not log on RemoteException
            $server->addPlugin(new ExceptionLoggerPlugin('webdav', \OC::$server->getLogger()));
        }
        $server->on('beforeMethod', function () use($e) {
            if ($e instanceof RemoteException) {
                switch ($e->getCode()) {
                    case OC_Response::STATUS_SERVICE_UNAVAILABLE:
                        throw new ServiceUnavailable($e->getMessage());
                    case OC_Response::STATUS_NOT_FOUND:
                        throw new \Sabre\DAV\Exception\NotFound($e->getMessage());
                }
            }
            $class = get_class($e);
            $msg = $e->getMessage();
            throw new ServiceUnavailable("{$class}: {$msg}");
        });
        $server->exec();
    } else {
        $statusCode = OC_Response::STATUS_INTERNAL_SERVER_ERROR;
        if ($e instanceof \OC\ServiceUnavailableException) {
            $statusCode = OC_Response::STATUS_SERVICE_UNAVAILABLE;
        }
        if ($e instanceof RemoteException) {
            // we shall not log on RemoteException
            OC_Response::setStatus($e->getCode());
            OC_Template::printErrorPage($e->getMessage());
        } else {
            \OCP\Util::writeLog('remote', $e->getMessage(), \OCP\Util::FATAL);
            OC_Response::setStatus($statusCode);
            OC_Template::printExceptionErrorPage($e);
        }
    }
}
开发者ID:rosarion,项目名称:core,代码行数:45,代码来源:remote.php

示例15: array

// The lock manager is reponsible for making sure users don't overwrite
// each others changes.
$lockBackend = new DAV\Locks\Backend\File($dolibarr_main_data_root . '/cdav/.locks');
// Principals Backend
$principalBackend = new DAVACL\PrincipalBackend\Dolibarr($user, $db);
// CardDav & CalDav Backend
$carddavBackend = new Sabre\CardDAV\Backend\Dolibarr($user, $db, $langs);
$caldavBackend = new Sabre\CalDAV\Backend\Dolibarr($user, $db, $langs, $cdavLib);
// Setting up the directory tree //
$nodes = array(new DAVACL\PrincipalCollection($principalBackend), new \Sabre\CardDAV\AddressBookRoot($principalBackend, $carddavBackend), new \Sabre\CalDAV\CalendarRoot($principalBackend, $caldavBackend), new DAV\FS\Directory($dolibarr_main_data_root . '/cdav/public'));
// admin can access all dolibarr documents
if ($user->admin) {
    $nodes[] = new DAV\FS\Directory($dolibarr_main_data_root);
}
// The server object is responsible for making sense out of the WebDAV protocol
$server = new DAV\Server($nodes);
// If your server is not on your webroot, make sure the following line has the
// correct information
$server->setBaseUri(dol_buildpath('cdav/server.php', 1) . '/');
$server->addPlugin(new \Sabre\DAV\Auth\Plugin($authBackend));
$server->addPlugin(new \Sabre\DAV\Locks\Plugin($lockBackend));
$server->addPlugin(new \Sabre\DAV\Browser\Plugin());
$server->addPlugin(new \Sabre\CardDAV\Plugin());
$server->addPlugin(new \Sabre\CalDAV\Plugin());
$server->addPlugin(new \Sabre\DAVACL\Plugin());
// $server->addPlugin(new \Sabre\DAV\Sync\Plugin());
// All we need to do now, is to fire up the server
$server->exec();
if (is_object($db)) {
    $db->close();
}
开发者ID:aternatik,项目名称:cdav,代码行数:31,代码来源:server.php


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