diff --git a/.htaccess b/.htaccess index adc6667d5bf64ce0e4f282dc9c53da2a7b187255..fd1f6abb969c671fc75f408f34d7fc05dd046e39 100644 --- a/.htaccess +++ b/.htaccess @@ -1,9 +1,9 @@ ErrorDocument 403 /core/templates/403.php ErrorDocument 404 /core/templates/404.php -Redirect 301 /apps/calendar/caldav.php /remote/caldav.php -Redirect 301 /apps/contacts/carddav.php /remote/carddav.php -Redirect 301 /apps/files/webdav.php /remote/webdav.php -Redirect 301 /files/webdav.php /remote/webdav.php +Redirect 301 /apps/calendar/caldav.php /remote.php/caldav/ +Redirect 301 /apps/contacts/carddav.php /remote.php/carddav/ +Redirect 301 /apps/files/webdav.php /remote.php/webdav/ +Redirect 301 /files/webdav.php /remote.php/webdav/ <IfModule mod_php5.c> php_value upload_max_filesize 512M php_value post_max_size 512M @@ -15,9 +15,10 @@ php_value memory_limit 512M <IfModule mod_rewrite.c> RewriteEngine on RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization}] -RewriteRule ^.well-known/carddav /remote/carddav.php [R] -RewriteRule ^.well-known/caldav /remote/caldav.php [R] +RewriteRule ^.well-known/carddav /remote.php/carddav/ [R] +RewriteRule ^.well-known/caldav /remote.php/caldav/ [R] RewriteRule ^apps/([^/]*)/(.*\.(css|php))$ index.php?app=$1&getfile=$2 [QSA,L] +RewriteRule ^remote/(.*) remote.php [QSA,L] </IfModule> Options -Indexes diff --git a/3rdparty/Sabre/DAV/Server.php b/3rdparty/Sabre/DAV/Server.php index 4284c127b6e120ac33b110e5df019e0502d6d797..50b190e8fabf834a9c421b9638eadb71156e20b6 100644 --- a/3rdparty/Sabre/DAV/Server.php +++ b/3rdparty/Sabre/DAV/Server.php @@ -215,7 +215,7 @@ class Sabre_DAV_Server { $DOM->appendChild($error); $error->appendChild($DOM->createElement('s:exception',get_class($e))); - $error->appendChild($DOM->createElement('s:message',$e->getMessage())); + $error->appendChild($DOM->createElement('s:message',htmlentities($e->getMessage()))); if ($this->debugExceptions) { $error->appendChild($DOM->createElement('s:file',$e->getFile())); $error->appendChild($DOM->createElement('s:line',$e->getLine())); diff --git a/apps/calendar/appinfo/app.php b/apps/calendar/appinfo/app.php index 055066de0df03f66b79438c6f236c694de279827..297d8e44b6723e746e9c413499390f95e93eb235 100755 --- a/apps/calendar/appinfo/app.php +++ b/apps/calendar/appinfo/app.php @@ -23,6 +23,4 @@ OCP\App::addNavigationEntry( array( 'name' => $l->t('Calendar'))); OCP\App::registerPersonal('calendar', 'settings'); OC_Search::registerProvider('OC_Search_Provider_Calendar'); -if(!file_exists(OC::$SERVERROOT.'/remote/caldav.php')){ - file_put_contents(OC::$SERVERROOT.'/remote/caldav.php', file_get_contents(OC::$APPSROOT . '/apps/calendar/appinfo/remote.php')); -} \ No newline at end of file +OCP\CONFIG::setAppValue('core', 'caldav', '/apps/calendar/appinfo/remote.php'); \ No newline at end of file diff --git a/apps/calendar/appinfo/remote.php b/apps/calendar/appinfo/remote.php index 32b454ee90ca27e2c2a1187338a65b41d248199a..7ff6a2fbbe2b3cbc00111bac59adb9d7f8258dbe 100755 --- a/apps/calendar/appinfo/remote.php +++ b/apps/calendar/appinfo/remote.php @@ -5,10 +5,6 @@ * later. * See the COPYING-README file. */ -// Do not load FS ... -$RUNTIME_NOSETUPFS = true; -require_once('../lib/base.php'); - OCP\App::checkAppEnabled('calendar'); // Backends @@ -24,7 +20,7 @@ $nodes = array( // Fire up server $server = new Sabre_DAV_Server($nodes); -$server->setBaseUri(OC::$WEBROOT.'/remote/caldav.php'); +$server->setBaseUri($baseuri); // Add plugins $server->addPlugin(new Sabre_DAV_Auth_Plugin($authBackend,'ownCloud')); $server->addPlugin(new Sabre_CalDAV_Plugin()); diff --git a/apps/calendar/templates/calendar.php b/apps/calendar/templates/calendar.php index 7e767e367324ef006152cc0d85e384a6c2f1e117..19c9a4d8d765eb149a74f270d22deb09d0738f30 100755 --- a/apps/calendar/templates/calendar.php +++ b/apps/calendar/templates/calendar.php @@ -19,7 +19,7 @@ var missing_field_totime = '<?php echo addslashes($l->t('To Time')) ?>'; var missing_field_startsbeforeends = '<?php echo addslashes($l->t('The event ends before it starts')) ?>'; var missing_field_dberror = '<?php echo addslashes($l->t('There was a database fail')) ?>'; - var totalurl = '<?php echo OCP\Util::linkToAbsolute('calendar', 'caldav.php'); ?>/calendars'; + var totalurl = '<?php echo OCP\Util::linkToAbsolute('remote.php', 'caldav'); ?>/calendars'; var firstDay = '<?php echo (OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'firstday', 'mo') == 'mo' ? '1' : '0'); ?>'; $(document).ready(function() { <?php diff --git a/apps/calendar/templates/settings.php b/apps/calendar/templates/settings.php index 0a325ccbc24ec1a1c9f0c190ff2dc8b32e5e97d7..0d6c8735ecc139d88de2909e9ce183540bd48b32 100755 --- a/apps/calendar/templates/settings.php +++ b/apps/calendar/templates/settings.php @@ -47,6 +47,6 @@ </table> <?php echo $l->t('Calendar CalDAV syncing address:');?> - <code><?php echo OCP\Util::linkToAbsolute('remote', 'caldav.php'); ?></code><br /> + <code><?php echo OCP\Util::linkToAbsolute('remote.php', 'caldav/'); ?></code><br /> </fieldset> </form> diff --git a/apps/contacts/appinfo/app.php b/apps/contacts/appinfo/app.php index c8c1d779daef6013ad4d291568e73f08f76ccc0f..216e89d5c09db39ea70f3b52641b588b1570079d 100755 --- a/apps/contacts/appinfo/app.php +++ b/apps/contacts/appinfo/app.php @@ -25,6 +25,4 @@ OCP\App::addNavigationEntry( array( OCP\App::registerPersonal('contacts','settings'); OCP\Util::addscript('contacts', 'loader'); OC_Search::registerProvider('OC_Search_Provider_Contacts'); -if(!file_exists(OC::$SERVERROOT.'/remote/carddav.php')){ - file_put_contents(OC::$SERVERROOT.'/remote/carddav.php', file_get_contents(OC::$APPSROOT . '/apps/contacts/appinfo/remote.php')); -} \ No newline at end of file +OCP\CONFIG::setAppValue('core', 'carddav', '/apps/contacts/appinfo/remote.php'); \ No newline at end of file diff --git a/apps/contacts/appinfo/remote.php b/apps/contacts/appinfo/remote.php index 804c560e3d0414c15d067cba22ad61754b100505..67006b77f97c1c3c4ddfe85e6e9d21eb434b9409 100755 --- a/apps/contacts/appinfo/remote.php +++ b/apps/contacts/appinfo/remote.php @@ -19,9 +19,6 @@ * License along with this library. If not, see <http://www.gnu.org/licenses/>. * */ -// Do not load FS ... -$RUNTIME_NOSETUPFS = true; -require_once('../lib/base.php'); OCP\App::checkAppEnabled('contacts'); @@ -38,7 +35,7 @@ $nodes = array( // Fire up server $server = new Sabre_DAV_Server($nodes); -$server->setBaseUri(OC::$WEBROOT.'/remote/carddav.php'); +$server->setBaseUri($baseuri); // Add plugins $server->addPlugin(new Sabre_DAV_Auth_Plugin($authBackend,'ownCloud')); $server->addPlugin(new Sabre_CardDAV_Plugin()); diff --git a/apps/contacts/templates/index.php b/apps/contacts/templates/index.php index c28b47e7c287e6366ebb09172b5f2b1eb045f31b..791e3ced26c61dd3e47462c6ca74ffe72fdf6221 100755 --- a/apps/contacts/templates/index.php +++ b/apps/contacts/templates/index.php @@ -1,5 +1,5 @@ <script type='text/javascript'> - var totalurl = '<?php echo OCP\Util::linkToAbsolute('contacts', 'carddav.php'); ?>/addressbooks'; + var totalurl = '<?php echo OCP\Util::linkToAbsolute('remote.php', 'carddav'); ?>/addressbooks'; var categories = <?php echo json_encode($_['categories']); ?>; var lang = '<?php echo OCP\Config::getUserValue(OCP\USER::getUser(), 'core', 'lang', 'en'); ?>'; </script> diff --git a/apps/contacts/templates/settings.php b/apps/contacts/templates/settings.php index 9dffdfb0e4fc157b443f3d92b6d380497b7b0ef5..ce14e52e0ce18a5668972708c4a55f9d38f42e86 100755 --- a/apps/contacts/templates/settings.php +++ b/apps/contacts/templates/settings.php @@ -4,9 +4,9 @@ <?php echo $l->t('CardDAV syncing addresses'); ?> (<a href="http://owncloud.org/synchronisation/" target="_blank"><?php echo $l->t('more info'); ?></a>) <dl> <dt><?php echo $l->t('Primary address (Kontact et al)'); ?></dt> - <dd><code><?php echo OCP\Util::linkToAbsolute('remote', 'carddav.php'); ?>/</code></dd> + <dd><code><?php echo OCP\Util::linkToAbsolute('remote.php', 'carddav/'); ?></code></dd> <dt><?php echo $l->t('iOS/OS X'); ?></dt> - <dd><code><?php echo OCP\Util::linkToAbsolute('remote', 'carddav.php'); ?>/principals/<?php echo OCP\USER::getUser(); ?></code>/</dd> + <dd><code><?php echo OCP\Util::linkToAbsolute('remote.php', 'carddav/'); ?>principals/<?php echo OCP\USER::getUser(); ?></code>/</dd> </dl> Powered by <a href="http://geonames.org/" target="_blank">geonames.org webservice</a> </fieldset> diff --git a/apps/files/appinfo/app.php b/apps/files/appinfo/app.php index 3f4e1705fb0b06eec4f3fc84d01eb6ca96637934..2cc2d48602cb20661dd71b9c946cb76c5f13e378 100755 --- a/apps/files/appinfo/app.php +++ b/apps/files/appinfo/app.php @@ -1,6 +1,4 @@ <?php - - $l=OC_L10N::get('files'); OCP\App::register( array( "order" => 2, "id" => "files", "name" => "Files" )); @@ -9,6 +7,4 @@ OCP\App::registerAdmin('files','admin'); OCP\App::addNavigationEntry( array( "id" => "files_index", "order" => 0, "href" => OCP\Util::linkTo( "files", "index.php" ), "icon" => OCP\Util::imagePath( "core", "places/home.svg" ), "name" => $l->t("Files") )); OC_Search::registerProvider('OC_Search_Provider_File'); -if(!file_exists(OC::$SERVERROOT.'/remote/webdav.php')){ - file_put_contents(OC::$SERVERROOT.'/remote/webdav.php', file_get_contents(OC::$APPSROOT . '/apps/files/appinfo/remote.php')); -} \ No newline at end of file +OCP\CONFIG::setAppValue('core', 'webdav', '/apps/files/appinfo/remote.php'); \ No newline at end of file diff --git a/apps/files/appinfo/remote.php b/apps/files/appinfo/remote.php index defb97ab152ef8ed451661884c94bcb141e2e81b..465e0c0a93556d7ff6035a5d0ba2324951dc533e 100644 --- a/apps/files/appinfo/remote.php +++ b/apps/files/appinfo/remote.php @@ -22,12 +22,8 @@ * License along with this library. If not, see <http://www.gnu.org/licenses/>. * */ - -// Do not load FS ... -$RUNTIME_NOSETUPFS = true; // only need filesystem apps $RUNTIME_APPTYPES=array('filesystem','authentication'); -require_once('../lib/base.php'); // Backends $authBackend = new OC_Connector_Sabre_Auth(); @@ -38,7 +34,7 @@ $publicDir = new OC_Connector_Sabre_Directory(''); // Fire up server $server = new Sabre_DAV_Server($publicDir); -$server->setBaseUri(OC::$WEBROOT.'/remote/webdav.php'); +$server->setBaseUri($baseuri); // Load plugins $server->addPlugin(new Sabre_DAV_Auth_Plugin($authBackend,'ownCloud')); diff --git a/index.php b/index.php index 91f0cfb5e4803aee277b6fe667c9c521e3745b08..b0b77969c57e5a7b11043e3186a190f676bfe15a 100644 --- a/index.php +++ b/index.php @@ -44,7 +44,7 @@ if($not_installed) { // Handle WebDAV if($_SERVER['REQUEST_METHOD']=='PROPFIND'){ - header('location: '.OC_Helper::linkToAbsolute('remote','webdav.php')); + header('location: '.OC_Helper::linkToAbsolute('remote.php','webdav/')); exit(); } diff --git a/remote.php b/remote.php new file mode 100644 index 0000000000000000000000000000000000000000..db2d1756f7a89a851962143cb2ac64fcf8b7cf8b --- /dev/null +++ b/remote.php @@ -0,0 +1,16 @@ +<?php +$RUNTIME_NOSETUPFS = true; +//$RUNTIME_NOAPPS = TRUE; +require_once('lib/base.php'); +$path_info = $_SERVER['PATH_INFO']; +if (!$pos = strpos($path_info, '/', 1)) { + $pos = strlen($path_info); +} +$service=substr($path_info, 1, $pos-1); +$file = OCP\CONFIG::getAppValue('core', $service); +if(is_null($file)){ + //header('HTTP/1.0 404 Not Found'); + exit; +} +$baseuri = OC::$WEBROOT . '/remote.php/'.$service.'/'; +require_once(OC::$APPSROOT . $file); diff --git a/remote/.gitignore b/remote/.gitignore deleted file mode 100644 index c96a04f008ee21e260b28f7701595ed59e2839e3..0000000000000000000000000000000000000000 --- a/remote/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.gitignore \ No newline at end of file diff --git a/settings/templates/personal.php b/settings/templates/personal.php index 3f1d57c73d452b600244b7f2add42105dc44015c..799606e6a9117c28a58d76743c49b94ac8c41549 100644 --- a/settings/templates/personal.php +++ b/settings/templates/personal.php @@ -47,7 +47,7 @@ <p class="personalblock"> <strong>WebDAV</strong> - <code><?php echo OC_Helper::linkToAbsolute('remote', 'webdav.php'); ?></code><br /> + <code><?php echo OC_Helper::linkToAbsolute('remote.php', 'webdav/'); ?></code><br /> <em><?php echo $l->t('use this address to connect to your ownCloud in your file manager');?></em> </p>