summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@owncloud.com>2012-10-01 14:39:47 +0200
committerArthur Schiwon <blizzz@owncloud.com>2012-10-01 14:39:53 +0200
commitb23ad579dc674d3fdeaed0c6f650a6fcb8de6394 (patch)
tree9c1a87ab32f30d362769e54828598f424353cd72 /apps
parent804372947ae5cdaeaa8c92250f4efb4ae54e8a3f (diff)
downloadnextcloud-server-b23ad579dc674d3fdeaed0c6f650a6fcb8de6394.tar.gz
nextcloud-server-b23ad579dc674d3fdeaed0c6f650a6fcb8de6394.zip
Sharing: backward compatibility to links from OC 4.0.
Diffstat (limited to 'apps')
-rw-r--r--apps/files_sharing/public.php20
1 files changed, 20 insertions, 0 deletions
diff --git a/apps/files_sharing/public.php b/apps/files_sharing/public.php
index 525ffa83578..15377680ab8 100644
--- a/apps/files_sharing/public.php
+++ b/apps/files_sharing/public.php
@@ -1,6 +1,26 @@
<?php
// Load other apps for file previews
OC_App::loadApps();
+
+// Compatibility with shared-by-link items from ownCloud 4.0
+// requires old Sharing table !
+// support will be removed in OC 5.0,a
+if (isset($_GET['token'])) {
+ unset($_GET['file']);
+ $qry = \OC_DB::prepare('SELECT `source` FROM `*PREFIX*sharing` WHERE `target` = ? LIMIT 1');
+ $filepath = $qry->execute(array($_GET['token']))->fetchOne();
+ if(isset($filepath)) {
+ $info = OC_FileCache_Cached::get($filepath, '');
+ if(strtolower($info['mimetype']) == 'httpd/unix-directory') {
+ $_GET['dir'] = $filepath;
+ } else {
+ $_GET['file'] = $filepath;
+ }
+ \OCP\Util::writeLog('files_sharing', 'You have files that are shared by link originating from ownCloud 4.0. Redistribute the new links, because backwards compatibility will be removed in ownCloud 5.', \OCP\Util::WARN);
+ }
+}
+// Enf of backward compatibility
+
if (isset($_GET['file']) || isset($_GET['dir'])) {
if (isset($_GET['dir'])) {
$type = 'folder';