summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorg Ehrke <dev@georgswebsite.de>2012-05-07 15:07:16 +0200
committerGeorg Ehrke <dev@georgswebsite.de>2012-05-07 15:07:16 +0200
commit5904d5cf50ba5567fac40e6fa1f1ded6a9f48bcd (patch)
tree702cef4bef9929971a5f5baf1d79fa237c058fd7
parentd032345191c57294d5723639f777692c85bd2b1a (diff)
parent1138df0f4b0cd2e151fa65670705a578c718a0c2 (diff)
downloadnextcloud-server-5904d5cf50ba5567fac40e6fa1f1ded6a9f48bcd.tar.gz
nextcloud-server-5904d5cf50ba5567fac40e6fa1f1ded6a9f48bcd.zip
Merge branch 'remote.php'
-rw-r--r--.htaccess13
-rw-r--r--3rdparty/Sabre/DAV/Server.php2
-rwxr-xr-xapps/calendar/appinfo/app.php4
-rwxr-xr-xapps/calendar/appinfo/remote.php6
-rwxr-xr-xapps/calendar/templates/calendar.php2
-rwxr-xr-xapps/calendar/templates/settings.php2
-rwxr-xr-xapps/contacts/appinfo/app.php4
-rwxr-xr-xapps/contacts/appinfo/remote.php5
-rwxr-xr-xapps/contacts/templates/index.php2
-rwxr-xr-xapps/contacts/templates/settings.php4
-rwxr-xr-xapps/files/appinfo/app.php6
-rw-r--r--apps/files/appinfo/remote.php6
-rw-r--r--index.php2
-rw-r--r--remote.php16
-rw-r--r--remote/.gitignore2
-rw-r--r--settings/templates/personal.php2
16 files changed, 37 insertions, 41 deletions
diff --git a/.htaccess b/.htaccess
index adc6667d5bf..fd1f6abb969 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 4284c127b6e..50b190e8fab 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 055066de0df..297d8e44b67 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 32b454ee90c..7ff6a2fbbe2 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 7e767e36732..19c9a4d8d76 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 0a325ccbc24..0d6c8735ecc 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 c8c1d779dae..216e89d5c09 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 804c560e3d0..67006b77f97 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 c28b47e7c28..791e3ced26c 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 9dffdfb0e4f..ce14e52e0ce 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 3f4e1705fb0..2cc2d48602c 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 defb97ab152..465e0c0a935 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 91f0cfb5e48..b0b77969c57 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 00000000000..db2d1756f7a
--- /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 c96a04f008e..00000000000
--- 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 3f1d57c73d4..799606e6a91 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>