コード例 #1
0
 /**
  * Constructor.
  *
  * @param Server                   $dav
  * @param EventDispatcherInterface $dispatcher
  * @param RouterInterface          $router
  */
 public function __construct(Server $dav, EventDispatcherInterface $dispatcher, RouterInterface $router)
 {
     $this->dav = $dav;
     $this->dav->setBaseUri($router->generate('secotrust_sabre_dav', array()));
     $this->dispatcher = $dispatcher;
     // TODO needed?
 }
コード例 #2
0
ファイル: PluginTest.php プロジェクト: jakobsack/sabre-dav
 function setup()
 {
     $caldavNS = '{urn:ietf:params:xml:ns:caldav}';
     $this->caldavBackend = new Backend\Mock([['id' => 1, 'uri' => 'UUID-123467', 'principaluri' => 'principals/user1', '{DAV:}displayname' => 'user1 calendar', $caldavNS . 'calendar-description' => 'Calendar description', '{http://apple.com/ns/ical/}calendar-order' => '1', '{http://apple.com/ns/ical/}calendar-color' => '#FF0000', $caldavNS . 'supported-calendar-component-set' => new Xml\Property\SupportedCalendarComponentSet(['VEVENT', 'VTODO'])], ['id' => 2, 'uri' => 'UUID-123468', 'principaluri' => 'principals/user1', '{DAV:}displayname' => 'user1 calendar2', $caldavNS . 'calendar-description' => 'Calendar description', '{http://apple.com/ns/ical/}calendar-order' => '1', '{http://apple.com/ns/ical/}calendar-color' => '#FF0000', $caldavNS . 'supported-calendar-component-set' => new Xml\Property\SupportedCalendarComponentSet(['VEVENT', 'VTODO'])]], [1 => ['UUID-2345' => ['calendardata' => TestUtil::getTestCalendarData()]]]);
     $principalBackend = new DAVACL\PrincipalBackend\Mock();
     $principalBackend->setGroupMemberSet('principals/admin/calendar-proxy-read', ['principals/user1']);
     $principalBackend->setGroupMemberSet('principals/admin/calendar-proxy-write', ['principals/user1']);
     $principalBackend->addPrincipal(['uri' => 'principals/admin/calendar-proxy-read']);
     $principalBackend->addPrincipal(['uri' => 'principals/admin/calendar-proxy-write']);
     $calendars = new CalendarRoot($principalBackend, $this->caldavBackend);
     $principals = new Principal\Collection($principalBackend);
     $root = new DAV\SimpleCollection('root');
     $root->addChild($calendars);
     $root->addChild($principals);
     $this->server = new DAV\Server($root);
     $this->server->sapi = new HTTP\SapiMock();
     $this->server->debugExceptions = true;
     $this->server->setBaseUri('/');
     $this->plugin = new Plugin();
     $this->server->addPlugin($this->plugin);
     // Adding ACL plugin
     $this->server->addPlugin(new DAVACL\Plugin());
     // Adding Auth plugin, and ensuring that we are logged in.
     $authBackend = new DAV\Auth\Backend\Mock();
     $authBackend->setPrincipal('principals/user1');
     $authPlugin = new DAV\Auth\Plugin($authBackend);
     $authPlugin->beforeMethod(new \Sabre\HTTP\Request(), new \Sabre\HTTP\Response());
     $this->server->addPlugin($authPlugin);
     // This forces a login
     $authPlugin->beforeMethod(new HTTP\Request(), new HTTP\Response());
     $this->response = new HTTP\ResponseMock();
     $this->server->httpResponse = $this->response;
 }
コード例 #3
0
ファイル: Server.php プロジェクト: gustavonv/Baikal
 /**
  * Initializes the server object
  *
  * @return void
  */
 protected function initServer()
 {
     if ($this->authType === 'Basic') {
         $authBackend = new \Baikal\Core\PDOBasicAuth($this->pdo, $this->authRealm);
     } else {
         $authBackend = new \Sabre\DAV\Auth\Backend\PDO($this->pdo, $this->authRealm);
     }
     $principalBackend = new \Sabre\DAVACL\PrincipalBackend\PDO($this->pdo);
     $nodes = [new \Sabre\CalDAV\Principal\Collection($principalBackend)];
     if ($this->enableCalDAV) {
         $calendarBackend = new \Sabre\CalDAV\Backend\PDO($this->pdo);
         $nodes[] = new \Sabre\CalDAV\CalendarRoot($principalBackend, $calendarBackend);
     }
     if ($this->enableCardDAV) {
         $carddavBackend = new \Sabre\CardDAV\Backend\PDO($GLOBALS["DB"]->getPDO());
         $nodes[] = new \Sabre\CardDAV\AddressBookRoot($principalBackend, $carddavBackend);
     }
     $this->server = new \Sabre\DAV\Server($nodes);
     $this->server->setBaseUri($this->baseUri);
     $this->server->addPlugin(new \Sabre\DAV\Auth\Plugin($authBackend, $this->authRealm));
     $this->server->addPlugin(new \Sabre\DAVACL\Plugin());
     $this->server->addPlugin(new \Sabre\DAV\Browser\Plugin());
     if ($this->enableCalDAV) {
         $this->server->addPlugin(new \Sabre\CalDAV\Plugin());
         $this->server->addPlugin(new \Sabre\CalDAV\ICSExportPlugin());
     }
     if ($this->enableCardDAV) {
         $this->server->addPlugin(new \Sabre\CardDAV\Plugin());
         $this->server->addPlugin(new \Sabre\CardDAV\VCFExportPlugin());
     }
 }
コード例 #4
0
 /**
  * @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);
 }
コード例 #5
0
 public function idAction($id)
 {
     $server = new Server(new RootId($id));
     $server->setBaseUri(WEBDAV_BASE_URI . "id/" . $id . "/");
     $this->initDavPlugins($server);
     $server->exec();
     exit;
 }
コード例 #6
0
    /**
     * This method tests if hrefs containing & are correctly encoded.
     */
    function testSerializeEntity()
    {
        $href = new Href('http://example.org/?a&b', false);
        $this->assertEquals('http://example.org/?a&b', $href->getHref());
        $doc = new \DOMDocument();
        $root = $doc->createElement('d:anything');
        $root->setAttribute('xmlns:d', 'DAV:');
        $doc->appendChild($root);
        $server = new DAV\Server();
        $server->setBaseUri('/bla/');
        $href->serialize($server, $root);
        $xml = $doc->saveXML();
        $this->assertEquals('<?xml version="1.0"?>
<d:anything xmlns:d="DAV:"><d:href>http://example.org/?a&amp;b</d:href></d:anything>
', $xml);
    }
コード例 #7
0
    function testSerializeNoPrefix()
    {
        $href = new HrefList(array('foo', 'bar'), false);
        $this->assertEquals(array('foo', 'bar'), $href->getHrefs());
        $doc = new \DOMDocument();
        $root = $doc->createElement('d:anything');
        $root->setAttribute('xmlns:d', 'DAV:');
        $doc->appendChild($root);
        $server = new DAV\Server();
        $server->setBaseUri('/bla/');
        $href->serialize($server, $root);
        $xml = $doc->saveXML();
        $this->assertEquals('<?xml version="1.0"?>
<d:anything xmlns:d="DAV:"><d:href>foo</d:href><d:href>bar</d:href></d:anything>
', $xml);
    }
コード例 #8
0
ファイル: WebdavController.php プロジェクト: Xavier94/mydav
 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();
 }
コード例 #9
0
ファイル: CalDav.php プロジェクト: mkalus/calendarize
 /**
  * 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();
 }
コード例 #10
0
ファイル: Issue33Test.php プロジェクト: TamirAl/hubzilla
 /**
  * @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')));
 }
コード例 #11
0
ファイル: DavServer.php プロジェクト: horde/horde
 public function create(Horde_Injector $injector)
 {
     global $conf, $registry;
     $principalBackend = new Horde_Dav_Principals(new Horde_Core_Auth_UsernameHook(array('base' => $injector->getInstance('Horde_Core_Factory_Auth')->create())), $injector->getInstance('Horde_Core_Factory_Identity_DavUsernameHook'));
     $principals = new DAVACL\PrincipalCollection($principalBackend);
     $principals->disableListing = $conf['auth']['list_users'] == 'input';
     $calendarBackend = new Horde_Dav_Calendar_Backend($registry, $injector->getInstance('Horde_Dav_Storage'));
     $caldav = new CalDAV\CalendarRootNode($principalBackend, $calendarBackend);
     $contactsBackend = new Horde_Dav_Contacts_Backend($registry);
     $carddav = new CardDAV\AddressBookRoot($principalBackend, $contactsBackend);
     $server = new DAV\Server(new Horde_Dav_RootCollection($registry, array($principals, $caldav, $carddav), isset($conf['mime']['magic_db']) ? $conf['mime']['magic_db'] : null));
     $server->debugExceptions = false;
     $server->setBaseUri($registry->get('webroot', 'horde') . ($GLOBALS['conf']['urls']['pretty'] == 'rewrite' ? '/rpc/' : '/rpc.php/'));
     $server->addPlugin(new DAV\Auth\Plugin(new Horde_Core_Dav_Auth($injector->getInstance('Horde_Core_Factory_Auth')->create()), 'Horde DAV Server'));
     $server->addPlugin(new CalDAV\Plugin());
     $server->addPlugin(new CardDAV\Plugin());
     $server->addPlugin(new DAV\Locks\Plugin(new Horde_Dav_Locks($registry, $injector->getInstance('Horde_Lock'))));
     $server->addPlugin(new DAVACL\Plugin());
     $server->addPlugin(new DAV\Browser\Plugin());
     return $server;
 }
コード例 #12
0
ファイル: Server.php プロジェクト: rukzuk/rukzuk
 /**
  * init the dav server
  */
 protected function initServer()
 {
     // create server
     $root = new \Sabre\DAV\FS\Directory($this->rootDirectory);
     $this->davServer = new \Sabre\DAV\Server($root);
     if (isset($this->baseUri)) {
         $this->davServer->setBaseUri($this->baseUri);
     }
     // Authentication backend
     $authBackend = new \Sabre\DAV\Auth\Backend\BasicCallBack(array($this, 'authCallback'));
     $auth = new \Sabre\DAV\Auth\Plugin($authBackend, 'Development Area');
     $this->davServer->addPlugin($auth);
     // Support for LOCK and UNLOCK
     $lockBackend = new \Sabre\DAV\Locks\Backend\File($this->lockFilePath);
     $lockPlugin = new \Sabre\DAV\Locks\Plugin($lockBackend);
     $this->davServer->addPlugin($lockPlugin);
     // Support for html frontend
     $browser = new \Sabre\DAV\Browser\Plugin();
     $this->davServer->addPlugin($browser);
     // Automatically guess (some) contenttypes, based on extension
     $this->davServer->addPlugin(new \Sabre\DAV\Browser\GuessContentType());
     // Support for mounting
     $this->davServer->addPlugin(new \Sabre\DAV\Mount\Plugin());
 }
コード例 #13
0
ファイル: server.php プロジェクト: aternatik/cdav
// 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();
}
コード例 #14
0
ファイル: index.php プロジェクト: cheese1/ampache
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program 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 program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
define('NO_SESSION', '1');
require_once '../lib/init.php';
if (!AmpConfig::get('webdav_backend')) {
    echo "Disabled.";
    exit;
}
use Sabre\DAV;
$rootDir = new WebDAV_Catalog();
$server = new DAV\Server($rootDir);
$baseUri = (AmpConfig::get('raw_web_path') !== "/" ? AmpConfig::get('raw_web_path') : "") . '/webdav/index.php';
$server->setBaseUri($baseUri);
if (AmpConfig::get('use_auth')) {
    $authBackend = new WebDAV_Auth();
    $authPlugin = new DAV\Auth\Plugin($authBackend, 'Ampache');
    $server->addPlugin($authPlugin);
}
$server->exec();
コード例 #15
0
 /**
  * (non-PHPdoc)
  * @see Tinebase_Server_Interface::handle()
  */
 public function handle(\Zend\Http\Request $request = null, $body = null)
 {
     $this->_request = $request instanceof \Zend\Http\Request ? $request : Tinebase_Core::get(Tinebase_Core::REQUEST);
     if ($body !== null) {
         $this->_body = $body;
     } else {
         if ($this->_request instanceof \Zend\Http\Request) {
             $this->_body = fopen('php://temp', 'r+');
             fwrite($this->_body, $request->getContent());
             rewind($this->_body);
         }
     }
     try {
         list($loginName, $password) = $this->_getAuthData($this->_request);
     } catch (Tinebase_Exception_NotFound $tenf) {
         header('WWW-Authenticate: Basic realm="WebDAV for Tine 2.0"');
         header('HTTP/1.1 401 Unauthorized');
         return;
     }
     if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) {
         Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . ' is CalDav, CardDAV or WebDAV request.');
     }
     Tinebase_Core::initFramework();
     if (Tinebase_Controller::getInstance()->login($loginName, $password, $this->_request, self::REQUEST_TYPE) !== true) {
         header('WWW-Authenticate: Basic realm="WebDAV for Tine 2.0"');
         header('HTTP/1.1 401 Unauthorized');
         return;
     }
     if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) {
         Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . ' requestUri:' . $this->_request->getRequestUri());
     }
     self::$_server = new \Sabre\DAV\Server(new Tinebase_WebDav_Root());
     if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
         $contentType = self::$_server->httpRequest->getHeader('Content-Type');
         Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . " requestContentType: " . $contentType);
         if (preg_match('/^text/', $contentType)) {
             // NOTE inputstream can not be rewinded
             $debugStream = fopen('php://temp', 'r+');
             stream_copy_to_stream($this->_body, $debugStream);
             rewind($debugStream);
             $this->_body = $debugStream;
             Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . " <<< *DAV request\n" . stream_get_contents($this->_body));
             rewind($this->_body);
         } else {
             Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . " <<< *DAV request\n -- BINARY DATA --");
         }
     }
     self::$_server->httpRequest->setBody($this->_body);
     // compute base uri
     self::$_server->setBaseUri($this->_request->getBaseUrl() . '/');
     $tempDir = Tinebase_Core::getTempDir();
     if (!empty($tempDir)) {
         self::$_server->addPlugin(new \Sabre\DAV\Locks\Plugin(new \Sabre\DAV\Locks\Backend\File($tempDir . '/webdav.lock')));
     }
     self::$_server->addPlugin(new \Sabre\DAV\Auth\Plugin(new Tinebase_WebDav_Auth(), null));
     $aclPlugin = new \Sabre\DAVACL\Plugin();
     $aclPlugin->defaultUsernamePath = Tinebase_WebDav_PrincipalBackend::PREFIX_USERS;
     $aclPlugin->principalCollectionSet = array(Tinebase_WebDav_PrincipalBackend::PREFIX_USERS, Tinebase_WebDav_PrincipalBackend::PREFIX_GROUPS);
     $aclPlugin->principalSearchPropertySet = array('{DAV:}displayname' => 'Display name', '{' . \Sabre\DAV\Server::NS_SABREDAV . '}email-address' => 'Email address', '{' . \Sabre\CalDAV\Plugin::NS_CALENDARSERVER . '}email-address-set' => 'Email addresses', '{' . \Sabre\CalDAV\Plugin::NS_CALENDARSERVER . '}first-name' => 'First name', '{' . \Sabre\CalDAV\Plugin::NS_CALENDARSERVER . '}last-name' => 'Last name', '{' . \Sabre\CalDAV\Plugin::NS_CALDAV . '}calendar-user-address-set' => 'Calendar user address set', '{' . \Sabre\CalDAV\Plugin::NS_CALDAV . '}calendar-user-type' => 'Calendar user type');
     self::$_server->addPlugin($aclPlugin);
     self::$_server->addPlugin(new \Sabre\CardDAV\Plugin());
     self::$_server->addPlugin(new Calendar_Frontend_CalDAV_SpeedUpPlugin());
     // this plugin must be loaded before CalDAV plugin
     self::$_server->addPlugin(new \Sabre\CalDAV\Plugin());
     self::$_server->addPlugin(new \Sabre\CalDAV\SharingPlugin());
     self::$_server->addPlugin(new Calendar_Frontend_CalDAV_PluginAutoSchedule());
     self::$_server->addPlugin(new Calendar_Frontend_CalDAV_PluginDefaultAlarms());
     self::$_server->addPlugin(new Calendar_Frontend_CalDAV_PluginManagedAttachments());
     self::$_server->addPlugin(new Calendar_Frontend_CalDAV_PluginPrivateEvents());
     self::$_server->addPlugin(new Tinebase_WebDav_Plugin_Inverse());
     self::$_server->addPlugin(new Tinebase_WebDav_Plugin_OwnCloud());
     self::$_server->addPlugin(new Tinebase_WebDav_Plugin_PrincipalSearch());
     #self::$_server->addPlugin(new DAV\Sync\Plugin());
     self::$_server->addPlugin(new \Sabre\DAV\Browser\Plugin());
     if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
         ob_start();
     }
     self::$_server->exec();
     if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
         Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . " >>> *DAV response:\n" . ob_get_contents());
         ob_end_flush();
     }
     Tinebase_Controller::getInstance()->logout($this->_request->getServer('REMOTE_ADDR'));
 }
コード例 #16
0
ファイル: server.php プロジェクト: jxwang0/SoCal
<?php

use Sabre\DAV;
date_default_timezone_set('Canada/Eastern');
// The autoloader
require 'vendor/autoload.php';
// 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('/sabredav/server.php');
// The lock manager is reponsible 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());
// All we need to do now, is to fire up the server
$server->exec();
コード例 #17
0
ファイル: groupware.php プロジェクト: ArcherSys/ArcherSysRuby
<?php

use Sabre\DAV;
// The autoloader
require_once $_SERVER["DOCUMENT_ROOT"] . '/vendor/autoload.php';
// 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($_SERVER["PHP_SELF"]);
// The lock manager is reponsible 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());
// All we need to do now, is to fire up the server
$server->exec();
コード例 #18
0
ファイル: index.php プロジェクト: jubicoy/wordpress4-docker
<?php

use Sabre\DAV;
// The autoloader
require 'vendor/autoload.php';
// Now we're creating a whole bunch of objects
$rootDirectory = new DAV\FS\Directory('/var/www/wordpress/wp-content');
// 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('/');
// The lock manager is reponsible for making sure users don't overwrite
// each others changes.
$lockBackend = new DAV\Locks\Backend\File('/tmp/davlocks');
$lockPlugin = new DAV\Locks\Plugin($lockBackend);
$server->addPlugin($lockPlugin);
// All we need to do now, is to fire up the server
$server->exec();
コード例 #19
0
ファイル: server.php プロジェクト: Xavier94/mydav
<?php

use Sabre\DAV;
require 'vendor/autoload.php';
// 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('/mydav/server.php');
// The lock manager is reponsible 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());
// All we need to do now, is to fire up the server
$server->exec();
コード例 #20
0
//$_SERVER["PHP_AUTH_DIGEST"] = "admin";
set_time_limit(3600);
require_once dirname(__FILE__) . '/config.php';
require 'webdav/vendor/autoload.php';
require 'webdav/CustomDirectory.php';
require 'webdav/CustomFile.php';
//require_once dirname(__FILE__) . '/homecollection.php';
use Sabre\DAV;
use Sabre\DAV\Auth;
$lockBackend = new DAV\Locks\Backend\File('data/locks');
$lockPlugin = new DAV\Locks\Plugin($lockBackend);
$pdo = new \PDO('mysql:dbname=' . $conf['db_database'], $conf['db_username'], $conf['db_password']);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$authBackend = new Auth\Backend\PDO($pdo);
$authBackend->setRealm($conf['dav_realm']);
$authPlugin = new Auth\Plugin($authBackend);
/*
$tree = [
    new MyServer\HomeCollection($authPlugin)
];

$server = new DAV\Server($tree);
*/
$publicDir = new MyDirectory($authPlugin, '.');
$server = new DAV\Server($publicDir);
$server->setBaseUri('/webdav/');
// Adding the plugin to the server.
$server->addPlugin($authPlugin);
$server->addPlugin($lockPlugin);
$server->addPlugin(new DAV\Browser\Plugin());
$server->exec();
コード例 #21
0
 /**
  * Initialize the underlying server.
  *
  * @return void
  */
 protected function initializeServer()
 {
     $this->server = new SabreDav\Server(null);
     $this->server->setBaseUri($this->getConfiguration()->base_url ?: '/');
     $this->server->addPlugin(new SabreDav\Browser\Plugin());
 }