diff options
author | kondou <kondou@ts.unde.re> | 2013-09-02 07:58:06 +0200 |
---|---|---|
committer | kondou <kondou@ts.unde.re> | 2013-09-02 07:58:06 +0200 |
commit | e5fc7b9dbeb01ac116bb132903c562c8f7d3c5b3 (patch) | |
tree | b7d8d913cdf7f4d1ce42f3027918ad0f5fbe5c3b /lib/public | |
parent | 8dd93c8c0288a11f04816bea2a58aee661ef9e97 (diff) | |
parent | f038cb9aea7c9a1513ab14d0df002773b17d5333 (diff) | |
download | nextcloud-server-e5fc7b9dbeb01ac116bb132903c562c8f7d3c5b3.tar.gz nextcloud-server-e5fc7b9dbeb01ac116bb132903c562c8f7d3c5b3.zip |
Merge branch 'master' into clean_up_util
Conflicts:
lib/base.php
Diffstat (limited to 'lib/public')
-rw-r--r-- | lib/public/preview.php | 34 | ||||
-rw-r--r-- | lib/public/share.php | 16 | ||||
-rw-r--r-- | lib/public/template.php | 19 |
3 files changed, 63 insertions, 6 deletions
diff --git a/lib/public/preview.php b/lib/public/preview.php new file mode 100644 index 00000000000..7588347eccb --- /dev/null +++ b/lib/public/preview.php @@ -0,0 +1,34 @@ +<?php +/** + * Copyright (c) 2013 Frank Karlitschek frank@owncloud.org + * Copyright (c) 2013 Georg Ehrke georg@ownCloud.com + * This file is licensed under the Affero General Public License version 3 or + * later. + * See the COPYING-README file. + */ +namespace OCP; + +/** + * This class provides functions to render and show thumbnails and previews of files + */ +class Preview { + + /** + * @brief return a preview of a file + * @param $file The path to the file where you want a thumbnail from + * @param $maxX The maximum X size of the thumbnail. It can be smaller depending on the shape of the image + * @param $maxY The maximum Y size of the thumbnail. It can be smaller depending on the shape of the image + * @param $scaleup Scale smaller images up to the thumbnail size or not. Might look ugly + * @return image + */ + public static function show($file,$maxX=100,$maxY=75,$scaleup=false) { + return(\OC\Preview::show($file,$maxX,$maxY,$scaleup)); + } + + + + public static function isMimeSupported($mimetype='*') { + return \OC\Preview::isMimeSupported($mimetype); + } + +} diff --git a/lib/public/share.php b/lib/public/share.php index 7714837769d..fe996dbe266 100644 --- a/lib/public/share.php +++ b/lib/public/share.php @@ -209,7 +209,7 @@ class Share { } } } - + // let's get the parent for the next round $meta = $cache->get((int)$source); if($meta !== false) { @@ -840,7 +840,11 @@ class Share { // Get filesystem root to add it to the file target and remove from the // file source, match file_source with the file cache if ($itemType == 'file' || $itemType == 'folder') { - $root = \OC\Files\Filesystem::getRoot(); + if(!is_null($uidOwner)) { + $root = \OC\Files\Filesystem::getRoot(); + } else { + $root = ''; + } $where = 'INNER JOIN `*PREFIX*filecache` ON `file_source` = `*PREFIX*filecache`.`fileid`'; if (!isset($item)) { $where .= ' WHERE `file_target` IS NOT NULL'; @@ -1303,11 +1307,11 @@ class Share { 'run' => &$run, 'error' => &$error )); - + if ($run === false) { throw new \Exception($error); } - + if (isset($fileSource)) { if ($parentFolder) { if ($parentFolder === true) { @@ -1398,11 +1402,11 @@ class Share { 'run' => &$run, 'error' => &$error )); - + if ($run === false) { throw new \Exception($error); } - + if (isset($fileSource)) { if ($parentFolder) { if ($parentFolder === true) { diff --git a/lib/public/template.php b/lib/public/template.php index ab1089c332d..3b1a4ed4906 100644 --- a/lib/public/template.php +++ b/lib/public/template.php @@ -54,6 +54,25 @@ function mimetype_icon( $mimetype ) { return(\mimetype_icon( $mimetype )); } +/** + * @brief make preview_icon available as a simple function + * Returns the path to the preview of the image. + * @param $path path of file + * @returns link to the preview + */ +function preview_icon( $path ) { + return(\preview_icon( $path )); +} + +/** + * @brief make publicpreview_icon available as a simple function + * Returns the path to the preview of the image. + * @param $path path of file + * @returns link to the preview + */ +function publicPreview_icon ( $path, $token ) { + return(\publicPreview_icon( $path, $token )); +} /** * @brief make OC_Helper::humanFileSize available as a simple function |