diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2013-10-10 17:23:27 +0200 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2013-10-10 17:23:27 +0200 |
commit | 4c2e3919dec7077b00c2df836658dc41338e7d09 (patch) | |
tree | 829249f7df2a490803d5fa1be9aceb55d09448ec | |
parent | 92009c5d8eb48d8ea89ab6ee803d8a47a7ff98c0 (diff) | |
download | nextcloud-server-4c2e3919dec7077b00c2df836658dc41338e7d09.tar.gz nextcloud-server-4c2e3919dec7077b00c2df836658dc41338e7d09.zip |
make previews work for shared files in the versions drop-down
-rw-r--r-- | apps/files_versions/ajax/preview.php | 15 | ||||
-rw-r--r-- | apps/files_versions/lib/versions.php | 2 |
2 files changed, 12 insertions, 5 deletions
diff --git a/apps/files_versions/ajax/preview.php b/apps/files_versions/ajax/preview.php index c24134df534..6fd374711c3 100644 --- a/apps/files_versions/ajax/preview.php +++ b/apps/files_versions/ajax/preview.php @@ -6,31 +6,38 @@ * See the COPYING-README file. */ \OC_Util::checkLoggedIn(); - +error_log("get preview!"); if(!\OC_App::isEnabled('files_versions')){ exit; } $file = array_key_exists('file', $_GET) ? (string) urldecode($_GET['file']) : ''; +$user = array_key_exists('user', $_GET) ? $_GET['user'] : ''; $maxX = array_key_exists('x', $_GET) ? (int) $_GET['x'] : 44; $maxY = array_key_exists('y', $_GET) ? (int) $_GET['y'] : 44; $version = array_key_exists('version', $_GET) ? $_GET['version'] : ''; $scalingUp = array_key_exists('scalingup', $_GET) ? (bool) $_GET['scalingup'] : true; +if($user === '') { + \OC_Response::setStatus(400); //400 Bad Request + \OC_Log::write('versions-preview', 'No user parameter was passed', \OC_Log::DEBUG); + exit; +} + if($file === '' && $version === '') { \OC_Response::setStatus(400); //400 Bad Request - \OC_Log::write('core-preview', 'No file parameter was passed', \OC_Log::DEBUG); + \OC_Log::write('versions-preview', 'No file parameter was passed', \OC_Log::DEBUG); exit; } if($maxX === 0 || $maxY === 0) { \OC_Response::setStatus(400); //400 Bad Request - \OC_Log::write('core-preview', 'x and/or y set to 0', \OC_Log::DEBUG); + \OC_Log::write('versions-preview', 'x and/or y set to 0', \OC_Log::DEBUG); exit; } try{ - $preview = new \OC\Preview(\OC_User::getUser(), 'files_versions'); + $preview = new \OC\Preview($user, 'files_versions'); $preview->setFile($file.'.v'.$version); $preview->setMaxX($maxX); $preview->setMaxY($maxY); diff --git a/apps/files_versions/lib/versions.php b/apps/files_versions/lib/versions.php index 8151324696f..7d765e28ced 100644 --- a/apps/files_versions/lib/versions.php +++ b/apps/files_versions/lib/versions.php @@ -257,7 +257,7 @@ class Storage { $versions[$key]['cur'] = 0; $versions[$key]['version'] = $version; $versions[$key]['humanReadableTimestamp'] = self::getHumanReadableTimestamp($version); - $versions[$key]['preview'] = \OCP\Util::linkToRoute('core_ajax_versions_preview', array('file' => $filename, 'version' => $version)); + $versions[$key]['preview'] = \OCP\Util::linkToRoute('core_ajax_versions_preview', array('file' => $filename, 'version' => $version, 'user' => $uid)); $versions[$key]['path'] = $filename; $versions[$key]['size'] = $file['size']; } |