remote.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. /**
  3. * ownCloud
  4. *
  5. * @author Frank Karlitschek
  6. * @author Jakob Sack
  7. * @copyright 2012 Frank Karlitschek frank@owncloud.org
  8. * @copyright 2011 Jakob Sack kde@jakobsack.de
  9. *
  10. * This library is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
  12. * License as published by the Free Software Foundation; either
  13. * version 3 of the License, or any later version.
  14. *
  15. * This library is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
  19. *
  20. * You should have received a copy of the GNU Affero General Public
  21. * License along with this library. If not, see <http://www.gnu.org/licenses/>.
  22. *
  23. */
  24. // load needed apps
  25. $RUNTIME_APPTYPES = array('filesystem', 'authentication', 'logging');
  26. OC_App::loadApps($RUNTIME_APPTYPES);
  27. OC_Util::obEnd();
  28. // Backends
  29. $authBackend = new OC_Connector_Sabre_Auth();
  30. $lockBackend = new OC_Connector_Sabre_Locks();
  31. $requestBackend = new OC_Connector_Sabre_Request();
  32. // Create ownCloud Dir
  33. $rootDir = new OC_Connector_Sabre_Directory('');
  34. $objectTree = new \OC\Connector\Sabre\ObjectTree($rootDir);
  35. // Fire up server
  36. $server = new OC_Connector_Sabre_Server($objectTree);
  37. $server->httpRequest = $requestBackend;
  38. $server->setBaseUri($baseuri);
  39. // Load plugins
  40. $defaults = new OC_Defaults();
  41. $server->addPlugin(new Sabre_DAV_Auth_Plugin($authBackend, $defaults->getName()));
  42. $server->addPlugin(new Sabre_DAV_Locks_Plugin($lockBackend));
  43. $server->addPlugin(new Sabre_DAV_Browser_Plugin(false)); // Show something in the Browser, but no upload
  44. $server->addPlugin(new OC_Connector_Sabre_FilesPlugin());
  45. $server->addPlugin(new OC_Connector_Sabre_AbortedUploadDetectionPlugin());
  46. $server->addPlugin(new OC_Connector_Sabre_QuotaPlugin());
  47. $server->addPlugin(new OC_Connector_Sabre_MaintenancePlugin());
  48. // And off we go!
  49. $server->exec();