本文整理汇总了PHP中Sabre_DAV_Server::setBaseUri方法的典型用法代码示例。如果您正苦于以下问题:PHP Sabre_DAV_Server::setBaseUri方法的具体用法?PHP Sabre_DAV_Server::setBaseUri怎么用?PHP Sabre_DAV_Server::setBaseUri使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sabre_DAV_Server
的用法示例。
在下文中一共展示了Sabre_DAV_Server::setBaseUri方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setup
function setup()
{
if (!SABRE_HASSQLITE) {
$this->markTestSkipped('No PDO SQLite support');
}
$this->caldavBackend = Sabre_CalDAV_TestUtil::getBackend();
$principalBackend = new Sabre_DAVACL_MockPrincipalBackend();
$principalBackend->setGroupMemberSet('principals/admin/calendar-proxy-read', array('principals/user1'));
$principalBackend->setGroupMemberSet('principals/admin/calendar-proxy-write', array('principals/user1'));
$principalBackend->addPrincipal(array('uri' => 'principals/admin/calendar-proxy-read'));
$principalBackend->addPrincipal(array('uri' => 'principals/admin/calendar-proxy-write'));
$calendars = new Sabre_CalDAV_CalendarRootNode($principalBackend, $this->caldavBackend);
$principals = new Sabre_CalDAV_Principal_Collection($principalBackend);
$root = new Sabre_DAV_SimpleCollection('root');
$root->addChild($calendars);
$root->addChild($principals);
$objectTree = new Sabre_DAV_ObjectTree($root);
$this->server = new Sabre_DAV_Server($objectTree);
$this->server->debugExceptions = true;
$this->server->setBaseUri('/');
$this->plugin = new Sabre_CalDAV_Plugin();
$this->server->addPlugin($this->plugin);
$this->response = new Sabre_HTTP_ResponseMock();
$this->server->httpResponse = $this->response;
}
示例2: setup
function setup()
{
$this->caldavBackend = new Sabre_CalDAV_Backend_Mock(array(array('id' => 1, 'uri' => 'UUID-123467', 'principaluri' => 'principals/user1', '{DAV:}displayname' => 'user1 calendar', '{urn:ietf:params:xml:ns:caldav}calendar-description' => 'Calendar description', '{http://apple.com/ns/ical/}calendar-order' => '1', '{http://apple.com/ns/ical/}calendar-color' => '#FF0000', '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set' => new Sabre_CalDAV_Property_SupportedCalendarComponentSet(array('VEVENT', 'VTODO'))), array('id' => 2, 'uri' => 'UUID-123468', 'principaluri' => 'principals/user1', '{DAV:}displayname' => 'user1 calendar2', '{urn:ietf:params:xml:ns:caldav}calendar-description' => 'Calendar description', '{http://apple.com/ns/ical/}calendar-order' => '1', '{http://apple.com/ns/ical/}calendar-color' => '#FF0000', '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set' => new Sabre_CalDAV_Property_SupportedCalendarComponentSet(array('VEVENT', 'VTODO')))), array(1 => array('UUID-2345' => array('calendardata' => Sabre_CalDAV_TestUtil::getTestCalendarData()))));
$principalBackend = new Sabre_DAVACL_MockPrincipalBackend();
$principalBackend->setGroupMemberSet('principals/admin/calendar-proxy-read', array('principals/user1'));
$principalBackend->setGroupMemberSet('principals/admin/calendar-proxy-write', array('principals/user1'));
$principalBackend->addPrincipal(array('uri' => 'principals/admin/calendar-proxy-read'));
$principalBackend->addPrincipal(array('uri' => 'principals/admin/calendar-proxy-write'));
$calendars = new Sabre_CalDAV_CalendarRootNode($principalBackend, $this->caldavBackend);
$principals = new Sabre_CalDAV_Principal_Collection($principalBackend);
$root = new Sabre_DAV_SimpleCollection('root');
$root->addChild($calendars);
$root->addChild($principals);
$objectTree = new Sabre_DAV_ObjectTree($root);
$this->server = new Sabre_DAV_Server($objectTree);
$this->server->debugExceptions = true;
$this->server->setBaseUri('/');
$this->plugin = new Sabre_CalDAV_Plugin();
$this->server->addPlugin($this->plugin);
// Adding ACL plugin
$this->server->addPlugin(new Sabre_DAVACL_Plugin());
// Adding Auth plugin, and ensuring that we are logged in.
$authBackend = new Sabre_DAV_Auth_MockBackend();
$authBackend->defaultUser = 'user1';
$authPlugin = new Sabre_DAV_Auth_Plugin($authBackend, 'SabreDAV');
$this->server->addPlugin($authPlugin);
$authPlugin->beforeMethod('GET', '/');
$this->response = new Sabre_HTTP_ResponseMock();
$this->server->httpResponse = $this->response;
}
示例3: 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();
}
示例4: 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();
}
示例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: 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;
}
示例7: testSerializeNoPrefix
function testSerializeNoPrefix()
{
$href = new Sabre_DAV_Property_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 Sabre_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: 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();
}
}
示例9: testSerializeNoPrefix
function testSerializeNoPrefix()
{
$href = new Sabre_DAV_Property_Href('path', false);
$this->assertEquals('path', $href->getHref());
$doc = new DOMDocument();
$root = $doc->createElement('d:anything');
$root->setAttribute('xmlns:d', 'DAV:');
$doc->appendChild($root);
$objectTree = new Sabre_DAV_ObjectTree(new Sabre_DAV_SimpleDirectory('rootdir'));
$server = new Sabre_DAV_Server($objectTree);
$server->setBaseUri('/bla/');
$href->serialize($server, $root);
$xml = $doc->saveXML();
$this->assertEquals('<?xml version="1.0"?>
<d:anything xmlns:d="DAV:"><d:href>path</d:href></d:anything>
', $xml);
}
示例10: 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')));
}
示例11: 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();
}
示例12: Required
function __construct(ipsRegistry $registry)
{
$this->registry = $registry;
$this->DB = $this->registry->DB();
$this->settings =& $this->registry->fetchSettings();
$this->request =& $this->registry->fetchRequest();
$this->cache = $this->registry->cache();
$this->caches =& $this->registry->cache()->fetchCaches();
/* Set require path to include sabre directory */
@set_include_path(IPS_KERNEL_PATH . 'sabre/');
/*noLibHook*/
ipsRegistry::$settings['use_friendly_urls'] = 0;
/* Fetch authentication library */
$classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/handlers/han_login.php', 'han_login');
$login = new $classToLoad($registry);
/* Require spl for sabre */
require_once 'Sabre.autoload.php';
/*noLibHook*/
/* Attempt authentication */
$auth = new Sabre_HTTP_BasicAuth();
$auth->setRealm("IP.Board WebDav");
/* Enabled? */
if (!$this->settings['webdav_on']) {
$auth->requireLogin();
echo "Please visit your Admin CP - Look and Feel - Externally Edit Templates and CSS to enable this functionality";
exit;
}
/* Fetch details */
$authDetails = $auth->getUserPass();
/* Check auth */
$member = IPSMember::load(IPSText::parseCleanValue($authDetails[0]), 'all', 'username');
if (!$member['member_id']) {
$auth->requireLogin();
print "Authentication Required (User doesn't exist)";
exit;
}
/* Internal auth only */
$result = IPSMember::authenticateMember($member['member_id'], md5(IPSText::parseCleanValue($authDetails[1])));
if ($result === false) {
$auth->requireLogin();
print "Authentication Required (Username or password incorrect)";
exit;
}
/* Load permissions class */
$classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/class_permissions.php', 'class_permissions');
$this->registry->setClass('class_permissions', new $classToLoad($this->registry));
if (!$member['g_access_cp']) {
$auth->requireLogin();
print "Authentication Required (You are not an admin)";
exit;
}
if (!$this->registry->getClass('class_permissions')->checkPermission('settemplates_external_edit')) {
$auth->requireLogin();
print "You are not permitted to edit skins externally";
exit;
}
/* Require some files for our sabre implementation */
require_once IPS_ROOT_PATH . 'sources/classes/sabre/root/skins.php';
/*noLibHook*/
require_once IPS_ROOT_PATH . 'sources/classes/sabre/directory/templates.php';
/*noLibHook*/
require_once IPS_ROOT_PATH . 'sources/classes/sabre/directory/groups.php';
/*noLibHook*/
require_once IPS_ROOT_PATH . 'sources/classes/sabre/files/templates.php';
/*noLibHook*/
require_once IPS_ROOT_PATH . 'sources/classes/sabre/lock/nolocks.php';
/*noLibHook*/
$tree = new Sabre_DAV_ObjectTree(new sabre_root_skins());
$server = new Sabre_DAV_Server($tree);
$server->setBaseUri($this->getBaseUrl() . '/');
//$server->addPlugin( new Sabre_DAV_Browser_Plugin() );
$server->addPlugin(new Sabre_DAV_Locks_Plugin(new sabre_lock_nolocks()));
/* Process */
$server->exec();
}
示例13: index
function index()
{
exit('webdav is not yet finished');
ob_clean();
$this->load->helper('url');
$publicDir = USERFILES . 'media/content';
$tmpDir = CACHEDIR . 'webdav';
$tmpDir = normalize_path($tmpDir);
if (is_dir($tmpDir) == false) {
mkdir($tmpDir);
}
$publicDir = normalize_path($publicDir);
if (is_dir($publicDir) == false) {
mkdir($publicDir);
}
// If you want to run the SabreDAV server in a custom location (using mod_rewrite for instance)
// You can override the baseUri here.
require_once BASEPATH . 'libraries/webshare/lib/Sabre.autoload.php';
$u = 'admin';
$p = '1234';
//$auth = new Sabre_HTTP_DigestAuth ();
//$auth->init ();
$is_valid = false;
//$username_test = $auth->getUsername ();
//$pass_test = $auth->validatePassword ();
//$auth2 = new Sabre_HTTP_BasicAuth ();
//$passresult = $auth2->getUserPass ();
//p($passresult);
/*if (! $username_test) {
$is_valid = false;
} else {
$data = array ();
$data ['username'] = $username_test;
//$data ['password'] = $pass_test;
$data ['is_active'] = 'y';
$data ['is_admin'] = 'y';
$data = CI::model ( 'users' )->getUsers ( $data );
$data = $data [0];
//
if (! empty ( $data )) {
//p($data);
$pass_test = $auth->validatePassword ( $data ['password'] );
//p($pass_test);
if ($pass_test == true) {
$is_valid = true;
} else {
$is_valid = false;
}
} else {
$is_valid = false;
}
//p($data);
}
if ($is_valid == false) {
//$auth->requireLogin ();
//echo "Authentication required\n";
//die ();
}*/
// Create the root node
$root = new Sabre_DAV_FS_Directory($publicDir);
//..p($_SERVER);
// The rootnode needs in turn to be passed to the server class
$server = new Sabre_DAV_Server($root);
//$baseUri = '/cms/webdav/';
$temp1 = site_url('webdav');
$temp1 = parse_url($temp1);
//p($temp1);
$baseUri = $temp1['path'];
if (isset($baseUri)) {
$server->setBaseUri($baseUri);
}
// Support for LOCK and UNLOCK
$lockBackend = new Sabre_DAV_Locks_Backend_FS($tmpDir);
$lockPlugin = new Sabre_DAV_Locks_Plugin($lockBackend);
$server->addPlugin($lockPlugin);
$server->addPlugin(new Sabre_DAV_Mount_Plugin());
// Support for html frontend
$browser = new Sabre_DAV_Browser_Plugin();
$server->addPlugin($browser);
// Temporary file filter
$tempFF = new Sabre_DAV_TemporaryFileFilterPlugin($tmpDir);
$server->addPlugin($tempFF);
// And off we go!
$server->exec();
dav;
}
示例14: array
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* 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();
示例15: array
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* 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');
require_once '../lib/base.php';
// 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(OC::$WEBROOT . '/files/webdav.php');
// 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();