Blame view
sources/apps/gallery/ajax/albumthumbnail.php
967 Bytes
|
03e52840d
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
<?php
/**
* Copyright (c) 2012 Robin Appelman <icewind@owncloud.com>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('gallery');
session_write_close();
list($owner, $img) = explode('/', $_GET['file'], 2);
if ($owner !== OC_User::getUser()) {
\OC\Files\Filesystem::initMountPoints($owner);
$parts = explode('/', $img, 3);
if (count($parts) === 3) {
list($shareId, , $img) = $parts;
} else {
$shareId = $parts[0];
$img = '';
}
if (OCP\Share::getItemSharedWith('gallery', $shareId)) {
$ownerView = new \OC\Files\View('/' . $owner . '/files');
$sharedGallery = $ownerView->getPath($shareId);
if ($img) {
$img = $sharedGallery . '/' . $img;
} else {
$img = $sharedGallery;
}
} else {
OC_JSON::error('no such file');
die();
}
}
$image = new \OCA\Gallery\AlbumThumbnail('/' . $img, $owner);
$image->show();
|