From 5b44714f4cbd75138519789f55fd8b6f4b5d4241 Mon Sep 17 00:00:00 2001 From: Frank Karlitschek Date: Tue, 13 Nov 2012 15:11:02 +0100 Subject: [PATCH 001/170] =?UTF-8?q?first=20version=20of=20the=20new=20prev?= =?UTF-8?q?iewer=20lib.=20It=20currently=20only=20created=20previews/thumb?= =?UTF-8?q?nails=20for=20images.=20It=20get=C2=B4s=20more=20interesting=20?= =?UTF-8?q?when=20we=20add=20PDFs,=20movies,=20mp3,=20text=20files=20and?= =?UTF-8?q?=20more...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/preview.php | 131 +++++++++++++++++++++++++++++++++++++++++ lib/public/preview.php | 50 ++++++++++++++++ 2 files changed, 181 insertions(+) create mode 100755 lib/preview.php create mode 100644 lib/public/preview.php diff --git a/lib/preview.php b/lib/preview.php new file mode 100755 index 00000000000..8b1a42925a6 --- /dev/null +++ b/lib/preview.php @@ -0,0 +1,131 @@ +show(); + }else{ + header('Content-type: image/png'); + OC_PreviewUnknown::getThumbnail($maxX,$maxY); + } + } + + +} + + + +class OC_PreviewImage { + + // the thumbnail cache folder + const THUMBNAILS_FOLDER = 'thumbnails'; + + public static function getThumbnail($path,$maxX,$maxY,$scalingup) { + $thumbnails_view = new \OC_FilesystemView('/'.\OCP\User::getUser() .'/'.self::THUMBNAILS_FOLDER); + + // is a preview already in the cache? + if ($thumbnails_view->file_exists($path.'-'.$maxX.'-'.$maxY.'-'.$scalingup)) { + return new \OC_Image($thumbnails_view->getLocalFile($path.'-'.$maxX.'-'.$maxY.'-'.$scalingup)); + } + + // does the sourcefile exist? + if (!\OC_Filesystem::file_exists($path)) { + \OC_Log::write('Preview', 'File '.$path.' don\'t exists', \OC_Log::WARN); + return false; + } + + // open the source image + $image = new \OC_Image(); + $image->loadFromFile(\OC_Filesystem::getLocalFile($path)); + if (!$image->valid()) return false; + + // fix the orientation + $image->fixOrientation(); + + // calculate the right preview size + $Xsize=$image->width(); + $Ysize=$image->height(); + if (($Xsize/$Ysize)>($maxX/$maxY)) { + $factor=$maxX/$Xsize; + } else { + $factor=$maxY/$Ysize; + } + + // only scale up if requested + if($scalingup==false) { + if($factor>1) $factor=1; + } + $newXsize=$Xsize*$factor; + $newYsize=$Ysize*$factor; + + // resize + $ret = $image->preciseResize($newXsize, $newYsize); + if (!$ret) { + \OC_Log::write('Preview', 'Couldn\'t resize image', \OC_Log::ERROR); + unset($image); + return false; + } + + // store in cache + $l = $thumbnails_view->getLocalFile($path.'-'.$maxX.'-'.$maxY.'-'.$scalingup); + $image->save($l); + + return $image; + } + + + +} + + +class OC_PreviewUnknown { + public static function getThumbnail($maxX,$maxY) { + + // check if GD is installed + if(!extension_loaded('gd') || !function_exists('gd_info')) { + OC_Log::write('preview', __METHOD__.'(): GD module not installed', OC_Log::ERROR); + return false; + } + + // create a white image + $image = imagecreatetruecolor($maxX, $maxY); + $color = imagecolorallocate($image, 255, 255, 255); + imagefill($image, 0, 0, $color); + + // output the image + imagepng($image); + imagedestroy($image); + } + +} + diff --git a/lib/public/preview.php b/lib/public/preview.php new file mode 100644 index 00000000000..a7487c485f1 --- /dev/null +++ b/lib/public/preview.php @@ -0,0 +1,50 @@ +. +* +*/ + +/** + * Public interface of ownCloud for apps to use. + * Preview Class. + * + */ + +// use OCP namespace for all classes that are considered public. +// This means that they should be used by apps instead of the internal ownCloud classes +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)); + } + +} From e484811e24f6332df49eb35c7e2adffca81d2005 Mon Sep 17 00:00:00 2001 From: Frank Karlitschek Date: Tue, 13 Nov 2012 16:14:16 +0100 Subject: [PATCH 002/170] add some documentation, remove a debug hack, move folder name definition to main class --- lib/preview.php | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/lib/preview.php b/lib/preview.php index 8b1a42925a6..3fa494a2e03 100755 --- a/lib/preview.php +++ b/lib/preview.php @@ -19,21 +19,28 @@ TODO: class OC_Preview { - + + // the thumbnail cache folder + const THUMBNAILS_FOLDER = 'thumbnails'; /** * @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 */ - static public function show($file,$maxX,$maxY) { + static public function show($file,$maxX,$maxY,$scalingup) { + // get the mimetype of the file $mimetype=explode('/',OC_FileSystem::getMimeType($file)); - if($mimetype[0]=='imaage'){ + + // it´s an image + if($mimetype[0]=='image'){ OCP\Response::enableCaching(3600 * 24); // 24 hour - $image=OC_PreviewImage::getThumbnail($file,$maxX,$maxY,false); + $image=OC_PreviewImage::getThumbnail($file,$maxX,$maxY,$scalingup); $image->show(); + // it´s something else. Let´s create a dummy preview }else{ header('Content-type: image/png'); OC_PreviewUnknown::getThumbnail($maxX,$maxY); @@ -47,11 +54,8 @@ class OC_Preview { class OC_PreviewImage { - // the thumbnail cache folder - const THUMBNAILS_FOLDER = 'thumbnails'; - public static function getThumbnail($path,$maxX,$maxY,$scalingup) { - $thumbnails_view = new \OC_FilesystemView('/'.\OCP\User::getUser() .'/'.self::THUMBNAILS_FOLDER); + $thumbnails_view = new \OC_FilesystemView('/'.\OCP\User::getUser() .'/'.OC_Preview::THUMBNAILS_FOLDER); // is a preview already in the cache? if ($thumbnails_view->file_exists($path.'-'.$maxX.'-'.$maxY.'-'.$scalingup)) { From eb27c0b2a84da44f8e42f7e4aca0102c969eb195 Mon Sep 17 00:00:00 2001 From: Frank Karlitschek Date: Mon, 14 Jan 2013 15:51:47 +0100 Subject: [PATCH 003/170] snapshor of the preview lib. movies are not yet working --- lib/preview.php | 94 +++++++++++++++++++++++++++++++++++-------------- 1 file changed, 68 insertions(+), 26 deletions(-) diff --git a/lib/preview.php b/lib/preview.php index 3fa494a2e03..d49e9d3bde3 100755 --- a/lib/preview.php +++ b/lib/preview.php @@ -9,6 +9,7 @@ /* TODO: - delete thumbnails if files change. + - make it work with external filesystem files. - movies support - pdf support - mp3/id3 support @@ -34,12 +35,17 @@ class OC_Preview { static public function show($file,$maxX,$maxY,$scalingup) { // get the mimetype of the file $mimetype=explode('/',OC_FileSystem::getMimeType($file)); - // it´s an image if($mimetype[0]=='image'){ OCP\Response::enableCaching(3600 * 24); // 24 hour $image=OC_PreviewImage::getThumbnail($file,$maxX,$maxY,$scalingup); $image->show(); + + // it´s a video + }elseif($mimetype[0]=='video'){ + OCP\Response::enableCaching(3600 * 24); // 24 hour + OC_PreviewMovie::getThumbnail($file,$maxX,$maxY,$scalingup); + // it´s something else. Let´s create a dummy preview }else{ header('Content-type: image/png'); @@ -55,56 +61,59 @@ class OC_Preview { class OC_PreviewImage { public static function getThumbnail($path,$maxX,$maxY,$scalingup) { - $thumbnails_view = new \OC_FilesystemView('/'.\OCP\User::getUser() .'/'.OC_Preview::THUMBNAILS_FOLDER); - // is a preview already in the cache? + $thumbnails_view = new \OC_FilesystemView('/'.\OCP\User::getUser() .'/'.OC_Preview::THUMBNAILS_FOLDER); + + // is a preview already in the cache? if ($thumbnails_view->file_exists($path.'-'.$maxX.'-'.$maxY.'-'.$scalingup)) { return new \OC_Image($thumbnails_view->getLocalFile($path.'-'.$maxX.'-'.$maxY.'-'.$scalingup)); } - - // does the sourcefile exist? + + // does the sourcefile exist? if (!\OC_Filesystem::file_exists($path)) { \OC_Log::write('Preview', 'File '.$path.' don\'t exists', \OC_Log::WARN); return false; } - // open the source image + // open the source image $image = new \OC_Image(); $image->loadFromFile(\OC_Filesystem::getLocalFile($path)); if (!$image->valid()) return false; - // fix the orientation + // fix the orientation $image->fixOrientation(); - - // calculate the right preview size - $Xsize=$image->width(); - $Ysize=$image->height(); - if (($Xsize/$Ysize)>($maxX/$maxY)) { - $factor=$maxX/$Xsize; - } else { - $factor=$maxY/$Ysize; - } - - // only scale up if requested - if($scalingup==false) { - if($factor>1) $factor=1; - } - $newXsize=$Xsize*$factor; - $newYsize=$Ysize*$factor; - // resize + // calculate the right preview size + $Xsize=$image->width(); + $Ysize=$image->height(); + if (($Xsize/$Ysize)>($maxX/$maxY)) { + $factor=$maxX/$Xsize; + } else { + $factor=$maxY/$Ysize; + } + + // only scale up if requested + if($scalingup==false) { + if($factor>1) $factor=1; + } + $newXsize=$Xsize*$factor; + $newYsize=$Ysize*$factor; + + // resize $ret = $image->preciseResize($newXsize, $newYsize); if (!$ret) { \OC_Log::write('Preview', 'Couldn\'t resize image', \OC_Log::ERROR); unset($image); return false; } - - // store in cache + + // store in cache $l = $thumbnails_view->getLocalFile($path.'-'.$maxX.'-'.$maxY.'-'.$scalingup); $image->save($l); return $image; + + } @@ -112,6 +121,39 @@ class OC_PreviewImage { } +class OC_PreviewMovie { + + public static function isAvailable() { + $check=shell_exec('ffmpeg'); + if($check==NULL) return(false); else return(true); + } + + public static function getThumbnail($path,$maxX,$maxY,$scalingup) { + $thumbnails_view = new \OC_FilesystemView('/'.\OCP\User::getUser() .'/'.OC_Preview::THUMBNAILS_FOLDER); + + // is a preview already in the cache? + if ($thumbnails_view->file_exists($path.'-'.$maxX.'-'.$maxY.'-'.$scalingup)) { + return new \OC_Image($thumbnails_view->getLocalFile($path.'-'.$maxX.'-'.$maxY.'-'.$scalingup)); + } + + // does the sourcefile exist? + if (!\OC_Filesystem::file_exists($path)) { + \OC_Log::write('Preview', 'File '.$path.' don\'t exists', \OC_Log::WARN); + return false; + } + + // call ffmpeg to do the screenshot + shell_exec('ffmpeg -y -i {'.escapeshellarg($path).'} -f mjpeg -vframes 1 -ss 1 -s {'.escapeshellarg($maxX).'}x{'.escapeshellarg($maxY).'} {.'.$thumbnails_view->getLocalFile($path.'-'.$maxX.'-'.$maxY.'-'.$scalingup).'}'); + + // output the generated Preview + $thumbnails_view->getLocalFile($path.'-'.$maxX.'-'.$maxY.'-'.$scalingup); + unset($thumbnails_view); + } + + +} + + class OC_PreviewUnknown { public static function getThumbnail($maxX,$maxY) { From 9ef449842a369c2517f5c34932b502b754393ce0 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Thu, 25 Apr 2013 11:18:45 +0200 Subject: [PATCH 004/170] save current work state of Preview Lib --- lib/preview.php | 384 +++++++++++++++++++++++++++++------------------- 1 file changed, 232 insertions(+), 152 deletions(-) diff --git a/lib/preview.php b/lib/preview.php index d49e9d3bde3..c7047633212 100755 --- a/lib/preview.php +++ b/lib/preview.php @@ -1,28 +1,139 @@ getFileInfo($file); + $fileid = self::$fileinfo['fileid']; + + //echo self::THUMBNAILS_FOLDER . PATH_SEPARATOR . $fileid; + if(!self::$fileview->is_dir(self::THUMBNAILS_FOLDER . PATH_SEPARATOR . $fileid)){ + return false; + } + + //does a preview with the wanted height and width already exist? + if(self::$fileview->file_exists(self::THUMBNAILS_FOLDER . PATH_SEPARATOR . $fileid . PATH_SEPARATOR . $x . '-' . $y . '.png')){ + return self::THUMBNAILS_FOLDER . PATH_SEPARATOR . $fileid . PATH_SEPARATOR . $x . '-' . $y . '.png'; + } + + $wantedaspectratio = $maxX / $maxY; + + //array for usable cached thumbnails + $possiblethumbnails = array(); + + $allthumbnails = self::$fileview->getDirectoryContent(self::THUMBNAILS_FOLDER . PATH_SEPARATOR . $fileid); + foreach($allthumbnails as $thumbnail){ + $size = explode('-', $thumbnail['name']); + $x = $size[0]; + $y = $size[1]; + + $aspectratio = $x / $y; + if($aspectratio != $wantedaspectratio){ + continue; + } + + if($x < $maxX || $y < $maxY){ + if($scalingup){ + $scalefactor = $maxX / $x; + if($scalefactor > self::MAX_SCALE_FACTOR){ + continue; + } + }else{ + continue; + } + } + + $possiblethumbnails[$x] = $thumbnail['path']; + } + + if(count($possiblethumbnails) === 0){ + return false; + } + + if(count($possiblethumbnails) === 1){ + return current($possiblethumbnails); + } + + ksort($possiblethumbnails); + + if(key(reset($possiblethumbnails)) > $maxX){ + return current(reset($possiblethumbnails)); + } + + if(key(end($possiblethumbnails)) < $maxX){ + return current(end($possiblethumbnails)); + } + + foreach($possiblethumbnails as $width => $path){ + if($width < $maxX){ + continue; + }else{ + return $path; + } + } + } + + /** + * @brief delete a preview with a specfic height and width + * @param $file path to the file + * @param $x width of preview + * @param $y height of preview + * @return image + */ + public static function deletePreview($file, $x, $y){ + self::init(); + + $fileinfo = self::$fileview->getFileInfo($file); + $fileid = self::$fileinfo['fileid']; + + return self::$fileview->unlink(self::THUMBNAILS_FOLDER . PATH_SEPARATOR . $fileid . PATH_SEPARATOR . $x . '-' . $y . '.png'); + } + + /** + * @brief deletes all previews of a file + * @param $file path of file + * @return bool + */ + public static function deleteAllPrevies($file){ + self::init(); + + $fileinfo = self::$fileview->getFileInfo($file); + $fileid = self::$fileinfo['fileid']; + + return self::$fielview->rmdir(self::THUMBNAILS_FOLDER . PATH_SEPARATOR . $fileid); + } /** * @brief return a preview of a file @@ -32,146 +143,115 @@ class OC_Preview { * @param $scaleup Scale smaller images up to the thumbnail size or not. Might look ugly * @return image */ - static public function show($file,$maxX,$maxY,$scalingup) { - // get the mimetype of the file - $mimetype=explode('/',OC_FileSystem::getMimeType($file)); - // it´s an image - if($mimetype[0]=='image'){ - OCP\Response::enableCaching(3600 * 24); // 24 hour - $image=OC_PreviewImage::getThumbnail($file,$maxX,$maxY,$scalingup); - $image->show(); + public static function getPreview($file, $maxX, $maxY, $scalingup){ + self::init(); + + $cached = self::isCached($file, $maxX, $maxY); + if($cached){ + $image = new \OC_Image($cached); + if($image->width() != $maxX && $image->height != $maxY){ + $image->preciseResize($maxX, $maxY); + } + return $image; + } + + $mimetype = self::$fileview->getMimeType($file); + + $preview; + + foreach(self::$providers as $supportedmimetype => $provider){ + if(!preg_match($supportedmimetype, $mimetype)){ + continue; + } + + $preview = $provider->getThumbnail($file, $maxX, $maxY, $scalingup); + + if(!$preview){ + continue; + } + + if(!($preview instanceof \OC_Image)){ + $preview = @new \OC_Image($preview); + } + + //cache thumbnail + $preview->save(self::$filesview->getAbsolutePath(self::THUMBNAILS_FOLDER . PATH_SEPARATOR . $fileid . PATH_SEPARATOR . $x . '-' . $y . '.png')); + + break; + } + + return $preview; + } - // it´s a video - }elseif($mimetype[0]=='video'){ - OCP\Response::enableCaching(3600 * 24); // 24 hour - OC_PreviewMovie::getThumbnail($file,$maxX,$maxY,$scalingup); - - // it´s something else. Let´s create a dummy preview - }else{ - header('Content-type: image/png'); - OC_PreviewUnknown::getThumbnail($maxX,$maxY); + /** + * @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 showPreview($file, $maxX, $maxY, $scalingup = true, $fontsize = 12){ + OCP\Response::enableCaching(3600 * 24); // 24 hour + $preview = self::getPreview($file, $maxX, $maxY, $scalingup, $fontsize); + $preview->show(); + } + + /** + * @brief check whether or not providers and views are initialized and initialize if not + * @return void + */ + private static function init(){ + if(empty(self::$providers)){ + self::initProviders(); + } + if(is_null(self::$thumbnailsview) || is_null(self::$userlandview)){ + self::initViews(); } } + /** + * @brief register a new preview provider to be used + * @param string $provider class name of a OC_Preview_Provider + * @return void + */ + public static function registerProvider($class, $options=array()){ + self::$registeredProviders[]=array('class'=>$class, 'options'=>$options); + } -} - - - -class OC_PreviewImage { - - public static function getThumbnail($path,$maxX,$maxY,$scalingup) { - - $thumbnails_view = new \OC_FilesystemView('/'.\OCP\User::getUser() .'/'.OC_Preview::THUMBNAILS_FOLDER); - - // is a preview already in the cache? - if ($thumbnails_view->file_exists($path.'-'.$maxX.'-'.$maxY.'-'.$scalingup)) { - return new \OC_Image($thumbnails_view->getLocalFile($path.'-'.$maxX.'-'.$maxY.'-'.$scalingup)); - } - - // does the sourcefile exist? - if (!\OC_Filesystem::file_exists($path)) { - \OC_Log::write('Preview', 'File '.$path.' don\'t exists', \OC_Log::WARN); - return false; - } - - // open the source image - $image = new \OC_Image(); - $image->loadFromFile(\OC_Filesystem::getLocalFile($path)); - if (!$image->valid()) return false; - - // fix the orientation - $image->fixOrientation(); - - // calculate the right preview size - $Xsize=$image->width(); - $Ysize=$image->height(); - if (($Xsize/$Ysize)>($maxX/$maxY)) { - $factor=$maxX/$Xsize; - } else { - $factor=$maxY/$Ysize; - } - - // only scale up if requested - if($scalingup==false) { - if($factor>1) $factor=1; - } - $newXsize=$Xsize*$factor; - $newYsize=$Ysize*$factor; - - // resize - $ret = $image->preciseResize($newXsize, $newYsize); - if (!$ret) { - \OC_Log::write('Preview', 'Couldn\'t resize image', \OC_Log::ERROR); - unset($image); - return false; - } - - // store in cache - $l = $thumbnails_view->getLocalFile($path.'-'.$maxX.'-'.$maxY.'-'.$scalingup); - $image->save($l); - - return $image; - - - } - - - -} - - -class OC_PreviewMovie { - - public static function isAvailable() { - $check=shell_exec('ffmpeg'); - if($check==NULL) return(false); else return(true); - } - - public static function getThumbnail($path,$maxX,$maxY,$scalingup) { - $thumbnails_view = new \OC_FilesystemView('/'.\OCP\User::getUser() .'/'.OC_Preview::THUMBNAILS_FOLDER); - - // is a preview already in the cache? - if ($thumbnails_view->file_exists($path.'-'.$maxX.'-'.$maxY.'-'.$scalingup)) { - return new \OC_Image($thumbnails_view->getLocalFile($path.'-'.$maxX.'-'.$maxY.'-'.$scalingup)); - } - - // does the sourcefile exist? - if (!\OC_Filesystem::file_exists($path)) { - \OC_Log::write('Preview', 'File '.$path.' don\'t exists', \OC_Log::WARN); - return false; - } - - // call ffmpeg to do the screenshot - shell_exec('ffmpeg -y -i {'.escapeshellarg($path).'} -f mjpeg -vframes 1 -ss 1 -s {'.escapeshellarg($maxX).'}x{'.escapeshellarg($maxY).'} {.'.$thumbnails_view->getLocalFile($path.'-'.$maxX.'-'.$maxY.'-'.$scalingup).'}'); - - // output the generated Preview - $thumbnails_view->getLocalFile($path.'-'.$maxX.'-'.$maxY.'-'.$scalingup); - unset($thumbnails_view); - } - - -} - - -class OC_PreviewUnknown { - public static function getThumbnail($maxX,$maxY) { - - // check if GD is installed - if(!extension_loaded('gd') || !function_exists('gd_info')) { - OC_Log::write('preview', __METHOD__.'(): GD module not installed', OC_Log::ERROR); - return false; + /** + * @brief create instances of all the registered preview providers + * @return void + */ + private static function initProviders(){ + if(count(self::$providers)>0) { + return; } - - // create a white image - $image = imagecreatetruecolor($maxX, $maxY); - $color = imagecolorallocate($image, 255, 255, 255); - imagefill($image, 0, 0, $color); - - // output the image - imagepng($image); - imagedestroy($image); - } - -} - + + foreach(self::$registeredProviders as $provider) { + $class=$provider['class']; + $options=$provider['options']; + + $object = new $class($options); + + self::$providers[$object->getMimeType()] = $object; + } + + $keys = array_map('strlen', array_keys(self::$providers)); + array_multisort($keys, SORT_DESC, self::$providers); + } + + /** + * @brief initialize a new \OC\Files\View object + * @return void + */ + private static function initViews(){ + if(is_null(self::$fileview)){ + self::$fileview = new OC\Files\View(); + } + } + + public static function previewRouter($params){ + var_dump($params); + } +} \ No newline at end of file From f02aca3f6ee295485d5bb9bc99b85b5573716f17 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Thu, 25 Apr 2013 11:42:40 +0200 Subject: [PATCH 005/170] add route for previews --- core/routes.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/routes.php b/core/routes.php index be19b66bf72..be5766cea9d 100644 --- a/core/routes.php +++ b/core/routes.php @@ -42,7 +42,8 @@ $this->create('js_config', '/core/js/config.js') // Routing $this->create('core_ajax_routes', '/core/routes.json') ->action('OC_Router', 'JSRoutes'); - +$this->create('core_ajax_preview', '/core/preview.png') + ->action('OC_Preview', 'previewRouter'); OC::$CLASSPATH['OC_Core_LostPassword_Controller'] = 'core/lostpassword/controller.php'; $this->create('core_lostpassword_index', '/lostpassword/') ->get() From 8c1925425b26d9b2889632c724ec455ceeed4dd4 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Thu, 25 Apr 2013 12:51:44 +0200 Subject: [PATCH 006/170] save current work state --- lib/preview.php | 32 ++++++++++++++++-- lib/preview/images.php | 71 ++++++++++++++++++++++++++++++++++++++++ lib/preview/movies.php | 42 ++++++++++++++++++++++++ lib/preview/mp3.php | 1 + lib/preview/pdf.php | 0 lib/preview/provider.php | 20 +++++++++++ lib/preview/unknown.php | 34 +++++++++++++++++++ 7 files changed, 197 insertions(+), 3 deletions(-) create mode 100644 lib/preview/images.php create mode 100644 lib/preview/movies.php create mode 100644 lib/preview/mp3.php create mode 100644 lib/preview/pdf.php create mode 100644 lib/preview/provider.php create mode 100644 lib/preview/unknown.php diff --git a/lib/preview.php b/lib/preview.php index c7047633212..de79b424077 100755 --- a/lib/preview.php +++ b/lib/preview.php @@ -205,7 +205,7 @@ class OC_Preview { if(empty(self::$providers)){ self::initProviders(); } - if(is_null(self::$thumbnailsview) || is_null(self::$userlandview)){ + if(is_null(self::$fileview)){ self::initViews(); } } @@ -247,11 +247,37 @@ class OC_Preview { */ private static function initViews(){ if(is_null(self::$fileview)){ - self::$fileview = new OC\Files\View(); + //does this work with LDAP? + self::$fileview = new OC\Files\View(OC_User::getUser()); } } public static function previewRouter($params){ - var_dump($params); + self::init(); + + $file = (string) urldecode($_GET['file']); + $maxX = (int) $_GET['x']; + $maxY = (int) $_GET['y']; + $scalingup = (bool) $_GET['scalingup']; + + $path = 'files/' . $file; + + if($maxX === 0 || $maxY === 0){ + OC_Log::write('core', 'Can not create preview with 0px width or 0px height', OC_Log::DEBUG); + exit; + } + + var_dump(self::$fileview->file_exists($path)); + var_dump(self::$fileview->getDirectoryContent()); + var_dump(self::$fileview->getDirectoryContent('files/')); + var_dump($path); + var_dump(self::$fileview->filesize($path)); + var_dump(self::$fileview->getAbsolutePath('/')); + + if(!self::$fileview->filesize($path)){ + OC_Response::setStatus(OC_Response::STATUS_NOT_FOUND); + } + + self::showPreview($file, $maxX, $maxY, $scalingup); } } \ No newline at end of file diff --git a/lib/preview/images.php b/lib/preview/images.php new file mode 100644 index 00000000000..6b6e8e3599f --- /dev/null +++ b/lib/preview/images.php @@ -0,0 +1,71 @@ +file_exists($path.'-'.$maxX.'-'.$maxY.'-'.$scalingup)) { + return new \OC_Image($thumbnails_view->getLocalFile($path.'-'.$maxX.'-'.$maxY.'-'.$scalingup)); + } + + // does the sourcefile exist? + if (!\OC_Filesystem::file_exists($path)) { + \OC_Log::write('Preview', 'File '.$path.' don\'t exists', \OC_Log::WARN); + return false; + } + + // open the source image + $image = new \OC_Image(); + $image->loadFromFile(\OC_Filesystem::getLocalFile($path)); + if (!$image->valid()) return false; + + // fix the orientation + $image->fixOrientation(); + + // calculate the right preview size + $Xsize=$image->width(); + $Ysize=$image->height(); + if (($Xsize/$Ysize)>($maxX/$maxY)) { + $factor=$maxX/$Xsize; + } else { + $factor=$maxY/$Ysize; + } + + // only scale up if requested + if($scalingup==false) { + if($factor>1) $factor=1; + } + $newXsize=$Xsize*$factor; + $newYsize=$Ysize*$factor; + + // resize + $ret = $image->preciseResize($newXsize, $newYsize); + if (!$ret) { + \OC_Log::write('Preview', 'Couldn\'t resize image', \OC_Log::ERROR); + unset($image); + return false; + } + + // store in cache + $l = $thumbnails_view->getLocalFile($path.'-'.$maxX.'-'.$maxY.'-'.$scalingup); + $image->save($l); + + return $image; + } + +} + +OC_Preview::registerProvider('OC_Preview_Image'); \ No newline at end of file diff --git a/lib/preview/movies.php b/lib/preview/movies.php new file mode 100644 index 00000000000..afa27c0b143 --- /dev/null +++ b/lib/preview/movies.php @@ -0,0 +1,42 @@ +file_exists($path.'-'.$maxX.'-'.$maxY.'-'.$scalingup)) { + return new \OC_Image($thumbnails_view->getLocalFile($path.'-'.$maxX.'-'.$maxY.'-'.$scalingup)); + } + + // does the sourcefile exist? + if (!\OC_Filesystem::file_exists($path)) { + \OC_Log::write('Preview', 'File '.$path.' don\'t exists', \OC_Log::WARN); + return false; + } + + // call ffmpeg to do the screenshot + shell_exec('ffmpeg -y -i {'.escapeshellarg($path).'} -f mjpeg -vframes 1 -ss 1 -s {'.escapeshellarg($maxX).'}x{'.escapeshellarg($maxY).'} {.'.$thumbnails_view->getLocalFile($path.'-'.$maxX.'-'.$maxY.'-'.$scalingup).'}'); + + // output the generated Preview + $thumbnails_view->getLocalFile($path.'-'.$maxX.'-'.$maxY.'-'.$scalingup); + unset($thumbnails_view); + } + + } + + OC_Preview::registerProvider('OC_Preview_Movie'); +} \ No newline at end of file diff --git a/lib/preview/mp3.php b/lib/preview/mp3.php new file mode 100644 index 00000000000..645e6fa6232 --- /dev/null +++ b/lib/preview/mp3.php @@ -0,0 +1 @@ +///audio\/mpeg/ \ No newline at end of file diff --git a/lib/preview/pdf.php b/lib/preview/pdf.php new file mode 100644 index 00000000000..e69de29bb2d diff --git a/lib/preview/provider.php b/lib/preview/provider.php new file mode 100644 index 00000000000..c45edbba44d --- /dev/null +++ b/lib/preview/provider.php @@ -0,0 +1,20 @@ +options=$options; + } + + abstract public function getMimeType(); + + /** + * search for $query + * @param string $query + * @return + */ + abstract public function getThumbnail($path, $maxX, $maxY, $scalingup); +} diff --git a/lib/preview/unknown.php b/lib/preview/unknown.php new file mode 100644 index 00000000000..1cd270db687 --- /dev/null +++ b/lib/preview/unknown.php @@ -0,0 +1,34 @@ + Date: Thu, 9 May 2013 23:59:16 +0200 Subject: [PATCH 007/170] implement OC_Preview --- lib/preview.php | 527 +++++++++++++++++++++++++++++---------- lib/preview/images.php | 53 +--- lib/preview/movies.php | 4 +- lib/preview/mp3.php | 21 +- lib/preview/pdf.php | 29 +++ lib/preview/provider.php | 2 +- lib/preview/unknown.php | 2 +- 7 files changed, 451 insertions(+), 187 deletions(-) diff --git a/lib/preview.php b/lib/preview.php index de79b424077..c062a068872 100755 --- a/lib/preview.php +++ b/lib/preview.php @@ -5,21 +5,38 @@ * This file is licensed under the Affero General Public License version 3 or * later. * See the COPYING-README file. - */ -/* + * * Thumbnails: * structure of filename: * /data/user/thumbnails/pathhash/x-y.png * */ +require_once('preview/images.php'); +require_once('preview/movies.php'); +require_once('preview/mp3.php'); +require_once('preview/pdf.php'); +require_once('preview/unknown.php'); class OC_Preview { //the thumbnail folder const THUMBNAILS_FOLDER = 'thumbnails'; - const MAX_SCALE_FACTOR = 2; + + //config + private $max_scale_factor; + private $max_x; + private $max_y; //fileview object - static private $fileview = null; + private $fileview = null; + private $userview = null; + + //vars + private $file; + private $maxX; + private $maxY; + private $scalingup; + + private $preview; //preview providers static private $providers = array(); @@ -27,6 +44,8 @@ class OC_Preview { /** * @brief check if thumbnail or bigger version of thumbnail of file is cached + * @param $user userid + * @param $root path of root * @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 @@ -34,68 +53,223 @@ class OC_Preview { * false if thumbnail does not exist * path to thumbnail if thumbnail exists */ - private static function isCached($file, $maxX, $maxY, $scalingup){ - $fileinfo = self::$fileview->getFileInfo($file); - $fileid = self::$fileinfo['fileid']; + public function __construct($user = null, $root = '', $file = '', $maxX = 0, $maxY = 0, $scalingup = false){ + //set config + $this->max_x = OC_Config::getValue('preview_max_x', null); + $this->max_y = OC_Config::getValue('preview_max_y', null); + $this->max_scale_factor = OC_Config::getValue('preview_max_scale_factor', 10); - //echo self::THUMBNAILS_FOLDER . PATH_SEPARATOR . $fileid; - if(!self::$fileview->is_dir(self::THUMBNAILS_FOLDER . PATH_SEPARATOR . $fileid)){ + //save parameters + $this->file = $file; + $this->maxX = $maxX; + $this->maxY = $maxY; + $this->scalingup = $scalingup; + + //init fileviews + $this->fileview = new \OC\Files\View('/' . $user . '/' . $root); + $this->userview = new \OC\Files\View('/' . $user); + + if(!is_null($this->max_x)){ + if($this->maxX > $this->max_x){ + OC_Log::write('core', 'maxX reduced from ' . $this->maxX . ' to ' . $this->max_x, OC_Log::DEBUG); + $this->maxX = $this->max_x; + } + } + + if(!is_null($this->max_y)){ + if($this->maxY > $this->max_y){ + OC_Log::write('core', 'maxY reduced from ' . $this->maxY . ' to ' . $this->max_y, OC_Log::DEBUG); + $this->maxY = $this->max_y; + } + } + + //init providers + if(empty(self::$providers)){ + self::initProviders(); + } + + //check if there are any providers at all + if(empty(self::$providers)){ + OC_Log::write('core', 'No preview providers exist', OC_Log::ERROR); + throw new Exception('No providers'); + } + + //validate parameters + if($file === ''){ + OC_Log::write('core', 'No filename passed', OC_Log::ERROR); + throw new Exception('File not found'); + } + + //check if file exists + if(!$this->fileview->file_exists($file)){ + OC_Log::write('core', 'File:"' . $file . '" not found', OC_Log::ERROR); + throw new Exception('File not found'); + } + + //check if given size makes sense + if($maxX === 0 || $maxY === 0){ + OC_Log::write('core', 'Can not create preview with 0px width or 0px height', OC_Log::ERROR); + throw new Exception('Height and/or width set to 0'); + } + } + + /** + * @brief returns the path of the file you want a thumbnail from + * @return string + */ + public function getFile(){ + return $this->file; + } + + /** + * @brief returns the max width of the preview + * @return integer + */ + public function getMaxX(){ + return $this->maxX; + } + + /** + * @brief returns the max height of the preview + * @return integer + */ + public function getMaxY(){ + return $this->maxY; + } + + /** + * @brief returns whether or not scalingup is enabled + * @return bool + */ + public function getScalingup(){ + return $this->scalingup; + } + + /** + * @brief returns the name of the thumbnailfolder + * @return string + */ + public function getThumbnailsfolder(){ + return self::THUMBNAILS_FOLDER; + } + + /** + * @brief returns the max scale factor + * @return integer + */ + public function getMaxScaleFactor(){ + return $this->max_scale_factor; + } + + /** + * @brief returns the max width set in ownCloud's config + * @return integer + */ + public function getConfigMaxX(){ + return $this->max_x; + } + + /** + * @brief returns the max height set in ownCloud's config + * @return integer + */ + public function getConfigMaxY(){ + return $this->max_y; + } + + /** + * @brief deletes previews of a file with specific x and y + * @return bool + */ + public function deletePreview(){ + $fileinfo = $this->fileview->getFileInfo($this->file); + $fileid = $fileinfo['fileid']; + + return $this->userview->unlink(self::THUMBNAILS_FOLDER . '/' . $fileid . '/' . $this->maxX . '-' . $this->maxY . '.png'); + } + + /** + * @brief deletes all previews of a file + * @return bool + */ + public function deleteAllPrevies(){ + $fileinfo = $this->fileview->getFileInfo($this->file); + $fileid = $fileinfo['fileid']; + + return $this->userview->rmdir(self::THUMBNAILS_FOLDER . '/' . $fileid); + } + + /** + * @brief check if thumbnail or bigger version of thumbnail of file is cached + * @return mixed (bool / string) + * false if thumbnail does not exist + * path to thumbnail if thumbnail exists + */ + private function isCached(){ + $file = $this->file; + $maxX = $this->maxX; + $maxY = $this->maxY; + $scalingup = $this->scalingup; + + $fileinfo = $this->fileview->getFileInfo($file); + $fileid = $fileinfo['fileid']; + + if(!$this->userview->is_dir(self::THUMBNAILS_FOLDER . '/' . $fileid)){ return false; } - + //does a preview with the wanted height and width already exist? - if(self::$fileview->file_exists(self::THUMBNAILS_FOLDER . PATH_SEPARATOR . $fileid . PATH_SEPARATOR . $x . '-' . $y . '.png')){ - return self::THUMBNAILS_FOLDER . PATH_SEPARATOR . $fileid . PATH_SEPARATOR . $x . '-' . $y . '.png'; + if($this->userview->file_exists(self::THUMBNAILS_FOLDER . '/' . $fileid . '/' . $maxX . '-' . $maxY . '.png')){ + return self::THUMBNAILS_FOLDER . '/' . $fileid . '/' . $maxX . '-' . $maxY . '.png'; } - + $wantedaspectratio = $maxX / $maxY; - + //array for usable cached thumbnails $possiblethumbnails = array(); - - $allthumbnails = self::$fileview->getDirectoryContent(self::THUMBNAILS_FOLDER . PATH_SEPARATOR . $fileid); + + $allthumbnails = $this->userview->getDirectoryContent(self::THUMBNAILS_FOLDER . '/' . $fileid); foreach($allthumbnails as $thumbnail){ $size = explode('-', $thumbnail['name']); $x = $size[0]; $y = $size[1]; - + $aspectratio = $x / $y; if($aspectratio != $wantedaspectratio){ continue; } - + if($x < $maxX || $y < $maxY){ if($scalingup){ $scalefactor = $maxX / $x; - if($scalefactor > self::MAX_SCALE_FACTOR){ + if($scalefactor > $this->max_scale_factor){ continue; } }else{ continue; } } - $possiblethumbnails[$x] = $thumbnail['path']; } - + if(count($possiblethumbnails) === 0){ return false; } - + if(count($possiblethumbnails) === 1){ return current($possiblethumbnails); } - + ksort($possiblethumbnails); - + if(key(reset($possiblethumbnails)) > $maxX){ return current(reset($possiblethumbnails)); } - + if(key(end($possiblethumbnails)) < $maxX){ return current(end($possiblethumbnails)); } - + foreach($possiblethumbnails as $width => $path){ if($width < $maxX){ continue; @@ -105,36 +279,6 @@ class OC_Preview { } } - /** - * @brief delete a preview with a specfic height and width - * @param $file path to the file - * @param $x width of preview - * @param $y height of preview - * @return image - */ - public static function deletePreview($file, $x, $y){ - self::init(); - - $fileinfo = self::$fileview->getFileInfo($file); - $fileid = self::$fileinfo['fileid']; - - return self::$fileview->unlink(self::THUMBNAILS_FOLDER . PATH_SEPARATOR . $fileid . PATH_SEPARATOR . $x . '-' . $y . '.png'); - } - - /** - * @brief deletes all previews of a file - * @param $file path of file - * @return bool - */ - public static function deleteAllPrevies($file){ - self::init(); - - $fileinfo = self::$fileview->getFileInfo($file); - $fileid = self::$fileinfo['fileid']; - - return self::$fielview->rmdir(self::THUMBNAILS_FOLDER . PATH_SEPARATOR . $fileid); - } - /** * @brief return a preview of a file * @param $file The path to the file where you want a thumbnail from @@ -143,44 +287,49 @@ class OC_Preview { * @param $scaleup Scale smaller images up to the thumbnail size or not. Might look ugly * @return image */ - public static function getPreview($file, $maxX, $maxY, $scalingup){ - self::init(); - - $cached = self::isCached($file, $maxX, $maxY); + public function getPreview(){ + $file = $this->file; + $maxX = $this->maxX; + $maxY = $this->maxY; + $scalingup = $this->scalingup; + + $fileinfo = $this->fileview->getFileInfo($file); + $fileid = $fileinfo['fileid']; + + $cached = self::isCached(); + if($cached){ - $image = new \OC_Image($cached); - if($image->width() != $maxX && $image->height != $maxY){ - $image->preciseResize($maxX, $maxY); + $image = new \OC_Image($this->userview->getLocalFile($cached)); + $this->preview = $image; + }else{ + $mimetype = $this->fileview->getMimeType($file); + + $preview; + + foreach(self::$providers as $supportedmimetype => $provider){ + if(!preg_match($supportedmimetype, $mimetype)){ + continue; + } + + $preview = $provider->getThumbnail($file, $maxX, $maxY, $scalingup, $this->fileview); + + if(!$preview){ + continue; + } + + if(!($preview instanceof \OC_Image)){ + $preview = @new \OC_Image($preview); + } + + //cache thumbnail + $preview->save($this->userview->getLocalFile(self::THUMBNAILS_FOLDER . '/' . $fileid . '/' . $maxX . '-' . $maxY . '.png')); + + break; } - return $image; + $this->preview = $preview; } - - $mimetype = self::$fileview->getMimeType($file); - - $preview; - - foreach(self::$providers as $supportedmimetype => $provider){ - if(!preg_match($supportedmimetype, $mimetype)){ - continue; - } - - $preview = $provider->getThumbnail($file, $maxX, $maxY, $scalingup); - - if(!$preview){ - continue; - } - - if(!($preview instanceof \OC_Image)){ - $preview = @new \OC_Image($preview); - } - - //cache thumbnail - $preview->save(self::$filesview->getAbsolutePath(self::THUMBNAILS_FOLDER . PATH_SEPARATOR . $fileid . PATH_SEPARATOR . $x . '-' . $y . '.png')); - - break; - } - - return $preview; + $this->resizeAndCrop(); + return $this->preview; } /** @@ -189,24 +338,109 @@ class OC_Preview { * @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 showPreview($file, $maxX, $maxY, $scalingup = true, $fontsize = 12){ - OCP\Response::enableCaching(3600 * 24); // 24 hour - $preview = self::getPreview($file, $maxX, $maxY, $scalingup, $fontsize); - $preview->show(); - } - - /** - * @brief check whether or not providers and views are initialized and initialize if not * @return void */ - private static function init(){ - if(empty(self::$providers)){ - self::initProviders(); + public function showPreview(){ + OCP\Response::enableCaching(3600 * 24); // 24 hour + $preview = $this->getPreview(); + if($preview){ + $preview->show(); } - if(is_null(self::$fileview)){ - self::initViews(); + } + + /** + * @brief resize, crop and fix orientation + * @return image + */ + public function resizeAndCrop(){ + $image = $this->preview; + $x = $this->maxX; + $y = $this->maxY; + $scalingup = $this->scalingup; + + $image->fixOrientation(); + + if(!($image instanceof \OC_Image)){ + OC_Log::write('core', 'Object passed to resizeAndCrop is not an instance of OC_Image', OC_Log::DEBUG); + return; + } + + $realx = (int) $image->width(); + $realy = (int) $image->height(); + + if($x === $realx && $y === $realy){ + return $image; + } + + $factorX = $x / $realx; + $factorY = $y / $realy; + + if($factorX >= $factorY){ + $factor = $factorX; + }else{ + $factor = $factorY; + } + + // only scale up if requested + if($scalingup === false) { + if($factor>1) $factor=1; + } + if(!is_null($this->max_scale_factor)){ + if($factor > $this->max_scale_factor){ + OC_Log::write('core', 'scalefactor reduced from ' . $factor . ' to ' . $this->max_scale_factor, OC_Log::DEBUG); + $factor = $this->max_scale_factor; + } + } + $newXsize = $realx * $factor; + $newYsize = $realy * $factor; + + // resize + $image->preciseResize($newXsize, $newYsize); + + if($newXsize === $x && $newYsize === $y){ + $this->preview = $image; + return; + } + + if($newXsize >= $x && $newYsize >= $y){ + $cropX = floor(abs($x - $newXsize) * 0.5); + $cropY = floor(abs($y - $newYsize) * 0.5); + + $image->crop($cropX, $cropY, $x, $y); + + $this->preview = $image; + return; + } + + if($newXsize < $x || $newYsize < $y){ + if($newXsize > $x){ + $cropX = floor(($newXsize - $x) * 0.5); + $image->crop($cropX, 0, $x, $newYsize); + } + + if($newYsize > $y){ + $cropY = floor(($newYsize - $y) * 0.5); + $image->crop(0, $cropY, $newXsize, $y); + } + + $newXsize = (int) $image->width(); + $newYsize = (int) $image->height(); + + //create transparent background layer + $transparentlayer = imagecreatetruecolor($x, $y); + $black = imagecolorallocate($transparentlayer, 0, 0, 0); + $image = $image->resource(); + imagecolortransparent($transparentlayer, $black); + + $mergeX = floor(abs($x - $newXsize) * 0.5); + $mergeY = floor(abs($y - $newYsize) * 0.5); + + imagecopymerge($transparentlayer, $image, $mergeX, $mergeY, 0, 0, $newXsize, $newYsize, 100); + + $image = new \OC_Image($transparentlayer); + + $this->preview = $image; + return; } } @@ -236,48 +470,75 @@ class OC_Preview { self::$providers[$object->getMimeType()] = $object; } - + $keys = array_map('strlen', array_keys(self::$providers)); array_multisort($keys, SORT_DESC, self::$providers); } /** - * @brief initialize a new \OC\Files\View object + * @brief method that handles preview requests from users that are logged in * @return void */ - private static function initViews(){ - if(is_null(self::$fileview)){ - //does this work with LDAP? - self::$fileview = new OC\Files\View(OC_User::getUser()); + public static function previewRouter($params){ + OC_Util::checkLoggedIn(); + + $file = ''; + $maxX = 0; + $maxY = 0; + /* + * use: ?scalingup=0 / ?scalingup = 1 + * do not use ?scalingup=false / ?scalingup = true as these will always be true + */ + $scalingup = false; + + if(array_key_exists('file', $_GET)) $file = (string) urldecode($_GET['file']); + if(array_key_exists('x', $_GET)) $maxX = (int) $_GET['x']; + if(array_key_exists('y', $_GET)) $maxY = (int) $_GET['y']; + if(array_key_exists('scalingup', $_GET)) $scalingup = (bool) $_GET['scalingup']; + + if($file !== '' && $maxX !== 0 && $maxY !== 0){ + $preview = new OC_Preview(OC_User::getUser(), 'files', $file, $maxX, $maxY, $scalingup); + $preview->showPreview(); + }else{ + OC_Response::setStatus(404); + exit; } } - public static function previewRouter($params){ - self::init(); + /** + * @brief method that handles preview requests from users that are not logged in / view shared folders that are public + * @return void + */ + public static function publicPreviewRouter($params){ + $file = ''; + $maxX = 0; + $maxY = 0; + $scalingup = false; + $token = ''; - $file = (string) urldecode($_GET['file']); - $maxX = (int) $_GET['x']; - $maxY = (int) $_GET['y']; - $scalingup = (bool) $_GET['scalingup']; + $user = null; + $path = null; - $path = 'files/' . $file; + if(array_key_exists('file', $_GET)) $file = (string) urldecode($_GET['file']); + if(array_key_exists('x', $_GET)) $maxX = (int) $_GET['x']; + if(array_key_exists('y', $_GET)) $maxY = (int) $_GET['y']; + if(array_key_exists('scalingup', $_GET)) $scalingup = (bool) $_GET['scalingup']; + if(array_key_exists('t', $_GET)) $token = (string) $_GET['t']; - if($maxX === 0 || $maxY === 0){ - OC_Log::write('core', 'Can not create preview with 0px width or 0px height', OC_Log::DEBUG); + $linkItem = OCP\Share::getShareByToken($token); + if (is_array($linkItem) && isset($linkItem['uid_owner']) && isset($linkItem['file_source'])) { + $userid = $linkItem['uid_owner']; + OC_Util::setupFS($fileOwner); + $path = $linkItem['file_source']; + } + + if($user !== null && $path !== null){ + $preview = new OC_Preview($userid, $path, $file, $maxX, $maxY, $scalingup); + $preview->showPreview(); + }else{ + OC_Response::setStatus(404); exit; } - var_dump(self::$fileview->file_exists($path)); - var_dump(self::$fileview->getDirectoryContent()); - var_dump(self::$fileview->getDirectoryContent('files/')); - var_dump($path); - var_dump(self::$fileview->filesize($path)); - var_dump(self::$fileview->getAbsolutePath('/')); - - if(!self::$fileview->filesize($path)){ - OC_Response::setStatus(OC_Response::STATUS_NOT_FOUND); - } - - self::showPreview($file, $maxX, $maxY, $scalingup); } } \ No newline at end of file diff --git a/lib/preview/images.php b/lib/preview/images.php index 6b6e8e3599f..6766cdb2148 100644 --- a/lib/preview/images.php +++ b/lib/preview/images.php @@ -12,60 +12,15 @@ class OC_Preview_Image extends OC_Preview_Provider{ return '/image\/.*/'; } - public static function getThumbnail($path,$maxX,$maxY,$scalingup) { - - $thumbnails_view = new \OC_FilesystemView('/'.\OCP\User::getUser() .'/'.OC_Preview::THUMBNAILS_FOLDER); - - // is a preview already in the cache? - if ($thumbnails_view->file_exists($path.'-'.$maxX.'-'.$maxY.'-'.$scalingup)) { - return new \OC_Image($thumbnails_view->getLocalFile($path.'-'.$maxX.'-'.$maxY.'-'.$scalingup)); - } - - // does the sourcefile exist? - if (!\OC_Filesystem::file_exists($path)) { - \OC_Log::write('Preview', 'File '.$path.' don\'t exists', \OC_Log::WARN); - return false; - } - - // open the source image + public function getThumbnail($path,$maxX,$maxY,$scalingup,$fileview) { + //new image object $image = new \OC_Image(); - $image->loadFromFile(\OC_Filesystem::getLocalFile($path)); + $image->loadFromFile($fileview->getLocalFile($path)); + //check if image object is valid if (!$image->valid()) return false; - // fix the orientation - $image->fixOrientation(); - - // calculate the right preview size - $Xsize=$image->width(); - $Ysize=$image->height(); - if (($Xsize/$Ysize)>($maxX/$maxY)) { - $factor=$maxX/$Xsize; - } else { - $factor=$maxY/$Ysize; - } - - // only scale up if requested - if($scalingup==false) { - if($factor>1) $factor=1; - } - $newXsize=$Xsize*$factor; - $newYsize=$Ysize*$factor; - - // resize - $ret = $image->preciseResize($newXsize, $newYsize); - if (!$ret) { - \OC_Log::write('Preview', 'Couldn\'t resize image', \OC_Log::ERROR); - unset($image); - return false; - } - - // store in cache - $l = $thumbnails_view->getLocalFile($path.'-'.$maxX.'-'.$maxY.'-'.$scalingup); - $image->save($l); - return $image; } - } OC_Preview::registerProvider('OC_Preview_Image'); \ No newline at end of file diff --git a/lib/preview/movies.php b/lib/preview/movies.php index afa27c0b143..c994240424c 100644 --- a/lib/preview/movies.php +++ b/lib/preview/movies.php @@ -6,7 +6,7 @@ * later. * See the COPYING-README file. */ -if(!is_null(shell_exec('ffmpeg'))){ +if(!is_null(shell_exec('ffmpeg -version'))){ class OC_Preview_Movie extends OC_Preview_Provider{ @@ -14,7 +14,7 @@ if(!is_null(shell_exec('ffmpeg'))){ return '/video\/.*/'; } - public static function getThumbnail($path,$maxX,$maxY,$scalingup) { + public function getThumbnail($path,$maxX,$maxY,$scalingup,$fileview) { $thumbnails_view = new \OC_FilesystemView('/'.\OCP\User::getUser() .'/'.OC_Preview::THUMBNAILS_FOLDER); // is a preview already in the cache? diff --git a/lib/preview/mp3.php b/lib/preview/mp3.php index 645e6fa6232..2481e743783 100644 --- a/lib/preview/mp3.php +++ b/lib/preview/mp3.php @@ -1 +1,20 @@ -///audio\/mpeg/ \ No newline at end of file +getLocalFile($path) . '[0]'); + $pdf->setImageFormat('png'); + + //new image object + $image = new \OC_Image(); + $image->loadFromFile($fileview->getLocalFile($path)); + //check if image object is valid + if (!$image->valid()) return false; + + return $image; + } +} + +OC_Preview::registerProvider('OC_Preview_PDF'); \ No newline at end of file diff --git a/lib/preview/provider.php b/lib/preview/provider.php index c45edbba44d..e9264030144 100644 --- a/lib/preview/provider.php +++ b/lib/preview/provider.php @@ -16,5 +16,5 @@ abstract class OC_Preview_Provider{ * @param string $query * @return */ - abstract public function getThumbnail($path, $maxX, $maxY, $scalingup); + abstract public function getThumbnail($path, $maxX, $maxY, $scalingup,$fileview); } diff --git a/lib/preview/unknown.php b/lib/preview/unknown.php index 1cd270db687..5089a56d671 100644 --- a/lib/preview/unknown.php +++ b/lib/preview/unknown.php @@ -12,7 +12,7 @@ class OC_Preview_Unknown extends OC_Preview_Provider{ return '/.*/'; } - public static function getThumbnail($maxX,$maxY) { + public function getThumbnail($path, $maxX, $maxY, $scalingup,$fileview) { // check if GD is installed if(!extension_loaded('gd') || !function_exists('gd_info')) { OC_Log::write('preview', __METHOD__.'(): GD module not installed', OC_Log::ERROR); From 837c6ed597f1c549cac5b0b439b257d81ea02b1d Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Fri, 17 May 2013 09:43:25 +0200 Subject: [PATCH 008/170] implement pdf preview backend --- lib/preview/pdf.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/preview/pdf.php b/lib/preview/pdf.php index d86ad643914..695f8569538 100644 --- a/lib/preview/pdf.php +++ b/lib/preview/pdf.php @@ -14,11 +14,10 @@ class OC_Preview_PDF extends OC_Preview_Provider{ public function getThumbnail($path, $maxX, $maxY, $scalingup,$fileview) { //create imagick object from pdf $pdf = new imagick($fileview->getLocalFile($path) . '[0]'); - $pdf->setImageFormat('png'); - + $pdf->setImageFormat('jpg'); + //new image object - $image = new \OC_Image(); - $image->loadFromFile($fileview->getLocalFile($path)); + $image = new \OC_Image($pdf); //check if image object is valid if (!$image->valid()) return false; From 8dba46912d19bf976b24e0c097368f2e56ccb97b Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Fri, 17 May 2013 11:28:49 +0200 Subject: [PATCH 009/170] Disable transparent backgrounds for now --- lib/preview.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/preview.php b/lib/preview.php index c062a068872..44b551006f1 100755 --- a/lib/preview.php +++ b/lib/preview.php @@ -427,17 +427,21 @@ class OC_Preview { $newYsize = (int) $image->height(); //create transparent background layer - $transparentlayer = imagecreatetruecolor($x, $y); - $black = imagecolorallocate($transparentlayer, 0, 0, 0); + $backgroundlayer = imagecreatetruecolor($x, $y); + $white = imagecolorallocate($backgroundlayer, 255, 255, 255); + imagefill($backgroundlayer, 0, 0, $white); + $image = $image->resource(); - imagecolortransparent($transparentlayer, $black); $mergeX = floor(abs($x - $newXsize) * 0.5); $mergeY = floor(abs($y - $newYsize) * 0.5); - imagecopymerge($transparentlayer, $image, $mergeX, $mergeY, 0, 0, $newXsize, $newYsize, 100); + imagecopy($backgroundlayer, $image, $mergeX, $mergeY, 0, 0, $newXsize, $newYsize); - $image = new \OC_Image($transparentlayer); + //$black = imagecolorallocate(0,0,0); + //imagecolortransparent($transparentlayer, $black); + + $image = new \OC_Image($backgroundlayer); $this->preview = $image; return; From f29b8cf68531844c23c45a210e280769a8cece73 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Fri, 17 May 2013 11:30:44 +0200 Subject: [PATCH 010/170] set default value of scalingup to true --- lib/preview.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/preview.php b/lib/preview.php index 44b551006f1..3b6e0ae131e 100755 --- a/lib/preview.php +++ b/lib/preview.php @@ -53,7 +53,7 @@ class OC_Preview { * false if thumbnail does not exist * path to thumbnail if thumbnail exists */ - public function __construct($user = null, $root = '', $file = '', $maxX = 0, $maxY = 0, $scalingup = false){ + public function __construct($user = null, $root = '', $file = '', $maxX = 0, $maxY = 0, $scalingup = true){ //set config $this->max_x = OC_Config::getValue('preview_max_x', null); $this->max_y = OC_Config::getValue('preview_max_y', null); @@ -493,7 +493,7 @@ class OC_Preview { * use: ?scalingup=0 / ?scalingup = 1 * do not use ?scalingup=false / ?scalingup = true as these will always be true */ - $scalingup = false; + $scalingup = true; if(array_key_exists('file', $_GET)) $file = (string) urldecode($_GET['file']); if(array_key_exists('x', $_GET)) $maxX = (int) $_GET['x']; @@ -517,7 +517,7 @@ class OC_Preview { $file = ''; $maxX = 0; $maxY = 0; - $scalingup = false; + $scalingup = true; $token = ''; $user = null; From 04a4234b9eba85dc1a2f690c12e6a59381a74a54 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Fri, 17 May 2013 11:32:42 +0200 Subject: [PATCH 011/170] implement mp3 preview backend --- lib/preview/mp3.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/preview/mp3.php b/lib/preview/mp3.php index 2481e743783..f5fac0b8366 100644 --- a/lib/preview/mp3.php +++ b/lib/preview/mp3.php @@ -5,14 +5,30 @@ * later. * See the COPYING-README file. */ +require_once('getid3/getid3.php'); + class OC_Preview_MP3 extends OC_Preview_Provider{ public function getMimeType(){ return '/audio\/mpeg/'; } - public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) { + public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) { + $getID3 = new getID3(); + //Todo - add stream support + $tags = $getID3->analyze($fileview->getLocalFile($path)); + getid3_lib::CopyTagsToComments($tags); + $picture = @$tags['id3v2']['APIC'][0]['data']; + $image = new \OC_Image($picture); + if (!$image->valid()) return $this->getNoCoverThumbnail($maxX, $maxY); + + return $image; + } + + public function getNoCoverThumbnail($maxX, $maxY){ + $image = new \OC_Image(); + return $image; } } From 8b39a085121fae7823046f209eecc3484cf5c936 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Fri, 17 May 2013 12:00:32 +0200 Subject: [PATCH 012/170] fix typo --- lib/preview/images.php | 2 +- lib/preview/movies.php | 2 +- lib/preview/mp3.php | 2 +- lib/preview/pdf.php | 2 +- lib/preview/unknown.php | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/preview/images.php b/lib/preview/images.php index 6766cdb2148..589c7d829d5 100644 --- a/lib/preview/images.php +++ b/lib/preview/images.php @@ -1,7 +1,7 @@ Date: Fri, 17 May 2013 15:06:37 +0200 Subject: [PATCH 013/170] implement movie previews --- lib/preview/movies.php | 33 +++++++++++---------------------- 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/lib/preview/movies.php b/lib/preview/movies.php index 1f0ceb3ace3..868755a1205 100644 --- a/lib/preview/movies.php +++ b/lib/preview/movies.php @@ -7,7 +7,6 @@ * See the COPYING-README file. */ if(!is_null(shell_exec('ffmpeg -version'))){ - class OC_Preview_Movie extends OC_Preview_Provider{ public function getMimeType(){ @@ -15,28 +14,18 @@ if(!is_null(shell_exec('ffmpeg -version'))){ } public function getThumbnail($path,$maxX,$maxY,$scalingup,$fileview) { - $thumbnails_view = new \OC_FilesystemView('/'.\OCP\User::getUser() .'/'.OC_Preview::THUMBNAILS_FOLDER); - - // is a preview already in the cache? - if ($thumbnails_view->file_exists($path.'-'.$maxX.'-'.$maxY.'-'.$scalingup)) { - return new \OC_Image($thumbnails_view->getLocalFile($path.'-'.$maxX.'-'.$maxY.'-'.$scalingup)); - } - - // does the sourcefile exist? - if (!\OC_Filesystem::file_exists($path)) { - \OC_Log::write('Preview', 'File '.$path.' don\'t exists', \OC_Log::WARN); - return false; - } - - // call ffmpeg to do the screenshot - shell_exec('ffmpeg -y -i {'.escapeshellarg($path).'} -f mjpeg -vframes 1 -ss 1 -s {'.escapeshellarg($maxX).'}x{'.escapeshellarg($maxY).'} {.'.$thumbnails_view->getLocalFile($path.'-'.$maxX.'-'.$maxY.'-'.$scalingup).'}'); - - // output the generated Preview - $thumbnails_view->getLocalFile($path.'-'.$maxX.'-'.$maxY.'-'.$scalingup); - unset($thumbnails_view); + $abspath = $fileview->getLocalfile($path); + + $tmppath = OC_Helper::tmpFile(); + + $cmd = 'ffmpeg -y -i ' . escapeshellarg($abspath) . ' -f mjpeg -vframes 1 -ss 1 -s ' . escapeshellarg($maxX) . 'x' . escapeshellarg($maxY) . ' ' . $tmppath; + shell_exec($cmd); + + $image = new \OC_Image($tmppath); + if (!$image->valid()) return false; + + return $image; } - } - OC_Preview::registerProvider('OC_Preview_Movie'); } \ No newline at end of file From dd06387a9c65dfaf8d95e6545586f7a042bfd44e Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Fri, 17 May 2013 19:08:16 +0200 Subject: [PATCH 014/170] remove whitespace --- lib/preview.php | 79 ++++++++++++++++++++-------------------- lib/preview/images.php | 2 +- lib/preview/movies.php | 10 ++--- lib/preview/mp3.php | 2 +- lib/preview/pdf.php | 2 +- lib/preview/provider.php | 2 +- lib/preview/unknown.php | 21 +++-------- 7 files changed, 53 insertions(+), 65 deletions(-) diff --git a/lib/preview.php b/lib/preview.php index 3b6e0ae131e..d6c72603524 100755 --- a/lib/preview.php +++ b/lib/preview.php @@ -20,7 +20,7 @@ require_once('preview/unknown.php'); class OC_Preview { //the thumbnail folder const THUMBNAILS_FOLDER = 'thumbnails'; - + //config private $max_scale_factor; private $max_x; @@ -35,7 +35,7 @@ class OC_Preview { private $maxX; private $maxY; private $scalingup; - + private $preview; //preview providers @@ -58,7 +58,7 @@ class OC_Preview { $this->max_x = OC_Config::getValue('preview_max_x', null); $this->max_y = OC_Config::getValue('preview_max_y', null); $this->max_scale_factor = OC_Config::getValue('preview_max_scale_factor', 10); - + //save parameters $this->file = $file; $this->maxX = $maxX; @@ -112,7 +112,7 @@ class OC_Preview { throw new Exception('Height and/or width set to 0'); } } - + /** * @brief returns the path of the file you want a thumbnail from * @return string @@ -120,7 +120,7 @@ class OC_Preview { public function getFile(){ return $this->file; } - + /** * @brief returns the max width of the preview * @return integer @@ -136,7 +136,7 @@ class OC_Preview { public function getMaxY(){ return $this->maxY; } - + /** * @brief returns whether or not scalingup is enabled * @return bool @@ -144,7 +144,7 @@ class OC_Preview { public function getScalingup(){ return $this->scalingup; } - + /** * @brief returns the name of the thumbnailfolder * @return string @@ -176,7 +176,7 @@ class OC_Preview { public function getConfigMaxY(){ return $this->max_y; } - + /** * @brief deletes previews of a file with specific x and y * @return bool @@ -303,27 +303,27 @@ class OC_Preview { $this->preview = $image; }else{ $mimetype = $this->fileview->getMimeType($file); - + $preview; - + foreach(self::$providers as $supportedmimetype => $provider){ if(!preg_match($supportedmimetype, $mimetype)){ continue; } - + $preview = $provider->getThumbnail($file, $maxX, $maxY, $scalingup, $this->fileview); if(!$preview){ continue; } - + if(!($preview instanceof \OC_Image)){ $preview = @new \OC_Image($preview); } - + //cache thumbnail $preview->save($this->userview->getLocalFile(self::THUMBNAILS_FOLDER . '/' . $fileid . '/' . $maxX . '-' . $maxY . '.png')); - + break; } $this->preview = $preview; @@ -396,12 +396,12 @@ class OC_Preview { // resize $image->preciseResize($newXsize, $newYsize); - + if($newXsize === $x && $newYsize === $y){ $this->preview = $image; return; } - + if($newXsize >= $x && $newYsize >= $y){ $cropX = floor(abs($x - $newXsize) * 0.5); $cropY = floor(abs($y - $newYsize) * 0.5); @@ -411,38 +411,38 @@ class OC_Preview { $this->preview = $image; return; } - + if($newXsize < $x || $newYsize < $y){ if($newXsize > $x){ $cropX = floor(($newXsize - $x) * 0.5); $image->crop($cropX, 0, $x, $newYsize); } - + if($newYsize > $y){ $cropY = floor(($newYsize - $y) * 0.5); $image->crop(0, $cropY, $newXsize, $y); } - + $newXsize = (int) $image->width(); $newYsize = (int) $image->height(); - + //create transparent background layer $backgroundlayer = imagecreatetruecolor($x, $y); $white = imagecolorallocate($backgroundlayer, 255, 255, 255); imagefill($backgroundlayer, 0, 0, $white); - + $image = $image->resource(); - + $mergeX = floor(abs($x - $newXsize) * 0.5); $mergeY = floor(abs($y - $newYsize) * 0.5); - + imagecopy($backgroundlayer, $image, $mergeX, $mergeY, 0, 0, $newXsize, $newYsize); - + //$black = imagecolorallocate(0,0,0); //imagecolortransparent($transparentlayer, $black); - + $image = new \OC_Image($backgroundlayer); - + $this->preview = $image; return; } @@ -465,27 +465,27 @@ class OC_Preview { if(count(self::$providers)>0) { return; } - + foreach(self::$registeredProviders as $provider) { $class=$provider['class']; $options=$provider['options']; - + $object = new $class($options); - + self::$providers[$object->getMimeType()] = $object; } - + $keys = array_map('strlen', array_keys(self::$providers)); array_multisort($keys, SORT_DESC, self::$providers); } - + /** * @brief method that handles preview requests from users that are logged in * @return void */ public static function previewRouter($params){ OC_Util::checkLoggedIn(); - + $file = ''; $maxX = 0; $maxY = 0; @@ -494,12 +494,12 @@ class OC_Preview { * do not use ?scalingup=false / ?scalingup = true as these will always be true */ $scalingup = true; - + if(array_key_exists('file', $_GET)) $file = (string) urldecode($_GET['file']); if(array_key_exists('x', $_GET)) $maxX = (int) $_GET['x']; if(array_key_exists('y', $_GET)) $maxY = (int) $_GET['y']; if(array_key_exists('scalingup', $_GET)) $scalingup = (bool) $_GET['scalingup']; - + if($file !== '' && $maxX !== 0 && $maxY !== 0){ $preview = new OC_Preview(OC_User::getUser(), 'files', $file, $maxX, $maxY, $scalingup); $preview->showPreview(); @@ -508,7 +508,7 @@ class OC_Preview { exit; } } - + /** * @brief method that handles preview requests from users that are not logged in / view shared folders that are public * @return void @@ -519,23 +519,23 @@ class OC_Preview { $maxY = 0; $scalingup = true; $token = ''; - + $user = null; $path = null; - + if(array_key_exists('file', $_GET)) $file = (string) urldecode($_GET['file']); if(array_key_exists('x', $_GET)) $maxX = (int) $_GET['x']; if(array_key_exists('y', $_GET)) $maxY = (int) $_GET['y']; if(array_key_exists('scalingup', $_GET)) $scalingup = (bool) $_GET['scalingup']; if(array_key_exists('t', $_GET)) $token = (string) $_GET['t']; - + $linkItem = OCP\Share::getShareByToken($token); if (is_array($linkItem) && isset($linkItem['uid_owner']) && isset($linkItem['file_source'])) { $userid = $linkItem['uid_owner']; OC_Util::setupFS($fileOwner); $path = $linkItem['file_source']; } - + if($user !== null && $path !== null){ $preview = new OC_Preview($userid, $path, $file, $maxX, $maxY, $scalingup); $preview->showPreview(); @@ -543,6 +543,5 @@ class OC_Preview { OC_Response::setStatus(404); exit; } - } } \ No newline at end of file diff --git a/lib/preview/images.php b/lib/preview/images.php index 589c7d829d5..a0df337d58e 100644 --- a/lib/preview/images.php +++ b/lib/preview/images.php @@ -11,7 +11,7 @@ class OC_Preview_Image extends OC_Preview_Provider{ public function getMimeType(){ return '/image\/.*/'; } - + public function getThumbnail($path,$maxX,$maxY,$scalingup,$fileview) { //new image object $image = new \OC_Image(); diff --git a/lib/preview/movies.php b/lib/preview/movies.php index 868755a1205..8144956c998 100644 --- a/lib/preview/movies.php +++ b/lib/preview/movies.php @@ -12,18 +12,18 @@ if(!is_null(shell_exec('ffmpeg -version'))){ public function getMimeType(){ return '/video\/.*/'; } - + public function getThumbnail($path,$maxX,$maxY,$scalingup,$fileview) { $abspath = $fileview->getLocalfile($path); - + $tmppath = OC_Helper::tmpFile(); - + $cmd = 'ffmpeg -y -i ' . escapeshellarg($abspath) . ' -f mjpeg -vframes 1 -ss 1 -s ' . escapeshellarg($maxX) . 'x' . escapeshellarg($maxY) . ' ' . $tmppath; shell_exec($cmd); - + $image = new \OC_Image($tmppath); if (!$image->valid()) return false; - + return $image; } } diff --git a/lib/preview/mp3.php b/lib/preview/mp3.php index 5194e165818..6fb4b051f41 100644 --- a/lib/preview/mp3.php +++ b/lib/preview/mp3.php @@ -25,7 +25,7 @@ class OC_Preview_MP3 extends OC_Preview_Provider{ return $image; } - + public function getNoCoverThumbnail($maxX, $maxY){ $image = new \OC_Image(); return $image; diff --git a/lib/preview/pdf.php b/lib/preview/pdf.php index f1b7f3eee73..bf1d8b2b3b5 100644 --- a/lib/preview/pdf.php +++ b/lib/preview/pdf.php @@ -15,7 +15,7 @@ class OC_Preview_PDF extends OC_Preview_Provider{ //create imagick object from pdf $pdf = new imagick($fileview->getLocalFile($path) . '[0]'); $pdf->setImageFormat('jpg'); - + //new image object $image = new \OC_Image($pdf); //check if image object is valid diff --git a/lib/preview/provider.php b/lib/preview/provider.php index e9264030144..2f2a0e68486 100644 --- a/lib/preview/provider.php +++ b/lib/preview/provider.php @@ -8,7 +8,7 @@ abstract class OC_Preview_Provider{ public function __construct($options) { $this->options=$options; } - + abstract public function getMimeType(); /** diff --git a/lib/preview/unknown.php b/lib/preview/unknown.php index 746b0ebb47a..290c18a72d7 100644 --- a/lib/preview/unknown.php +++ b/lib/preview/unknown.php @@ -12,23 +12,12 @@ class OC_Preview_Unknown extends OC_Preview_Provider{ return '/.*/'; } - public function getThumbnail($path, $maxX, $maxY, $scalingup,$fileview) { - // check if GD is installed - if(!extension_loaded('gd') || !function_exists('gd_info')) { - OC_Log::write('preview', __METHOD__.'(): GD module not installed', OC_Log::ERROR); - return false; - } - - // create a white image - $image = imagecreatetruecolor($maxX, $maxY); - $color = imagecolorallocate($image, 255, 255, 255); - imagefill($image, 0, 0, $color); - - // output the image - imagepng($image); - imagedestroy($image); - } + public function getThumbnail($path, $maxX, $maxY, $scalingup,$fileview) { + + $mimetype = $this->fileview->getMimeType($file); + return new \OC_Image(); + } } OC_Preview::registerProvider('OC_Preview_Unknown'); \ No newline at end of file From 13c6ef1ba9c3f857150679d164852d8724ab946f Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Tue, 21 May 2013 12:23:31 +0200 Subject: [PATCH 015/170] add svg backend --- lib/preview.php | 1 + lib/preview/svg.php | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 lib/preview/svg.php diff --git a/lib/preview.php b/lib/preview.php index d6c72603524..572c85057be 100755 --- a/lib/preview.php +++ b/lib/preview.php @@ -15,6 +15,7 @@ require_once('preview/images.php'); require_once('preview/movies.php'); require_once('preview/mp3.php'); require_once('preview/pdf.php'); +require_once('preview/svg.php'); require_once('preview/unknown.php'); class OC_Preview { diff --git a/lib/preview/svg.php b/lib/preview/svg.php new file mode 100644 index 00000000000..12b93f696ea --- /dev/null +++ b/lib/preview/svg.php @@ -0,0 +1,28 @@ +readImageBlob($fileview->file_get_contents($path)); + $svg->setImageFormat('jpg'); + + //new image object + $image = new \OC_Image($svg); + //check if image object is valid + if (!$image->valid()) return false; + + return $image; + } +} + +OC_Preview::registerProvider('OC_Preview_SVG'); \ No newline at end of file From 00985068ca249f4087f9f5b634e628afb8e8f7b1 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Wed, 22 May 2013 15:12:25 +0200 Subject: [PATCH 016/170] add previews for public files --- core/routes.php | 2 ++ lib/preview.php | 24 +++++++++++++++++++----- lib/preview/unknown.php | 10 ++++++---- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/core/routes.php b/core/routes.php index be5766cea9d..c45ffee26fd 100644 --- a/core/routes.php +++ b/core/routes.php @@ -44,6 +44,8 @@ $this->create('core_ajax_routes', '/core/routes.json') ->action('OC_Router', 'JSRoutes'); $this->create('core_ajax_preview', '/core/preview.png') ->action('OC_Preview', 'previewRouter'); +$this->create('core_ajax_public_preview', '/core/publicpreview.png') + ->action('OC_Preview', 'publicPreviewRouter'); OC::$CLASSPATH['OC_Core_LostPassword_Controller'] = 'core/lostpassword/controller.php'; $this->create('core_lostpassword_index', '/lostpassword/') ->get() diff --git a/lib/preview.php b/lib/preview.php index 572c85057be..39a87ed5396 100755 --- a/lib/preview.php +++ b/lib/preview.php @@ -529,16 +529,30 @@ class OC_Preview { if(array_key_exists('y', $_GET)) $maxY = (int) $_GET['y']; if(array_key_exists('scalingup', $_GET)) $scalingup = (bool) $_GET['scalingup']; if(array_key_exists('t', $_GET)) $token = (string) $_GET['t']; - + $linkItem = OCP\Share::getShareByToken($token); + if (is_array($linkItem) && isset($linkItem['uid_owner']) && isset($linkItem['file_source'])) { $userid = $linkItem['uid_owner']; - OC_Util::setupFS($fileOwner); - $path = $linkItem['file_source']; + OC_Util::setupFS($userid); + $pathid = $linkItem['file_source']; + $path = \OC\Files\Filesystem::getPath($pathid); + } + + //clean up file parameter + $file = \OC\Files\Filesystem::normalizePath($file); + if(!\OC\Files\Filesystem::isValidPath($file)){ + OC_Response::setStatus(403); + exit; } - if($user !== null && $path !== null){ - $preview = new OC_Preview($userid, $path, $file, $maxX, $maxY, $scalingup); + $path = \OC\Files\Filesystem::normalizePath($path, false); + if(substr($path, 0, 1) == '/'){ + $path = substr($path, 1); + } + + if($userid !== null && $path !== null){ + $preview = new OC_Preview($userid, 'files/' . $path, $file, $maxX, $maxY, $scalingup); $preview->showPreview(); }else{ OC_Response::setStatus(404); diff --git a/lib/preview/unknown.php b/lib/preview/unknown.php index 290c18a72d7..5bbdcf847f1 100644 --- a/lib/preview/unknown.php +++ b/lib/preview/unknown.php @@ -13,11 +13,13 @@ class OC_Preview_Unknown extends OC_Preview_Provider{ } public function getThumbnail($path, $maxX, $maxY, $scalingup,$fileview) { - - - $mimetype = $this->fileview->getMimeType($file); + /*$mimetype = $fileview->getMimeType($path); + $info = $fileview->getFileInfo($path); + $name = array_key_exists('name', $info) ? $info['name'] : ''; + $size = array_key_exists('size', $info) ? $info['size'] : 0; + $isencrypted = array_key_exists('encrypted', $info) ? $info['encrypted'] : false;*/ // show little lock return new \OC_Image(); } } -OC_Preview::registerProvider('OC_Preview_Unknown'); \ No newline at end of file +OC_Preview::registerProvider('OC_Preview_Unknown'); From 1bed3253abfc627a6dd698fc62a617285c1d7c84 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Sat, 25 May 2013 11:05:37 +0200 Subject: [PATCH 017/170] add sample config for previews --- config/config.sample.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/config/config.sample.php b/config/config.sample.php index 72834009201..db6eaf852af 100644 --- a/config/config.sample.php +++ b/config/config.sample.php @@ -183,4 +183,12 @@ $CONFIG = array( 'customclient_desktop' => '', //http://owncloud.org/sync-clients/ 'customclient_android' => '', //https://play.google.com/store/apps/details?id=com.owncloud.android 'customclient_ios' => '' //https://itunes.apple.com/us/app/owncloud/id543672169?mt=8 + +// PREVIEW +/* the max width of a generated preview, if value is null, there is no limit */ +'preview_max_x' => null, +/* the max height of a generated preview, if value is null, there is no limit */ +'preview_max_y' => null, +/* the max factor to scale a preview, default is set to 10 */ +'preview_max_scale_factor' => 10, ); From f78e00209692d28253b91a432eb02d432c96a695 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Mon, 27 May 2013 10:45:21 +0200 Subject: [PATCH 018/170] make image preview backend work with encryption --- lib/preview/images.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/preview/images.php b/lib/preview/images.php index a0df337d58e..52aad67ca8b 100644 --- a/lib/preview/images.php +++ b/lib/preview/images.php @@ -14,11 +14,10 @@ class OC_Preview_Image extends OC_Preview_Provider{ public function getThumbnail($path,$maxX,$maxY,$scalingup,$fileview) { //new image object - $image = new \OC_Image(); - $image->loadFromFile($fileview->getLocalFile($path)); + $image = new \OC_Image($fileview->fopen($path, 'r')); //check if image object is valid if (!$image->valid()) return false; - + return $image; } } From 62411965f9ccfbe66584e91bc325d156e08196d2 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Mon, 27 May 2013 11:09:55 +0200 Subject: [PATCH 019/170] make svg preview backend work with encryption --- lib/preview/svg.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/preview/svg.php b/lib/preview/svg.php index 12b93f696ea..8f4697dce04 100644 --- a/lib/preview/svg.php +++ b/lib/preview/svg.php @@ -13,7 +13,8 @@ class OC_Preview_SVG extends OC_Preview_Provider{ public function getThumbnail($path,$maxX,$maxY,$scalingup,$fileview) { $svg = new Imagick(); - $svg->readImageBlob($fileview->file_get_contents($path)); + $svg->setResolution($maxX, $maxY); + $svg->readImageBlob('' . $fileview->file_get_contents($path)); $svg->setImageFormat('jpg'); //new image object From 005d8e98706fc98d8dc5aa4927bb3ab0e6b00ac2 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Tue, 28 May 2013 10:21:02 +0200 Subject: [PATCH 020/170] update images.php --- lib/preview/images.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/preview/images.php b/lib/preview/images.php index 52aad67ca8b..a8f203528c5 100644 --- a/lib/preview/images.php +++ b/lib/preview/images.php @@ -13,11 +13,20 @@ class OC_Preview_Image extends OC_Preview_Provider{ } public function getThumbnail($path,$maxX,$maxY,$scalingup,$fileview) { - //new image object - $image = new \OC_Image($fileview->fopen($path, 'r')); + //get fileinfo + $fileinfo = $fileview->getFileInfo($path); + + //check if file is encrypted + if($fileinfo['encrypted'] === true){ + $image = new \OC_Image($fileview->fopen($path, 'r')); + }else{ + $image = new \OC_Image(); + $image->loadFromFile($fileview->getLocalFile($path)); + } + //check if image object is valid if (!$image->valid()) return false; - + return $image; } } From 707f52f1dbb063595541331f94b3796f0f96ce9a Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Tue, 28 May 2013 10:23:40 +0200 Subject: [PATCH 021/170] check if the imagick extension is loaded --- lib/preview/svg.php | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/lib/preview/svg.php b/lib/preview/svg.php index 8f4697dce04..415b7751c2b 100644 --- a/lib/preview/svg.php +++ b/lib/preview/svg.php @@ -5,25 +5,29 @@ * later. * See the COPYING-README file. */ -class OC_Preview_SVG extends OC_Preview_Provider{ +if (extension_loaded('imagick')){ - public function getMimeType(){ - return '/image\/svg\+xml/'; + class OC_Preview_SVG extends OC_Preview_Provider{ + + public function getMimeType(){ + return '/image\/svg\+xml/'; + } + + public function getThumbnail($path,$maxX,$maxY,$scalingup,$fileview) { + $svg = new Imagick(); + $svg->setResolution($maxX, $maxY); + $svg->readImageBlob('' . $fileview->file_get_contents($path)); + $svg->setImageFormat('jpg'); + + //new image object + $image = new \OC_Image($svg); + //check if image object is valid + if (!$image->valid()) return false; + + return $image; + } } - public function getThumbnail($path,$maxX,$maxY,$scalingup,$fileview) { - $svg = new Imagick(); - $svg->setResolution($maxX, $maxY); - $svg->readImageBlob('' . $fileview->file_get_contents($path)); - $svg->setImageFormat('jpg'); + OC_Preview::registerProvider('OC_Preview_SVG'); - //new image object - $image = new \OC_Image($svg); - //check if image object is valid - if (!$image->valid()) return false; - - return $image; - } -} - -OC_Preview::registerProvider('OC_Preview_SVG'); \ No newline at end of file +} \ No newline at end of file From 5ae1333c76fd1331e21fff0fc7343888c473c8d4 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Tue, 28 May 2013 11:29:01 +0200 Subject: [PATCH 022/170] add preview backend for text based files --- lib/preview/txt.php | 49 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 lib/preview/txt.php diff --git a/lib/preview/txt.php b/lib/preview/txt.php new file mode 100644 index 00000000000..2b5d8edb893 --- /dev/null +++ b/lib/preview/txt.php @@ -0,0 +1,49 @@ +fopen($path, 'r'); + $content = stream_get_contents($content); + + $lines = preg_split("/\r\n|\n|\r/", $content); + $numoflines = count($lines); + + $fontsize = 5; //5px + $linesize = ceil($fontsize * 1.25); + + $image = imagecreate($maxX, $maxY); + $imagecolor = imagecolorallocate($image, 255, 255, 255); + $textcolor = imagecolorallocate($image, 0, 0, 0); + + foreach($lines as $index => $line){ + $index = $index + 1; + + $x = (int) 1; + $y = (int) ($index * $linesize) - $fontsize; + + imagestring($image, 1, $x, $y, $line, $textcolor); + + if(($index * $linesize) >= $maxY){ + break; + } + } + + $image = new \OC_Image($image); + + if (!$image->valid()) return false; + + return $image; + } +} + +OC_Preview::registerProvider('OC_Preview_TXT'); \ No newline at end of file From 7555332d58c6e684cfbde72d5676e8e1902ae4f3 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Tue, 28 May 2013 11:31:48 +0200 Subject: [PATCH 023/170] remove whitespace --- lib/preview/txt.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/preview/txt.php b/lib/preview/txt.php index 2b5d8edb893..1e88aec69fd 100644 --- a/lib/preview/txt.php +++ b/lib/preview/txt.php @@ -39,7 +39,7 @@ class OC_Preview_TXT extends OC_Preview_Provider{ } $image = new \OC_Image($image); - + if (!$image->valid()) return false; return $image; From 4d52dfb0a0517a7fd52d20572085aba2ec0e4ad0 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Tue, 28 May 2013 11:48:02 +0200 Subject: [PATCH 024/170] make movie backend work with encryption --- lib/preview/movies.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/preview/movies.php b/lib/preview/movies.php index 8144956c998..1e517b38182 100644 --- a/lib/preview/movies.php +++ b/lib/preview/movies.php @@ -14,18 +14,25 @@ if(!is_null(shell_exec('ffmpeg -version'))){ } public function getThumbnail($path,$maxX,$maxY,$scalingup,$fileview) { - $abspath = $fileview->getLocalfile($path); + //get fileinfo + $fileinfo = $fileview->getFileInfo($path); + $abspath = $fileview->toTmpFile($path); $tmppath = OC_Helper::tmpFile(); $cmd = 'ffmpeg -y -i ' . escapeshellarg($abspath) . ' -f mjpeg -vframes 1 -ss 1 -s ' . escapeshellarg($maxX) . 'x' . escapeshellarg($maxY) . ' ' . $tmppath; shell_exec($cmd); + unlink($abspath); + $image = new \OC_Image($tmppath); if (!$image->valid()) return false; + unlink($tmppath); + return $image; } } + OC_Preview::registerProvider('OC_Preview_Movie'); } \ No newline at end of file From 738cc48a85f48f8dca2b42d5667d6662810a688b Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Tue, 28 May 2013 11:49:18 +0200 Subject: [PATCH 025/170] make mp3 backend work with encryption --- lib/preview/mp3.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/preview/mp3.php b/lib/preview/mp3.php index 6fb4b051f41..18f5cfde375 100644 --- a/lib/preview/mp3.php +++ b/lib/preview/mp3.php @@ -14,15 +14,20 @@ class OC_Preview_MP3 extends OC_Preview_Provider{ } public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) { - $getID3 = new getID3(); + $getID3 = new getID3(); + + $tmppath = $fileview->toTmpFile($path); + //Todo - add stream support - $tags = $getID3->analyze($fileview->getLocalFile($path)); + $tags = $getID3->analyze($tmppath); getid3_lib::CopyTagsToComments($tags); $picture = @$tags['id3v2']['APIC'][0]['data']; - + + unlink($tmppath); + $image = new \OC_Image($picture); if (!$image->valid()) return $this->getNoCoverThumbnail($maxX, $maxY); - + return $image; } From 55b00fe819079d78224989eee91d5886233738ab Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Tue, 28 May 2013 11:59:20 +0200 Subject: [PATCH 026/170] make pdf backend work with encryption --- lib/preview/pdf.php | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/lib/preview/pdf.php b/lib/preview/pdf.php index bf1d8b2b3b5..de5263f91d8 100644 --- a/lib/preview/pdf.php +++ b/lib/preview/pdf.php @@ -5,24 +5,31 @@ * later. * See the COPYING-README file. */ -class OC_Preview_PDF extends OC_Preview_Provider{ +if (extension_loaded('imagick')){ - public function getMimeType(){ - return '/application\/pdf/'; + class OC_Preview_PDF extends OC_Preview_Provider{ + + public function getMimeType(){ + return '/application\/pdf/'; + } + + public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) { + $tmppath = $fileview->toTmpFile($path); + + //create imagick object from pdf + $pdf = new imagick($tmppath . '[0]'); + $pdf->setImageFormat('jpg'); + + unlink($tmppath); + + //new image object + $image = new \OC_Image($pdf); + //check if image object is valid + if (!$image->valid()) return false; + + return $image; + } } - public function getThumbnail($path, $maxX, $maxY, $scalingup,$fileview) { - //create imagick object from pdf - $pdf = new imagick($fileview->getLocalFile($path) . '[0]'); - $pdf->setImageFormat('jpg'); - - //new image object - $image = new \OC_Image($pdf); - //check if image object is valid - if (!$image->valid()) return false; - - return $image; - } + OC_Preview::registerProvider('OC_Preview_PDF'); } - -OC_Preview::registerProvider('OC_Preview_PDF'); \ No newline at end of file From 08a022aaa48a6bae95ff75204a763a7c16a8253e Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Tue, 28 May 2013 12:09:46 +0200 Subject: [PATCH 027/170] don't give ffmpeg wanted size, cause it doesn't care about aspect ratio --- lib/preview/movies.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/preview/movies.php b/lib/preview/movies.php index 1e517b38182..d2aaf730d67 100644 --- a/lib/preview/movies.php +++ b/lib/preview/movies.php @@ -20,7 +20,8 @@ if(!is_null(shell_exec('ffmpeg -version'))){ $abspath = $fileview->toTmpFile($path); $tmppath = OC_Helper::tmpFile(); - $cmd = 'ffmpeg -y -i ' . escapeshellarg($abspath) . ' -f mjpeg -vframes 1 -ss 1 -s ' . escapeshellarg($maxX) . 'x' . escapeshellarg($maxY) . ' ' . $tmppath; + //$cmd = 'ffmpeg -y -i ' . escapeshellarg($abspath) . ' -f mjpeg -vframes 1 -ss 1 -s ' . escapeshellarg($maxX) . 'x' . escapeshellarg($maxY) . ' ' . $tmppath; + $cmd = 'ffmpeg -y -i ' . escapeshellarg($abspath) . ' -f mjpeg -vframes 1 -ss 1 ' . $tmppath; shell_exec($cmd); unlink($abspath); From a03787bc422563d129359d34673eb361b0173f51 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Tue, 28 May 2013 16:04:39 +0200 Subject: [PATCH 028/170] make preview cache work with encryption and improve error handling --- lib/preview.php | 40 +++++++++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/lib/preview.php b/lib/preview.php index 39a87ed5396..6fc166b9c70 100755 --- a/lib/preview.php +++ b/lib/preview.php @@ -16,6 +16,7 @@ require_once('preview/movies.php'); require_once('preview/mp3.php'); require_once('preview/pdf.php'); require_once('preview/svg.php'); +require_once('preview/txt.php'); require_once('preview/unknown.php'); class OC_Preview { @@ -300,7 +301,7 @@ class OC_Preview { $cached = self::isCached(); if($cached){ - $image = new \OC_Image($this->userview->getLocalFile($cached)); + $image = new \OC_Image($this->userview->file_get_contents($cached, 'r')); $this->preview = $image; }else{ $mimetype = $this->fileview->getMimeType($file); @@ -313,17 +314,22 @@ class OC_Preview { } $preview = $provider->getThumbnail($file, $maxX, $maxY, $scalingup, $this->fileview); - + if(!$preview){ continue; } - if(!($preview instanceof \OC_Image)){ - $preview = @new \OC_Image($preview); + //are there any cached thumbnails yet + if($this->userview->is_dir(self::THUMBNAILS_FOLDER . '/') === false){ + $this->userview->mkdir(self::THUMBNAILS_FOLDER . '/'); } //cache thumbnail - $preview->save($this->userview->getLocalFile(self::THUMBNAILS_FOLDER . '/' . $fileid . '/' . $maxX . '-' . $maxY . '.png')); + $cachepath = self::THUMBNAILS_FOLDER . '/' . $fileid . '/' . $maxX . '-' . $maxY . '.png'; + if($this->userview->is_dir(self::THUMBNAILS_FOLDER . '/' . $fileid . '/') === false){ + $this->userview->mkdir(self::THUMBNAILS_FOLDER . '/' . $fileid . '/'); + } + $this->userview->file_put_contents($cachepath, $preview->data()); break; } @@ -354,13 +360,13 @@ class OC_Preview { * @return image */ public function resizeAndCrop(){ + $this->preview->fixOrientation(); + $image = $this->preview; $x = $this->maxX; $y = $this->maxY; $scalingup = $this->scalingup; - $image->fixOrientation(); - if(!($image instanceof \OC_Image)){ OC_Log::write('core', 'Object passed to resizeAndCrop is not an instance of OC_Image', OC_Log::DEBUG); return; @@ -502,8 +508,14 @@ class OC_Preview { if(array_key_exists('scalingup', $_GET)) $scalingup = (bool) $_GET['scalingup']; if($file !== '' && $maxX !== 0 && $maxY !== 0){ - $preview = new OC_Preview(OC_User::getUser(), 'files', $file, $maxX, $maxY, $scalingup); - $preview->showPreview(); + try{ + $preview = new OC_Preview(OC_User::getUser(), 'files', $file, $maxX, $maxY, $scalingup); + $preview->showPreview(); + }catch(Exception $e){ + OC_Response::setStatus(404); + OC_Log::write('core', $e->getmessage(), OC_Log::ERROR); + exit; + } }else{ OC_Response::setStatus(404); exit; @@ -552,8 +564,14 @@ class OC_Preview { } if($userid !== null && $path !== null){ - $preview = new OC_Preview($userid, 'files/' . $path, $file, $maxX, $maxY, $scalingup); - $preview->showPreview(); + try{ + $preview = new OC_Preview($userid, 'files/' . $path, $file, $maxX, $maxY, $scalingup); + $preview->showPreview(); + }catch(Exception $e){ + OC_Response::setStatus(404); + OC_Log::write('core', $e->getmessage(), OC_Log::ERROR); + exit; + } }else{ OC_Response::setStatus(404); exit; From eebc15dce0da88dff91dc5249938341cd50b8a85 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Wed, 29 May 2013 12:01:43 +0200 Subject: [PATCH 029/170] connect preview lib to filesystem hooks --- lib/base.php | 9 ++++ lib/preview.php | 106 ++++++++++++++++++++++++++++-------------------- 2 files changed, 71 insertions(+), 44 deletions(-) diff --git a/lib/base.php b/lib/base.php index 724bd250a5c..ae384225bed 100644 --- a/lib/base.php +++ b/lib/base.php @@ -474,6 +474,7 @@ class OC { self::registerCacheHooks(); self::registerFilesystemHooks(); + self::registerPreviewHooks(); self::registerShareHooks(); //make sure temporary files are cleaned up @@ -539,6 +540,14 @@ class OC { OC_Hook::connect('OC_Filesystem', 'rename', 'OC_Filesystem', 'isBlacklisted'); } + /** + * register hooks for previews + */ + public static function registerPreviewHooks() { + OC_Hook::connect('OC_Filesystem', 'post_write', 'OC_Preview', 'post_write'); + OC_Hook::connect('OC_Filesystem', 'delete', 'OC_Preview', 'post_delete'); + } + /** * register hooks for sharing */ diff --git a/lib/preview.php b/lib/preview.php index 6fc166b9c70..7c4db971dfb 100755 --- a/lib/preview.php +++ b/lib/preview.php @@ -55,7 +55,7 @@ class OC_Preview { * false if thumbnail does not exist * path to thumbnail if thumbnail exists */ - public function __construct($user = null, $root = '', $file = '', $maxX = 0, $maxY = 0, $scalingup = true){ + public function __construct($user = null, $root = '', $file = '', $maxX = 0, $maxY = 0, $scalingup = true, $force = false){ //set config $this->max_x = OC_Config::getValue('preview_max_x', null); $this->max_y = OC_Config::getValue('preview_max_y', null); @@ -71,47 +71,49 @@ class OC_Preview { $this->fileview = new \OC\Files\View('/' . $user . '/' . $root); $this->userview = new \OC\Files\View('/' . $user); - if(!is_null($this->max_x)){ - if($this->maxX > $this->max_x){ - OC_Log::write('core', 'maxX reduced from ' . $this->maxX . ' to ' . $this->max_x, OC_Log::DEBUG); - $this->maxX = $this->max_x; + if($force !== true){ + if(!is_null($this->max_x)){ + if($this->maxX > $this->max_x){ + OC_Log::write('core', 'maxX reduced from ' . $this->maxX . ' to ' . $this->max_x, OC_Log::DEBUG); + $this->maxX = $this->max_x; + } } - } - - if(!is_null($this->max_y)){ - if($this->maxY > $this->max_y){ - OC_Log::write('core', 'maxY reduced from ' . $this->maxY . ' to ' . $this->max_y, OC_Log::DEBUG); - $this->maxY = $this->max_y; + + if(!is_null($this->max_y)){ + if($this->maxY > $this->max_y){ + OC_Log::write('core', 'maxY reduced from ' . $this->maxY . ' to ' . $this->max_y, OC_Log::DEBUG); + $this->maxY = $this->max_y; + } + } + + //init providers + if(empty(self::$providers)){ + self::initProviders(); + } + + //check if there are any providers at all + if(empty(self::$providers)){ + OC_Log::write('core', 'No preview providers exist', OC_Log::ERROR); + throw new Exception('No providers'); + } + + //validate parameters + if($file === ''){ + OC_Log::write('core', 'No filename passed', OC_Log::ERROR); + throw new Exception('File not found'); + } + + //check if file exists + if(!$this->fileview->file_exists($file)){ + OC_Log::write('core', 'File:"' . $file . '" not found', OC_Log::ERROR); + throw new Exception('File not found'); + } + + //check if given size makes sense + if($maxX === 0 || $maxY === 0){ + OC_Log::write('core', 'Can not create preview with 0px width or 0px height', OC_Log::ERROR); + throw new Exception('Height and/or width set to 0'); } - } - - //init providers - if(empty(self::$providers)){ - self::initProviders(); - } - - //check if there are any providers at all - if(empty(self::$providers)){ - OC_Log::write('core', 'No preview providers exist', OC_Log::ERROR); - throw new Exception('No providers'); - } - - //validate parameters - if($file === ''){ - OC_Log::write('core', 'No filename passed', OC_Log::ERROR); - throw new Exception('File not found'); - } - - //check if file exists - if(!$this->fileview->file_exists($file)){ - OC_Log::write('core', 'File:"' . $file . '" not found', OC_Log::ERROR); - throw new Exception('File not found'); - } - - //check if given size makes sense - if($maxX === 0 || $maxY === 0){ - OC_Log::write('core', 'Can not create preview with 0px width or 0px height', OC_Log::ERROR); - throw new Exception('Height and/or width set to 0'); } } @@ -186,19 +188,22 @@ class OC_Preview { public function deletePreview(){ $fileinfo = $this->fileview->getFileInfo($this->file); $fileid = $fileinfo['fileid']; - - return $this->userview->unlink(self::THUMBNAILS_FOLDER . '/' . $fileid . '/' . $this->maxX . '-' . $this->maxY . '.png'); + + $this->userview->unlink(self::THUMBNAILS_FOLDER . '/' . $fileid . '/' . $this->maxX . '-' . $this->maxY . '.png'); + return; } /** * @brief deletes all previews of a file * @return bool */ - public function deleteAllPrevies(){ + public function deleteAllPreviews(){ $fileinfo = $this->fileview->getFileInfo($this->file); $fileid = $fileinfo['fileid']; - return $this->userview->rmdir(self::THUMBNAILS_FOLDER . '/' . $fileid); + $this->userview->deleteAll(self::THUMBNAILS_FOLDER . '/' . $fileid . '/'); + $this->userview->rmdir(self::THUMBNAILS_FOLDER . '/' . $fileid . '/'); + return; } /** @@ -577,4 +582,17 @@ class OC_Preview { exit; } } + + public static function post_write($args){ + self::post_delete($args); + } + + public static function post_delete($args){ + $path = $args['path']; + if(substr($path, 0, 1) == '/'){ + $path = substr($path, 1); + } + $preview = new OC_Preview(OC_User::getUser(), 'files/', $path, 0, 0, false, true); + $preview->deleteAllPreviews(); + } } \ No newline at end of file From fa6b96090abc341da4f9320af02ee75b29a204e6 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Wed, 29 May 2013 12:33:24 +0200 Subject: [PATCH 030/170] move to OC namespace --- core/routes.php | 4 +-- lib/base.php | 4 +-- lib/preview.php | 64 +++++++++++++++++++++------------------- lib/preview/images.php | 6 ++-- lib/preview/movies.php | 8 +++-- lib/preview/mp3.php | 10 ++++--- lib/preview/pdf.php | 8 +++-- lib/preview/provider.php | 4 ++- lib/preview/svg.php | 16 +++++++--- lib/preview/txt.php | 6 ++-- lib/preview/unknown.php | 6 ++-- 11 files changed, 80 insertions(+), 56 deletions(-) diff --git a/core/routes.php b/core/routes.php index c45ffee26fd..4b3ad53da01 100644 --- a/core/routes.php +++ b/core/routes.php @@ -43,9 +43,9 @@ $this->create('js_config', '/core/js/config.js') $this->create('core_ajax_routes', '/core/routes.json') ->action('OC_Router', 'JSRoutes'); $this->create('core_ajax_preview', '/core/preview.png') - ->action('OC_Preview', 'previewRouter'); + ->action('OC\Preview', 'previewRouter'); $this->create('core_ajax_public_preview', '/core/publicpreview.png') - ->action('OC_Preview', 'publicPreviewRouter'); + ->action('OC\Preview', 'publicPreviewRouter'); OC::$CLASSPATH['OC_Core_LostPassword_Controller'] = 'core/lostpassword/controller.php'; $this->create('core_lostpassword_index', '/lostpassword/') ->get() diff --git a/lib/base.php b/lib/base.php index ae384225bed..525b259f673 100644 --- a/lib/base.php +++ b/lib/base.php @@ -544,8 +544,8 @@ class OC { * register hooks for previews */ public static function registerPreviewHooks() { - OC_Hook::connect('OC_Filesystem', 'post_write', 'OC_Preview', 'post_write'); - OC_Hook::connect('OC_Filesystem', 'delete', 'OC_Preview', 'post_delete'); + OC_Hook::connect('OC_Filesystem', 'post_write', 'OC\Preview', 'post_write'); + OC_Hook::connect('OC_Filesystem', 'delete', 'OC\Preview', 'post_delete'); } /** diff --git a/lib/preview.php b/lib/preview.php index 7c4db971dfb..31812035c49 100755 --- a/lib/preview.php +++ b/lib/preview.php @@ -11,6 +11,8 @@ * /data/user/thumbnails/pathhash/x-y.png * */ +namespace OC; + require_once('preview/images.php'); require_once('preview/movies.php'); require_once('preview/mp3.php'); @@ -19,7 +21,7 @@ require_once('preview/svg.php'); require_once('preview/txt.php'); require_once('preview/unknown.php'); -class OC_Preview { +class Preview { //the thumbnail folder const THUMBNAILS_FOLDER = 'thumbnails'; @@ -57,9 +59,9 @@ class OC_Preview { */ public function __construct($user = null, $root = '', $file = '', $maxX = 0, $maxY = 0, $scalingup = true, $force = false){ //set config - $this->max_x = OC_Config::getValue('preview_max_x', null); - $this->max_y = OC_Config::getValue('preview_max_y', null); - $this->max_scale_factor = OC_Config::getValue('preview_max_scale_factor', 10); + $this->max_x = \OC_Config::getValue('preview_max_x', null); + $this->max_y = \OC_Config::getValue('preview_max_y', null); + $this->max_scale_factor = \OC_Config::getValue('preview_max_scale_factor', 10); //save parameters $this->file = $file; @@ -74,14 +76,14 @@ class OC_Preview { if($force !== true){ if(!is_null($this->max_x)){ if($this->maxX > $this->max_x){ - OC_Log::write('core', 'maxX reduced from ' . $this->maxX . ' to ' . $this->max_x, OC_Log::DEBUG); + \OC_Log::write('core', 'maxX reduced from ' . $this->maxX . ' to ' . $this->max_x, \OC_Log::DEBUG); $this->maxX = $this->max_x; } } if(!is_null($this->max_y)){ if($this->maxY > $this->max_y){ - OC_Log::write('core', 'maxY reduced from ' . $this->maxY . ' to ' . $this->max_y, OC_Log::DEBUG); + \OC_Log::write('core', 'maxY reduced from ' . $this->maxY . ' to ' . $this->max_y, \OC_Log::DEBUG); $this->maxY = $this->max_y; } } @@ -93,26 +95,26 @@ class OC_Preview { //check if there are any providers at all if(empty(self::$providers)){ - OC_Log::write('core', 'No preview providers exist', OC_Log::ERROR); - throw new Exception('No providers'); + \OC_Log::write('core', 'No preview providers exist', \OC_Log::ERROR); + throw new \Exception('No providers'); } //validate parameters if($file === ''){ - OC_Log::write('core', 'No filename passed', OC_Log::ERROR); - throw new Exception('File not found'); + \OC_Log::write('core', 'No filename passed', \OC_Log::ERROR); + throw new \Exception('File not found'); } //check if file exists if(!$this->fileview->file_exists($file)){ - OC_Log::write('core', 'File:"' . $file . '" not found', OC_Log::ERROR); - throw new Exception('File not found'); + \OC_Log::write('core', 'File:"' . $file . '" not found', \OC_Log::ERROR); + throw new \Exception('File not found'); } //check if given size makes sense if($maxX === 0 || $maxY === 0){ - OC_Log::write('core', 'Can not create preview with 0px width or 0px height', OC_Log::ERROR); - throw new Exception('Height and/or width set to 0'); + \OC_Log::write('core', 'Can not create preview with 0px width or 0px height', \OC_Log::ERROR); + throw new \Exception('Height and/or width set to 0'); } } } @@ -353,7 +355,7 @@ class OC_Preview { * @return void */ public function showPreview(){ - OCP\Response::enableCaching(3600 * 24); // 24 hour + \OCP\Response::enableCaching(3600 * 24); // 24 hour $preview = $this->getPreview(); if($preview){ $preview->show(); @@ -373,7 +375,7 @@ class OC_Preview { $scalingup = $this->scalingup; if(!($image instanceof \OC_Image)){ - OC_Log::write('core', 'Object passed to resizeAndCrop is not an instance of OC_Image', OC_Log::DEBUG); + OC_Log::write('core', 'Object passed to resizeAndCrop is not an instance of OC_Image', \OC_Log::DEBUG); return; } @@ -399,7 +401,7 @@ class OC_Preview { } if(!is_null($this->max_scale_factor)){ if($factor > $this->max_scale_factor){ - OC_Log::write('core', 'scalefactor reduced from ' . $factor . ' to ' . $this->max_scale_factor, OC_Log::DEBUG); + \OC_Log::write('core', 'scalefactor reduced from ' . $factor . ' to ' . $this->max_scale_factor, \OC_Log::DEBUG); $factor = $this->max_scale_factor; } } @@ -462,7 +464,7 @@ class OC_Preview { /** * @brief register a new preview provider to be used - * @param string $provider class name of a OC_Preview_Provider + * @param string $provider class name of a Preview_Provider * @return void */ public static function registerProvider($class, $options=array()){ @@ -496,7 +498,7 @@ class OC_Preview { * @return void */ public static function previewRouter($params){ - OC_Util::checkLoggedIn(); + \OC_Util::checkLoggedIn(); $file = ''; $maxX = 0; @@ -514,15 +516,15 @@ class OC_Preview { if($file !== '' && $maxX !== 0 && $maxY !== 0){ try{ - $preview = new OC_Preview(OC_User::getUser(), 'files', $file, $maxX, $maxY, $scalingup); + $preview = new Preview(\OC_User::getUser(), 'files', $file, $maxX, $maxY, $scalingup); $preview->showPreview(); }catch(Exception $e){ - OC_Response::setStatus(404); - OC_Log::write('core', $e->getmessage(), OC_Log::ERROR); + \OC_Response::setStatus(404); + \OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR); exit; } }else{ - OC_Response::setStatus(404); + \OC_Response::setStatus(404); exit; } } @@ -547,11 +549,11 @@ class OC_Preview { if(array_key_exists('scalingup', $_GET)) $scalingup = (bool) $_GET['scalingup']; if(array_key_exists('t', $_GET)) $token = (string) $_GET['t']; - $linkItem = OCP\Share::getShareByToken($token); + $linkItem = \OCP\Share::getShareByToken($token); if (is_array($linkItem) && isset($linkItem['uid_owner']) && isset($linkItem['file_source'])) { $userid = $linkItem['uid_owner']; - OC_Util::setupFS($userid); + \OC_Util::setupFS($userid); $pathid = $linkItem['file_source']; $path = \OC\Files\Filesystem::getPath($pathid); } @@ -559,7 +561,7 @@ class OC_Preview { //clean up file parameter $file = \OC\Files\Filesystem::normalizePath($file); if(!\OC\Files\Filesystem::isValidPath($file)){ - OC_Response::setStatus(403); + \OC_Response::setStatus(403); exit; } @@ -570,15 +572,15 @@ class OC_Preview { if($userid !== null && $path !== null){ try{ - $preview = new OC_Preview($userid, 'files/' . $path, $file, $maxX, $maxY, $scalingup); + $preview = new Preview($userid, 'files/' . $path, $file, $maxX, $maxY, $scalingup); $preview->showPreview(); }catch(Exception $e){ - OC_Response::setStatus(404); - OC_Log::write('core', $e->getmessage(), OC_Log::ERROR); + \OC_Response::setStatus(404); + \OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR); exit; } }else{ - OC_Response::setStatus(404); + \OC_Response::setStatus(404); exit; } } @@ -592,7 +594,7 @@ class OC_Preview { if(substr($path, 0, 1) == '/'){ $path = substr($path, 1); } - $preview = new OC_Preview(OC_User::getUser(), 'files/', $path, 0, 0, false, true); + $preview = new Preview(\OC_User::getUser(), 'files/', $path, 0, 0, false, true); $preview->deleteAllPreviews(); } } \ No newline at end of file diff --git a/lib/preview/images.php b/lib/preview/images.php index a8f203528c5..c62fc5397e5 100644 --- a/lib/preview/images.php +++ b/lib/preview/images.php @@ -6,7 +6,9 @@ * later. * See the COPYING-README file. */ -class OC_Preview_Image extends OC_Preview_Provider{ +namespace OC\Preview; + +class Image extends Provider{ public function getMimeType(){ return '/image\/.*/'; @@ -31,4 +33,4 @@ class OC_Preview_Image extends OC_Preview_Provider{ } } -OC_Preview::registerProvider('OC_Preview_Image'); \ No newline at end of file +\OC\Preview::registerProvider('OC\Preview\Image'); \ No newline at end of file diff --git a/lib/preview/movies.php b/lib/preview/movies.php index d2aaf730d67..14ac97b552d 100644 --- a/lib/preview/movies.php +++ b/lib/preview/movies.php @@ -6,8 +6,10 @@ * later. * See the COPYING-README file. */ +namespace OC\Preview; + if(!is_null(shell_exec('ffmpeg -version'))){ - class OC_Preview_Movie extends OC_Preview_Provider{ + class Movie extends Provider{ public function getMimeType(){ return '/video\/.*/'; @@ -18,7 +20,7 @@ if(!is_null(shell_exec('ffmpeg -version'))){ $fileinfo = $fileview->getFileInfo($path); $abspath = $fileview->toTmpFile($path); - $tmppath = OC_Helper::tmpFile(); + $tmppath = \OC_Helper::tmpFile(); //$cmd = 'ffmpeg -y -i ' . escapeshellarg($abspath) . ' -f mjpeg -vframes 1 -ss 1 -s ' . escapeshellarg($maxX) . 'x' . escapeshellarg($maxY) . ' ' . $tmppath; $cmd = 'ffmpeg -y -i ' . escapeshellarg($abspath) . ' -f mjpeg -vframes 1 -ss 1 ' . $tmppath; @@ -35,5 +37,5 @@ if(!is_null(shell_exec('ffmpeg -version'))){ } } - OC_Preview::registerProvider('OC_Preview_Movie'); + \OC\Preview::registerProvider('OC\Preview\Movie'); } \ No newline at end of file diff --git a/lib/preview/mp3.php b/lib/preview/mp3.php index 18f5cfde375..d62c7230788 100644 --- a/lib/preview/mp3.php +++ b/lib/preview/mp3.php @@ -5,22 +5,24 @@ * later. * See the COPYING-README file. */ +namespace OC\Preview; + require_once('getid3/getid3.php'); -class OC_Preview_MP3 extends OC_Preview_Provider{ +class MP3 extends Provider{ public function getMimeType(){ return '/audio\/mpeg/'; } public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) { - $getID3 = new getID3(); + $getID3 = new \getID3(); $tmppath = $fileview->toTmpFile($path); //Todo - add stream support $tags = $getID3->analyze($tmppath); - getid3_lib::CopyTagsToComments($tags); + \getid3_lib::CopyTagsToComments($tags); $picture = @$tags['id3v2']['APIC'][0]['data']; unlink($tmppath); @@ -38,4 +40,4 @@ class OC_Preview_MP3 extends OC_Preview_Provider{ } -OC_Preview::registerProvider('OC_Preview_MP3'); \ No newline at end of file +\OC\Preview::registerProvider('OC\Preview\MP3'); \ No newline at end of file diff --git a/lib/preview/pdf.php b/lib/preview/pdf.php index de5263f91d8..4dd4538545c 100644 --- a/lib/preview/pdf.php +++ b/lib/preview/pdf.php @@ -5,9 +5,11 @@ * later. * See the COPYING-README file. */ +namespace OC\Preview; + if (extension_loaded('imagick')){ - class OC_Preview_PDF extends OC_Preview_Provider{ + class PDF extends Provider{ public function getMimeType(){ return '/application\/pdf/'; @@ -17,7 +19,7 @@ if (extension_loaded('imagick')){ $tmppath = $fileview->toTmpFile($path); //create imagick object from pdf - $pdf = new imagick($tmppath . '[0]'); + $pdf = new \imagick($tmppath . '[0]'); $pdf->setImageFormat('jpg'); unlink($tmppath); @@ -31,5 +33,5 @@ if (extension_loaded('imagick')){ } } - OC_Preview::registerProvider('OC_Preview_PDF'); + \OC\Preview::registerProvider('OC\Preview\PDF'); } diff --git a/lib/preview/provider.php b/lib/preview/provider.php index 2f2a0e68486..1e8d537adc8 100644 --- a/lib/preview/provider.php +++ b/lib/preview/provider.php @@ -2,7 +2,9 @@ /** * provides search functionalty */ -abstract class OC_Preview_Provider{ +namespace OC\Preview; + +abstract class Provider{ private $options; public function __construct($options) { diff --git a/lib/preview/svg.php b/lib/preview/svg.php index 415b7751c2b..70be263189d 100644 --- a/lib/preview/svg.php +++ b/lib/preview/svg.php @@ -5,18 +5,26 @@ * later. * See the COPYING-README file. */ +namespace OC\Preview; + if (extension_loaded('imagick')){ - class OC_Preview_SVG extends OC_Preview_Provider{ + class SVG extends Provider{ public function getMimeType(){ return '/image\/svg\+xml/'; } public function getThumbnail($path,$maxX,$maxY,$scalingup,$fileview) { - $svg = new Imagick(); + $svg = new \Imagick(); $svg->setResolution($maxX, $maxY); - $svg->readImageBlob('' . $fileview->file_get_contents($path)); + + $content = stream_get_contents($fileview->fopen($path, 'r')); + if(substr($content, 0, 5) !== '' . $content; + } + + $svg->readImageBlob($content); $svg->setImageFormat('jpg'); //new image object @@ -28,6 +36,6 @@ if (extension_loaded('imagick')){ } } - OC_Preview::registerProvider('OC_Preview_SVG'); + \OC\Preview::registerProvider('OC\Preview\SVG'); } \ No newline at end of file diff --git a/lib/preview/txt.php b/lib/preview/txt.php index 1e88aec69fd..4004ecd3fce 100644 --- a/lib/preview/txt.php +++ b/lib/preview/txt.php @@ -5,7 +5,9 @@ * later. * See the COPYING-README file. */ -class OC_Preview_TXT extends OC_Preview_Provider{ +namespace OC\Preview; + +class TXT extends Provider{ public function getMimeType(){ return '/text\/.*/'; @@ -46,4 +48,4 @@ class OC_Preview_TXT extends OC_Preview_Provider{ } } -OC_Preview::registerProvider('OC_Preview_TXT'); \ No newline at end of file +\OC\Preview::registerProvider('OC\Preview\TXT'); \ No newline at end of file diff --git a/lib/preview/unknown.php b/lib/preview/unknown.php index 5bbdcf847f1..6a8d2fbb75c 100644 --- a/lib/preview/unknown.php +++ b/lib/preview/unknown.php @@ -6,7 +6,9 @@ * later. * See the COPYING-README file. */ -class OC_Preview_Unknown extends OC_Preview_Provider{ +namespace OC\Preview; + +class Unknown extends Provider{ public function getMimeType(){ return '/.*/'; @@ -22,4 +24,4 @@ class OC_Preview_Unknown extends OC_Preview_Provider{ } } -OC_Preview::registerProvider('OC_Preview_Unknown'); +\OC\Preview::registerProvider('OC\Preview\Unknown'); From 268246fac833837d7b9e7a6a2a4559cfadc0a7ab Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Wed, 29 May 2013 12:48:21 +0200 Subject: [PATCH 031/170] namespace fix --- lib/preview.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/preview.php b/lib/preview.php index 31812035c49..855d5a9da04 100755 --- a/lib/preview.php +++ b/lib/preview.php @@ -375,7 +375,7 @@ class Preview { $scalingup = $this->scalingup; if(!($image instanceof \OC_Image)){ - OC_Log::write('core', 'Object passed to resizeAndCrop is not an instance of OC_Image', \OC_Log::DEBUG); + \OC_Log::write('core', 'Object passed to resizeAndCrop is not an instance of OC_Image', \OC_Log::DEBUG); return; } From 7408ab660af2c681ca6abfb15d6230382f35dd7c Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Wed, 29 May 2013 13:03:33 +0200 Subject: [PATCH 032/170] respect coding style guidelines --- lib/preview.php | 136 +++++++++++++++++++-------------------- lib/preview/images.php | 6 +- lib/preview/movies.php | 6 +- lib/preview/mp3.php | 4 +- lib/preview/pdf.php | 4 +- lib/preview/provider.php | 2 +- lib/preview/svg.php | 6 +- lib/preview/txt.php | 8 +-- lib/preview/unknown.php | 4 +- 9 files changed, 88 insertions(+), 88 deletions(-) diff --git a/lib/preview.php b/lib/preview.php index 855d5a9da04..1150681e64f 100755 --- a/lib/preview.php +++ b/lib/preview.php @@ -57,7 +57,7 @@ class Preview { * false if thumbnail does not exist * path to thumbnail if thumbnail exists */ - public function __construct($user = null, $root = '', $file = '', $maxX = 0, $maxY = 0, $scalingup = true, $force = false){ + public function __construct($user=null, $root='', $file='', $maxX=0, $maxY=0, $scalingup=true, $force=false) { //set config $this->max_x = \OC_Config::getValue('preview_max_x', null); $this->max_y = \OC_Config::getValue('preview_max_y', null); @@ -73,46 +73,46 @@ class Preview { $this->fileview = new \OC\Files\View('/' . $user . '/' . $root); $this->userview = new \OC\Files\View('/' . $user); - if($force !== true){ - if(!is_null($this->max_x)){ - if($this->maxX > $this->max_x){ + if($force !== true) { + if(!is_null($this->max_x)) { + if($this->maxX > $this->max_x) { \OC_Log::write('core', 'maxX reduced from ' . $this->maxX . ' to ' . $this->max_x, \OC_Log::DEBUG); $this->maxX = $this->max_x; } } - if(!is_null($this->max_y)){ - if($this->maxY > $this->max_y){ + if(!is_null($this->max_y)) { + if($this->maxY > $this->max_y) { \OC_Log::write('core', 'maxY reduced from ' . $this->maxY . ' to ' . $this->max_y, \OC_Log::DEBUG); $this->maxY = $this->max_y; } } //init providers - if(empty(self::$providers)){ + if(empty(self::$providers)) { self::initProviders(); } //check if there are any providers at all - if(empty(self::$providers)){ + if(empty(self::$providers)) { \OC_Log::write('core', 'No preview providers exist', \OC_Log::ERROR); throw new \Exception('No providers'); } //validate parameters - if($file === ''){ + if($file === '') { \OC_Log::write('core', 'No filename passed', \OC_Log::ERROR); throw new \Exception('File not found'); } //check if file exists - if(!$this->fileview->file_exists($file)){ + if(!$this->fileview->file_exists($file)) { \OC_Log::write('core', 'File:"' . $file . '" not found', \OC_Log::ERROR); throw new \Exception('File not found'); } //check if given size makes sense - if($maxX === 0 || $maxY === 0){ + if($maxX === 0 || $maxY === 0) { \OC_Log::write('core', 'Can not create preview with 0px width or 0px height', \OC_Log::ERROR); throw new \Exception('Height and/or width set to 0'); } @@ -123,7 +123,7 @@ class Preview { * @brief returns the path of the file you want a thumbnail from * @return string */ - public function getFile(){ + public function getFile() { return $this->file; } @@ -131,7 +131,7 @@ class Preview { * @brief returns the max width of the preview * @return integer */ - public function getMaxX(){ + public function getMaxX() { return $this->maxX; } @@ -139,7 +139,7 @@ class Preview { * @brief returns the max height of the preview * @return integer */ - public function getMaxY(){ + public function getMaxY() { return $this->maxY; } @@ -147,7 +147,7 @@ class Preview { * @brief returns whether or not scalingup is enabled * @return bool */ - public function getScalingup(){ + public function getScalingup() { return $this->scalingup; } @@ -155,7 +155,7 @@ class Preview { * @brief returns the name of the thumbnailfolder * @return string */ - public function getThumbnailsfolder(){ + public function getThumbnailsfolder() { return self::THUMBNAILS_FOLDER; } @@ -163,7 +163,7 @@ class Preview { * @brief returns the max scale factor * @return integer */ - public function getMaxScaleFactor(){ + public function getMaxScaleFactor() { return $this->max_scale_factor; } @@ -171,7 +171,7 @@ class Preview { * @brief returns the max width set in ownCloud's config * @return integer */ - public function getConfigMaxX(){ + public function getConfigMaxX() { return $this->max_x; } @@ -179,7 +179,7 @@ class Preview { * @brief returns the max height set in ownCloud's config * @return integer */ - public function getConfigMaxY(){ + public function getConfigMaxY() { return $this->max_y; } @@ -187,7 +187,7 @@ class Preview { * @brief deletes previews of a file with specific x and y * @return bool */ - public function deletePreview(){ + public function deletePreview() { $fileinfo = $this->fileview->getFileInfo($this->file); $fileid = $fileinfo['fileid']; @@ -199,7 +199,7 @@ class Preview { * @brief deletes all previews of a file * @return bool */ - public function deleteAllPreviews(){ + public function deleteAllPreviews() { $fileinfo = $this->fileview->getFileInfo($this->file); $fileid = $fileinfo['fileid']; @@ -214,7 +214,7 @@ class Preview { * false if thumbnail does not exist * path to thumbnail if thumbnail exists */ - private function isCached(){ + private function isCached() { $file = $this->file; $maxX = $this->maxX; $maxY = $this->maxY; @@ -223,12 +223,12 @@ class Preview { $fileinfo = $this->fileview->getFileInfo($file); $fileid = $fileinfo['fileid']; - if(!$this->userview->is_dir(self::THUMBNAILS_FOLDER . '/' . $fileid)){ + if(!$this->userview->is_dir(self::THUMBNAILS_FOLDER . '/' . $fileid)) { return false; } //does a preview with the wanted height and width already exist? - if($this->userview->file_exists(self::THUMBNAILS_FOLDER . '/' . $fileid . '/' . $maxX . '-' . $maxY . '.png')){ + if($this->userview->file_exists(self::THUMBNAILS_FOLDER . '/' . $fileid . '/' . $maxX . '-' . $maxY . '.png')) { return self::THUMBNAILS_FOLDER . '/' . $fileid . '/' . $maxX . '-' . $maxY . '.png'; } @@ -238,20 +238,20 @@ class Preview { $possiblethumbnails = array(); $allthumbnails = $this->userview->getDirectoryContent(self::THUMBNAILS_FOLDER . '/' . $fileid); - foreach($allthumbnails as $thumbnail){ + foreach($allthumbnails as $thumbnail) { $size = explode('-', $thumbnail['name']); $x = $size[0]; $y = $size[1]; $aspectratio = $x / $y; - if($aspectratio != $wantedaspectratio){ + if($aspectratio != $wantedaspectratio) { continue; } - if($x < $maxX || $y < $maxY){ - if($scalingup){ + if($x < $maxX || $y < $maxY) { + if($scalingup) { $scalefactor = $maxX / $x; - if($scalefactor > $this->max_scale_factor){ + if($scalefactor > $this->max_scale_factor) { continue; } }else{ @@ -261,26 +261,26 @@ class Preview { $possiblethumbnails[$x] = $thumbnail['path']; } - if(count($possiblethumbnails) === 0){ + if(count($possiblethumbnails) === 0) { return false; } - if(count($possiblethumbnails) === 1){ + if(count($possiblethumbnails) === 1) { return current($possiblethumbnails); } ksort($possiblethumbnails); - if(key(reset($possiblethumbnails)) > $maxX){ + if(key(reset($possiblethumbnails)) > $maxX) { return current(reset($possiblethumbnails)); } - if(key(end($possiblethumbnails)) < $maxX){ + if(key(end($possiblethumbnails)) < $maxX) { return current(end($possiblethumbnails)); } - foreach($possiblethumbnails as $width => $path){ - if($width < $maxX){ + foreach($possiblethumbnails as $width => $path) { + if($width < $maxX) { continue; }else{ return $path; @@ -296,7 +296,7 @@ class Preview { * @param $scaleup Scale smaller images up to the thumbnail size or not. Might look ugly * @return image */ - public function getPreview(){ + public function getPreview() { $file = $this->file; $maxX = $this->maxX; $maxY = $this->maxY; @@ -307,7 +307,7 @@ class Preview { $cached = self::isCached(); - if($cached){ + if($cached) { $image = new \OC_Image($this->userview->file_get_contents($cached, 'r')); $this->preview = $image; }else{ @@ -315,25 +315,25 @@ class Preview { $preview; - foreach(self::$providers as $supportedmimetype => $provider){ - if(!preg_match($supportedmimetype, $mimetype)){ + foreach(self::$providers as $supportedmimetype => $provider) { + if(!preg_match($supportedmimetype, $mimetype)) { continue; } $preview = $provider->getThumbnail($file, $maxX, $maxY, $scalingup, $this->fileview); - if(!$preview){ + if(!$preview) { continue; } //are there any cached thumbnails yet - if($this->userview->is_dir(self::THUMBNAILS_FOLDER . '/') === false){ + if($this->userview->is_dir(self::THUMBNAILS_FOLDER . '/') === false) { $this->userview->mkdir(self::THUMBNAILS_FOLDER . '/'); } //cache thumbnail $cachepath = self::THUMBNAILS_FOLDER . '/' . $fileid . '/' . $maxX . '-' . $maxY . '.png'; - if($this->userview->is_dir(self::THUMBNAILS_FOLDER . '/' . $fileid . '/') === false){ + if($this->userview->is_dir(self::THUMBNAILS_FOLDER . '/' . $fileid . '/') === false) { $this->userview->mkdir(self::THUMBNAILS_FOLDER . '/' . $fileid . '/'); } $this->userview->file_put_contents($cachepath, $preview->data()); @@ -354,10 +354,10 @@ class Preview { * @param $scaleup Scale smaller images up to the thumbnail size or not. Might look ugly * @return void */ - public function showPreview(){ + public function showPreview() { \OCP\Response::enableCaching(3600 * 24); // 24 hour $preview = $this->getPreview(); - if($preview){ + if($preview) { $preview->show(); } } @@ -366,7 +366,7 @@ class Preview { * @brief resize, crop and fix orientation * @return image */ - public function resizeAndCrop(){ + public function resizeAndCrop() { $this->preview->fixOrientation(); $image = $this->preview; @@ -374,7 +374,7 @@ class Preview { $y = $this->maxY; $scalingup = $this->scalingup; - if(!($image instanceof \OC_Image)){ + if(!($image instanceof \OC_Image)) { \OC_Log::write('core', 'Object passed to resizeAndCrop is not an instance of OC_Image', \OC_Log::DEBUG); return; } @@ -382,14 +382,14 @@ class Preview { $realx = (int) $image->width(); $realy = (int) $image->height(); - if($x === $realx && $y === $realy){ + if($x === $realx && $y === $realy) { return $image; } $factorX = $x / $realx; $factorY = $y / $realy; - if($factorX >= $factorY){ + if($factorX >= $factorY) { $factor = $factorX; }else{ $factor = $factorY; @@ -399,8 +399,8 @@ class Preview { if($scalingup === false) { if($factor>1) $factor=1; } - if(!is_null($this->max_scale_factor)){ - if($factor > $this->max_scale_factor){ + if(!is_null($this->max_scale_factor)) { + if($factor > $this->max_scale_factor) { \OC_Log::write('core', 'scalefactor reduced from ' . $factor . ' to ' . $this->max_scale_factor, \OC_Log::DEBUG); $factor = $this->max_scale_factor; } @@ -411,12 +411,12 @@ class Preview { // resize $image->preciseResize($newXsize, $newYsize); - if($newXsize === $x && $newYsize === $y){ + if($newXsize === $x && $newYsize === $y) { $this->preview = $image; return; } - if($newXsize >= $x && $newYsize >= $y){ + if($newXsize >= $x && $newYsize >= $y) { $cropX = floor(abs($x - $newXsize) * 0.5); $cropY = floor(abs($y - $newYsize) * 0.5); @@ -426,13 +426,13 @@ class Preview { return; } - if($newXsize < $x || $newYsize < $y){ - if($newXsize > $x){ + if($newXsize < $x || $newYsize < $y) { + if($newXsize > $x) { $cropX = floor(($newXsize - $x) * 0.5); $image->crop($cropX, 0, $x, $newYsize); } - if($newYsize > $y){ + if($newYsize > $y) { $cropY = floor(($newYsize - $y) * 0.5); $image->crop(0, $cropY, $newXsize, $y); } @@ -467,7 +467,7 @@ class Preview { * @param string $provider class name of a Preview_Provider * @return void */ - public static function registerProvider($class, $options=array()){ + public static function registerProvider($class, $options=array()) { self::$registeredProviders[]=array('class'=>$class, 'options'=>$options); } @@ -475,7 +475,7 @@ class Preview { * @brief create instances of all the registered preview providers * @return void */ - private static function initProviders(){ + private static function initProviders() { if(count(self::$providers)>0) { return; } @@ -497,7 +497,7 @@ class Preview { * @brief method that handles preview requests from users that are logged in * @return void */ - public static function previewRouter($params){ + public static function previewRouter($params) { \OC_Util::checkLoggedIn(); $file = ''; @@ -514,11 +514,11 @@ class Preview { if(array_key_exists('y', $_GET)) $maxY = (int) $_GET['y']; if(array_key_exists('scalingup', $_GET)) $scalingup = (bool) $_GET['scalingup']; - if($file !== '' && $maxX !== 0 && $maxY !== 0){ + if($file !== '' && $maxX !== 0 && $maxY !== 0) { try{ $preview = new Preview(\OC_User::getUser(), 'files', $file, $maxX, $maxY, $scalingup); $preview->showPreview(); - }catch(Exception $e){ + }catch(Exception $e) { \OC_Response::setStatus(404); \OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR); exit; @@ -533,7 +533,7 @@ class Preview { * @brief method that handles preview requests from users that are not logged in / view shared folders that are public * @return void */ - public static function publicPreviewRouter($params){ + public static function publicPreviewRouter($params) { $file = ''; $maxX = 0; $maxY = 0; @@ -560,21 +560,21 @@ class Preview { //clean up file parameter $file = \OC\Files\Filesystem::normalizePath($file); - if(!\OC\Files\Filesystem::isValidPath($file)){ + if(!\OC\Files\Filesystem::isValidPath($file)) { \OC_Response::setStatus(403); exit; } $path = \OC\Files\Filesystem::normalizePath($path, false); - if(substr($path, 0, 1) == '/'){ + if(substr($path, 0, 1) == '/') { $path = substr($path, 1); } - if($userid !== null && $path !== null){ + if($userid !== null && $path !== null) { try{ $preview = new Preview($userid, 'files/' . $path, $file, $maxX, $maxY, $scalingup); $preview->showPreview(); - }catch(Exception $e){ + }catch(Exception $e) { \OC_Response::setStatus(404); \OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR); exit; @@ -585,13 +585,13 @@ class Preview { } } - public static function post_write($args){ + public static function post_write($args) { self::post_delete($args); } - public static function post_delete($args){ + public static function post_delete($args) { $path = $args['path']; - if(substr($path, 0, 1) == '/'){ + if(substr($path, 0, 1) == '/') { $path = substr($path, 1); } $preview = new Preview(\OC_User::getUser(), 'files/', $path, 0, 0, false, true); diff --git a/lib/preview/images.php b/lib/preview/images.php index c62fc5397e5..933d65ec59e 100644 --- a/lib/preview/images.php +++ b/lib/preview/images.php @@ -10,16 +10,16 @@ namespace OC\Preview; class Image extends Provider{ - public function getMimeType(){ + public function getMimeType() { return '/image\/.*/'; } - public function getThumbnail($path,$maxX,$maxY,$scalingup,$fileview) { + public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) { //get fileinfo $fileinfo = $fileview->getFileInfo($path); //check if file is encrypted - if($fileinfo['encrypted'] === true){ + if($fileinfo['encrypted'] === true) { $image = new \OC_Image($fileview->fopen($path, 'r')); }else{ $image = new \OC_Image(); diff --git a/lib/preview/movies.php b/lib/preview/movies.php index 14ac97b552d..aa97c3f43fc 100644 --- a/lib/preview/movies.php +++ b/lib/preview/movies.php @@ -8,14 +8,14 @@ */ namespace OC\Preview; -if(!is_null(shell_exec('ffmpeg -version'))){ +if(!is_null(shell_exec('ffmpeg -version'))) { class Movie extends Provider{ - public function getMimeType(){ + public function getMimeType() { return '/video\/.*/'; } - public function getThumbnail($path,$maxX,$maxY,$scalingup,$fileview) { + public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) { //get fileinfo $fileinfo = $fileview->getFileInfo($path); diff --git a/lib/preview/mp3.php b/lib/preview/mp3.php index d62c7230788..cfe78f32727 100644 --- a/lib/preview/mp3.php +++ b/lib/preview/mp3.php @@ -11,7 +11,7 @@ require_once('getid3/getid3.php'); class MP3 extends Provider{ - public function getMimeType(){ + public function getMimeType() { return '/audio\/mpeg/'; } @@ -33,7 +33,7 @@ class MP3 extends Provider{ return $image; } - public function getNoCoverThumbnail($maxX, $maxY){ + public function getNoCoverThumbnail($maxX, $maxY) { $image = new \OC_Image(); return $image; } diff --git a/lib/preview/pdf.php b/lib/preview/pdf.php index 4dd4538545c..66570b05aa4 100644 --- a/lib/preview/pdf.php +++ b/lib/preview/pdf.php @@ -7,11 +7,11 @@ */ namespace OC\Preview; -if (extension_loaded('imagick')){ +if (extension_loaded('imagick')) { class PDF extends Provider{ - public function getMimeType(){ + public function getMimeType() { return '/application\/pdf/'; } diff --git a/lib/preview/provider.php b/lib/preview/provider.php index 1e8d537adc8..58e7ad7f453 100644 --- a/lib/preview/provider.php +++ b/lib/preview/provider.php @@ -18,5 +18,5 @@ abstract class Provider{ * @param string $query * @return */ - abstract public function getThumbnail($path, $maxX, $maxY, $scalingup,$fileview); + abstract public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview); } diff --git a/lib/preview/svg.php b/lib/preview/svg.php index 70be263189d..746315d6e6a 100644 --- a/lib/preview/svg.php +++ b/lib/preview/svg.php @@ -7,11 +7,11 @@ */ namespace OC\Preview; -if (extension_loaded('imagick')){ +if (extension_loaded('imagick')) { class SVG extends Provider{ - public function getMimeType(){ + public function getMimeType() { return '/image\/svg\+xml/'; } @@ -20,7 +20,7 @@ if (extension_loaded('imagick')){ $svg->setResolution($maxX, $maxY); $content = stream_get_contents($fileview->fopen($path, 'r')); - if(substr($content, 0, 5) !== '' . $content; } diff --git a/lib/preview/txt.php b/lib/preview/txt.php index 4004ecd3fce..5961761aaa4 100644 --- a/lib/preview/txt.php +++ b/lib/preview/txt.php @@ -9,11 +9,11 @@ namespace OC\Preview; class TXT extends Provider{ - public function getMimeType(){ + public function getMimeType() { return '/text\/.*/'; } - public function getThumbnail($path,$maxX,$maxY,$scalingup,$fileview) { + public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) { $content = $fileview->fopen($path, 'r'); $content = stream_get_contents($content); @@ -27,7 +27,7 @@ class TXT extends Provider{ $imagecolor = imagecolorallocate($image, 255, 255, 255); $textcolor = imagecolorallocate($image, 0, 0, 0); - foreach($lines as $index => $line){ + foreach($lines as $index => $line) { $index = $index + 1; $x = (int) 1; @@ -35,7 +35,7 @@ class TXT extends Provider{ imagestring($image, 1, $x, $y, $line, $textcolor); - if(($index * $linesize) >= $maxY){ + if(($index * $linesize) >= $maxY) { break; } } diff --git a/lib/preview/unknown.php b/lib/preview/unknown.php index 6a8d2fbb75c..2977cd68923 100644 --- a/lib/preview/unknown.php +++ b/lib/preview/unknown.php @@ -10,11 +10,11 @@ namespace OC\Preview; class Unknown extends Provider{ - public function getMimeType(){ + public function getMimeType() { return '/.*/'; } - public function getThumbnail($path, $maxX, $maxY, $scalingup,$fileview) { + public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) { /*$mimetype = $fileview->getMimeType($path); $info = $fileview->getFileInfo($path); $name = array_key_exists('name', $info) ? $info['name'] : ''; From 6b90416891e9e0943a7b19f29017bf7d8140eb0a Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Wed, 29 May 2013 13:09:38 +0200 Subject: [PATCH 033/170] add php preview backend --- lib/preview/txt.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/preview/txt.php b/lib/preview/txt.php index 5961761aaa4..def6806860b 100644 --- a/lib/preview/txt.php +++ b/lib/preview/txt.php @@ -48,4 +48,14 @@ class TXT extends Provider{ } } -\OC\Preview::registerProvider('OC\Preview\TXT'); \ No newline at end of file +\OC\Preview::registerProvider('OC\Preview\TXT'); + +class PHP extends TXT { + + public function getMimeType() { + return '/application\/x-php/'; + } + +} + +\OC\Preview::registerProvider('OC\Preview\PHP'); \ No newline at end of file From 1e252b67635aeed7fa8180a0868abd6442a3c42c Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Wed, 29 May 2013 13:11:43 +0200 Subject: [PATCH 034/170] more style fixes --- lib/preview/images.php | 2 +- lib/preview/movies.php | 3 ++- lib/preview/mp3.php | 4 ++-- lib/preview/pdf.php | 2 +- lib/preview/provider.php | 2 +- lib/preview/svg.php | 2 +- lib/preview/txt.php | 2 +- lib/preview/unknown.php | 2 +- 8 files changed, 10 insertions(+), 9 deletions(-) diff --git a/lib/preview/images.php b/lib/preview/images.php index 933d65ec59e..080e424e5bd 100644 --- a/lib/preview/images.php +++ b/lib/preview/images.php @@ -8,7 +8,7 @@ */ namespace OC\Preview; -class Image extends Provider{ +class Image extends Provider { public function getMimeType() { return '/image\/.*/'; diff --git a/lib/preview/movies.php b/lib/preview/movies.php index aa97c3f43fc..18e9d4f778c 100644 --- a/lib/preview/movies.php +++ b/lib/preview/movies.php @@ -9,7 +9,8 @@ namespace OC\Preview; if(!is_null(shell_exec('ffmpeg -version'))) { - class Movie extends Provider{ + + class Movie extends Provider { public function getMimeType() { return '/video\/.*/'; diff --git a/lib/preview/mp3.php b/lib/preview/mp3.php index cfe78f32727..303626e022e 100644 --- a/lib/preview/mp3.php +++ b/lib/preview/mp3.php @@ -1,4 +1,4 @@ - Date: Wed, 29 May 2013 13:13:47 +0200 Subject: [PATCH 035/170] fix c&p fail --- lib/preview/mp3.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/preview/mp3.php b/lib/preview/mp3.php index 303626e022e..3c6be5c9226 100644 --- a/lib/preview/mp3.php +++ b/lib/preview/mp3.php @@ -1,4 +1,4 @@ -Provider{ Date: Thu, 30 May 2013 10:44:23 +0200 Subject: [PATCH 036/170] validate size of file --- lib/preview.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/preview.php b/lib/preview.php index 1150681e64f..be3abc2cd47 100755 --- a/lib/preview.php +++ b/lib/preview.php @@ -87,7 +87,15 @@ class Preview { $this->maxY = $this->max_y; } } - + + $fileinfo = $this->fileview->getFileInfo($this->file); + if(array_key_exists('size', $fileinfo)){ + if((int) $fileinfo['size'] === 0){ + \OC_Log::write('core', 'You can\'t generate a preview of a 0 byte file (' . $this->file . ')', \OC_Log::ERROR); + throw new \Exception('0 byte file given'); + } + } + //init providers if(empty(self::$providers)) { self::initProviders(); @@ -518,7 +526,7 @@ class Preview { try{ $preview = new Preview(\OC_User::getUser(), 'files', $file, $maxX, $maxY, $scalingup); $preview->showPreview(); - }catch(Exception $e) { + }catch(\Exception $e) { \OC_Response::setStatus(404); \OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR); exit; @@ -574,7 +582,7 @@ class Preview { try{ $preview = new Preview($userid, 'files/' . $path, $file, $maxX, $maxY, $scalingup); $preview->showPreview(); - }catch(Exception $e) { + }catch(\Exception $e) { \OC_Response::setStatus(404); \OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR); exit; From a014662c52f5295a7e86cd43b7dd62b89e3f1085 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Thu, 30 May 2013 11:06:52 +0200 Subject: [PATCH 037/170] improve imagick error handling --- lib/preview/pdf.php | 9 +++++++-- lib/preview/svg.php | 21 +++++++++++++-------- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/lib/preview/pdf.php b/lib/preview/pdf.php index 85878a122a8..f1d0a33dc63 100644 --- a/lib/preview/pdf.php +++ b/lib/preview/pdf.php @@ -19,8 +19,13 @@ if (extension_loaded('imagick')) { $tmppath = $fileview->toTmpFile($path); //create imagick object from pdf - $pdf = new \imagick($tmppath . '[0]'); - $pdf->setImageFormat('jpg'); + try{ + $pdf = new \imagick($tmppath . '[0]'); + $pdf->setImageFormat('jpg'); + }catch(\Exception $e){ + \OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR); + return false; + } unlink($tmppath); diff --git a/lib/preview/svg.php b/lib/preview/svg.php index 8bceeaf60d1..76d81589bac 100644 --- a/lib/preview/svg.php +++ b/lib/preview/svg.php @@ -16,17 +16,22 @@ if (extension_loaded('imagick')) { } public function getThumbnail($path,$maxX,$maxY,$scalingup,$fileview) { - $svg = new \Imagick(); - $svg->setResolution($maxX, $maxY); + try{ + $svg = new \Imagick(); + $svg->setResolution($maxX, $maxY); - $content = stream_get_contents($fileview->fopen($path, 'r')); - if(substr($content, 0, 5) !== '' . $content; + $content = stream_get_contents($fileview->fopen($path, 'r')); + if(substr($content, 0, 5) !== '' . $content; + } + + $svg->readImageBlob($content); + $svg->setImageFormat('jpg'); + }catch(\Exception $e){ + \OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR); + return false; } - $svg->readImageBlob($content); - $svg->setImageFormat('jpg'); - //new image object $image = new \OC_Image($svg); //check if image object is valid From b944b1c5d29393e1b6f0bc51cf50db6eba356e64 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Thu, 30 May 2013 11:12:12 +0200 Subject: [PATCH 038/170] add javascript preview backend --- lib/preview/txt.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/preview/txt.php b/lib/preview/txt.php index 4eb0e820406..f18da66c3b8 100644 --- a/lib/preview/txt.php +++ b/lib/preview/txt.php @@ -58,4 +58,14 @@ class PHP extends TXT { } -\OC\Preview::registerProvider('OC\Preview\PHP'); \ No newline at end of file +\OC\Preview::registerProvider('OC\Preview\PHP'); + +class JavaScript extends TXT { + + public function getMimeType() { + return '/application\/javascript/'; + } + +} + +\OC\Preview::registerProvider('OC\Preview\JavaScript'); \ No newline at end of file From f7c80a391d192a15d594c3eaf7909a3d78df1a29 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Thu, 30 May 2013 15:29:38 +0200 Subject: [PATCH 039/170] load getID3 only if needed --- lib/preview/mp3.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/preview/mp3.php b/lib/preview/mp3.php index 3c6be5c9226..660e9fc3ce4 100644 --- a/lib/preview/mp3.php +++ b/lib/preview/mp3.php @@ -7,8 +7,6 @@ */ namespace OC\Preview; -require_once('getid3/getid3.php'); - class MP3 extends Provider { public function getMimeType() { @@ -16,6 +14,8 @@ class MP3 extends Provider { } public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) { + require_once('getid3/getid3.php'); + $getID3 = new \getID3(); $tmppath = $fileview->toTmpFile($path); From a11a40d9a96685d41e5acae096752f16785b16b5 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Fri, 31 May 2013 12:23:51 +0200 Subject: [PATCH 040/170] add backend for microsoft office 2007 documents --- lib/preview.php | 2 + lib/preview/msoffice.php | 109 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 111 insertions(+) create mode 100644 lib/preview/msoffice.php diff --git a/lib/preview.php b/lib/preview.php index be3abc2cd47..a73f4cb1ac0 100755 --- a/lib/preview.php +++ b/lib/preview.php @@ -20,6 +20,8 @@ require_once('preview/pdf.php'); require_once('preview/svg.php'); require_once('preview/txt.php'); require_once('preview/unknown.php'); +require_once('preview/msoffice.php'); +//require_once('preview/opendocument.php'); class Preview { //the thumbnail folder diff --git a/lib/preview/msoffice.php b/lib/preview/msoffice.php new file mode 100644 index 00000000000..c99ca313c72 --- /dev/null +++ b/lib/preview/msoffice.php @@ -0,0 +1,109 @@ +toTmpFile($path); + + $transformdoc = new \TransformDoc(); + $transformdoc->setStrFile($tmpdoc); + $transformdoc->generatePDF($tmpdoc); + + $pdf = new \imagick($tmpdoc . '[0]'); + $pdf->setImageFormat('jpg'); + + unlink($tmpdoc); + + //new image object + $image = new \OC_Image($pdf); + //check if image object is valid + if (!$image->valid()) return false; + + return $image; + } +} + +class DOC extends MSOffice2003 { + + public function getMimeType() { + return '/application\/msword/'; + } + +} + +\OC\Preview::registerProvider('OC\Preview\DOC'); + +class DOCX extends MSOffice2007 { + + public function getMimeType() { + return '/application\/vnd.openxmlformats-officedocument.wordprocessingml.document/'; + } + +} + +\OC\Preview::registerProvider('OC\Preview\DOCX'); + +class XLS extends MSOffice2003 { + + public function getMimeType() { + return '/application\/vnd.ms-excel/'; + } + +} + +\OC\Preview::registerProvider('OC\Preview\XLS'); + +class XLSX extends MSOffice2007 { + + public function getMimeType() { + return '/application\/vnd.openxmlformats-officedocument.spreadsheetml.sheet/'; + } + +} + +\OC\Preview::registerProvider('OC\Preview\XLSX'); + +class PPT extends MSOffice2003 { + + public function getMimeType() { + return '/application\/vnd.ms-powerpoint/'; + } + +} + +\OC\Preview::registerProvider('OC\Preview\PPT'); + +class PPTX extends MSOffice2007 { + + public function getMimeType() { + return '/application\/vnd.openxmlformats-officedocument.presentationml.presentation/'; + } + +} + +\OC\Preview::registerProvider('OC\Preview\PPTX'); \ No newline at end of file From 34decf357697a81c23e844ef606c04a20a08c597 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Mon, 3 Jun 2013 11:24:31 +0200 Subject: [PATCH 041/170] save current work state --- lib/preview.php | 2 +- lib/preview/libreoffice-cl.php | 0 lib/preview/office.php | 13 +++++++++++++ lib/preview/opendocument.php | 0 4 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 lib/preview/libreoffice-cl.php create mode 100644 lib/preview/office.php create mode 100644 lib/preview/opendocument.php diff --git a/lib/preview.php b/lib/preview.php index a73f4cb1ac0..4705efe2107 100755 --- a/lib/preview.php +++ b/lib/preview.php @@ -20,7 +20,7 @@ require_once('preview/pdf.php'); require_once('preview/svg.php'); require_once('preview/txt.php'); require_once('preview/unknown.php'); -require_once('preview/msoffice.php'); +//require_once('preview/msoffice.php'); //require_once('preview/opendocument.php'); class Preview { diff --git a/lib/preview/libreoffice-cl.php b/lib/preview/libreoffice-cl.php new file mode 100644 index 00000000000..e69de29bb2d diff --git a/lib/preview/office.php b/lib/preview/office.php new file mode 100644 index 00000000000..c66f5584f07 --- /dev/null +++ b/lib/preview/office.php @@ -0,0 +1,13 @@ + Date: Wed, 5 Jun 2013 10:50:20 +0200 Subject: [PATCH 042/170] save current work state of libreoffice preview backend --- lib/preview/libreoffice-cl.php | 129 +++++++++++++++++++++++++++++++++ lib/preview/office.php | 4 +- 2 files changed, 132 insertions(+), 1 deletion(-) diff --git a/lib/preview/libreoffice-cl.php b/lib/preview/libreoffice-cl.php index e69de29bb2d..1408e69e8cf 100644 --- a/lib/preview/libreoffice-cl.php +++ b/lib/preview/libreoffice-cl.php @@ -0,0 +1,129 @@ +initCmd(); + if(is_null($this->cmd)) { + return false; + } + + $abspath = $fileview->toTmpFile($path); + + chdir(get_temp_dir()); + + $exec = 'libreoffice --headless -convert-to pdf ' . escapeshellarg($abspath); + exec($exec) + + //create imagick object from pdf + try{ + $pdf = new \imagick($abspath . '.pdf' . '[0]'); + $pdf->setImageFormat('jpg'); + }catch(\Exception $e){ + \OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR); + return false; + } + + $image = new \OC_Image($pdf); + + unlink($abspath); + unlink($tmppath); + if (!$image->valid()) return false; + + return $image; + } + + private function initCmd() { + $cmd = ''; + + if(is_string(\OC_Config::getValue('preview_libreoffice_path', null))) { + $cmd = \OC_Config::getValue('preview_libreoffice_path', null); + } + + if($cmd === '' && shell_exec('libreoffice --headless --version')) { + $cmd = 'libreoffice'; + } + + if($cmd === '' && shell_exec('openoffice --headless --version')) { + $cmd = 'openoffice'; + } + + if($cmd === '') { + $cmd = null; + } + + $this->cmd = $cmd; + } + } +} + +//.doc, .dot +class MSOfficeDoc extends Office { + + public function getMimeType() { + return '/application\/msword/'; + } + +} + +\OC\Preview::registerProvider('OC\Preview\MSOfficeDoc'); + +//.docm, .dotm, .xls(m), .xlt(m), .xla(m), .ppt(m), .pot(m), .pps(m), .ppa(m) +class MSOffice2003 extends Office { + + public function getMimeType() { + return '/application\/vnd.ms-.*/'; + } + +} + +\OC\Preview::registerProvider('OC\Preview\MSOffice2003'); + +//.docx, .dotx, .xlsx, .xltx, .pptx, .potx, .ppsx +class MSOffice2007 extends Office { + + public function getMimeType() { + return '/application\/vnd.openxmlformats-officedocument.*/'; + } + +} + +\OC\Preview::registerProvider('OC\Preview\MSOffice2007'); + +//.odt, .ott, .oth, .odm, .odg, .otg, .odp, .otp, .ods, .ots, .odc, .odf, .odb, .odi, .oxt +class OpenDocument extends Office { + + public function getMimeType() { + return '/application\/vnd.oasis.opendocument.*/'; + } + +} + +\OC\Preview::registerProvider('OC\Preview\OpenDocument'); + +//.sxw, .stw, .sxc, .stc, .sxd, .std, .sxi, .sti, .sxg, .sxm +class StarOffice extends Office { + + public function getMimeType() { + return '/application\/vnd.sun.xml.*/'; + } + +} + +\OC\Preview::registerProvider('OC\Preview\StarOffice'); \ No newline at end of file diff --git a/lib/preview/office.php b/lib/preview/office.php index c66f5584f07..cc1addf3996 100644 --- a/lib/preview/office.php +++ b/lib/preview/office.php @@ -5,9 +5,11 @@ * later. * See the COPYING-README file. */ -if(shell_exec('libreoffice') || shell_exec('openoffice')) { +//let's see if there is libreoffice or openoffice on this machine +if(shell_exec('libreoffice --headless --version') || shell_exec('openoffice --headless --version') || is_string(\OC_Config::getValue('preview_libreoffice_path', null))) { require_once('libreoffice-cl.php'); }else{ + //in case there isn't, use our fallback require_once('msoffice.php'); require_once('opendocument.php'); } \ No newline at end of file From 749c33f39d9452e2c1fdca718e3abcdb7c4a9dd0 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Wed, 5 Jun 2013 10:53:16 +0200 Subject: [PATCH 043/170] escape tmppath shell arg --- lib/preview/movies.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/preview/movies.php b/lib/preview/movies.php index 18e9d4f778c..8cd50263e2a 100644 --- a/lib/preview/movies.php +++ b/lib/preview/movies.php @@ -24,7 +24,7 @@ if(!is_null(shell_exec('ffmpeg -version'))) { $tmppath = \OC_Helper::tmpFile(); //$cmd = 'ffmpeg -y -i ' . escapeshellarg($abspath) . ' -f mjpeg -vframes 1 -ss 1 -s ' . escapeshellarg($maxX) . 'x' . escapeshellarg($maxY) . ' ' . $tmppath; - $cmd = 'ffmpeg -y -i ' . escapeshellarg($abspath) . ' -f mjpeg -vframes 1 -ss 1 ' . $tmppath; + $cmd = 'ffmpeg -y -i ' . escapeshellarg($abspath) . ' -f mjpeg -vframes 1 -ss 1 ' . escapeshellarg($tmppath); shell_exec($cmd); unlink($abspath); From f437673f1a03ba5b2eeb3e79d24bf6ad3265aa0b Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Wed, 5 Jun 2013 10:55:57 +0200 Subject: [PATCH 044/170] update require_once block in preview.php --- lib/preview.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/preview.php b/lib/preview.php index 4705efe2107..f9f1288cb98 100755 --- a/lib/preview.php +++ b/lib/preview.php @@ -20,8 +20,7 @@ require_once('preview/pdf.php'); require_once('preview/svg.php'); require_once('preview/txt.php'); require_once('preview/unknown.php'); -//require_once('preview/msoffice.php'); -//require_once('preview/opendocument.php'); +require_once('preview/office.php'); class Preview { //the thumbnail folder From bab8b20cbdc65888d92477f9a5810ea4b114ada1 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Wed, 5 Jun 2013 11:06:36 +0200 Subject: [PATCH 045/170] use ->cmd instead of hardcoded libreoffice --- lib/preview/libreoffice-cl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/preview/libreoffice-cl.php b/lib/preview/libreoffice-cl.php index 1408e69e8cf..49c574c9521 100644 --- a/lib/preview/libreoffice-cl.php +++ b/lib/preview/libreoffice-cl.php @@ -28,7 +28,7 @@ if (extension_loaded('imagick')) { chdir(get_temp_dir()); - $exec = 'libreoffice --headless -convert-to pdf ' . escapeshellarg($abspath); + $exec = $this->cmd . ' --headless -convert-to pdf ' . escapeshellarg($abspath); exec($exec) //create imagick object from pdf From 8c5fceba296ae76a0f22f3ed0324dec46ef16019 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Wed, 5 Jun 2013 11:13:13 +0200 Subject: [PATCH 046/170] fix syntax error --- lib/preview/libreoffice-cl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/preview/libreoffice-cl.php b/lib/preview/libreoffice-cl.php index 49c574c9521..1b8e482fb23 100644 --- a/lib/preview/libreoffice-cl.php +++ b/lib/preview/libreoffice-cl.php @@ -29,7 +29,7 @@ if (extension_loaded('imagick')) { chdir(get_temp_dir()); $exec = $this->cmd . ' --headless -convert-to pdf ' . escapeshellarg($abspath); - exec($exec) + exec($exec); //create imagick object from pdf try{ From 78e8712366e2a198973f9a887c771894bef9a905 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Wed, 5 Jun 2013 11:17:29 +0200 Subject: [PATCH 047/170] update config.sample.php --- config/config.sample.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/config.sample.php b/config/config.sample.php index db6eaf852af..2f437771f2b 100644 --- a/config/config.sample.php +++ b/config/config.sample.php @@ -191,4 +191,6 @@ $CONFIG = array( 'preview_max_y' => null, /* the max factor to scale a preview, default is set to 10 */ 'preview_max_scale_factor' => 10, +/* custom path for libreoffice / openoffice binary */ +'preview_libreoffice_path' => '/usr/bin/libreoffice'; ); From 5c1d4fc186b692508f718c06218621bddcfd8f22 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Wed, 5 Jun 2013 11:18:57 +0200 Subject: [PATCH 048/170] yet another update for config.sample.php --- config/config.sample.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/config.sample.php b/config/config.sample.php index 2f437771f2b..2812d848133 100644 --- a/config/config.sample.php +++ b/config/config.sample.php @@ -192,5 +192,5 @@ $CONFIG = array( /* the max factor to scale a preview, default is set to 10 */ 'preview_max_scale_factor' => 10, /* custom path for libreoffice / openoffice binary */ -'preview_libreoffice_path' => '/usr/bin/libreoffice'; +'preview_libreoffice_path' => '/usr/bin/libreoffice', ); From 21cc4f6960618c41e81ca7e785a6d9e21c21ecf9 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Wed, 5 Jun 2013 12:44:31 +0200 Subject: [PATCH 049/170] make libreoffice preview backend work :D --- lib/preview/libreoffice-cl.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/preview/libreoffice-cl.php b/lib/preview/libreoffice-cl.php index 1b8e482fb23..5121a4c5a08 100644 --- a/lib/preview/libreoffice-cl.php +++ b/lib/preview/libreoffice-cl.php @@ -26,11 +26,13 @@ if (extension_loaded('imagick')) { $abspath = $fileview->toTmpFile($path); - chdir(get_temp_dir()); + $tmpdir = get_temp_dir(); + + $exec = $this->cmd . ' --headless --nologo --nofirststartwizard --invisible --norestore -convert-to pdf -outdir ' . escapeshellarg($tmpdir) . ' ' . escapeshellarg($abspath); + $export = 'export HOME=/tmp'; + + shell_exec($export . "\n" . $exec); - $exec = $this->cmd . ' --headless -convert-to pdf ' . escapeshellarg($abspath); - exec($exec); - //create imagick object from pdf try{ $pdf = new \imagick($abspath . '.pdf' . '[0]'); @@ -43,7 +45,8 @@ if (extension_loaded('imagick')) { $image = new \OC_Image($pdf); unlink($abspath); - unlink($tmppath); + unlink($abspath . '.pdf'); + if (!$image->valid()) return false; return $image; From f80aba48935e7325effaa65f899922927157028a Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Wed, 5 Jun 2013 12:58:39 +0200 Subject: [PATCH 050/170] use tmpdir var instead of hardcoded /tmp --- lib/preview/libreoffice-cl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/preview/libreoffice-cl.php b/lib/preview/libreoffice-cl.php index 5121a4c5a08..33fa7a04e5d 100644 --- a/lib/preview/libreoffice-cl.php +++ b/lib/preview/libreoffice-cl.php @@ -29,7 +29,7 @@ if (extension_loaded('imagick')) { $tmpdir = get_temp_dir(); $exec = $this->cmd . ' --headless --nologo --nofirststartwizard --invisible --norestore -convert-to pdf -outdir ' . escapeshellarg($tmpdir) . ' ' . escapeshellarg($abspath); - $export = 'export HOME=/tmp'; + $export = 'export HOME=/' . $tmpdir; shell_exec($export . "\n" . $exec); From 25e8ac1c2f51e7f3f35eaec013aa1b3f8356f17b Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Mon, 10 Jun 2013 11:01:12 +0200 Subject: [PATCH 051/170] implement previews for single shared files --- lib/preview.php | 41 +++++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/lib/preview.php b/lib/preview.php index f9f1288cb98..904689bc4e1 100755 --- a/lib/preview.php +++ b/lib/preview.php @@ -557,31 +557,40 @@ class Preview { if(array_key_exists('y', $_GET)) $maxY = (int) $_GET['y']; if(array_key_exists('scalingup', $_GET)) $scalingup = (bool) $_GET['scalingup']; if(array_key_exists('t', $_GET)) $token = (string) $_GET['t']; - + $linkItem = \OCP\Share::getShareByToken($token); - + if (is_array($linkItem) && isset($linkItem['uid_owner']) && isset($linkItem['file_source'])) { $userid = $linkItem['uid_owner']; \OC_Util::setupFS($userid); + $pathid = $linkItem['file_source']; $path = \OC\Files\Filesystem::getPath($pathid); - } - - //clean up file parameter - $file = \OC\Files\Filesystem::normalizePath($file); - if(!\OC\Files\Filesystem::isValidPath($file)) { - \OC_Response::setStatus(403); - exit; + $pathinfo = \OC\Files\Filesystem::getFileInfo($path); + + $sharedfile = null; + if($linkItem['item_type'] === 'folder') { + //clean up file parameter + $sharedfile = \OC\Files\Filesystem::normalizePath($file); + if(!\OC\Files\Filesystem::isValidPath($file)) { + \OC_Response::setStatus(403); + exit; + } + } else if($linkItem['item_type'] === 'file') { + $parent = $pathinfo['parent']; + $path = \OC\Files\Filesystem::getPath($parent); + $sharedfile = $pathinfo['name']; + } + + $path = \OC\Files\Filesystem::normalizePath($path, false); + if(substr($path, 0, 1) == '/') { + $path = substr($path, 1); + } } - $path = \OC\Files\Filesystem::normalizePath($path, false); - if(substr($path, 0, 1) == '/') { - $path = substr($path, 1); - } - - if($userid !== null && $path !== null) { + if($userid !== null && $path !== null && $sharedfile !== null) { try{ - $preview = new Preview($userid, 'files/' . $path, $file, $maxX, $maxY, $scalingup); + $preview = new Preview($userid, 'files/' . $path, $sharedfile, $maxX, $maxY, $scalingup); $preview->showPreview(); }catch(\Exception $e) { \OC_Response::setStatus(404); From 0e4f5001d5143f55a9d051b501fe32de900917c5 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Tue, 11 Jun 2013 10:45:50 +0200 Subject: [PATCH 052/170] don't crop Y axis --- lib/preview.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/preview.php b/lib/preview.php index 904689bc4e1..ed33e7b09dc 100755 --- a/lib/preview.php +++ b/lib/preview.php @@ -427,7 +427,8 @@ class Preview { if($newXsize >= $x && $newYsize >= $y) { $cropX = floor(abs($x - $newXsize) * 0.5); - $cropY = floor(abs($y - $newYsize) * 0.5); + //$cropY = floor(abs($y - $newYsize) * 0.5); + $cropY = 0; $image->crop($cropX, $cropY, $x, $y); From 2ff97917e9e72b674de07ca05dc04dd3bea14f07 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Tue, 11 Jun 2013 10:56:16 +0200 Subject: [PATCH 053/170] code optimization --- lib/preview/images.php | 5 +---- lib/preview/movies.php | 5 ++--- lib/preview/mp3.php | 4 +--- lib/preview/pdf.php | 4 +--- lib/preview/svg.php | 4 +--- lib/preview/txt.php | 4 +--- 6 files changed, 7 insertions(+), 19 deletions(-) diff --git a/lib/preview/images.php b/lib/preview/images.php index 080e424e5bd..e4041538e92 100644 --- a/lib/preview/images.php +++ b/lib/preview/images.php @@ -26,10 +26,7 @@ class Image extends Provider { $image->loadFromFile($fileview->getLocalFile($path)); } - //check if image object is valid - if (!$image->valid()) return false; - - return $image; + return $image->valid() ? $image : false; } } diff --git a/lib/preview/movies.php b/lib/preview/movies.php index 8cd50263e2a..cb959a962a7 100644 --- a/lib/preview/movies.php +++ b/lib/preview/movies.php @@ -27,14 +27,13 @@ if(!is_null(shell_exec('ffmpeg -version'))) { $cmd = 'ffmpeg -y -i ' . escapeshellarg($abspath) . ' -f mjpeg -vframes 1 -ss 1 ' . escapeshellarg($tmppath); shell_exec($cmd); - unlink($abspath); $image = new \OC_Image($tmppath); - if (!$image->valid()) return false; + unlink($abspath); unlink($tmppath); - return $image; + return $image->valid() ? $image : false; } } diff --git a/lib/preview/mp3.php b/lib/preview/mp3.php index 660e9fc3ce4..60dfb5ff461 100644 --- a/lib/preview/mp3.php +++ b/lib/preview/mp3.php @@ -28,9 +28,7 @@ class MP3 extends Provider { unlink($tmppath); $image = new \OC_Image($picture); - if (!$image->valid()) return $this->getNoCoverThumbnail($maxX, $maxY); - - return $image; + return $image->valid() ? $image : $this->getNoCoverThumbnail($maxX, $maxY); } public function getNoCoverThumbnail($maxX, $maxY) { diff --git a/lib/preview/pdf.php b/lib/preview/pdf.php index f1d0a33dc63..3eabd201156 100644 --- a/lib/preview/pdf.php +++ b/lib/preview/pdf.php @@ -32,9 +32,7 @@ if (extension_loaded('imagick')) { //new image object $image = new \OC_Image($pdf); //check if image object is valid - if (!$image->valid()) return false; - - return $image; + return $image->valid() ? $image : false; } } diff --git a/lib/preview/svg.php b/lib/preview/svg.php index 76d81589bac..bafaf71b15a 100644 --- a/lib/preview/svg.php +++ b/lib/preview/svg.php @@ -35,9 +35,7 @@ if (extension_loaded('imagick')) { //new image object $image = new \OC_Image($svg); //check if image object is valid - if (!$image->valid()) return false; - - return $image; + return $image->valid() ? $image : false; } } diff --git a/lib/preview/txt.php b/lib/preview/txt.php index f18da66c3b8..c7b8fabc6b0 100644 --- a/lib/preview/txt.php +++ b/lib/preview/txt.php @@ -42,9 +42,7 @@ class TXT extends Provider { $image = new \OC_Image($image); - if (!$image->valid()) return false; - - return $image; + return $image->valid() ? $image : false; } } From 28cf63d37d6a2b90ae32a2b5b7193a5f5c69830d Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Tue, 11 Jun 2013 11:00:44 +0200 Subject: [PATCH 054/170] check if imagick is loaded in office.php, not in libreoffice-cl.php --- lib/preview/libreoffice-cl.php | 93 ++++++++++++++++------------------ lib/preview/office.php | 17 ++++--- 2 files changed, 54 insertions(+), 56 deletions(-) diff --git a/lib/preview/libreoffice-cl.php b/lib/preview/libreoffice-cl.php index 33fa7a04e5d..2749c4867e9 100644 --- a/lib/preview/libreoffice-cl.php +++ b/lib/preview/libreoffice-cl.php @@ -8,71 +8,66 @@ namespace OC\Preview; //we need imagick to convert -if (extension_loaded('imagick')) { +class Office extends Provider { - class Office extends Provider { + private $cmd; - private $cmd; + public function getMimeType() { + return null; + } - public function getMimeType() { - return null; + public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) { + $this->initCmd(); + if(is_null($this->cmd)) { + return false; } - public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) { - $this->initCmd(); - if(is_null($this->cmd)) { - return false; - } + $abspath = $fileview->toTmpFile($path); - $abspath = $fileview->toTmpFile($path); + $tmpdir = get_temp_dir(); - $tmpdir = get_temp_dir(); + $exec = $this->cmd . ' --headless --nologo --nofirststartwizard --invisible --norestore -convert-to pdf -outdir ' . escapeshellarg($tmpdir) . ' ' . escapeshellarg($abspath); + $export = 'export HOME=/' . $tmpdir; - $exec = $this->cmd . ' --headless --nologo --nofirststartwizard --invisible --norestore -convert-to pdf -outdir ' . escapeshellarg($tmpdir) . ' ' . escapeshellarg($abspath); - $export = 'export HOME=/' . $tmpdir; + shell_exec($export . "\n" . $exec); - shell_exec($export . "\n" . $exec); - - //create imagick object from pdf - try{ - $pdf = new \imagick($abspath . '.pdf' . '[0]'); - $pdf->setImageFormat('jpg'); - }catch(\Exception $e){ - \OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR); - return false; - } - - $image = new \OC_Image($pdf); - - unlink($abspath); - unlink($abspath . '.pdf'); - - if (!$image->valid()) return false; - - return $image; + //create imagick object from pdf + try{ + $pdf = new \imagick($abspath . '.pdf' . '[0]'); + $pdf->setImageFormat('jpg'); + }catch(\Exception $e){ + \OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR); + return false; } - private function initCmd() { - $cmd = ''; + $image = new \OC_Image($pdf); - if(is_string(\OC_Config::getValue('preview_libreoffice_path', null))) { - $cmd = \OC_Config::getValue('preview_libreoffice_path', null); - } + unlink($abspath); + unlink($abspath . '.pdf'); - if($cmd === '' && shell_exec('libreoffice --headless --version')) { - $cmd = 'libreoffice'; - } + return $image->valid() ? $image : false; + } - if($cmd === '' && shell_exec('openoffice --headless --version')) { - $cmd = 'openoffice'; - } + private function initCmd() { + $cmd = ''; - if($cmd === '') { - $cmd = null; - } - - $this->cmd = $cmd; + if(is_string(\OC_Config::getValue('preview_libreoffice_path', null))) { + $cmd = \OC_Config::getValue('preview_libreoffice_path', null); } + + if($cmd === '' && shell_exec('libreoffice --headless --version')) { + $cmd = 'libreoffice'; + } + + if($cmd === '' && shell_exec('openoffice --headless --version')) { + $cmd = 'openoffice'; + } + + if($cmd === '') { + $cmd = null; + } + + $this->cmd = $cmd; } } diff --git a/lib/preview/office.php b/lib/preview/office.php index cc1addf3996..20f545ef337 100644 --- a/lib/preview/office.php +++ b/lib/preview/office.php @@ -5,11 +5,14 @@ * later. * See the COPYING-README file. */ -//let's see if there is libreoffice or openoffice on this machine -if(shell_exec('libreoffice --headless --version') || shell_exec('openoffice --headless --version') || is_string(\OC_Config::getValue('preview_libreoffice_path', null))) { - require_once('libreoffice-cl.php'); -}else{ - //in case there isn't, use our fallback - require_once('msoffice.php'); - require_once('opendocument.php'); +//both, libreoffice backend and php fallback, need imagick +if (extension_loaded('imagick')) { + //let's see if there is libreoffice or openoffice on this machine + if(shell_exec('libreoffice --headless --version') || shell_exec('openoffice --headless --version') || is_string(\OC_Config::getValue('preview_libreoffice_path', null))) { + require_once('libreoffice-cl.php'); + }else{ + //in case there isn't, use our fallback + require_once('msoffice.php'); + require_once('opendocument.php'); + } } \ No newline at end of file From 67816da0bfe16ecb58d3a3bdb70c1fb9a79cff75 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Tue, 11 Jun 2013 13:15:24 +0200 Subject: [PATCH 055/170] save current work state of office fallback --- lib/preview/msoffice.php | 111 ++++++++++++++++++++++++----------- lib/preview/opendocument.php | 12 ++++ 2 files changed, 89 insertions(+), 34 deletions(-) diff --git a/lib/preview/msoffice.php b/lib/preview/msoffice.php index c99ca313c72..4fedb735c95 100644 --- a/lib/preview/msoffice.php +++ b/lib/preview/msoffice.php @@ -7,22 +7,24 @@ */ namespace OC\Preview; -class MSOffice2003 extends Provider { +class DOC extends Provider { - public function getMimeType(){ - return null; + public function getMimeType() { + return '/application\/msword/'; } - public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview){ - return false; + public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) { + } + } +\OC\Preview::registerProvider('OC\Preview\DOC'); -class MSOffice2007 extends Provider { +class DOCX extends Provider { - public function getMimeType(){ - return null; + public function getMimeType() { + return '/application\/vnd.openxmlformats-officedocument.wordprocessingml.document/'; } public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) { @@ -39,36 +41,50 @@ class MSOffice2007 extends Provider { unlink($tmpdoc); - //new image object $image = new \OC_Image($pdf); - //check if image object is valid - if (!$image->valid()) return false; - - return $image; - } -} - -class DOC extends MSOffice2003 { - - public function getMimeType() { - return '/application\/msword/'; - } - -} - -\OC\Preview::registerProvider('OC\Preview\DOC'); - -class DOCX extends MSOffice2007 { - - public function getMimeType() { - return '/application\/vnd.openxmlformats-officedocument.wordprocessingml.document/'; + + return $image->valid() ? $image : false; } } \OC\Preview::registerProvider('OC\Preview\DOCX'); -class XLS extends MSOffice2003 { +class MSOfficeExcel extends Provider { + + public function getMimeType() { + return null; + } + + public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) { + require_once('PHPExcel/Classes/PHPExcel.php'); + require_once('PHPExcel/Classes/PHPExcel/IOFactory.php'); + //require_once('mpdf/mpdf.php'); + + $abspath = $fileview->toTmpFile($path); + $tmppath = \OC_Helper::tmpFile(); + + $rendererName = \PHPExcel_Settings::PDF_RENDERER_DOMPDF; + $rendererLibraryPath = \OC::$THIRDPARTYROOT . '/dompdf'; + + \PHPExcel_Settings::setPdfRenderer($rendererName, $rendererLibraryPath); + + $phpexcel = new \PHPExcel($abspath); + $excel = \PHPExcel_IOFactory::createWriter($phpexcel, 'PDF'); + $excel->save($tmppath); + + $pdf = new \imagick($tmppath . '[0]'); + $pdf->setImageFormat('jpg'); + + unlink($abspath); + unlink($tmppath); + + return $image->valid() ? $image : false; + } + +} + +class XLS extends MSOfficeExcel { public function getMimeType() { return '/application\/vnd.ms-excel/'; @@ -78,7 +94,7 @@ class XLS extends MSOffice2003 { \OC\Preview::registerProvider('OC\Preview\XLS'); -class XLSX extends MSOffice2007 { +class XLSX extends MSOfficeExcel { public function getMimeType() { return '/application\/vnd.openxmlformats-officedocument.spreadsheetml.sheet/'; @@ -88,7 +104,34 @@ class XLSX extends MSOffice2007 { \OC\Preview::registerProvider('OC\Preview\XLSX'); -class PPT extends MSOffice2003 { +class MSOfficePowerPoint extends Provider { + + public function getMimeType() { + return null; + } + + public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) { + //require_once(''); + //require_once(''); + + $abspath = $fileview->toTmpFile($path); + $tmppath = \OC_Helper::tmpFile(); + + $excel = PHPPowerPoint_IOFactory::createWriter($abspath, 'PDF'); + $excel->save($tmppath); + + $pdf = new \imagick($tmppath . '[0]'); + $pdf->setImageFormat('jpg'); + + unlink($abspath); + unlink($tmppath); + + return $image->valid() ? $image : false; + } + +} + +class PPT extends MSOfficePowerPoint { public function getMimeType() { return '/application\/vnd.ms-powerpoint/'; @@ -98,7 +141,7 @@ class PPT extends MSOffice2003 { \OC\Preview::registerProvider('OC\Preview\PPT'); -class PPTX extends MSOffice2007 { +class PPTX extends MSOfficePowerPoint { public function getMimeType() { return '/application\/vnd.openxmlformats-officedocument.presentationml.presentation/'; diff --git a/lib/preview/opendocument.php b/lib/preview/opendocument.php index e69de29bb2d..786a038ff82 100644 --- a/lib/preview/opendocument.php +++ b/lib/preview/opendocument.php @@ -0,0 +1,12 @@ + Date: Wed, 12 Jun 2013 11:40:01 +0200 Subject: [PATCH 056/170] finish implementation of Excel preview fallback --- lib/preview/msoffice.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/preview/msoffice.php b/lib/preview/msoffice.php index 4fedb735c95..c2e39d00d94 100644 --- a/lib/preview/msoffice.php +++ b/lib/preview/msoffice.php @@ -42,7 +42,7 @@ class DOCX extends Provider { unlink($tmpdoc); $image = new \OC_Image($pdf); - + return $image->valid() ? $image : false; } @@ -65,7 +65,7 @@ class MSOfficeExcel extends Provider { $tmppath = \OC_Helper::tmpFile(); $rendererName = \PHPExcel_Settings::PDF_RENDERER_DOMPDF; - $rendererLibraryPath = \OC::$THIRDPARTYROOT . '/dompdf'; + $rendererLibraryPath = \OC::$THIRDPARTYROOT . '/3rdparty/dompdf'; \PHPExcel_Settings::setPdfRenderer($rendererName, $rendererLibraryPath); @@ -79,6 +79,8 @@ class MSOfficeExcel extends Provider { unlink($abspath); unlink($tmppath); + $image = new \OC_Image($pdf); + return $image->valid() ? $image : false; } From 1f52ad0363e2cff05e2058d31317b580c27e2c31 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Wed, 12 Jun 2013 13:20:59 +0200 Subject: [PATCH 057/170] work on powerpoint fallback --- lib/preview/msoffice.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/preview/msoffice.php b/lib/preview/msoffice.php index c2e39d00d94..65886169e9a 100644 --- a/lib/preview/msoffice.php +++ b/lib/preview/msoffice.php @@ -59,7 +59,6 @@ class MSOfficeExcel extends Provider { public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) { require_once('PHPExcel/Classes/PHPExcel.php'); require_once('PHPExcel/Classes/PHPExcel/IOFactory.php'); - //require_once('mpdf/mpdf.php'); $abspath = $fileview->toTmpFile($path); $tmppath = \OC_Helper::tmpFile(); @@ -113,14 +112,12 @@ class MSOfficePowerPoint extends Provider { } public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) { - //require_once(''); - //require_once(''); + return false; $abspath = $fileview->toTmpFile($path); $tmppath = \OC_Helper::tmpFile(); - $excel = PHPPowerPoint_IOFactory::createWriter($abspath, 'PDF'); - $excel->save($tmppath); + null; $pdf = new \imagick($tmppath . '[0]'); $pdf->setImageFormat('jpg'); @@ -128,6 +125,8 @@ class MSOfficePowerPoint extends Provider { unlink($abspath); unlink($tmppath); + $image = new \OC_Image($pdf); + return $image->valid() ? $image : false; } From f89a23b463884e1a9b89c84fdcb1c34afba62645 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Wed, 12 Jun 2013 16:18:16 +0200 Subject: [PATCH 058/170] implement unknown preview backend --- lib/preview/unknown.php | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/lib/preview/unknown.php b/lib/preview/unknown.php index 6b161424917..6e1dc06c1bc 100644 --- a/lib/preview/unknown.php +++ b/lib/preview/unknown.php @@ -15,12 +15,24 @@ class Unknown extends Provider { } public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) { - /*$mimetype = $fileview->getMimeType($path); - $info = $fileview->getFileInfo($path); - $name = array_key_exists('name', $info) ? $info['name'] : ''; - $size = array_key_exists('size', $info) ? $info['size'] : 0; - $isencrypted = array_key_exists('encrypted', $info) ? $info['encrypted'] : false;*/ // show little lock - return new \OC_Image(); + $mimetype = $fileview->getMimeType($path); + if(substr_count($mimetype, '/')) { + list($type, $subtype) = explode('/', $mimetype); + } + + $iconsroot = \OC::$SERVERROOT . '/core/img/filetypes/'; + + $icons = array($mimetype, $type, 'text'); + foreach($icons as $icon) { + $icon = str_replace('/', '-', $icon); + + $iconpath = $iconsroot . $icon . '.png'; + + if(file_exists($iconpath)) { + return new \OC_Image($iconpath); + } + } + return false; } } From 25981a079a185080ad3ca2d2a23dd827efbd9d05 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Thu, 13 Jun 2013 09:52:39 +0200 Subject: [PATCH 059/170] some whitespace fixes --- lib/preview.php | 11 ++++++----- lib/preview/unknown.php | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/preview.php b/lib/preview.php index ed33e7b09dc..3564fe3df44 100755 --- a/lib/preview.php +++ b/lib/preview.php @@ -41,6 +41,7 @@ class Preview { private $maxY; private $scalingup; + //preview images object private $preview; //preview providers @@ -81,7 +82,7 @@ class Preview { $this->maxX = $this->max_x; } } - + if(!is_null($this->max_y)) { if($this->maxY > $this->max_y) { \OC_Log::write('core', 'maxY reduced from ' . $this->maxY . ' to ' . $this->max_y, \OC_Log::DEBUG); @@ -101,25 +102,25 @@ class Preview { if(empty(self::$providers)) { self::initProviders(); } - + //check if there are any providers at all if(empty(self::$providers)) { \OC_Log::write('core', 'No preview providers exist', \OC_Log::ERROR); throw new \Exception('No providers'); } - + //validate parameters if($file === '') { \OC_Log::write('core', 'No filename passed', \OC_Log::ERROR); throw new \Exception('File not found'); } - + //check if file exists if(!$this->fileview->file_exists($file)) { \OC_Log::write('core', 'File:"' . $file . '" not found', \OC_Log::ERROR); throw new \Exception('File not found'); } - + //check if given size makes sense if($maxX === 0 || $maxY === 0) { \OC_Log::write('core', 'Can not create preview with 0px width or 0px height', \OC_Log::ERROR); diff --git a/lib/preview/unknown.php b/lib/preview/unknown.php index 6e1dc06c1bc..4e1ca7de741 100644 --- a/lib/preview/unknown.php +++ b/lib/preview/unknown.php @@ -36,4 +36,4 @@ class Unknown extends Provider { } } -\OC\Preview::registerProvider('OC\Preview\Unknown'); +\OC\Preview::registerProvider('OC\Preview\Unknown'); \ No newline at end of file From 6082a0649cefd356370d4ca8034041c1af3875ff Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Mon, 17 Jun 2013 12:27:26 +0200 Subject: [PATCH 060/170] stream first mb of movie to create preview --- lib/preview/movies.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/preview/movies.php b/lib/preview/movies.php index cb959a962a7..8531050d112 100644 --- a/lib/preview/movies.php +++ b/lib/preview/movies.php @@ -17,16 +17,18 @@ if(!is_null(shell_exec('ffmpeg -version'))) { } public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) { - //get fileinfo - $fileinfo = $fileview->getFileInfo($path); - - $abspath = $fileview->toTmpFile($path); + $abspath = \OC_Helper::tmpFile(); $tmppath = \OC_Helper::tmpFile(); - //$cmd = 'ffmpeg -y -i ' . escapeshellarg($abspath) . ' -f mjpeg -vframes 1 -ss 1 -s ' . escapeshellarg($maxX) . 'x' . escapeshellarg($maxY) . ' ' . $tmppath; - $cmd = 'ffmpeg -y -i ' . escapeshellarg($abspath) . ' -f mjpeg -vframes 1 -ss 1 ' . escapeshellarg($tmppath); - shell_exec($cmd); + $handle = $fileview->fopen($path, 'rb'); + $firstmb = stream_get_contents($handle, 1048576); //1024 * 1024 = 1048576 + file_put_contents($abspath, $firstmb); + + //$cmd = 'ffmpeg -y -i ' . escapeshellarg($abspath) . ' -f mjpeg -vframes 1 -ss 1 -s ' . escapeshellarg($maxX) . 'x' . escapeshellarg($maxY) . ' ' . $tmppath; + $cmd = 'ffmpeg -an -y -i ' . escapeshellarg($abspath) . ' -f mjpeg -vframes 1 -ss 1 ' . escapeshellarg($tmppath); + + shell_exec($cmd); $image = new \OC_Image($tmppath); From bea4376fd48e714b121e1abb54f9bd786e89c877 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Tue, 18 Jun 2013 11:04:08 +0200 Subject: [PATCH 061/170] remove opendocument.php --- lib/preview/office.php | 1 - lib/preview/opendocument.php | 12 ------------ 2 files changed, 13 deletions(-) delete mode 100644 lib/preview/opendocument.php diff --git a/lib/preview/office.php b/lib/preview/office.php index 20f545ef337..b6783bc5798 100644 --- a/lib/preview/office.php +++ b/lib/preview/office.php @@ -13,6 +13,5 @@ if (extension_loaded('imagick')) { }else{ //in case there isn't, use our fallback require_once('msoffice.php'); - require_once('opendocument.php'); } } \ No newline at end of file diff --git a/lib/preview/opendocument.php b/lib/preview/opendocument.php deleted file mode 100644 index 786a038ff82..00000000000 --- a/lib/preview/opendocument.php +++ /dev/null @@ -1,12 +0,0 @@ - Date: Tue, 18 Jun 2013 13:53:02 +0200 Subject: [PATCH 062/170] use ppt icon instead of preview --- lib/preview/msoffice.php | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/lib/preview/msoffice.php b/lib/preview/msoffice.php index 65886169e9a..262582f0216 100644 --- a/lib/preview/msoffice.php +++ b/lib/preview/msoffice.php @@ -14,7 +14,7 @@ class DOC extends Provider { } public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) { - + require_once(); } } @@ -105,6 +105,7 @@ class XLSX extends MSOfficeExcel { \OC\Preview::registerProvider('OC\Preview\XLSX'); +/* //There is no (good) php-only solution for converting powerpoint documents to pdfs / pngs ... class MSOfficePowerPoint extends Provider { public function getMimeType() { @@ -113,21 +114,6 @@ class MSOfficePowerPoint extends Provider { public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) { return false; - - $abspath = $fileview->toTmpFile($path); - $tmppath = \OC_Helper::tmpFile(); - - null; - - $pdf = new \imagick($tmppath . '[0]'); - $pdf->setImageFormat('jpg'); - - unlink($abspath); - unlink($tmppath); - - $image = new \OC_Image($pdf); - - return $image->valid() ? $image : false; } } @@ -150,4 +136,5 @@ class PPTX extends MSOfficePowerPoint { } -\OC\Preview::registerProvider('OC\Preview\PPTX'); \ No newline at end of file +\OC\Preview::registerProvider('OC\Preview\PPTX'); +*/ \ No newline at end of file From 1fcbf8dd7ac69bfce888cc61084a72919503fd05 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Wed, 19 Jun 2013 10:21:55 +0200 Subject: [PATCH 063/170] implemenet getNoCoverThumbnail --- lib/preview/mp3.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/preview/mp3.php b/lib/preview/mp3.php index 60dfb5ff461..835ff529000 100644 --- a/lib/preview/mp3.php +++ b/lib/preview/mp3.php @@ -20,7 +20,6 @@ class MP3 extends Provider { $tmppath = $fileview->toTmpFile($path); - //Todo - add stream support $tags = $getID3->analyze($tmppath); \getid3_lib::CopyTagsToComments($tags); $picture = @$tags['id3v2']['APIC'][0]['data']; @@ -32,8 +31,14 @@ class MP3 extends Provider { } public function getNoCoverThumbnail($maxX, $maxY) { - $image = new \OC_Image(); - return $image; + $icon = \OC::$SERVERROOT . '/core/img/filetypes/audio.png'; + + if(!file_exists($icon)) { + return false; + } + + $image = new \OC_Image($icon); + return $image->valid() ? $image : false; } } From fb67b458412241cb91c01bdb339d1a4317aeacab Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Wed, 19 Jun 2013 13:40:57 +0200 Subject: [PATCH 064/170] comment out old code --- lib/preview/msoffice.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/preview/msoffice.php b/lib/preview/msoffice.php index 262582f0216..ccf1d674c7a 100644 --- a/lib/preview/msoffice.php +++ b/lib/preview/msoffice.php @@ -7,6 +7,7 @@ */ namespace OC\Preview; +/* //There is no (good) php-only solution for converting 2003 word documents to pdfs / pngs ... class DOC extends Provider { public function getMimeType() { @@ -14,12 +15,13 @@ class DOC extends Provider { } public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) { - require_once(); + require_once(''); } } \OC\Preview::registerProvider('OC\Preview\DOC'); +*/ class DOCX extends Provider { From efe4bfc693ce98fc45e6a003f9bedd0d9da1d1af Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Wed, 19 Jun 2013 13:43:11 +0200 Subject: [PATCH 065/170] update 3rdparty submodule --- 3rdparty | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/3rdparty b/3rdparty index 3ef9f738a91..0a8f54ed446 160000 --- a/3rdparty +++ b/3rdparty @@ -1 +1 @@ -Subproject commit 3ef9f738a9107879dddc7d97842cf4d2198fae4c +Subproject commit 0a8f54ed446d9c0d56f8abff3bdb18fcaa6f561b From 1a8e4399b0084a2769bbf43f0ba417c547ac931c Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Tue, 25 Jun 2013 15:08:51 +0200 Subject: [PATCH 066/170] increase Files row height to tappable 44px, more breathing space --- apps/files/css/files.css | 56 +++++++++++++++++++++++++++++++++------- 1 file changed, 47 insertions(+), 9 deletions(-) diff --git a/apps/files/css/files.css b/apps/files/css/files.css index 108dcd741c6..be29186cbb7 100644 --- a/apps/files/css/files.css +++ b/apps/files/css/files.css @@ -62,7 +62,10 @@ color:#888; text-shadow:#fff 0 1px 0; } #filestable { position: relative; top:37px; width:100%; } -tbody tr { background-color:#fff; height:2.5em; } +tbody tr { + background-color: #fff; + height: 44px; +} tbody tr:hover, tbody tr:active { background-color: rgb(240,240,240); } @@ -75,12 +78,25 @@ span.extension { text-transform:lowercase; -ms-filter:"progid:DXImageTransform.M tr:hover span.extension { -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; filter:alpha(opacity=100); opacity:1; color:#777; } table tr.mouseOver td { background-color:#eee; } table th { height:2em; padding:0 .5em; color:#999; } -table th .name { float:left; margin-left:.5em; } +table th .name { + float: left; + margin-left: 17px; +} table th, table td { border-bottom:1px solid #ddd; text-align:left; font-weight:normal; } -table td { border-bottom:1px solid #eee; font-style:normal; background-position:1em .5em; background-repeat:no-repeat; } +table td { + border-bottom: 1px solid #eee; + font-style: normal; + background-position: 8px center; + background-repeat: no-repeat; +} table th#headerName { width:100em; /* not really sure why this works better than 100% … table styling */ } table th#headerSize, table td.filesize { min-width:3em; padding:0 1em; text-align:right; } -table th#headerDate, table td.date { min-width:11em; padding:0 .1em 0 1em; text-align:left; } +table th#headerDate, table td.date { + position: relative; + min-width: 11em; + padding:0 .1em 0 1em; + text-align:left; +} /* Multiselect bar */ #filestable.multiselect { top:63px; } @@ -93,13 +109,29 @@ table.multiselect thead th { } table.multiselect #headerName { width: 100%; } table td.selection, table th.selection, table td.fileaction { width:2em; text-align:center; } -table td.filename a.name { display:block; height:1.5em; vertical-align:middle; margin-left:3em; } +table td.filename a.name { + box-sizing: border-box; + display: block; + height: 44px; + vertical-align: middle; + margin-left: 50px; +} table tr[data-type="dir"] td.filename a.name span.nametext {font-weight:bold; } table td.filename input.filename { width:100%; cursor:text; } table td.filename a, table td.login, table td.logout, table td.download, table td.upload, table td.create, table td.delete { padding:.2em .5em .5em 0; } table td.filename .nametext, .uploadtext, .modified { float:left; padding:.3em 0; } +.modified { + position: absolute; + top: 10px; +} /* TODO fix usability bug (accidental file/folder selection) */ -table td.filename .nametext { overflow:hidden; text-overflow:ellipsis; max-width:800px; } +table td.filename .nametext { + position: absolute; + top: 10px; + overflow: hidden; + text-overflow: ellipsis; + max-width: 800px; +} table td.filename .uploadtext { font-weight:normal; margin-left:.5em; } table td.filename form { font-size:.85em; margin-left:3em; margin-right:3em; } @@ -119,8 +151,10 @@ table td.filename form { font-size:.85em; margin-left:3em; margin-right:3em; } /* File actions */ .fileactions { - position:absolute; top:.6em; right:0; - font-size:.8em; + position: absolute; + top: 13px; + right: 0; + font-size: 11px; } #fileList .name { position:relative; /* Firefox needs to explicitly have this default set … */ } #fileList tr:hover .fileactions { /* background to distinguish when overlaying with file names */ @@ -132,7 +166,11 @@ table td.filename form { font-size:.85em; margin-left:3em; margin-right:3em; } box-shadow: -5px 0 7px rgba(230,230,230,.9); } #fileList .fileactions a.action img { position:relative; top:.2em; } -#fileList a.action { display:inline; margin:-.5em 0; padding:1em .5em 1em .5em !important; } +#fileList a.action { + display: inline; + margin: -.5em 0; + padding: 16px 8px !important; +} #fileList img.move2trash { display:inline; margin:-.5em 0; padding:1em .5em 1em .5em !important; float:right; } a.action.delete { float:right; } a.action>img { max-height:16px; max-width:16px; vertical-align:text-bottom; } From dc65482d50ae274b0db12cadce25f6fff0c86671 Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Tue, 25 Jun 2013 17:57:38 +0200 Subject: [PATCH 067/170] first round of replacing small filetype icons with proper ones, from Elementary --- core/img/filetypes/application-pdf.png | Bin 591 -> 1759 bytes core/img/filetypes/application-pdf.svg | 277 +++++++ core/img/filetypes/application-rss+xml.png | Bin 691 -> 1098 bytes core/img/filetypes/application-rss+xml.svg | 914 +++++++++++++++++++++ core/img/filetypes/application.png | Bin 464 -> 1235 bytes core/img/filetypes/application.svg | 320 ++++++++ core/img/filetypes/audio.png | Bin 385 -> 858 bytes core/img/filetypes/audio.svg | 274 ++++++ core/img/filetypes/code.png | Bin 603 -> 908 bytes core/img/filetypes/code.svg | 359 ++++++++ core/img/filetypes/file.png | Bin 294 -> 374 bytes core/img/filetypes/file.svg | 197 +++++ core/img/filetypes/flash.png | Bin 580 -> 954 bytes core/img/filetypes/flash.svg | 310 +++++++ core/img/filetypes/folder.png | Bin 537 -> 709 bytes core/img/filetypes/folder.svg | 329 ++++++++ core/img/filetypes/font.png | Bin 813 -> 1793 bytes core/img/filetypes/font.svg | 338 ++++++++ core/img/filetypes/image-svg+xml.png | Bin 481 -> 959 bytes core/img/filetypes/image-svg+xml.svg | 666 +++++++++++++++ core/img/filetypes/image.png | Bin 606 -> 978 bytes core/img/filetypes/image.svg | 321 ++++++++ core/img/filetypes/text-html.png | Bin 578 -> 741 bytes core/img/filetypes/text-html.svg | 280 +++++++ core/img/filetypes/text.png | Bin 342 -> 757 bytes core/img/filetypes/text.svg | 228 +++++ 26 files changed, 4813 insertions(+) create mode 100644 core/img/filetypes/application-pdf.svg create mode 100644 core/img/filetypes/application-rss+xml.svg create mode 100644 core/img/filetypes/application.svg create mode 100644 core/img/filetypes/audio.svg create mode 100644 core/img/filetypes/code.svg create mode 100644 core/img/filetypes/file.svg create mode 100644 core/img/filetypes/flash.svg create mode 100644 core/img/filetypes/folder.svg create mode 100644 core/img/filetypes/font.svg create mode 100644 core/img/filetypes/image-svg+xml.svg create mode 100644 core/img/filetypes/image.svg create mode 100644 core/img/filetypes/text-html.svg create mode 100644 core/img/filetypes/text.svg diff --git a/core/img/filetypes/application-pdf.png b/core/img/filetypes/application-pdf.png index 8f8095e46fa4965700afe1f9d065d8a37b101676..2cbcb741d84a8e1303608089a33e22180a0e4510 100644 GIT binary patch literal 1759 zcmV<51|a!~P)6y0bI$p6Bu6%zn&%#0xKS<6+L6nR(B9p8xxQ{?GrMF{;XqZ1#pm|33gATKwgs z#^mqmS+{FoZDmj7TmcKl7_b&hbCNa9p%uHRpo(EmQv#@;2)(;|HsMqT>8W{l9OP8^=S#UY1*NHHNRW*QsctO2@ zDyX7rFrugp=}>Eso(*(;;mgDwolK97@#pV+o6^iQao+&%Uwgl0$?35%EQB>OAGEO= z08v3j!bEFPtIZTBh`}cbxsN|g=O-S)ILE~kf8ebj{ebqwkpZT&!ct#rOitpO!BqrV zf}oWF2mnMuB`8c3v4&{JPP!la3{iVKS*^y|AHKrn-~NV5xj-p$%+xdD&Q8Kj3(Z<}bW;-~er!QOYM2qX;94_zY7l zh4Ne)!`MJ(Grdc5)B>Q^@X6Z!FM@LmKZF>w?{cmIqzbt(%3^d&rRVZ%0 zgT8OQNbZx5B3?iRBVaTb3#zRwSl4p@;+}50jj4Jg%v}O*nFvoj^DONH{jAx(o%Q$K z%laoi$Mn{_`1i{%W2YwP8E66S72~26Oei$B;a2LICtbk_muLVA@4d^FW5+qOe?Pzb z;?rCi8lwDxEeyQ$eHgr>sRL>0;w78|R(Sl`YL()~jbxb+>2f!00T3BeZ;NBP(wOcv zCB66#C!cwiH(xq{Nm2&B{sQLCElt`(UC-4xa||r%^;+1Lla5aEy|>`zuB`?@2^(LG zrQ{rKE@n-dFmdcSukYQ5iZHNmA9m~Ah{$|b5v+?^o?N`AR;z(3k#nrM{{b4AUzVj7 z0Mab4K&uiPD7%REIHrE~EGM7ai)5Znd%s5fq3sI{hy?py^z^gUSF5FoQACu2agKcD9C! zVvQw@la{oUw{4^0rM5U`iw}%eXMXX{)b!(hy}fZ1g-d2}$s0%%5})zcgNNAhjThMP z)Kgp=8zbrLB+Ie@#u(BxZP_vFv$MQ$_=t?oR$p5j)67k(R4Q#{Yd77VWshu0bGtC6 zqa`&jNvF?Te`&m(yX;U%d)z2?&|pX`25k?+~~jO{{au3n480DmkIy?002ovPDHLkV1k

~O9lw>B8WRlD)Gm}Jrz31u-X&&gn2lvjs=i{7nIaL6v2==uw+8Lcs(8j27 z;|c`rmSv@Lx!heopGP^^Ieb3f=R!%Lpp$}iMS-&P3EJ)s48wrJ_Ni0~k|c47D2nj= z{jS6bt|kFpFf|p5cM`_&0Zh|`rfEp0(}=}lT#(6RpzAsUfxv^LSYX>WlAaN$>)*J5 z0#sE+JRUD8iT9*fz{)_^7@6P&!sEjTcD+I9Z4YjT1`wH@fV{cEvneYGFU%maIEU2s55&K(LixD|{p-uiS@?KNj zk-Go8G$hH6g002ovPDHLkV1hVj1#|!a diff --git a/core/img/filetypes/application-pdf.svg b/core/img/filetypes/application-pdf.svg new file mode 100644 index 00000000000..3f9ad528afb --- /dev/null +++ b/core/img/filetypes/application-pdf.svg @@ -0,0 +1,277 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/img/filetypes/application-rss+xml.png b/core/img/filetypes/application-rss+xml.png index 315c4f4fa62cb720326ba3f54259666ba3999e42..e5bb322c5733e7d2961fd27e049e4249a0d2a5c1 100644 GIT binary patch literal 1098 zcmV-Q1hxB#P)a7G#|~(yYCzq z@9WOI*UT(}ap8kI_ua?4_y0Tpb3fjQnX#Fd+f?=c0sadB_3j7fp1*$%XG0(xEM=gw zcH28AcdQFw=+M|xQw>4D2}oM9Hd(t$!&0HNwzQ~W80U{1DRn6WsA6Ylu&WE;93l=} zT0)p^2n$42^V&?4_SWr~YHxs84ZH^*fjG=L5SP0lJpe3-noQgjyidmN1%N8%74bfe zI1^7CuuQlTfWmgu0>TXQDNHW_GfUFo4G{ye)OAVbWnTbEZDFlS)vj9tP*w1W3kcu@ zgT(sO{cEp~Oq?_o1%P->#_s8W8s=lnD<*=tgxXR7sfs>u!BURQ5!3YE$5=mez$~%f zVof4-X~be66mC@NXKA1_4H$S!RzxoVRYQG}21Ky9Y`aT>k1 zAZjUG52Md+!*Mg~v&b_yV#VUVQjpM^SDLS%Krj4^{&|}C!YuJG-yjt>cK6Sr0vPdq zuYx!SkdYgxjZ9M8J;?x|f6TJ>(QD|XbL$ZV03_)$z$>b89}Z~Yz|!|H*e{0)YNjfoeVpZT=EEKST864DR!H8GQT|wmdk+ z;1jQ6s3xxGex_dd2h`3A!;e~4_mk@l%$w2prO z1A{c4Ie^B3MyYTYjD^qQejNzrz`_gnv9SLEqMyE^e*0dU&mP2LSpE2I^snEk-MWYR zT@#(6QI~kwu9yR52duEp%%NBQX7Q~l+CO|r{f@m1J~V}{EYmvqDFC%y;}ua`DGlbe zawn`vLE*sY^ii%q^exid!SZ|401VvoFzS`)>?r{1V|zMsUzLWu^s@?76^mjtQlj&x zk)dI9WeJx(!D!<{m4x#cW&R-(B;K^tCj2s z?)N)2U4Hq{25xwiGYdbpQb1=l6TxbDZwj&S={?7%qx-u`rsG(Zp`-rh=e^=%((1yvsuf5d=&62Zj)Y zH&JviNS_F4_Hj|T(1j4$p-!}kixP9&dB4uv^MveG?dGf%sUCoc2!IFxD6wHRA2^dX zXRVk!-qSfk(jcaUKn#RP48(whfPlJUpApdrA!TQi_4D+fVoM;3I0gZ8{=Xv~Po;geVA+Em9@0Wq2 zr>OTZEGR05L=gf1T;ucCxq6Q6EgJiH@@-lVaAlQyw`jIF^c=&IVnj|95hHbE_cnt| zTzZQ?F4Ne@(bH(~&3nM%m)I@ID{@jJ2qZPjr)jhpe9hViOwH5k&|T#EmmL3(vHeUQ zq^!t^Al6JD;=mHq^Bg?J-8-zG2Od7gZbknG;K9czYjPqG*xjPo0k(c4%lPXTpw(qq z@aGMnxtFS(np+2kC} z7P02O874ZkJH$v#nCUVx$({yDN`IX@o2wyvTD#e`qN`_w5<}$3F+_ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/core/img/filetypes/application.png b/core/img/filetypes/application.png index 1dee9e366094e87db68c606d0522d72d4b939818..3518d3116d2a6d0fadd6b09b3b592a2cb322bdce 100644 GIT binary patch literal 1235 zcmV;^1T6cBP)zpC!G631~st$=$LjuDnvM`SqpI###sn8@8#)w6&qwSNGIL1Hskx^mf7_ukXz+^#B% zs;c;vCVy%5{{aAg{mYXlPksx6;AvG=4_4=Xf+-=y-(^|;_4x7Q(MABC=RJ+0=wY|p zmA>yIr9?`J=Xo2)Qhp}T7~@=Py>YCR@`uCW!?Uw9fIl|^P)a@UJWsxU{n{1tecydr z_dL%5u>iEzXsuC7Ik(>}kY=+fl~NDtHJ1PwV|=?<2tid<7-Nu9y0O+8fU2t27_hNb zRk`)`@t1l3s{mFLtOg4q+*G zL9f>%iX!qnUn_ns2CQXSMzh(Zsw&rrM@L8W`+Wcgg8?5td_V|+F@~L;9kMK2(tj%k z>L_j3W?6<(is^I;Kv|abdOiC6K3SFl(C_!rTJ!$>dxQ`S1_So@_X&c4cDw!GBse=e zLrRGd0x2a*DQ?}m#p&s(TQi@}IXpaMFc=U70Yy=8adCk$W~~pllAzAOYC{@h$n)Io z4e+^7R`p)poVI4b2H3>+@84%WpEDc|xw^VSYt3jhqSNUtC5q$N?UuW{yL7u<_V)J3 z^Lz=+wHUBZ8HOQ25b)x~3#61JNkUN+gkcE4cswS{GJM}hDaGBpcWJlVEEWrw>sk!h zASoqjnj(Z?GMPA8q?C-uW70GQKuU@4`)>a9^pt~xgC!ZaW?=Oo5khczc}bEaNGU1H z()EPz`%WsQlw&N8W2&m6)oLxBigkIdt(^sRq}HP-A`C;c)*KxjadL7(v)Od>&1RF6 zlM}k#E?R5CFm#(&-LEBqy$=W>$n%`z<71}NDZ9J7eERf>D2m)^7)2362ztF9w{PF3 z-EK1&43_k_3~VLADga{)uU@_4#*G_%{P^*6;1|s;aC2p|l@cDLJoc6D_XCQ0%;;BBn(0WbcEP)8e6`gpm!y1M!N^ZV(=IC*t) z{^;nqJv-tM$9J1L2QJ2DN!#51=1_l@G`2=6e0lehL%sic%`_4--LFM}IF!KzJCseW zq1I3__Z40|e?qyK1__gzP(qrBf-G7SQbQ`#Lw94WVe(o`qg+f4hy;Qju)q#I(9{`% zQmAGomzhQ!b|gq>KqL@IkO~$=Koi}a$u6d07kiS}NoYVMJjAeZpaB*;wwcDdEbK@K zNP;B7RzhQ|H9AlUO<`J>m1(5R)Pb-iLBb@7Jp)}LHdAb-VVgYxVoTzGoqu{~a>6uj zeqCRFI9pC#h09bGwy9;oHcp6(RB%jeY^F=Ll!S+9JkVe4nDG7tJMQiP0000 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + diff --git a/core/img/filetypes/audio.png b/core/img/filetypes/audio.png index a8b3ede3df956f8d505543b190bc8d1b5b4dce75..cd9821ec047ff066ac222f7434fd318f1968a6c6 100644 GIT binary patch literal 858 zcmV-g1Eu_lP)NI9*~1SCT_Gs%VjNDv0ZoG^URyES=V*=%*HvDbeh9Q z)6-KtJw1^GhEh7vfK7xk*1OF%Vtb_Px}Fs09BG^)&#sMb)+~*6VeDx!8uy>8ZGn)_~baRl~(% zfvTz;axnt-mducRgsSs|35u?Clbynh-6_%cfPW9< zc^(*;&*y{HlS*N~1!))yL7JvGIXOXDmPnEW^Z6WUnmVs2$_uef7^MMImZg+9I5@!B z*%`FfsO#Fv7z&&s5+&g0zTY;R4K|z2;O{X4V;&^DC<@GGGXQkq`J3i>z|kEuKNdxi zuU4xcLWmgv&KMIPg8oiI0nkdR-+7*YUoMv`hX4Q^9UV=TQeToJ$+XrVN`P~&+P0NK kh^j2hK87q7?|;$$0M}CEus3`j`~Uy|07*qoM6N<$f-drfxBvhE literal 385 zcmV-{0e=38P)klCE>?a@fNhGaV ftv%qM$TQzJ6;XjO8erVL00000NkvXXu0mjfw}q7O diff --git a/core/img/filetypes/audio.svg b/core/img/filetypes/audio.svg new file mode 100644 index 00000000000..f742383d632 --- /dev/null +++ b/core/img/filetypes/audio.svg @@ -0,0 +1,274 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + diff --git a/core/img/filetypes/code.png b/core/img/filetypes/code.png index 0c76bd1297751b66230f74719504b2adb02b1615..753d151f538842c2636a94e0f9231fc4ef1c301f 100644 GIT binary patch literal 908 zcmV;719SX|P)calP19IDZ2()FQp&u6e`_n%%{zg$fG7#T{5*f}IRMSI>v=OdjnCu4>voZt znPW?hPD@=iTLOB~5Jdr)Y0pJEa=yN{%|#bpscy*t7w(Ved`-dieEc?x&*Netogt`u z`S@*?pkB$>*%X8OwmT1SwzsWdcjjEj0WLm#Y4L9j=)9Ynv78NbHd0sREeKcA68^C> zJ*~E+NNfG7Vyi(E1@O;bLv!$xOH(;t*NGbD#y*gGov;-O4DNOg!2ArKuCe%iyBhKB zYRoH8$jX|)*yXP|U;EK&7G8WJ^=i_RQ`r{6+qJ2ncu@d`VOWB@PHnIzgg4<0+rW7=;1;izPJMweME|Xz{et{60wL$2{xyZsozNH~rfs{rgt?xf;zwoCoU4ghY9O#pDX zJO3q>uWrcz2lZoFhfgA-hNZKCj*YfX9S68OdlSE+qkeHS`E&}8$3uUAe>PbWYY))p zJ%B(!y+nqVVoJ5L0d8Nv4S?V8Cz(vLzrK@7;U*JLqK5or;z_iIDvbF>+^s@ zb}6InA?}RFIn+^y$ED^4$XC0l2{1H7jjA&6+pnrBQc4c*sI%l9@2+1_#9X&@fQkxR z;F>R?rfIm{?vh1Tvp<*IssKU=Wn^R|F*-ULbX0w*enJSLNGWsIqA*hlAq1c=2XoNU iz>GABigJEWC+!!w&Od^wnO&v;0000^~*-1fljz_B$LUvK}k?BNXe#Y!m=zM!!V#}8bncK5m;8VP zw86G*RI63?Cd%b9bX|ueNlZ|wR6rj|r_)VIP@r2imh3?SN+^{|kY%~8B{maJ@F*OK z&VH9LwOeGt#DRjj0~v~8`>iO7!Ybi;zE$va`A^T#yW`y44;k^#O~K5*jD=qcUhPSc zvyy~q;5H_1WT1l~cqje9yfa+l!hu6xjdOJ8s;8E^+=QQ$tw p?%p!Hy#YapB=@+^9(46X{{RQg%9y;OKjr`c002ovPDHLkV1g7l326WT diff --git a/core/img/filetypes/code.svg b/core/img/filetypes/code.svg new file mode 100644 index 00000000000..1dee047b11f --- /dev/null +++ b/core/img/filetypes/code.svg @@ -0,0 +1,359 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/img/filetypes/file.png b/core/img/filetypes/file.png index 8b8b1ca0000bc8fa8d0379926736029f8fabe364..c20f13c2e13af5bccf96b77dd66a6a0df0508c90 100644 GIT binary patch literal 374 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdzmSQK*5Dp-y;YjHK@;M7UB8!3Q zuY)k7lg8`{prB-lYeY$Kep*R+Vo@qXd3m{BW?pu2a$-TMUVc&f>~}U&Kt-QDT^vIq zTHj9H&D(4s(Dq)Z+eliWEkR@z&jFT~D>P5CyqVw|WW>-jq3h5tZ(${F>&}jI2ZR1h zzjpKc-ODG=B&=TdIyg{7mF0p(-}Qa(&wra4C;hZC&dj$s#H-UvT`A-CHOq3KHP0&9 zl6y27uEm8v;4O|7c5LGF}$;v{gPaVutPR)C#5QQ<|d}62BjvZR2H60wE-&H;pyTSqH(@-Vl>|&1p(LP>kg~E zYiz5X^`c$+%8#zC{u)yfe-5 zmgid={Z3k(ERKCKrE7DF;=x4^O+ pzO8rLO8p|Ip=x)jHOtWj`bJBmKdh_V<`47(gQu&X%Q~loCIFbEay|e6 diff --git a/core/img/filetypes/file.svg b/core/img/filetypes/file.svg new file mode 100644 index 00000000000..f0c0f1daf7e --- /dev/null +++ b/core/img/filetypes/file.svg @@ -0,0 +1,197 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/core/img/filetypes/flash.png b/core/img/filetypes/flash.png index 9f5db634a4fb42ad33c7a78f5488f03308d3317c..bcde641da3ca196a8212a5b6d91a62013f1430ab 100644 GIT binary patch literal 954 zcmV;r14aCaP)8=ZhVsRlE5JVI@Zd?wX?nDHR%jISl z78YJM3?tIyQc9MVmICVm007r@>2x}g0$7$d71}a;+Y*Hii>bv@N<|LQ7r^ZtqE-N) zTm7Bb0bR^UTd=dfPH}aW(%KrPWYo~BGOXL$NVhG%J2g4u$pwpp47*;x^eo#2uS*qfY+W6C@s) z#dX~S!`w}-8^VEF;Cmj$<@d>rXNWsCrfu?9+oQO0j!$N1_~MzTwSGDcbP<(5{g~mQ z7{enYIJQYgDss6=rY0xw+djYl_DjG&x{F9Du77lvsm$HP9TU?uF%{UBf$T`!RvW_* zS^%B;K882HynxwmkxWlw$75W+{434M%>y>avf0q_`r3h88%3_Yy-05A9)^xNRCX&2 zP2S5>pM4YXuhnXSwZQ?DqVfGY*WP-AiLp`A;~5Oc;zntknRm`otyXVeWd_~#ADG7TyifoGzXkqYh3VzF*APPBc^<7+i)zn=hXn{d1HB3}<%8<~`B(g(16Y!Kav9LZ#I-!JhChA6D-Iv8UfilU%gE+d!ANl7-FMJko@B=v9?3Fv}pny_sf z=E*mhpTB_ZBv7eTkk99(z%UF@k#stJCutT?*giObx$qWlViRogHB?nap-^ZUi83t$ z=kGt5(=*`f%P^*A!PYjsQHsT)>?D)PJRsm4)^;3x^8<|7M{rS<(>t*|l29kKk5Z}B zUcfJY! + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/core/img/filetypes/folder.png b/core/img/filetypes/folder.png index 784e8fa48234f4f64b6922a6758f254ee0ca08ec..b7be63d58369d5da485f12ead9ca6982c8e8e563 100644 GIT binary patch literal 709 zcmV;$0y_PPP)M_{T#OD zL*!f7*x1-vsEwk95U>jf7J?W|NZj3IbMMS~T9|!>kgRdc^k2sZ#MOqsjx?%!t$0I=ZhpQcF+A>0EnJ3t8GHUPLgnEA-0vMdKV zcTc!(*WK49003Gd^3lwW%{DWL$W)a&EQ+GIKl~n_==FLaqLco2s%W)Z6XW3Sc+g&Y ze0g#4>783Q+p5|qAkTArUj6c}^LyjPn^!NN7XWbe+Vw}v%g@?Ho;SMqARaC~X|JrT ztONK9NGknr8$F26=UQmx0GmZ%{|u;jO(d|qMAMIB2!N|X#p)q|g=1m?P|O7&Dqz!U z2oTjeu_Dg^Ygmwl0Aqo$j8%Z8A{G>-%>|$&P~j1P64#Lh=ggtjEFjMSVnJjZZ2?oP z6Du-p9$*e6QBaB_K%`WW2ugLx900_MNNEH}v8qTEEo&a&07wK>)g!>}PQOYdIByQt z=DXxXf>`y&D$v{9BN4DVSdV`V|1UBSGxj>&y&+(G^Jm4Z5N*B!0S*#Hck9OpK>a>P zCML6z{;2}TU=N*kL}KlCIy3|TK&n$B;xfqrz^pGO%aCFn2g3otV~Ug#Bgw&j;0VA; zY?h<0V*+5~fS|FqOBZqglRZHbC*oI%!!i#5J8K_azx}%U{)&6EO+g63l;ReEKCs`C r?N1Z{F5+MbW*-V**WG0Ta9Z&Pj@y0dwwZ6q00000NkvXXu0mjfO6e%^ literal 537 zcmV+!0_OdRP)x(K@^6+>g^d@v4;gkbWsEoXE%32*i1tcpTNXd5CcIl)ECgqz|2rE6EW}s7R?kl za1q`0GCkMruC6-2LANtwVlsgzsp4?{@7$`KBv!G66>Vie3h?3OmEEkjwdLG0PgLVi z`!N((f$A@n17Ldj#`};0I3@iHJ5M{#IZz|UIYRm4(!uV7eYIYIwQf&}_2J~}>pQ^n z6o8--^T(=hkBNQ_k{-_GWE;FMW7!p}f{NG3nHZ{D5<3d8&tLh%a4AqqnjMkr3m&fkMdECD3N5}Unig5wy40;>lo4j~k+e}v)` zR6)J8Mk*u=SpB`p6o)7j?S0T@9?bz#m@l>gc*zk__|*!FMcHwP!gwLJvS~9c0px8E zW + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + diff --git a/core/img/filetypes/font.png b/core/img/filetypes/font.png index 81e41de7d3a9bcc50267b34d0005487d5c7cc7c0..df44a7fc47db6c6edce188fa5e00ead07456bf97 100644 GIT binary patch literal 1793 zcmV+c2mbhpP)kn#o@63d#~SKd+oK^#LT#!OYK22X zLr*dD$ihD}KYHN6f#6 zT>yCNt~>4(zWzFd`lNsB&FuB{1f&&6NstsM=i=ek{$mdx{luLkw~rlp0l2~zG@H#q z0DYe4Ax%>U;FXDqiPr&~$@3gx7!rVoMw-pu$-CFR#8L2ycT4{RvbV>j({tJU@zNhLykMF8XxI?P9+5%Q%XkxcAQ|vW0o}e{A3;Ewr_1 z3APT|TpG42?R|?|{C)tw?{85`IUxkv?RE~}Y3|%y6B83>r4VCTmcjEpoGu(4Ki8gY z?mPTgw{rk+N{&R!Z>+hbK>E-3U`QVC*1Ru(5MoCV1a;>evMggE#812XKVyr;wcBvc zL1~RAt=UL(xs>xpqtVCAo3z%*^Be#s_wL<$ zVsYa2>o?y8Y-V<_)BFi`kLlQz&RLQV~kHkJDGVW01!Yw)LtNF=E2NxLO9R&rPjLYoLj63FW<5L9^aFz07N&rBuR?`6Vr9eAPGBdQ+l;`0wYaWU1{?%2lssu2Vl&zyeZr>BypE>6s zgn$5jv?YacNf}#4khe>v1tHCBRxqY63qV9Wq?C2%9E>q3Gw&K7AAhS`^ZeSu_yd`# z`T{Uc=qNXjjs@~}Wm#@jN(m{2dP6yC=6H!f_Y|4AnFNp+pfnc)EY^WWqtORolMv#3 zb~{I9S^j$I0ArElg+-Yg+yD~@rn|Sa@Srf3m>G}~2Nlr_lkfX9d^VrE!t<2=uwCn8Nms`J%Eq|X-o z#8l4hvnAnO1Dq`xbJk&P#$e~b%pgG#fUnKwMS8|K%o@OB@_U7liG?+melU9S;LjHU z8jZ%s0rYi34`$X=Q&X=2hycirDFFK0({CJ`w#AQ*6=nOhahNfT6S*ye`8;>l7M_la?YV+yIZYR3qW@<;Evg! z%p7_0tSP=VUAiNuOZ)eCO!13D|C;%n1I{hXK}6nUudid{etWXC#p%Mnea01E{?5#s z-vq$ixwvTIZAe5OfUvVt2OtAbEF6%fxzK@ET@liqi0KY!4j=_!K2_-pk0xj4-v&wm jmb)IL^#8}{^#=GivXWu0)28I700000NkvXXu0mjfbU9WX literal 813 zcmV+|1JeA7P)%S8Yz4}?d^ZEOv#Sc!)mtIgHXaEQ+_ullV zJO1Y8v8UhuAAS7ozvIlitK{;}YszGvVI*jPQs)gu{RuZGF1qsJqxF>Ai*mOY zeUVJ^Xn04=g+vNN2-6q_7DHe6!8fa@! z^ZEB_2Vebf-umoI@{HTtK!PIfdyIp7Zk$|p=*|D=N%#IIE_w1_EaGe}ST5wWclgx% z|Fx4ZY{8likTKA?G12oM|4&}@o+);3yYs=L?ao)At-(S*$63Le zJ&q^>ZEbL?y!O>L=h9<7rvvdA2Do?L{p8zs_rGt?o&P=^cm5ltT|5S~l@laqmU8i; rSIv!oK>XjU`o@3v@@qdCD9z3Q7_5=EFk?|V00000NkvXXu0mjffa;^e diff --git a/core/img/filetypes/font.svg b/core/img/filetypes/font.svg new file mode 100644 index 00000000000..404f622ea7b --- /dev/null +++ b/core/img/filetypes/font.svg @@ -0,0 +1,338 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/img/filetypes/image-svg+xml.png b/core/img/filetypes/image-svg+xml.png index a1291c2dfad75b289f88ab762a3a32ccb436c1ed..e3dd52489d3772962e22cdf47569b53616fe73eb 100644 GIT binary patch literal 959 zcmV;w13>(VP)z_|7@MbH1CXD&v&%^iqNC6zjp|aZmRb{Gb&4rJudU0!ZU@;&b3ZQ(98X^?H zWA8xK;(sR4OFtmbu7hREXXnht<1ls^P5+Io>_&Q$$hxv%*pp~*1m@GVjosx1A1$O!tmFaOWz|qKZPajp#bXMf;k|@K;T0$j~atHdzARr z_ld3V#cuD!YK-ALwUXxEw}?NHK>H8Yj1wB5QnK$etYym~pM|T#hz8iJo=5y_$qF+_ zJ_Gq_63=zR#3=gt{;D_&KLbmYBQi07i&EL={_ zi4n~^uyGr5{a5tH6~s#;K@KU*fR{!*_bxyNEBPuW(Gd!u?iSSCL%{6#7y_T%i4X54 zpT_d0kemyCj_ICv@n1iT*|NK;m}uUCL< zy_+D`9LhHoKqxh}Vy)hU?`Du+E{1Yh@IzF~nkI&6ac)8^jy>29H?Bn2f%&Xu{2N;T zIEUC4Xh8AJKAh8su)jME?w`>E*n|D0DosG!*q1bq4+2n_%%CftCRnwm6m0w&v6BZL z3Lw-qbiO?WKvQ;vvf;J@<<+Oz~z@wR`0ef1}Tm-j^vP}s1o%CXF$G_-YMUg(`O7a2elivAr~AVj4e zdk6lX0FL7jkH;egxcA9D5I{t%fq{X^p`oFUNVDIMKPe)Xs?L6kQcfiz0<>0wMJON0 hXjxKO%u^pm{{i;%Y;-~x&NBc2002ovPDHLkV1mQAx^@5n literal 481 zcmV<70UrK|P)SXcnW4?r|Fc?Kd3cm$;%kZi#G`Sa_VnwmC}YZ26Y zhXbnt^XAQKXm4+SUQ}H6r(?sz`|0x@O--EjU}EI72kk(5e$=!F(*t|%| zOO`#}*s$)|C0u^?YPrGY(Rf4Gt^S&sOU+enjCclWzS^+v`E5dh=Tv=F*rDQzDn?3c zT=(o=$L8ms2^j#wwxyStFa(R1K0Y&H$BX|!zZw%`2!=rX%m*7M?R@p$v*kt(Sq6Bw z+-#h< + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/img/filetypes/image.png b/core/img/filetypes/image.png index 4a158fef7e0da8fd19525f574f2c4966443866cf..83d20fdb7762d4b52b398c80e4ecc3fb6f2d5470 100644 GIT binary patch literal 978 zcmV;@11@dUJ z_uS{qnOPyFq@AX;75#q#fES=pD6}OJy1KfA7r;tHA;ez+wkLj-fDnSEr6o$GQgxDj zqP<^l%)PLEj%k_>Us+kHjyV*_<#JU5KVcT2l(O1d-wp*#(?keSv$IClY>pko4Q_88 z1gr%O!*C2XGs7_OcsveZx73Y@*f*fqS-0vP9UV+gPU7)+&~=?krGlnuXqrZ)QfcbC zt~*Gyq=1wX!!S@31w~O98yjP2Xoy@c$I;PI(;d6}R;cTSz?$r~P$g4gS< z0*sE1GBGhhAP``Gf1ka*y_#LyO;MD_1neQOFY@s4!13`h!^6V_gF$p%C!J0ckH_in z?+2huhgt6OBgc>FHs4d6}oDC!*0Pi;Ig$DOp`z zKw=y@8NH9A)i>j*R^LcJ>ZvnW!zvuh=8&y?VSXf|ZXNQA> zgQg|jt$^bgetv$E&1QLjf9LJ(jjyjSd_Es@b91Pw3V^DrOifKWS^&S_PcoULv$M0N z9@I<5nqw%Xq*yGX>$-#S$Hxb$RElsoOg^6{nM_vQvaPKxUSD5%d3m8wDExT{8r6aG z^K(qoWO{mq=bD-72)CKr9v`7z}c9a>C)^Ar}`HWHK2tnGAP#cNB}omhX^%J%(-x1AzcD zGc%-8DWsIFudh4CudlCL0=BGa4!GF?%+JrWySs~F7{3MdBLsSTdkKX?+}zy!2zWh= znh;n;Ls#OM)^b%<9R!4wl5{%VmRE5+9v6xbLiybX$xpcu zLJ@!fV!%H@$6wlf8OQ-oqLoMJe`#(1HETP8UxCcTx6i@D5&!@I07*qoM6N<$f_;y! A`2YX_ literal 606 zcmV-k0-^nhP)Q2rnAt>LM%-F zK|rtwgcU)}7x~z1Hrcs5bH*ZO$!>xO8K#?==bZPQ_ecnV>#P`H`QzGaRhd62G_&rC zTLU$c7_x*nFP_dW#Q+*);mMHE?j)HexK784D4x9l_tfpz2$@1y}9rkF+ zI+J5NMWeZyObc!d+rUc=>D+uOdAOg#%+Ej6h+wn5^xPmVVH*Eu446Y0A_@ zo$rlds-+sL10Db + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/img/filetypes/text-html.png b/core/img/filetypes/text-html.png index 55d1072eafda48abb0a5fcecb98b114d866077b9..de11613f25f41a5918b041f358a66cd38366eaaf 100644 GIT binary patch literal 741 zcmVba;AtS^`X`Q)aW-{s5~WK@i}19;H%=YPFh5sFb4L?{j~Dk1>X7wMwZ} z!t*?WAV?J6*#V^#gTa7eu}HmMCyJsJz{|@E7Z(>?UtcfhNWEUCSS&Ia3{Xn#=783E z89W}30cbXx#BrP|uC=Dy?Q(m2i>lnJOi{m&v4B?hm;gCY1K&@6I48y~YVI0Ra8jWR7EcUzIE;lzf zsU};*G#ZV}zFF5_U&S9EAK11{rBX@Q`0((6lrr^b%H>~QU6y4fzN!wI1yV|`uCCBp z^Zx!0fbaXMWB`|!msplX7>1d7_W}S2f*`Zty0V%z7l1?cWdTk;j!*8u*95R_oAdMY zTmcrd<*hNZ(J00000NkvXXu0mjf_EbrX literal 578 zcmV-I0=@l-P)dis)>+`f+#3Rv=dSV4I&~|Vk?LiBG~#L1X~NSQGbAyogj#ie_$n8 z*oYwUieR#5zw>=_v)By?+NE%sVPM|5yzfjE5$wfk_Go)9(A<0e{hvFiJ0eb2MFf%t zDJxl&RDw>Nl#~WweRba-&_F#fn|ifCG!S=00#QfIDe64k{5mZFusu=CnSq>Qvt$j5 zI$4b(K~|@Tvozn3#yaJ|Be;BKfh@+AwFR!7UF7D*61OfavvGQ!VN-Ga+zO*%#qEoS z8E0dX4NpRyRS|XCrXq{e4r(61{zg^7gBPDUwmjg}k(Q%NLkD6fm6*tZ=)6^ARRw9CNHr!!-b)EovamKwdDMpr>=!|-tf?S+boQE&JP}G_9P5@nR zSOjlBPI$jHA&U_KsTjQko(uJ_ROpKn!K^ckXTHmZd+_Mh7C&~BUYvvb=Xi2w6%i+L zP+hwJF0QUE^66)$h?CXHvdjEbu3a_69GS^`e5Gac*$0~K9VHcGVKhe>RE(rT+Ca5J zv_?D-3(OpKFrQAl`$E;pyKkaTN=V?@iK2u!kqwFy=F?aM-2b}R>c4;EZ`t2+*gqpJ QK>z>%07*qoM6N<$f@8}2CIA2c diff --git a/core/img/filetypes/text-html.svg b/core/img/filetypes/text-html.svg new file mode 100644 index 00000000000..bf29fbcbbf2 --- /dev/null +++ b/core/img/filetypes/text-html.svg @@ -0,0 +1,280 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + diff --git a/core/img/filetypes/text.png b/core/img/filetypes/text.png index 813f712f726c935f9adf8d2f2dd0d7683791ef11..2b96638d16c9af6b5f98350c4ec102d4975c1b64 100644 GIT binary patch literal 757 zcmVr^#nd|{2jDfVx`$1`XC^PkIDD5WqlpU;1cMx#5v z0GrL`_v7Q^Pt#^)7x}(_cYlBXz0qjYdbpI5#bS}O=Li5qQN(VytCfId6&^)lnAx<{ zfqgy;X(^>@CsB!jxnaFt5C9}=0364m-|y3Iw@ZoT2>D-+VUx9;AS|c(qyqq@vaT9mgSxB0SGSN=Y2YD5X+rbh}*!gTdh` zkW!`yOeT}Uja8uiNh!+-m>U3IUS0rbwOS~plJ@jG41fDgB+erKo`na zOv9s!aJgIp`8Ev05Zkti;~2+rk`~nOKR!MfkH;yWMJOFarxal=gGei2+cr|l%56BE zPETvYo12@mC3}%A+=B_23OqkQ1JG`_iQ^d8b=hvWxULI)DxmAb{Jpxm%H17D5jaJG zYz-VlAbS_og`@8Ror0pfK=q#u5CgH zf*`=MESk+G7Z(@wdcDMF5lU;|R0Xu3N;P2O>FEh5&U+99oS&c5Y&HqQkju-(g(B`YhYXo=00000NkvXXu0mjfEhtiT literal 342 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!60wlNoGJgf6SkfJR9T^zbpD<_bdI{u9mbgZg z1m~xflqVLYGB~E>C#5QQ<|d}62BjvZR2H60wE-%6;pyTSA|c6o&@eC9QG)Hj&ExYL zO&oVL^)+cM^qd@ApywS>pwx0H@RDN}hq;7mU-SKczYQ-hnrr=;iDAQMZQ+*g=YOM= z!QlMQEn7FbaD->uKAYgo_j9)W&$$zS*W9}m(ey0q$&7l-XEWO0Y(9M=SnhLbwy;d>@~SY$Ku*0xPvIOQeV1x7u_z-2-X>_74(yfh7C znXL|3GZ+d2`3re2hs?MK + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + From c7fdf00e8497af9804b0cfd4fa081940bf53bc96 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Fri, 21 Jun 2013 14:24:52 +0200 Subject: [PATCH 068/170] add unit tests for preview lib to make @DeepDiver1975 happy --- tests/lib/preview.php | 108 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 tests/lib/preview.php diff --git a/tests/lib/preview.php b/tests/lib/preview.php new file mode 100644 index 00000000000..2599da400c8 --- /dev/null +++ b/tests/lib/preview.php @@ -0,0 +1,108 @@ + + * This file is licensed under the Affero General Public License version 3 or + * later. + * See the COPYING-README file. + */ + +namespace Test; + +class Preview extends \PHPUnit_Framework_TestCase { + + public function testIsPreviewDeleted() { + $user = $this->initFS(); + + $rootView = new \OC\Files\View(''); + $rootView->mkdir('/'.$user); + $rootView->mkdir('/'.$user.'/files'); + + $samplefile = '/'.$user.'/files/test.txt'; + + $rootView->file_put_contents($samplefile, 'dummy file data'); + + $x = 50; + $y = 50; + + $preview = new \OC\Preview($user, 'files/', 'test.txt', $x, $y); + $preview->getPreview(); + + $fileinfo = $rootView->getFileInfo($samplefile); + $fileid = $fileinfo['fileid']; + + $thumbcachefile = '/' . $user . '/' . \OC\Preview::THUMBNAILS_FOLDER . '/' . $fileid . '/' . $x . '-' . $y . '.png'; + + $this->assertEquals($rootView->file_exists($thumbcachefile), true); + + $preview->deletePreview(); + + $this->assertEquals($rootView->file_exists($thumbcachefile), false); + } + + public function testAreAllPreviewsDeleted() { + $user = $this->initFS(); + + $rootView = new \OC\Files\View(''); + $rootView->mkdir('/'.$user); + $rootView->mkdir('/'.$user.'/files'); + + $samplefile = '/'.$user.'/files/test.txt'; + + $rootView->file_put_contents($samplefile, 'dummy file data'); + + $x = 50; + $y = 50; + + $preview = new \OC\Preview($user, 'files/', 'test.txt', $x, $y); + $preview->getPreview(); + + $fileinfo = $rootView->getFileInfo($samplefile); + $fileid = $fileinfo['fileid']; + + $thumbcachefolder = '/' . $user . '/' . \OC\Preview::THUMBNAILS_FOLDER . '/' . $fileid . '/'; + + $this->assertEquals($rootView->is_dir($thumbcachefolder), true); + + $preview->deleteAllPreviews(); + + $this->assertEquals($rootView->is_dir($thumbcachefolder), false); + } + + public function testIsMaxSizeWorking() { + $user = $this->initFS(); + + $maxX = 250; + $maxY = 250; + + \OC_Config::getValue('preview_max_x', $maxX); + \OC_Config::getValue('preview_max_y', $maxY); + + $rootView = new \OC\Files\View(''); + $rootView->mkdir('/'.$user); + $rootView->mkdir('/'.$user.'/files'); + + $samplefile = '/'.$user.'/files/test.txt'; + + $rootView->file_put_contents($samplefile, 'dummy file data'); + + $preview = new \OC\Preview($user, 'files/', 'test.txt', 1000, 1000); + $image = $preview->getPreview(); + + $this->assertEquals($image->width(), $maxX); + $this->assertEquals($image->height(), $maxY); + } + + private function initFS() { + if(\OC\Files\Filesystem::getView()){ + $user = \OC_User::getUser(); + }else{ + $user=uniqid(); + \OC_User::setUserId($user); + \OC\Files\Filesystem::init($user, '/'.$user.'/files'); + } + + \OC\Files\Filesystem::mount('OC\Files\Storage\Temporary', array(), '/'); + + return $user; + } +} \ No newline at end of file From a98391b976ba7dd544af6a0d16b324efb2fc7a3c Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Wed, 26 Jun 2013 10:57:37 +0200 Subject: [PATCH 069/170] some minor improvements to preview lib --- lib/preview.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/preview.php b/lib/preview.php index 3564fe3df44..87e2e78d1d8 100755 --- a/lib/preview.php +++ b/lib/preview.php @@ -323,7 +323,7 @@ class Preview { }else{ $mimetype = $this->fileview->getMimeType($file); - $preview; + $preview = null; foreach(self::$providers as $supportedmimetype => $provider) { if(!preg_match($supportedmimetype, $mimetype)) { @@ -350,6 +350,11 @@ class Preview { break; } + + if(is_null($preview) || $preview === false) { + $preview = new \OC_Image(); + } + $this->preview = $preview; } $this->resizeAndCrop(); From 9b7efef39d3f7eae45741f0adf0bc0d52945d842 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Wed, 26 Jun 2013 14:28:40 +0200 Subject: [PATCH 070/170] improve Image Provider --- lib/preview/images.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/preview/images.php b/lib/preview/images.php index e4041538e92..987aa9aef0a 100644 --- a/lib/preview/images.php +++ b/lib/preview/images.php @@ -20,7 +20,7 @@ class Image extends Provider { //check if file is encrypted if($fileinfo['encrypted'] === true) { - $image = new \OC_Image($fileview->fopen($path, 'r')); + $image = new \OC_Image(stream_get_contents($fileview->fopen($path, 'r'))); }else{ $image = new \OC_Image(); $image->loadFromFile($fileview->getLocalFile($path)); From 39c387eed4e5da7bddb6f7cd48a8f8b607f3b8dd Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Wed, 26 Jun 2013 18:04:18 +0200 Subject: [PATCH 071/170] implement server side use of previews --- apps/files/templates/part.list.php | 3 ++- lib/helper.php | 11 +++++++++++ lib/public/template.php | 9 +++++++++ lib/template.php | 12 ++++++++++++ 4 files changed, 34 insertions(+), 1 deletion(-) diff --git a/apps/files/templates/part.list.php b/apps/files/templates/part.list.php index 1e94275dcba..6dabd7d6970 100644 --- a/apps/files/templates/part.list.php +++ b/apps/files/templates/part.list.php @@ -1,6 +1,7 @@ style="background-image:url()" - style="background-image:url()" + style="background-image:url()" > diff --git a/lib/helper.php b/lib/helper.php index a315c640d1a..e8cc81774dd 100644 --- a/lib/helper.php +++ b/lib/helper.php @@ -223,6 +223,17 @@ class OC_Helper { } } + /** + * @brief get path to preview of file + * @param string $path path + * @return string the url + * + * Returns the path to the preview of the file. + */ + public static function previewIcon($path) { + return self::linkToRoute( 'core_ajax_preview', array('x' => 32, 'y' => 32, 'file' => $path)); + } + /** * @brief Make a human file size * @param int $bytes file size in bytes diff --git a/lib/public/template.php b/lib/public/template.php index ccf19cf052c..5f9888f9f28 100644 --- a/lib/public/template.php +++ b/lib/public/template.php @@ -54,6 +54,15 @@ 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 OC_Helper::humanFileSize available as a simple function diff --git a/lib/template.php b/lib/template.php index ae9ea187445..048d172f1c9 100644 --- a/lib/template.php +++ b/lib/template.php @@ -62,6 +62,18 @@ function image_path( $app, $image ) { return OC_Helper::imagePath( $app, $image ); } +/** + * @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 + * + * For further information have a look at OC_Helper::previewIcon + */ +function preview_icon( $path ) { + return OC_Helper::previewIcon( $path ); +} + /** * @brief make OC_Helper::mimetypeIcon available as a simple function * @param string $mimetype mimetype From 806f3bddecbd8182f1da90ec91e2a03a1a6e2c3b Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Wed, 26 Jun 2013 18:19:10 +0200 Subject: [PATCH 072/170] increase size of preview to size of row --- apps/files/css/files.css | 2 +- lib/helper.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/files/css/files.css b/apps/files/css/files.css index be29186cbb7..222cc9c83ef 100644 --- a/apps/files/css/files.css +++ b/apps/files/css/files.css @@ -118,7 +118,7 @@ table td.filename a.name { } table tr[data-type="dir"] td.filename a.name span.nametext {font-weight:bold; } table td.filename input.filename { width:100%; cursor:text; } -table td.filename a, table td.login, table td.logout, table td.download, table td.upload, table td.create, table td.delete { padding:.2em .5em .5em 0; } +table td.filename a, table td.login, table td.logout, table td.download, table td.upload, table td.create, table td.delete { padding:.2em .5em .5em .3em; } table td.filename .nametext, .uploadtext, .modified { float:left; padding:.3em 0; } .modified { position: absolute; diff --git a/lib/helper.php b/lib/helper.php index e8cc81774dd..0a8962a5312 100644 --- a/lib/helper.php +++ b/lib/helper.php @@ -231,7 +231,7 @@ class OC_Helper { * Returns the path to the preview of the file. */ public static function previewIcon($path) { - return self::linkToRoute( 'core_ajax_preview', array('x' => 32, 'y' => 32, 'file' => $path)); + return self::linkToRoute( 'core_ajax_preview', array('x' => 44, 'y' => 44, 'file' => $path)); } /** From d332b1d4a2e9382aaa8e8a11b6200efaadb18768 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Tue, 2 Jul 2013 11:13:22 +0200 Subject: [PATCH 073/170] implement preview loading after upload --- apps/files/js/filelist.js | 5 +++-- apps/files/js/files.js | 19 +++++++++++++------ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index e19a35bbc5b..11bf028d93a 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -172,8 +172,9 @@ var FileList={ if (id != null) { tr.attr('data-id', id); } - getMimeIcon(mime,function(path){ - tr.find('td.filename').attr('style','background-image:url('+path+')'); + var path = $('#dir').val()+'/'+name; + getPreviewIcon(path, function(previewpath){ + tr.find('td.filename').attr('style','background-image:url('+previewpath+')'); }); tr.find('td.filename').draggable(dragOptions); }, diff --git a/apps/files/js/files.js b/apps/files/js/files.js index a79d34c9b23..224167b99c1 100644 --- a/apps/files/js/files.js +++ b/apps/files/js/files.js @@ -513,8 +513,9 @@ $(document).ready(function() { var tr=$('tr').filterAttr('data-file',name); tr.attr('data-mime',result.data.mime); tr.attr('data-id', result.data.id); - getMimeIcon(result.data.mime,function(path){ - tr.find('td.filename').attr('style','background-image:url('+path+')'); + var path = $('#dir').val()+'/'+name; + getPreviewIcon(path, function(previewpath){ + tr.find('td.filename').attr('style','background-image:url('+previewpath+')'); }); } else { OC.dialogs.alert(result.data.message, t('core', 'Error')); @@ -577,8 +578,9 @@ $(document).ready(function() { var tr=$('tr').filterAttr('data-file',localName); tr.data('mime',mime).data('id',id); tr.attr('data-id', id); - getMimeIcon(mime,function(path){ - tr.find('td.filename').attr('style','background-image:url('+path+')'); + var path = $('#dir').val()+'/'+localName; + getPreviewIcon(path, function(previewpath){ + tr.find('td.filename').attr('style','background-image:url('+previewpath+')'); }); }); eventSource.listen('error',function(error){ @@ -769,8 +771,9 @@ var createDragShadow = function(event){ if (elem.type === 'dir') { newtr.find('td.filename').attr('style','background-image:url('+OC.imagePath('core', 'filetypes/folder.png')+')'); } else { - getMimeIcon(elem.mime,function(path){ - newtr.find('td.filename').attr('style','background-image:url('+path+')'); + var path = $('#dir').val()+'/'+elem.name; + getPreviewIcon(path, function(previewpath){ + newtr.find('td.filename').attr('style','background-image:url('+previewpath+')'); }); } }); @@ -956,6 +959,10 @@ function getMimeIcon(mime, ready){ } getMimeIcon.cache={}; +function getPreviewIcon(path, ready){ + ready(OC.Router.generate('core_ajax_preview', {file:path, x:44, y:44})); +} + function getUniqueName(name){ if($('tr').filterAttr('data-file',name).length>0){ var parts=name.split('.'); From 6e864e6599602609b5808ae4d043b273a9fe5071 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Tue, 2 Jul 2013 16:30:58 +0200 Subject: [PATCH 074/170] fix size of icons in 'new' dropdown menu - I hope @jancborchardt knows a better solution coz this won't work in most IE versions ... --- apps/files/templates/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/files/templates/index.php b/apps/files/templates/index.php index b576253f4f0..c4a15c5fa61 100644 --- a/apps/files/templates/index.php +++ b/apps/files/templates/index.php @@ -6,9 +6,9 @@

t('New'));?>
    -
  • t('Text file'));?>

  • -
  • t('Folder'));?>

  • t('From link'));?>

  • From 04292ff16c56d85216ddbd6f644e8055413c0170 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Mon, 8 Jul 2013 10:53:53 +0200 Subject: [PATCH 075/170] implement use of preview icons in thrashbin app --- apps/files_trashbin/lib/trash.php | 4 +++ apps/files_trashbin/templates/part.list.php | 2 +- core/routes.php | 2 ++ lib/preview.php | 35 ++++++++++++++++++--- 4 files changed, 38 insertions(+), 5 deletions(-) diff --git a/apps/files_trashbin/lib/trash.php b/apps/files_trashbin/lib/trash.php index 7b8d3cb4252..e82a597c61e 100644 --- a/apps/files_trashbin/lib/trash.php +++ b/apps/files_trashbin/lib/trash.php @@ -850,4 +850,8 @@ class Trashbin { //Listen to delete user signal \OCP\Util::connectHook('OC_User', 'pre_deleteUser', "OCA\Files_Trashbin\Hooks", "deleteUser_hook"); } + + public static function preview_icon($path) { + return \OC_Helper::linkToRoute( 'core_ajax_trashbin_preview', array('x' => 44, 'y' => 44, 'file' => $path)); + } } diff --git a/apps/files_trashbin/templates/part.list.php b/apps/files_trashbin/templates/part.list.php index 92a38bd2635..d53e38549d1 100644 --- a/apps/files_trashbin/templates/part.list.php +++ b/apps/files_trashbin/templates/part.list.php @@ -27,7 +27,7 @@ style="background-image:url()" - style="background-image:url()" + style="background-image:url()" > diff --git a/core/routes.php b/core/routes.php index 4b3ad53da01..41e82f8a73d 100644 --- a/core/routes.php +++ b/core/routes.php @@ -44,6 +44,8 @@ $this->create('core_ajax_routes', '/core/routes.json') ->action('OC_Router', 'JSRoutes'); $this->create('core_ajax_preview', '/core/preview.png') ->action('OC\Preview', 'previewRouter'); +$this->create('core_ajax_trashbin_preview', '/core/trashbinpreview.png') + ->action('OC\Preview', 'trashbinPreviewRouter'); $this->create('core_ajax_public_preview', '/core/publicpreview.png') ->action('OC\Preview', 'publicPreviewRouter'); OC::$CLASSPATH['OC_Core_LostPassword_Controller'] = 'core/lostpassword/controller.php'; diff --git a/lib/preview.php b/lib/preview.php index 87e2e78d1d8..f12107c9f57 100755 --- a/lib/preview.php +++ b/lib/preview.php @@ -519,10 +519,6 @@ class Preview { $file = ''; $maxX = 0; $maxY = 0; - /* - * use: ?scalingup=0 / ?scalingup = 1 - * do not use ?scalingup=false / ?scalingup = true as these will always be true - */ $scalingup = true; if(array_key_exists('file', $_GET)) $file = (string) urldecode($_GET['file']); @@ -610,6 +606,37 @@ class Preview { } } + public static function trashbinPreviewRouter() { + if(!\OC_App::isEnabled('files_trashbin')){ + exit; + } + \OC_Util::checkLoggedIn(); + + $file = ''; + $maxX = 0; + $maxY = 0; + $scalingup = true; + + if(array_key_exists('file', $_GET)) $file = (string) urldecode($_GET['file']); + if(array_key_exists('x', $_GET)) $maxX = (int) $_GET['x']; + if(array_key_exists('y', $_GET)) $maxY = (int) $_GET['y']; + if(array_key_exists('scalingup', $_GET)) $scalingup = (bool) $_GET['scalingup']; + + if($file !== '' && $maxX !== 0 && $maxY !== 0) { + try{ + $preview = new Preview(\OC_User::getUser(), 'files_trashbin/files', $file, $maxX, $maxY, $scalingup); + $preview->showPreview(); + }catch(\Exception $e) { + \OC_Response::setStatus(404); + \OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR); + exit; + } + }else{ + \OC_Response::setStatus(404); + exit; + } + } + public static function post_write($args) { self::post_delete($args); } From d699135c5e9cc56b7c3bcbb2263ffa5946b0b8b6 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Mon, 8 Jul 2013 15:14:25 +0200 Subject: [PATCH 076/170] fix for previews in trashbin app --- apps/files_trashbin/templates/part.list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/files_trashbin/templates/part.list.php b/apps/files_trashbin/templates/part.list.php index d53e38549d1..3f260867582 100644 --- a/apps/files_trashbin/templates/part.list.php +++ b/apps/files_trashbin/templates/part.list.php @@ -27,7 +27,7 @@ style="background-image:url()" - style="background-image:url()" + style="background-image:url()" > From 8eefaba719160eb92dcb6747b5e70b7e04736cea Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Tue, 9 Jul 2013 11:40:09 +0200 Subject: [PATCH 077/170] some style adjustments --- apps/files/css/files.css | 4 ++-- apps/files/templates/index.php | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/files/css/files.css b/apps/files/css/files.css index 222cc9c83ef..d7843ab3535 100644 --- a/apps/files/css/files.css +++ b/apps/files/css/files.css @@ -19,9 +19,9 @@ background:#f8f8f8; border:1px solid #ddd; border-radius:10px; border-top-left-radius:0; box-shadow:0 2px 7px rgba(170,170,170,.4); } -#new>ul>li { height:20px; margin:.3em; padding-left:2em; padding-bottom:0.1em; +#new>ul>li { height:36px; margin:.3em; padding-left:3em; padding-bottom:0.1em; background-repeat:no-repeat; cursor:pointer; } -#new>ul>li>p { cursor:pointer; } +#new>ul>li>p { cursor:pointer; padding-top: 7px; padding-bottom: 7px;} #new>ul>li>form>input { padding:0.3em; margin:-0.3em; } #trash { height:17px; margin: 0 1em; z-index:1010; float: right; } diff --git a/apps/files/templates/index.php b/apps/files/templates/index.php index c4a15c5fa61..89e270fd146 100644 --- a/apps/files/templates/index.php +++ b/apps/files/templates/index.php @@ -6,11 +6,11 @@
    t('New'));?>
      -
    • t('Text file'));?>

    • -
    • t('Folder'));?>

    • -
    • t('From link'));?>

    From cf449d42e87b21dff0de35c394031c5fa28b56aa Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Wed, 10 Jul 2013 11:25:28 +0200 Subject: [PATCH 078/170] properly encode path --- apps/files/js/files.js | 2 +- apps/files_trashbin/lib/trash.php | 2 +- lib/helper.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/files/js/files.js b/apps/files/js/files.js index 224167b99c1..06d193bf8f3 100644 --- a/apps/files/js/files.js +++ b/apps/files/js/files.js @@ -960,7 +960,7 @@ function getMimeIcon(mime, ready){ getMimeIcon.cache={}; function getPreviewIcon(path, ready){ - ready(OC.Router.generate('core_ajax_preview', {file:path, x:44, y:44})); + ready(OC.Router.generate('core_ajax_preview', {file: encodeURIComponent(path), x:44, y:44})); } function getUniqueName(name){ diff --git a/apps/files_trashbin/lib/trash.php b/apps/files_trashbin/lib/trash.php index e82a597c61e..fb99fca5b3f 100644 --- a/apps/files_trashbin/lib/trash.php +++ b/apps/files_trashbin/lib/trash.php @@ -852,6 +852,6 @@ class Trashbin { } public static function preview_icon($path) { - return \OC_Helper::linkToRoute( 'core_ajax_trashbin_preview', array('x' => 44, 'y' => 44, 'file' => $path)); + return \OC_Helper::linkToRoute( 'core_ajax_trashbin_preview', array('x' => 44, 'y' => 44, 'file' => urlencode($path) )); } } diff --git a/lib/helper.php b/lib/helper.php index 0a8962a5312..326f2567f99 100644 --- a/lib/helper.php +++ b/lib/helper.php @@ -231,7 +231,7 @@ class OC_Helper { * Returns the path to the preview of the file. */ public static function previewIcon($path) { - return self::linkToRoute( 'core_ajax_preview', array('x' => 44, 'y' => 44, 'file' => $path)); + return self::linkToRoute( 'core_ajax_preview', array('x' => 44, 'y' => 44, 'file' => urlencode($path) )); } /** From 832779804d36d27c47325d1dcce09e566c8cee60 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Wed, 10 Jul 2013 12:18:17 +0200 Subject: [PATCH 079/170] add two new icons - for copyright see filetypes/readme-2.txt --- core/img/web.png | Bin 0 -> 4472 bytes core/img/web.svg | 183 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 183 insertions(+) create mode 100644 core/img/web.png create mode 100644 core/img/web.svg diff --git a/core/img/web.png b/core/img/web.png new file mode 100644 index 0000000000000000000000000000000000000000..bdc2f4a84a53f20d2501f8addd72d299b6f098fc GIT binary patch literal 4472 zcmai12Q-}P)*iy>y|-YrQAdk1h7lQz&gen}VWN$}V3ZLPAzCC#5{clDq8(jCZxJne z2_b5PIC>4yF6W+m?z!i#`~Tls@Atjm-p{-Dv!AusUh9oDHP)r0=B5S!0Cajt1nT@N zaK0{60?*$@)V$&V0GY7+wQHt&*RBbe`uVuId$|GtDojz9Gd`0RtQxUCs8{T80UO=> zaUV)7&9B$+a2K@$^-^B1>9fCH9+wbafGWr4^H5AKR~49q5|x3+B$}TuF(6@rbU^3O z&-=}ldgk{f3iObn-`f}jMc2qJ=jsBT#mw96_kMmlcPo?4JwQbkd+lVATFArN*zmT^qlUHA3Xdy6h?~YH`~omCg7%*bR8XwSf_#0jGSeR;cLYMnm|fa=G+$rsm1(AYYFmSj5==zC^Ip{Zk4|zRlOblWsbJNIUpww4lyfvl z=a{`#>nOoCb(Pt`%|DYI^E+3p%JQIDUX?13r>{~Pv_MMIA<-6ir$*0E&D=o2Y0harCeJaCV`N6n;~tmV8)1S3LGlDl5FhHM#8Fpx7`+XZ-Xh~vWDo&n0LR)bKHMwBvD;2&rMy8Yb+(W1 z3grgczxehf4iC+Y6GO&s#GABr%qx(-%d9`RaUfdy=F;A23X3chI_oWEDAK7gp8@r? z(%z-Ur4RHvgac>jbMy)WKPh#yS${4mC=sU$>#mk}7}dSc)~m?Y{|&4ZRNc@T|5CUy z5|sG;>hw{gcHk7P_xg3j{j*lJ6|39V^H>OLjC)Po6VaQ-VT%em@f3Tt4f9Jckqf{i zb7<+z5#O@G{1oopAU@)UWxp6gjbEAjtXP>_%@K6QKIpmww*~m(y?7*9&c_B77HR8$ zK2OFj7Ks)(9S;DI2Dw|<;B1Txp)Nk&GETRAoLyz`-q>?A006^7&$r&LI41$Tw-?4A zidP5yj)0!;FU$~-!0!;8r#i^S$W-8(kDsf+6&X1hd5{LRfPetZ@0J@Bh0yuq`1zkY z=r#_Ag+d@fK|wM>3Nk)^Xo#GuswzZQ9wIL#2f;gGA#yUZkUt}zAB3IP2)*X# z>V)(0v+(ip(zu}Jj`8$&al*P@5QIVgj`$-b406HaFT8#)`Xc1t?EfEMoV(kWJv4Bme+)kRIZy1(GhnIyAvzl<#zE=}XPdmuC+9 zvA@#9d<0FBJLZYdFv-2)o}`S{${8ig8?9{g_Uy*E2v2bG6uD2dRW9@2&VK9eO-YU# z$dfJyzNK-nxiv^=?puciqSrHyG*0@a_^w@7#r|mQQ=bWHoCykVQXq9nkQw`Vbo9ZY zE|C2AB>I$KJ+QhEkZnr znIC(5B=g$>t=0`JWXzQH2WNdgC*V-arDR=D0oDD+bDVM{~s7i{8C4xV68 z3~QN@#FD5O+P?;#siu5T!P4}ZaM?i*z@!9c3curi1Sci^*?&I3_9Gp?Ja+dan7Qqj zKl6)nLx_}G8l`b_3v`r`jg^U4{qoo@q^T>%BSEnr?QYAs=MgKx(IFO}QgeC&!JLUu z)bqxkftu0uWvyvmVXJS&QmEEc#ixEreA?3-H<}dDqWvsyx62GwVXKeZe)wV)p z6ny7p>i+$!rg%a{q9lg_lir)-0}jYi(fIJCrit}%HY(a6J(_H$4c!~zib?wQD(3k^ zl`e<+wO5CR-IGyzeh*09rPnNirtDBFJYcN7pTDZ}Cn?)3h9u<>{ag9$(EVw%CYL!a z@pNOj#G@|V@E7;5YSxXgIMZeFL>n}PFRiOtScYi8gOmI`JQ?*q8GIm~SZF9Ci4W3N z^tyLl!Il!2W&Pm&af7cV$R$$9u#UiFaI zvhO7QORM6~e$&~XY4k!Jfp@iwq@ATQW%WOF)A6q#E_d~&D;tFVSl6b=F(n$ME8SnZ zg}T#8alo;pOR93Ue8TSVMk$T$7j&>cc%36FeF6(8T%0Oh7$ zQpu#SX?Vn{z$hkTznf9O7VpuT!dnTv%sksZ%V6al{E9qn=9xHam!fp1s1tyg^B`Wl zW+4RSY@00Xefi7FWLQCiu}qqQrG zMetK@ip6R{qLG-1^Eaktsi8I1PbeJiBQnHH71BuA++*2DSnQ?}ym^%`tuM>Gr8OWg z!X)|E$eYn&6%0Of)zWHttd&sy8vdx7t)WN1WSwsHjER;LUG1~8c|)%A!tWw zr(B_MD?L)f4M?r~SiHkw&9Vy-$CW}Jkkec{_blkW1~0_uOa(u>Ev3kZ-rutKQV z<5;@16H6u7;_?z0^mP+gw-4edjjAzI(3)i1fVRqU>BMQ?+t1uOznTjV(~1)#u`yq; z^2||`mq^nhBU|@+)J*B6pX90bS-&%5x79z1V9* zXqXe@Gu*yzW%uGqe$Rrbi)wN!8Aw1bF)BZW)yG5WLD=)c=J))};FD!bGmBv=RI&v$ zAf~6w$yviuC+4!ULNh5xbmUhqvF3jKBDd={V-P;W;+QWDJk*e`JXkT)@D!(J;uZ{~ z>TZ_kc7_=u^ll=h*Ct2F#G0=oXInY7#Fs6LvT2GPuikjA+2@s6P{UOIMt5#e0;su` zPEnF^SW%;*7L%rX5Aoq^!&VjDZnpx1X*$MS@D35dD&63#+BFE=_8NY~+Cn|JC1&`+ zHf&v`Q|TsGzGufoU$QwT1<_oVMW`s;>^4$7r(gUMBZ(l>Yw&Wf15&f&QJNz29vSmP zBjhdIWHjBY0txjWJ2OLF_Rs9tuP7|m+(q-KewKNvLL@ji3~+i!$UO~i&kcX8so^Hs zEth7f^F>_>6e|Um3*F~jP|^}v)S7=;@<3|@(e=Sod~hqk!^=UBqz4^|AWv-iwwRv3 zu|@Iyr?#AYoA9+m#AWde$y|-3OntA1A@%2MUs|fo#hbd{s z5Shf(OjkWtRJiMXvzBAEZ~?ZC_dbaGaFgD;nMg#V(fPS(HuaND_TN7Bn^U=flg~=# zPI?xr>%mdfSW-|hKZTWyNur?qq;n@M`%8~5BO^BkS%P}C-FbhZ$MF3<8^0^&&h7RO z2J(@;?l;=ZMGY!i$5-%aE5dE{~9|c%-(RHRaLTUP}2ayUNmpp#wN@N zTztP~vym-vS3?*JPDKn5uEDB;9 zEdT;e9k&&`--8sDm5xD z3{})2Z{BulG_b3Uymf_yv|=uVLGNbRWl9n<8{|!6l164w66FXDa#)d@hsS^Cu$~ka zD`{?RJyz%Ut^278I4eFzldAScN!p^~Hw_+qabx6sa{X*z^k=dvCU6M5VRp3bJT|-j z0Mkfbon;$)p; zibBdL*`6e^$>K(TdsHMv*TeWE8%Zh+FRP+^-xEw+8hb|(u~gu>;-ws&E?QAmdR`bp z**-|xwZgW_`2%(E$0yRgq5G@B@AmoN@i9zib3_<4$ReJl>WQ&|#nlWh{1G{%lt0yc z>yB(Tx9m)6n)L_yE94_q3&9GS#poU-vc+dP-)wV)yTS@ZcvUvvm7O}kmwC9j#C^$= zyMzORf@T<|3lER@)B?d_{7|1(#$yAKUs18zFS*`!8!D;d4+K6e+qfJRt$afsvlB;* ziK+C+%PiXDEP$Y6{jG-CU!@HDIoVu#TOuinrs}fJ1S6(3!jJJ|L$3{#NygV!S9>s1 zwE;YtcSeSW=64(&1WEFmTMmKQZ=z8}?7VRuqqmg`Ep`sM7=u{|;aOgF1rA16uIP=k zzsECi4w#Y7Tt3>(${qU=ID_BK2>O(en7GZiIe9J$4Lu)pw{Eo1`p%^>GmJjx2K{V3 zS!bC6o8}!(CmCLPbo}*u*&s_vHm)a+Su$l598%mm`e=v8p9$74-BR_925CZI!e*L+!zc%?$%C>xgzR>~l^kZ0ITNBOoYN3KD`*m8ax2e*m)=v>S zk>m5J+A~3Awy5!YdF6qstvWi1_gtT#s|iQ@zIVe=UTYI?KZb^cOb-M!9Ja->Fz~Bj fZ$jD^##iAE!=tD$;plG{cO5-#V??pm&Aa~qFUaxB literal 0 HcmV?d00001 diff --git a/core/img/web.svg b/core/img/web.svg new file mode 100644 index 00000000000..bc6c6bde650 --- /dev/null +++ b/core/img/web.svg @@ -0,0 +1,183 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 45d16916718ea103b371da9c7bef0385717d8cef Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Wed, 10 Jul 2013 13:38:42 +0200 Subject: [PATCH 080/170] fix orientation before caching preview --- lib/preview.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/preview.php b/lib/preview.php index f12107c9f57..6173fc8aa6b 100755 --- a/lib/preview.php +++ b/lib/preview.php @@ -332,7 +332,7 @@ class Preview { $preview = $provider->getThumbnail($file, $maxX, $maxY, $scalingup, $this->fileview); - if(!$preview) { + if(!($preview instanceof \OC_Image)) { continue; } @@ -346,6 +346,8 @@ class Preview { if($this->userview->is_dir(self::THUMBNAILS_FOLDER . '/' . $fileid . '/') === false) { $this->userview->mkdir(self::THUMBNAILS_FOLDER . '/' . $fileid . '/'); } + + $preview->fixOrientation(); $this->userview->file_put_contents($cachepath, $preview->data()); break; @@ -382,8 +384,6 @@ class Preview { * @return image */ public function resizeAndCrop() { - $this->preview->fixOrientation(); - $image = $this->preview; $x = $this->maxX; $y = $this->maxY; From 7091d7a6d2c495901383d89aaa0030366bf61d02 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Wed, 10 Jul 2013 17:57:04 +0200 Subject: [PATCH 081/170] clean up oc\preview --- lib/preview.php | 305 +++++++++++++++++++++++++++++------------------- 1 file changed, 183 insertions(+), 122 deletions(-) diff --git a/lib/preview.php b/lib/preview.php index 6173fc8aa6b..8ecad159157 100755 --- a/lib/preview.php +++ b/lib/preview.php @@ -23,7 +23,7 @@ require_once('preview/unknown.php'); require_once('preview/office.php'); class Preview { - //the thumbnail folder + //the thumbnail folder const THUMBNAILS_FOLDER = 'thumbnails'; //config @@ -50,7 +50,7 @@ class Preview { /** * @brief check if thumbnail or bigger version of thumbnail of file is cached - * @param $user userid + * @param $user userid - if no user is given, OC_User::getUser will be used * @param $root path of root * @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 @@ -59,73 +59,35 @@ class Preview { * false if thumbnail does not exist * path to thumbnail if thumbnail exists */ - public function __construct($user=null, $root='', $file='', $maxX=0, $maxY=0, $scalingup=true, $force=false) { + public function __construct($user='', $root='/', $file='', $maxX=1, $maxY=1, $scalingup=true) { //set config $this->max_x = \OC_Config::getValue('preview_max_x', null); $this->max_y = \OC_Config::getValue('preview_max_y', null); $this->max_scale_factor = \OC_Config::getValue('preview_max_scale_factor', 10); //save parameters - $this->file = $file; - $this->maxX = $maxX; - $this->maxY = $maxY; - $this->scalingup = $scalingup; + $this->setFile($file); + $this->setMaxX($maxX); + $this->setMaxY($maxY); + $this->setScalingUp($scalingup); //init fileviews + if($user === ''){ + $user = OC_User::getUser(); + } $this->fileview = new \OC\Files\View('/' . $user . '/' . $root); $this->userview = new \OC\Files\View('/' . $user); + + $this->preview = null; - if($force !== true) { - if(!is_null($this->max_x)) { - if($this->maxX > $this->max_x) { - \OC_Log::write('core', 'maxX reduced from ' . $this->maxX . ' to ' . $this->max_x, \OC_Log::DEBUG); - $this->maxX = $this->max_x; - } - } + //check if there are preview backends + if(empty(self::$providers)) { + self::initProviders(); + } - if(!is_null($this->max_y)) { - if($this->maxY > $this->max_y) { - \OC_Log::write('core', 'maxY reduced from ' . $this->maxY . ' to ' . $this->max_y, \OC_Log::DEBUG); - $this->maxY = $this->max_y; - } - } - - $fileinfo = $this->fileview->getFileInfo($this->file); - if(array_key_exists('size', $fileinfo)){ - if((int) $fileinfo['size'] === 0){ - \OC_Log::write('core', 'You can\'t generate a preview of a 0 byte file (' . $this->file . ')', \OC_Log::ERROR); - throw new \Exception('0 byte file given'); - } - } - - //init providers - if(empty(self::$providers)) { - self::initProviders(); - } - - //check if there are any providers at all - if(empty(self::$providers)) { - \OC_Log::write('core', 'No preview providers exist', \OC_Log::ERROR); - throw new \Exception('No providers'); - } - - //validate parameters - if($file === '') { - \OC_Log::write('core', 'No filename passed', \OC_Log::ERROR); - throw new \Exception('File not found'); - } - - //check if file exists - if(!$this->fileview->file_exists($file)) { - \OC_Log::write('core', 'File:"' . $file . '" not found', \OC_Log::ERROR); - throw new \Exception('File not found'); - } - - //check if given size makes sense - if($maxX === 0 || $maxY === 0) { - \OC_Log::write('core', 'Can not create preview with 0px width or 0px height', \OC_Log::ERROR); - throw new \Exception('Height and/or width set to 0'); - } + if(empty(self::$providers)) { + \OC_Log::write('core', 'No preview providers exist', \OC_Log::ERROR); + throw new \Exception('No preview providers'); } } @@ -165,7 +127,7 @@ class Preview { * @brief returns the name of the thumbnailfolder * @return string */ - public function getThumbnailsfolder() { + public function getThumbnailsFolder() { return self::THUMBNAILS_FOLDER; } @@ -193,16 +155,97 @@ class Preview { return $this->max_y; } + /** + * @brief set the path of the file you want a thumbnail from + * @return $this + */ + public function setFile($file) { + $this->file = $file; + return $this; + } + + /** + * @brief set the the max width of the preview + * @return $this + */ + public function setMaxX($maxX=1) { + if($maxX === 0) { + throw new \Exception('Cannot set width of 0!'); + } + $configMaxX = $this->getConfigMaxX(); + if(!is_null($configMaxX)) { + if($maxX > $configMaxX) { + \OC_Log::write('core', 'maxX reduced from ' . $maxX . ' to ' . $configMaxX, \OC_Log::DEBUG); + $maxX = $configMaxX; + } + } + $this->maxX = $maxX; + return $this; + } + + /** + * @brief set the the max height of the preview + * @return $this + */ + public function setMaxY($maxY=1) { + if($maxY === 0) { + throw new \Exception('Cannot set height of 0!'); + } + $configMaxY = $this->getConfigMaxY(); + if(!is_null($configMaxY)) { + if($maxY > $configMaxY) { + \OC_Log::write('core', 'maxX reduced from ' . $maxY . ' to ' . $configMaxY, \OC_Log::DEBUG); + $maxY = $configMaxY; + } + } + $this->maxY = $maxY; + return $this; + } + + /** + * @brief set whether or not scalingup is enabled + * @return $this + */ + public function setScalingup($scalingup) { + if($this->getMaxScaleFactor() === 1) { + $scalingup = false; + } + $this->scalingup = $scalingup; + return $this; + } + + /** + * @brief check if all parameters are valid + * @return integer + */ + public function isFileValid() { + $file = $this->getFile(); + if($file === '') { + \OC_Log::write('core', 'No filename passed', \OC_Log::ERROR); + return false; + } + + if(!$this->fileview->file_exists($file)) { + \OC_Log::write('core', 'File:"' . $file . '" not found', \OC_Log::ERROR); + return false; + } + + return true; + } + /** * @brief deletes previews of a file with specific x and y * @return bool */ public function deletePreview() { - $fileinfo = $this->fileview->getFileInfo($this->file); + $file = $this->getFile(); + + $fileinfo = $this->fileview->getFileInfo($file); $fileid = $fileinfo['fileid']; - $this->userview->unlink(self::THUMBNAILS_FOLDER . '/' . $fileid . '/' . $this->maxX . '-' . $this->maxY . '.png'); - return; + $previepath = $this->getThumbnailsFolder() . '/' . $fileid . '/' . $this->getMaxX() . '-' . $this->getMaxY() . '.png'; + $this->userview->unlink($previepath); + return $this->userview->file_exists($previepath); } /** @@ -210,12 +253,15 @@ class Preview { * @return bool */ public function deleteAllPreviews() { - $fileinfo = $this->fileview->getFileInfo($this->file); - $fileid = $fileinfo['fileid']; + $file = $this->getFile(); - $this->userview->deleteAll(self::THUMBNAILS_FOLDER . '/' . $fileid . '/'); - $this->userview->rmdir(self::THUMBNAILS_FOLDER . '/' . $fileid . '/'); - return; + $fileinfo = $this->fileview->getFileInfo($file); + $fileid = $fileinfo['fileid']; + + $previewpath = $this->getThumbnailsFolder() . '/' . $fileid . '/'; + $this->userview->deleteAll($previewpath); + $this->userview->rmdir($previewpath); + return $this->userview->is_dir($previepath); } /** @@ -225,21 +271,23 @@ class Preview { * path to thumbnail if thumbnail exists */ private function isCached() { - $file = $this->file; - $maxX = $this->maxX; - $maxY = $this->maxY; - $scalingup = $this->scalingup; + $file = $this->getFile(); + $maxX = $this->getMaxX(); + $maxY = $this->getMaxY(); + $scalingup = $this->getScalingup(); + $maxscalefactor = $this->getMaxScaleFactor(); $fileinfo = $this->fileview->getFileInfo($file); $fileid = $fileinfo['fileid']; - if(!$this->userview->is_dir(self::THUMBNAILS_FOLDER . '/' . $fileid)) { + $previewpath = $this->getThumbnailsFolder() . '/' . $fileid . '/'; + if(!$this->userview->is_dir($previewpath)) { return false; } //does a preview with the wanted height and width already exist? - if($this->userview->file_exists(self::THUMBNAILS_FOLDER . '/' . $fileid . '/' . $maxX . '-' . $maxY . '.png')) { - return self::THUMBNAILS_FOLDER . '/' . $fileid . '/' . $maxX . '-' . $maxY . '.png'; + if($this->userview->file_exists($previewpath . $maxX . '-' . $maxY . '.png')) { + return $previewpath . $maxX . '-' . $maxY . '.png'; } $wantedaspectratio = $maxX / $maxY; @@ -247,7 +295,7 @@ class Preview { //array for usable cached thumbnails $possiblethumbnails = array(); - $allthumbnails = $this->userview->getDirectoryContent(self::THUMBNAILS_FOLDER . '/' . $fileid); + $allthumbnails = $this->userview->getDirectoryContent($previewpath); foreach($allthumbnails as $thumbnail) { $size = explode('-', $thumbnail['name']); $x = $size[0]; @@ -261,7 +309,7 @@ class Preview { if($x < $maxX || $y < $maxY) { if($scalingup) { $scalefactor = $maxX / $x; - if($scalefactor > $this->max_scale_factor) { + if($scalefactor > $maxscalefactor) { continue; } }else{ @@ -307,22 +355,28 @@ class Preview { * @return image */ public function getPreview() { - $file = $this->file; - $maxX = $this->maxX; - $maxY = $this->maxY; - $scalingup = $this->scalingup; + if(!is_null($this->preview) && $this->preview->valid()){ + return $this->preview; + } + + $this->preview = null; + $file = $this->getFile(); + $maxX = $this->getMaxX(); + $maxY = $this->getMaxY(); + $scalingup = $this->getScalingup(); $fileinfo = $this->fileview->getFileInfo($file); $fileid = $fileinfo['fileid']; - $cached = self::isCached(); + $cached = $this->isCached(); if($cached) { $image = new \OC_Image($this->userview->file_get_contents($cached, 'r')); - $this->preview = $image; - }else{ - $mimetype = $this->fileview->getMimeType($file); + $this->preview = $image->valid() ? $image : null; + } + if(is_null($this->preview)) { + $mimetype = $this->fileview->getMimeType($file); $preview = null; foreach(self::$providers as $supportedmimetype => $provider) { @@ -336,35 +390,35 @@ class Preview { continue; } - //are there any cached thumbnails yet - if($this->userview->is_dir(self::THUMBNAILS_FOLDER . '/') === false) { - $this->userview->mkdir(self::THUMBNAILS_FOLDER . '/'); + $this->preview = $preview; + $this->resizeAndCrop(); + + $previewpath = $this->getThumbnailsFolder() . '/' . $fileid . '/'; + $cachepath = $previewpath . $maxX . '-' . $maxY . '.png'; + + if($this->userview->is_dir($this->getThumbnailsFolder() . '/') === false) { + $this->userview->mkdir($this->getThumbnailsFolder() . '/'); } - //cache thumbnail - $cachepath = self::THUMBNAILS_FOLDER . '/' . $fileid . '/' . $maxX . '-' . $maxY . '.png'; - if($this->userview->is_dir(self::THUMBNAILS_FOLDER . '/' . $fileid . '/') === false) { - $this->userview->mkdir(self::THUMBNAILS_FOLDER . '/' . $fileid . '/'); + if($this->userview->is_dir($previewpath) === false) { + $this->userview->mkdir($previewpath); } - $preview->fixOrientation(); $this->userview->file_put_contents($cachepath, $preview->data()); break; } - - if(is_null($preview) || $preview === false) { - $preview = new \OC_Image(); - } - - $this->preview = $preview; } - $this->resizeAndCrop(); + + if(is_null($this->preview)) { + $this->preview = new \OC_Image(); + } + return $this->preview; } /** - * @brief return a preview of a file + * @brief show preview * @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 @@ -372,67 +426,74 @@ class Preview { * @return void */ public function showPreview() { - \OCP\Response::enableCaching(3600 * 24); // 24 hour - $preview = $this->getPreview(); - if($preview) { - $preview->show(); + \OCP\Response::enableCaching(3600 * 24); // 24 hours + if(is_null($this->preview)) { + $this->getPreview(); } + $this->preview->show(); } /** * @brief resize, crop and fix orientation * @return image */ - public function resizeAndCrop() { + private function resizeAndCrop() { $image = $this->preview; - $x = $this->maxX; - $y = $this->maxY; - $scalingup = $this->scalingup; + $x = $this->getMaxX(); + $y = $this->getMaxY(); + $scalingup = $this->getScalingup(); + $maxscalefactor = $this->getMaxScaleFactor(); if(!($image instanceof \OC_Image)) { - \OC_Log::write('core', 'Object passed to resizeAndCrop is not an instance of OC_Image', \OC_Log::DEBUG); + \OC_Log::write('core', '$this->preview is not an instance of OC_Image', \OC_Log::DEBUG); return; } + $image->fixOrientation(); + $realx = (int) $image->width(); $realy = (int) $image->height(); if($x === $realx && $y === $realy) { - return $image; + $this->preview = $image; + return true; } $factorX = $x / $realx; $factorY = $y / $realy; - + if($factorX >= $factorY) { $factor = $factorX; }else{ $factor = $factorY; } - - // only scale up if requested + if($scalingup === false) { - if($factor>1) $factor=1; - } - if(!is_null($this->max_scale_factor)) { - if($factor > $this->max_scale_factor) { - \OC_Log::write('core', 'scalefactor reduced from ' . $factor . ' to ' . $this->max_scale_factor, \OC_Log::DEBUG); - $factor = $this->max_scale_factor; + if($factor > 1) { + $factor = 1; } } - $newXsize = $realx * $factor; - $newYsize = $realy * $factor; - // resize + if(!is_null($maxscalefactor)) { + if($factor > $maxscalefactor) { + \OC_Log::write('core', 'scalefactor reduced from ' . $factor . ' to ' . $maxscalefactor, \OC_Log::DEBUG); + $factor = $maxscalefactor; + } + } + + $newXsize = (int) ($realx * $factor); + $newYsize = (int) ($realy * $factor); + $image->preciseResize($newXsize, $newYsize); - if($newXsize === $x && $newYsize === $y) { + if($newXsize == $x && $newYsize === $y) { $this->preview = $image; return; } if($newXsize >= $x && $newYsize >= $y) { $cropX = floor(abs($x - $newXsize) * 0.5); + //don't crop previews on the Y axis, this sucks if it's a document. //$cropY = floor(abs($y - $newYsize) * 0.5); $cropY = 0; From f14b0fa6e0dfad28f2f6573ec517019ac12342cf Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Wed, 10 Jul 2013 18:01:04 +0200 Subject: [PATCH 082/170] update some comments in preview lib --- lib/preview.php | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/lib/preview.php b/lib/preview.php index 8ecad159157..0a8ab438367 100755 --- a/lib/preview.php +++ b/lib/preview.php @@ -348,10 +348,6 @@ 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 function getPreview() { @@ -419,10 +415,6 @@ class Preview { /** * @brief show preview - * @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 void */ public function showPreview() { @@ -431,6 +423,7 @@ class Preview { $this->getPreview(); } $this->preview->show(); + return; } /** @@ -486,7 +479,7 @@ class Preview { $image->preciseResize($newXsize, $newYsize); - if($newXsize == $x && $newYsize === $y) { + if($newXsize === $x && $newYsize === $y) { $this->preview = $image; return; } From 5c31b843fc62b2be43d85ca680eeffa3e6f292dd Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Wed, 10 Jul 2013 18:04:13 +0200 Subject: [PATCH 083/170] fix typo --- lib/preview.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/preview.php b/lib/preview.php index 0a8ab438367..f018fa38850 100755 --- a/lib/preview.php +++ b/lib/preview.php @@ -243,9 +243,9 @@ class Preview { $fileinfo = $this->fileview->getFileInfo($file); $fileid = $fileinfo['fileid']; - $previepath = $this->getThumbnailsFolder() . '/' . $fileid . '/' . $this->getMaxX() . '-' . $this->getMaxY() . '.png'; - $this->userview->unlink($previepath); - return $this->userview->file_exists($previepath); + $previewpath = $this->getThumbnailsFolder() . '/' . $fileid . '/' . $this->getMaxX() . '-' . $this->getMaxY() . '.png'; + $this->userview->unlink($previewpath); + return $this->userview->file_exists($previewpath); } /** @@ -261,7 +261,7 @@ class Preview { $previewpath = $this->getThumbnailsFolder() . '/' . $fileid . '/'; $this->userview->deleteAll($previewpath); $this->userview->rmdir($previewpath); - return $this->userview->is_dir($previepath); + return $this->userview->is_dir($previewpath); } /** From 7f71ae60b0fefe697aa9da2cda40853736df0580 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Thu, 11 Jul 2013 10:10:07 +0200 Subject: [PATCH 084/170] improve validation of oc\preview and implement preview of error icon if something went wrong --- lib/preview.php | 249 ++++++++++++++++++++++++++++++------------------ 1 file changed, 156 insertions(+), 93 deletions(-) diff --git a/lib/preview.php b/lib/preview.php index f018fa38850..94e0cd96e7c 100755 --- a/lib/preview.php +++ b/lib/preview.php @@ -426,6 +426,14 @@ class Preview { return; } + /** + * @brief show preview + * @return void + */ + public function show() { + return $this->showPreview(); + } + /** * @brief resize, crop and fix orientation * @return image @@ -567,30 +575,40 @@ class Preview { * @brief method that handles preview requests from users that are logged in * @return void */ - public static function previewRouter($params) { + public static function previewRouter() { \OC_Util::checkLoggedIn(); - $file = ''; - $maxX = 0; - $maxY = 0; - $scalingup = true; + $file = array_key_exists('file', $_GET) ? (string) urldecode($_GET['file']) : ''; + $maxX = array_key_exists('x', $_GET) ? (int) $_GET['x'] : '44'; + $maxY = array_key_exists('y', $_GET) ? (int) $_GET['y'] : '44'; + $scalingup = array_key_exists('scalingup', $_GET) ? (bool) $_GET['scalingup'] : true; - if(array_key_exists('file', $_GET)) $file = (string) urldecode($_GET['file']); - if(array_key_exists('x', $_GET)) $maxX = (int) $_GET['x']; - if(array_key_exists('y', $_GET)) $maxY = (int) $_GET['y']; - if(array_key_exists('scalingup', $_GET)) $scalingup = (bool) $_GET['scalingup']; + if($file === '') { + \OC_Response::setStatus(400); //400 Bad Request + \OC_Log::write('core-preview', 'No file parameter was passed', \OC_Log::DEBUG); + self::showErrorPreview(); + exit; + } - if($file !== '' && $maxX !== 0 && $maxY !== 0) { - try{ - $preview = new Preview(\OC_User::getUser(), 'files', $file, $maxX, $maxY, $scalingup); - $preview->showPreview(); - }catch(\Exception $e) { - \OC_Response::setStatus(404); - \OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR); - exit; - } - }else{ - \OC_Response::setStatus(404); + 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); + self::showErrorPreview(); + exit; + } + + try{ + $preview = new Preview(\OC_User::getUser(), 'files'); + $preview->setFile($file); + $preview->setMaxX($maxX); + $preview->setMaxY($maxY); + $preview->setScalingUp($scalingup); + + $preview->show(); + }catch(\Exception $e) { + \OC_Response::setStatus(500); + \OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR); + self::showErrorPreview(); exit; } } @@ -599,94 +617,132 @@ class Preview { * @brief method that handles preview requests from users that are not logged in / view shared folders that are public * @return void */ - public static function publicPreviewRouter($params) { - $file = ''; - $maxX = 0; - $maxY = 0; - $scalingup = true; - $token = ''; - - $user = null; - $path = null; - - if(array_key_exists('file', $_GET)) $file = (string) urldecode($_GET['file']); - if(array_key_exists('x', $_GET)) $maxX = (int) $_GET['x']; - if(array_key_exists('y', $_GET)) $maxY = (int) $_GET['y']; - if(array_key_exists('scalingup', $_GET)) $scalingup = (bool) $_GET['scalingup']; - if(array_key_exists('t', $_GET)) $token = (string) $_GET['t']; - - $linkItem = \OCP\Share::getShareByToken($token); - - if (is_array($linkItem) && isset($linkItem['uid_owner']) && isset($linkItem['file_source'])) { - $userid = $linkItem['uid_owner']; - \OC_Util::setupFS($userid); - - $pathid = $linkItem['file_source']; - $path = \OC\Files\Filesystem::getPath($pathid); - $pathinfo = \OC\Files\Filesystem::getFileInfo($path); - - $sharedfile = null; - if($linkItem['item_type'] === 'folder') { - //clean up file parameter - $sharedfile = \OC\Files\Filesystem::normalizePath($file); - if(!\OC\Files\Filesystem::isValidPath($file)) { - \OC_Response::setStatus(403); - exit; - } - } else if($linkItem['item_type'] === 'file') { - $parent = $pathinfo['parent']; - $path = \OC\Files\Filesystem::getPath($parent); - $sharedfile = $pathinfo['name']; - } - - $path = \OC\Files\Filesystem::normalizePath($path, false); - if(substr($path, 0, 1) == '/') { - $path = substr($path, 1); - } + public static function publicPreviewRouter() { + if(!\OC_App::isEnabled('files_sharing')){ + exit; } - if($userid !== null && $path !== null && $sharedfile !== null) { - try{ - $preview = new Preview($userid, 'files/' . $path, $sharedfile, $maxX, $maxY, $scalingup); - $preview->showPreview(); - }catch(\Exception $e) { - \OC_Response::setStatus(404); - \OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR); + $file = array_key_exists('file', $_GET) ? (string) urldecode($_GET['file']) : ''; + $maxX = array_key_exists('x', $_GET) ? (int) $_GET['x'] : '44'; + $maxY = array_key_exists('y', $_GET) ? (int) $_GET['y'] : '44'; + $scalingup = array_key_exists('scalingup', $_GET) ? (bool) $_GET['scalingup'] : true; + $token = array_key_exists('t', $_GET) ? (string) $_GET['t'] : ''; + + if($token === ''){ + \OC_Response::setStatus(400); //400 Bad Request + \OC_Log::write('core-preview', 'No token parameter was passed', \OC_Log::DEBUG); + self::showErrorPreview(); + exit; + } + + $linkedItem = \OCP\Share::getShareByToken($token); + if($linkedItem === false || ($linkedItem['item_type'] !== 'file' && $linkedItem['item_type'] !== 'folder')) { + \OC_Response::setStatus(404); + \OC_Log::write('core-preview', 'Passed token parameter is not valid', \OC_Log::DEBUG); + self::showErrorPreview(); + exit; + } + + if(!isset($linkedItem['uid_owner']) || !isset($linkedItem['file_source'])) { + \OC_Response::setStatus(500); + \OC_Log::write('core-preview', 'Passed token seems to be valid, but it does not contain all necessary information . ("' . $token . '")'); + self::showErrorPreview(); + exit; + } + + $userid = $linkedItem['uid_owner']; + \OC_Util::setupFS($userid); + + $pathid = $linkedItem['file_source']; + $path = \OC\Files\Filesystem::getPath($pathid); + $pathinfo = \OC\Files\Filesystem::getFileInfo($path); + $sharedfile = null; + + if($linkedItem['item_type'] === 'folder') { + $isvalid = \OC\File\Filesystem::isValidPath($file); + if(!$isvalid) { + \OC_Response::setStatus(400); //400 Bad Request + \OC_Log::write('core-preview', 'Passed filename is not valid, might be malicious (file:"' . $file . '";ip:"' . $_SERVER['REMOTE_ADDR'] . '")', \OC_Log::WARN); + self::showErrorPreview(); exit; } - }else{ - \OC_Response::setStatus(404); + $sharedfile = \OC\Files\Filesystem::normalizePath($file); + } + + if($linkedItem['item_type'] === 'file') { + $parent = $pathinfo['parent']; + $path = \OC\Files\Filesystem::getPath($parent); + $sharedfile = $pathinfo['name']; + } + + $path = \OC\Files\Filesystem::normalizePath($path, false); + if(substr($path, 0, 1) == '/') { + $path = substr($path, 1); + } + + 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); + self::showErrorPreview(); + exit; + } + + $root = 'files/' . $path; + + try{ + $preview = new Preview($userid, $path); + $preview->setFile($file); + $preview->setMaxX($maxX); + $preview->setMaxY($maxY); + $preview->setScalingUp($scalingup); + + $preview->show(); + }catch(\Exception $e) { + \OC_Response::setStatus(500); + \OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR); + self::showErrorPreview(); exit; } } public static function trashbinPreviewRouter() { + \OC_Util::checkLoggedIn(); + if(!\OC_App::isEnabled('files_trashbin')){ exit; } - \OC_Util::checkLoggedIn(); - $file = ''; - $maxX = 0; - $maxY = 0; - $scalingup = true; + $file = array_key_exists('file', $_GET) ? (string) urldecode($_GET['file']) : ''; + $maxX = array_key_exists('x', $_GET) ? (int) $_GET['x'] : '44'; + $maxY = array_key_exists('y', $_GET) ? (int) $_GET['y'] : '44'; + $scalingup = array_key_exists('scalingup', $_GET) ? (bool) $_GET['scalingup'] : true; - if(array_key_exists('file', $_GET)) $file = (string) urldecode($_GET['file']); - if(array_key_exists('x', $_GET)) $maxX = (int) $_GET['x']; - if(array_key_exists('y', $_GET)) $maxY = (int) $_GET['y']; - if(array_key_exists('scalingup', $_GET)) $scalingup = (bool) $_GET['scalingup']; + if($file === '') { + \OC_Response::setStatus(400); //400 Bad Request + \OC_Log::write('core-preview', 'No file parameter was passed', \OC_Log::DEBUG); + self::showErrorPreview(); + exit; + } - if($file !== '' && $maxX !== 0 && $maxY !== 0) { - try{ - $preview = new Preview(\OC_User::getUser(), 'files_trashbin/files', $file, $maxX, $maxY, $scalingup); - $preview->showPreview(); - }catch(\Exception $e) { - \OC_Response::setStatus(404); - \OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR); - exit; - } - }else{ - \OC_Response::setStatus(404); + 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); + self::showErrorPreview(); + exit; + } + + try{ + $preview = new Preview(\OC_User::getUser(), 'files_trashbin/files'); + $preview->setFile($file); + $preview->setMaxX($maxX); + $preview->setMaxY($maxY); + $preview->setScalingUp($scalingup); + + $preview->showPreview(); + }catch(\Exception $e) { + \OC_Response::setStatus(500); + \OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR); + self::showErrorPreview(); exit; } } @@ -703,4 +759,11 @@ class Preview { $preview = new Preview(\OC_User::getUser(), 'files/', $path, 0, 0, false, true); $preview->deleteAllPreviews(); } + + private static function showErrorPreview() { + $path = \OC::$SERVERROOT . '/core/img/actions/delete.png'; + $preview = new \OC_Image($path); + $preview->preciseResize(44, 44); + $preview->show(); + } } \ No newline at end of file From 4bbbba1dc8288462881d9bfdf979b3f207572d2e Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Thu, 11 Jul 2013 11:43:53 +0200 Subject: [PATCH 085/170] fix typo --- lib/preview.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/preview.php b/lib/preview.php index 94e0cd96e7c..5b2ee2cddd4 100755 --- a/lib/preview.php +++ b/lib/preview.php @@ -659,7 +659,7 @@ class Preview { $sharedfile = null; if($linkedItem['item_type'] === 'folder') { - $isvalid = \OC\File\Filesystem::isValidPath($file); + $isvalid = \OC\Files\Filesystem::isValidPath($file); if(!$isvalid) { \OC_Response::setStatus(400); //400 Bad Request \OC_Log::write('core-preview', 'Passed filename is not valid, might be malicious (file:"' . $file . '";ip:"' . $_SERVER['REMOTE_ADDR'] . '")', \OC_Log::WARN); From 06eca985ce493bba65293003bd52aed10566c6d6 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Thu, 11 Jul 2013 11:57:19 +0200 Subject: [PATCH 086/170] use $root instead of $path --- lib/preview.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/preview.php b/lib/preview.php index 5b2ee2cddd4..62bcf4873b5 100755 --- a/lib/preview.php +++ b/lib/preview.php @@ -690,7 +690,7 @@ class Preview { $root = 'files/' . $path; try{ - $preview = new Preview($userid, $path); + $preview = new Preview($userid, $root); $preview->setFile($file); $preview->setMaxX($maxX); $preview->setMaxY($maxY); From 53830f2f751151d2d326b253471e63d9b1cf8eb1 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Thu, 11 Jul 2013 11:58:52 +0200 Subject: [PATCH 087/170] implement use of previews in sharing app --- apps/files/index.php | 1 + apps/files/templates/part.list.php | 9 ++++++++- apps/files_sharing/public.php | 3 +++ lib/helper.php | 4 ++++ lib/public/template.php | 10 ++++++++++ lib/template.php | 4 ++++ 6 files changed, 30 insertions(+), 1 deletion(-) diff --git a/apps/files/index.php b/apps/files/index.php index 2338cf439e4..156febd87f4 100644 --- a/apps/files/index.php +++ b/apps/files/index.php @@ -95,6 +95,7 @@ $list->assign('files', $files); $list->assign('baseURL', OCP\Util::linkTo('files', 'index.php') . '?dir='); $list->assign('downloadURL', OCP\Util::linkToRoute('download', array('file' => '/'))); $list->assign('disableSharing', false); +$list->assign('isPublic', false); $breadcrumbNav = new OCP\Template('files', 'part.breadcrumb', ''); $breadcrumbNav->assign('breadcrumb', $breadcrumb); $breadcrumbNav->assign('baseURL', OCP\Util::linkTo('files', 'index.php') . '?dir='); diff --git a/apps/files/templates/part.list.php b/apps/files/templates/part.list.php index 38d1314392b..9e62c991975 100644 --- a/apps/files/templates/part.list.php +++ b/apps/files/templates/part.list.php @@ -30,7 +30,14 @@ $totalsize = 0; ?> style="background-image:url()" - style="background-image:url()" + + + style="background-image:url()" + + style="background-image:url()" + > diff --git a/apps/files_sharing/public.php b/apps/files_sharing/public.php index 9462844a82b..0c4150f74d2 100644 --- a/apps/files_sharing/public.php +++ b/apps/files_sharing/public.php @@ -191,6 +191,9 @@ if (isset($path)) { $list->assign('baseURL', OCP\Util::linkToPublic('files') . $urlLinkIdentifiers . '&path='); $list->assign('downloadURL', OCP\Util::linkToPublic('files') . $urlLinkIdentifiers . '&download&path='); + $list->assign('isPublic', true); + $list->assign('sharingtoken', $token); + $list->assign('sharingroot', ($path)); $breadcrumbNav = new OCP\Template('files', 'part.breadcrumb', ''); $breadcrumbNav->assign('breadcrumb', $breadcrumb); $breadcrumbNav->assign('baseURL', OCP\Util::linkToPublic('files') . $urlLinkIdentifiers . '&path='); diff --git a/lib/helper.php b/lib/helper.php index 856dba625b3..6153f318723 100644 --- a/lib/helper.php +++ b/lib/helper.php @@ -234,6 +234,10 @@ class OC_Helper { return self::linkToRoute( 'core_ajax_preview', array('x' => 44, 'y' => 44, 'file' => urlencode($path) )); } + public static function publicPreview_icon( $path, $token ) { + return self::linkToRoute( 'core_ajax_public_preview', array('x' => 44, 'y' => 44, 'file' => urlencode($path), 't' => $token)); + } + /** * @brief Make a human file size * @param int $bytes file size in bytes diff --git a/lib/public/template.php b/lib/public/template.php index 5f9888f9f28..69997ad42b6 100644 --- a/lib/public/template.php +++ b/lib/public/template.php @@ -64,6 +64,16 @@ 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 * Makes 2048 to 2 kB. diff --git a/lib/template.php b/lib/template.php index 048d172f1c9..842c3325357 100644 --- a/lib/template.php +++ b/lib/template.php @@ -74,6 +74,10 @@ function preview_icon( $path ) { return OC_Helper::previewIcon( $path ); } +function publicPreview_icon ( $path, $token ) { + return OC_Helper::publicPreview_icon( $path, $token ); +} + /** * @brief make OC_Helper::mimetypeIcon available as a simple function * @param string $mimetype mimetype From ec75e1904d9d4c77d1a6c1c656e7deeae07a8804 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Thu, 11 Jul 2013 12:28:41 +0200 Subject: [PATCH 088/170] make jenkins happy --- lib/preview/unknown.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/preview/unknown.php b/lib/preview/unknown.php index 4e1ca7de741..a31b365722e 100644 --- a/lib/preview/unknown.php +++ b/lib/preview/unknown.php @@ -22,7 +22,11 @@ class Unknown extends Provider { $iconsroot = \OC::$SERVERROOT . '/core/img/filetypes/'; - $icons = array($mimetype, $type, 'text'); + if(isset($type)){ + $icons = array($mimetype, $type, 'text'); + }else{ + $icons = array($mimetype, 'text'); + } foreach($icons as $icon) { $icon = str_replace('/', '-', $icon); From 89554bd917f9cbc7d16cc31b754a47d9f942b0b1 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Thu, 11 Jul 2013 13:39:10 +0200 Subject: [PATCH 089/170] it's setValue not getValue, damn type --- tests/lib/preview.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/lib/preview.php b/tests/lib/preview.php index 2599da400c8..c4894f848f6 100644 --- a/tests/lib/preview.php +++ b/tests/lib/preview.php @@ -74,8 +74,8 @@ class Preview extends \PHPUnit_Framework_TestCase { $maxX = 250; $maxY = 250; - \OC_Config::getValue('preview_max_x', $maxX); - \OC_Config::getValue('preview_max_y', $maxY); + \OC_Config::setValue('preview_max_x', $maxX); + \OC_Config::setValue('preview_max_y', $maxY); $rootView = new \OC\Files\View(''); $rootView->mkdir('/'.$user); @@ -87,7 +87,10 @@ class Preview extends \PHPUnit_Framework_TestCase { $preview = new \OC\Preview($user, 'files/', 'test.txt', 1000, 1000); $image = $preview->getPreview(); - + + var_dump($image->width()); + var_dump($image->height()); + $this->assertEquals($image->width(), $maxX); $this->assertEquals($image->height(), $maxY); } From 7f3dbb6936cded830cbbf135f887a84ebd50b77c Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Thu, 11 Jul 2013 13:41:09 +0200 Subject: [PATCH 090/170] remove debug code ... --- tests/lib/preview.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/lib/preview.php b/tests/lib/preview.php index c4894f848f6..bebdc12b500 100644 --- a/tests/lib/preview.php +++ b/tests/lib/preview.php @@ -87,10 +87,7 @@ class Preview extends \PHPUnit_Framework_TestCase { $preview = new \OC\Preview($user, 'files/', 'test.txt', 1000, 1000); $image = $preview->getPreview(); - - var_dump($image->width()); - var_dump($image->height()); - + $this->assertEquals($image->width(), $maxX); $this->assertEquals($image->height(), $maxY); } From 7b2aa5d830efeea7e68a71ddc33bc6e9add1409d Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Thu, 11 Jul 2013 19:03:21 +0200 Subject: [PATCH 091/170] OC\Preview - use camelCase --- lib/preview.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/preview.php b/lib/preview.php index 62bcf4873b5..327a45d8d13 100755 --- a/lib/preview.php +++ b/lib/preview.php @@ -27,9 +27,9 @@ class Preview { const THUMBNAILS_FOLDER = 'thumbnails'; //config - private $max_scale_factor; - private $max_x; - private $max_y; + private $maxScaleFactor; + private $configMaxX; + private $configMaxY; //fileview object private $fileview = null; @@ -61,9 +61,9 @@ class Preview { */ public function __construct($user='', $root='/', $file='', $maxX=1, $maxY=1, $scalingup=true) { //set config - $this->max_x = \OC_Config::getValue('preview_max_x', null); - $this->max_y = \OC_Config::getValue('preview_max_y', null); - $this->max_scale_factor = \OC_Config::getValue('preview_max_scale_factor', 10); + $this->configMaxX = \OC_Config::getValue('preview_max_x', null); + $this->configMaxY = \OC_Config::getValue('preview_max_y', null); + $this->maxScaleFactor = \OC_Config::getValue('preview_max_scale_factor', 10); //save parameters $this->setFile($file); @@ -136,7 +136,7 @@ class Preview { * @return integer */ public function getMaxScaleFactor() { - return $this->max_scale_factor; + return $this->maxScaleFactor; } /** @@ -144,7 +144,7 @@ class Preview { * @return integer */ public function getConfigMaxX() { - return $this->max_x; + return $this->configMaxX; } /** @@ -152,7 +152,7 @@ class Preview { * @return integer */ public function getConfigMaxY() { - return $this->max_y; + return $this->configMaxY; } /** From 1e8a646f51428d19f565fa702cbb935ca8267adb Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Thu, 11 Jul 2013 19:21:37 +0200 Subject: [PATCH 092/170] OC\Preview - improve documentation --- lib/preview.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/lib/preview.php b/lib/preview.php index 327a45d8d13..fba1d893e08 100755 --- a/lib/preview.php +++ b/lib/preview.php @@ -50,11 +50,12 @@ class Preview { /** * @brief check if thumbnail or bigger version of thumbnail of file is cached - * @param $user userid - if no user is given, OC_User::getUser will be used - * @param $root path of root - * @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 string $user userid - if no user is given, OC_User::getUser will be used + * @param string $root path of root + * @param string $file The path to the file where you want a thumbnail from + * @param int $maxX The maximum X size of the thumbnail. It can be smaller depending on the shape of the image + * @param int $maxY The maximum Y size of the thumbnail. It can be smaller depending on the shape of the image + * @param bool $scalingup Disable/Enable upscaling of previews * @return mixed (bool / string) * false if thumbnail does not exist * path to thumbnail if thumbnail exists @@ -157,6 +158,7 @@ class Preview { /** * @brief set the path of the file you want a thumbnail from + * @param string $file * @return $this */ public function setFile($file) { @@ -166,6 +168,7 @@ class Preview { /** * @brief set the the max width of the preview + * @param int $maxX * @return $this */ public function setMaxX($maxX=1) { @@ -185,6 +188,7 @@ class Preview { /** * @brief set the the max height of the preview + * @param int $maxY * @return $this */ public function setMaxY($maxY=1) { @@ -204,6 +208,7 @@ class Preview { /** * @brief set whether or not scalingup is enabled + * @param bool $scalingup * @return $this */ public function setScalingup($scalingup) { @@ -216,7 +221,7 @@ class Preview { /** * @brief check if all parameters are valid - * @return integer + * @return bool */ public function isFileValid() { $file = $this->getFile(); @@ -543,6 +548,7 @@ class Preview { /** * @brief register a new preview provider to be used * @param string $provider class name of a Preview_Provider + * @param array $options * @return void */ public static function registerProvider($class, $options=array()) { From c6849bed9da49b488497eb44c81059630bade2e0 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Thu, 11 Jul 2013 20:02:59 +0200 Subject: [PATCH 093/170] OC\Preview - remove unneeded comment --- lib/preview/provider.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/preview/provider.php b/lib/preview/provider.php index 44e1d11ba06..e4a730bafc8 100644 --- a/lib/preview/provider.php +++ b/lib/preview/provider.php @@ -1,7 +1,4 @@ Date: Thu, 11 Jul 2013 20:15:30 +0200 Subject: [PATCH 094/170] OC\Preview - fix logic of two return values --- lib/preview.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/preview.php b/lib/preview.php index fba1d893e08..cc287595f40 100755 --- a/lib/preview.php +++ b/lib/preview.php @@ -250,7 +250,7 @@ class Preview { $previewpath = $this->getThumbnailsFolder() . '/' . $fileid . '/' . $this->getMaxX() . '-' . $this->getMaxY() . '.png'; $this->userview->unlink($previewpath); - return $this->userview->file_exists($previewpath); + return !$this->userview->file_exists($previewpath); } /** @@ -266,7 +266,7 @@ class Preview { $previewpath = $this->getThumbnailsFolder() . '/' . $fileid . '/'; $this->userview->deleteAll($previewpath); $this->userview->rmdir($previewpath); - return $this->userview->is_dir($previewpath); + return !$this->userview->is_dir($previewpath); } /** From 14a35267c15115a1e7d2901ddd9b8c5c7e1b9a31 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Thu, 11 Jul 2013 20:35:55 +0200 Subject: [PATCH 095/170] OC\Preview - outsource static methods --- core/routes.php | 7 ++++--- lib/preview.php | 29 +++++++++++++++++++---------- lib/preview/images.php | 2 +- lib/preview/libreoffice-cl.php | 10 +++++----- lib/preview/movies.php | 2 +- lib/preview/mp3.php | 2 +- lib/preview/msoffice.php | 12 ++++++------ lib/preview/pdf.php | 2 +- lib/preview/svg.php | 2 +- lib/preview/txt.php | 6 +++--- lib/preview/unknown.php | 2 +- 11 files changed, 43 insertions(+), 33 deletions(-) diff --git a/core/routes.php b/core/routes.php index 41e82f8a73d..c0e658b26dc 100644 --- a/core/routes.php +++ b/core/routes.php @@ -42,12 +42,13 @@ $this->create('js_config', '/core/js/config.js') // Routing $this->create('core_ajax_routes', '/core/routes.json') ->action('OC_Router', 'JSRoutes'); +OC::$CLASSPATH['OC\PreviewManager'] = 'lib/preview.php'; $this->create('core_ajax_preview', '/core/preview.png') - ->action('OC\Preview', 'previewRouter'); + ->action('OC\PreviewManager', 'previewRouter'); $this->create('core_ajax_trashbin_preview', '/core/trashbinpreview.png') - ->action('OC\Preview', 'trashbinPreviewRouter'); + ->action('OC\PreviewManager', 'trashbinPreviewRouter'); $this->create('core_ajax_public_preview', '/core/publicpreview.png') - ->action('OC\Preview', 'publicPreviewRouter'); + ->action('OC\PreviewManager', 'publicPreviewRouter'); OC::$CLASSPATH['OC_Core_LostPassword_Controller'] = 'core/lostpassword/controller.php'; $this->create('core_lostpassword_index', '/lostpassword/') ->get() diff --git a/lib/preview.php b/lib/preview.php index cc287595f40..73e01a9e552 100755 --- a/lib/preview.php +++ b/lib/preview.php @@ -44,10 +44,6 @@ class Preview { //preview images object private $preview; - //preview providers - static private $providers = array(); - static private $registeredProviders = array(); - /** * @brief check if thumbnail or bigger version of thumbnail of file is cached * @param string $user userid - if no user is given, OC_User::getUser will be used @@ -82,11 +78,13 @@ class Preview { $this->preview = null; //check if there are preview backends - if(empty(self::$providers)) { - self::initProviders(); + $providers = PreviewManager::getProviders(); + if(empty($providers)) { + PreviewManager::initProviders(); } - if(empty(self::$providers)) { + $providers = PreviewManager::getProviders(); + if(empty($providers)) { \OC_Log::write('core', 'No preview providers exist', \OC_Log::ERROR); throw new \Exception('No preview providers'); } @@ -380,7 +378,8 @@ class Preview { $mimetype = $this->fileview->getMimeType($file); $preview = null; - foreach(self::$providers as $supportedmimetype => $provider) { + $providers = PreviewManager::getProviders(); + foreach($providers as $supportedmimetype => $provider) { if(!preg_match($supportedmimetype, $mimetype)) { continue; } @@ -544,6 +543,16 @@ class Preview { return; } } +} + +class PreviewManager { + //preview providers + static private $providers = array(); + static private $registeredProviders = array(); + + public static function getProviders() { + return self::$providers; + } /** * @brief register a new preview provider to be used @@ -559,7 +568,7 @@ class Preview { * @brief create instances of all the registered preview providers * @return void */ - private static function initProviders() { + public static function initProviders() { if(count(self::$providers)>0) { return; } @@ -766,7 +775,7 @@ class Preview { $preview->deleteAllPreviews(); } - private static function showErrorPreview() { + public static function showErrorPreview() { $path = \OC::$SERVERROOT . '/core/img/actions/delete.png'; $preview = new \OC_Image($path); $preview->preciseResize(44, 44); diff --git a/lib/preview/images.php b/lib/preview/images.php index 987aa9aef0a..84ab9f1ae43 100644 --- a/lib/preview/images.php +++ b/lib/preview/images.php @@ -30,4 +30,4 @@ class Image extends Provider { } } -\OC\Preview::registerProvider('OC\Preview\Image'); \ No newline at end of file +\OC\PreviewManager::registerProvider('OC\Preview\Image'); \ No newline at end of file diff --git a/lib/preview/libreoffice-cl.php b/lib/preview/libreoffice-cl.php index 2749c4867e9..ffe8de505f7 100644 --- a/lib/preview/libreoffice-cl.php +++ b/lib/preview/libreoffice-cl.php @@ -80,7 +80,7 @@ class MSOfficeDoc extends Office { } -\OC\Preview::registerProvider('OC\Preview\MSOfficeDoc'); +\OC\PreviewManager::registerProvider('OC\Preview\MSOfficeDoc'); //.docm, .dotm, .xls(m), .xlt(m), .xla(m), .ppt(m), .pot(m), .pps(m), .ppa(m) class MSOffice2003 extends Office { @@ -91,7 +91,7 @@ class MSOffice2003 extends Office { } -\OC\Preview::registerProvider('OC\Preview\MSOffice2003'); +\OC\PreviewManager::registerProvider('OC\Preview\MSOffice2003'); //.docx, .dotx, .xlsx, .xltx, .pptx, .potx, .ppsx class MSOffice2007 extends Office { @@ -102,7 +102,7 @@ class MSOffice2007 extends Office { } -\OC\Preview::registerProvider('OC\Preview\MSOffice2007'); +\OC\PreviewManager::registerProvider('OC\Preview\MSOffice2007'); //.odt, .ott, .oth, .odm, .odg, .otg, .odp, .otp, .ods, .ots, .odc, .odf, .odb, .odi, .oxt class OpenDocument extends Office { @@ -113,7 +113,7 @@ class OpenDocument extends Office { } -\OC\Preview::registerProvider('OC\Preview\OpenDocument'); +\OC\PreviewManager::registerProvider('OC\Preview\OpenDocument'); //.sxw, .stw, .sxc, .stc, .sxd, .std, .sxi, .sti, .sxg, .sxm class StarOffice extends Office { @@ -124,4 +124,4 @@ class StarOffice extends Office { } -\OC\Preview::registerProvider('OC\Preview\StarOffice'); \ No newline at end of file +\OC\PreviewManager::registerProvider('OC\Preview\StarOffice'); \ No newline at end of file diff --git a/lib/preview/movies.php b/lib/preview/movies.php index 8531050d112..f4452e02fc2 100644 --- a/lib/preview/movies.php +++ b/lib/preview/movies.php @@ -39,5 +39,5 @@ if(!is_null(shell_exec('ffmpeg -version'))) { } } - \OC\Preview::registerProvider('OC\Preview\Movie'); + \OC\PreviewManager::registerProvider('OC\Preview\Movie'); } \ No newline at end of file diff --git a/lib/preview/mp3.php b/lib/preview/mp3.php index 835ff529000..baa24ad129e 100644 --- a/lib/preview/mp3.php +++ b/lib/preview/mp3.php @@ -43,4 +43,4 @@ class MP3 extends Provider { } -\OC\Preview::registerProvider('OC\Preview\MP3'); \ No newline at end of file +\OC\PreviewManager::registerProvider('OC\Preview\MP3'); \ No newline at end of file diff --git a/lib/preview/msoffice.php b/lib/preview/msoffice.php index ccf1d674c7a..9f6ea7f74cf 100644 --- a/lib/preview/msoffice.php +++ b/lib/preview/msoffice.php @@ -20,7 +20,7 @@ class DOC extends Provider { } -\OC\Preview::registerProvider('OC\Preview\DOC'); +\OC\PreviewManager::registerProvider('OC\Preview\DOC'); */ class DOCX extends Provider { @@ -50,7 +50,7 @@ class DOCX extends Provider { } -\OC\Preview::registerProvider('OC\Preview\DOCX'); +\OC\PreviewManager::registerProvider('OC\Preview\DOCX'); class MSOfficeExcel extends Provider { @@ -95,7 +95,7 @@ class XLS extends MSOfficeExcel { } -\OC\Preview::registerProvider('OC\Preview\XLS'); +\OC\PreviewManager::registerProvider('OC\Preview\XLS'); class XLSX extends MSOfficeExcel { @@ -105,7 +105,7 @@ class XLSX extends MSOfficeExcel { } -\OC\Preview::registerProvider('OC\Preview\XLSX'); +\OC\PreviewManager::registerProvider('OC\Preview\XLSX'); /* //There is no (good) php-only solution for converting powerpoint documents to pdfs / pngs ... class MSOfficePowerPoint extends Provider { @@ -128,7 +128,7 @@ class PPT extends MSOfficePowerPoint { } -\OC\Preview::registerProvider('OC\Preview\PPT'); +\OC\PreviewManager::registerProvider('OC\Preview\PPT'); class PPTX extends MSOfficePowerPoint { @@ -138,5 +138,5 @@ class PPTX extends MSOfficePowerPoint { } -\OC\Preview::registerProvider('OC\Preview\PPTX'); +\OC\PreviewManager::registerProvider('OC\Preview\PPTX'); */ \ No newline at end of file diff --git a/lib/preview/pdf.php b/lib/preview/pdf.php index 3eabd201156..0d289e9db94 100644 --- a/lib/preview/pdf.php +++ b/lib/preview/pdf.php @@ -36,5 +36,5 @@ if (extension_loaded('imagick')) { } } - \OC\Preview::registerProvider('OC\Preview\PDF'); + \OC\PreviewManager::registerProvider('OC\Preview\PDF'); } diff --git a/lib/preview/svg.php b/lib/preview/svg.php index bafaf71b15a..5507686af97 100644 --- a/lib/preview/svg.php +++ b/lib/preview/svg.php @@ -39,6 +39,6 @@ if (extension_loaded('imagick')) { } } - \OC\Preview::registerProvider('OC\Preview\SVG'); + \OC\PreviewManager::registerProvider('OC\Preview\SVG'); } \ No newline at end of file diff --git a/lib/preview/txt.php b/lib/preview/txt.php index c7b8fabc6b0..acbf34c5e42 100644 --- a/lib/preview/txt.php +++ b/lib/preview/txt.php @@ -46,7 +46,7 @@ class TXT extends Provider { } } -\OC\Preview::registerProvider('OC\Preview\TXT'); +\OC\PreviewManager::registerProvider('OC\Preview\TXT'); class PHP extends TXT { @@ -56,7 +56,7 @@ class PHP extends TXT { } -\OC\Preview::registerProvider('OC\Preview\PHP'); +\OC\PreviewManager::registerProvider('OC\Preview\PHP'); class JavaScript extends TXT { @@ -66,4 +66,4 @@ class JavaScript extends TXT { } -\OC\Preview::registerProvider('OC\Preview\JavaScript'); \ No newline at end of file +\OC\PreviewManager::registerProvider('OC\Preview\JavaScript'); \ No newline at end of file diff --git a/lib/preview/unknown.php b/lib/preview/unknown.php index a31b365722e..f9f6fe957b2 100644 --- a/lib/preview/unknown.php +++ b/lib/preview/unknown.php @@ -40,4 +40,4 @@ class Unknown extends Provider { } } -\OC\Preview::registerProvider('OC\Preview\Unknown'); \ No newline at end of file +\OC\PreviewManager::registerProvider('OC\Preview\Unknown'); \ No newline at end of file From 10cc0511af5e1c5a37314ff2fabe0e27f9482e27 Mon Sep 17 00:00:00 2001 From: kondou Date: Fri, 12 Jul 2013 01:36:10 +0200 Subject: [PATCH 096/170] Optimize images with optipng and scour --- core/img/filetypes/application-pdf.png | Bin 1759 -> 1746 bytes core/img/filetypes/application-pdf.svg | 323 ++----- core/img/filetypes/application-rss+xml.svg | 950 +-------------------- core/img/filetypes/application.png | Bin 1235 -> 1018 bytes core/img/filetypes/application.svg | 373 ++------ core/img/filetypes/audio.png | Bin 858 -> 816 bytes core/img/filetypes/audio.svg | 317 +------ core/img/filetypes/code.svg | 419 ++------- core/img/filetypes/file.svg | 229 +---- core/img/filetypes/flash.svg | 366 ++------ core/img/filetypes/folder.svg | 385 ++------- core/img/filetypes/font.png | Bin 1793 -> 1697 bytes core/img/filetypes/font.svg | 371 +------- core/img/filetypes/image-svg+xml.svg | 716 ++-------------- core/img/filetypes/image.png | Bin 978 -> 976 bytes core/img/filetypes/image.svg | 376 ++------ core/img/filetypes/text-html.png | Bin 741 -> 654 bytes core/img/filetypes/text-html.svg | 323 +------ core/img/filetypes/text.png | Bin 757 -> 693 bytes core/img/filetypes/text.svg | 265 +----- 20 files changed, 634 insertions(+), 4779 deletions(-) diff --git a/core/img/filetypes/application-pdf.png b/core/img/filetypes/application-pdf.png index 2cbcb741d84a8e1303608089a33e22180a0e4510..a9ab6d279b6147ad8d0f6319ecdde08a637c8e70 100644 GIT binary patch delta 1655 zcmV--28j9J4blyeZhucnL_t(o!|j({h+S6|$AA0doO3_tqjx4rGo5s1l1|ea)0#A5 zY-w!}n-(c3#gr-(t5~5F^rellB9Wq?)KE|#>RS^LA!$)eA}vaUP(v)$geK!hX2`Tg zCut{4W|Fyc?>&1hAI_cW-1+K@kQX<1vFCF3-TQz3>%abMkAG2BuII2^=kb34e*TwF z8k4`PXU&d*)sp2S;(e2wPF_)R58qIN&pp96(eXG!t}_+@n5}pVeAiY zs8*K*aA!}~j>jI}`RXm(w?}b40b`l~O!hYhEZJ-_APQ(@6~(RFz*vlPbI$-ogiF6W zN_g)g=TDq?lz-nI`5bU~NdW6BH|*-|C`a`_9iw5uSc9<^nzLyF$$&w?5Z}L(j*oAn zF+I)MpTEQ%-}okIc5tm$BW)zQtB8+I)Vz+(!&UL!Ob8SU1B)wx-X znFGK$G2|~SIr_o3OsDEC(gsshh%R#-4#}t;;00I&O z4Fam5imJhgqBcv1T7&egqw6bQC+g^AYIKyp{NVePrl*Md2Do?|7AyGxs#H@!E8XO_+(qf`d+?PCqJJ<`t?~Y;zw-9JeY9yxDIZhx9wUl` z6jLl^<+<<-V>2?F>0Owk767$Ih*$4@9-Nym3@)EN!|=gFOr1VOrC6Yti^zKqq9}@} zVoU9dHebZ52r4Tw0LI6N1V9-(agvc&4pJQ+rkuodmkN|(Ph=hQyJ#8&jgw{0H)v2K zXn!{AN+J~H{Ncllojl3J&=9Uxr7cM)7xLs{N8&x!WI}Dh9VAoRlHH~WR+Pxt4=F?7 z--iyO6BBfKM^q>fdq*yESu2p)A~Lfd0D=fuw`2<1dV9HolD8JO#B;kKS=|2k<8%)U z&=JR!BS&Hl8UztR!@OJuL7JgKF)qRxi+{I{$a!*cLa9)s`__&4IFE{whOn{-0eW^m zNY4WgaCK;iOZ#6&M}|?8sXHspi~&QlR{&1I=5rJZ`6aUu_xBV2@psZjSd>1ypbF=r zxbZgnzV|%2&pwO<0TqmZ(acy-ZDql_mfz2hWWy~?)*IQ{6@5UIV^2Lz`#?XdwtsGA z?LBw1_OUN9wfPSI^Wuxx$%#1zT1BWB=a(>{Y`AqdQ%?iQ5>99rmSN%j_qcrID5v)B z<@aBGlFMh$QvS#$2446v4Bpn%fwY7K$?gG5y#7qJN^$*q(p2!e*bQ3%cw_2qQAAe~ z(VZkD7vAOgQ&02O3;Qr}!oatm!++eqsY!cQ*RwUwECchRUd!5Y+|fzC_a>aOG6PE1 z_#!MN=V)^gtCE=UBS(2-_a0P)fjxV$o9{$K=0ZiV&bPd|gg~uU1690pth)C;8fjRR zr4|6vEU%1KB{EQUp7toBe)=@WpV^J1fepLAMf9<)A21-2+4sD+pQ+A(W`B3bT#}>f z-uq}YLbi5!4d`55&w@adqP3L0Bb+(I@n@bzF$_Gr8~Xb*7MdcQC7@PsWcI9(BsoyX z-?$dv*SE+A7WrppI{E}VJ#&_!1HZsHOV8Jyq>*OkWV{CyRiR$50ZJT4 zIBVu;>Dc}WMAa<|APq9zNPpAp9@4y+X!D9DBIJyvU>)c8A7J92=O_;jQoR3Dgb?P+ zaAu~4ieil=iQ<;Dl(%f55u~=P4~$f&fBo*{)T4d9y^;6XBV$?`8?izhQvSC80NcLv z9P6HVf~%vW#GRd_X_|pCh9pT^I%a)lhBpr$l98F}D=ocpc2T8LX>coByW!R}eP~mX z+kr713%cr@0Vx;}@j)auSap_~2$3MJrKDPuJ9#c`93JxiH&Y_##>dAeTL1v8S+k}X zLTLBi$0FkXm;ZuUYeSl*b?4lbv9Ymhix{|G1YKNw;Z@X-yh2 zwzM{gO^XziVoDW?Rjg17deg>Okw{TcYAC1|^{$DCkW>_th@wOYHN;X)Xm>=`e#8qea^qpnoSAvgd!GOMfBw(^oPRN@%8hLHhDQHC03cfY z<)g;r@99~$YhZ0?K{9&jC1qX07Qh# zzdnwC_YxOQoqu|qUmg1taCAig8!I>M>Fp@T^*^4VVZc~}u@;)6X#xqrz+*@r+)c-a zchH!bVd%%NaMxG93K{~}YBjP(#>h`!rII*q?p_<;TDfV@ssJKPA*$E#jYgo|TCh4l zsxk8*8u=papZz?A!OherC;8LEso(*(;;mgDwolK97@#pV+o6^iQao+&%Uwgl0$?35%EQB>O zAGEO=08v3j!bEFPtIZTBh`}cbxsN|g=O-S)ILE~kf8ebj{ebqwkpZT&!ct#rOitpO z!BqrVf`6cu0SEv@K_w_m6tRYA$4O1VHOa?I2-;?7RO zO$*IhFsi6%bKUDO5CAkM8wD(GaFC8qKSt8mPnKm|9ebNMzxzGRKi{USl&6%$IAai1 zlD76`0l*?6AR79T)(SwCY9?rQGca^D9l!Cym#g=ymjCJZJJTaClsRy zBZ~M8Q!It@TpGjJKxQ+&OLNo$pw{ro+Wjwra|=I;a%JcoBZrSLefA8MVu4~VCLcv0 zilT@rw$#3C@nx)vpw|;23MNVr@qjXZ>NKOT9i}=mLOD(7E)^&x5wUeF-bFJnXp*iH z-+!Q95wBs?>xod53rCMKe)=?%!^5~*m9{jcT*#A49BC9`O%Q4eZZAP?E44YWqQu7j zmofzYb>uKQIZ0RKhzkXh$dQX(*a~E>h|Jsz051a8t(bzg-d?VvF>w?{cmIqzbt(% z3^d&rRVZ%0gT8OQNbZx5B3?iRBVaTb3#zRwSl4p@;+}50jj4Jg%v}O*nFvoj^M5Su z1O2SozMb{=-OKtXKF9RdyZHCZFJq@B=NV`L?iJ&r6-+2Jx8YXmnI~Pr372R93h%wk zm1D;_vwuIo`{L7F85*Mefh`QY^nDn-qp1UF>Eb1v16Fwa*=m*I#*Ji|5b1I^Yyl7% zQ*Vo7y3&~LG$p^mN#EIfPYC+2EP6R=FTlm+CyE>)i`quEb8@I*p`!yPV&9C z;O4Ha20#fLUyP;X9BnRUO`0%q>^QIQ-G_=Wux}rB>)nXRd{+^yi&~ysyr)*Hfhv)6 zthxUI8kt{~r4|6vEU!ST5*sMHi1s+9e)cRUpWBOMo=tndM*N}e3k-+^`+r{a^t07j z&~SFlr8&Cpe}G2AhqKcD9C!VvQw@la{oUw{4^0rM5U`iw}%eXMXX{)b!(hy}fZ1g-d2}$s0%% z5})zcgNNAhjThMP)Kgp=8zbrLB+Ie@#u(BxZP_vFv$MQ$_=t?oR()Sv9MjBAs#Gd% zWotLxo@I}0Nprg}rlTb{X8sKYBO;L(Neot - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/img/filetypes/application-rss+xml.svg b/core/img/filetypes/application-rss+xml.svg index 7b4f1127a94..4fd98545a7d 100644 --- a/core/img/filetypes/application-rss+xml.svg +++ b/core/img/filetypes/application-rss+xml.svg @@ -1,914 +1,40 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/img/filetypes/application.png b/core/img/filetypes/application.png index 3518d3116d2a6d0fadd6b09b3b592a2cb322bdce..9152cc1b744f1c06d0d5ae87c2965311f117fc1c 100644 GIT binary patch delta 951 zcmV;o14#VS3Hk?+85aWp002a!ipBr{00VPENmK|32;1RL;E^#re*t|^OjJex|Nj>k z7ZMT@6ciMRiHR5(7#0>5FfcHTjEs(sj#E=pN=iyrR#u3Jh>eYnQBhH7XlSRWr%_Q+ zSXfwET3TIQU0z;ZUteEfU|?ZkVPaxpV`F1vWMpM!WoBk(XJ=<SYo}Qnd zpP-Uu_s;a81tE;T6tgWrBudlDLu&}YQv9hwV zv$M0bw6wLgwYIjlx3{;rxVXByy1To(yu7@=zP`Y~z{SPI$;rvf%gfEp&Ct-$($dn@ z)YRA4*V)R5(w?l1*+CK@^1RwR@u2*n!9b>`fBP0=5>BI0)Q;b8!PM!j2_DRssUB6ddpVVEz|Ca%XS@w3#>hofee=5Uf^Mfq~E%kBsr!sWj&qAZo zXv7$TL1aqq?reU#1Ok8|DM_N!NvGc)IRp>^R0Em;K@gqQ4f?Ht)tV-q9pF`$qDVP&)I(YIcvHfk&4`dkj0_W!`xKvW6gGxSDR}c@|I}Vq<#ICdvB*0_yqk zhUlMgX4YJ&mI1VYl0rzV9QYL`sS0c^k)4ekRZu<6LXK zajcZ`hr{8+v$HdRKQ{tUN_~K72q3fiZ@iogK0)Thf0k27l@(ZP#X5hEj^@bP7OOmh^f( z`u#pxmI2W3_t9GO{{4G|5DW$b_V@P*f`E3r{of=wJ3B*4i4X!QB}yr7-MYo;>8V>Y zpU*iwJY+B!5Cj25QE+i_fiY&S54Mt^&cJFz8e_=w-0cnUxldO0UfrCwX21s6#P{#t zXFi`Z9DfeEy1GJZ&1f{D)9EZFisRVrmb<&Vbh};l_V&p0d?gNGU1H()EPz`%WsQlw&N8W2&m6 z)oLxBigkIdt(^sRq}HP-A`C;c)*KxjadL7(v)Od>&1RF6lM}k#E?R5CFm#(&-LEBq zy$=W>$n%`z<71}NDZ9J7eERf>D2m)^7)2362ztF9w{PF3-EK1&43_k_3~VLADga{) zuYX>>;>L{|eEj(FbKn=vEpU4{-Mo3zy%DPylT8w=F<`G#Qp%!-48wM}+kJL* zbrmK_@;l&dtn%Zg7mLL|qtWPD7>4cfcsvCV^?%2mPG?VRec=0k!x-~Z0Z1veQmXJg jZxYAx-2T1<;8)ncR5 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/img/filetypes/audio.png b/core/img/filetypes/audio.png index cd9821ec047ff066ac222f7434fd318f1968a6c6..3f56a7e2a9a976c91965495dfe7bc76667df5f75 100644 GIT binary patch delta 747 zcmcb`wt;Peq&PDJ1B1(wu46!ox!B1wgoA_Q_Cx;%6Af+Z8Px)OLR|m<|1T~sE+ix* zA|fIoAt5Fv#>&dd!otGF#>URh4ph#`$;r*l4dFsWfC`XhxwyE13V3*U`1ttv`S}F| z1Ox>IAqGlHN=i#h%gM{0tEi}`s;a7~sj1hit7~XzXliO|X=!O|YwPIf z=<4d~>FMd~>l+vt7#bQH85tQH8=IJzn3|fJnVFfJn_E~|SXx?ISy@?ITie*!*xK6K z+1c6K+dDWoI668yIXO8yJG;2JxVpN!xw*N!yL)(eczSwzd3kwzd;9qK`1<<#`T6<# z`v(LB1O?Rxg@lBJhK7cPg@uQQM@B|QM@PrS#U&>vPntAo%9JTnr%s(VZQ6_(GiJ`5 zIcwIe$c}h_U?2*X1o;IsaPvtiC?7k269jHQe)>XHGGZ?S17p0Wi(`m{rnLz}IrdKV4$WFF9!?CegKJ{?Qq%UcvVBShY8Q@`=vST9FXD&oM3RoX)L7 z%H{|9PlcM^I^=ecxBa}a{6#ijXEUw%dH1iST@nlHT4bu8zuqpkD0oY&T1S{!`TJwn zb3!kP&C)h1POC4n+GClfy_DC?EpVIBbE9*LTDcdN6a*WsogL+}gm;#3_|#Cp9e2bQ zZDEY?w7k5Cb2m$1qvP&5My(4p_v~oU$i48*ox|x_p^}P{hxC?70zY=D3kW%OnPr@M zwSk|5g=L~y#K~1mJM?BL%x(=c+q3ZQ&O>2a7+0(*TmS9+yE64KPbDs%Sxm=%KCPAQ zTLV;`p*g#qU5<0o7REPmd)0o--eK){VAJlt2bzCNHJLh8o0e~Ra=(tbZil;Do&W#< delta 789 zcmV+w1M2*+2HFOY85jlt0047(dh`GQ00eVFNmK|32nc)#WQdV4Jbwb$NkljXNJ~TI#Lga&gFhy2 zv_i{eEm^T$ci!{No3UBfb@h zrTj(`5JD7JS65$s0)J*~2$;F~8sp|`2-xdp?eg;SmyPKV0DzmD8{FUDgE2;S18mQ` zuIsx!*IGOM`1m;ROyJY)cI&u}N>dx~`uZADN@t$|S4u%C)sO4C-c3Mj9RT|$v_Yhl zD9f^6H=s6f+qV68CxO^$DIx%{SS*|q`y}i>nn278K9T3=XMa3AJoG1xb-x87G$CM& zk@2Sp0l?ke9VU|r_V@RLQ=2|I1eBufu`y;0o}Zs%Z*LE`x3_4TX7Kc*Lg2gI2lkD2 zU57MHadB~hBuVi2_&BHo%A+I!D$ce+JJ!Hk>eh9Q)6-KtJw1^GhEh7vfK7xk*1OF% zVtb_Px}Fs09Diw=LQ3gqXefI~0#rGry6w`oZTq#u!$WAT!8s2~^e6(hT8DuBxZ3KL zQudkPgYP6@+-YKK0~o=@ZaM(Svdqc%U1113&@>IU+pVK=)2J)jH#(h8(KO8;OD;I zHk%DLn{v(I?=b>n9wfXd3e09R0CeH`o921I(H%2C7DbV-R;wREh#3IR7!x0Y{!T&x z&`PP_d7gh?E|)8Z000~v9Zi)|Uy>xrwALR=fOD?ewv|GNsw~SshAbBEf6@K`*HYuK TH+&xa00000NkvXXu0mjfDmixI diff --git a/core/img/filetypes/audio.svg b/core/img/filetypes/audio.svg index f742383d632..d5eda38e8aa 100644 --- a/core/img/filetypes/audio.svg +++ b/core/img/filetypes/audio.svg @@ -1,274 +1,49 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/img/filetypes/code.svg b/core/img/filetypes/code.svg index 1dee047b11f..61a5c19f511 100644 --- a/core/img/filetypes/code.svg +++ b/core/img/filetypes/code.svg @@ -1,359 +1,66 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/img/filetypes/file.svg b/core/img/filetypes/file.svg index f0c0f1daf7e..3d91c341143 100644 --- a/core/img/filetypes/file.svg +++ b/core/img/filetypes/file.svg @@ -1,197 +1,36 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/img/filetypes/flash.svg b/core/img/filetypes/flash.svg index 60cab4ad380..cb823703d9b 100644 --- a/core/img/filetypes/flash.svg +++ b/core/img/filetypes/flash.svg @@ -1,310 +1,60 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/img/filetypes/folder.svg b/core/img/filetypes/folder.svg index dd80b695bb1..92d4cc22718 100644 --- a/core/img/filetypes/folder.svg +++ b/core/img/filetypes/folder.svg @@ -1,329 +1,60 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/img/filetypes/font.png b/core/img/filetypes/font.png index df44a7fc47db6c6edce188fa5e00ead07456bf97..9404c3ca6ac330d3639a00e0b4c618e52172c2a2 100644 GIT binary patch delta 1606 zcmV-M2D$lx4xtT@Zhsz0L_t(oh3!^pY!r1AFNla>MWt6t>Gq)Aw$quNV`p}^d-Oi& zLFs`}0s+xL2obCj@hDNT5I-2sl(TAqaA|Eq6A&qsgdbmc zMx(JEowg(=Cx3U-vreb8VR=&e>YOvGgD)Cm7g>|p%1bG1wKbL9XHDe}Ta%c|OQvYk zV-dhwTPgkSh&u&Au;7_JFE0;}NDrP>d1TM(W0KA%vU|>%8E4DPjLttlcokX~O@Zs5 zO@kX{)8X2JBDj#qI?g4;O?@N+7`;f&DCOwvE;{?pn|~Bd1Cg2~Nq%Qc@zqT!y#4aD zw4UYyW5@Yy#5bv;F4sIbhpR;=*rlPUvdX$Cf@40W`ioF)^{5qNjA@bCUbK z1k2%|bECmv|5B&9a%O_At0~7|KV^u&c~Td*;Di!qKB2^9p42nT8nYC~-z(+WsS}-1~i*sHw5&bguW7gaj~) z;g>rtsJG~BbsSSPAOV_vT)hq=px5i$@%dfs{2&jiG+ax4 zZhtDwGaJBUH1?1jX6U}1P^;n2Hsz;7%d~tKYI%*lmSI8%B!JOaEfx!n9z}K=(cyuN z<>!P44e2P$J?#N6X5dXY-ldXgxw5h8*mfS?4uz&Ie#2b zLsG9G5nnVrq=w%8Cgb5csvR{Sqw)HAW+@Rvi*QF9J0Cn0^Ok0HY@Y_jN2`ZK!ahI$Z2I z5Gev-KVo-;2qsaYCZxTAeW11DeUY{%RBYH4eot;&nBXiQC*1j3B{_A}}y8-~rgWYSk*NS+fTH{r!+qK7OsvuNuJj{ViH+ zC#8h77C{gI!0pXubM1cxKqg1t^5Ie`8ZV`=Q-O_gpoA5MnfnqR1G7JkOQ2c558RzpqxSDvF|N ztJNA^0C?-JJMI;}{yK#Eq<`zp?Dh2oq!ma>kQ6BA;(y`R{$mdx{luLkw~rlp0l2~z zG@H#q0DYe4Ax%>U;FXDqiPr&~$@3gx7!rVoMw-pu$-CFR#8L2ycT4{RvbV>j({tJU zzN7N&rBuR?`6Vr9eAPGBdQ+l;`zEVmtGurKTo0(0w#$(ikIG=0IF$zK~gb+axL`tcuHRh{^ z#7%Xrs|$6F)1_e8Xq5j zt6TH@+QIk(nW_2$Fiz+wH;;}5@^@ufZdFPNDTR7NIcny3i9q)hnYoz+kQkse7XvKT zfkvaz2Vj#B;(T^HM`c<5dg%aTk>rI%nH$^y69}fex3ut}FqW7ZkP-(K(SHo&sBx4o zXba0^q3D^_8+JXtdN6(FgM*td0MJ@*6GGU|>H*;3p+kqxECnbT)AL4hW)*U)utJK; zkj0IXnXI*7W)yZIf;{8gJ_Xut8LDJnc>w@`$A~CmW>{v1Dq`xbJk&P#$e~b%pgG#fUnKwMS8|K%o@OB@_U7l ziG?+melU9S;LjHU8jZ%s0rYi34`$X=Q&X=2hycirDFFK0({CJ`w#AQ*6=nOhahNfT z6S*ye`8;>l7MD5bstAac&3 zW4l|eRtrFPG2o8bpUfP2@~kPoHC?(Rr%U_ycTDk%L;srjoCD4+%t1unWUsGd<9>Ux zw8iPdzJ10OU;fU_o8JV$+_|`D;cZAn9)Pg3QU@RdP%IpfrMb|7S6va(orviUXbvC+ xU_Mpp3y&se=HCWN03epT9;EdD$LaM3_&2hWVXo7r - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/img/filetypes/image-svg+xml.svg b/core/img/filetypes/image-svg+xml.svg index f9b378887f3..06df5f54da6 100644 --- a/core/img/filetypes/image-svg+xml.svg +++ b/core/img/filetypes/image-svg+xml.svg @@ -1,666 +1,56 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/img/filetypes/image.png b/core/img/filetypes/image.png index 83d20fdb7762d4b52b398c80e4ecc3fb6f2d5470..087f5dcdbdf61777512cbf7985715f0a12124a19 100644 GIT binary patch delta 908 zcmV;719SY+2hazQ85aWp002a!ipBr{00VPENmK|32;1RL;E^#re*v>lOjJex|Nj60 z00000000000000004OLZDJdx`Dk>{0D=aK5EiElBE-o)GFEB7LF)=YRGBPtWGc+_b zH8nLhHa0gmH#j&rIXO8xIyyT$J3Kr*Jv}`>K0ZG`KR`f0K|w)6LPA4BLqtSGMMXtM zMn*?RM@UFWNl8gce@aSAOG`{lOifKqPEJlwPft)#P*G7)Qc_Y=Q&Ut_R8>_~R#sM5 zS65hASXo(FT3T9LTU%UQTwPsVUS3{bUteHgU}0flVq#)rV`F4wWMyS#XJ=<>mzS5An3$WJo1UJYqN1XurKPEzrV=H$jQmc%F4>k&CSlv&d<-!(b3V;($dt_)YaA1*4Eb7*VowC*xTFN+}zyV z-QC{a-rwKff8gNY;o;%p;^O1ulq(=H}<;=jiC@>FMd}>gwz3>+J08?d|RE z?(XmJ@9^;O@$vEU^78ZZ^T0u}p#T5?26R$RQvd-19xO9ymSSiC00DhTL_t(I%f*sQ zYZOrwguin$vGXD_YJ`lD+2}^lg^_HsaiM$tCxU;(e}5wQ3lvw01`%9H%pyL>DEJ`Y zn0a-Ti|(HE7&ANZZ0?1sTc^&s1^>T-M^o_!4NRO08yYyC=h$Eu2gO~M?wJPWsDJXU zWZ8lS3cDr=U`v)&5KOM|!+ZuTNd=|wz_CKM_P*~Dl~tNV0&t$v+RAXZ!ezw-VY$`Y z%RJW`f1LZ43W8_qEp+CBo5{X*KI?2t7LYtPDfvTlWj;S#I?M2LzjUpNFp}ia&gRnA z$JI^0ew(VPOTu6v4Tm>Zv!gxsZ)Gqo@01lFP!bDO_IMY8`YsSGvbP zGal2x;`(Dh0e0(osa9>^?yLM{plXEn?7P3DrfLzy)t89~B7z8lAR-n@!b5=Tr-e3| iX_X>UOo_e4zpvk=^$&&_6P$Md0000SP4p68%qVTP}IsoR4heA zjrajZ)Trb`lFjbUQ*GGYe7t!ce4jM$fy3-D!`%1W=ggT|A*H09rnD9Pe*%CPpin5Z zB@w#1x`Y?NN<<;VUw;9%Cw`TH5Q3$pB}%1Ib&`Feyg4gS<0*sE1GBGhhAP``Gf1ka*y_#Ly zO;MD_1neQOFMsmz@WAo$F~h^d1cO0zT_>GR6OYH~@9zhoTrP8Yc}clkZkou}nhgo) zx?UrluIp@XZxfA1>FMcVd3l+qrzfJ(D2t1WNGVxeUFGWP3Povty|`6&5U?`Y0=F_Z zkw`E*JBzBS~G8rs#OM)^b%<9R!4wl5{%VmRE5+9v6xbLiybX$xpcuLJ@!fV!%H@$6wlf8OQ-o kqLoMJe`#(1HETP8UxCcTx6i@D5&!@I07*qoM6N<$f>aNnwEzGB diff --git a/core/img/filetypes/image.svg b/core/img/filetypes/image.svg index 440b6af7ac0..50991f7359d 100644 --- a/core/img/filetypes/image.svg +++ b/core/img/filetypes/image.svg @@ -1,321 +1,61 @@ - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + + + + + + + + + diff --git a/core/img/filetypes/text-html.png b/core/img/filetypes/text-html.png index de11613f25f41a5918b041f358a66cd38366eaaf..dd17b7501034216c35e9273dc7e3858d486d2aed 100644 GIT binary patch delta 584 zcmV-O0=NC;1&#%f85aWp002a!ipBr{00VPENmK|32;1RL;E^#re*o}MOjJex|Nj60 z0000000000006$ezM-L^mzS5BnVFuRo}i$hp`oFoqN1atqokyyrKP2&rlzN-r>Ll? zsi~=|s;aB2tE{Z7t*x!EudlGMu(7eRva+(Xv$M3cw6(Rhwzjsnx3{>sxVgExy1Kf% zySu!+yuH1>z`(%4f5E}R!otJD!^FhI$;rve%F4~n&Ck!z($dn_*4Ee8*Vx$D+}zyV z-QC{a-rwKf;Nall;o;)q;^X7vlt)=I7_<=;-L_>FMg~>g((4?Ck9A?d|UF z?(gsK@bK{Q@$vHV^7Hfa^z`)g_4WPz{r~^}4?0_v00007e{@n#Qvd-14-@F=?TSR& z0002}Nkl~m> z5!8BK=WNbCi6o^9lT?xtNt!S343_hg0Nwz;2r~F4*nA46qMvN|13@P7hV}M1xm{Zk z<=zAE_JH4)f9E|^WmW)$*9ApZR&ftu(=Td(b^nUG=x;(4;WYIC-OF_YekvCUDZ36} zb1?zB9cgrCK5(@pJ>52vYB$KEGY_+#3*eXl!S!Z`_)MSU;Q1y1j@+O1&?e&y?u!n{ z#z}i#R5KdF_5d&(HP*AL`dD>c{nxvH6>*svT%Lp^CafL}Rw4NiXuV0xNeCt_lHLKP Wy+U7gQ>a@20000@UpU)i9kYL*p9o?oy783U3|Y)CwUF9H)#u;UE(>D}t7^B~Ka4SDjvyh#&sMATeRa=X57JtfTdfwBW#w92 zYfZb|PTg1vz!*amMSm!zas{w$n{~GVQnzW0$qYPHoAPEla14l@09JqVhS&<=N%JkP`T{f*Zb%lCae&)ax?FM!!>#&kN}2+-+tczSwT0!*h?UtcfhNWEUCSS&Ia3{Xn#=783E89W}30cbXx#BrP|uC=Dy?Q(m2 zi>lnJOi{m&< zCKIA4O8vRl>wj@~cZZZRu^&YdlgR|fad2HXGxt^wgkeanR-;fTFdPmO&-3;56)7c^ zN+s1d!{LxZp+K!xBMigCj$s_fG#ZU%Pb~Jk-7YsbH>oCD#55X>%)VLIUth%^A0ODZ zO{G#v*!b}9fRr-zXv*bZUtN}ECBCW-ngvoyuCA`oT72{V{tkfe`>A9AmzS4VmPHtb znR)jD00@F0v*5b2nl%@IL-l0=PCkxL?!easux*?3^YdH*7PI7!073}s@$vEP`T6-< zuGN3%e-lDj#+c<;6suH12mv_jU^z+wzF8?Mj@k9w=o57qG24cv!y^Cy002ovPDHLk FV1gQzIw$}D diff --git a/core/img/filetypes/text-html.svg b/core/img/filetypes/text-html.svg index bf29fbcbbf2..c41964738d0 100644 --- a/core/img/filetypes/text-html.svg +++ b/core/img/filetypes/text-html.svg @@ -1,280 +1,49 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/img/filetypes/text.png b/core/img/filetypes/text.png index 2b96638d16c9af6b5f98350c4ec102d4975c1b64..6b069c82c119a5bc115cd657b9752215b8cd1044 100644 GIT binary patch delta 623 zcmV-#0+9Xn1+@i`85aWp002a!ipBr{00VPENmK|32;1RL;E^#re*ouDOjJex|Nj60 z0000000000003lUWK&a9c6N4nczAhvd3$?%e0+RsxVgExy1Kf%ySu!+yuH1>zP`S{zrVo1z`?=6!otGC z!^6bH#KpzM#>U3Tf5^zm$;ryf%FN8n&CSiu&d$%z&(YD*+S=OO+}z#W-QM2b-{0Th z;Naom;o{=ruz*=jZ3>=;-O`>FVn0>+9?6?CkCB?e6aG@9*#M@bK~R z@$&NW^Yioc^z`-h_5J<*|NsAsvZUAm000qmQchC<0Rj&be{*}LrlzK*rlzK*t-3L% zIDt{%g4(scvqhP-tQwEXTGu}!N<5}Kh44bjnP3$mu9WY)iKb_v{k)n{q1JI#E z6Lqjtf2Rk_pE1b)*S@L?fF1w^OsWf?_s|~!YNCn&>5F@moo@|Sp}XMVyv_gs002ov JPDHLkV1i{gTR8v# delta 688 zcmV;h0#E(51@#4x85jlt0047(dh`GQ00eVFNmK|32nc)#WQdV4JbwamNkl=Wc2_Dxnwh@dAgkch$;iOg(~ z9cz4Hjln7QZ@|YhXa4h_%UCF-FfpIce~d<>JH7y$&F1&xSw9LJ&G@6&F#ONr$O=;-x9*VoqwAy7&ogh;K^b|ClPd^Y_aq=312 zwORqBqSgN$$03R$JkLW)NgT&0rBZ5iyIlr@!Qm;8QlU3I zUS0rbwOS~plJ@jG41fDgB+erKo`naOv9s!aJgIp`8Ev05Zkti;~2+r zk`~nOKR!MfkAKH0pG7DgM5h#CErUoaVB0oQ%F1mxolZ|{!<(C%vL$}H!>?LT|BKhx*Od^Wp_EG42vZvIIlRARiPeZ5uvNyPqV8N*#UF(t W?ly-EnGJFP0000 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 33ac4d93d63b98761cf9c09467dcad7bc5d34bf0 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Fri, 12 Jul 2013 10:03:25 +0200 Subject: [PATCH 097/170] OC\Preview - use !== and === instead of != and == --- lib/preview.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/preview.php b/lib/preview.php index 73e01a9e552..5576981225b 100755 --- a/lib/preview.php +++ b/lib/preview.php @@ -305,7 +305,7 @@ class Preview { $y = $size[1]; $aspectratio = $x / $y; - if($aspectratio != $wantedaspectratio) { + if($aspectratio !== $wantedaspectratio) { continue; } @@ -691,7 +691,7 @@ class PreviewManager { } $path = \OC\Files\Filesystem::normalizePath($path, false); - if(substr($path, 0, 1) == '/') { + if(substr($path, 0, 1) === '/') { $path = substr($path, 1); } @@ -768,7 +768,7 @@ class PreviewManager { public static function post_delete($args) { $path = $args['path']; - if(substr($path, 0, 1) == '/') { + if(substr($path, 0, 1) === '/') { $path = substr($path, 1); } $preview = new Preview(\OC_User::getUser(), 'files/', $path, 0, 0, false, true); From 21abebf96a45323b81ddf057d3851d25085b59ad Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Fri, 12 Jul 2013 11:50:24 +0200 Subject: [PATCH 098/170] OC\Preview - proper handling of a cached previews's filename --- lib/preview.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/preview.php b/lib/preview.php index 5576981225b..08c0b7e20d0 100755 --- a/lib/preview.php +++ b/lib/preview.php @@ -283,6 +283,10 @@ class Preview { $fileinfo = $this->fileview->getFileInfo($file); $fileid = $fileinfo['fileid']; + if(is_null($fileid)) { + return false; + } + $previewpath = $this->getThumbnailsFolder() . '/' . $fileid . '/'; if(!$this->userview->is_dir($previewpath)) { return false; @@ -293,18 +297,19 @@ class Preview { return $previewpath . $maxX . '-' . $maxY . '.png'; } - $wantedaspectratio = $maxX / $maxY; + $wantedaspectratio = (float) ($maxX / $maxY); //array for usable cached thumbnails $possiblethumbnails = array(); $allthumbnails = $this->userview->getDirectoryContent($previewpath); foreach($allthumbnails as $thumbnail) { - $size = explode('-', $thumbnail['name']); - $x = $size[0]; - $y = $size[1]; + $name = rtrim($thumbnail['name'], '.png'); + $size = explode('-', $name); + $x = (int) $size[0]; + $y = (int) $size[1]; - $aspectratio = $x / $y; + $aspectratio = (float) ($x / $y); if($aspectratio !== $wantedaspectratio) { continue; } From c834d93e8778bbbe008c992e6fab5250296ec216 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Fri, 12 Jul 2013 14:16:06 +0200 Subject: [PATCH 099/170] OC\Preview - update git submodule --- 3rdparty | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/3rdparty b/3rdparty index 21762672395..31ed0ab78e4 160000 --- a/3rdparty +++ b/3rdparty @@ -1 +1 @@ -Subproject commit 217626723957161191572ea50172a3943c30696d +Subproject commit 31ed0ab78e48d7515740b05f64c07a2b0648421f From 1303fe0f9fe7c67764fb48cbb84fcb30e4a32b33 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Sun, 14 Jul 2013 00:00:10 +0200 Subject: [PATCH 100/170] OC\Preview - set scale factor down to 2 and upscale cached preview - this got lost in a git stash ... --- lib/preview.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/preview.php b/lib/preview.php index 08c0b7e20d0..03aaaceb9ca 100755 --- a/lib/preview.php +++ b/lib/preview.php @@ -60,7 +60,7 @@ class Preview { //set config $this->configMaxX = \OC_Config::getValue('preview_max_x', null); $this->configMaxY = \OC_Config::getValue('preview_max_y', null); - $this->maxScaleFactor = \OC_Config::getValue('preview_max_scale_factor', 10); + $this->maxScaleFactor = \OC_Config::getValue('preview_max_scale_factor', 2); //save parameters $this->setFile($file); @@ -377,6 +377,7 @@ class Preview { if($cached) { $image = new \OC_Image($this->userview->file_get_contents($cached, 'r')); $this->preview = $image->valid() ? $image : null; + $this->resizeAndCrop(); } if(is_null($this->preview)) { From 65affdc9b32629ab4692f77ffd4dff77e026b1dc Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Mon, 29 Jul 2013 14:40:26 +0200 Subject: [PATCH 101/170] make previews in files app smaller --- lib/helper.php | 4 ++-- lib/preview.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/helper.php b/lib/helper.php index 6153f318723..0853c792750 100644 --- a/lib/helper.php +++ b/lib/helper.php @@ -231,11 +231,11 @@ class OC_Helper { * Returns the path to the preview of the file. */ public static function previewIcon($path) { - return self::linkToRoute( 'core_ajax_preview', array('x' => 44, 'y' => 44, 'file' => urlencode($path) )); + return self::linkToRoute( 'core_ajax_preview', array('x' => 36, 'y' => 36, 'file' => urlencode($path) )); } public static function publicPreview_icon( $path, $token ) { - return self::linkToRoute( 'core_ajax_public_preview', array('x' => 44, 'y' => 44, 'file' => urlencode($path), 't' => $token)); + return self::linkToRoute( 'core_ajax_public_preview', array('x' => 36, 'y' => 36, 'file' => urlencode($path), 't' => $token)); } /** diff --git a/lib/preview.php b/lib/preview.php index 03aaaceb9ca..c570a17e4a7 100755 --- a/lib/preview.php +++ b/lib/preview.php @@ -784,7 +784,7 @@ class PreviewManager { public static function showErrorPreview() { $path = \OC::$SERVERROOT . '/core/img/actions/delete.png'; $preview = new \OC_Image($path); - $preview->preciseResize(44, 44); + $preview->preciseResize(36, 36); $preview->show(); } } \ No newline at end of file From e01bc7de987ddb7d33feb75ad598bdf97c348105 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Mon, 29 Jul 2013 14:46:20 +0200 Subject: [PATCH 102/170] Revert "OC\Preview - outsource static methods" This reverts commit 14a35267c15115a1e7d2901ddd9b8c5c7e1b9a31. --- core/routes.php | 7 +++---- lib/preview.php | 37 +++++++++++++--------------------- lib/preview/images.php | 2 +- lib/preview/libreoffice-cl.php | 10 ++++----- lib/preview/movies.php | 2 +- lib/preview/mp3.php | 2 +- lib/preview/msoffice.php | 12 +++++------ lib/preview/pdf.php | 2 +- lib/preview/svg.php | 2 +- lib/preview/txt.php | 6 +++--- lib/preview/unknown.php | 2 +- 11 files changed, 37 insertions(+), 47 deletions(-) diff --git a/core/routes.php b/core/routes.php index c0e658b26dc..41e82f8a73d 100644 --- a/core/routes.php +++ b/core/routes.php @@ -42,13 +42,12 @@ $this->create('js_config', '/core/js/config.js') // Routing $this->create('core_ajax_routes', '/core/routes.json') ->action('OC_Router', 'JSRoutes'); -OC::$CLASSPATH['OC\PreviewManager'] = 'lib/preview.php'; $this->create('core_ajax_preview', '/core/preview.png') - ->action('OC\PreviewManager', 'previewRouter'); + ->action('OC\Preview', 'previewRouter'); $this->create('core_ajax_trashbin_preview', '/core/trashbinpreview.png') - ->action('OC\PreviewManager', 'trashbinPreviewRouter'); + ->action('OC\Preview', 'trashbinPreviewRouter'); $this->create('core_ajax_public_preview', '/core/publicpreview.png') - ->action('OC\PreviewManager', 'publicPreviewRouter'); + ->action('OC\Preview', 'publicPreviewRouter'); OC::$CLASSPATH['OC_Core_LostPassword_Controller'] = 'core/lostpassword/controller.php'; $this->create('core_lostpassword_index', '/lostpassword/') ->get() diff --git a/lib/preview.php b/lib/preview.php index c570a17e4a7..113b200c29b 100755 --- a/lib/preview.php +++ b/lib/preview.php @@ -44,6 +44,10 @@ class Preview { //preview images object private $preview; + //preview providers + static private $providers = array(); + static private $registeredProviders = array(); + /** * @brief check if thumbnail or bigger version of thumbnail of file is cached * @param string $user userid - if no user is given, OC_User::getUser will be used @@ -78,13 +82,11 @@ class Preview { $this->preview = null; //check if there are preview backends - $providers = PreviewManager::getProviders(); - if(empty($providers)) { - PreviewManager::initProviders(); + if(empty(self::$providers)) { + self::initProviders(); } - $providers = PreviewManager::getProviders(); - if(empty($providers)) { + if(empty(self::$providers)) { \OC_Log::write('core', 'No preview providers exist', \OC_Log::ERROR); throw new \Exception('No preview providers'); } @@ -384,8 +386,7 @@ class Preview { $mimetype = $this->fileview->getMimeType($file); $preview = null; - $providers = PreviewManager::getProviders(); - foreach($providers as $supportedmimetype => $provider) { + foreach(self::$providers as $supportedmimetype => $provider) { if(!preg_match($supportedmimetype, $mimetype)) { continue; } @@ -549,16 +550,6 @@ class Preview { return; } } -} - -class PreviewManager { - //preview providers - static private $providers = array(); - static private $registeredProviders = array(); - - public static function getProviders() { - return self::$providers; - } /** * @brief register a new preview provider to be used @@ -574,7 +565,7 @@ class PreviewManager { * @brief create instances of all the registered preview providers * @return void */ - public static function initProviders() { + private static function initProviders() { if(count(self::$providers)>0) { return; } @@ -600,8 +591,8 @@ class PreviewManager { \OC_Util::checkLoggedIn(); $file = array_key_exists('file', $_GET) ? (string) urldecode($_GET['file']) : ''; - $maxX = array_key_exists('x', $_GET) ? (int) $_GET['x'] : '44'; - $maxY = array_key_exists('y', $_GET) ? (int) $_GET['y'] : '44'; + $maxX = array_key_exists('x', $_GET) ? (int) $_GET['x'] : '36'; + $maxY = array_key_exists('y', $_GET) ? (int) $_GET['y'] : '36'; $scalingup = array_key_exists('scalingup', $_GET) ? (bool) $_GET['scalingup'] : true; if($file === '') { @@ -644,8 +635,8 @@ class PreviewManager { } $file = array_key_exists('file', $_GET) ? (string) urldecode($_GET['file']) : ''; - $maxX = array_key_exists('x', $_GET) ? (int) $_GET['x'] : '44'; - $maxY = array_key_exists('y', $_GET) ? (int) $_GET['y'] : '44'; + $maxX = array_key_exists('x', $_GET) ? (int) $_GET['x'] : '36'; + $maxY = array_key_exists('y', $_GET) ? (int) $_GET['y'] : '36'; $scalingup = array_key_exists('scalingup', $_GET) ? (bool) $_GET['scalingup'] : true; $token = array_key_exists('t', $_GET) ? (string) $_GET['t'] : ''; @@ -781,7 +772,7 @@ class PreviewManager { $preview->deleteAllPreviews(); } - public static function showErrorPreview() { + private static function showErrorPreview() { $path = \OC::$SERVERROOT . '/core/img/actions/delete.png'; $preview = new \OC_Image($path); $preview->preciseResize(36, 36); diff --git a/lib/preview/images.php b/lib/preview/images.php index 84ab9f1ae43..987aa9aef0a 100644 --- a/lib/preview/images.php +++ b/lib/preview/images.php @@ -30,4 +30,4 @@ class Image extends Provider { } } -\OC\PreviewManager::registerProvider('OC\Preview\Image'); \ No newline at end of file +\OC\Preview::registerProvider('OC\Preview\Image'); \ No newline at end of file diff --git a/lib/preview/libreoffice-cl.php b/lib/preview/libreoffice-cl.php index ffe8de505f7..2749c4867e9 100644 --- a/lib/preview/libreoffice-cl.php +++ b/lib/preview/libreoffice-cl.php @@ -80,7 +80,7 @@ class MSOfficeDoc extends Office { } -\OC\PreviewManager::registerProvider('OC\Preview\MSOfficeDoc'); +\OC\Preview::registerProvider('OC\Preview\MSOfficeDoc'); //.docm, .dotm, .xls(m), .xlt(m), .xla(m), .ppt(m), .pot(m), .pps(m), .ppa(m) class MSOffice2003 extends Office { @@ -91,7 +91,7 @@ class MSOffice2003 extends Office { } -\OC\PreviewManager::registerProvider('OC\Preview\MSOffice2003'); +\OC\Preview::registerProvider('OC\Preview\MSOffice2003'); //.docx, .dotx, .xlsx, .xltx, .pptx, .potx, .ppsx class MSOffice2007 extends Office { @@ -102,7 +102,7 @@ class MSOffice2007 extends Office { } -\OC\PreviewManager::registerProvider('OC\Preview\MSOffice2007'); +\OC\Preview::registerProvider('OC\Preview\MSOffice2007'); //.odt, .ott, .oth, .odm, .odg, .otg, .odp, .otp, .ods, .ots, .odc, .odf, .odb, .odi, .oxt class OpenDocument extends Office { @@ -113,7 +113,7 @@ class OpenDocument extends Office { } -\OC\PreviewManager::registerProvider('OC\Preview\OpenDocument'); +\OC\Preview::registerProvider('OC\Preview\OpenDocument'); //.sxw, .stw, .sxc, .stc, .sxd, .std, .sxi, .sti, .sxg, .sxm class StarOffice extends Office { @@ -124,4 +124,4 @@ class StarOffice extends Office { } -\OC\PreviewManager::registerProvider('OC\Preview\StarOffice'); \ No newline at end of file +\OC\Preview::registerProvider('OC\Preview\StarOffice'); \ No newline at end of file diff --git a/lib/preview/movies.php b/lib/preview/movies.php index f4452e02fc2..8531050d112 100644 --- a/lib/preview/movies.php +++ b/lib/preview/movies.php @@ -39,5 +39,5 @@ if(!is_null(shell_exec('ffmpeg -version'))) { } } - \OC\PreviewManager::registerProvider('OC\Preview\Movie'); + \OC\Preview::registerProvider('OC\Preview\Movie'); } \ No newline at end of file diff --git a/lib/preview/mp3.php b/lib/preview/mp3.php index baa24ad129e..835ff529000 100644 --- a/lib/preview/mp3.php +++ b/lib/preview/mp3.php @@ -43,4 +43,4 @@ class MP3 extends Provider { } -\OC\PreviewManager::registerProvider('OC\Preview\MP3'); \ No newline at end of file +\OC\Preview::registerProvider('OC\Preview\MP3'); \ No newline at end of file diff --git a/lib/preview/msoffice.php b/lib/preview/msoffice.php index 9f6ea7f74cf..ccf1d674c7a 100644 --- a/lib/preview/msoffice.php +++ b/lib/preview/msoffice.php @@ -20,7 +20,7 @@ class DOC extends Provider { } -\OC\PreviewManager::registerProvider('OC\Preview\DOC'); +\OC\Preview::registerProvider('OC\Preview\DOC'); */ class DOCX extends Provider { @@ -50,7 +50,7 @@ class DOCX extends Provider { } -\OC\PreviewManager::registerProvider('OC\Preview\DOCX'); +\OC\Preview::registerProvider('OC\Preview\DOCX'); class MSOfficeExcel extends Provider { @@ -95,7 +95,7 @@ class XLS extends MSOfficeExcel { } -\OC\PreviewManager::registerProvider('OC\Preview\XLS'); +\OC\Preview::registerProvider('OC\Preview\XLS'); class XLSX extends MSOfficeExcel { @@ -105,7 +105,7 @@ class XLSX extends MSOfficeExcel { } -\OC\PreviewManager::registerProvider('OC\Preview\XLSX'); +\OC\Preview::registerProvider('OC\Preview\XLSX'); /* //There is no (good) php-only solution for converting powerpoint documents to pdfs / pngs ... class MSOfficePowerPoint extends Provider { @@ -128,7 +128,7 @@ class PPT extends MSOfficePowerPoint { } -\OC\PreviewManager::registerProvider('OC\Preview\PPT'); +\OC\Preview::registerProvider('OC\Preview\PPT'); class PPTX extends MSOfficePowerPoint { @@ -138,5 +138,5 @@ class PPTX extends MSOfficePowerPoint { } -\OC\PreviewManager::registerProvider('OC\Preview\PPTX'); +\OC\Preview::registerProvider('OC\Preview\PPTX'); */ \ No newline at end of file diff --git a/lib/preview/pdf.php b/lib/preview/pdf.php index 0d289e9db94..3eabd201156 100644 --- a/lib/preview/pdf.php +++ b/lib/preview/pdf.php @@ -36,5 +36,5 @@ if (extension_loaded('imagick')) { } } - \OC\PreviewManager::registerProvider('OC\Preview\PDF'); + \OC\Preview::registerProvider('OC\Preview\PDF'); } diff --git a/lib/preview/svg.php b/lib/preview/svg.php index 5507686af97..bafaf71b15a 100644 --- a/lib/preview/svg.php +++ b/lib/preview/svg.php @@ -39,6 +39,6 @@ if (extension_loaded('imagick')) { } } - \OC\PreviewManager::registerProvider('OC\Preview\SVG'); + \OC\Preview::registerProvider('OC\Preview\SVG'); } \ No newline at end of file diff --git a/lib/preview/txt.php b/lib/preview/txt.php index acbf34c5e42..c7b8fabc6b0 100644 --- a/lib/preview/txt.php +++ b/lib/preview/txt.php @@ -46,7 +46,7 @@ class TXT extends Provider { } } -\OC\PreviewManager::registerProvider('OC\Preview\TXT'); +\OC\Preview::registerProvider('OC\Preview\TXT'); class PHP extends TXT { @@ -56,7 +56,7 @@ class PHP extends TXT { } -\OC\PreviewManager::registerProvider('OC\Preview\PHP'); +\OC\Preview::registerProvider('OC\Preview\PHP'); class JavaScript extends TXT { @@ -66,4 +66,4 @@ class JavaScript extends TXT { } -\OC\PreviewManager::registerProvider('OC\Preview\JavaScript'); \ No newline at end of file +\OC\Preview::registerProvider('OC\Preview\JavaScript'); \ No newline at end of file diff --git a/lib/preview/unknown.php b/lib/preview/unknown.php index f9f6fe957b2..a31b365722e 100644 --- a/lib/preview/unknown.php +++ b/lib/preview/unknown.php @@ -40,4 +40,4 @@ class Unknown extends Provider { } } -\OC\PreviewManager::registerProvider('OC\Preview\Unknown'); \ No newline at end of file +\OC\Preview::registerProvider('OC\Preview\Unknown'); \ No newline at end of file From 1e4ec2ac276b15232824da056b6253696d324d42 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Mon, 29 Jul 2013 15:47:17 +0200 Subject: [PATCH 103/170] add class='preview-icon' to rows in file app that make use of previews --- apps/files/templates/part.list.php | 12 ++++++++-- lib/preview.php | 18 +++++++++++++- lib/public/preview.php | 38 +++++++++--------------------- 3 files changed, 38 insertions(+), 30 deletions(-) diff --git a/apps/files/templates/part.list.php b/apps/files/templates/part.list.php index 9e62c991975..b87000a8993 100644 --- a/apps/files/templates/part.list.php +++ b/apps/files/templates/part.list.php @@ -34,9 +34,17 @@ $totalsize = 0; ?> - style="background-image:url()" + + style="background-image:url()" class="preview-icon" + + style="background-image:url()" + - style="background-image:url()" + + style="background-image:url()" class="preview-icon" + + style="background-image:url()" + > diff --git a/lib/preview.php b/lib/preview.php index 113b200c29b..245ad64014e 100755 --- a/lib/preview.php +++ b/lib/preview.php @@ -771,7 +771,23 @@ class Preview { $preview = new Preview(\OC_User::getUser(), 'files/', $path, 0, 0, false, true); $preview->deleteAllPreviews(); } - + + public static function isMimeSupported($mimetype) { + //check if there are preview backends + if(empty(self::$providers)) { + self::initProviders(); + } + + //remove last element because it has the mimetype * + $providers = array_slice(self::$providers, 0, -1); + foreach($providers as $supportedmimetype => $provider) { + if(preg_match($supportedmimetype, $mimetype)) { + return true; + } + } + return false; + } + private static function showErrorPreview() { $path = \OC::$SERVERROOT . '/core/img/actions/delete.png'; $preview = new \OC_Image($path); diff --git a/lib/public/preview.php b/lib/public/preview.php index a7487c485f1..e488eade4da 100644 --- a/lib/public/preview.php +++ b/lib/public/preview.php @@ -1,33 +1,11 @@ . -* -*/ - -/** - * Public interface of ownCloud for apps to use. - * Preview Class. - * + * 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. */ - -// use OCP namespace for all classes that are considered public. -// This means that they should be used by apps instead of the internal ownCloud classes namespace OCP; /** @@ -47,4 +25,10 @@ class Preview { return(\OC_Preview::show($file,$maxX,$maxY,$scaleup)); } + + + public static function isMimeSupported($mimetype='*') { + return \OC\Preview::isMimeSupported($mimetype); + } + } From 2ea8ee613986216a420fad2795b5e7fa89519d5e Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Mon, 29 Jul 2013 16:27:40 +0200 Subject: [PATCH 104/170] add class='preview-icon' in trashbin app as well --- apps/files_trashbin/lib/trash.php | 2 +- apps/files_trashbin/templates/part.list.php | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/files_trashbin/lib/trash.php b/apps/files_trashbin/lib/trash.php index 4174ef0d185..71e76770aa9 100644 --- a/apps/files_trashbin/lib/trash.php +++ b/apps/files_trashbin/lib/trash.php @@ -858,6 +858,6 @@ class Trashbin { } public static function preview_icon($path) { - return \OC_Helper::linkToRoute( 'core_ajax_trashbin_preview', array('x' => 44, 'y' => 44, 'file' => urlencode($path) )); + return \OC_Helper::linkToRoute( 'core_ajax_trashbin_preview', array('x' => 36, 'y' => 36, 'file' => urlencode($path) )); } } diff --git a/apps/files_trashbin/templates/part.list.php b/apps/files_trashbin/templates/part.list.php index 44e2fc7293b..71b9a238823 100644 --- a/apps/files_trashbin/templates/part.list.php +++ b/apps/files_trashbin/templates/part.list.php @@ -25,7 +25,11 @@ style="background-image:url()" - style="background-image:url()" + + style="background-image:url()" class="preview-icon" + + style="background-image:url()" + > From b4a523927823ab8bc80c5f1fc0d5bd5ef61f8eb8 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Mon, 29 Jul 2013 16:30:04 +0200 Subject: [PATCH 105/170] fix syntax in config.sample.php --- config/config.sample.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/config.sample.php b/config/config.sample.php index cacca78e970..7629414ef16 100644 --- a/config/config.sample.php +++ b/config/config.sample.php @@ -185,7 +185,7 @@ $CONFIG = array( //links to custom clients 'customclient_desktop' => '', //http://owncloud.org/sync-clients/ 'customclient_android' => '', //https://play.google.com/store/apps/details?id=com.owncloud.android -'customclient_ios' => '' //https://itunes.apple.com/us/app/owncloud/id543672169?mt=8 +'customclient_ios' => '', //https://itunes.apple.com/us/app/owncloud/id543672169?mt=8 // PREVIEW /* the max width of a generated preview, if value is null, there is no limit */ From ac6a3133eca86b853da838ae310534b76e9fb662 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Tue, 30 Jul 2013 12:29:12 +0200 Subject: [PATCH 106/170] style fixes --- apps/files/js/files.js | 2 +- apps/files/templates/part.list.php | 2 +- apps/files_sharing/public.php | 2 +- core/ajax/preview.php | 42 ++++ core/ajax/publicpreview.php | 92 +++++++++ core/ajax/trashbinpreview.php | 46 +++++ core/routes.php | 6 +- lib/helper.php | 2 +- lib/preview.php | 308 +++++++---------------------- lib/preview/images.php | 7 +- lib/preview/libreoffice-cl.php | 24 ++- lib/preview/movies.php | 22 ++- lib/preview/mp3.php | 20 +- lib/preview/msoffice.php | 24 +-- lib/preview/office.php | 7 +- lib/preview/pdf.php | 8 +- lib/preview/txt.php | 15 +- lib/preview/unknown.php | 8 +- lib/template.php | 3 + lib/template/functions.php | 16 ++ 20 files changed, 348 insertions(+), 308 deletions(-) create mode 100644 core/ajax/preview.php create mode 100644 core/ajax/publicpreview.php create mode 100644 core/ajax/trashbinpreview.php diff --git a/apps/files/js/files.js b/apps/files/js/files.js index 53c6de09dd0..8b66ed6747b 100644 --- a/apps/files/js/files.js +++ b/apps/files/js/files.js @@ -825,7 +825,7 @@ function getMimeIcon(mime, ready){ getMimeIcon.cache={}; function getPreviewIcon(path, ready){ - ready(OC.Router.generate('core_ajax_preview', {file: encodeURIComponent(path), x:44, y:44})); + ready(OC.Router.generate('core_ajax_preview', {file: encodeURIComponent(path), x:36, y:36})); } function getUniqueName(name){ diff --git a/apps/files/templates/part.list.php b/apps/files/templates/part.list.php index a957a94f332..ab1b91167db 100644 --- a/apps/files/templates/part.list.php +++ b/apps/files/templates/part.list.php @@ -3,7 +3,7 @@ $totaldirs = 0; $totalsize = 0; ?> 6 $totalsize += $file['size']; if ($file['type'] === 'dir') { $totaldirs++; diff --git a/apps/files_sharing/public.php b/apps/files_sharing/public.php index 284b7a30208..650fa6a7c27 100644 --- a/apps/files_sharing/public.php +++ b/apps/files_sharing/public.php @@ -196,7 +196,7 @@ if (isset($path)) { OCP\Util::linkToPublic('files') . $urlLinkIdentifiers . '&download&path='); $list->assign('isPublic', true); $list->assign('sharingtoken', $token); - $list->assign('sharingroot', ($path)); + $list->assign('sharingroot', $basePath); $breadcrumbNav = new OCP\Template('files', 'part.breadcrumb', ''); $breadcrumbNav->assign('breadcrumb', $breadcrumb); $breadcrumbNav->assign('baseURL', OCP\Util::linkToPublic('files') . $urlLinkIdentifiers . '&path='); diff --git a/core/ajax/preview.php b/core/ajax/preview.php new file mode 100644 index 00000000000..a9d127ffcc4 --- /dev/null +++ b/core/ajax/preview.php @@ -0,0 +1,42 @@ +setFile($file); + $preview->setMaxX($maxX); + $preview->setMaxY($maxY); + $preview->setScalingUp($scalingUp); + + $preview->show(); +}catch(\Exception $e) { + \OC_Response::setStatus(500); + \OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR); + \OC\Preview::showErrorPreview(); + exit; +} \ No newline at end of file diff --git a/core/ajax/publicpreview.php b/core/ajax/publicpreview.php new file mode 100644 index 00000000000..aace24caa21 --- /dev/null +++ b/core/ajax/publicpreview.php @@ -0,0 +1,92 @@ +setFile($sharedFile); + $preview->setMaxX($maxX); + $preview->setMaxY($maxY); + $preview->setScalingUp($scalingUp); + + $preview->show(); +}catch(\Exception $e) { + \OC_Response::setStatus(500); + \OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR); + \OC\Preview::showErrorPreview(); + exit; +} \ No newline at end of file diff --git a/core/ajax/trashbinpreview.php b/core/ajax/trashbinpreview.php new file mode 100644 index 00000000000..d018a57d37b --- /dev/null +++ b/core/ajax/trashbinpreview.php @@ -0,0 +1,46 @@ +setFile($file); + $preview->setMaxX($maxX); + $preview->setMaxY($maxY); + $preview->setScalingUp($scalingUp); + + $preview->showPreview(); +}catch(\Exception $e) { + \OC_Response::setStatus(500); + \OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR); + \OC\Preview::showErrorPreview(); + exit; +} \ No newline at end of file diff --git a/core/routes.php b/core/routes.php index 41e82f8a73d..75cc4d511c0 100644 --- a/core/routes.php +++ b/core/routes.php @@ -43,11 +43,11 @@ $this->create('js_config', '/core/js/config.js') $this->create('core_ajax_routes', '/core/routes.json') ->action('OC_Router', 'JSRoutes'); $this->create('core_ajax_preview', '/core/preview.png') - ->action('OC\Preview', 'previewRouter'); + ->actionInclude('core/ajax/preview.php'); $this->create('core_ajax_trashbin_preview', '/core/trashbinpreview.png') - ->action('OC\Preview', 'trashbinPreviewRouter'); + ->actionInclude('core/ajax/trashbinpreview.php'); $this->create('core_ajax_public_preview', '/core/publicpreview.png') - ->action('OC\Preview', 'publicPreviewRouter'); + ->actionInclude('core/ajax/publicpreview.php'); OC::$CLASSPATH['OC_Core_LostPassword_Controller'] = 'core/lostpassword/controller.php'; $this->create('core_lostpassword_index', '/lostpassword/') ->get() diff --git a/lib/helper.php b/lib/helper.php index 460e5679b02..b74e4c4512e 100644 --- a/lib/helper.php +++ b/lib/helper.php @@ -233,7 +233,7 @@ class OC_Helper { return self::linkToRoute( 'core_ajax_preview', array('x' => 36, 'y' => 36, 'file' => urlencode($path) )); } - public static function publicPreview_icon( $path, $token ) { + public static function publicPreviewIcon( $path, $token ) { return self::linkToRoute( 'core_ajax_public_preview', array('x' => 36, 'y' => 36, 'file' => urlencode($path), 't' => $token)); } diff --git a/lib/preview.php b/lib/preview.php index 245ad64014e..9f4d20b4650 100755 --- a/lib/preview.php +++ b/lib/preview.php @@ -55,12 +55,12 @@ class Preview { * @param string $file The path to the file where you want a thumbnail from * @param int $maxX The maximum X size of the thumbnail. It can be smaller depending on the shape of the image * @param int $maxY The maximum Y size of the thumbnail. It can be smaller depending on the shape of the image - * @param bool $scalingup Disable/Enable upscaling of previews + * @param bool $scalingUp Disable/Enable upscaling of previews * @return mixed (bool / string) * false if thumbnail does not exist * path to thumbnail if thumbnail exists */ - public function __construct($user='', $root='/', $file='', $maxX=1, $maxY=1, $scalingup=true) { + public function __construct($user='', $root='/', $file='', $maxX=1, $maxY=1, $scalingUp=true) { //set config $this->configMaxX = \OC_Config::getValue('preview_max_x', null); $this->configMaxY = \OC_Config::getValue('preview_max_y', null); @@ -70,11 +70,11 @@ class Preview { $this->setFile($file); $this->setMaxX($maxX); $this->setMaxY($maxY); - $this->setScalingUp($scalingup); + $this->setScalingUp($scalingUp); //init fileviews if($user === ''){ - $user = OC_User::getUser(); + $user = \OC_User::getUser(); } $this->fileview = new \OC\Files\View('/' . $user . '/' . $root); $this->userview = new \OC\Files\View('/' . $user); @@ -120,7 +120,7 @@ class Preview { * @brief returns whether or not scalingup is enabled * @return bool */ - public function getScalingup() { + public function getScalingUp() { return $this->scalingup; } @@ -172,8 +172,8 @@ class Preview { * @return $this */ public function setMaxX($maxX=1) { - if($maxX === 0) { - throw new \Exception('Cannot set width of 0!'); + if($maxX <= 0) { + throw new \Exception('Cannot set width of 0 or smaller!'); } $configMaxX = $this->getConfigMaxX(); if(!is_null($configMaxX)) { @@ -192,8 +192,8 @@ class Preview { * @return $this */ public function setMaxY($maxY=1) { - if($maxY === 0) { - throw new \Exception('Cannot set height of 0!'); + if($maxY <= 0) { + throw new \Exception('Cannot set height of 0 or smaller!'); } $configMaxY = $this->getConfigMaxY(); if(!is_null($configMaxY)) { @@ -208,14 +208,14 @@ class Preview { /** * @brief set whether or not scalingup is enabled - * @param bool $scalingup + * @param bool $scalingUp * @return $this */ - public function setScalingup($scalingup) { + public function setScalingup($scalingUp) { if($this->getMaxScaleFactor() === 1) { - $scalingup = false; + $scalingUp = false; } - $this->scalingup = $scalingup; + $this->scalingup = $scalingUp; return $this; } @@ -245,12 +245,12 @@ class Preview { public function deletePreview() { $file = $this->getFile(); - $fileinfo = $this->fileview->getFileInfo($file); - $fileid = $fileinfo['fileid']; + $fileInfo = $this->fileview->getFileInfo($file); + $fileId = $fileInfo['fileid']; - $previewpath = $this->getThumbnailsFolder() . '/' . $fileid . '/' . $this->getMaxX() . '-' . $this->getMaxY() . '.png'; - $this->userview->unlink($previewpath); - return !$this->userview->file_exists($previewpath); + $previewPath = $this->getThumbnailsFolder() . '/' . $fileId . '/' . $this->getMaxX() . '-' . $this->getMaxY() . '.png'; + $this->userview->unlink($previewPath); + return !$this->userview->file_exists($previewPath); } /** @@ -260,13 +260,13 @@ class Preview { public function deleteAllPreviews() { $file = $this->getFile(); - $fileinfo = $this->fileview->getFileInfo($file); - $fileid = $fileinfo['fileid']; + $fileInfo = $this->fileview->getFileInfo($file); + $fileId = $fileInfo['fileid']; - $previewpath = $this->getThumbnailsFolder() . '/' . $fileid . '/'; - $this->userview->deleteAll($previewpath); - $this->userview->rmdir($previewpath); - return !$this->userview->is_dir($previewpath); + $previewPath = $this->getThumbnailsFolder() . '/' . $fileId . '/'; + $this->userview->deleteAll($previewPath); + $this->userview->rmdir($previewPath); + return !$this->userview->is_dir($previewPath); } /** @@ -279,45 +279,45 @@ class Preview { $file = $this->getFile(); $maxX = $this->getMaxX(); $maxY = $this->getMaxY(); - $scalingup = $this->getScalingup(); + $scalingUp = $this->getScalingUp(); $maxscalefactor = $this->getMaxScaleFactor(); - $fileinfo = $this->fileview->getFileInfo($file); - $fileid = $fileinfo['fileid']; + $fileInfo = $this->fileview->getFileInfo($file); + $fileId = $fileInfo['fileid']; - if(is_null($fileid)) { + if(is_null($fileId)) { return false; } - $previewpath = $this->getThumbnailsFolder() . '/' . $fileid . '/'; - if(!$this->userview->is_dir($previewpath)) { + $previewPath = $this->getThumbnailsFolder() . '/' . $fileId . '/'; + if(!$this->userview->is_dir($previewPath)) { return false; } //does a preview with the wanted height and width already exist? - if($this->userview->file_exists($previewpath . $maxX . '-' . $maxY . '.png')) { - return $previewpath . $maxX . '-' . $maxY . '.png'; + if($this->userview->file_exists($previewPath . $maxX . '-' . $maxY . '.png')) { + return $previewPath . $maxX . '-' . $maxY . '.png'; } - $wantedaspectratio = (float) ($maxX / $maxY); + $wantedAspectRatio = (float) ($maxX / $maxY); //array for usable cached thumbnails - $possiblethumbnails = array(); + $possibleThumbnails = array(); - $allthumbnails = $this->userview->getDirectoryContent($previewpath); - foreach($allthumbnails as $thumbnail) { + $allThumbnails = $this->userview->getDirectoryContent($previewPath); + foreach($allThumbnails as $thumbnail) { $name = rtrim($thumbnail['name'], '.png'); $size = explode('-', $name); $x = (int) $size[0]; $y = (int) $size[1]; - $aspectratio = (float) ($x / $y); - if($aspectratio !== $wantedaspectratio) { + $aspectRatio = (float) ($x / $y); + if($aspectRatio !== $wantedAspectRatio) { continue; } if($x < $maxX || $y < $maxY) { - if($scalingup) { + if($scalingUp) { $scalefactor = $maxX / $x; if($scalefactor > $maxscalefactor) { continue; @@ -326,28 +326,28 @@ class Preview { continue; } } - $possiblethumbnails[$x] = $thumbnail['path']; + $possibleThumbnails[$x] = $thumbnail['path']; } - if(count($possiblethumbnails) === 0) { + if(count($possibleThumbnails) === 0) { return false; } - if(count($possiblethumbnails) === 1) { - return current($possiblethumbnails); + if(count($possibleThumbnails) === 1) { + return current($possibleThumbnails); } - ksort($possiblethumbnails); + ksort($possibleThumbnails); - if(key(reset($possiblethumbnails)) > $maxX) { - return current(reset($possiblethumbnails)); + if(key(reset($possibleThumbnails)) > $maxX) { + return current(reset($possibleThumbnails)); } - if(key(end($possiblethumbnails)) < $maxX) { - return current(end($possiblethumbnails)); + if(key(end($possibleThumbnails)) < $maxX) { + return current(end($possibleThumbnails)); } - foreach($possiblethumbnails as $width => $path) { + foreach($possibleThumbnails as $width => $path) { if($width < $maxX) { continue; }else{ @@ -358,7 +358,7 @@ class Preview { /** * @brief return a preview of a file - * @return image + * @return \OC_Image */ public function getPreview() { if(!is_null($this->preview) && $this->preview->valid()){ @@ -369,10 +369,10 @@ class Preview { $file = $this->getFile(); $maxX = $this->getMaxX(); $maxY = $this->getMaxY(); - $scalingup = $this->getScalingup(); + $scalingUp = $this->getScalingUp(); - $fileinfo = $this->fileview->getFileInfo($file); - $fileid = $fileinfo['fileid']; + $fileInfo = $this->fileview->getFileInfo($file); + $fileId = $fileInfo['fileid']; $cached = $this->isCached(); @@ -386,12 +386,12 @@ class Preview { $mimetype = $this->fileview->getMimeType($file); $preview = null; - foreach(self::$providers as $supportedmimetype => $provider) { - if(!preg_match($supportedmimetype, $mimetype)) { + foreach(self::$providers as $supportedMimetype => $provider) { + if(!preg_match($supportedMimetype, $mimetype)) { continue; } - $preview = $provider->getThumbnail($file, $maxX, $maxY, $scalingup, $this->fileview); + $preview = $provider->getThumbnail($file, $maxX, $maxY, $scalingUp, $this->fileview); if(!($preview instanceof \OC_Image)) { continue; @@ -400,18 +400,18 @@ class Preview { $this->preview = $preview; $this->resizeAndCrop(); - $previewpath = $this->getThumbnailsFolder() . '/' . $fileid . '/'; - $cachepath = $previewpath . $maxX . '-' . $maxY . '.png'; + $previewPath = $this->getThumbnailsFolder() . '/' . $fileId . '/'; + $cachePath = $previewPath . $maxX . '-' . $maxY . '.png'; if($this->userview->is_dir($this->getThumbnailsFolder() . '/') === false) { $this->userview->mkdir($this->getThumbnailsFolder() . '/'); } - if($this->userview->is_dir($previewpath) === false) { - $this->userview->mkdir($previewpath); + if($this->userview->is_dir($previewPath) === false) { + $this->userview->mkdir($previewPath); } - $this->userview->file_put_contents($cachepath, $preview->data()); + $this->userview->file_put_contents($cachePath, $preview->data()); break; } @@ -447,13 +447,13 @@ class Preview { /** * @brief resize, crop and fix orientation - * @return image + * @return void */ private function resizeAndCrop() { $image = $this->preview; $x = $this->getMaxX(); $y = $this->getMaxY(); - $scalingup = $this->getScalingup(); + $scalingUp = $this->getScalingUp(); $maxscalefactor = $this->getMaxScaleFactor(); if(!($image instanceof \OC_Image)) { @@ -480,7 +480,7 @@ class Preview { $factor = $factorY; } - if($scalingup === false) { + if($scalingUp === false) { if($factor > 1) { $factor = 1; } @@ -583,182 +583,6 @@ class Preview { array_multisort($keys, SORT_DESC, self::$providers); } - /** - * @brief method that handles preview requests from users that are logged in - * @return void - */ - public static function previewRouter() { - \OC_Util::checkLoggedIn(); - - $file = array_key_exists('file', $_GET) ? (string) urldecode($_GET['file']) : ''; - $maxX = array_key_exists('x', $_GET) ? (int) $_GET['x'] : '36'; - $maxY = array_key_exists('y', $_GET) ? (int) $_GET['y'] : '36'; - $scalingup = array_key_exists('scalingup', $_GET) ? (bool) $_GET['scalingup'] : true; - - if($file === '') { - \OC_Response::setStatus(400); //400 Bad Request - \OC_Log::write('core-preview', 'No file parameter was passed', \OC_Log::DEBUG); - self::showErrorPreview(); - 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); - self::showErrorPreview(); - exit; - } - - try{ - $preview = new Preview(\OC_User::getUser(), 'files'); - $preview->setFile($file); - $preview->setMaxX($maxX); - $preview->setMaxY($maxY); - $preview->setScalingUp($scalingup); - - $preview->show(); - }catch(\Exception $e) { - \OC_Response::setStatus(500); - \OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR); - self::showErrorPreview(); - exit; - } - } - - /** - * @brief method that handles preview requests from users that are not logged in / view shared folders that are public - * @return void - */ - public static function publicPreviewRouter() { - if(!\OC_App::isEnabled('files_sharing')){ - exit; - } - - $file = array_key_exists('file', $_GET) ? (string) urldecode($_GET['file']) : ''; - $maxX = array_key_exists('x', $_GET) ? (int) $_GET['x'] : '36'; - $maxY = array_key_exists('y', $_GET) ? (int) $_GET['y'] : '36'; - $scalingup = array_key_exists('scalingup', $_GET) ? (bool) $_GET['scalingup'] : true; - $token = array_key_exists('t', $_GET) ? (string) $_GET['t'] : ''; - - if($token === ''){ - \OC_Response::setStatus(400); //400 Bad Request - \OC_Log::write('core-preview', 'No token parameter was passed', \OC_Log::DEBUG); - self::showErrorPreview(); - exit; - } - - $linkedItem = \OCP\Share::getShareByToken($token); - if($linkedItem === false || ($linkedItem['item_type'] !== 'file' && $linkedItem['item_type'] !== 'folder')) { - \OC_Response::setStatus(404); - \OC_Log::write('core-preview', 'Passed token parameter is not valid', \OC_Log::DEBUG); - self::showErrorPreview(); - exit; - } - - if(!isset($linkedItem['uid_owner']) || !isset($linkedItem['file_source'])) { - \OC_Response::setStatus(500); - \OC_Log::write('core-preview', 'Passed token seems to be valid, but it does not contain all necessary information . ("' . $token . '")'); - self::showErrorPreview(); - exit; - } - - $userid = $linkedItem['uid_owner']; - \OC_Util::setupFS($userid); - - $pathid = $linkedItem['file_source']; - $path = \OC\Files\Filesystem::getPath($pathid); - $pathinfo = \OC\Files\Filesystem::getFileInfo($path); - $sharedfile = null; - - if($linkedItem['item_type'] === 'folder') { - $isvalid = \OC\Files\Filesystem::isValidPath($file); - if(!$isvalid) { - \OC_Response::setStatus(400); //400 Bad Request - \OC_Log::write('core-preview', 'Passed filename is not valid, might be malicious (file:"' . $file . '";ip:"' . $_SERVER['REMOTE_ADDR'] . '")', \OC_Log::WARN); - self::showErrorPreview(); - exit; - } - $sharedfile = \OC\Files\Filesystem::normalizePath($file); - } - - if($linkedItem['item_type'] === 'file') { - $parent = $pathinfo['parent']; - $path = \OC\Files\Filesystem::getPath($parent); - $sharedfile = $pathinfo['name']; - } - - $path = \OC\Files\Filesystem::normalizePath($path, false); - if(substr($path, 0, 1) === '/') { - $path = substr($path, 1); - } - - 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); - self::showErrorPreview(); - exit; - } - - $root = 'files/' . $path; - - try{ - $preview = new Preview($userid, $root); - $preview->setFile($file); - $preview->setMaxX($maxX); - $preview->setMaxY($maxY); - $preview->setScalingUp($scalingup); - - $preview->show(); - }catch(\Exception $e) { - \OC_Response::setStatus(500); - \OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR); - self::showErrorPreview(); - exit; - } - } - - public static function trashbinPreviewRouter() { - \OC_Util::checkLoggedIn(); - - if(!\OC_App::isEnabled('files_trashbin')){ - exit; - } - - $file = array_key_exists('file', $_GET) ? (string) urldecode($_GET['file']) : ''; - $maxX = array_key_exists('x', $_GET) ? (int) $_GET['x'] : '44'; - $maxY = array_key_exists('y', $_GET) ? (int) $_GET['y'] : '44'; - $scalingup = array_key_exists('scalingup', $_GET) ? (bool) $_GET['scalingup'] : true; - - if($file === '') { - \OC_Response::setStatus(400); //400 Bad Request - \OC_Log::write('core-preview', 'No file parameter was passed', \OC_Log::DEBUG); - self::showErrorPreview(); - 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); - self::showErrorPreview(); - exit; - } - - try{ - $preview = new Preview(\OC_User::getUser(), 'files_trashbin/files'); - $preview->setFile($file); - $preview->setMaxX($maxX); - $preview->setMaxY($maxY); - $preview->setScalingUp($scalingup); - - $preview->showPreview(); - }catch(\Exception $e) { - \OC_Response::setStatus(500); - \OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR); - self::showErrorPreview(); - exit; - } - } - public static function post_write($args) { self::post_delete($args); } @@ -780,8 +604,8 @@ class Preview { //remove last element because it has the mimetype * $providers = array_slice(self::$providers, 0, -1); - foreach($providers as $supportedmimetype => $provider) { - if(preg_match($supportedmimetype, $mimetype)) { + foreach($providers as $supportedMimetype => $provider) { + if(preg_match($supportedMimetype, $mimetype)) { return true; } } diff --git a/lib/preview/images.php b/lib/preview/images.php index 987aa9aef0a..9aec967282d 100644 --- a/lib/preview/images.php +++ b/lib/preview/images.php @@ -16,10 +16,13 @@ class Image extends Provider { public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) { //get fileinfo - $fileinfo = $fileview->getFileInfo($path); + $fileInfo = $fileview->getFileInfo($path); + if(!$fileInfo) { + return false; + } //check if file is encrypted - if($fileinfo['encrypted'] === true) { + if($fileInfo['encrypted'] === true) { $image = new \OC_Image(stream_get_contents($fileview->fopen($path, 'r'))); }else{ $image = new \OC_Image(); diff --git a/lib/preview/libreoffice-cl.php b/lib/preview/libreoffice-cl.php index 2749c4867e9..0f4ec3d0348 100644 --- a/lib/preview/libreoffice-cl.php +++ b/lib/preview/libreoffice-cl.php @@ -22,28 +22,30 @@ class Office extends Provider { return false; } - $abspath = $fileview->toTmpFile($path); + $absPath = $fileview->toTmpFile($path); - $tmpdir = get_temp_dir(); + $tmpDir = get_temp_dir(); - $exec = $this->cmd . ' --headless --nologo --nofirststartwizard --invisible --norestore -convert-to pdf -outdir ' . escapeshellarg($tmpdir) . ' ' . escapeshellarg($abspath); - $export = 'export HOME=/' . $tmpdir; + $exec = $this->cmd . ' --headless --nologo --nofirststartwizard --invisible --norestore -convert-to pdf -outdir ' . escapeshellarg($tmpDir) . ' ' . escapeshellarg($absPath); + $export = 'export HOME=/' . $tmpDir; shell_exec($export . "\n" . $exec); //create imagick object from pdf try{ - $pdf = new \imagick($abspath . '.pdf' . '[0]'); + $pdf = new \imagick($absPath . '.pdf' . '[0]'); $pdf->setImageFormat('jpg'); - }catch(\Exception $e){ + }catch (\Exception $e) { + unlink($absPath); + unlink($absPath . '.pdf'); \OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR); return false; } $image = new \OC_Image($pdf); - unlink($abspath); - unlink($abspath . '.pdf'); + unlink($absPath); + unlink($absPath . '.pdf'); return $image->valid() ? $image : false; } @@ -55,11 +57,13 @@ class Office extends Provider { $cmd = \OC_Config::getValue('preview_libreoffice_path', null); } - if($cmd === '' && shell_exec('libreoffice --headless --version')) { + $whichLibreOffice = shell_exec('which libreoffice'); + if($cmd === '' && !empty($whichLibreOffice)) { $cmd = 'libreoffice'; } - if($cmd === '' && shell_exec('openoffice --headless --version')) { + $whichOpenOffice = shell_exec('which openoffice'); + if($cmd === '' && !empty($whichOpenOffice)) { $cmd = 'openoffice'; } diff --git a/lib/preview/movies.php b/lib/preview/movies.php index 8531050d112..e2a1b8edddc 100644 --- a/lib/preview/movies.php +++ b/lib/preview/movies.php @@ -8,7 +8,11 @@ */ namespace OC\Preview; -if(!is_null(shell_exec('ffmpeg -version'))) { +$isShellExecEnabled = !in_array('shell_exec', explode(', ', ini_get('disable_functions'))); +$whichFFMPEG = shell_exec('which ffmpeg'); +$isFFMPEGAvailable = !empty($whichFFMPEG); + +if($isShellExecEnabled && $isFFMPEGAvailable) { class Movie extends Provider { @@ -17,23 +21,23 @@ if(!is_null(shell_exec('ffmpeg -version'))) { } public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) { - $abspath = \OC_Helper::tmpFile(); - $tmppath = \OC_Helper::tmpFile(); + $absPath = \OC_Helper::tmpFile(); + $tmpPath = \OC_Helper::tmpFile(); $handle = $fileview->fopen($path, 'rb'); $firstmb = stream_get_contents($handle, 1048576); //1024 * 1024 = 1048576 - file_put_contents($abspath, $firstmb); + file_put_contents($absPath, $firstmb); - //$cmd = 'ffmpeg -y -i ' . escapeshellarg($abspath) . ' -f mjpeg -vframes 1 -ss 1 -s ' . escapeshellarg($maxX) . 'x' . escapeshellarg($maxY) . ' ' . $tmppath; - $cmd = 'ffmpeg -an -y -i ' . escapeshellarg($abspath) . ' -f mjpeg -vframes 1 -ss 1 ' . escapeshellarg($tmppath); + //$cmd = 'ffmpeg -y -i ' . escapeshellarg($absPath) . ' -f mjpeg -vframes 1 -ss 1 -s ' . escapeshellarg($maxX) . 'x' . escapeshellarg($maxY) . ' ' . $tmpPath; + $cmd = 'ffmpeg -an -y -i ' . escapeshellarg($absPath) . ' -f mjpeg -vframes 1 -ss 1 ' . escapeshellarg($tmpPath); shell_exec($cmd); - $image = new \OC_Image($tmppath); + $image = new \OC_Image($tmpPath); - unlink($abspath); - unlink($tmppath); + unlink($absPath); + unlink($tmpPath); return $image->valid() ? $image : false; } diff --git a/lib/preview/mp3.php b/lib/preview/mp3.php index 835ff529000..1eed566315c 100644 --- a/lib/preview/mp3.php +++ b/lib/preview/mp3.php @@ -18,19 +18,21 @@ class MP3 extends Provider { $getID3 = new \getID3(); - $tmppath = $fileview->toTmpFile($path); + $tmpPath = $fileview->toTmpFile($path); - $tags = $getID3->analyze($tmppath); - \getid3_lib::CopyTagsToComments($tags); - $picture = @$tags['id3v2']['APIC'][0]['data']; + $tags = $getID3->analyze($tmpPath); + \getid3_lib::CopyTagsToComments($tags); + if(isset($tags['id3v2']['APIC'][0]['data'])) { + $picture = @$tags['id3v2']['APIC'][0]['data']; + unlink($tmpPath); + $image = new \OC_Image($picture); + return $image->valid() ? $image : $this->getNoCoverThumbnail(); + } - unlink($tmppath); - - $image = new \OC_Image($picture); - return $image->valid() ? $image : $this->getNoCoverThumbnail($maxX, $maxY); + return $this->getNoCoverThumbnail(); } - public function getNoCoverThumbnail($maxX, $maxY) { + private function getNoCoverThumbnail() { $icon = \OC::$SERVERROOT . '/core/img/filetypes/audio.png'; if(!file_exists($icon)) { diff --git a/lib/preview/msoffice.php b/lib/preview/msoffice.php index ccf1d674c7a..e69ab0ab8cb 100644 --- a/lib/preview/msoffice.php +++ b/lib/preview/msoffice.php @@ -32,16 +32,16 @@ class DOCX extends Provider { public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) { require_once('phpdocx/classes/TransformDoc.inc'); - $tmpdoc = $fileview->toTmpFile($path); + $tmpDoc = $fileview->toTmpFile($path); $transformdoc = new \TransformDoc(); - $transformdoc->setStrFile($tmpdoc); - $transformdoc->generatePDF($tmpdoc); + $transformdoc->setStrFile($tmpDoc); + $transformdoc->generatePDF($tmpDoc); - $pdf = new \imagick($tmpdoc . '[0]'); + $pdf = new \imagick($tmpDoc . '[0]'); $pdf->setImageFormat('jpg'); - unlink($tmpdoc); + unlink($tmpDoc); $image = new \OC_Image($pdf); @@ -62,23 +62,23 @@ class MSOfficeExcel extends Provider { require_once('PHPExcel/Classes/PHPExcel.php'); require_once('PHPExcel/Classes/PHPExcel/IOFactory.php'); - $abspath = $fileview->toTmpFile($path); - $tmppath = \OC_Helper::tmpFile(); + $absPath = $fileview->toTmpFile($path); + $tmpPath = \OC_Helper::tmpFile(); $rendererName = \PHPExcel_Settings::PDF_RENDERER_DOMPDF; $rendererLibraryPath = \OC::$THIRDPARTYROOT . '/3rdparty/dompdf'; \PHPExcel_Settings::setPdfRenderer($rendererName, $rendererLibraryPath); - $phpexcel = new \PHPExcel($abspath); + $phpexcel = new \PHPExcel($absPath); $excel = \PHPExcel_IOFactory::createWriter($phpexcel, 'PDF'); - $excel->save($tmppath); + $excel->save($tmpPath); - $pdf = new \imagick($tmppath . '[0]'); + $pdf = new \imagick($tmpPath . '[0]'); $pdf->setImageFormat('jpg'); - unlink($abspath); - unlink($tmppath); + unlink($absPath); + unlink($tmpPath); $image = new \OC_Image($pdf); diff --git a/lib/preview/office.php b/lib/preview/office.php index b6783bc5798..b93e1e57c8b 100644 --- a/lib/preview/office.php +++ b/lib/preview/office.php @@ -7,8 +7,13 @@ */ //both, libreoffice backend and php fallback, need imagick if (extension_loaded('imagick')) { + $isShellExecEnabled = !in_array('shell_exec', explode(', ', ini_get('disable_functions'))); + $whichLibreOffice = shell_exec('which libreoffice'); + $isLibreOfficeAvailable = !empty($whichLibreOffice); + $whichOpenOffice = shell_exec('which libreoffice'); + $isOpenOfficeAvailable = !empty($whichOpenOffice); //let's see if there is libreoffice or openoffice on this machine - if(shell_exec('libreoffice --headless --version') || shell_exec('openoffice --headless --version') || is_string(\OC_Config::getValue('preview_libreoffice_path', null))) { + if($isShellExecEnabled && ($isLibreOfficeAvailable || $isOpenOfficeAvailable || is_string(\OC_Config::getValue('preview_libreoffice_path', null)))) { require_once('libreoffice-cl.php'); }else{ //in case there isn't, use our fallback diff --git a/lib/preview/pdf.php b/lib/preview/pdf.php index 3eabd201156..723dc1d80d2 100644 --- a/lib/preview/pdf.php +++ b/lib/preview/pdf.php @@ -16,18 +16,18 @@ if (extension_loaded('imagick')) { } public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) { - $tmppath = $fileview->toTmpFile($path); + $tmpPath = $fileview->toTmpFile($path); //create imagick object from pdf try{ - $pdf = new \imagick($tmppath . '[0]'); + $pdf = new \imagick($tmpPath . '[0]'); $pdf->setImageFormat('jpg'); - }catch(\Exception $e){ + }catch (\Exception $e) { \OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR); return false; } - unlink($tmppath); + unlink($tmpPath); //new image object $image = new \OC_Image($pdf); diff --git a/lib/preview/txt.php b/lib/preview/txt.php index c7b8fabc6b0..89927fd580a 100644 --- a/lib/preview/txt.php +++ b/lib/preview/txt.php @@ -18,24 +18,23 @@ class TXT extends Provider { $content = stream_get_contents($content); $lines = preg_split("/\r\n|\n|\r/", $content); - $numoflines = count($lines); - $fontsize = 5; //5px - $linesize = ceil($fontsize * 1.25); + $fontSize = 5; //5px + $lineSize = ceil($fontSize * 1.25); $image = imagecreate($maxX, $maxY); - $imagecolor = imagecolorallocate($image, 255, 255, 255); - $textcolor = imagecolorallocate($image, 0, 0, 0); + imagecolorallocate($image, 255, 255, 255); + $textColor = imagecolorallocate($image, 0, 0, 0); foreach($lines as $index => $line) { $index = $index + 1; $x = (int) 1; - $y = (int) ($index * $linesize) - $fontsize; + $y = (int) ($index * $lineSize) - $fontSize; - imagestring($image, 1, $x, $y, $line, $textcolor); + imagestring($image, 1, $x, $y, $line, $textColor); - if(($index * $linesize) >= $maxY) { + if(($index * $lineSize) >= $maxY) { break; } } diff --git a/lib/preview/unknown.php b/lib/preview/unknown.php index a31b365722e..ba13ca35d66 100644 --- a/lib/preview/unknown.php +++ b/lib/preview/unknown.php @@ -20,7 +20,7 @@ class Unknown extends Provider { list($type, $subtype) = explode('/', $mimetype); } - $iconsroot = \OC::$SERVERROOT . '/core/img/filetypes/'; + $iconsRoot = \OC::$SERVERROOT . '/core/img/filetypes/'; if(isset($type)){ $icons = array($mimetype, $type, 'text'); @@ -30,10 +30,10 @@ class Unknown extends Provider { foreach($icons as $icon) { $icon = str_replace('/', '-', $icon); - $iconpath = $iconsroot . $icon . '.png'; + $iconPath = $iconsRoot . $icon . '.png'; - if(file_exists($iconpath)) { - return new \OC_Image($iconpath); + if(file_exists($iconPath)) { + return new \OC_Image($iconPath); } } return false; diff --git a/lib/template.php b/lib/template.php index caa1e667c61..9b2c1211e61 100644 --- a/lib/template.php +++ b/lib/template.php @@ -23,6 +23,9 @@ require_once __DIR__.'/template/functions.php'; +/** + * This class provides the templates for ownCloud. + */ class OC_Template extends \OC\Template\Base { private $renderas; // Create a full page? private $path; // The path to the template diff --git a/lib/template/functions.php b/lib/template/functions.php index a864614c9a1..842f28c90e0 100644 --- a/lib/template/functions.php +++ b/lib/template/functions.php @@ -47,6 +47,22 @@ function image_path( $app, $image ) { return OC_Helper::imagePath( $app, $image ); } +/** + * @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 + * + * For further information have a look at OC_Helper::previewIcon + */ +function preview_icon( $path ) { + return OC_Helper::previewIcon( $path ); +} + +function publicPreview_icon ( $path, $token ) { + return OC_Helper::publicPreviewIcon( $path, $token ); +} + /** * @brief make OC_Helper::mimetypeIcon available as a simple function * @param string $mimetype mimetype From d84d8f71082ba17a9f37f86600a71d20e2481772 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Tue, 30 Jul 2013 12:35:39 +0200 Subject: [PATCH 107/170] fix merge conflicts --- lib/template/functions.php | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/lib/template/functions.php b/lib/template/functions.php index 842f28c90e0..a892e310362 100644 --- a/lib/template/functions.php +++ b/lib/template/functions.php @@ -47,22 +47,6 @@ function image_path( $app, $image ) { return OC_Helper::imagePath( $app, $image ); } -/** - * @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 - * - * For further information have a look at OC_Helper::previewIcon - */ -function preview_icon( $path ) { - return OC_Helper::previewIcon( $path ); -} - -function publicPreview_icon ( $path, $token ) { - return OC_Helper::publicPreviewIcon( $path, $token ); -} - /** * @brief make OC_Helper::mimetypeIcon available as a simple function * @param string $mimetype mimetype @@ -87,7 +71,7 @@ function preview_icon( $path ) { } function publicPreview_icon ( $path, $token ) { - return OC_Helper::publicPreview_icon( $path, $token ); + return OC_Helper::publicPreviewIcon( $path, $token ); } /** From 640253fa31928ff52ba41e53cf50192c4b0002e9 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Tue, 30 Jul 2013 13:43:15 +0200 Subject: [PATCH 108/170] fix code style of try catch blocks --- core/ajax/publicpreview.php | 2 +- lib/preview/libreoffice-cl.php | 2 +- lib/preview/pdf.php | 2 +- lib/preview/svg.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/core/ajax/publicpreview.php b/core/ajax/publicpreview.php index aace24caa21..955fbc2626a 100644 --- a/core/ajax/publicpreview.php +++ b/core/ajax/publicpreview.php @@ -84,7 +84,7 @@ try{ $preview->setScalingUp($scalingUp); $preview->show(); -}catch(\Exception $e) { +} catch (\Exception $e) { \OC_Response::setStatus(500); \OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR); \OC\Preview::showErrorPreview(); diff --git a/lib/preview/libreoffice-cl.php b/lib/preview/libreoffice-cl.php index 0f4ec3d0348..2f1d08499ef 100644 --- a/lib/preview/libreoffice-cl.php +++ b/lib/preview/libreoffice-cl.php @@ -35,7 +35,7 @@ class Office extends Provider { try{ $pdf = new \imagick($absPath . '.pdf' . '[0]'); $pdf->setImageFormat('jpg'); - }catch (\Exception $e) { + } catch (\Exception $e) { unlink($absPath); unlink($absPath . '.pdf'); \OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR); diff --git a/lib/preview/pdf.php b/lib/preview/pdf.php index 723dc1d80d2..cc974b68818 100644 --- a/lib/preview/pdf.php +++ b/lib/preview/pdf.php @@ -22,7 +22,7 @@ if (extension_loaded('imagick')) { try{ $pdf = new \imagick($tmpPath . '[0]'); $pdf->setImageFormat('jpg'); - }catch (\Exception $e) { + } catch (\Exception $e) { \OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR); return false; } diff --git a/lib/preview/svg.php b/lib/preview/svg.php index bafaf71b15a..e939e526b1b 100644 --- a/lib/preview/svg.php +++ b/lib/preview/svg.php @@ -27,7 +27,7 @@ if (extension_loaded('imagick')) { $svg->readImageBlob($content); $svg->setImageFormat('jpg'); - }catch(\Exception $e){ + } catch (\Exception $e) { \OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR); return false; } From 554b1990e23c76aea182e9b8c2687f8f8b939fb9 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Mon, 5 Aug 2013 14:23:30 +0200 Subject: [PATCH 109/170] suppress is_file error msg --- lib/image.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/image.php b/lib/image.php index c1b187608a6..4bc38e20e56 100644 --- a/lib/image.php +++ b/lib/image.php @@ -392,7 +392,7 @@ class OC_Image { */ public function loadFromFile($imagepath=false) { // exif_imagetype throws "read error!" if file is less than 12 byte - if(!is_file($imagepath) || !file_exists($imagepath) || filesize($imagepath) < 12 || !is_readable($imagepath)) { + if(!@is_file($imagepath) || !file_exists($imagepath) || filesize($imagepath) < 12 || !is_readable($imagepath)) { // Debug output disabled because this method is tried before loadFromBase64? OC_Log::write('core', 'OC_Image->loadFromFile, couldn\'t load: '.$imagepath, OC_Log::DEBUG); return false; From 91bd4dd67b7d58f09a4dadff8060f63c6d6b691e Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Wed, 7 Aug 2013 11:48:08 +0200 Subject: [PATCH 110/170] implement previews of single shared files --- apps/files_sharing/js/public.js | 2 +- apps/files_sharing/templates/public.php | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/files_sharing/js/public.js b/apps/files_sharing/js/public.js index 294223aa094..fbbe9b7f3cb 100644 --- a/apps/files_sharing/js/public.js +++ b/apps/files_sharing/js/public.js @@ -16,7 +16,7 @@ $(document).ready(function() { if (typeof FileActions !== 'undefined') { var mimetype = $('#mimetype').val(); // Show file preview if previewer is available, images are already handled by the template - if (mimetype.substr(0, mimetype.indexOf('/')) != 'image') { + if (mimetype.substr(0, mimetype.indexOf('/')) != 'image' && $('.publicpreview').length() !== 0) { // Trigger default action if not download TODO var action = FileActions.getDefault(mimetype, 'file', OC.PERMISSION_READ); if (typeof action === 'undefined') { diff --git a/apps/files_sharing/templates/public.php b/apps/files_sharing/templates/public.php index 746a715f3cc..c164b3ea2b7 100644 --- a/apps/files_sharing/templates/public.php +++ b/apps/files_sharing/templates/public.php @@ -79,6 +79,10 @@
+ +
+ +
  • From dcc92445a0bc3d9d47768ac0f640780f2b09a5fd Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Wed, 7 Aug 2013 11:51:08 +0200 Subject: [PATCH 111/170] allow permissions.user to be null as suggested by @butonic --- db_structure.xml | 2 +- lib/util.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/db_structure.xml b/db_structure.xml index ef5de653033..4c192ba028e 100644 --- a/db_structure.xml +++ b/db_structure.xml @@ -383,7 +383,7 @@ user text - true + false 64 diff --git a/lib/util.php b/lib/util.php index b7dc2207e6c..dc13d31fd2b 100755 --- a/lib/util.php +++ b/lib/util.php @@ -78,7 +78,7 @@ class OC_Util { public static function getVersion() { // hint: We only can count up. Reset minor/patchlevel when // updating major/minor version number. - return array(5, 80, 05); + return array(5, 80, 06); } /** From 41ba155a143d318377302e2672726d7ea588c3c4 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Wed, 7 Aug 2013 11:57:10 +0200 Subject: [PATCH 112/170] fix js error --- apps/files_sharing/js/public.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/files_sharing/js/public.js b/apps/files_sharing/js/public.js index fbbe9b7f3cb..8cac8bf1997 100644 --- a/apps/files_sharing/js/public.js +++ b/apps/files_sharing/js/public.js @@ -16,7 +16,7 @@ $(document).ready(function() { if (typeof FileActions !== 'undefined') { var mimetype = $('#mimetype').val(); // Show file preview if previewer is available, images are already handled by the template - if (mimetype.substr(0, mimetype.indexOf('/')) != 'image' && $('.publicpreview').length() !== 0) { + if (mimetype.substr(0, mimetype.indexOf('/')) != 'image' && $('.publicpreview').length === 0) { // Trigger default action if not download TODO var action = FileActions.getDefault(mimetype, 'file', OC.PERMISSION_READ); if (typeof action === 'undefined') { From 1c9d52774e165da3d916399510727de6b7c487fa Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Fri, 9 Aug 2013 09:31:53 +0200 Subject: [PATCH 113/170] update indexes of oc_permissions --- db_structure.xml | 2 -- lib/util.php | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/db_structure.xml b/db_structure.xml index 4c192ba028e..1fcba9e2247 100644 --- a/db_structure.xml +++ b/db_structure.xml @@ -397,8 +397,6 @@ id_user_index - true - true fileid ascending diff --git a/lib/util.php b/lib/util.php index dc13d31fd2b..a7a83cf1a23 100755 --- a/lib/util.php +++ b/lib/util.php @@ -78,7 +78,7 @@ class OC_Util { public static function getVersion() { // hint: We only can count up. Reset minor/patchlevel when // updating major/minor version number. - return array(5, 80, 06); + return array(5, 80, 07); } /** From 3cbbe395eba76be37c16dcb00ac93760e965975e Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Wed, 14 Aug 2013 11:38:52 +0200 Subject: [PATCH 114/170] don't use hardcoded size for preview --- apps/files/js/files.js | 4 +++- apps/files/templates/index.php | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/files/js/files.js b/apps/files/js/files.js index 8b66ed6747b..180c23cbfa4 100644 --- a/apps/files/js/files.js +++ b/apps/files/js/files.js @@ -825,7 +825,9 @@ function getMimeIcon(mime, ready){ getMimeIcon.cache={}; function getPreviewIcon(path, ready){ - ready(OC.Router.generate('core_ajax_preview', {file: encodeURIComponent(path), x:36, y:36})); + var x = $('#filestable').data('preview-x'); + var y = $('#filestable').data('preview-y'); + ready(OC.Router.generate('core_ajax_preview', {file: encodeURIComponent(path), x:x, y:y})); } function getUniqueName(name){ diff --git a/apps/files/templates/index.php b/apps/files/templates/index.php index e4348904671..311ada70dfd 100644 --- a/apps/files/templates/index.php +++ b/apps/files/templates/index.php @@ -59,7 +59,7 @@
    t('Nothing in here. Upload something!'))?>
    - +
    ').attr({ "class": "filename", - "style": 'background-image:url('+iconurl+'); background-size: 16px;' + "style": 'background-image:url('+iconurl+'); background-size: 32px;' }); td.append(''); var link_elem = $('').attr({ From 81a45cfcf1c7064615429bb3f9759e9455868614 Mon Sep 17 00:00:00 2001 From: Stephane Martin Date: Mon, 26 Aug 2013 15:16:41 +0200 Subject: [PATCH 147/170] fixes #4574 --- lib/base.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/base.php b/lib/base.php index 2613e88d053..c73eb9413d6 100644 --- a/lib/base.php +++ b/lib/base.php @@ -795,11 +795,16 @@ class OC { ) { return false; } - OC_App::loadApps(array('authentication')); - if (OC_User::login($_SERVER["PHP_AUTH_USER"], $_SERVER["PHP_AUTH_PW"])) { - //OC_Log::write('core',"Logged in with HTTP Authentication", OC_Log::DEBUG); - OC_User::unsetMagicInCookie(); - $_SERVER['HTTP_REQUESTTOKEN'] = OC_Util::callRegister(); + // don't redo authentication if user is already logged in + // otherwise session would be invalidated in OC_User::login with + // session_regenerate_id at every page load + if (!OC_User::isLoggedIn()) { + OC_App::loadApps(array('authentication')); + if (OC_User::login($_SERVER["PHP_AUTH_USER"], $_SERVER["PHP_AUTH_PW"])) { + //OC_Log::write('core',"Logged in with HTTP Authentication", OC_Log::DEBUG); + OC_User::unsetMagicInCookie(); + $_SERVER['HTTP_REQUESTTOKEN'] = OC_Util::callRegister(); + } } return true; } From b16a018da99259278ba2f93f1e0c2d2e2bce6fb0 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Mon, 26 Aug 2013 16:33:51 +0200 Subject: [PATCH 148/170] use random string as id for checkbox --- apps/files/js/filelist.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 7a48453488a..cbeca1764ea 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -17,7 +17,8 @@ var FileList={ "class": "filename", "style": 'background-image:url('+iconurl+'); background-size: 32px;' }); - td.append(''); + var rand = Math.random().toString(16).slice(2); + td.append(''); var link_elem = $('').attr({ "class": "name", "href": linktarget From 6e8bc13aa3befba15e3df17cb32ef54d447fbfec Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Tue, 27 Aug 2013 10:58:17 +0200 Subject: [PATCH 149/170] fix weird logical behaviour --- lib/helper.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/helper.php b/lib/helper.php index dd2476eda5c..cfb29028ee3 100644 --- a/lib/helper.php +++ b/lib/helper.php @@ -858,10 +858,8 @@ class OC_Helper { } else { $total = $free; //either unknown or unlimited } - if ($total == 0) { - $total = 1; // prevent division by zero - } - if ($total >= 0) { + if ($total > 0) { + // prevent division by zero or error codes (negative values) $relative = round(($used / $total) * 10000) / 100; } else { $relative = 0; From 6bd0f3cba7491c55e53c637b3cae60ac9685f146 Mon Sep 17 00:00:00 2001 From: kondou Date: Wed, 3 Jul 2013 19:50:03 +0200 Subject: [PATCH 150/170] Reimplement filesummary in JS Fix #993 --- apps/files/css/files.css | 15 +++- apps/files/js/filelist.js | 110 +++++++++++++++++++++++++++++ apps/files/templates/part.list.php | 40 +---------- apps/files_trashbin/js/trash.js | 2 + 4 files changed, 127 insertions(+), 40 deletions(-) diff --git a/apps/files/css/files.css b/apps/files/css/files.css index 7d5fe6445b7..a9b93dc2dee 100644 --- a/apps/files/css/files.css +++ b/apps/files/css/files.css @@ -170,7 +170,20 @@ a.action>img { max-height:16px; max-width:16px; vertical-align:text-bottom; } } .summary { - opacity: .5; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=30)"; + filter: alpha(opacity=30); + opacity: .3; + height: 70px; +} + +.summary:hover, .summary, table tr.summary td { + background-color: transparent; +} + +.summary td { + padding-top: 8px; + padding-bottom: 8px; + border-bottom: none; } .summary .info { diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 10801af3ead..e11cc70802b 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -144,6 +144,7 @@ var FileList={ remove:function(name){ $('tr').filterAttr('data-file',name).find('td.filename').draggable('destroy'); $('tr').filterAttr('data-file',name).remove(); + FileList.updateFileSummary(); if($('tr[data-file]').length==0){ $('#emptyfolder').show(); } @@ -176,6 +177,7 @@ var FileList={ $('#fileList').append(element); } $('#emptyfolder').hide(); + FileList.updateFileSummary(); }, loadingDone:function(name, id){ var mime, tr=$('tr').filterAttr('data-file',name); @@ -391,6 +393,7 @@ var FileList={ }); procesSelection(); checkTrashStatus(); + FileList.updateFileSummary(); } else { $.each(files,function(index,file) { var deleteAction = $('tr').filterAttr('data-file',files[i]).children("td.date").children(".action.delete"); @@ -398,6 +401,111 @@ var FileList={ }); } }); + }, + createFileSummary: function() { + if( $('#fileList tr').length > 0 ) { + var totalDirs = 0; + var totalFiles = 0; + var totalSize = 0; + + // Count types and filesize + $.each($('tr[data-file]'), function(index, value) { + if ($(value).data('type') === 'dir') { + totalDirs++; + } else if ($(value).data('type') === 'file') { + totalFiles++; + } + totalSize += parseInt($(value).data('size')); + }); + + // Get translations + var directoryInfo = n('files', '%n folder', '%n folders', totalDirs); + var fileInfo = n('files', '%n file', '%n files', totalFiles); + + var infoVars = { + dirs: ''+directoryInfo+'', + files: ''+fileInfo+'' + } + + var info = t('files', '{dirs} and {files}', infoVars); + + // don't show the filesize column, if filesize is NaN (e.g. in trashbin) + if (isNaN(totalSize)) { + var fileSize = ''; + } else { + var fileSize = ''; + } + + $('#fileList').append(''+fileSize+''); + + var $dirInfo = $('.summary .dirinfo'); + var $fileInfo = $('.summary .fileinfo'); + var $connector = $('.summary .connector'); + + // Show only what's necessary, e.g.: no files: don't show "0 files" + if ($dirInfo.html().charAt(0) === "0") { + $dirInfo.hide(); + $connector.hide(); + } + if ($fileInfo.html().charAt(0) === "0") { + $fileInfo.hide(); + $connector.hide(); + } + } + }, + updateFileSummary: function() { + var $summary = $('.summary'); + + // Check if we should remove the summary to show "Upload something" + if ($('#fileList tr').length === 1 && $summary.length === 1) { + $summary.remove(); + } + // If there's no summary create one (createFileSummary checks if there's data) + else if ($summary.length === 0) { + FileList.createFileSummary(); + } + // There's a summary and data -> Update the summary + else if ($('#fileList tr').length > 1 && $summary.length === 1) { + var totalDirs = 0; + var totalFiles = 0; + var totalSize = 0; + $.each($('tr[data-file]'), function(index, value) { + if ($(value).data('type') === 'dir') { + totalDirs++; + } else if ($(value).data('type') === 'file') { + totalFiles++; + } + if ($(value).data('size') !== undefined) { + totalSize += parseInt($(value).data('size')); + } + }); + + var $dirInfo = $('.summary .dirinfo'); + var $fileInfo = $('.summary .fileinfo'); + var $connector = $('.summary .connector'); + + // Substitute old content with new translations + $dirInfo.html(n('files', '%n folder', '%n folders', totalDirs)); + $fileInfo.html(n('files', '%n file', '%n files', totalFiles)); + $('.summary .filesize').html(humanFileSize(totalSize)); + + // Show only what's necessary (may be hidden) + if ($dirInfo.html().charAt(0) === "0") { + $dirInfo.hide(); + $connector.hide(); + } else { + $dirInfo.show(); + } + if ($fileInfo.html().charAt(0) === "0") { + $fileInfo.hide(); + $connector.hide(); + } else { + $fileInfo.show(); + } + if ($dirInfo.html().charAt(0) !== "0" && $fileInfo.html().charAt(0) !== "0") { + $connector.show(); + } + } } }; @@ -599,4 +707,6 @@ $(document).ready(function(){ $(window).unload(function (){ $(window).trigger('beforeunload'); }); + + FileList.createFileSummary(); }); diff --git a/apps/files/templates/part.list.php b/apps/files/templates/part.list.php index 0c7d6936697..3e6f619868d 100644 --- a/apps/files/templates/part.list.php +++ b/apps/files/templates/part.list.php @@ -1,14 +1,5 @@ - - - - - - - - - Date: Wed, 28 Aug 2013 15:46:44 +0200 Subject: [PATCH 151/170] also move empty folders to the trash bin as discussed here #4590 --- apps/files_trashbin/lib/trash.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/apps/files_trashbin/lib/trash.php b/apps/files_trashbin/lib/trash.php index 0dcb2fc82e1..880832f9afa 100644 --- a/apps/files_trashbin/lib/trash.php +++ b/apps/files_trashbin/lib/trash.php @@ -72,11 +72,6 @@ class Trashbin { $mime = $view->getMimeType('files' . $file_path); if ($view->is_dir('files' . $file_path)) { - $dirContent = $view->getDirectoryContent('files' . $file_path); - // no need to move empty folders to the trash bin - if (empty($dirContent)) { - return true; - } $type = 'dir'; } else { $type = 'file'; From 6c7efd5dacaf9144b715ad6db408ce53d0682cbe Mon Sep 17 00:00:00 2001 From: kondou Date: Wed, 28 Aug 2013 22:12:01 +0200 Subject: [PATCH 152/170] Work around #4630 to fix license showing --- settings/js/apps.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/settings/js/apps.js b/settings/js/apps.js index d9817aff6b6..3372d769bd3 100644 --- a/settings/js/apps.js +++ b/settings/js/apps.js @@ -27,7 +27,16 @@ OC.Settings.Apps = OC.Settings.Apps || { } page.find('small.externalapp').attr('style', 'visibility:visible'); page.find('span.author').text(app.author); - page.find('span.licence').text(app.license); + + // FIXME licenses of downloaded apps go into app.licence, licenses of not-downloaded apps into app.license + if (typeof(app.licence) !== 'undefined') { + var applicense = app.licence; + } else if (typeof(app.license) !== 'undefined') { + var applicense = app.license; + } else { + var applicense = ''; + } + page.find('span.licence').text(applicense); if (app.update !== false) { page.find('input.update').show(); From 1d04843ef07abe16132badc4d062a1321a18d211 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Wed, 28 Aug 2013 22:42:43 +0200 Subject: [PATCH 153/170] no duplicate declaration of appLicense + camelCase --- settings/js/apps.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/settings/js/apps.js b/settings/js/apps.js index 3372d769bd3..1ae45932172 100644 --- a/settings/js/apps.js +++ b/settings/js/apps.js @@ -29,14 +29,13 @@ OC.Settings.Apps = OC.Settings.Apps || { page.find('span.author').text(app.author); // FIXME licenses of downloaded apps go into app.licence, licenses of not-downloaded apps into app.license + var appLicense = ''; if (typeof(app.licence) !== 'undefined') { - var applicense = app.licence; + appLicense = app.licence; } else if (typeof(app.license) !== 'undefined') { - var applicense = app.license; - } else { - var applicense = ''; + appLicense = app.license; } - page.find('span.licence').text(applicense); + page.find('span.licence').text(appLicense); if (app.update !== false) { page.find('input.update').show(); From 70b6e2161ec654f7049027bf6dc5072c1eda4d5e Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Thu, 29 Aug 2013 10:08:53 +0200 Subject: [PATCH 154/170] invert logic of disable_previews --- config/config.sample.php | 2 +- lib/preview.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/config/config.sample.php b/config/config.sample.php index 76de97818d5..6dd45163677 100644 --- a/config/config.sample.php +++ b/config/config.sample.php @@ -191,7 +191,7 @@ $CONFIG = array( 'customclient_ios' => '', //https://itunes.apple.com/us/app/owncloud/id543672169?mt=8 // PREVIEW -'disable_previews' => false, +'enable_previews' => true, /* the max width of a generated preview, if value is null, there is no limit */ 'preview_max_x' => null, /* the max height of a generated preview, if value is null, there is no limit */ diff --git a/lib/preview.php b/lib/preview.php index a8a8580e229..164ad10ba5f 100755 --- a/lib/preview.php +++ b/lib/preview.php @@ -569,9 +569,9 @@ class Preview { * @return void */ private static function initProviders() { - if(\OC_Config::getValue('disable_previews', false)) { + if(!\OC_Config::getValue('enable_previews', true)) { $provider = new Preview\Unknown(); - self::$providers = array($provider); + self::$providers = array($provider->getMimeType() => $provider); return; } @@ -606,7 +606,7 @@ class Preview { } public static function isMimeSupported($mimetype) { - if(\OC_Config::getValue('disable_previews', false)) { + if(!\OC_Config::getValue('enable_previews', true)) { return false; } From 301cce54ccdc1dcd1bd63bf4285e870e300979b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Thu, 29 Aug 2013 10:49:50 +0200 Subject: [PATCH 155/170] webdav quota information contains the values for used and free - not total --- lib/connector/sabre/directory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/connector/sabre/directory.php b/lib/connector/sabre/directory.php index 66cd2fcd4e3..3181a4b310f 100644 --- a/lib/connector/sabre/directory.php +++ b/lib/connector/sabre/directory.php @@ -236,7 +236,7 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sa $storageInfo = OC_Helper::getStorageInfo($this->path); return array( $storageInfo['used'], - $storageInfo['total'] + $storageInfo['free'] ); } From 98a04d7c73f2969d6b08f4d925f53fb8e9f34c7e Mon Sep 17 00:00:00 2001 From: Masaki Kawabata Neto Date: Thu, 29 Aug 2013 10:00:30 -0300 Subject: [PATCH 156/170] added help and status commands switch structure enables many commands seamlessy. also added some help and status command. --- console.php | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/console.php b/console.php index 4aec5bdc24f..a2d4ab3562e 100644 --- a/console.php +++ b/console.php @@ -20,17 +20,32 @@ if (!OC::$CLI) { exit(0); } +$self = basename($argv[0]); if ($argc <= 1) { - echo "Usage:" . PHP_EOL; - echo " " . basename($argv[0]) . " " . PHP_EOL; - exit(0); + $argv[1] = "help"; } $command = $argv[1]; array_shift($argv); -if ($command === 'files:scan') { - require_once 'apps/files/console/scan.php'; -} else { - echo "Unknown command '$command'" . PHP_EOL; +switch ($command) { + case 'files:scan': + require_once 'apps/files/console/scan.php'; + break; + case 'status': + require_once 'status.php'; + break; + case 'help': + echo "Usage:" . PHP_EOL; + echo " " . $self . " " . PHP_EOL; + echo PHP_EOL; + echo "Available commands:" . PHP_EOL; + echo " files:scan -> rescan filesystem" .PHP_EOL; + echo " status -> show some status information" .PHP_EOL; + echo " help -> show this help screen" .PHP_EOL; + break; + default: + echo "Unknown command '$command'" . PHP_EOL; + echo "For available commands type ". $self . " help" . PHP_EOL; + break; } From 1dd18980ae171d9cd16ab95bdfb289b54ef6c34d Mon Sep 17 00:00:00 2001 From: Masaki Kawabata Neto Date: Thu, 29 Aug 2013 10:03:58 -0300 Subject: [PATCH 158/170] enable usage with CLI interface Added option to use the status.php with console.php via CLI --- status.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/status.php b/status.php index 179fe3f49f2..88805ad6b19 100644 --- a/status.php +++ b/status.php @@ -33,8 +33,11 @@ try { 'version'=>implode('.', OC_Util::getVersion()), 'versionstring'=>OC_Util::getVersionString(), 'edition'=>OC_Util::getEditionString()); - - echo(json_encode($values)); + if (OC::$CLI) { + print_r($values); + } else { + echo(json_encode($values)); + } } catch (Exception $ex) { OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR); From 1fa29b4c118b848fb3e0e6cdb6aa7bb88cb9d62e Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 29 Aug 2013 15:31:03 +0200 Subject: [PATCH 159/170] also emmit create hook when creating new files using touch() --- lib/files/view.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/files/view.php b/lib/files/view.php index bb737f19ef8..8aee12bf6fe 100644 --- a/lib/files/view.php +++ b/lib/files/view.php @@ -249,6 +249,7 @@ class View { $hooks = array('touch'); if (!$this->file_exists($path)) { + $hooks[] = 'create'; $hooks[] = 'write'; } $result = $this->basicOperation('touch', $path, $hooks, $mtime); From 728fc7f123eeedb79f01dd1f38d469857a8e15cf Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Thu, 29 Aug 2013 16:13:16 +0200 Subject: [PATCH 160/170] fix parameter missing warning --- lib/preview.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/preview.php b/lib/preview.php index 164ad10ba5f..b40ba191fba 100755 --- a/lib/preview.php +++ b/lib/preview.php @@ -570,7 +570,7 @@ class Preview { */ private static function initProviders() { if(!\OC_Config::getValue('enable_previews', true)) { - $provider = new Preview\Unknown(); + $provider = new Preview\Unknown(array()); self::$providers = array($provider->getMimeType() => $provider); return; } From 04b9e77478a36b9ef9ed48a8181ed9195d47ec8a Mon Sep 17 00:00:00 2001 From: Masaki Date: Thu, 29 Aug 2013 15:03:16 -0300 Subject: [PATCH 161/170] replace ident spaces with tabs --- console.php | 41 +++++++++++++++++++++-------------------- status.php | 4 ++-- 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/console.php b/console.php index a2d4ab3562e..fbe09d9bb68 100644 --- a/console.php +++ b/console.php @@ -1,3 +1,4 @@ + @@ -22,30 +23,30 @@ if (!OC::$CLI) { $self = basename($argv[0]); if ($argc <= 1) { - $argv[1] = "help"; + $argv[1] = "help"; } $command = $argv[1]; array_shift($argv); switch ($command) { - case 'files:scan': - require_once 'apps/files/console/scan.php'; - break; - case 'status': - require_once 'status.php'; - break; - case 'help': - echo "Usage:" . PHP_EOL; - echo " " . $self . " " . PHP_EOL; - echo PHP_EOL; - echo "Available commands:" . PHP_EOL; - echo " files:scan -> rescan filesystem" .PHP_EOL; - echo " status -> show some status information" .PHP_EOL; - echo " help -> show this help screen" .PHP_EOL; - break; - default: - echo "Unknown command '$command'" . PHP_EOL; - echo "For available commands type ". $self . " help" . PHP_EOL; - break; + case 'files:scan': + require_once 'apps/files/console/scan.php'; + break; + case 'status': + require_once 'status.php'; + break; + case 'help': + echo "Usage:" . PHP_EOL; + echo " " . $self . " " . PHP_EOL; + echo PHP_EOL; + echo "Available commands:" . PHP_EOL; + echo " files:scan -> rescan filesystem" .PHP_EOL; + echo " status -> show some status information" .PHP_EOL; + echo " help -> show this help screen" .PHP_EOL; + break; + default: + echo "Unknown command '$command'" . PHP_EOL; + echo "For available commands type ". $self . " help" . PHP_EOL; + break; } diff --git a/status.php b/status.php index 88805ad6b19..88422100f14 100644 --- a/status.php +++ b/status.php @@ -34,9 +34,9 @@ try { 'versionstring'=>OC_Util::getVersionString(), 'edition'=>OC_Util::getEditionString()); if (OC::$CLI) { - print_r($values); + print_r($values); } else { - echo(json_encode($values)); + echo(json_encode($values)); } } catch (Exception $ex) { From c9c4ab22a489c373cf994da490353e2f3e1cadd1 Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Fri, 30 Aug 2013 11:17:31 +0200 Subject: [PATCH 162/170] Apps management as sticky footer and rename to 'Apps', fix #4622 --- core/css/styles.css | 18 ++++++++++++++++++ core/templates/layout.user.php | 9 +++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/core/css/styles.css b/core/css/styles.css index ce0d5abfc78..ad9fcb43466 100644 --- a/core/css/styles.css +++ b/core/css/styles.css @@ -501,6 +501,9 @@ label.infield { cursor:text !important; top:1.05em; left:.85em; } #navigation:hover { overflow-y: auto; /* show scrollbar only on hover */ } +#apps { + height: 100%; +} #navigation a span { display: block; text-decoration: none; @@ -545,9 +548,24 @@ label.infield { cursor:text !important; top:1.05em; left:.85em; } padding-top: 20px; } +/* Apps management as sticky footer, less obtrusive in the list */ +#navigation .wrapper { + min-height: 100%; + margin: 0 auto -72px; +} +#apps-management, #navigation .push { + height: 70px; +} #apps-management { + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=60)"; + filter: alpha(opacity=60); opacity: .6; } +#apps-management .icon { + padding-bottom: 0; +} + + /* USER MENU */ diff --git a/core/templates/layout.user.php b/core/templates/layout.user.php index 3c1114492cb..1e0f4a75c3c 100644 --- a/core/templates/layout.user.php +++ b/core/templates/layout.user.php @@ -78,6 +78,7 @@
    From e704c8e4dc41e69b4d4d8e8f3d1c1108920bb29a Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Wed, 14 Aug 2013 11:51:54 +0200 Subject: [PATCH 115/170] use web.svg instead of web.png --- apps/files/templates/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/files/templates/index.php b/apps/files/templates/index.php index 311ada70dfd..89604c4fa0b 100644 --- a/apps/files/templates/index.php +++ b/apps/files/templates/index.php @@ -10,7 +10,7 @@ data-type='file'>

    t('Text file'));?>

  • t('Folder'));?>

  • -
  • t('From link'));?>

  • From f9b281576726774c2109f8f909aceeb7320b4cae Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Wed, 14 Aug 2013 12:21:27 +0200 Subject: [PATCH 116/170] remove \OC\Preview::showErrorPreview --- core/ajax/preview.php | 3 --- core/ajax/publicpreview.php | 6 ------ core/ajax/trashbinpreview.php | 3 --- lib/preview.php | 7 ------- 4 files changed, 19 deletions(-) diff --git a/core/ajax/preview.php b/core/ajax/preview.php index a9d127ffcc4..486155831d7 100644 --- a/core/ajax/preview.php +++ b/core/ajax/preview.php @@ -15,14 +15,12 @@ $scalingUp = array_key_exists('scalingup', $_GET) ? (bool) $_GET['scalingup'] : if($file === '') { \OC_Response::setStatus(400); //400 Bad Request \OC_Log::write('core-preview', 'No file parameter was passed', \OC_Log::DEBUG); - \OC\Preview::showErrorPreview(); 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\Preview::showErrorPreview(); exit; } @@ -37,6 +35,5 @@ try{ }catch(\Exception $e) { \OC_Response::setStatus(500); \OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR); - \OC\Preview::showErrorPreview(); exit; } \ No newline at end of file diff --git a/core/ajax/publicpreview.php b/core/ajax/publicpreview.php index 955fbc2626a..83194d5349c 100644 --- a/core/ajax/publicpreview.php +++ b/core/ajax/publicpreview.php @@ -18,7 +18,6 @@ $token = array_key_exists('t', $_GET) ? (string) $_GET['t'] : ''; if($token === ''){ \OC_Response::setStatus(400); //400 Bad Request \OC_Log::write('core-preview', 'No token parameter was passed', \OC_Log::DEBUG); - \OC\Preview::showErrorPreview(); exit; } @@ -26,14 +25,12 @@ $linkedItem = \OCP\Share::getShareByToken($token); if($linkedItem === false || ($linkedItem['item_type'] !== 'file' && $linkedItem['item_type'] !== 'folder')) { \OC_Response::setStatus(404); \OC_Log::write('core-preview', 'Passed token parameter is not valid', \OC_Log::DEBUG); - \OC\Preview::showErrorPreview(); exit; } if(!isset($linkedItem['uid_owner']) || !isset($linkedItem['file_source'])) { \OC_Response::setStatus(500); \OC_Log::write('core-preview', 'Passed token seems to be valid, but it does not contain all necessary information . ("' . $token . '")', \OC_Log::WARN); - \OC\Preview::showErrorPreview(); exit; } @@ -50,7 +47,6 @@ if($linkedItem['item_type'] === 'folder') { if(!$isvalid) { \OC_Response::setStatus(400); //400 Bad Request \OC_Log::write('core-preview', 'Passed filename is not valid, might be malicious (file:"' . $file . '";ip:"' . $_SERVER['REMOTE_ADDR'] . '")', \OC_Log::WARN); - \OC\Preview::showErrorPreview(); exit; } $sharedFile = \OC\Files\Filesystem::normalizePath($file); @@ -70,7 +66,6 @@ if(substr($path, 0, 1) === '/') { 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\Preview::showErrorPreview(); exit; } @@ -87,6 +82,5 @@ try{ } catch (\Exception $e) { \OC_Response::setStatus(500); \OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR); - \OC\Preview::showErrorPreview(); exit; } \ No newline at end of file diff --git a/core/ajax/trashbinpreview.php b/core/ajax/trashbinpreview.php index d018a57d37b..a916dcf229f 100644 --- a/core/ajax/trashbinpreview.php +++ b/core/ajax/trashbinpreview.php @@ -19,14 +19,12 @@ $scalingUp = array_key_exists('scalingup', $_GET) ? (bool) $_GET['scalingup'] : if($file === '') { \OC_Response::setStatus(400); //400 Bad Request \OC_Log::write('core-preview', 'No file parameter was passed', \OC_Log::DEBUG); - \OC\Preview::showErrorPreview(); 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\Preview::showErrorPreview(); exit; } @@ -41,6 +39,5 @@ try{ }catch(\Exception $e) { \OC_Response::setStatus(500); \OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR); - \OC\Preview::showErrorPreview(); exit; } \ No newline at end of file diff --git a/lib/preview.php b/lib/preview.php index 9f4d20b4650..92cc87c5897 100755 --- a/lib/preview.php +++ b/lib/preview.php @@ -611,11 +611,4 @@ class Preview { } return false; } - - private static function showErrorPreview() { - $path = \OC::$SERVERROOT . '/core/img/actions/delete.png'; - $preview = new \OC_Image($path); - $preview->preciseResize(36, 36); - $preview->show(); - } } \ No newline at end of file From 20855add94701432da093e2ae74477a76ddc7f48 Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Wed, 14 Aug 2013 12:33:41 +0200 Subject: [PATCH 117/170] add more file type icons, replace old ones --- core/img/filetypes/application-epub+zip.png | Bin 0 -> 1371 bytes core/img/filetypes/application-epub+zip.svg | 761 ++++++++++++++++++++ core/img/filetypes/calendar.png | Bin 0 -> 1333 bytes core/img/filetypes/calendar.svg | 94 +++ core/img/filetypes/database.png | Bin 390 -> 1372 bytes core/img/filetypes/database.svg | 54 ++ core/img/filetypes/folder-drag-accept.png | Bin 0 -> 757 bytes core/img/filetypes/folder-drag-accept.svg | 335 +++++++++ core/img/filetypes/link.png | Bin 923 -> 850 bytes core/img/filetypes/link.svg | 12 + core/img/filetypes/text-calendar.png | Bin 675 -> 0 bytes core/img/filetypes/text-vcard.png | Bin 533 -> 782 bytes core/img/filetypes/text-vcard.svg | 60 ++ core/img/filetypes/video.png | Bin 653 -> 1809 bytes core/img/filetypes/video.svg | 71 ++ 15 files changed, 1387 insertions(+) create mode 100644 core/img/filetypes/application-epub+zip.png create mode 100644 core/img/filetypes/application-epub+zip.svg create mode 100644 core/img/filetypes/calendar.png create mode 100644 core/img/filetypes/calendar.svg create mode 100644 core/img/filetypes/database.svg create mode 100644 core/img/filetypes/folder-drag-accept.png create mode 100644 core/img/filetypes/folder-drag-accept.svg create mode 100644 core/img/filetypes/link.svg delete mode 100644 core/img/filetypes/text-calendar.png create mode 100644 core/img/filetypes/text-vcard.svg create mode 100644 core/img/filetypes/video.svg diff --git a/core/img/filetypes/application-epub+zip.png b/core/img/filetypes/application-epub+zip.png new file mode 100644 index 0000000000000000000000000000000000000000..b3e3b28b4d51b91305d967d445879de4cf25fcbe GIT binary patch literal 1371 zcmV-h1*H0kP)PkR2z4dmP8Z^$N@%IHD=9TqX`!H0M0c**kTkWr82b^E&Sc)q zJIBR)^XAP*$)pu8yt((y+;h+W{LlZLcSg*Nz>WHK3i-)H-#$8Zir9OA%< z0|Dm*K|lZl!%#IaP*Y67OwnjAmh${I_05(g0hk%Hv$Nc~b&Fgs$F`UIaL(bJ#IrcT zi9-Ys0W&Oi90F0*#H^%U7eP>$uf_n9>&g}0tAYbm6hsg#%zCs>)oScQRxr@gG62*b zVg{;;a}HGyu`v3IVFIK!us4FBR-pF*psLj%)KI_)D2j;0(Z_ZP7EBF|X0vE*w!9Qn zId_U^C_ceL07xwXK-q@Ksm3783~d%b@=`SfaH6P$$`>m1cV#wWz}(_Y$N*GFUS6Zk zGmvCK&2S1TVdP>F{bKY!vYnycaR7e(^K)*_{ZdIo{A3uWiix4kYM|=UC~^rYFN<$| z=P*OP`zZxJ07Jdwn8F`-uf$?ZvZ!tu8mKnb$hpMgdt%ko46WNwv9!q9%O4;JFO42& z+q!X7;l`bx8k`d}1mKniU{wWWL+1{*Z5YQd<@x&3dn|g_d3?b79Q#; zK!mmqkA?YZCcb@}SND9x$iTs<1`8tt2k?tICMJ)PcQdqiq!Vn0%r5IGC>yI9L6izr zrLEl~C)0d&{s@KQJw`SiWMtC;3dMVTdHx7FrfFO0p+U%6QbUajQ9}Sh5Y*_v;s{ig z74055xz34mhgtL&So9Y-aqcjAxz37}Uc9etS5Dyrr67n!7*ZX+2Vg~eiroASJ~{ac z0PU-aw6(XOfyP~9xguhq?g0VB8i2|i-jHce;Zh|4(itz|y!x$*5v5=m0FoLgzx~S5 zm$?A&TEaPW9=W$fe?XEtO9BlVzYUkvK=~cm d4#59C{srer&cwx7=JWsn002ovPDHLkV1n~YhkO74 literal 0 HcmV?d00001 diff --git a/core/img/filetypes/application-epub+zip.svg b/core/img/filetypes/application-epub+zip.svg new file mode 100644 index 00000000000..041f9f15e68 --- /dev/null +++ b/core/img/filetypes/application-epub+zip.svg @@ -0,0 +1,761 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/img/filetypes/calendar.png b/core/img/filetypes/calendar.png new file mode 100644 index 0000000000000000000000000000000000000000..d85b1db651c258b22d7707dbdf57a19bc92f832a GIT binary patch literal 1333 zcmV-51 z=jUBMpI_O^_E~(qdNH@&O{b(3p9{ywKms7~<#%*;cCxUrkeqw(z_#+Wfsb+UjW7LA zU(f&gFtmLl1>!4#>_-p_M@pp|t?nk&j;T5K1AGL@EhVR2{9u8jCX)XAD0))RE7Js)92HTMk$* z{A`zI3c-Q#n~9LKAqB2d*(YOhma;z~q(J%}tH%Z?7K^kb;;h~%AU%cfsv?A}2GH3W zxi(mBSbgJI)h8ZjsW5`AXq(iK( zGBzR?AZl|thqEpcaqzD@JUDcOw(GxOD*;YhtZ~SSMr-3EgrFAsrv=nj;haP|N5}nt zX!-gJb{~EVQ(l7_xsVdVwYXXotOH}|)K#C>HxFY2gEdugXoGfwsiQ}|qY$hkKw!1S z1O{mx&Il4MEwr9GP4MSDda(!sgs85*E&$aiI0p_AZ5`}7b(+eZ-zhH`T&+gX7VRXf zyNZf+1voGjjp}@@S_4vG%9^#=TUEmL&WOCBk{?$z&N)oEf|B909OguPTM z(cRsR5Q3SR8Pe%Ai9~`zp+Hwx7fPvZVSvfW$%uGM0pTqL5R1j4hQh1(+ zbB$p-?D9;kU2;Ed^l?LmWOUrI59YXe%sghgMT52!AhL zycqqL%jF_GJUrYKR!TLW0)T;m0RYCv#^~wkAs&x2GBQG6UmsFRhKGk492|@Y*TY(C za=Bb{DF}^%AONc2(^^O24T2!5@E{1HA~VKB_93nxYibu5W1_HYt+{&jYBb@MD_5dP zbGcmPbNTY+XgtI~BzD^=FvcK+Ad|^NDd_F(#rJ(iMn=eFGC1eBbm>w9K5^ni0}i7# zF)`8nE~tBHdFn6;R}$K6gzE{LPJs}jp^`^OMO^O6VubveLX!rzVG|bRlxG{GE-Ai72x~&@#wo?@7}$w`}glZ z*xTFtSu&X%YO00000NkvXXu0mjfE4gM( literal 0 HcmV?d00001 diff --git a/core/img/filetypes/calendar.svg b/core/img/filetypes/calendar.svg new file mode 100644 index 00000000000..0016749b936 --- /dev/null +++ b/core/img/filetypes/calendar.svg @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/img/filetypes/database.png b/core/img/filetypes/database.png index 3d09261a26eb97c6dedc1d3504cbc2cf915eb642..24788b2a37f04a4d44d09fabc5ef8c062015fa42 100644 GIT binary patch literal 1372 zcmV-i1*7_jP)* z*4hRDBJzl+4d4}kYLX&s(Nx zf^$9y04Svf3BwSM<8<5YHYG{Y)>{80rCh##{kn5vfP44ueW|tnHkZqr1@?t=4#pUylxVeDf$KUU5q-6^wDiNV0Qc|T|Ace?OFnZAi(c-aaIqhNJ^My23qTxA-IDbjYeHux^xMiw+E%vnE-IkVUK1}Z8V0o9|G_^ z51o#KbNL*CFofs%kW!v%V#6?C+gXg5CORDlp63mX83G_8>U13Veiy~!B&MfIAOd{9 z3vX`^v5cXVLY!*Xze15}DGUL7bQIaF1+9T73ejlnKuQTBqGJKVFl@%LoZ_6r_q$+> z!?G-xW&$C4!x`(T*8d#GJ*d7dz3&WkyIuHx7fF&JjwQk{Y#s|RJ3EW#&!3}Inno^X z5BjB)a9tOk=fQQo^ymTra=9FA+eR*Dr^g&j(;S=|1Ob}OI?kUzKePviItqotIAa`Z zYY$PWJc8rA@d0+C<~R;2l}A`xdkDrj3WdV>u`5uk)x^TWHAIm_wOYmF$B#ion3QHQ3Tg@5d=Q!^*VNUcd)g!1+6u**-^~S&S7EU8lFCV%C20wax_4v z(?P4%#?sOvwzs$OcE!f!Dcy|`OdewS63%cC^ zg~H^SSn%@YHi95HnFYS@Z(ZlzKQeBXx<0z!yE zvB?<2>#IpbgZ}I1h{t1YjrtlS>DN5>=k@jVZ`Rk>cK}GO zwLB6ah2Q`(=`Av@UcGv;P$+z8+xADC^Y^sY<4Ka_lO!1h0LIuJW6U93QCMgI5V5A^C4NF6506?cn(x^0XdesRIX-5Ja0z}6E e=%Xe)*!}^IMmcxN+me(30000;1k*-!zk~CMF9Bv_3(^PCOq; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/core/img/filetypes/folder-drag-accept.png b/core/img/filetypes/folder-drag-accept.png new file mode 100644 index 0000000000000000000000000000000000000000..19c2d2eebd41e50454157f035df9c69dbcfc5717 GIT binary patch literal 757 zcmVPK2!hzQ_TEskU%234PbZxM067Xm>F4?9U0^} zPA}%x3G=$lyix!FP&LN9&GY=&=seG1j2XzO|4B-Dr~mx-j|Z8I*4mTi1`!q32X{g7 z&1lunRdB!%P7kMX&K7%_n6s8X6A** zFLvW3LuN7ZSwH|Hn<0sl9bo?~NVIOKNCVFJ$Y+5dLXv1`t($#-$Za*0QW%?dVD@Lh zu^1=(Kng+}D5y^B4?y$#ax(~gaCH*@%!1RC6y#I{l=9J7UvBgPI`s`VRY5pgt4-!y zIV8_;N+Sr^Q-Sgtt6m=ffcyE)%hzk4mM-Gho6*r*m6?u=Ct^-Q)dAoG0QK&GMC1UN n0dR-~Lz4yIGjmn|I4k`IiV;{$#ooxz00000NkvXXu0mjfIR`?8 literal 0 HcmV?d00001 diff --git a/core/img/filetypes/folder-drag-accept.svg b/core/img/filetypes/folder-drag-accept.svg new file mode 100644 index 00000000000..a7885c80be7 --- /dev/null +++ b/core/img/filetypes/folder-drag-accept.svg @@ -0,0 +1,335 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + diff --git a/core/img/filetypes/link.png b/core/img/filetypes/link.png index 68f21d30116710e48a8bf462cb32441e51fad5f6..0e021d89f82366fecbb4896e852b958053125a16 100644 GIT binary patch literal 850 zcmV-Y1FigtP)v1 zer!LTi9pAG#pjrh?{FhxjPxWRl6OY=245t7n{gKhu^~q3Rw807@$JKp5i2XAD(sIE zz@IZd0hh5n*1t~tSCxF{;rEC+YdUfQS_#-SEK2$oVk@@cZ)}h4!#EMY`2&kfn5*y@ zty%$bwRgz>!HQD<9{hwa@fufSB#KfNoXHGqXY8A(6EKy4tjmD(;iLF|v}Q3*R;;bl zn92&kPzur|J=fuOjex@y-+deVhdOQPRy?jj2_cNfd0t)P_OPOTbQV{l?n+$*v{(Lq z?X;{KdB^TzX$E79b~aqeO~K6)NI$;9ZY;sM2E?h2S4=|-H**4>lmHgsqU!y>&Yojo zg@E7iB)102#M3vmmE)Nk9}VKjuWK7{Z?2;qDP;REczXEV5}HlmV! zpZIMu^So$k!?>=r5!G$QsjV#e_2U4Z_8{Pw_{?v`nZqcxjTI@iRQq1=e-A>c52MU+ z+_AG=&W6nm$?K2f2sUWug`{IUYXt0VK;G;^5&=idzIZ;yvW)K<-FM37SF)0bawHBV z{R7w+g>@Twmb_L#G9Brfc#gx`7tQ-k<~$en#sW&&QI(=OYy4vpB0;0_K7P%567W9C coc|ra1xC@JLcf37!~g&Q07*qoM6N<$f<=LeVgLXD literal 923 zcmV;M17!S(P)A9)b<7tX~vT z$e)FfZ+`X4_uKyq#wJHC;J3lH{lhQkUc~Wid;*pnjhM12xe-bPByd^xuQ9zgeM^Mm z*tc)|P}LtTnHXr@Gkmmbkg^O2bqyhO>LP|qjIwW2@Di+4EuKm~&tOO2!N3o{128Hl z9v%fgerM0C#)7P|PMvxr*!Gf?eGA8f{OT6fS`9l>LQCg)p=~c$Zr|AT_0+_?F*JJk zlapOT2Q(wWx-LMq(TxXxLn+U;!LV)MhNp~ommdh+fo8T*&g-yQbbG&ze&=>tC(Ar=&^1xlA;Jc(6 zcCi_xs8k}-S&#ONOHm%e@#nGC7F++8C~r29Or!_{(QGQEG)+O^J1BCPmgM4JAzC8I z`jS9bO>|}Jq_#$IRzp0d34>)&3L%7MN)eTv!0B!^nn}f4z2*vFE@jv3dn zG>H)u>FR7_d2JcsjvfZ$vkP~xik@T^(_N)nx=tqJV+tQjQ`owJ83bf`zX6Ear*=Mhzn5QUuXE|v zR33Qyi8G!0{H2r##d#6R6YmYbZz4NTssT;cXiGb6lxO+k@{ba@2D~*hKDY6N;Bkh> xhhCRLejsJkAIT{5sICHcfU`5>bKmUb{{y)0nR3PMMxX!y002ovPDHLkV1nl+t-}BS diff --git a/core/img/filetypes/link.svg b/core/img/filetypes/link.svg new file mode 100644 index 00000000000..b25013414ba --- /dev/null +++ b/core/img/filetypes/link.svg @@ -0,0 +1,12 @@ + + + + + image/svg+xml + + + + + + + diff --git a/core/img/filetypes/text-calendar.png b/core/img/filetypes/text-calendar.png deleted file mode 100644 index 658913852d60fc6ca8557568d26b8e93e7d56525..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 675 zcmV;U0$lxxP)w!? zFisFv!T|cmRtW;1f$>$s0G>^*GP-h`H-mzTP&3`b(d;hDCL-{+T2LSiJi1S%34OTG znWn~v^Brk?FQB#MFuosf?qnt!t(A%g#tAAA`tV{p&t%~)6GMus628BV?|aP6=Lr0O zrxPn=6Fy3{fE84gngF`mQ;ZG4p#ul`mYb)mJw@Q%q_eddamvg>kv)yI#B0M!3sxev z!1s9dp#Z>KE{BK5@W%p1Kt!2cEYj2vBiUHDJ-HCTS{r%b!`Wj=!r&Tb+LFBfRN!=5 zl7aC&Ul)Foh{s4J>JU)^p9+C-Q44MR8(8|WK})8dx#e}T%`v`wFOp3_q9I1QsXihN zJVaEgK9Y|1KAJgEb`m$%VXVVh!8pM>`_Eli`}OBJfVb0i{tF{QT8%v&>u>-7002ov JPDHLkV1feuD8K*! diff --git a/core/img/filetypes/text-vcard.png b/core/img/filetypes/text-vcard.png index c02f315d20749098a50e79bd9525eed3cda7be6b..2e52d1ecb3a51b897b64d06b8db16e89c398b9e6 100644 GIT binary patch literal 782 zcmV+p1M&QcP)qY}R-bwLrQFm6eFB|ZHER1vRe0%5a zogpbD=9SCk@`s0qr}zPNI-S4OYW2_jn7%ye;Nal2SS4=|g& z3gG4C1@(Fz4-XGuW+V~`q|<2}9UZL%P$_V?>G%66l}a!S1KDgA*=!cNuA^Ko}RXti1}O%wfoACHfZAR?HiiT(Y3Twh-!l}agnq4j~mV1V&>jLBr;cFS(Ji|y@g zyuQBr`T`Z|u!rcfxL(P$|DUkl)uvc0`MJUu<3*Xt<*&C4`RkN?~E zfl8&acHw!AMk7y5mA+g9mSqJ3Se9Q6gnRk_4{hF+Y$E`4T}LDm2^B!K{~iD$(lVLM z{pIClLpl4KdVYSsCn8Ns>C(`AYUp2g`Lzrdq67d-&Mit|?{!dp0=w2pNBI@jk^lez M07*qoM6N<$f|W>DiU0rr literal 533 zcmV+w0_y#VP)~%#^24dF_nR2<@_W67)1?cUEu^twUb)isDIFhhds}=iK3R>bPJ|0e?$zQO{gfSb6 zAmw}l&+|y1)FDbOh~LB|8AsbZWx#U1r$+A&&@Nx#xl}^&O@y|4t-qIL8GGyFgudOB zMUBefj6^S-TgKXw9~(9fXO}l9u&h~_&1U!^@!0B?~s|2G5wL<6_)Q&2rqn4Ysi zYDkz=-^k9mUKoqT&@0!tb`xM{bJg4sMG?(rlN1C@+IG7gZnyh)fD-9^wOWPO>qRga zgu~$&m^wiaP%IV^2m}y`M05a#41+*G!W1YTk2ASkP8&9ThNn^~CX>l%T{(BmzyFOt XHe4|Dt4X diff --git a/core/img/filetypes/text-vcard.svg b/core/img/filetypes/text-vcard.svg new file mode 100644 index 00000000000..27054be57e6 --- /dev/null +++ b/core/img/filetypes/text-vcard.svg @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/core/img/filetypes/video.png b/core/img/filetypes/video.png index b0ce7bb198a3b268bd634d2b26e9b710f3797d37..13bf229fc45a63ba5866d77024bda31414aabbaf 100644 GIT binary patch literal 1809 zcmV+s2k!WZP)Enn)?}C53)b^#2D3Q~)@3?ATui2M7Nd zi^T*05JEze{#W0Z?sV?dmr}yAEV8t;^tXkDg=w{I@W*&Oo^)OJBLF6)Oi)T=ZKWCj zP)d`EqCiS%d!F}+5TZq+(LVry<2WCsluT9C1R*5mc^-riwYKdf0C3K2A;d=^gcgg% zb`e5;1Tal~&p78uBofnCuU^eMj(Lx*tq@L|l%%wTzW8A6Bv+;2h%aLy5p zMgvT>6QC2g+lj%!K@1NMZ~&!<{>K@ZrM;jEsz6X=w>tTU*<}g%F{| z2HUVR4V@8@QsUI9Q>fKyn46n}>$-4V7mA{QF&6aw_Ta$-R4NsmK7BeEa~vn&LpK)f z2JP$%A>g_$_V3@1=g*&q054s-gyG>~sHzIvwgVu>7#=-(gmgL$$8q4gZm{Z|a6%;X zKllnl2<+Om3(;s4<#IV>Oi>gZKYkoXj~>O-r%!SJ{(ZDsEeIh{DwUvV8j{H*Ha0dw zwtWYDOxiuz8BWJ>(9_ccDJ5#PS}^X{i*{wii4!Mq?%X-3stV8ZP^;Ad0K0eZ-j>d8 z!UrVu+3AzYZ|m#pkWwO%NMLhw6P)vaPykRU6maj}J>>KGAgp`$?gfBAw>tuz&!7hFI-2&gPGekB_6#Xkd1B_BZptBME=4IgW#=sVVgJ_2J5uE9mR% zgJoG@jG=x0hrUfsO$F)v-6ZVJjW1G45JFHYl`t_efwO1N;_~Iouq+EJD=Pqi{{DXG zx{if~1>CxI3(aOT6!x7su#JSj=0K->{`?s?Z{Ebr%nS}3IDr2CegMGS+#HIi`go#l9wlfOBpZi^a|N@89duXfz1`j^ork z&$A+t$XBYW8d6Hww!IDjnx=i-wr_IIHv#Cnt|xumfQ0Qja3i13rx;_az7fv(x195D zEz4S$Qi3tIn$PD`j^o_uC|Dsq%d!GJ+qOe`uIt|L52e6?4pzRCQVJ<$y*=g?3Wc>o zp|B=|@Y+nTODTmA;#~)$1HEGT>K7C+d;O_vS zD2m=T^i4XQK0^rkz9Ze^>2#V>N`JRraO@8Z3}`}#f2UHZOy{-BvMd;e@!wEU3fs1! z>pD2+P!t9J?bbg7R8@s#S%}4AAwAPHq3e3+&?}Wn&nTrsDgfBF{Zp}6{D+j%*v|c( zh0^d}UH7%_w}cR4GRA%~4C9wu@t2e@{&V^>7(MR{X|}OU00000NkvXXu0mjfEu&Q_ literal 653 zcmV;80&@L{P)WO3(`_cf+b25@DJ#zdQm}8GzWtq2-QnZ8W6mB^kfeK5f%S{ zUW%tGMCwrwic~ZrQcG=4f?5bkV+3dRk8hw6bk~y$KX#b!y*J4EJ~>;dRASqrSu;ZpM>?P}K~6AT zWv6Dmq?v&9LdXC(m%WCO6ma_di$R(v$@ad_>@R41N3N5lSJq9@6CGhX84-$%Xrd_6 z;){?{E|Ytt5$S-&Au>t4wDlIxdkfe-a22LMj``McG};r8@{GsRPm*+8fFey6C)@ifDBXVyTw(N@Xd41b45OFg6x_QA zpwLiigyy~cVoPxW^r~C7ZQpr%>1$*HKmv~AY-qJw4;gUecS--wnqslISSS=^KA&Ic n@BK|Onfz#3R%n{$a)0j^sqv5F(1NTL00000NkvXXu0mjf3S}fX diff --git a/core/img/filetypes/video.svg b/core/img/filetypes/video.svg new file mode 100644 index 00000000000..b499d1cd252 --- /dev/null +++ b/core/img/filetypes/video.svg @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + From 5abf6ddea4b3e1246a1c66e876e420841322865f Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Wed, 14 Aug 2013 12:36:31 +0200 Subject: [PATCH 118/170] replace same but differently named package graphics with one proper one --- .../filetypes/application-x-7z-compressed.png | Bin 650 -> 0 bytes .../application-x-bzip-compressed-tar.png | Bin 650 -> 0 bytes core/img/filetypes/application-x-bzip.png | Bin 650 -> 0 bytes .../application-x-compressed-tar.png | Bin 650 -> 0 bytes core/img/filetypes/application-x-deb.png | Bin 650 -> 0 bytes .../application-x-debian-package.png | Bin 539 -> 0 bytes core/img/filetypes/application-x-gzip.png | Bin 650 -> 0 bytes .../application-x-lzma-compressed-tar.png | Bin 650 -> 0 bytes core/img/filetypes/application-x-rar.png | Bin 650 -> 0 bytes core/img/filetypes/application-x-rpm.png | Bin 650 -> 0 bytes core/img/filetypes/application-x-tar.png | Bin 650 -> 0 bytes core/img/filetypes/application-x-tarz.png | Bin 650 -> 0 bytes core/img/filetypes/application-zip.png | Bin 650 -> 0 bytes core/img/filetypes/package-x-generic.png | Bin 0 -> 794 bytes core/img/filetypes/package-x-generic.svg | 62 ++++++++++++++++++ core/img/filetypes/x-.png | Bin 555 -> 0 bytes 16 files changed, 62 insertions(+) delete mode 100644 core/img/filetypes/application-x-7z-compressed.png delete mode 100644 core/img/filetypes/application-x-bzip-compressed-tar.png delete mode 100644 core/img/filetypes/application-x-bzip.png delete mode 100644 core/img/filetypes/application-x-compressed-tar.png delete mode 100644 core/img/filetypes/application-x-deb.png delete mode 100644 core/img/filetypes/application-x-debian-package.png delete mode 100644 core/img/filetypes/application-x-gzip.png delete mode 100644 core/img/filetypes/application-x-lzma-compressed-tar.png delete mode 100644 core/img/filetypes/application-x-rar.png delete mode 100644 core/img/filetypes/application-x-rpm.png delete mode 100644 core/img/filetypes/application-x-tar.png delete mode 100644 core/img/filetypes/application-x-tarz.png delete mode 100644 core/img/filetypes/application-zip.png create mode 100644 core/img/filetypes/package-x-generic.png create mode 100644 core/img/filetypes/package-x-generic.svg delete mode 100644 core/img/filetypes/x-.png diff --git a/core/img/filetypes/application-x-7z-compressed.png b/core/img/filetypes/application-x-7z-compressed.png deleted file mode 100644 index 2cd08aebf954b1fbd87e53856815e091d7b29d16..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 650 zcmV;50(Jd~P)o`*ydp1@?@ZsHlN&VCM238tNOk z1QY5L2%4$Sp*Ub*AccTt{fDFtybNg1E#o)FJXdrr^;GCd7{{KH!!QJ_vs=ham zZe6(N?pOcjQV86?e0$>>KyY^+-aLOUgz#kT$dOUgjHm}gs;Xjf^)!yN`{^yEWJ=D= z+LrC@&#k*(x^idZc{OBXl+v_m8q5q+MO7)KU?d0?DuS8Lk1-q$Nij}=8&wFbi%9)xYwI_!XW|rq zH!olODT+x5tXDvN?D#20lNH931%{(V2IDb<;e@55X8|~NbdB8YlMfE)+FcIz_h|Qb z__+D5u2dZ}qs;c0A*jrdt|8Y028VhDU%z}nN+#zSrE4j(7BfTDsni@-K?uZD5kdsO zOi{@I#R53) zMp7lEM2Ni_H$$~oR7$3FGt9y-0L>tVyJM=vs`P-6=4o`*ydp1@?@ZsHlN&VCM238tNOk z1QY5L2%4$Sp*Ub*AccTt{fDFtybNg1E#o)FJXdrr^;GCd7{{KH!!QJ_vs=ham zZe6(N?pOcjQV86?e0$>>KyY^+-aLOUgz#kT$dOUgjHm}gs;Xjf^)!yN`{^yEWJ=D= z+LrC@&#k*(x^idZc{OBXl+v_m8q5q+MO7)KU?d0?DuS8Lk1-q$Nij}=8&wFbi%9)xYwI_!XW|rq zH!olODT+x5tXDvN?D#20lNH931%{(V2IDb<;e@55X8|~NbdB8YlMfE)+FcIz_h|Qb z__+D5u2dZ}qs;c0A*jrdt|8Y028VhDU%z}nN+#zSrE4j(7BfTDsni@-K?uZD5kdsO zOi{@I#R53) zMp7lEM2Ni_H$$~oR7$3FGt9y-0L>tVyJM=vs`P-6=4o`*ydp1@?@ZsHlN&VCM238tNOk z1QY5L2%4$Sp*Ub*AccTt{fDFtybNg1E#o)FJXdrr^;GCd7{{KH!!QJ_vs=ham zZe6(N?pOcjQV86?e0$>>KyY^+-aLOUgz#kT$dOUgjHm}gs;Xjf^)!yN`{^yEWJ=D= z+LrC@&#k*(x^idZc{OBXl+v_m8q5q+MO7)KU?d0?DuS8Lk1-q$Nij}=8&wFbi%9)xYwI_!XW|rq zH!olODT+x5tXDvN?D#20lNH931%{(V2IDb<;e@55X8|~NbdB8YlMfE)+FcIz_h|Qb z__+D5u2dZ}qs;c0A*jrdt|8Y028VhDU%z}nN+#zSrE4j(7BfTDsni@-K?uZD5kdsO zOi{@I#R53) zMp7lEM2Ni_H$$~oR7$3FGt9y-0L>tVyJM=vs`P-6=4o`*ydp1@?@ZsHlN&VCM238tNOk z1QY5L2%4$Sp*Ub*AccTt{fDFtybNg1E#o)FJXdrr^;GCd7{{KH!!QJ_vs=ham zZe6(N?pOcjQV86?e0$>>KyY^+-aLOUgz#kT$dOUgjHm}gs;Xjf^)!yN`{^yEWJ=D= z+LrC@&#k*(x^idZc{OBXl+v_m8q5q+MO7)KU?d0?DuS8Lk1-q$Nij}=8&wFbi%9)xYwI_!XW|rq zH!olODT+x5tXDvN?D#20lNH931%{(V2IDb<;e@55X8|~NbdB8YlMfE)+FcIz_h|Qb z__+D5u2dZ}qs;c0A*jrdt|8Y028VhDU%z}nN+#zSrE4j(7BfTDsni@-K?uZD5kdsO zOi{@I#R53) zMp7lEM2Ni_H$$~oR7$3FGt9y-0L>tVyJM=vs`P-6=4o`*ydp1@?@ZsHlN&VCM238tNOk z1QY5L2%4$Sp*Ub*AccTt{fDFtybNg1E#o)FJXdrr^;GCd7{{KH!!QJ_vs=ham zZe6(N?pOcjQV86?e0$>>KyY^+-aLOUgz#kT$dOUgjHm}gs;Xjf^)!yN`{^yEWJ=D= z+LrC@&#k*(x^idZc{OBXl+v_m8q5q+MO7)KU?d0?DuS8Lk1-q$Nij}=8&wFbi%9)xYwI_!XW|rq zH!olODT+x5tXDvN?D#20lNH931%{(V2IDb<;e@55X8|~NbdB8YlMfE)+FcIz_h|Qb z__+D5u2dZ}qs;c0A*jrdt|8Y028VhDU%z}nN+#zSrE4j(7BfTDsni@-K?uZD5kdsO zOi{@I#R53) zMp7lEM2Ni_H$$~oR7$3FGt9y-0L>tVyJM=vs`P-6=4swT@MmX-bxDQkZK@nQTs)aaNpePoH&IpmkZShf=L}QLc7T zvW;1?j#;*nUbmB9xRhbKmSVb>W4oASy^dqOmS4S^XTFM}YQT$Vz@BWu zjA+4(X~CXr!i;Icl4!!6XTqRu!<1^om2AYGXvCp!#g=Twp=`#aa>u52$fkA4r+3Pw zaLT81&8cPyhe`sYygZR2UhB z!CgwjKp2M6=lhwYwuOSw3zwk#UyExH1*=p@GLxCtE3Z9=e;H81%#hR@B-rE2TqbJU zUf)H)`T00!aXF`3C73Rm5Zdbcz1JRGt`Em)N<-SSE{PQ85^@WPM146}26b;s7s(j) z>pVBc_EX0oQMYw3&S?ASBJoo>gauuFZJ#7Ld)HeHe;VmYy4^4~mp%~Y$=wX-u!8Ow dZpI&J`~qx(SpY!aSHS=P002ovPDHLkV1i1#`r7~i diff --git a/core/img/filetypes/application-x-gzip.png b/core/img/filetypes/application-x-gzip.png deleted file mode 100644 index 2cd08aebf954b1fbd87e53856815e091d7b29d16..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 650 zcmV;50(Jd~P)o`*ydp1@?@ZsHlN&VCM238tNOk z1QY5L2%4$Sp*Ub*AccTt{fDFtybNg1E#o)FJXdrr^;GCd7{{KH!!QJ_vs=ham zZe6(N?pOcjQV86?e0$>>KyY^+-aLOUgz#kT$dOUgjHm}gs;Xjf^)!yN`{^yEWJ=D= z+LrC@&#k*(x^idZc{OBXl+v_m8q5q+MO7)KU?d0?DuS8Lk1-q$Nij}=8&wFbi%9)xYwI_!XW|rq zH!olODT+x5tXDvN?D#20lNH931%{(V2IDb<;e@55X8|~NbdB8YlMfE)+FcIz_h|Qb z__+D5u2dZ}qs;c0A*jrdt|8Y028VhDU%z}nN+#zSrE4j(7BfTDsni@-K?uZD5kdsO zOi{@I#R53) zMp7lEM2Ni_H$$~oR7$3FGt9y-0L>tVyJM=vs`P-6=4o`*ydp1@?@ZsHlN&VCM238tNOk z1QY5L2%4$Sp*Ub*AccTt{fDFtybNg1E#o)FJXdrr^;GCd7{{KH!!QJ_vs=ham zZe6(N?pOcjQV86?e0$>>KyY^+-aLOUgz#kT$dOUgjHm}gs;Xjf^)!yN`{^yEWJ=D= z+LrC@&#k*(x^idZc{OBXl+v_m8q5q+MO7)KU?d0?DuS8Lk1-q$Nij}=8&wFbi%9)xYwI_!XW|rq zH!olODT+x5tXDvN?D#20lNH931%{(V2IDb<;e@55X8|~NbdB8YlMfE)+FcIz_h|Qb z__+D5u2dZ}qs;c0A*jrdt|8Y028VhDU%z}nN+#zSrE4j(7BfTDsni@-K?uZD5kdsO zOi{@I#R53) zMp7lEM2Ni_H$$~oR7$3FGt9y-0L>tVyJM=vs`P-6=4o`*ydp1@?@ZsHlN&VCM238tNOk z1QY5L2%4$Sp*Ub*AccTt{fDFtybNg1E#o)FJXdrr^;GCd7{{KH!!QJ_vs=ham zZe6(N?pOcjQV86?e0$>>KyY^+-aLOUgz#kT$dOUgjHm}gs;Xjf^)!yN`{^yEWJ=D= z+LrC@&#k*(x^idZc{OBXl+v_m8q5q+MO7)KU?d0?DuS8Lk1-q$Nij}=8&wFbi%9)xYwI_!XW|rq zH!olODT+x5tXDvN?D#20lNH931%{(V2IDb<;e@55X8|~NbdB8YlMfE)+FcIz_h|Qb z__+D5u2dZ}qs;c0A*jrdt|8Y028VhDU%z}nN+#zSrE4j(7BfTDsni@-K?uZD5kdsO zOi{@I#R53) zMp7lEM2Ni_H$$~oR7$3FGt9y-0L>tVyJM=vs`P-6=4o`*ydp1@?@ZsHlN&VCM238tNOk z1QY5L2%4$Sp*Ub*AccTt{fDFtybNg1E#o)FJXdrr^;GCd7{{KH!!QJ_vs=ham zZe6(N?pOcjQV86?e0$>>KyY^+-aLOUgz#kT$dOUgjHm}gs;Xjf^)!yN`{^yEWJ=D= z+LrC@&#k*(x^idZc{OBXl+v_m8q5q+MO7)KU?d0?DuS8Lk1-q$Nij}=8&wFbi%9)xYwI_!XW|rq zH!olODT+x5tXDvN?D#20lNH931%{(V2IDb<;e@55X8|~NbdB8YlMfE)+FcIz_h|Qb z__+D5u2dZ}qs;c0A*jrdt|8Y028VhDU%z}nN+#zSrE4j(7BfTDsni@-K?uZD5kdsO zOi{@I#R53) zMp7lEM2Ni_H$$~oR7$3FGt9y-0L>tVyJM=vs`P-6=4o`*ydp1@?@ZsHlN&VCM238tNOk z1QY5L2%4$Sp*Ub*AccTt{fDFtybNg1E#o)FJXdrr^;GCd7{{KH!!QJ_vs=ham zZe6(N?pOcjQV86?e0$>>KyY^+-aLOUgz#kT$dOUgjHm}gs;Xjf^)!yN`{^yEWJ=D= z+LrC@&#k*(x^idZc{OBXl+v_m8q5q+MO7)KU?d0?DuS8Lk1-q$Nij}=8&wFbi%9)xYwI_!XW|rq zH!olODT+x5tXDvN?D#20lNH931%{(V2IDb<;e@55X8|~NbdB8YlMfE)+FcIz_h|Qb z__+D5u2dZ}qs;c0A*jrdt|8Y028VhDU%z}nN+#zSrE4j(7BfTDsni@-K?uZD5kdsO zOi{@I#R53) zMp7lEM2Ni_H$$~oR7$3FGt9y-0L>tVyJM=vs`P-6=4o`*ydp1@?@ZsHlN&VCM238tNOk z1QY5L2%4$Sp*Ub*AccTt{fDFtybNg1E#o)FJXdrr^;GCd7{{KH!!QJ_vs=ham zZe6(N?pOcjQV86?e0$>>KyY^+-aLOUgz#kT$dOUgjHm}gs;Xjf^)!yN`{^yEWJ=D= z+LrC@&#k*(x^idZc{OBXl+v_m8q5q+MO7)KU?d0?DuS8Lk1-q$Nij}=8&wFbi%9)xYwI_!XW|rq zH!olODT+x5tXDvN?D#20lNH931%{(V2IDb<;e@55X8|~NbdB8YlMfE)+FcIz_h|Qb z__+D5u2dZ}qs;c0A*jrdt|8Y028VhDU%z}nN+#zSrE4j(7BfTDsni@-K?uZD5kdsO zOi{@I#R53) zMp7lEM2Ni_H$$~oR7$3FGt9y-0L>tVyJM=vs`P-6=4o`*ydp1@?@ZsHlN&VCM238tNOk z1QY5L2%4$Sp*Ub*AccTt{fDFtybNg1E#o)FJXdrr^;GCd7{{KH!!QJ_vs=ham zZe6(N?pOcjQV86?e0$>>KyY^+-aLOUgz#kT$dOUgjHm}gs;Xjf^)!yN`{^yEWJ=D= z+LrC@&#k*(x^idZc{OBXl+v_m8q5q+MO7)KU?d0?DuS8Lk1-q$Nij}=8&wFbi%9)xYwI_!XW|rq zH!olODT+x5tXDvN?D#20lNH931%{(V2IDb<;e@55X8|~NbdB8YlMfE)+FcIz_h|Qb z__+D5u2dZ}qs;c0A*jrdt|8Y028VhDU%z}nN+#zSrE4j(7BfTDsni@-K?uZD5kdsO zOi{@I#R53) zMp7lEM2Ni_H$$~oR7$3FGt9y-0L>tVyJM=vs`P-6=4vYsD`^WAyRc5Gk%8b%t)v)=jpW@f!Ms*3xh z;9kA|4*-BI3g14zdjshEHi{+)Jz0gDbrhn3zJC64|Kn^eZ^Eyi-mW8X$LkwwaTv}S zuP_!yu_tqOIony&*G!DFle53j`00yR`=>ww0dl9iQIfETLWG*L2@_AItgKTtVaAAL zm#4b`KKKD-Zji35rd5VYh5>}J@z$~`y$U33)JsR_e+H8P0suHX*xRPeZ6L77GHPVX z2#UaC%GW)noO3zL2rw2*?!n=~-u4s$B_2d+k`OV_`e2&%iPj-dgGLx7X*RkT0Qh17 zz?fjCzxF7waf+yyAne7kQ4HIQVN3{^G2Etr`tsV7@k73ru0EW;H<)c?a$vfIkOPy0 zkVDd64vvRsJ5vN!H@ED@=1Q*O#?0r?QEfv5D}7Jo;g8zn4aRtd;rL-Gj&ZTMWv2m% z2$-AaxJV-62QbyYdKBmN7YIOe1O9%dcGFW60GBhU)6D7j&+n}q)zKt@0s_=tdm*R( zj&cd8TMv{?wv1dW1K<`tpk3UwXu@I%xKM(&wyt@R5^k6RtrfabwQ{)x#0&aaOsg~n zRNDhLcxf$|s%XOIgQSatCYm4+7-ND-4|HOx;OTq1l8Ff-0%J^I0rV@6;>K*cm1cf- zUV^>_uq1g#*KyFssTaUF;Ux>edPnhXIIURB5wI43F7i39wBO-3FAqR104K`I%%(x- zMoE+vfU^Kb&e4(3@R@g)x=m6ji5vkK8C8Wb<}rZiPMl9d07zATP5ui`F!!5w2Sfny Y4=r&2?dYa8HUIzs07*qoM6N<$f=^&wX8-^I literal 0 HcmV?d00001 diff --git a/core/img/filetypes/package-x-generic.svg b/core/img/filetypes/package-x-generic.svg new file mode 100644 index 00000000000..13ab5b7550e --- /dev/null +++ b/core/img/filetypes/package-x-generic.svg @@ -0,0 +1,62 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/img/filetypes/x-.png b/core/img/filetypes/x-.png deleted file mode 100644 index 8443c23eb944cf8ef49c9d13cd496502f46f1885..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 555 zcmV+`0@VG9P)i3lOYrtSl@<#7b-w zf}j{s!5HvocfT|9z82@(O@vrwU^wRt=bd>tXQpGD!`Kvuv@XEI8~tgUP2L`{+*)U@I@ zrVtr5X14??iAF(=0+k>q)v`Scm$9&=i`*knBsnaUVL1>ti*O1xfzmiD$%Md-h*6M( z@*iB)icu3eU424Ok{kp%Y!1dvp%f0`ac9vcupx^$vU0xuKpJcBvej0UYk%)EV>mIx2hV}QRf#LX^Uh(%`7hZ~|KEf#uQ31s002ovPDHLkV1hgQ{`mj^ From fc23649fa1afa5123bc6421378c9bc756db0ba7d Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Wed, 14 Aug 2013 12:43:42 +0200 Subject: [PATCH 119/170] replace different icons for documents, spreadsheets and presentations with proper ones --- core/img/filetypes/application-msexcel.png | Bin 663 -> 0 bytes .../filetypes/application-mspowerpoint.png | Bin 588 -> 0 bytes core/img/filetypes/application-msword.png | Bin 651 -> 0 bytes ...ication-vnd.oasis.opendocument.formula.png | Bin 479 -> 0 bytes ...cation-vnd.oasis.opendocument.graphics.png | Bin 475 -> 0 bytes ...on-vnd.oasis.opendocument.presentation.png | Bin 333 -> 0 bytes ...ion-vnd.oasis.opendocument.spreadsheet.png | Bin 344 -> 0 bytes ...pplication-vnd.oasis.opendocument.text.png | Bin 347 -> 0 bytes core/img/filetypes/ms-excel.png | Bin 663 -> 0 bytes core/img/filetypes/ms-powerpoint.png | Bin 588 -> 0 bytes core/img/filetypes/presentation.png | Bin 519 -> 0 bytes core/img/filetypes/spreadsheet.png | Bin 566 -> 0 bytes core/img/filetypes/x-office-document.png | Bin 0 -> 930 bytes core/img/filetypes/x-office-document.svg | 60 ++++++++++ core/img/filetypes/x-office-presentation.png | Bin 0 -> 1102 bytes core/img/filetypes/x-office-presentation.svg | 109 ++++++++++++++++++ core/img/filetypes/x-office-spreadsheet.png | Bin 0 -> 789 bytes core/img/filetypes/x-office-spreadsheet.svg | 64 ++++++++++ 18 files changed, 233 insertions(+) delete mode 100644 core/img/filetypes/application-msexcel.png delete mode 100644 core/img/filetypes/application-mspowerpoint.png delete mode 100644 core/img/filetypes/application-msword.png delete mode 100644 core/img/filetypes/application-vnd.oasis.opendocument.formula.png delete mode 100644 core/img/filetypes/application-vnd.oasis.opendocument.graphics.png delete mode 100644 core/img/filetypes/application-vnd.oasis.opendocument.presentation.png delete mode 100644 core/img/filetypes/application-vnd.oasis.opendocument.spreadsheet.png delete mode 100644 core/img/filetypes/application-vnd.oasis.opendocument.text.png delete mode 100644 core/img/filetypes/ms-excel.png delete mode 100644 core/img/filetypes/ms-powerpoint.png delete mode 100644 core/img/filetypes/presentation.png delete mode 100644 core/img/filetypes/spreadsheet.png create mode 100644 core/img/filetypes/x-office-document.png create mode 100644 core/img/filetypes/x-office-document.svg create mode 100644 core/img/filetypes/x-office-presentation.png create mode 100644 core/img/filetypes/x-office-presentation.svg create mode 100644 core/img/filetypes/x-office-spreadsheet.png create mode 100644 core/img/filetypes/x-office-spreadsheet.svg diff --git a/core/img/filetypes/application-msexcel.png b/core/img/filetypes/application-msexcel.png deleted file mode 100644 index b977d7e52e2446ea01201c5c7209ac3a05f12c9f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 663 zcmV;I0%-k-P)^@R5;6x zlTS!gQ5431_q{u#M2 zg&W%y6a}>qj1Z|7Vu&-DW6d~k-n;jnHsjb-q#u0C^W!_5^C=MlKq<8oNCQ6qS00!X z5eI;XP=g!^f}j{hku}E1zZ?XCjE;`p19k(Rh%^AQQ54xysU+ocx$c#f61Z4HnT#3u~FR(3>BnZniMIF4DouI8Hi4u>cAK%EN)5PO(ip3(% zIgBx+QYirR){Z8QwV$9Z(Mpt=L-Or3#bf-G@66}txq0yc*T(zNTBDT0T8rO^JeNbSI-Tzf5!pBioy4NwAN^?iN#{;fH1Jke4Xa`^fR8m z%h6dq%xX)S?7`zae))(Xst^Scp6B8FejQW?RLTM8@0=vnnntuRGBM2dpo>gbCnTD= z^<;=JuqdSf@O>Z8^XdR?s+KEfhDdB_#ahFj^giCtzT(s8kA$AViyTqaAR;KGaLzUU z<=GqA4bRwpX|IG~*x>pZ!@zLr`XQ`od>m(`;jz|M_*1GDO#$7;n74ppb8=eiqh760 x0yt}J1#p`gw$`o!R{d7zU9~!Un@nJV{4bstt4Au+Up@c;002ovPDHLkV1kWhGjjj{ diff --git a/core/img/filetypes/application-mspowerpoint.png b/core/img/filetypes/application-mspowerpoint.png deleted file mode 100644 index c4eff0387d5888c638ba09473ba6d2369f7b56f0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 588 zcmV-S0<-;zP)HU2HvUSp%6 z*n}iP63IK?dpo;h@sj9~pcxo;VVTc-XLiP@DgefqE#NE=@oyUd-&HjLpsLIuSFXV-EMck)oQ(A`s%*^&wf0(rNiNHsU%=0Rw;WC z(kbc37l6fo`-0uR!pYkYv8U^3?nsh^@pw!K0TH3uYyx1_2>|JbXPmfskJ|1YAw9w! z9`N)1^Aesr;y5Nr5-ODn)oOL|CGi}f9!&iVwpK$khlIX10X$H6^A_stBJqvLhU$?V`QXqKme*s~gVDJ4A;LTs_e15jhc1;By a82kqHEPVYFAD2!50000hkjP zNW|QGv-YFNLN^qH@tJycPNG5ti6B7;r4mEr#lr@*T8*M85D`{ZR^BWwF23T<%MYIh zdC)S*p=|xk^!~H=+HSZ183~y8v4|mYmZxt&)5{{~>J`>E223Q5>T$=~mtA71q-jdG z+eJhOAyBW^0k9Gk1+rX8)zFx((CG^&tDY>6XaS~Fy!WJON|Gdujg5^~Vzt@o%BcYLiNiTQSD`zL^ociBz_>bDlpw3kriQ@Z`bVsGz-_6N>$&gTDiKDTKR^ z-hB*tHa^>!oD~5TK^0UK5rZ}RBm50Bv}S-yA%s=Ha5RYb{)!z2N&$&64gfhybBu8p lh~_|?8^bu;BRYt{<}Yrwd83Y=s?Goa002ovPDHLkV1l%3CP4rI diff --git a/core/img/filetypes/application-vnd.oasis.opendocument.formula.png b/core/img/filetypes/application-vnd.oasis.opendocument.formula.png deleted file mode 100644 index e0cf49542d44e8a72f53a170b524bf73b6c94fef..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 479 zcmV<50U-W~P)kl?b!hEF}^N)(TD2=$W+J?I!BhkpOgY zx`|{md52$;%jJ;GX7zPE9%nY2&BT}Ag3hT7+NGXYEXJ%>t4Rnf>ksJF?ps3V)GL?E zI+SoY%q$j*N$MFp!+>^+{^gsN&^h&r#UcuYf(|7Z45p-x!4%qs&j@^&0$G+nXozM` zAHfTc_#@S7Ri{#^=X>e3r^k`HLg+EMD^O`rgS!2JwxQ5K!MB@cDeK@spqPZy58;LkX;)RGWTdsBaJ` zio%*pM<;2xCTH;S`u;;eeS^U3^%?|E&w0p70OyxizYdl927%k{7J?F=!BTV;`^RUf z*7nkwYxou;LO^|kfZwYSY-}Isx6sVy&Y=)c-ym?gTnzsR^$h~2)5#nT$9=m{{|gwu V+0lueHkJSY002ovPDHLkV1n0f-g^K5 diff --git a/core/img/filetypes/application-vnd.oasis.opendocument.graphics.png b/core/img/filetypes/application-vnd.oasis.opendocument.graphics.png deleted file mode 100644 index b326a0543a5e4505ecea5aba7bbb0ebe07bfc902..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 475 zcmV<10VMv3P)?xuc$zJqiVqDu%;VB`zp#>RqdirB%}70HTC5qdckM9`rw zUV;fTGekN>bx_i@r+FrJXvqzG;K$A~|M|_%Gb^OiX#o*MQOM`>#1388@o9KG9tUPk z1OS+zOd^J1+`*8lR;y5{RMIEa&UojuMX3C%@&-; zT(8$-U}dve;&eJ4!c_1A=JZ>b-MX;_=P}pmbfDdCGq94$WJwsCFTtqL9szA8Cmaqx zV-rQn3_=4B@J9^>0}J%_2nsl6=Gg6{{s}Ls>%fW z-`SdQDjZEdoVR$j`t>zYm4tAuI*s^pih-2{3OF$g<1@)%ym7evXVlggQi7K$YbHEm1JvLhq*+@Y~+vNhx zTLko8`4MnIBBR0La)cozGOVHR-7Xhk-Xie({RI9|n70UgJ|FRVy|q!n{1@Jd@s)7; Rl3f4*002ovPDHLkV1hy|(kTD{ diff --git a/core/img/filetypes/application-vnd.oasis.opendocument.presentation.png b/core/img/filetypes/application-vnd.oasis.opendocument.presentation.png deleted file mode 100644 index 7c6fd24684095b2e90d6706e80dfae9d4ad394a7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 333 zcmV-T0kZyyP)gFy?gh=|73s_ zD^`FFU|6JbpbMa^`>3_^Ga*~=M-1L#XgfzSrKN3P00000NkvXXu0mjf(l?Lc diff --git a/core/img/filetypes/application-vnd.oasis.opendocument.spreadsheet.png b/core/img/filetypes/application-vnd.oasis.opendocument.spreadsheet.png deleted file mode 100644 index 8b0e85b067039c2bd583db7fd94d746a6848547b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 344 zcmV-e0jK_nP)M@H|fxMN!$Db-H!a3fH3% zY>cVI>gfwD%XM$a0(qYQ1h&WTv^knC1n2Ou(M4CyiOw%;vC(>_-O(HE^j{Z(b9ho4 zwt?2V5-a;pv@CM)zyev8eSbu6#un%eh97rkOn;&7AL;5=vnw38;~IfEQp(DH1Ei)I zzOes;G)4i4VE()@z0$87Njx0Dn)n|MEUUr<=FgXK^?Z?3Q2LC)VRxihXfPFVk0%8R|u zIlkhT_~a&+A?5&amG4tRDNU-L-&!{rlg7D!#$%GG`sqdl&aYt$z9I z<=a8xudT9fm$BS@TUK3Gw0rs14%vwj&wzUGM=a9X!Q}K~QN0mQb4!J7U(-yBKFeH= zns49jI~HZ=RaE$h&18z#;y7GzndQUMCIt>NUxs+C54H6mF4OtXeSRB6egrjET=x|| rFr7>0_{|WY^oHEo(bGyJxc|so{(IWaU}Cc$7-$Thu6{1-oD!M^@R5;6x zlTS!gQ5431_q{u#M2 zg&W%y6a}>qj1Z|7Vu&-DW6d~k-n;jnHsjb-q#u0C^W!_5^C=MlKq<8oNCQ6qS00!X z5eI;XP=g!^f}j{hku}E1zZ?XCjE;`p19k(Rh%^AQQ54xysU+ocx$c#f61Z4HnT#3u~FR(3>BnZniMIF4DouI8Hi4u>cAK%EN)5PO(ip3(% zIgBx+QYirR){Z8QwV$9Z(Mpt=L-Or3#bf-G@66}txq0yc*T(zNTBDT0T8rO^JeNbSI-Tzf5!pBioy4NwAN^?iN#{;fH1Jke4Xa`^fR8m z%h6dq%xX)S?7`zae))(Xst^Scp6B8FejQW?RLTM8@0=vnnntuRGBM2dpo>gbCnTD= z^<;=JuqdSf@O>Z8^XdR?s+KEfhDdB_#ahFj^giCtzT(s8kA$AViyTqaAR;KGaLzUU z<=GqA4bRwpX|IG~*x>pZ!@zLr`XQ`od>m(`;jz|M_*1GDO#$7;n74ppb8=eiqh760 x0yt}J1#p`gw$`o!R{d7zU9~!Un@nJV{4bstt4Au+Up@c;002ovPDHLkV1kWhGjjj{ diff --git a/core/img/filetypes/ms-powerpoint.png b/core/img/filetypes/ms-powerpoint.png deleted file mode 100644 index c4eff0387d5888c638ba09473ba6d2369f7b56f0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 588 zcmV-S0<-;zP)HU2HvUSp%6 z*n}iP63IK?dpo;h@sj9~pcxo;VVTc-XLiP@DgefqE#NE=@oyUd-&HjLpsLIuSFXV-EMck)oQ(A`s%*^&wf0(rNiNHsU%=0Rw;WC z(kbc37l6fo`-0uR!pYkYv8U^3?nsh^@pw!K0TH3uYyx1_2>|JbXPmfskJ|1YAw9w! z9`N)1^Aesr;y5Nr5-ODn)oOL|CGi}f9!&iVwpK$khlIX10X$H6^A_stBJqvLhU$?V`QXqKme*s~gVDJ4A;LTs_e15jhc1;By a82kqHEPVYFAD2!50000l0tqi6&npJ$x10^Z5HznC|jkhtXU{*?AXX+vSK$&lqrKo z4P`-MYRWlh-uHXoo+plGVQMtjm29&SnPTept1G}>;1qBiY)nF?X%bBWNhny_l)Z3d z&-N3@T)lWSVVldhUf%V8y7}mh3o^f*rno=*oe{IP>4|aPep(t*WGZD`whRe#WKrpOeww^A5*|8>ZEI3iJG3d@;ddSaaQQiv*3SWXm^*Pk(vkYVP=SQ%7gX+6s4|5yBQ}3^T_6XQ zZDbP)D!Ze~6zXIkQ9PYpWTZE?jfD>%Y1@{Swk5itNez`{Q)G&e7J>b9cP_BngG&!t zi|rp2nJV;T^4jymwofAMkUFri0;>ZDmaq-jpk-+0DUxkA;uk8$FcGE_?o$8&002ov JPDHLkV1i%8-68-0 diff --git a/core/img/filetypes/spreadsheet.png b/core/img/filetypes/spreadsheet.png deleted file mode 100644 index abcd93689a08ec9bdbf0984927e8da06c043c7cd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 566 zcmV-60?GY}P)>q?GuNnCdgP^*Bj5V_b?dAq2Ppn9^MBB^YUM zad0N-T{Ujg*A6d~mYV4na=hT4Nz+_}SGTgW|Iir!%$ z;@OGkWI6+j0H}~K4RYR%!7y|zM`O@*K>rL{*&}x3lR**HrMXC1->#slU>X|w!U1xQ zqcmiGvd%360=)b7gRlP?JPp4u-rPlgT-QpKPrw+s2_Y2Fl6Pf3WLrIvfJl`5 zRzR7_7k?Q605MS|LOp)*^z@V<2h(HGDZ1S*OG`^!US1}5_V=et z$gY4fh#8W|FyGtT17LM^H8)s%-fFc*@rL(BB)19^Dj?AhWmNzm2m*S&9-ikBh9T8z zm0qt$wOVB`7~uOp{eGW?g#|V@H^+z+SAa+dVn7hm_u>l7f^-FpF~tOssQ(cGTLUp- zEu>Me*SWg7qSb1#yu6%Cq>zA^h=iDE8qz2d)I6|#K!h+H5>b;YkVO%>@?$6?5oQTY z(?F45%K751QME>@jS&+cX*tI-L%cN(IMp5-ZkP)9G|9D?T_l7$Z_lAn^f-Us0K0Yinz{ z!Q%5tR$Yof;({iAw>1FMji}jd&TmA9krQSwZf|cV&q^s)R#wLDDy3*Pn`o`AgymZh zi!cNf7$fLm546@+!YtymJObr*0a5>rkz@?xQ0;abC?3O&jSXtGnnfTFIT|pdWt1T> z%Pz>PK&dgz6JfRjzVG9@F0SiZ<`ctl9CmkiClZ=YARG}eBFPxex((Aw%WJ?yNh2Q^ z7um_l2{5X_U@)Lot8smO4UCWG`uaLS5EPP}unmX1fJlt7_zw>c3j>aY%2c2f0U@;w ziN!Nh-a;}{324l1)l)PoE-0uiF5+PKZdT;=-y)!t(tkYv>&^GKudC4ky!`O_lWjNi z;o{=rqf$zXNWw;?OQRwit7nPbA#Q;yNhMX2dh>tbC$HZGw2l#K7ytkO07*qoM6N<$ Ef*p~X2LJ#7 literal 0 HcmV?d00001 diff --git a/core/img/filetypes/x-office-document.svg b/core/img/filetypes/x-office-document.svg new file mode 100644 index 00000000000..fc51a3a1b70 --- /dev/null +++ b/core/img/filetypes/x-office-document.svg @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/core/img/filetypes/x-office-presentation.png b/core/img/filetypes/x-office-presentation.png new file mode 100644 index 0000000000000000000000000000000000000000..7ee552ba7c80dd6f285a4acd5b4a2cba62c140a9 GIT binary patch literal 1102 zcmV-U1hM;xP)Qxt zIoI6sH*(A|w~$-NDSsmOL^mA`29X?eG6WVRw3Y)=meuZPrmJ$8kL-A7t+gX1FEq^b zba%Z~^;Y$Wnel%jsG5B7;>A~H*1AhWA~HNUIQV`c0;;;Yx3_nf_BlO0U9BWGor34j zpZ^53fe*tlL_~^j)9a?^ONWWfIQQKlB7>(-pLPNO8xOta7hfYwbr8Y* zdB&5EpWG{f{&6FKfgIw1?L>9S|(tsNJaoxP2lkGu=H+b#a#aU=G;7#BM_$%FjWx1>03Ad zTbS9r6gWUY-j9H)G8&B-jYh;memVxw*LkpwsCv7z}7O zn>gpVzP@H}Z;vR7<{A&fkfo)i8Sg8rz*Ipqk&xzSXJ@ChaeaM#=Ac~di+Z2$n{7l+ ziwMBtW$1YxNs?54>-YPW=Y(Ncj=)WlG7`-fFHT^d_#hQv6&j63wFb;7X*xa3jDEjg zXrSBea&~qGz{7_RxxBn&cXyY1z0P<%UWjat>8eNxxPLTYLfVwf==FM~jnkS~Sy{o% z2*VKH_bYQNtIxZSYb{UOMy2%?Rgm`q0e$<=#M_W0$=tq>V7m@@N1d=?~d|0Rtj48_E0T`mW&JzT|%KHy*eN U6^wJ6Q2+n{07*qoM6N<$f>r1Fg#Z8m literal 0 HcmV?d00001 diff --git a/core/img/filetypes/x-office-presentation.svg b/core/img/filetypes/x-office-presentation.svg new file mode 100644 index 00000000000..821798d50fd --- /dev/null +++ b/core/img/filetypes/x-office-presentation.svg @@ -0,0 +1,109 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/img/filetypes/x-office-spreadsheet.png b/core/img/filetypes/x-office-spreadsheet.png new file mode 100644 index 0000000000000000000000000000000000000000..dfdc74a8bf660ebd02baa99b0cf40d48478dd032 GIT binary patch literal 789 zcmV+w1M2*VP)P0b9sfl_KZH0<@@E7Fh&3_?( zfQKACgb;G@WITBBAk^FoT146sajCJ`YNgNwo0g<)5>VTK6%&$>Zf88yPG&aAW|K?> zzsr7a=J9=RzPCF|7-JB_FpM9JF%OO)2qD{kzyGwjrdvsrQjg#7ho)&tn^Q_*7)Hy% zS_Cl0P_Nfvnx;|#x~{`IZ2)LFCS$BEanR^gx9tRuLPSpj#AhfJa@?fapm4k7p+=+8 zmfBqfSk(rC4*>uZPaff3-~nIHZx!M7jc}YwXD~K;@oybq=EYO#Kz$1+*BU(kS+4Q? zTWJ?VCr)x)sWqg1@zeten0)q_=ZlliCH`W1j_0My9)1Z}nSk;80RX`As|kd|VZQ$U z(+ck1xY7|vB9ZU|LN*myKq>7mpxp$vvN-_2F#yTWDZaj%D_ATjbhKcg&v4l51psUpmZT8_u*J#5 z>#nsOO`xL%V76G~5A+!pH#PwPZUD)prUjW?QQ}##G69~EgFjyR`!a4_y)2Mni|60I zQFRefX}{U;A6QUrQ0(Rl006VHhYw%UoV&ImkKBr@4LZ00w@bs&@EHKWerW|a$1e$F z*y4}xrvFn5S|T;e(^xDfZ7moxJg+vWgq_sxI)Pv?*s-9KP-20K=t+RC>u|YTN(CJL zLI?qH+$v0Am;in=p(#=Ab+7RUMcLHz T8ak$900000NkvXXu0mjf5vx}z literal 0 HcmV?d00001 diff --git a/core/img/filetypes/x-office-spreadsheet.svg b/core/img/filetypes/x-office-spreadsheet.svg new file mode 100644 index 00000000000..af40bb252a2 --- /dev/null +++ b/core/img/filetypes/x-office-spreadsheet.svg @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + From 14003b6d96396517875e39f46cd004ac867315bc Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Wed, 14 Aug 2013 13:00:13 +0200 Subject: [PATCH 120/170] replace different icons for code with proper ones --- core/img/filetypes/application-sgf.png | Bin 702 -> 0 bytes core/img/filetypes/code-script.png | Bin 859 -> 0 bytes core/img/filetypes/model.png | Bin 452 -> 0 bytes core/img/filetypes/readme-2.txt | 28 ------ core/img/filetypes/readme.txt | 22 ----- core/img/filetypes/ruby.png | Bin 626 -> 0 bytes .../img/filetypes/{code.png => text-code.png} | Bin .../img/filetypes/{code.svg => text-code.svg} | 0 core/img/filetypes/text-css.png | Bin 524 -> 0 bytes core/img/filetypes/text-x-c++.png | Bin 621 -> 0 bytes core/img/filetypes/text-x-c.png | Bin 587 -> 1345 bytes core/img/filetypes/text-x-c.svg | 75 +++++++++++++++ core/img/filetypes/text-x-csharp.png | Bin 700 -> 0 bytes core/img/filetypes/text-x-h.png | Bin 603 -> 1242 bytes core/img/filetypes/text-x-h.svg | 79 ++++++++++++++++ core/img/filetypes/text-x-javascript.png | Bin 0 -> 1340 bytes core/img/filetypes/text-x-javascript.svg | 76 +++++++++++++++ core/img/filetypes/text-x-php.png | Bin 538 -> 0 bytes core/img/filetypes/text-x-python.png | Bin 0 -> 1469 bytes core/img/filetypes/text-x-python.svg | 87 ++++++++++++++++++ 20 files changed, 317 insertions(+), 50 deletions(-) delete mode 100644 core/img/filetypes/application-sgf.png delete mode 100644 core/img/filetypes/code-script.png delete mode 100644 core/img/filetypes/model.png delete mode 100644 core/img/filetypes/readme-2.txt delete mode 100644 core/img/filetypes/readme.txt delete mode 100644 core/img/filetypes/ruby.png rename core/img/filetypes/{code.png => text-code.png} (100%) rename core/img/filetypes/{code.svg => text-code.svg} (100%) delete mode 100644 core/img/filetypes/text-css.png delete mode 100644 core/img/filetypes/text-x-c++.png create mode 100644 core/img/filetypes/text-x-c.svg delete mode 100644 core/img/filetypes/text-x-csharp.png create mode 100644 core/img/filetypes/text-x-h.svg create mode 100644 core/img/filetypes/text-x-javascript.png create mode 100644 core/img/filetypes/text-x-javascript.svg delete mode 100644 core/img/filetypes/text-x-php.png create mode 100644 core/img/filetypes/text-x-python.png create mode 100644 core/img/filetypes/text-x-python.svg diff --git a/core/img/filetypes/application-sgf.png b/core/img/filetypes/application-sgf.png deleted file mode 100644 index 48996c54394314e0f78157c6b06e472d90ce6038..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 702 zcmV;v0zv(WP)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2iyY| z5)UXgb;nEq00KTqL_t(2&tv#cB49w~teF~JmE#%iZ)0PjXKSGo>}6b;>9~1jBo+;q z_q23X2Kss0Sz4HxnwaS8>uYLiDk&+-%SqdttM*m7qiFc?<#l7RpPRES5ZK$>+uGV$ zSXdYu8mgu| zHU(+eI3wEK$->go5~#t?%j=}3?i+d4*D%y2uLRM+!op&0EPHu(Bg4FoU=w3~Gcz-L zdj~I9x0C8RZ{$?qs7p>!TwI)&hZm?pMuKne!Wf3uVs}kV4FdxMkR^6@C)Bi%HFU_x zi-?GDad9y-GxPIuEbj6L+7P6pr3ws0kRB70qbeH68rq~}`T6}=NWn}@X=H_H8OR&zw}9d#LDAt9i1#l*x!MMZ^# zgn%K#$;k=yD^N8HGn1vE%(mGPh@?@KVXG)B!p+Ua4a8hr92}gitgOt;OhDB@QdeDU zT7xHQTH4*%kZZ52CJu}spc{aSn3xz@SeW>D*zL{aXEb?XPpuoLhn1&V`8uiTYlxfc kNr!oAwG}x6Lk3w50DkN_x`QMu@&Et;07*qoM6N<$f??@ABme*a diff --git a/core/img/filetypes/code-script.png b/core/img/filetypes/code-script.png deleted file mode 100644 index 63fe6ceff5bfcedb9670279d4bb8d25807f6ecee..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 859 zcmV-h1El5>jf6w4x#gTU%_MMNlkNp$oSbvBp&uHw9M;u0-4@=t5BI zP6Hx#-C_{5RMJ z0_P+Xkumexn8%)S+Y)#l(gR;YJP<6#1-=jjK0LONWPdJQIR8uK1HpvVIxBIQ2ztt+ zqoEx_X9S%QGMe=~(k#sebCL-an)%CR%a7YtUOQUgv+G>~?N~XSWhx=? z@$fx}0MB;$`JWcQ-Re{XV~5|{DvU(#*+NF*g)j^qk#b~G9_O!i*y&mZVZ=a3;Go(K z`DkskYn56Nhu+k@1Ke*uY|x zI&k6j$JfNe_a{GH%=n2rZOz$Z8R9V?Pe36hIk}jo+A-`;dt9vyvBu#Xm@veu&@v`| zzt%mwc_$nd0-sMVx2d)b0!MqGxmfCumx7yB#nIUWvA{!HOMfslMyW1iV&nY>zxwyj z8^JfLN|kT z4m^Q1mhO(_r4w@`V?H=YNkOf(i&bHT3Auc3bryK1_{hDSetLoLN{VLB^78ULiNFy^ zkUqqG$fjVkJj5tfWkOn|P5`HVEp5@-mGnc0wvJGHC=+39MC2TWT#i?t*~fNch*he_ zgtS^8dH$(KlW)EF1b4Fzv~?&0IQaNdg;W5&{t&Bmg9&N1-rBBr_;Rg8ekw^mn;@T# zlS{|Rq+-Nlg18i%UY;i|q1NnSwf>I@85#4U4002ovPDHLkV1mEDi4_0< diff --git a/core/img/filetypes/model.png b/core/img/filetypes/model.png deleted file mode 100644 index 7851cf34c946e5667221e3478668503eb1cd733f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 452 zcmV;#0XzPQP)Pdwe5?6tW?r-ok|b$oDQj8FV%kZPq;(MWOV8?8;<)(iP}>hNMU> z7fbz%jjlr7h8uuoQ~J6}n}@Y@PdTk=)PxO{%7zmL?dchpZX*~n;I{!C>*(8cU;q(~ zAS%Po_@naEU!xidrBXD?;hN|x^%W|Ij)0y*r5vi|?W&Fub(NqJ@z0o=OZS(e|#C2>JN4>y}l*tQ*E7zP@R2CCJnkW?xa6bgk%(hgtZ z0=~d?U3i`+Mvi4!&~+WPT1^NX#{u6&QIx+DE(oR{&T5&-ovF?@wGw)P&AtpHZa|G%V*GUUqL@@!d4V$`8=##4)ytY959JG zdc&Kho)&AL70^i z!PEmeeDWCB-UbK(*4JST44^tV2z_J(dn~+vBMJT97_7rzFio=~XczIv?PQ5$v%u~y zu(bteXb5I1h2zCV{Jc2~V{{yzZipgsP6;k264$*#5q?GzCm|CPa9CKqm4b116h3Pu z?+%Cm52plC8|5P0@igf2GV1KkCfk{Zecu=G@VNrf>s%g9c5D%@cfxVb6$nY`1IW=4 zt10QqSps_2JLp0f3I0j0u>#qA;v!+T))KEbCg|mo3q0pG{OR}p0fPds8+K~d>Hq)$ M07*qoM6N<$g1S2e3jhEB diff --git a/core/img/filetypes/code.png b/core/img/filetypes/text-code.png similarity index 100% rename from core/img/filetypes/code.png rename to core/img/filetypes/text-code.png diff --git a/core/img/filetypes/code.svg b/core/img/filetypes/text-code.svg similarity index 100% rename from core/img/filetypes/code.svg rename to core/img/filetypes/text-code.svg diff --git a/core/img/filetypes/text-css.png b/core/img/filetypes/text-css.png deleted file mode 100644 index 23f3101811f2e402b8c581ba2e39977a675e0295..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 524 zcmV+n0`vWeP)`ZKMgf6%T?Ed*Cat6T(z(gze_Vj!CM zy6@eO?#%UBLOT}?40F9R=iD>%#+We%%UB#s+R_AGvw8Yw4_Zs>2F6fS)&oeXpp>-P z(4Hm2FoZ|N+3e;VNHZ};&)gBvnMk6jHRTlU@9U0$Oo&egxTGs^ATns~z)sFnC~aG*pjzb8G=xt@DLRNB;YZL<4tG!V^NUq+~Mv ztN7=;N57-Juq!r;ZvU(T-}ZaSebaUsBWyIhc|_vmN(Q*NXt96)H+}<~rjsF~CC`eaI+m%Y8jfzomMvZQaNUIT3LIrJ$h)_W{ zwF|LDNlB-g`Hb_G$;>3F$9JF3WYR|3fy2C+_wH}*xp!_4fF2UN4lt#d26oXwru}hT z0+0%Vz-l&|Tdh_L-Ng1G2*RBtBncRx;99K)&+}s0whhxXp{go}$g&Jk6k|vfypI5M z!1sNGVaV?!*L7i87Bo%cfO@?S`bajL{R<($@$|PtgBRcCGIJ_2a|&kO>G-s2aR3E4 zjssoScUa;zIdOeGHBnH13G)W-zt$kUQgNfG;96b=v&4NzRt&@7nN%v3HsG`<<+F$cumMs448N!W3r&2Z*b~D5^$^d6Jxn@SFK5Q8*uKSR7x{I|H-_N1f+AD zSYC5@2K4OKL$==F9U@CH;ONNL(W}oZICHn;d?~pw?GRIsH*x-68Oy6SuK`)`{E)46 z9^3(-HXa#X89SBv?uYTDR$`1BeYL^qy2ooL z9JGg!dj@bE2h%iBN-uI_FQ3~1aAJU;p94sV?vU@Vu~ zzYJVnaJh6}kUe&kYqf-!jn&kMV8u@`g~f@nQ6{h6=G`;>9L_o&0koYco59Oo$S(^a zPW~W&mlF~RTCGOX?B{Cc`@uU0na}7B#zvsJZ4aUE`&24rE}qoU7q1boR#*)bvt>m|>nH9zMx%F>ByuA^xhx~`M51sBF6ZkATK`k=zS2ZDywQ3z};VbDx?c~o&Y zm&URTbX{M!U1gwkQlrrz3_~d zrn#f<$I3v{48y>29BkWWY;25Tu}BaEq|<41T_+4fY}+P|V^XOUuIu8uE&zo>VT0dY z0pxNya=F}=kA{bbw~XziJ>3QSsmBHoLI_RUQk{F2rfCSV^>1|pfDpo%oSd|#r>9H% zP5`W|tXM(_Ln#%n$K0Hjhm_XS002U@Dc}}>|6Bh7M3;GZ2M~JY00000NkvXXu0mjf D!8m^? literal 587 zcmV-R0<`^!P)~7 zMNw2LQirBVQoa8G3P(rY+l;L4iy+JwSqmy$9JlSkk z&*$^Eg+c)@!R|v4gdc8+TTn&eWHO0VD&>$!B%o;;WLf4CNs=Inq9d`xA4otCWHK38 zmc{pkX`0Y=9g3oGK{}lVy~OYL|C5lQ&U^l;wrg|7w=BcA9L4-r411?K7f`@348&rw zXD#uW)DK;H`hxO}u%=@Cj{;#u#_;bb1_KgUOT2Hp6;)MvC6P$vQP3=g1O5#aU%I!K zZ1dc@f}YvG&*Spnplm2rIp^VdA^HydZ0X1axdms2!RKi5x-SFA4p@ zC@N|PI$ryHL@t-(!zBsf2-+sYAukhDHU + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/core/img/filetypes/text-x-csharp.png b/core/img/filetypes/text-x-csharp.png deleted file mode 100644 index ffb8fc932f321d19049a51e0134459e7d6549226..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 700 zcmV;t0z>_YP)WjsQrp;}0X?Bxrvf12IKW8>3t`e~W9|JS<{btTNbNT@EQIWBSNJTX8AMGXD z-SsH|s#>j9Xf~VMtyT-YMD}5^SWHTY5->o`k|d#AE_YQd79j`%GMS7FNvG3b7^Vy9 zn0HYCJy5MyQLoqKnW|JOp-?D*<2V^msZ>BOv0ANd2n7t@{=V;sZrQ>3c})5_%ms4z z7!qXwHHe~!QFj8aR~&*-3F?O|;#(ESIXP~Os%|~y^7c15*q5`gz2-5ol!fU92NIGT z_ves+>+Tf3gfcL?!nimYmR}cw*|BGULzI^7!;k#3K^YO#;!+vM@N~(99+<;fdqr zYPJm+pXYFYk;neQyXXEcTQDNQx57i`Okp9A#n?<7!{#tnKJdsF>utb@JH7dU01gfL zEK2hoPZAnO5+je3&^i*hWM`qCW^vLK!O*?U-#IvXV?#6koWqrwnD{j&K`7N>^tR3G z8zr1(qVOzcF#nF1&0MZ5C$l8*E^Uth0000oEl%}ChsqGN2zjk+KUJi~^*G_Eb zqx_^f?Cgx+XMXQH?^=ln!@7U}esyVS$>kMjcXwA`zkai?o@;Q& zaR|fk+35TjK)2hC<2Yv2nX^hMMYr3Hrvg}O5s`BT82t8BfMEqeKpe*?rEnaFIF9i= z4{Pn=^FYO7@l;S_0E5#HkK^WtU7E$Qqt;9W2!enh2uLQASZnb-52X}R{TtcdB8noC z`30h@*QnR)l*?sux!m~y3`Q7+q|<3SoeluG@4usX^&-km@cf6Lx%AcDnVdK=KsKAj z_kEyW#p!gKLZQGj$HCK02sQZ0nG5#R4vfCDq7ZGs7>u4R|HlD1$1NHJGsd8lLTinP zP^;C5wLxNojSa?_K2#Xe-Ppji+Y<|UssodN2C^0;Hi#9hwmkjv4))15e##{ZV@&!2 z%b$FPyRb0Tl_MP(j8>~fqtRf0f1gI9aX5NWjEx0}4TvSxsIq)waVt^CRQyrKH zAR<&M6;@YQDV0h?0CG?RioKSmaPuYt{iVLFiloKj0FKB3Y@-?!a)rgixtIa#!u`( ztJPxfuSYolHsR7T%WqyKm&*}pi&z0`h+|E?UZ>q|(|oeSoDswdVg!-#zA~z@8W>*O z{N-0tKmNqZ&L-ivcS%O^K_?W%^dXEL?vMf^h^3!`DfvGVV0c6Kx8GS^NRixFV|j6o zy@!7yBB+GhKcy9LToxA>DHe;&&*w1$VlCE4KUHVB1@0S{*nPB(brL*%yi0m@1rb4O z3$6!#3S%stPKPLp==ORT3r;2jPNIKXP6{yGh?Z}EOzqm+Jd7@o`REqCT$Wm`M(*8r zc+h}9YG9YjBoYaXF{GE5s3+%muEuj@7ABFzMc&Rx<-ArIh0w*`LlN$8k_fsfhqeDfiyJd zwZ^#<0QGu3sg!a>L?6Z+wdH^^`6>W_NJavV0sPHyRc>}g~)F_Qn`A>)C_iwK%Z zrIJ;xR)UI1Y4Ozts|-Nho;q zVk9-bX)%F~!;63iu$Fk=VJn3~fmb5S@@)ZqjBT2{f`vT`b2}zxb0$o;EF@G3&BHK^ zc)`1kUzo^Qkk$?KFKHNBD?nP-MJ3b@&4fg;g5l2wMi^g?9qj+~@b;62o_U1_S1J`g z7m^UMg25FX1MJ5AQxAJ5F5WDt=$=-@JV-!LHA2vuxl9kN>PS8x??^AINH6LjF*#nbk4}=n3gfWp$kEX5IpHS zYiQ{@d7Nl&d$#+7-TckP&Q}N91e- + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/core/img/filetypes/text-x-javascript.png b/core/img/filetypes/text-x-javascript.png new file mode 100644 index 0000000000000000000000000000000000000000..24d09ce978181c4b08b67c879553a75fc3c1e97a GIT binary patch literal 1340 zcmV-C1;hG@P)K~z|Uy_QdiWLFi3zjN!pSM^?XO?7peuI|xj!#L*OB48Hd zgb@N+L>z;lVpdsXlYs=>NJ16~WRpc88zltXh-N^A0T&Vwhk&?o5*LFeGKxWDLWk<< zbWhLBtE%^2y?gJ;qNgjB{+I4@;t$@UZe7m#-tV4s?h{pIQkO1W>MbrVTD}0SuCBV% zr%x|UuI)2zdiX=y%$a7U9HV<^k=+RpV|0C}EQRaLRmng3NHLZ0W<=K_QfP}MsQ zupRqz0Vb7Y8C6vwA{b++s){Iz2qBDrZ)<*jek!P40NZar`Runo>C#~w+iTB(09lri zWf^fCBOhMDhKfP}TPJ+w0rEU2NfOGkWMgB4rKKfWt=63b*nY~gWZ~Ukv+&@(fUth~ z16tpB9cg^|P)Vi+Xf~VF>vaHXQH?bJHwe^XyHy8AEYztT0MHOn??42+nW|F`4KNAf zy~kRMh5*ikKnS(Z0QmKf$S?i^>2FYrB7*mL=dfS@CiPR_#Was0B8LOmAIO8NKm-lZ z`2XtaKdJukQ;wgQCt8TWSiqv%VA%f~y*K_y=eb|)8~?x~==b|%Sw^GLpyfR3JtBg4 zj+K=a3N_6B{x$A7;gR+CDa;(3n}V%Dns_vLqI=Km*|z%vOisdXw@bI%1)y(g;1w0c zh~fD0PvGqduTs@m|^7+~oT8 z>-a~X;=`iL+O3p8jBx`Nk7eAQUSs&n7brite4qn+0_-IXihA9G2ormvI`YJej2?NG z|E$fh)^DO3Vai+FJ?|L&?q>(aK2#SZNy3bC<0A;ck!2ZWHiW8#sLr7EC5p$Nr|A8Q z!8^a@tDQPj1(ulLMo3gY{2bVG8Y&Y-7#Ni$ach?7=RZc~76|v8LgtrAXXo%vw;T(K zcL9vu*VzLdXt&$6TCJ_tlurRfg@uJKA#T9jEX&=J;mX_OS1qE@o>R0MQPL!|7pL!n zqA2j* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + diff --git a/core/img/filetypes/text-x-php.png b/core/img/filetypes/text-x-php.png deleted file mode 100644 index 7868a25945cd5e5cb7daaca9591927511ca65c0f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 538 zcmV+#0_FXQP)vYep8SaFV10Q$h+;hIUPX_=v5b}%>Tm<(&j1&5;I!55C)oN0s(P%ZB zP3Q#ahfpXKWF@S?jm4U#fv)QovMhrriclyNs6-G12#3R##4PSZ0VY(dRWJ;Lwuq{# zAW0Gwi$yA^R4RZ!;W+L`f&%x{=D^VK#BBWL4Ys{;*!A7Q;!=dN<&D8*GzGaF4`hV4 zDbY0{NrMX>ZqF=0((gR5-zL$kC*b)!fwu{Euru|XrG<$^n#@)7i_>rCmRxnDq>$Y%gJaCkRd|tE*a2x05Pe!I^e13o69#&RQZ36s0 zB=O|K2Yi(jsMqThn}9t?f5E-)L^naZ+db$&%M$!bCdm=jv7?t_lB?3&%Ltq(>ESw? c;MI421LCcoDG!2@;{X5v07*qoM6N<$f`UZt7XSbN diff --git a/core/img/filetypes/text-x-python.png b/core/img/filetypes/text-x-python.png new file mode 100644 index 0000000000000000000000000000000000000000..57148f4b90d401b26b324d3eaf530f11032b4726 GIT binary patch literal 1469 zcmV;u1w#6XP)+$HVFbF zIXI^lD9}rTTyjfu=%MH#*ZcuSkbj_eUvmx66gdWPQ6oTtByx}-zvLgHEK(B197S^Xd-*|GZt2$I9M?|tUY%$r9gBJ9S}$05ry3WWmJ+VS_1W@l#~3F;8QX!d(w)5iB^=_DDOWHS}O41Q*Cf0aQT@6K8r z+|mMxTN>LXNkXYqLTgR8+ojcNQLR=V55VxN_c;6XpP&Yy0819HkVYM{xJ&Wk-*KN> zK2eZI0to8Arc%z4v<*%HrCcbNQ0{YBw@GjHL$dOVc+Jg&S?QcH9&ioeT&pa}KGtJ0kG2{sdY_H#CqxdFw?uXpH^#!7QZ1fe? zGfSl1&!%qBNgMgt42)#61Tis6ffWZSUm!1EVEE(vm{j8`ji(aq&Mj>HGGfi{jDk}r zH~62QWE~NUI0~#*#{!H`L7st45#?g7Wpi^AfSI92tOb>0^8vlBA>Qg=n1B8)AZP2= z=Tv_80RU;|KX{#gQapW;WaCSM=yV8Ik6waNCBzEY9IU~0Jf2=W#bWRcq1VTC6^KPg z17;Rq!>^trEZin6tfJCQ#2Q3|?B2hq*CCXzv1yNC_)2^*-o!m1B3KcS98gqd&tty( zfV%rFXPYL#^B)~=6e700wch;O7zzSk> zB<;|sWwaJT%I-Q!-zGOctKa@WVfnA1JPNI=Y;SY`MOZD9-uncTY~Tkjl1B`71~|>D z4|fd3vbzKVNk1Y^16ym@kM@QVub^VjJ1r<@9Xketm< zOz^@Vke?3S#*+bd-|a4d^0@oc8ur{fRDX4mQt1qNKSJ_+-*dszn{@B~gXVmNg6A;2 z{W0a`8N^!B)TI>E5otd}28@6;pukwz&`q4INVN!26p^MWTI=z1gJMYOevjr{nQGM` z8Em0!K(CkMF8qG#6@O?Cj3BHCVl%|%SfdETkT49#j7#Qr7XotQ8z(44Cy zSh`(Ju<-iSJ7Rh%HiDQOziE?-Rrttha#5GCG|Oz!=2${e4+*T^H&vG3ec-QVQsH4b{t6_8jdKv}7aW z`m5K7q6n=uYR@$3Yk{}VXCx2e8Inpz1bU8Q-Rv$V8?=Xu0&jOTfX z2+rU(&n`E)^vo>Pz+t23(pA6VhdWzSd&py#Kt!0En`3Tn?$Gb8*1kVC^fu;MYk!C1 z6^RBz+*6l0_uAWlnz(Ey1~{o|FT6w6Ujr|oUY>p62Vj5Kd?Em)lyaPj_2~#X1og$E zEgT1>)X@!zQp&r2{kp%hvaw4=DX70RW_OAmAZ@|F`}N XL~gkR_@Yae00000NkvXXu0mjf_qV%N literal 0 HcmV?d00001 diff --git a/core/img/filetypes/text-x-python.svg b/core/img/filetypes/text-x-python.svg new file mode 100644 index 00000000000..00755e6d0c2 --- /dev/null +++ b/core/img/filetypes/text-x-python.svg @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + From 4f525c864df7eb6caf1bc945c3c9e48b20bcce5e Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Wed, 14 Aug 2013 13:25:07 +0200 Subject: [PATCH 121/170] lazy load preview icons --- apps/files/js/filelist.js | 2 +- apps/files/js/files.js | 20 ++++++++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 288648693be..138329940b4 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -186,7 +186,7 @@ var FileList={ tr.attr('data-id', id); } var path = $('#dir').val()+'/'+name; - getPreviewIcon(path, function(previewpath){ + lazyLoadPreview(path, mime, function(previewpath){ tr.find('td.filename').attr('style','background-image:url('+previewpath+')'); }); tr.find('td.filename').draggable(dragOptions); diff --git a/apps/files/js/files.js b/apps/files/js/files.js index 180c23cbfa4..7b01a5202da 100644 --- a/apps/files/js/files.js +++ b/apps/files/js/files.js @@ -366,8 +366,8 @@ $(document).ready(function() { var tr=$('tr').filterAttr('data-file',name); tr.attr('data-mime',result.data.mime); tr.attr('data-id', result.data.id); - var path = $('#dir').val()+'/'+name; - getPreviewIcon(path, function(previewpath){ + var path = $('#dir').val() + '/' + name; + lazyLoadPreview(path, result.data.mime, function(previewpath){ tr.find('td.filename').attr('style','background-image:url('+previewpath+')'); }); } else { @@ -432,7 +432,7 @@ $(document).ready(function() { tr.data('mime',mime).data('id',id); tr.attr('data-id', id); var path = $('#dir').val()+'/'+localName; - getPreviewIcon(path, function(previewpath){ + lazyLoadPreview(path, mime, function(previewpath){ tr.find('td.filename').attr('style','background-image:url('+previewpath+')'); }); }); @@ -639,7 +639,7 @@ var createDragShadow = function(event){ newtr.find('td.filename').attr('style','background-image:url('+OC.imagePath('core', 'filetypes/folder.png')+')'); } else { var path = $('#dir').val()+'/'+elem.name; - getPreviewIcon(path, function(previewpath){ + lazyLoadPreview(path, elem.mime, function(previewpath){ newtr.find('td.filename').attr('style','background-image:url('+previewpath+')'); }); } @@ -824,10 +824,18 @@ function getMimeIcon(mime, ready){ } getMimeIcon.cache={}; -function getPreviewIcon(path, ready){ +function lazyLoadPreview(path, mime, ready) { + getMimeIcon(mime,ready); var x = $('#filestable').data('preview-x'); var y = $('#filestable').data('preview-y'); - ready(OC.Router.generate('core_ajax_preview', {file: encodeURIComponent(path), x:x, y:y})); + var previewURL = OC.Router.generate('core_ajax_preview', {file: encodeURIComponent(path), x:x, y:y}); + $.ajax({ + url: previewURL, + type: 'GET', + success: function() { + ready(previewURL); + } + }); } function getUniqueName(name){ From 79a5e2a4cced4787635632f3857fe1d88cf64c71 Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Wed, 14 Aug 2013 13:45:20 +0200 Subject: [PATCH 122/170] adjustments of video and web icon --- core/img/filetypes/link.png | Bin 850 -> 0 bytes core/img/filetypes/link.svg | 12 --- core/img/filetypes/video.png | Bin 1809 -> 1362 bytes core/img/filetypes/video.svg | 110 ++++++++++++--------- core/img/filetypes/web.png | Bin 0 -> 2284 bytes core/img/filetypes/web.svg | 47 +++++++++ core/img/web.png | Bin 4472 -> 0 bytes core/img/web.svg | 183 ----------------------------------- 8 files changed, 109 insertions(+), 243 deletions(-) delete mode 100644 core/img/filetypes/link.png delete mode 100644 core/img/filetypes/link.svg create mode 100644 core/img/filetypes/web.png create mode 100644 core/img/filetypes/web.svg delete mode 100644 core/img/web.png delete mode 100644 core/img/web.svg diff --git a/core/img/filetypes/link.png b/core/img/filetypes/link.png deleted file mode 100644 index 0e021d89f82366fecbb4896e852b958053125a16..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 850 zcmV-Y1FigtP)v1 zer!LTi9pAG#pjrh?{FhxjPxWRl6OY=245t7n{gKhu^~q3Rw807@$JKp5i2XAD(sIE zz@IZd0hh5n*1t~tSCxF{;rEC+YdUfQS_#-SEK2$oVk@@cZ)}h4!#EMY`2&kfn5*y@ zty%$bwRgz>!HQD<9{hwa@fufSB#KfNoXHGqXY8A(6EKy4tjmD(;iLF|v}Q3*R;;bl zn92&kPzur|J=fuOjex@y-+deVhdOQPRy?jj2_cNfd0t)P_OPOTbQV{l?n+$*v{(Lq z?X;{KdB^TzX$E79b~aqeO~K6)NI$;9ZY;sM2E?h2S4=|-H**4>lmHgsqU!y>&Yojo zg@E7iB)102#M3vmmE)Nk9}VKjuWK7{Z?2;qDP;REczXEV5}HlmV! zpZIMu^So$k!?>=r5!G$QsjV#e_2U4Z_8{Pw_{?v`nZqcxjTI@iRQq1=e-A>c52MU+ z+_AG=&W6nm$?K2f2sUWug`{IUYXt0VK;G;^5&=idzIZ;yvW)K<-FM37SF)0bawHBV z{R7w+g>@Twmb_L#G9Brfc#gx`7tQ-k<~$en#sW&&QI(=OYy4vpB0;0_K7P%567W9C coc|ra1xC@JLcf37!~g&Q07*qoM6N<$f<=LeVgLXD diff --git a/core/img/filetypes/link.svg b/core/img/filetypes/link.svg deleted file mode 100644 index b25013414ba..00000000000 --- a/core/img/filetypes/link.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - - image/svg+xml - - - - - - - diff --git a/core/img/filetypes/video.png b/core/img/filetypes/video.png index 13bf229fc45a63ba5866d77024bda31414aabbaf..045754df26fa90c64237a817fe5a151b1aa18ab7 100644 GIT binary patch delta 1269 zcmVY4+K#`qNunNbm79CAQB>Igt*Wkj8T+vmrUknl1cY;SDoXc`u5yA z?Y%@n;^7wkxYd9C_1Aw+b&HvCJ;Pns(fd>x#4gTQj)xW#l z0RWHF|)i^0LadrJGXiM{P{5HxV*fa0JMMpK~ry# z?9Onza*|y+Zhw?T0*S+dqFWxVTEf)^z1k8s8>CzUU}a@x>u+#-r6&X^%hIXpeVrnd zW%&bu1&z%s)&{ik-~`nAqqYHSLhR!ex@Q*QPNFwqp6Ak~ z+yQ~QuI=#Q!#_CZP*v)>769$Qk@%dc;k-g3bik2B8_*__ur@%q1oLnQ1jgfWxNzY@ zp9KdF97v-FLNr?AK@ACtr2%mgNg0?XmxD&h2l1 z$kxw4aew8DPtm#o0gUZs=#Hv}>lB!WJ0LI`jhw39KXL15G&&Or7#fsz%TpY=gY?!z z?0MiJ#-Du5=GR|>SzHFQNI+wM=}b5ecM^RT6h$%P)}kmn4@6gYcxaNMMad11J;BYd zze|4Sy{OmO78LE4U>@#(K$c}9(P$?`ge=Q?6Mw2#LfBT$%+NH$Egxk0nHM^BJjK|~Nt^4-v>#`uq>C}-Yu#|$BqEn{qU#z>T zXiBfZJlp{R=iH22os0JHAsX=}7e_HKm_XbJdJ2{JhxWC;X|@Req*+t zZ7+i&s0qF!aIIO;npx?+A8a|cdv1y1#+wkPJTNnCRKSP|sDUDcCPJB6=4b18Li{+1 z1Vm&n@c!!R>XXxoOyb9tm7TZ#QLL`6-m~MD2i_Bry=HcK@?|svZU9Cd!~ZG*Pyv_B ftb*>-?0Uvu3+(HXprTa400000NkvXXu0mjf?%Q`2 delta 1720 zcmV;p21ohQ3Xu+wZGQ%iNkl7fM7XGTb?RK|fc|l_Zm=TF_u8|N3n8iXI z!Xeto%bYe@1VWn032CGiNOQ@GBe8(PE*B0tt%Q^tK>>*iD}DkS5;!2C2nQoO#EBf) zAqHc2cXd}+&0*ZVZYMK4H}*-T?y9c$zE|&k^{SdkDe)zRet%K){|5(D062E+*k1<+ z2mcw1#RLElLPC@NSKpWJbneubQo^z*b&p78uBofnCuU^eMj~O05JF@!nT<>)v(7p9T-Sx?c^`XvdRQb9DRR!k9Pqser)IOoB8tJQ+%dGI_B zx~_*)AcWX)`}m-Ku2ZQLMn*;;gh07m#^T~4q?G9G?Zu%(hj94tVa&|TV0n2NLWls| zZ$b!g&Jm4915C9OpcA;;iNV1^3=a?E)vH%{`0ybZV<8Y#RWUR)gfnN(;P&m?SX^8T zIe*}Td!7f^bp!h$5_YfNe~-uG7#bSFlP6E`?Afyru>Z~&!<{>K@ZrM;jEsz6X=w>t zTU*<}g%F{|2HUVR4V@8@QsUI9Q>fKyn46n}>$-4V7mA{QF&6aw_Ta$-R4NsmK7BeE za~vn&LpK)f2JP$%A>g_$_V3@1=g*&q0DmuCx`g53VW_GK+qMHB#uy$wdW3X34aafd zx^A%Qop3@V^gs9tLI~{IwF}W`6y>M~@!G)2B~y|NecnS}h16P%4$6 zX&RErBsMlSLbiPed`#Ls*cnd8anRG#11TkHwOTOl*Nb*##EBCpaPHhWsHzIj^M6pQ z)c^pyckkYo&Thg7B=p(olge-F>+6tGB9Ta7b8{1%^MFtQP$(2|@7_J+^Z6jGd-v`I zfIzo90-evG5cw-^m)jtpwOS3;Y8A<360cvs4nW?%eT%zy?_zm*8QqdfrBJWeQLoo` z1m4C0DJ8bHwotFvgA(fRe?kc6=YQvs&1Nw_KOa=bYuB!A0|o%YFp$k=@%ZuM5LoB4 zla$ma-KS5VV45a4=i72MJ3EU;qk-}9@sNSe=8uh!kE79OV0L!)H}k(E34g6Qj)SSG zDfIRA;mVaO=CxI3(aOT6!x7su#JSj=0K->{`?s?Z{Ebr%nS}3IDr2C zegMGS+#HIi`go#l9wlfOBpZi^a|N z@89duXfz1`j^ork&$A+t$bVO=sv1&C*tWe60Gg(K-L`LX&Nl(*x~?aE+<=7bI&dSO z&!-q;tG*G=`L~?&Z!ODOmr{Z;wwll9Q;y@@=qOkrJHGv-Q($Wno>%Cw_b4U4-5=wLWqB-QmIVm zwac4oRP*DoowxR1fIOk9l1^(^UKLb=%g=JZY#bO~n(=?&$dg#zAl}gVjr9&zJ z*tY#su~__vl+xJF{V|<|((qqh_qFb~gb-pf#(pvk - - - + + + + - - - + + + + + + + + + + + + - + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + @@ -56,16 +51,35 @@ - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/img/filetypes/web.png b/core/img/filetypes/web.png new file mode 100644 index 0000000000000000000000000000000000000000..0868ca52747fcf3617e637c21636e448cc2979c2 GIT binary patch literal 2284 zcmViz=KkA;{%-(Z_~{=W@O1F)mX5Y|-xvl@pP-gV0x1FLUVS|sy~`=s zkc~r1LxW@Ga^=zAZoTu-{|R8zPo7+CrR--rI@?yAn~x00 z)$7O<7GWX@aY9#IAs72W@!a^kI+SPs#htT!#+S(3h2u zJGs=Gu`yl6^g?h1pvd+vMWkJ#=?T*99oS7-0OYh!b?6k9uqnU$S6Z%E&Gy>^ z&q7?wJ!j*s+w%j89e5)mjL~pryoi(xh7!vY_`$OrkKc!o(62C738dRedTaj$)+3Yih+# zWii@-0gRzq3z@7XDH-_>+`i@EC39=en~0?FwjxdE*u)fA0;3I?_C*w~x)wW=#z+lD zf;Jc>5JCVDP8117hv~ZRWqz3ITkvwNjJ*C5V~78Yn`HH0eSw3l?94k{aYCMnPiqFj3Xd7Wz}^wk3q6)0B_@jkq#~lWV56 zZyio1hp_6_3jqj0wsSc_@n0CF0E1QrDJAP~`3$L)#}m))Fp&g{Yf2$=r|_vr-`R0FiL~gBz}d` z(bw_Mo<_%VUK`w8JE@i)oJ=bkkW!K)2~iYr&FWQr?TdGCZQCR|4A9b_Jn;1P(nSCO zTIyF!Si(dBvN~B0qN>|!ltuY!}J+`#P*(DMO}t5hjVzNraIR zwv$FEFkuZH1?VWK9|tvb=+6So=t2nBb)5|xHe6RI6b=jw476B{;x^zl>JCqbw846(ceL)J53USW#MEC=+JKr!})6&V{~JxKHq{|E{E2d zAP6{m^r*jg@7_PgalBtjIpMnQla8j*^-GiIZ=g`QX(j?sgVrf9bVkCv-f0f#ub@=CwfKI1WdSycfUrr&piYzkh$x z^E`qeV9lB}eH%A!yk<_VdI(MZn;bRBVjyfN0BWcAJ-KV_g9Dpt@!0QTQ9hOE@_3@k z6`52LnN*TQl`DxZkH?~X$`aZ?e*Ac}cke6D@7}%p;h~|SU!Oa7PKIGfUteE-*|KF1 zHQwI9CDw$E(csRJGeUtyXtD^UO0lXIeQpIG7ZR#V4nyr?)gWH`{R>+jFvZ`FlfAUjPcu zkC>VBc>oO=Gv~nr0|S|SKL0{fQ`6FNx%}de9Xsxyx%O{-dy6@tdBYO`0000 + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/img/web.png b/core/img/web.png deleted file mode 100644 index bdc2f4a84a53f20d2501f8addd72d299b6f098fc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4472 zcmai12Q-}P)*iy>y|-YrQAdk1h7lQz&gen}VWN$}V3ZLPAzCC#5{clDq8(jCZxJne z2_b5PIC>4yF6W+m?z!i#`~Tls@Atjm-p{-Dv!AusUh9oDHP)r0=B5S!0Cajt1nT@N zaK0{60?*$@)V$&V0GY7+wQHt&*RBbe`uVuId$|GtDojz9Gd`0RtQxUCs8{T80UO=> zaUV)7&9B$+a2K@$^-^B1>9fCH9+wbafGWr4^H5AKR~49q5|x3+B$}TuF(6@rbU^3O z&-=}ldgk{f3iObn-`f}jMc2qJ=jsBT#mw96_kMmlcPo?4JwQbkd+lVATFArN*zmT^qlUHA3Xdy6h?~YH`~omCg7%*bR8XwSf_#0jGSeR;cLYMnm|fa=G+$rsm1(AYYFmSj5==zC^Ip{Zk4|zRlOblWsbJNIUpww4lyfvl z=a{`#>nOoCb(Pt`%|DYI^E+3p%JQIDUX?13r>{~Pv_MMIA<-6ir$*0E&D=o2Y0harCeJaCV`N6n;~tmV8)1S3LGlDl5FhHM#8Fpx7`+XZ-Xh~vWDo&n0LR)bKHMwBvD;2&rMy8Yb+(W1 z3grgczxehf4iC+Y6GO&s#GABr%qx(-%d9`RaUfdy=F;A23X3chI_oWEDAK7gp8@r? z(%z-Ur4RHvgac>jbMy)WKPh#yS${4mC=sU$>#mk}7}dSc)~m?Y{|&4ZRNc@T|5CUy z5|sG;>hw{gcHk7P_xg3j{j*lJ6|39V^H>OLjC)Po6VaQ-VT%em@f3Tt4f9Jckqf{i zb7<+z5#O@G{1oopAU@)UWxp6gjbEAjtXP>_%@K6QKIpmww*~m(y?7*9&c_B77HR8$ zK2OFj7Ks)(9S;DI2Dw|<;B1Txp)Nk&GETRAoLyz`-q>?A006^7&$r&LI41$Tw-?4A zidP5yj)0!;FU$~-!0!;8r#i^S$W-8(kDsf+6&X1hd5{LRfPetZ@0J@Bh0yuq`1zkY z=r#_Ag+d@fK|wM>3Nk)^Xo#GuswzZQ9wIL#2f;gGA#yUZkUt}zAB3IP2)*X# z>V)(0v+(ip(zu}Jj`8$&al*P@5QIVgj`$-b406HaFT8#)`Xc1t?EfEMoV(kWJv4Bme+)kRIZy1(GhnIyAvzl<#zE=}XPdmuC+9 zvA@#9d<0FBJLZYdFv-2)o}`S{${8ig8?9{g_Uy*E2v2bG6uD2dRW9@2&VK9eO-YU# z$dfJyzNK-nxiv^=?puciqSrHyG*0@a_^w@7#r|mQQ=bWHoCykVQXq9nkQw`Vbo9ZY zE|C2AB>I$KJ+QhEkZnr znIC(5B=g$>t=0`JWXzQH2WNdgC*V-arDR=D0oDD+bDVM{~s7i{8C4xV68 z3~QN@#FD5O+P?;#siu5T!P4}ZaM?i*z@!9c3curi1Sci^*?&I3_9Gp?Ja+dan7Qqj zKl6)nLx_}G8l`b_3v`r`jg^U4{qoo@q^T>%BSEnr?QYAs=MgKx(IFO}QgeC&!JLUu z)bqxkftu0uWvyvmVXJS&QmEEc#ixEreA?3-H<}dDqWvsyx62GwVXKeZe)wV)p z6ny7p>i+$!rg%a{q9lg_lir)-0}jYi(fIJCrit}%HY(a6J(_H$4c!~zib?wQD(3k^ zl`e<+wO5CR-IGyzeh*09rPnNirtDBFJYcN7pTDZ}Cn?)3h9u<>{ag9$(EVw%CYL!a z@pNOj#G@|V@E7;5YSxXgIMZeFL>n}PFRiOtScYi8gOmI`JQ?*q8GIm~SZF9Ci4W3N z^tyLl!Il!2W&Pm&af7cV$R$$9u#UiFaI zvhO7QORM6~e$&~XY4k!Jfp@iwq@ATQW%WOF)A6q#E_d~&D;tFVSl6b=F(n$ME8SnZ zg}T#8alo;pOR93Ue8TSVMk$T$7j&>cc%36FeF6(8T%0Oh7$ zQpu#SX?Vn{z$hkTznf9O7VpuT!dnTv%sksZ%V6al{E9qn=9xHam!fp1s1tyg^B`Wl zW+4RSY@00Xefi7FWLQCiu}qqQrG zMetK@ip6R{qLG-1^Eaktsi8I1PbeJiBQnHH71BuA++*2DSnQ?}ym^%`tuM>Gr8OWg z!X)|E$eYn&6%0Of)zWHttd&sy8vdx7t)WN1WSwsHjER;LUG1~8c|)%A!tWw zr(B_MD?L)f4M?r~SiHkw&9Vy-$CW}Jkkec{_blkW1~0_uOa(u>Ev3kZ-rutKQV z<5;@16H6u7;_?z0^mP+gw-4edjjAzI(3)i1fVRqU>BMQ?+t1uOznTjV(~1)#u`yq; z^2||`mq^nhBU|@+)J*B6pX90bS-&%5x79z1V9* zXqXe@Gu*yzW%uGqe$Rrbi)wN!8Aw1bF)BZW)yG5WLD=)c=J))};FD!bGmBv=RI&v$ zAf~6w$yviuC+4!ULNh5xbmUhqvF3jKBDd={V-P;W;+QWDJk*e`JXkT)@D!(J;uZ{~ z>TZ_kc7_=u^ll=h*Ct2F#G0=oXInY7#Fs6LvT2GPuikjA+2@s6P{UOIMt5#e0;su` zPEnF^SW%;*7L%rX5Aoq^!&VjDZnpx1X*$MS@D35dD&63#+BFE=_8NY~+Cn|JC1&`+ zHf&v`Q|TsGzGufoU$QwT1<_oVMW`s;>^4$7r(gUMBZ(l>Yw&Wf15&f&QJNz29vSmP zBjhdIWHjBY0txjWJ2OLF_Rs9tuP7|m+(q-KewKNvLL@ji3~+i!$UO~i&kcX8so^Hs zEth7f^F>_>6e|Um3*F~jP|^}v)S7=;@<3|@(e=Sod~hqk!^=UBqz4^|AWv-iwwRv3 zu|@Iyr?#AYoA9+m#AWde$y|-3OntA1A@%2MUs|fo#hbd{s z5Shf(OjkWtRJiMXvzBAEZ~?ZC_dbaGaFgD;nMg#V(fPS(HuaND_TN7Bn^U=flg~=# zPI?xr>%mdfSW-|hKZTWyNur?qq;n@M`%8~5BO^BkS%P}C-FbhZ$MF3<8^0^&&h7RO z2J(@;?l;=ZMGY!i$5-%aE5dE{~9|c%-(RHRaLTUP}2ayUNmpp#wN@N zTztP~vym-vS3?*JPDKn5uEDB;9 zEdT;e9k&&`--8sDm5xD z3{})2Z{BulG_b3Uymf_yv|=uVLGNbRWl9n<8{|!6l164w66FXDa#)d@hsS^Cu$~ka zD`{?RJyz%Ut^278I4eFzldAScN!p^~Hw_+qabx6sa{X*z^k=dvCU6M5VRp3bJT|-j z0Mkfbon;$)p; zibBdL*`6e^$>K(TdsHMv*TeWE8%Zh+FRP+^-xEw+8hb|(u~gu>;-ws&E?QAmdR`bp z**-|xwZgW_`2%(E$0yRgq5G@B@AmoN@i9zib3_<4$ReJl>WQ&|#nlWh{1G{%lt0yc z>yB(Tx9m)6n)L_yE94_q3&9GS#poU-vc+dP-)wV)yTS@ZcvUvvm7O}kmwC9j#C^$= zyMzORf@T<|3lER@)B?d_{7|1(#$yAKUs18zFS*`!8!D;d4+K6e+qfJRt$afsvlB;* ziK+C+%PiXDEP$Y6{jG-CU!@HDIoVu#TOuinrs}fJ1S6(3!jJJ|L$3{#NygV!S9>s1 zwE;YtcSeSW=64(&1WEFmTMmKQZ=z8}?7VRuqqmg`Ep`sM7=u{|;aOgF1rA16uIP=k zzsECi4w#Y7Tt3>(${qU=ID_BK2>O(en7GZiIe9J$4Lu)pw{Eo1`p%^>GmJjx2K{V3 zS!bC6o8}!(CmCLPbo}*u*&s_vHm)a+Su$l598%mm`e=v8p9$74-BR_925CZI!e*L+!zc%?$%C>xgzR>~l^kZ0ITNBOoYN3KD`*m8ax2e*m)=v>S zk>m5J+A~3Awy5!YdF6qstvWi1_gtT#s|iQ@zIVe=UTYI?KZb^cOb-M!9Ja->Fz~Bj fZ$jD^##iAE!=tD$;plG{cO5-#V??pm&Aa~qFUaxB diff --git a/core/img/web.svg b/core/img/web.svg deleted file mode 100644 index bc6c6bde650..00000000000 --- a/core/img/web.svg +++ /dev/null @@ -1,183 +0,0 @@ - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From 320bf0e8c1fda9560d2ec6046153eeef59c7da1e Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Wed, 14 Aug 2013 16:19:02 +0200 Subject: [PATCH 123/170] fix breaking error due to ... a wrong icon link. Seriously? --- apps/files/templates/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/files/templates/index.php b/apps/files/templates/index.php index 89604c4fa0b..8598ead2404 100644 --- a/apps/files/templates/index.php +++ b/apps/files/templates/index.php @@ -10,7 +10,7 @@ data-type='file'>

    t('Text file'));?>

  • t('Folder'));?>

  • -
  • t('From link'));?>

  • From a255cc60075e9dab831754ff09cb522c37ea421f Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Wed, 14 Aug 2013 18:48:30 +0200 Subject: [PATCH 124/170] fix adding preview-icon to clss attribute --- apps/files/templates/part.list.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/files/templates/part.list.php b/apps/files/templates/part.list.php index ab1b91167db..e3420ca14cb 100644 --- a/apps/files/templates/part.list.php +++ b/apps/files/templates/part.list.php @@ -25,7 +25,11 @@ $totalsize = 0; ?> data-mime="" data-size='' data-permissions=''> + +
    style="background-image:url()" @@ -34,13 +38,13 @@ $totalsize = 0; ?> $relativePath = substr($relativePath, strlen($_['sharingroot'])); ?> - style="background-image:url()" class="preview-icon" + style="background-image:url()" style="background-image:url()" - style="background-image:url()" class="preview-icon" + style="background-image:url()" style="background-image:url()" From cba0f696226d344e5caf25631eefb92213c8b6c2 Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Wed, 14 Aug 2013 20:41:20 +0200 Subject: [PATCH 125/170] increase row height to 50px, properly position everything, checkboxes, actions etc --- apps/files/css/files.css | 145 ++++++++++++++++++++++------- apps/files/js/filelist.js | 2 +- apps/files/templates/index.php | 25 ++--- apps/files/templates/part.list.php | 5 +- core/css/styles.css | 2 +- 5 files changed, 133 insertions(+), 46 deletions(-) diff --git a/apps/files/css/files.css b/apps/files/css/files.css index c66484db536..de7be0a6a22 100644 --- a/apps/files/css/files.css +++ b/apps/files/css/files.css @@ -64,7 +64,7 @@ #filestable { position: relative; top:37px; width:100%; } tbody tr { background-color: #fff; - height: 44px; + height: 50px; } tbody tr:hover, tbody tr:active { background-color: rgb(240,240,240); @@ -79,8 +79,9 @@ tr:hover span.extension { -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Op table tr.mouseOver td { background-color:#eee; } table th { height:2em; padding:0 .5em; color:#999; } table th .name { - float: left; - margin-left: 17px; + position: absolute; + left: 55px; + top: 15px; } table th, table td { border-bottom:1px solid #ddd; text-align:left; font-weight:normal; } table td { @@ -89,17 +90,33 @@ table td { background-position: 8px center; background-repeat: no-repeat; } -table th#headerName { width:100em; /* not really sure why this works better than 100% … table styling */ } -table th#headerSize, table td.filesize { min-width:3em; padding:0 1em; text-align:right; } +table th#headerName { + position: relative; + width: 100em; /* not really sure why this works better than 100% … table styling */ + padding: 0; +} +#headerName-container { + position: relative; + height: 50px; +} +table th#headerSize, table td.filesize { + min-width: 3em; + padding: 0 1em; + text-align: right; +} table th#headerDate, table td.date { + -moz-box-sizing: border-box; + box-sizing: border-box; position: relative; min-width: 11em; - padding:0 .1em 0 1em; - text-align:left; + display: block; + height: 51px; } /* Multiselect bar */ -#filestable.multiselect { top:63px; } +#filestable.multiselect { + top: 88px; +} table.multiselect thead { position:fixed; top:82px; z-index:1; -moz-box-sizing: border-box; box-sizing: border-box; left: 0; padding-left: 64px; width:100%; } table.multiselect thead th { background-color: rgba(210,210,210,.7); @@ -107,27 +124,41 @@ table.multiselect thead th { font-weight: bold; border-bottom: 0; } -table.multiselect #headerName { width: 100%; } +table.multiselect #headerName { + position: relative; + width: 100%; +} table td.selection, table th.selection, table td.fileaction { width:2em; text-align:center; } table td.filename a.name { + position:relative; /* Firefox needs to explicitly have this default set … */ + -moz-box-sizing: border-box; box-sizing: border-box; display: block; - height: 44px; + height: 50px; vertical-align: middle; - margin-left: 50px; + padding: 0; } table tr[data-type="dir"] td.filename a.name span.nametext {font-weight:bold; } table td.filename input.filename { width:100%; cursor:text; } table td.filename a, table td.login, table td.logout, table td.download, table td.upload, table td.create, table td.delete { padding:.2em .5em .5em .3em; } table td.filename .nametext, .uploadtext, .modified { float:left; padding:.3em 0; } -.modified { + +#modified { position: absolute; - top: 10px; + top: 15px; } +.modified { + position: relative; + top: 11px; + left: 5px; +} + /* TODO fix usability bug (accidental file/folder selection) */ table td.filename .nametext { position: absolute; - top: 10px; + top: 16px; + left: 55px; + padding: 0; overflow: hidden; text-overflow: ellipsis; max-width: 800px; @@ -135,28 +166,58 @@ table td.filename .nametext { table td.filename .uploadtext { font-weight:normal; margin-left:.5em; } table td.filename form { font-size:.85em; margin-left:3em; margin-right:3em; } + /* File checkboxes */ -#fileList tr td.filename>input[type="checkbox"]:first-child { -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; filter:alpha(opacity=0); opacity:0; float:left; margin:.7em 0 0 1em; /* bigger clickable area doesn’t work in FF width:2.8em; height:2.4em;*/ -webkit-transition:opacity 200ms; -moz-transition:opacity 200ms; -o-transition:opacity 200ms; transition:opacity 200ms; } -#fileList tr td.filename>input[type="checkbox"]:hover:first-child { -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=80)"; filter:alpha(opacity=80); opacity:.8; } -/* Always show checkbox when selected */ -#fileList tr td.filename>input[type="checkbox"]:checked:first-child { -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; filter:alpha(opacity=100); opacity:1; } -#fileList tr.selected td.filename>input[type="checkbox"]:first-child { -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; filter:alpha(opacity=100); opacity:1; } +#fileList tr td.filename>input[type="checkbox"]:first-child { + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; + filter: alpha(opacity=0); + opacity: 0; + float: left; + margin: 32px 0 0 32px; /* bigger clickable area doesn’t work in FF width:2.8em; height:2.4em;*/ +} +/* Show checkbox when hovering, checked, or selected */ +#fileList tr:hover td.filename>input[type="checkbox"]:first-child, +#fileList tr td.filename>input[type="checkbox"]:checked:first-child, +#fileList tr.selected td.filename>input[type="checkbox"]:first-child { + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; + filter: alpha(opacity=100); + opacity: 1; +} +/* Use label to have bigger clickable size for checkbox */ +#fileList tr td.filename>input[type="checkbox"] + label, +#select_all + label { + height: 50px; + position: absolute; + width: 50px; + z-index: 100; +} +#fileList tr td.filename>input[type="checkbox"] + label { + left: 0; +} +#select_all + label { + top: 0; +} +#select_all { + position: absolute; + top: 18px; + left: 18px; +} + #fileList tr td.filename { position:relative; width:100%; -webkit-transition:background-image 500ms; -moz-transition:background-image 500ms; -o-transition:background-image 500ms; transition:background-image 500ms; } -#select_all { float:left; margin:.3em 0.6em 0 .5em; } + #uploadsize-message,#delete-confirm { display:none; } /* File actions */ .fileactions { position: absolute; - top: 13px; + top: 16px; right: 0; font-size: 11px; } -#fileList .name { position:relative; /* Firefox needs to explicitly have this default set … */ } #fileList tr:hover .fileactions { /* background to distinguish when overlaying with file names */ background-color: rgba(240,240,240,0.898); box-shadow: -5px 0 7px rgba(240,240,240,0.898); @@ -166,19 +227,39 @@ table td.filename form { font-size:.85em; margin-left:3em; margin-right:3em; } box-shadow: -5px 0 7px rgba(230,230,230,.9); } #fileList .fileactions a.action img { position:relative; top:.2em; } + +#fileList img.move2trash { display:inline; margin:-.5em 0; padding:1em .5em 1em .5em !important; float:right; } +#fileList a.action.delete { + position: absolute; + right: 0; + top: 0; + margin: 0; + padding: 15px 14px 19px !important; +} +a.action>img { max-height:16px; max-width:16px; vertical-align:text-bottom; } + +/* Actions for selected files */ +.selectedActions { + display: none; + position: absolute; + top: -1px; + right: 0; + padding: 15px 8px; +} +.selectedActions a { + display: inline; + padding: 17px 5px; +} +.selectedActions a img { + position:relative; + top:.3em; +} + + #fileList a.action { display: inline; margin: -.5em 0; - padding: 16px 8px !important; -} -#fileList img.move2trash { display:inline; margin:-.5em 0; padding:1em .5em 1em .5em !important; float:right; } -a.action.delete { float:right; } -a.action>img { max-height:16px; max-width:16px; vertical-align:text-bottom; } -.selectedActions { display:none; float:right; } -.selectedActions a { display:inline; margin:-.5em 0; padding:.5em !important; } -.selectedActions a img { position:relative; top:.3em; } - -#fileList a.action { + padding: 18px 8px !important; -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; filter: alpha(opacity=0); opacity: 0; diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 138329940b4..3a6b118ec9c 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -17,7 +17,7 @@ var FileList={ "class": "filename", "style": 'background-image:url('+iconurl+')' }); - td.append(''); + td.append(''); var link_elem = $('').attr({ "class": "name", "href": linktarget diff --git a/apps/files/templates/index.php b/apps/files/templates/index.php index 8598ead2404..714ff497f9d 100644 --- a/apps/files/templates/index.php +++ b/apps/files/templates/index.php @@ -63,17 +63,20 @@
    - - t( 'Name' )); ?> - - - - Download" /> - t('Download'))?> - - - +
    + + + t( 'Name' )); ?> + + + + Download" /> + t('Download'))?> + + + +
    t('Size')); ?> diff --git a/apps/files/templates/part.list.php b/apps/files/templates/part.list.php index ab1b91167db..93d1aaf9dca 100644 --- a/apps/files/templates/part.list.php +++ b/apps/files/templates/part.list.php @@ -47,7 +47,10 @@ $totalsize = 0; ?> > - + + + + diff --git a/core/css/styles.css b/core/css/styles.css index 0dd66fb5b7c..db7f01cfebd 100644 --- a/core/css/styles.css +++ b/core/css/styles.css @@ -142,7 +142,7 @@ a.disabled, a.disabled:hover, a.disabled:focus { .searchbox input[type="search"] { font-size:1.2em; padding:.2em .5em .2em 1.5em; background:#fff url('../img/actions/search.svg') no-repeat .5em center; border:0; -moz-border-radius:1em; -webkit-border-radius:1em; border-radius:1em; -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=70)"; filter:alpha(opacity=70);opacity:.7; -webkit-transition:opacity 300ms; -moz-transition:opacity 300ms; -o-transition:opacity 300ms; transition:opacity 300ms; margin-top:10px; float:right; } input[type="submit"].enabled { background:#66f866; border:1px solid #5e5; -moz-box-shadow:0 1px 1px #f8f8f8, 0 1px 1px #cfc inset; -webkit-box-shadow:0 1px 1px #f8f8f8, 0 1px 1px #cfc inset; box-shadow:0 1px 1px #f8f8f8, 0 1px 1px #cfc inset; } -#select_all{ margin-top:.4em !important;} + /* CONTENT ------------------------------------------------------------------ */ #controls { From e5761d90ef223a04205ad93eea7706439ef0b60e Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Wed, 14 Aug 2013 20:49:47 +0200 Subject: [PATCH 126/170] fix deleting old previews after file changed --- lib/preview.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/preview.php b/lib/preview.php index 92cc87c5897..293accb188a 100755 --- a/lib/preview.php +++ b/lib/preview.php @@ -592,7 +592,7 @@ class Preview { if(substr($path, 0, 1) === '/') { $path = substr($path, 1); } - $preview = new Preview(\OC_User::getUser(), 'files/', $path, 0, 0, false, true); + $preview = new Preview(\OC_User::getUser(), 'files/', $path); $preview->deleteAllPreviews(); } From 623f9ec817490c93e8abf0825bab372acf08c29e Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Wed, 14 Aug 2013 21:20:03 +0200 Subject: [PATCH 127/170] don't generate previews of empty txt files --- lib/preview/txt.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/preview/txt.php b/lib/preview/txt.php index 89927fd580a..c06f445e827 100644 --- a/lib/preview/txt.php +++ b/lib/preview/txt.php @@ -17,6 +17,10 @@ class TXT extends Provider { $content = $fileview->fopen($path, 'r'); $content = stream_get_contents($content); + if(trim($content) === '') { + return false; + } + $lines = preg_split("/\r\n|\n|\r/", $content); $fontSize = 5; //5px From b2f666c98f462da43168ae93a39c8dc886ba847e Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Wed, 14 Aug 2013 21:26:06 +0200 Subject: [PATCH 128/170] fix file summary position --- apps/files/css/files.css | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/apps/files/css/files.css b/apps/files/css/files.css index de7be0a6a22..4f2f10da4dd 100644 --- a/apps/files/css/files.css +++ b/apps/files/css/files.css @@ -281,9 +281,8 @@ a.action>img { max-height:16px; max-width:16px; vertical-align:text-bottom; } .summary { opacity: .5; } - .summary .info { - margin-left: 3em; + margin-left: 55px; } #scanning-message{ top:40%; left:40%; position:absolute; display:none; } From 2fd5178a0049abc474da551dbdb2ac71fc49dec1 Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Thu, 15 Aug 2013 12:50:26 +0200 Subject: [PATCH 129/170] adjust New file dialog for new styles --- apps/files/css/files.css | 7 +++++-- apps/files/js/file-upload.js | 2 +- core/img/filetypes/web.png | Bin 2284 -> 2254 bytes core/img/filetypes/web.svg | 24 +++++++++++------------- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/apps/files/css/files.css b/apps/files/css/files.css index 4f2f10da4dd..20eb5fd083f 100644 --- a/apps/files/css/files.css +++ b/apps/files/css/files.css @@ -22,7 +22,10 @@ #new>ul>li { height:36px; margin:.3em; padding-left:3em; padding-bottom:0.1em; background-repeat:no-repeat; cursor:pointer; } #new>ul>li>p { cursor:pointer; padding-top: 7px; padding-bottom: 7px;} -#new>ul>li>form>input { padding:0.3em; margin:-0.3em; } +#new>ul>li>form>input { + padding: 5px; + margin: 2px 0; +} #trash { margin: 0 1em; z-index:1010; float: right; } @@ -189,7 +192,7 @@ table td.filename form { font-size:.85em; margin-left:3em; margin-right:3em; } height: 50px; position: absolute; width: 50px; - z-index: 100; + z-index: 5; } #fileList tr td.filename>input[type="checkbox"] + label { left: 0; diff --git a/apps/files/js/file-upload.js b/apps/files/js/file-upload.js index 942a07dfccc..02e940aa3c4 100644 --- a/apps/files/js/file-upload.js +++ b/apps/files/js/file-upload.js @@ -221,7 +221,7 @@ $(document).ready(function() { $(this).data('text',text); $(this).children('p').remove(); var form=$('
    '); - var input=$(''); + var input=$(''); form.append(input); $(this).append(form); input.focus(); diff --git a/core/img/filetypes/web.png b/core/img/filetypes/web.png index 0868ca52747fcf3617e637c21636e448cc2979c2..c380231264555a13531b8fc6b1ed9d5c1f533a4e 100644 GIT binary patch delta 2167 zcmV--2#ELW5zY~iZhuQjL_t(og~gX^Y#h}U$A5QbcGq6N*3ZO_V~04zNuWt+d8VMM z5rUSs2#QDvQcHyZ7u2GZK4_(WXg^fqoj#&UQ7ckDw9pdhLs1LDsDdaoO&ZaHNP-gx zwu58G>s{}9*Ympfo_^T1afoT5t;9%wjb=wP=XcNfpEGxrh=1^59?pjv9q|5}hi=>c zY>RmDa^BQ(SzJ7J?gT70>-xA#NlRZ7waqdx3`I?rF)@J39a+K8IxFphz zzK!BwI#)+TqiwPijsna|fA8=oN6(TO-vI(ZCS z2e+n{mUS0W+tP`I8lsrq8jtjBes*MN=Ew*Of#l5i-U^|G=CDt_~UQW+}KL}$(Jc)vr~So zzx&LO?)~{4?VJe{n0*j>`s`C2w$db&uEpQL@`<>+#OxHLn$eHp2yW|V-N zNKsjb5Kd>&YtmpWXbVP2HMHQmwUoz3$sIjJ)>_tdbvBnu$9@m=|Hlkm z_nn>JY-(F}{%FA~FY70AYAKUWDjVIg>4rP{-xENqDev?=;{mR}-a1pE(;_?i}FXQLNiGSP%T-U4LxcSDevj8ITmutM5D5@Aq&(5Hn zL}gW_B95D?1dkWWR#mwU3)5VZI7Ls|V2ywk#9BlItYs!UMk=$^F^)O+Y!5`HTU$4+ zt4>ZfbdadaaQfxv39_fK+AbP&Axtu|0cv z?R2G`D?Wiz_LOqOwPyjuVowqj%OsYjtXLet0?Ku1=su6~#2bXuS;AtLWJ4>Nl^gNW z4QBu-Cy6*NT5CRi^_8S*l03S5kbi%SRea?L1T(qFlW_h^IbQ-}Wz_hkz{C+^Y$fH| zRt%?waC#DJEMh9-cIwD}!s)5AN&ya9YoaLP^2;veD_gJOqV5D(!5Tvxlw-j;b{4=( zzkMWUb$Qwb0XB-}9WSv(Vog-cRcdJ}ipxbNUwMJtk^R_6&jX0HXswCkn13(~*|`3E z?)>7lY&s`_#1URHSv>sW)2GfhAz-zAPJ$c~`bZeex0ls|SCc`Eyh{}jtK}VoilDWg zR~Uw@TDg+DZn=R^tVyGUzb-ll04%{Hjz2nPLmwN?RuqNUSW~y8ALS&m#$p#_B9-Z0 z09rBJTn6SKf*_!)tCKr#y?;qQx2dmhU|=A%D8Qj7e>`fn|5Nc#l_m7C!R)*gE{)wA z5mRYXTg?L2#mspi(pYQe0p1Of$z;?`TefU$X=!BDAxl8Q^)oK3Z)eFUF)dHbX6NcKrGjtbBZtBbUk4hB7Y)SYv*N*K`BKX z$MV!uPraJUNgy#kbm%UL#wO-gFTpG}C?jEj!a;P1=m;-SSItnlBEO7O z1I=Z?7(+6d#Bm&a-=|P0P$(2wyLRoGR4R4ITTluIZ~=GX@ZO2K)~*L?GxlDkTRN1R z0@p=3P6b2^^-I=36n|m~s~ND>`TtG{>gwvS))E8(M~@yY4-O9gF^ZynTI;DqB2h>r z5|i)V5zTE7<;}gn+0(l6f>+x6FWc^z`aVTnt#Vu%+gGE*5}sRw4a)O_s4|Q!)>P&| zGMVJ1{Rd3f(hl9!)RbDidUf5wg9leX_~3(I1tK66k$BF8dVhi9x%1SUFOMGm^UrRc zEsgHflFiy^1_?tvCsj>(siHGVVDLPT!-tPVFZ|{CNB8a9HOs`7!^xAs21bNuzaH_t{Bzm8P?L~Qff*yM{kF2*`8#<9s4W1G)L zDu2RJwtW2f@qch|@VP(i+O_Nck&%&Ko<4nA2SLE9RjZm-tXOehb@g&a7t9^iZb&SU zw?Ho7HZEP=T+`mwm8fl63K08+@nCXntT;ZD-?nYrL9O-QcI?=3E1-LOd)?b_zx}}G z&6}6`zR&RR@YMeO`#0^}xpN2>*%gb32DDNtsNSE0m~bE7RQH10JXq70@zZi zw0-yP-8<$=IXpZZPfkugF*7r>t+BDujiSh1;I;Sv-%u%~ssZOZX72h7fT~0mym(+> tpth;0X-|E9eQ!RW|I_yE+wY#c_b;%5#fX%|9&7*r002ovPDHLkV1hDKHd6oq delta 2198 zcmV;H2x<4u5$q9=ZhvV>L_t(og~gY9j9gV6$3N%3=C$3~oqcq>yM53uizQ7i&|0)hlX2!s;Frln9T2wF<%Yq#rm zx3fF5J3Dvo>pc8pX1BX-O^TW@$v1OvZtnek?)UdS=bj^sF@JoNKkFl{4mkhKO`CVT zTrf_uSU92=z(_MJqk4wszkb22Y=$mPi6A0q9}NYV+g6>MC}z$?0xOqA$&l*ENw6*K zbcVv!>&O%qVIm1}LRVZN7yCi+-1xgXly~j3h2uJGs=Gu`yl6^g?h1pvd+vMWkJ#=?T*99oS7-0OYh!b?6k9uqnU$S6Z%E&Gy>^&q7?wJ!j*s+wtR*QK`48N_<>4iBYtEa9r0}*PP3PFe6j%bI4Vm^u6t21! zJCnvp4Mu`C7$p!w01!?T2}XzMy6$E`;ExQFRHvy79-Rdlo0uZo)74=tXDhJfk`AaO zxqoG{T*hdP(FP~oM1I+7upEriXxUIKF^&G~NaCei@N%t;y#5knhyRS5YbDjXh^}?F zVtW~kHW;m`OidHls_QSAfzNLKVL@5$d!waFr^&VBWOHOYdP%jmV>uSWuFJ9oSdF(A zb&Dtdd5~Ih1dPEkidb8qHCh=g+e3u`R(~poXA;`8_PA%;SH1N34@&b|5Sw6e9K;#B zxtrXQRkKBn(rCakrk)8s7eEk9jNp$A&-VL1gU%%vNlaHIf_WPrioSW#Tk&0E-cY*uAR7AqIPZ=BQ>(-pD!-!Kr_X4qDXwd z?vm1ItpV7$;Z8Q+b|Whb0vS}XoHXe|FAEl5gOVELB}PGF^e|D?&ldVq>9!?=rPGv; z|BbjZhLdZiwQn6xCWo-<)(Zg$L4US$IYIGX7^MJ%Rt700>u>oCsg%bP&+g^zkrUXd zW`q{RVa3Pj;fny2HfIQ`p-RUH$0gIYoXL}Kprs_PlqnrONK4;3-0XsR0Jhgee%V@7 z9ASGI5MxLwky3Kw4WGpGJbv}miyTRMP)UpxR713xoswr;aNz0fB`y6)9e;-CI41F@ ziKizpN`uxUeudJ}*YVGuM#pkq8{Awwsg@p`Oe-3YQj#PIQ512_>Q#L0i+6Bs+ax*+ z(9)kg@bvc5MF0R=>Q_uy!bAbGI#~~*s@rOmMg}#ePW_$o@x$|ic>Y*p5VHR0F1oPQ5MxZMiQjOZx9ansnghfxVesYc4{VRLis^BkxLv@Y~{ z2WB9`Fr<6YLN?#C-hBEBJ~1#bkh&zm;otxKjF!PKOmNmWQAn=iN(440i7_(4NQF@f z+igN63LV#_W*}mT)@l~uLWq`pv)K6gyFOkh6#g`1?An zU@1eUc@ZXw(Mg1n5w?>?C@^6S9R=tps2>M4bm-3l%;-W0*L9r@8#Y{5C=?D13=Fhb zjp8=oHRO&SJA9vsN5*tmgCwatki-ZhXkK_VI%*UP8Vdc{bE7p%saXen3|em<;s;GOMj(Ohn+dCumBsd$Byh9%e8esl4;T3L8d!R5`ksmWDDrfZw$lv zYZ+s7W2!#if?O_#)|wy)IC}J`zjyE6KgMyqUrIUQy6%+gy2T6k1v9G?b8_EPFSIRR z`%dACwT}rQS2%9L%j6cKgDOH;n8vrDQ5}rI7>!mIQc66}9u4hbUb~5<<+|8wLsxG z4o8l>7r*wWSD)Cwe}B>QJc1x#&6+iR8#iveW=^eo2u=N)95u*dAZ#cAYNz)-xohl$ z1Dk5`*zaOdK7WD0x zH#ggH9NTlUcKLflQC|QG&X1Ux^LYRb88hd>0|Nt@d_Mm|Q&ZE@a=HBCjvYJhpSkvL Ye0z&Ip$~b(6951J07*qoM6N<$f=SFb?*IS* diff --git a/core/img/filetypes/web.svg b/core/img/filetypes/web.svg index 6ea49d59fb4..67775a2233b 100644 --- a/core/img/filetypes/web.svg +++ b/core/img/filetypes/web.svg @@ -14,34 +14,32 @@ - + - + - + - + - - - - - - - - - + + + + + + + From 7fe9320ffe60d9f8346f424a235bbc51c99f9484 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Thu, 15 Aug 2013 13:20:31 +0200 Subject: [PATCH 130/170] improve unknown backend --- lib/helper.php | 33 ++++++++++++++++++++++++++++++++- lib/preview/unknown.php | 22 +++------------------- 2 files changed, 35 insertions(+), 20 deletions(-) diff --git a/lib/helper.php b/lib/helper.php index b74e4c4512e..6552bcce703 100644 --- a/lib/helper.php +++ b/lib/helper.php @@ -188,7 +188,38 @@ class OC_Helper { * Returns the path to the image of this file type. */ public static function mimetypeIcon($mimetype) { - $alias = array('application/xml' => 'code/xml'); + $alias = array( + 'application/xml' => 'code/xml', + 'application/msword' => 'x-office/document', + 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' => 'x-office/document', + 'application/vnd.openxmlformats-officedocument.wordprocessingml.template' => 'x-office/document', + 'application/vnd.ms-word.document.macroEnabled.12' => 'x-office/document', + 'application/vnd.ms-word.template.macroEnabled.12' => 'x-office/document', + 'application/vnd.oasis.opendocument.text' => 'x-office/document', + 'application/vnd.oasis.opendocument.text-template' => 'x-office/document', + 'application/vnd.oasis.opendocument.text-web' => 'x-office/document', + 'application/vnd.oasis.opendocument.text-master' => 'x-office/document', + 'application/vnd.ms-powerpoint' => 'x-office/presentation', + 'application/vnd.openxmlformats-officedocument.presentationml.presentation' => 'x-office/presentation', + 'application/vnd.openxmlformats-officedocument.presentationml.template' => 'x-office/presentation', + 'application/vnd.openxmlformats-officedocument.presentationml.slideshow' => 'x-office/presentation', + 'application/vnd.ms-powerpoint.addin.macroEnabled.12' => 'x-office/presentation', + 'application/vnd.ms-powerpoint.presentation.macroEnabled.12' => 'x-office/presentation', + 'application/vnd.ms-powerpoint.template.macroEnabled.12' => 'x-office/presentation', + 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12' => 'x-office/presentation', + 'application/vnd.oasis.opendocument.presentation' => 'x-office/presentation', + 'application/vnd.oasis.opendocument.presentation-template' => 'x-office/presentation', + 'application/vnd.ms-excel' => 'x-office/spreadsheet', + 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' => 'x-office/spreadsheet', + 'application/vnd.openxmlformats-officedocument.spreadsheetml.template' => 'x-office/spreadsheet', + 'application/vnd.ms-excel.sheet.macroEnabled.12' => 'x-office/spreadsheet', + 'application/vnd.ms-excel.template.macroEnabled.12' => 'x-office/spreadsheet', + 'application/vnd.ms-excel.addin.macroEnabled.12' => 'x-office/spreadsheet', + 'application/vnd.ms-excel.sheet.binary.macroEnabled.12' => 'x-office/spreadsheet', + 'application/vnd.oasis.opendocument.spreadsheet' => 'x-office/spreadsheet', + 'application/vnd.oasis.opendocument.spreadsheet-template' => 'x-office/spreadsheet', + ); + if (isset($alias[$mimetype])) { $mimetype = $alias[$mimetype]; } diff --git a/lib/preview/unknown.php b/lib/preview/unknown.php index ba13ca35d66..9e6cd68d401 100644 --- a/lib/preview/unknown.php +++ b/lib/preview/unknown.php @@ -16,27 +16,11 @@ class Unknown extends Provider { public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) { $mimetype = $fileview->getMimeType($path); - if(substr_count($mimetype, '/')) { - list($type, $subtype) = explode('/', $mimetype); - } - $iconsRoot = \OC::$SERVERROOT . '/core/img/filetypes/'; + $path = \OC_Helper::mimetypeIcon($mimetype); + $path = \OC::$SERVERROOT . substr($path, strlen(\OC::$WEBROOT)); - if(isset($type)){ - $icons = array($mimetype, $type, 'text'); - }else{ - $icons = array($mimetype, 'text'); - } - foreach($icons as $icon) { - $icon = str_replace('/', '-', $icon); - - $iconPath = $iconsRoot . $icon . '.png'; - - if(file_exists($iconPath)) { - return new \OC_Image($iconPath); - } - } - return false; + return new \OC_Image($path); } } From 825d8610d0abbf1063df3019533253908142ae43 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Thu, 15 Aug 2013 13:21:35 +0200 Subject: [PATCH 131/170] fix svg and cache transparency issue --- lib/image.php | 3 +++ lib/preview.php | 2 ++ lib/preview/svg.php | 8 +++++--- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/image.php b/lib/image.php index 4bc38e20e56..53ffb24d18c 100644 --- a/lib/image.php +++ b/lib/image.php @@ -496,6 +496,9 @@ class OC_Image { return false; } $this->resource = @imagecreatefromstring($str); + imagealphablending($this->resource, false); + imagesavealpha($this->resource, true); + if(!$this->resource) { OC_Log::write('core', 'OC_Image->loadFromData, couldn\'t load', OC_Log::DEBUG); return false; diff --git a/lib/preview.php b/lib/preview.php index 293accb188a..e7dd327d021 100755 --- a/lib/preview.php +++ b/lib/preview.php @@ -391,6 +391,8 @@ class Preview { continue; } + \OC_Log::write('core', 'Generating preview for "' . $file . '" with "' . get_class($provider) . '"', \OC_Log::DEBUG); + $preview = $provider->getThumbnail($file, $maxX, $maxY, $scalingUp, $this->fileview); if(!($preview instanceof \OC_Image)) { diff --git a/lib/preview/svg.php b/lib/preview/svg.php index e939e526b1b..b49e51720fa 100644 --- a/lib/preview/svg.php +++ b/lib/preview/svg.php @@ -18,7 +18,7 @@ if (extension_loaded('imagick')) { public function getThumbnail($path,$maxX,$maxY,$scalingup,$fileview) { try{ $svg = new \Imagick(); - $svg->setResolution($maxX, $maxY); + $svg->setBackgroundColor(new \ImagickPixel('transparent')); $content = stream_get_contents($fileview->fopen($path, 'r')); if(substr($content, 0, 5) !== 'readImageBlob($content); - $svg->setImageFormat('jpg'); + $svg->setImageFormat('png32'); } catch (\Exception $e) { \OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR); return false; } + //new image object - $image = new \OC_Image($svg); + $image = new \OC_Image(); + $image->loadFromData($svg); //check if image object is valid return $image->valid() ? $image : false; } From 7a11911aead74e07ba2917be27e343ff93ca931f Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Thu, 15 Aug 2013 13:25:45 +0200 Subject: [PATCH 132/170] add comment to make @jancborchardt happy --- lib/preview/txt.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/preview/txt.php b/lib/preview/txt.php index c06f445e827..a487330691e 100644 --- a/lib/preview/txt.php +++ b/lib/preview/txt.php @@ -17,6 +17,7 @@ class TXT extends Provider { $content = $fileview->fopen($path, 'r'); $content = stream_get_contents($content); + //don't create previews of empty text files if(trim($content) === '') { return false; } From 4574c5cf5cbb9efc4f787b264842573540f88439 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Thu, 15 Aug 2013 16:13:01 +0200 Subject: [PATCH 133/170] check if ->resource is a resource --- lib/image.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/image.php b/lib/image.php index 53ffb24d18c..840b744ad72 100644 --- a/lib/image.php +++ b/lib/image.php @@ -496,8 +496,10 @@ class OC_Image { return false; } $this->resource = @imagecreatefromstring($str); - imagealphablending($this->resource, false); - imagesavealpha($this->resource, true); + if(is_resource($this->resource)) { + imagealphablending($this->resource, false); + imagesavealpha($this->resource, true); + } if(!$this->resource) { OC_Log::write('core', 'OC_Image->loadFromData, couldn\'t load', OC_Log::DEBUG); From 61370a765581851664bbe1924e2d0e2e86083326 Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Thu, 15 Aug 2013 18:58:23 +0200 Subject: [PATCH 134/170] add folder icons for shared, public and external --- core/img/filetypes/folder-external.png | Bin 0 -> 1012 bytes core/img/filetypes/folder-external.svg | 68 +++++++++++++++++++++++++ core/img/filetypes/folder-public.png | Bin 0 -> 1397 bytes core/img/filetypes/folder-public.svg | 68 +++++++++++++++++++++++++ core/img/filetypes/folder-shared.png | Bin 0 -> 1229 bytes core/img/filetypes/folder-shared.svg | 68 +++++++++++++++++++++++++ 6 files changed, 204 insertions(+) create mode 100644 core/img/filetypes/folder-external.png create mode 100644 core/img/filetypes/folder-external.svg create mode 100644 core/img/filetypes/folder-public.png create mode 100644 core/img/filetypes/folder-public.svg create mode 100644 core/img/filetypes/folder-shared.png create mode 100644 core/img/filetypes/folder-shared.svg diff --git a/core/img/filetypes/folder-external.png b/core/img/filetypes/folder-external.png new file mode 100644 index 0000000000000000000000000000000000000000..997f07b2bacc1ae5bb09b5addb1539254fffb6c6 GIT binary patch literal 1012 zcmV5FZC7Idh8lO>34#dXMv#`;hGL~9Rw;@fP_+dsQWV=JHYTrm@4h=TXXdy_@;;Kh zn-3DZ=~>O0bI&oJPV+zc<)P{DwWED&+c{Rol(^*T>wB;M81wOuIL?OL_}6qspTZgvZ2 z(+Zn?IT`~R0zqQ41>nUO)(eoW8Q{{nQ(QXt`I7y&-}|5^fCRzEkhcINgr@a@G=W$` zaPq_B{CVxymcHx7*LZ3F>pXDZ7A}mP==#=&<>MsA5WOH?Ix65LcV5UUu@vCuA6Izy z{f}FEt?9Ylu+*(b>GtzI&XdF#f)j%HHh{CfS$JVfR6^_xV2t6~WW8(ehx4boJbs2O z?H*v)qXKCH&I^T)?G|`fG_4OLp&UT9yR<)EIL$9#jZsMxRN=W-4gqlS?8%-jhzeE$ z&K7Ne!r9!3Pzj2Z0niQ5S4qjz1OARzeun4w9cHSr{E@DJ6T#)pHo)widTyPtHTEWlr7gI1$MWdz zk=7dE>cug34DIU~1Hd|=$ZH)Hs7*GU2tFu2^u7(}0J`lrYekoyrAcWFNO0cMn4W30 z0H!AY&b<#vSX%|w^Nm4q5}3LDR~x|9>)wj@UbW&&X5it+2KnsRky3!coljC0!z7CJ z66({_wgmtL=fz6UN*Vp$H;(Y?n~Ps@-7;GU*QfHH_QWX8`vM4^0I{&%dWi#G+WlLM z^4mmx(as7N$1-N4O5t1q#7+RCwi&nerNG+W1napyZxuyk{+D0@Apd#%)Y+@woqq^b zv-XfZ;9yBCV@wq9{{eECf07wvw)Xe;-!CEqthEFy%VLO-Wm&z^XiTfBZ4Dtnnx?&` iXTz!jpsES;6Y?LpcNV5;-lI1F0000 + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/img/filetypes/folder-public.png b/core/img/filetypes/folder-public.png new file mode 100644 index 0000000000000000000000000000000000000000..c716607e26e3c2cf8f82dd754e820d475cb99f70 GIT binary patch literal 1397 zcmV-*1&aEKP)!=lzgp|+)kcG~I8+_~TG z1H-h?sf;M$g_C@_>-m4bd(OG%`-JzN>uJGto&5&D4FDi9@+T)fK1u-0U9j-+O`BeBPK4n#o&2Ibx@KMT=FOYCfeQfAnp|6N2IH^X7POKa zKJX3QXHL@Haf&dJWZJBoX=uEK#j745nHqORjZ_HQxfqI#$QoZz%3z#F+p$M`TPq*G zy_rNP@Kz!7S!8~QDU<7|si|S-)(>cJYyC$J<2+IstZ@Y>7NIsemf8Rb##)`b+W%zx z`)~5pa~o+|xR_b98@XrMN`wgbWXpTJ@Y-7}S+SZ=w{F2$PeapfWp#uAV-4Ebs1yNX zZ9!^_v6Q8b3NgF3ZDIL+4={7yBF=R8(AnL?!F}J+(bYpuO%1ztZl`BR^5_#!a%BJ4 zM1{C~1T08xFxnJK09u}WZ(mwcw5m5;3_6Dz7GPGZ60<>UtYIk0O7xm=b^ z-&wSCq@`oUgOAX1Xz!SMN*S!t!zoZw7h-J~=RDSp&Ou*i`-Nk{;XS0&X?AaYhg`a! zFbME~)rweKf*@c>Inv!7C_7p!3_xi^tX(u*11c^^Z3%37fODN^@E*EOpW@G7zURz| zBRClm2vMq;b7#BAXS0m2u4T&XTZpnd&}9Ie2Wc!y#=`)yl94ioWU)#|7mmOKovp_h z=xWEwsC4h5)zsFJs;VvK+TfiV6F_N8tmH6&jH5^yOUji8m_B%K1u1Ht5J z(;4XNz2u#IK1WY?CsB5gx~Vg%s;ftr(ei*Y1{D>C0kT86NGiklVjsBN>Ko?LcD#i| zD3~*EA!|0g$f=`0vG0rR3=Q-FV2tLAcV9;c!Hl`{nK%EAvRVLA8R952{2R*5xx6x_ z7(O>@G%Z?1ZT(cdhg`luYj2hbjd$|&OK))R!;j-Vcn{-~A>$GOYN(&4MXSncY3os1 zlOGt&mjL?DbwyfR%oyD(Ed{Hecm@!h?KnyMvBUJ|6s_kYbh5exaG@Xt53PTev=n3X z0gp14!M?xpr4*=KPD`V;_C8rIZ{P`Q8(91NE9}|!A%E=u947+KxBt%BIxJfsKKqY$uhg1%!bg2;qz_hAl z1-{S|$FAs70*H=&_t{s!{kXRQ??pu_6_|%nT0#hCv_20+P~4IUA;wo#RZTR;R8v_9 z{*7G@VH1f&E}zd2c<*JY2m!({j4BlQPv*T3C|1bd+^2RL;@irX00000NkvXXu0mjf D`X`G_ literal 0 HcmV?d00001 diff --git a/core/img/filetypes/folder-public.svg b/core/img/filetypes/folder-public.svg new file mode 100644 index 00000000000..a949833f95a --- /dev/null +++ b/core/img/filetypes/folder-public.svg @@ -0,0 +1,68 @@ + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/img/filetypes/folder-shared.png b/core/img/filetypes/folder-shared.png new file mode 100644 index 0000000000000000000000000000000000000000..e547a242062eb9687929fb640e99d33468e85500 GIT binary patch literal 1229 zcmV;;1Ty=HP)AfjSy#9#`Pk5I6sP$=!tnR)m7x@c!Q zL#H1SkPRof$=r9}IrlgJcka1Igb=u&7Twp~9{@Z60Fv5?5Mm?Hx*gYaz}B9fZ?5R<{OE<}H}yE@?kPYV$Nb)V;_%qb zYx@r!`0kqoV9ojsZ|vRsaZeJ*_jL1$y}ol-&%S;8t^kt&%Gu)iYXxlhf678O2IIYi zsT^=Nq*_~ioZ-J*jyJDg<@k|<4D|Q0y6YKU?AcDol4W!H2m!%4ob_oHz*r-du|P5> zz{t>Lh6c{@YS1yr_CpXi@af~xGH#ehXT79RbH4jOGnWL6OLg2K;Su+iwl}V+s z7fL=hr_YnRV4c=0Srt{Gt^aU>Wxe}=&?KV@zAR@QZIBTh060Ro_{MVHfQfQehh zveK3&KPgeIsd5oLF-j($EK(s%CQ>dD1gj82RG+!h7$=V$;B4>DYPuk1x81P z%EmaXo2fvqwVmC2zrbtBjjMwkKlD9=7y9S;${-LpS(*`RaxI{(WBkTH(*U|yG}36J zz0YV@e}=V#zTsQMk)Ww%1)`~i!2I>vT8*}iZq|U*#udlLbQJ(VrAldSGRodoL~63S z3~cIoo6aY?xOC$xr)bXGn>$y8RR6@Va> z)JhrD4C?xSJM1FbJ2$eq>p8MXOcDv=NZ_VUkTQ-!*)Tkz8y7VnlcrJuz7{|@nffJ* zVxYb!m`&_d8B*1_cg!WQJU{z=a8=2w%oTvbsbdF!>hC?eGK72E6bK=_)A9yTgsGNn rY9Rsg+%Cc0HwR3F5NsX5{jz@n19huHG^0YB00000NkvXXu0mjfD!?-g literal 0 HcmV?d00001 diff --git a/core/img/filetypes/folder-shared.svg b/core/img/filetypes/folder-shared.svg new file mode 100644 index 00000000000..56aa9634d27 --- /dev/null +++ b/core/img/filetypes/folder-shared.svg @@ -0,0 +1,68 @@ + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From e7c06935702dc794f7178cdc47ce947404752ec0 Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Thu, 15 Aug 2013 19:40:39 +0200 Subject: [PATCH 135/170] checkstyle double quotes in HTML --- apps/files/templates/part.list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/files/templates/part.list.php b/apps/files/templates/part.list.php index bd1fe341f8d..1ed8e0cf91b 100644 --- a/apps/files/templates/part.list.php +++ b/apps/files/templates/part.list.php @@ -23,8 +23,8 @@ $totalsize = 0; ?> data-file="" data-type="" data-mime="" - data-size='' - data-permissions=''> + data-size="" + data-permissions="">
    From 164502477d8eac293ea002d39378be846bcc733c Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Fri, 16 Aug 2013 17:24:45 +0200 Subject: [PATCH 136/170] use jQuery.get instead of jQuery.ajax --- apps/files/js/files.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/apps/files/js/files.js b/apps/files/js/files.js index 3178ff65af8..fd18cf21ee8 100644 --- a/apps/files/js/files.js +++ b/apps/files/js/files.js @@ -821,12 +821,8 @@ function lazyLoadPreview(path, mime, ready) { var x = $('#filestable').data('preview-x'); var y = $('#filestable').data('preview-y'); var previewURL = OC.Router.generate('core_ajax_preview', {file: encodeURIComponent(path), x:x, y:y}); - $.ajax({ - url: previewURL, - type: 'GET', - success: function() { - ready(previewURL); - } + $.get(previewURL, function() { + ready(previewURL); }); } From 7e4dcd268f6cb6618600718a51c4d882e9027829 Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Sat, 17 Aug 2013 10:46:03 +0200 Subject: [PATCH 137/170] vertically center rename input box --- apps/files/css/files.css | 10 ++++++++-- apps/files/js/filelist.js | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/apps/files/css/files.css b/apps/files/css/files.css index 20eb5fd083f..be42a0056d8 100644 --- a/apps/files/css/files.css +++ b/apps/files/css/files.css @@ -142,7 +142,13 @@ table td.filename a.name { padding: 0; } table tr[data-type="dir"] td.filename a.name span.nametext {font-weight:bold; } -table td.filename input.filename { width:100%; cursor:text; } +table td.filename input.filename { + width: 80%; + font-size: 14px; + margin-top: 8px; + margin-left: 2px; + cursor: text; +} table td.filename a, table td.login, table td.logout, table td.download, table td.upload, table td.create, table td.delete { padding:.2em .5em .5em .3em; } table td.filename .nametext, .uploadtext, .modified { float:left; padding:.3em 0; } @@ -176,7 +182,7 @@ table td.filename form { font-size:.85em; margin-left:3em; margin-right:3em; } filter: alpha(opacity=0); opacity: 0; float: left; - margin: 32px 0 0 32px; /* bigger clickable area doesn’t work in FF width:2.8em; height:2.4em;*/ + margin: 32px 0 4px 32px; /* bigger clickable area doesn’t work in FF width:2.8em; height:2.4em;*/ } /* Show checkbox when hovering, checked, or selected */ #fileList tr:hover td.filename>input[type="checkbox"]:first-child, diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 536becad49a..10a297ddadb 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -199,7 +199,7 @@ var FileList={ tr=$('tr').filterAttr('data-file',name); tr.data('renaming',true); td=tr.children('td.filename'); - input=$('').val(name); + input=$('').val(name); form=$('
    '); form.append(input); td.children('a.name').hide(); From 48f0c54261bfa2d2f20864b0d41db8f1df6f1777 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Mon, 19 Aug 2013 12:16:55 +0200 Subject: [PATCH 138/170] style fixes for preview lib --- apps/files/templates/part.list.php | 3 +- config/config.sample.php | 2 + core/ajax/preview.php | 9 ++- lib/preview.php | 76 +++++++++---------- lib/preview/{images.php => image.php} | 0 .../{libreoffice-cl.php => office-cl.php} | 9 ++- .../{msoffice.php => office-fallback.php} | 0 lib/preview/office.php | 4 +- 8 files changed, 55 insertions(+), 48 deletions(-) rename lib/preview/{images.php => image.php} (100%) rename lib/preview/{libreoffice-cl.php => office-cl.php} (87%) rename lib/preview/{msoffice.php => office-fallback.php} (100%) diff --git a/apps/files/templates/part.list.php b/apps/files/templates/part.list.php index 1ed8e0cf91b..899fb04e252 100644 --- a/apps/files/templates/part.list.php +++ b/apps/files/templates/part.list.php @@ -3,7 +3,8 @@ $totaldirs = 0; $totalsize = 0; ?> 6 + //strlen('files/') => 6 + $relativePath = substr($file['path'], 6); $totalsize += $file['size']; if ($file['type'] === 'dir') { $totaldirs++; diff --git a/config/config.sample.php b/config/config.sample.php index 86bc20b714e..5c40078c7d7 100644 --- a/config/config.sample.php +++ b/config/config.sample.php @@ -199,6 +199,8 @@ $CONFIG = array( 'preview_max_scale_factor' => 10, /* custom path for libreoffice / openoffice binary */ 'preview_libreoffice_path' => '/usr/bin/libreoffice', +/* cl parameters for libreoffice / openoffice */ +'preview_office_cl_parameters' => '', // date format to be used while writing to the owncloud logfile 'logdateformat' => 'F d, Y H:i:s', ); diff --git a/core/ajax/preview.php b/core/ajax/preview.php index 486155831d7..af0f0493f4c 100644 --- a/core/ajax/preview.php +++ b/core/ajax/preview.php @@ -13,13 +13,15 @@ $maxY = array_key_exists('y', $_GET) ? (int) $_GET['y'] : '36'; $scalingUp = array_key_exists('scalingup', $_GET) ? (bool) $_GET['scalingup'] : true; if($file === '') { - \OC_Response::setStatus(400); //400 Bad Request + //400 Bad Request + \OC_Response::setStatus(400); \OC_Log::write('core-preview', 'No file parameter was passed', \OC_Log::DEBUG); exit; } if($maxX === 0 || $maxY === 0) { - \OC_Response::setStatus(400); //400 Bad Request + //400 Bad Request + \OC_Response::setStatus(400); \OC_Log::write('core-preview', 'x and/or y set to 0', \OC_Log::DEBUG); exit; } @@ -34,6 +36,5 @@ try{ $preview->show(); }catch(\Exception $e) { \OC_Response::setStatus(500); - \OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR); - exit; + \OC_Log::write('core', $e->getmessage(), \OC_Log::DEBUG); } \ No newline at end of file diff --git a/lib/preview.php b/lib/preview.php index e7dd327d021..9fed7f1b58f 100755 --- a/lib/preview.php +++ b/lib/preview.php @@ -13,14 +13,14 @@ */ namespace OC; -require_once('preview/images.php'); -require_once('preview/movies.php'); -require_once('preview/mp3.php'); -require_once('preview/pdf.php'); -require_once('preview/svg.php'); -require_once('preview/txt.php'); -require_once('preview/unknown.php'); -require_once('preview/office.php'); +require_once 'preview/image.php'; +require_once 'preview/movies.php'; +require_once 'preview/mp3.php'; +require_once 'preview/pdf.php'; +require_once 'preview/svg.php'; +require_once 'preview/txt.php'; +require_once 'preview/unknown.php'; +require_once 'preview/office.php'; class Preview { //the thumbnail folder @@ -32,8 +32,8 @@ class Preview { private $configMaxY; //fileview object - private $fileview = null; - private $userview = null; + private $fileView = null; + private $userView = null; //vars private $file; @@ -76,8 +76,8 @@ class Preview { if($user === ''){ $user = \OC_User::getUser(); } - $this->fileview = new \OC\Files\View('/' . $user . '/' . $root); - $this->userview = new \OC\Files\View('/' . $user); + $this->fileView = new \OC\Files\View('/' . $user . '/' . $root); + $this->userView = new \OC\Files\View('/' . $user); $this->preview = null; @@ -226,12 +226,12 @@ class Preview { public function isFileValid() { $file = $this->getFile(); if($file === '') { - \OC_Log::write('core', 'No filename passed', \OC_Log::ERROR); + \OC_Log::write('core', 'No filename passed', \OC_Log::DEBUG); return false; } - if(!$this->fileview->file_exists($file)) { - \OC_Log::write('core', 'File:"' . $file . '" not found', \OC_Log::ERROR); + if(!$this->fileView->file_exists($file)) { + \OC_Log::write('core', 'File:"' . $file . '" not found', \OC_Log::DEBUG); return false; } @@ -245,12 +245,12 @@ class Preview { public function deletePreview() { $file = $this->getFile(); - $fileInfo = $this->fileview->getFileInfo($file); + $fileInfo = $this->fileView->getFileInfo($file); $fileId = $fileInfo['fileid']; $previewPath = $this->getThumbnailsFolder() . '/' . $fileId . '/' . $this->getMaxX() . '-' . $this->getMaxY() . '.png'; - $this->userview->unlink($previewPath); - return !$this->userview->file_exists($previewPath); + $this->userView->unlink($previewPath); + return !$this->userView->file_exists($previewPath); } /** @@ -260,13 +260,13 @@ class Preview { public function deleteAllPreviews() { $file = $this->getFile(); - $fileInfo = $this->fileview->getFileInfo($file); + $fileInfo = $this->fileView->getFileInfo($file); $fileId = $fileInfo['fileid']; $previewPath = $this->getThumbnailsFolder() . '/' . $fileId . '/'; - $this->userview->deleteAll($previewPath); - $this->userview->rmdir($previewPath); - return !$this->userview->is_dir($previewPath); + $this->userView->deleteAll($previewPath); + $this->userView->rmdir($previewPath); + return !$this->userView->is_dir($previewPath); } /** @@ -280,9 +280,9 @@ class Preview { $maxX = $this->getMaxX(); $maxY = $this->getMaxY(); $scalingUp = $this->getScalingUp(); - $maxscalefactor = $this->getMaxScaleFactor(); + $maxScaleFactor = $this->getMaxScaleFactor(); - $fileInfo = $this->fileview->getFileInfo($file); + $fileInfo = $this->fileView->getFileInfo($file); $fileId = $fileInfo['fileid']; if(is_null($fileId)) { @@ -290,12 +290,12 @@ class Preview { } $previewPath = $this->getThumbnailsFolder() . '/' . $fileId . '/'; - if(!$this->userview->is_dir($previewPath)) { + if(!$this->userView->is_dir($previewPath)) { return false; } //does a preview with the wanted height and width already exist? - if($this->userview->file_exists($previewPath . $maxX . '-' . $maxY . '.png')) { + if($this->userView->file_exists($previewPath . $maxX . '-' . $maxY . '.png')) { return $previewPath . $maxX . '-' . $maxY . '.png'; } @@ -304,7 +304,7 @@ class Preview { //array for usable cached thumbnails $possibleThumbnails = array(); - $allThumbnails = $this->userview->getDirectoryContent($previewPath); + $allThumbnails = $this->userView->getDirectoryContent($previewPath); foreach($allThumbnails as $thumbnail) { $name = rtrim($thumbnail['name'], '.png'); $size = explode('-', $name); @@ -319,7 +319,7 @@ class Preview { if($x < $maxX || $y < $maxY) { if($scalingUp) { $scalefactor = $maxX / $x; - if($scalefactor > $maxscalefactor) { + if($scalefactor > $maxScaleFactor) { continue; } }else{ @@ -371,19 +371,19 @@ class Preview { $maxY = $this->getMaxY(); $scalingUp = $this->getScalingUp(); - $fileInfo = $this->fileview->getFileInfo($file); + $fileInfo = $this->fileView->getFileInfo($file); $fileId = $fileInfo['fileid']; $cached = $this->isCached(); if($cached) { - $image = new \OC_Image($this->userview->file_get_contents($cached, 'r')); + $image = new \OC_Image($this->userView->file_get_contents($cached, 'r')); $this->preview = $image->valid() ? $image : null; $this->resizeAndCrop(); } if(is_null($this->preview)) { - $mimetype = $this->fileview->getMimeType($file); + $mimetype = $this->fileView->getMimeType($file); $preview = null; foreach(self::$providers as $supportedMimetype => $provider) { @@ -393,7 +393,7 @@ class Preview { \OC_Log::write('core', 'Generating preview for "' . $file . '" with "' . get_class($provider) . '"', \OC_Log::DEBUG); - $preview = $provider->getThumbnail($file, $maxX, $maxY, $scalingUp, $this->fileview); + $preview = $provider->getThumbnail($file, $maxX, $maxY, $scalingUp, $this->fileView); if(!($preview instanceof \OC_Image)) { continue; @@ -405,15 +405,15 @@ class Preview { $previewPath = $this->getThumbnailsFolder() . '/' . $fileId . '/'; $cachePath = $previewPath . $maxX . '-' . $maxY . '.png'; - if($this->userview->is_dir($this->getThumbnailsFolder() . '/') === false) { - $this->userview->mkdir($this->getThumbnailsFolder() . '/'); + if($this->userView->is_dir($this->getThumbnailsFolder() . '/') === false) { + $this->userView->mkdir($this->getThumbnailsFolder() . '/'); } - if($this->userview->is_dir($previewPath) === false) { - $this->userview->mkdir($previewPath); + if($this->userView->is_dir($previewPath) === false) { + $this->userView->mkdir($previewPath); } - $this->userview->file_put_contents($cachePath, $preview->data()); + $this->userView->file_put_contents($cachePath, $preview->data()); break; } @@ -470,7 +470,7 @@ class Preview { if($x === $realx && $y === $realy) { $this->preview = $image; - return true; + return; } $factorX = $x / $realx; diff --git a/lib/preview/images.php b/lib/preview/image.php similarity index 100% rename from lib/preview/images.php rename to lib/preview/image.php diff --git a/lib/preview/libreoffice-cl.php b/lib/preview/office-cl.php similarity index 87% rename from lib/preview/libreoffice-cl.php rename to lib/preview/office-cl.php index 2f1d08499ef..112909d6523 100644 --- a/lib/preview/libreoffice-cl.php +++ b/lib/preview/office-cl.php @@ -7,7 +7,7 @@ */ namespace OC\Preview; -//we need imagick to convert +//we need imagick to convert class Office extends Provider { private $cmd; @@ -26,7 +26,10 @@ class Office extends Provider { $tmpDir = get_temp_dir(); - $exec = $this->cmd . ' --headless --nologo --nofirststartwizard --invisible --norestore -convert-to pdf -outdir ' . escapeshellarg($tmpDir) . ' ' . escapeshellarg($absPath); + $defaultParameters = ' --headless --nologo --nofirststartwizard --invisible --norestore -convert-to pdf -outdir '; + $clParameters = \OCP\Config::getSystemValue('preview_office_cl_parameters', $defaultParameters); + + $exec = $this->cmd . $clParameters . escapeshellarg($tmpDir) . ' ' . escapeshellarg($absPath); $export = 'export HOME=/' . $tmpDir; shell_exec($export . "\n" . $exec); @@ -110,7 +113,7 @@ class MSOffice2007 extends Office { //.odt, .ott, .oth, .odm, .odg, .otg, .odp, .otp, .ods, .ots, .odc, .odf, .odb, .odi, .oxt class OpenDocument extends Office { - + public function getMimeType() { return '/application\/vnd.oasis.opendocument.*/'; } diff --git a/lib/preview/msoffice.php b/lib/preview/office-fallback.php similarity index 100% rename from lib/preview/msoffice.php rename to lib/preview/office-fallback.php diff --git a/lib/preview/office.php b/lib/preview/office.php index b93e1e57c8b..5287bbd6ac1 100644 --- a/lib/preview/office.php +++ b/lib/preview/office.php @@ -14,9 +14,9 @@ if (extension_loaded('imagick')) { $isOpenOfficeAvailable = !empty($whichOpenOffice); //let's see if there is libreoffice or openoffice on this machine if($isShellExecEnabled && ($isLibreOfficeAvailable || $isOpenOfficeAvailable || is_string(\OC_Config::getValue('preview_libreoffice_path', null)))) { - require_once('libreoffice-cl.php'); + require_once('office-cl.php'); }else{ //in case there isn't, use our fallback - require_once('msoffice.php'); + require_once('office-fallback.php'); } } \ No newline at end of file From d9e8ebabdcd99bade4201d6be82e1841d30c5d65 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Mon, 19 Aug 2013 13:24:07 +0200 Subject: [PATCH 139/170] outsource sharing and deleted files previews to apps --- {core => apps/files_sharing}/ajax/publicpreview.php | 3 +-- apps/files_sharing/appinfo/routes.php | 5 +++++ .../files_trashbin/ajax/preview.php | 3 +-- apps/files_trashbin/appinfo/routes.php | 5 +++++ core/routes.php | 4 ---- 5 files changed, 12 insertions(+), 8 deletions(-) rename {core => apps/files_sharing}/ajax/publicpreview.php (97%) create mode 100644 apps/files_sharing/appinfo/routes.php rename core/ajax/trashbinpreview.php => apps/files_trashbin/ajax/preview.php (94%) create mode 100644 apps/files_trashbin/appinfo/routes.php diff --git a/core/ajax/publicpreview.php b/apps/files_sharing/ajax/publicpreview.php similarity index 97% rename from core/ajax/publicpreview.php rename to apps/files_sharing/ajax/publicpreview.php index 83194d5349c..41a1c178a48 100644 --- a/core/ajax/publicpreview.php +++ b/apps/files_sharing/ajax/publicpreview.php @@ -81,6 +81,5 @@ try{ $preview->show(); } catch (\Exception $e) { \OC_Response::setStatus(500); - \OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR); - exit; + \OC_Log::write('core', $e->getmessage(), \OC_Log::DEBUG); } \ No newline at end of file diff --git a/apps/files_sharing/appinfo/routes.php b/apps/files_sharing/appinfo/routes.php new file mode 100644 index 00000000000..02815b5eb42 --- /dev/null +++ b/apps/files_sharing/appinfo/routes.php @@ -0,0 +1,5 @@ +create('core_ajax_public_preview', '/publicpreview.png')->action( +function() { + require_once __DIR__ . '/../ajax/publicpreview.php'; +}); \ No newline at end of file diff --git a/core/ajax/trashbinpreview.php b/apps/files_trashbin/ajax/preview.php similarity index 94% rename from core/ajax/trashbinpreview.php rename to apps/files_trashbin/ajax/preview.php index a916dcf229f..a0846b051c7 100644 --- a/core/ajax/trashbinpreview.php +++ b/apps/files_trashbin/ajax/preview.php @@ -38,6 +38,5 @@ try{ $preview->showPreview(); }catch(\Exception $e) { \OC_Response::setStatus(500); - \OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR); - exit; + \OC_Log::write('core', $e->getmessage(), \OC_Log::DEBUG); } \ No newline at end of file diff --git a/apps/files_trashbin/appinfo/routes.php b/apps/files_trashbin/appinfo/routes.php new file mode 100644 index 00000000000..b1c3f02741e --- /dev/null +++ b/apps/files_trashbin/appinfo/routes.php @@ -0,0 +1,5 @@ +create('core_ajax_trashbin_preview', '/preview.png')->action( +function() { + require_once __DIR__ . '/../ajax/preview.php'; +}); \ No newline at end of file diff --git a/core/routes.php b/core/routes.php index ce35be1d583..f0f8ce571e2 100644 --- a/core/routes.php +++ b/core/routes.php @@ -44,10 +44,6 @@ $this->create('core_ajax_routes', '/core/routes.json') ->action('OC_Router', 'JSRoutes'); $this->create('core_ajax_preview', '/core/preview.png') ->actionInclude('core/ajax/preview.php'); -$this->create('core_ajax_trashbin_preview', '/core/trashbinpreview.png') - ->actionInclude('core/ajax/trashbinpreview.php'); -$this->create('core_ajax_public_preview', '/core/publicpreview.png') - ->actionInclude('core/ajax/publicpreview.php'); OC::$CLASSPATH['OC_Core_LostPassword_Controller'] = 'core/lostpassword/controller.php'; $this->create('core_lostpassword_index', '/lostpassword/') ->get() From 224b80f906c1b7cd6338854e58f228eff4ea871c Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Wed, 21 Aug 2013 15:55:59 +0200 Subject: [PATCH 140/170] move isMimeSupported out of template files --- apps/files/index.php | 1 + apps/files/templates/part.list.php | 6 +++--- apps/files_sharing/public.php | 1 + apps/files_trashbin/index.php | 1 + apps/files_trashbin/templates/part.list.php | 8 ++++++-- 5 files changed, 12 insertions(+), 5 deletions(-) diff --git a/apps/files/index.php b/apps/files/index.php index c05c2a9384d..3007f56e024 100644 --- a/apps/files/index.php +++ b/apps/files/index.php @@ -74,6 +74,7 @@ foreach ($content as $i) { } } $i['directory'] = $dir; + $i['isPreviewAvailable'] = \OCP\Preview::isMimeSupported($i['mimetype']); $files[] = $i; } diff --git a/apps/files/templates/part.list.php b/apps/files/templates/part.list.php index 899fb04e252..c91dda4c77e 100644 --- a/apps/files/templates/part.list.php +++ b/apps/files/templates/part.list.php @@ -26,7 +26,7 @@ $totalsize = 0; ?> data-mime="" data-size="" data-permissions=""> - +
    - + style="background-image:url()" style="background-image:url()" - + style="background-image:url()" style="background-image:url()" diff --git a/apps/files_sharing/public.php b/apps/files_sharing/public.php index f050fecd7b5..ec6b4e815f8 100644 --- a/apps/files_sharing/public.php +++ b/apps/files_sharing/public.php @@ -172,6 +172,7 @@ if (isset($path)) { } else { $i['extension'] = ''; } + $i['isPreviewAvailable'] = \OCP\Preview::isMimeSupported($i['mimetype']); } $i['directory'] = $getPath; $i['permissions'] = OCP\PERMISSION_READ; diff --git a/apps/files_trashbin/index.php b/apps/files_trashbin/index.php index 2dbaefe7a78..6ae238eb8eb 100644 --- a/apps/files_trashbin/index.php +++ b/apps/files_trashbin/index.php @@ -64,6 +64,7 @@ foreach ($result as $r) { $i['directory'] = ''; } $i['permissions'] = OCP\PERMISSION_READ; + $i['isPreviewAvailable'] = \OCP\Preview::isMimeSupported($r['mime']); $files[] = $i; } diff --git a/apps/files_trashbin/templates/part.list.php b/apps/files_trashbin/templates/part.list.php index 6c6d2162846..f7cc6b01bbb 100644 --- a/apps/files_trashbin/templates/part.list.php +++ b/apps/files_trashbin/templates/part.list.php @@ -21,12 +21,16 @@ data-timestamp='' data-dirlisting=0 > + + style="background-image:url()" - - style="background-image:url()" class="preview-icon" + + style="background-image:url()" style="background-image:url()" From 87c3f34a93257f015304ac48247eeaf38745af9f Mon Sep 17 00:00:00 2001 From: dampfklon Date: Thu, 22 Aug 2013 19:52:08 +0200 Subject: [PATCH 141/170] Make group suffix in share dialog translatable --- core/ajax/share.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/ajax/share.php b/core/ajax/share.php index bdcb61284ec..d3c6a8456a6 100644 --- a/core/ajax/share.php +++ b/core/ajax/share.php @@ -213,6 +213,10 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo } } $count = 0; + + // enable l10n support + $l = OC_L10N::get('core'); + foreach ($groups as $group) { if ($count < 15) { if (stripos($group, $_GET['search']) !== false @@ -221,7 +225,7 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo || !is_array($_GET['itemShares'][OCP\Share::SHARE_TYPE_GROUP]) || !in_array($group, $_GET['itemShares'][OCP\Share::SHARE_TYPE_GROUP]))) { $shareWith[] = array( - 'label' => $group.' (group)', + 'label' => $group.' ('.$l->t('group').')', 'value' => array( 'shareType' => OCP\Share::SHARE_TYPE_GROUP, 'shareWith' => $group From 1dab0767502013b5e86e8e24e3b12a2a8939f7a8 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Fri, 23 Aug 2013 23:05:44 +0200 Subject: [PATCH 142/170] make it possible to disable previews --- config/config.sample.php | 1 + lib/preview.php | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/config/config.sample.php b/config/config.sample.php index 5c40078c7d7..76de97818d5 100644 --- a/config/config.sample.php +++ b/config/config.sample.php @@ -191,6 +191,7 @@ $CONFIG = array( 'customclient_ios' => '', //https://itunes.apple.com/us/app/owncloud/id543672169?mt=8 // PREVIEW +'disable_previews' => false, /* the max width of a generated preview, if value is null, there is no limit */ 'preview_max_x' => null, /* the max height of a generated preview, if value is null, there is no limit */ diff --git a/lib/preview.php b/lib/preview.php index 9fed7f1b58f..0497ec95bc5 100755 --- a/lib/preview.php +++ b/lib/preview.php @@ -568,6 +568,12 @@ class Preview { * @return void */ private static function initProviders() { + if(\OC_Config::getValue('disable_previews', false)) { + $provider = new Preview\Unknown(); + self::$providers = array($provider); + return; + } + if(count(self::$providers)>0) { return; } @@ -599,6 +605,10 @@ class Preview { } public static function isMimeSupported($mimetype) { + if(\OC_Config::getValue('disable_previews', false)) { + return false; + } + //check if there are preview backends if(empty(self::$providers)) { self::initProviders(); From 13e34649bfb1a7d15833c209d629e3540d3366ef Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Fri, 23 Aug 2013 23:19:21 +0200 Subject: [PATCH 143/170] move path generation for previews to dedicated function --- apps/files/js/filelist.js | 2 +- apps/files/js/files.js | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 41245c00ba6..e3e985af38b 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -185,7 +185,7 @@ var FileList={ if (id != null) { tr.attr('data-id', id); } - var path = $('#dir').val()+'/'+name; + var path = getPathForPreview(name); lazyLoadPreview(path, mime, function(previewpath){ tr.find('td.filename').attr('style','background-image:url('+previewpath+')'); }); diff --git a/apps/files/js/files.js b/apps/files/js/files.js index f88ecd961b1..79fa01aa0aa 100644 --- a/apps/files/js/files.js +++ b/apps/files/js/files.js @@ -382,7 +382,7 @@ $(document).ready(function() { tr.attr('data-size',result.data.size); tr.attr('data-id', result.data.id); tr.find('.filesize').text(humanFileSize(result.data.size)); - var path = $('#dir').val() + '/' + name; + var path = getPathForPreview(name); lazyLoadPreview(path, result.data.mime, function(previewpath){ tr.find('td.filename').attr('style','background-image:url('+previewpath+')'); }); @@ -654,7 +654,7 @@ var createDragShadow = function(event){ if (elem.type === 'dir') { newtr.find('td.filename').attr('style','background-image:url('+OC.imagePath('core', 'filetypes/folder.png')+')'); } else { - var path = $('#dir').val()+'/'+elem.name; + var path = getPathForPreview(elem.name); lazyLoadPreview(path, elem.mime, function(previewpath){ newtr.find('td.filename').attr('style','background-image:url('+previewpath+')'); }); @@ -832,6 +832,11 @@ function getMimeIcon(mime, ready){ } getMimeIcon.cache={}; +function getPathForPreview(name) { + var path = $('#dir').val() + '/' + name; + return path; +} + function lazyLoadPreview(path, mime, ready) { getMimeIcon(mime,ready); var x = $('#filestable').data('preview-x'); From 58c727a4955b9ab60fa3c31fe902b673e883d181 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Fri, 23 Aug 2013 23:27:36 +0200 Subject: [PATCH 144/170] fix return value of method --- lib/preview.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/preview.php b/lib/preview.php index 0497ec95bc5..a8a8580e229 100755 --- a/lib/preview.php +++ b/lib/preview.php @@ -444,7 +444,8 @@ class Preview { * @return void */ public function show() { - return $this->showPreview(); + $this->showPreview(); + return; } /** From 46cbd7cd3b37e073ebb497f34d54ab67e4761969 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Mon, 26 Aug 2013 12:16:51 +0200 Subject: [PATCH 145/170] fix preview issue when uploading a file with parentheses --- apps/files/js/files.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/files/js/files.js b/apps/files/js/files.js index 79fa01aa0aa..a890da843bb 100644 --- a/apps/files/js/files.js +++ b/apps/files/js/files.js @@ -843,7 +843,9 @@ function lazyLoadPreview(path, mime, ready) { var y = $('#filestable').data('preview-y'); var previewURL = OC.Router.generate('core_ajax_preview', {file: encodeURIComponent(path), x:x, y:y}); $.get(previewURL, function() { - ready(previewURL); + previewURL = previewURL.replace('(','%28'); + previewURL = previewURL.replace(')','%29'); + ready(previewURL + '&reload=true'); }); } From d538a566acac35eab811b2bfa16596fb8534db0f Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Mon, 26 Aug 2013 14:36:18 +0200 Subject: [PATCH 146/170] fix background size in filelist.js --- apps/files/js/filelist.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index e3e985af38b..7a48453488a 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -15,7 +15,7 @@ var FileList={ // filename td td = $(''+humanFileSize(totalSize)+'
    '+info+'
    - t('directory')); - } else { - p($l->t('directories')); - } - } - if ($totaldirs !== 0 && $totalfiles !== 0) { - p(' & '); - } - if ($totalfiles !== 0) { - p($totalfiles.' '); - if ($totalfiles === 1) { - p($l->t('file')); - } else { - p($l->t('files')); - } - } ?> - - -