From c996600786080c54ba853ac8311fafdd3e814e78 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Sat, 5 May 2012 22:54:14 +0200 Subject: [PATCH 01/10] push changes --- apps/calendar/appinfo/app.php | 4 +--- apps/calendar/appinfo/remote.php | 6 +----- apps/contacts/appinfo/app.php | 4 +--- apps/contacts/appinfo/remote.php | 3 --- apps/files/appinfo/app.php | 6 +----- apps/files/appinfo/remote.php | 4 ---- remote.php | 12 ++++++++++++ 7 files changed, 16 insertions(+), 23 deletions(-) create mode 100644 remote.php diff --git a/apps/calendar/appinfo/app.php b/apps/calendar/appinfo/app.php index 055066de0d..297d8e44b6 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 32b454ee90..7ff6a2fbbe 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/contacts/appinfo/app.php b/apps/contacts/appinfo/app.php index c8c1d779da..216e89d5c0 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 804c560e3d..13b90745ae 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 . * */ -// Do not load FS ... -$RUNTIME_NOSETUPFS = true; -require_once('../lib/base.php'); OCP\App::checkAppEnabled('contacts'); diff --git a/apps/files/appinfo/app.php b/apps/files/appinfo/app.php index 3f4e1705fb..2cc2d48602 100755 --- a/apps/files/appinfo/app.php +++ b/apps/files/appinfo/app.php @@ -1,6 +1,4 @@ 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 3ac0023fb8..6d54a4baed 100644 --- a/apps/files/appinfo/remote.php +++ b/apps/files/appinfo/remote.php @@ -23,10 +23,6 @@ * */ -// Do not load FS ... -$RUNTIME_NOSETUPFS = true; -require_once('../lib/base.php'); - // only need filesystem apps $RUNTIME_APPTYPES=array('filesystem','authentication'); diff --git a/remote.php b/remote.php new file mode 100644 index 0000000000..e11b72ee8c --- /dev/null +++ b/remote.php @@ -0,0 +1,12 @@ + Date: Sun, 6 May 2012 00:12:51 +0200 Subject: [PATCH 02/10] Working remote.php with webdav and caldav --- .htaccess | 1 + 3rdparty/Sabre/DAV/Server.php | 2 +- apps/files/appinfo/remote.php | 2 +- remote.php | 12 ++++++++---- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.htaccess b/.htaccess index adc6667d5b..73e1af6213 100644 --- a/.htaccess +++ b/.htaccess @@ -19,5 +19,6 @@ RewriteRule ^.well-known/carddav /remote/carddav.php [R] RewriteRule ^.well-known/caldav /remote/caldav.php [R] RewriteRule ^apps/([^/]*)/(.*\.(css|php))$ index.php?app=$1&getfile=$2 [QSA,L] +RewriteRule ^remote/(.*) remote.php [QSA,L] Options -Indexes diff --git a/3rdparty/Sabre/DAV/Server.php b/3rdparty/Sabre/DAV/Server.php index 4284c127b6..50b190e8fa 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/files/appinfo/remote.php b/apps/files/appinfo/remote.php index 6d54a4baed..0f618c391a 100644 --- a/apps/files/appinfo/remote.php +++ b/apps/files/appinfo/remote.php @@ -37,7 +37,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/remote.php b/remote.php index e11b72ee8c..ab5364aad6 100644 --- a/remote.php +++ b/remote.php @@ -2,11 +2,15 @@ $RUNTIME_NOSETUPFS = true; //$RUNTIME_NOAPPS = TRUE; require_once('lib/base.php'); -$file = OCP\CONFIG::getAppValue('core', $_GET['service']); +$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=' . $_GET['service'] . '&p='; -parse_str($_GET['p'], $_GET); -require_once(OC::$APPSROOT . $file); \ No newline at end of file +$baseuri = '/remote.php/'.$service.'/'; +require_once(OC::$APPSROOT . $file); From 5a264040d4d27dfd8f754545fcbff980cc1a81f4 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Mon, 7 May 2012 11:24:00 +0200 Subject: [PATCH 03/10] fix remote.php --- remote.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/remote.php b/remote.php index ab5364aad6..db2d1756f7 100644 --- a/remote.php +++ b/remote.php @@ -9,8 +9,8 @@ if (!$pos = strpos($path_info, '/', 1)) { $service=substr($path_info, 1, $pos-1); $file = OCP\CONFIG::getAppValue('core', $service); if(is_null($file)){ - header('HTTP/1.0 404 Not Found'); + //header('HTTP/1.0 404 Not Found'); exit; } -$baseuri = '/remote.php/'.$service.'/'; +$baseuri = OC::$WEBROOT . '/remote.php/'.$service.'/'; require_once(OC::$APPSROOT . $file); From 7d2a68fc314bcefa69413d85e69ffd10dc34ddc5 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Mon, 7 May 2012 11:24:19 +0200 Subject: [PATCH 04/10] make carddav work with remote.php --- apps/contacts/appinfo/remote.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/contacts/appinfo/remote.php b/apps/contacts/appinfo/remote.php index 13b90745ae..67006b77f9 100755 --- a/apps/contacts/appinfo/remote.php +++ b/apps/contacts/appinfo/remote.php @@ -35,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()); From 9bdd00c0f22deea144eebe4773ef70063ea45575 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Mon, 7 May 2012 11:54:42 +0200 Subject: [PATCH 05/10] update htaccess file and remove remote folder --- .htaccess | 12 ++++++------ remote/.gitignore | 2 -- 2 files changed, 6 insertions(+), 8 deletions(-) delete mode 100644 remote/.gitignore diff --git a/.htaccess b/.htaccess index 73e1af6213..fd1f6abb96 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/ php_value upload_max_filesize 512M php_value post_max_size 512M @@ -15,8 +15,8 @@ php_value memory_limit 512M 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] diff --git a/remote/.gitignore b/remote/.gitignore deleted file mode 100644 index c96a04f008..0000000000 --- a/remote/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.gitignore \ No newline at end of file From ef10603c2640c4aba7d19ffc850403d248abd566 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Mon, 7 May 2012 12:02:20 +0200 Subject: [PATCH 06/10] fix pathes in calendar and contacts --- apps/calendar/templates/settings.php | 2 +- apps/contacts/templates/settings.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/calendar/templates/settings.php b/apps/calendar/templates/settings.php index 0a325ccbc2..0d6c8735ec 100755 --- a/apps/calendar/templates/settings.php +++ b/apps/calendar/templates/settings.php @@ -47,6 +47,6 @@ t('Calendar CalDAV syncing address:');?> -
+
diff --git a/apps/contacts/templates/settings.php b/apps/contacts/templates/settings.php index 9dffdfb0e4..ce14e52e0c 100755 --- a/apps/contacts/templates/settings.php +++ b/apps/contacts/templates/settings.php @@ -4,9 +4,9 @@ t('CardDAV syncing addresses'); ?> (t('more info'); ?>)
t('Primary address (Kontact et al)'); ?>
-
/
+
t('iOS/OS X'); ?>
-
/principals//
+
principals//
Powered by geonames.org webservice From e33b12a375e9a6bf7b9cc30a17c8d402e9b020d9 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Mon, 7 May 2012 12:07:39 +0200 Subject: [PATCH 07/10] fix path of webdav --- index.php | 2 +- settings/templates/personal.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/index.php b/index.php index 91f0cfb5e4..b0b77969c5 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/settings/templates/personal.php b/settings/templates/personal.php index 3f1d57c73d..799606e6a9 100644 --- a/settings/templates/personal.php +++ b/settings/templates/personal.php @@ -47,7 +47,7 @@

WebDAV -
+
t('use this address to connect to your ownCloud in your file manager');?>

From b125caaaf6ab94a63f8f56f5df82dcf547c95b7e Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Mon, 7 May 2012 12:16:25 +0200 Subject: [PATCH 08/10] fix path of caldav in calendar management --- apps/calendar/templates/calendar.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/calendar/templates/calendar.php b/apps/calendar/templates/calendar.php index 7e767e3673..19c9a4d8d7 100755 --- a/apps/calendar/templates/calendar.php +++ b/apps/calendar/templates/calendar.php @@ -19,7 +19,7 @@ var missing_field_totime = 't('To Time')) ?>'; var missing_field_startsbeforeends = 't('The event ends before it starts')) ?>'; var missing_field_dberror = 't('There was a database fail')) ?>'; - var totalurl = '/calendars'; + var totalurl = '/calendars'; var firstDay = ''; $(document).ready(function() { Date: Mon, 7 May 2012 12:18:58 +0200 Subject: [PATCH 09/10] fix path of carddav in addressbook management --- apps/contacts/templates/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/contacts/templates/index.php b/apps/contacts/templates/index.php index c28b47e7c2..791e3ced26 100755 --- a/apps/contacts/templates/index.php +++ b/apps/contacts/templates/index.php @@ -1,5 +1,5 @@ From 1138df0f4b0cd2e151fa65670705a578c718a0c2 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Mon, 7 May 2012 12:47:34 +0200 Subject: [PATCH 10/10] fix webdav, bloody merge conflicts --- apps/files/appinfo/remote.php | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/files/appinfo/remote.php b/apps/files/appinfo/remote.php index 94ae101bb0..465e0c0a93 100644 --- a/apps/files/appinfo/remote.php +++ b/apps/files/appinfo/remote.php @@ -24,7 +24,6 @@ */ // only need filesystem apps $RUNTIME_APPTYPES=array('filesystem','authentication'); -require_once('../lib/base.php'); // Backends $authBackend = new OC_Connector_Sabre_Auth();