diff --git a/apps/gallery/ajax/getCovers.php b/apps/gallery/ajax/getCovers.php index d84bf2a7903..b9c7558a53c 100644 --- a/apps/gallery/ajax/getCovers.php +++ b/apps/gallery/ajax/getCovers.php @@ -18,6 +18,7 @@ function CroppedThumbnail($imgSrc,$thumbnail_width,$thumbnail_height, $tgtImg, $ default: exit(); } + if(!$myImage) exit(); $ratio_orig = $width_orig/$height_orig; if ($thumbnail_width/$thumbnail_height > $ratio_orig) { @@ -52,8 +53,11 @@ $targetImg = imagecreatetruecolor($numOfItems*$box_size, $box_size); $counter = 0; while (($i = $result->fetchRow()) && $counter < $numOfItems) { $imagePath = OC::$CONFIG_DATADIRECTORY . $i['file_path']; - CroppedThumbnail($imagePath, $box_size, $box_size, $targetImg, $counter*$box_size); - $counter++; + if(file_exists($imagePath)) + { + CroppedThumbnail($imagePath, $box_size, $box_size, $targetImg, $counter*$box_size); + $counter++; + } } header('Content-Type: image/png'); diff --git a/apps/gallery/ajax/thumbnail.php b/apps/gallery/ajax/thumbnail.php index f24782390f6..a1416452932 100644 --- a/apps/gallery/ajax/thumbnail.php +++ b/apps/gallery/ajax/thumbnail.php @@ -5,6 +5,9 @@ OC_JSON::checkAppEnabled('gallery'); function CroppedThumbnail($imgSrc,$thumbnail_width,$thumbnail_height) { //$imgSrc is a FILE - Returns an image resource. //getting the image dimensions + if(! function_exists('imagecreatefromjpeg')) + OC_Log::write('gallery','GD module not installed',OC_Log::ERROR); + list($width_orig, $height_orig) = getimagesize($imgSrc); switch (strtolower(substr($imgSrc, strrpos($imgSrc, '.')+1))) { case "jpeg": @@ -18,6 +21,7 @@ function CroppedThumbnail($imgSrc,$thumbnail_width,$thumbnail_height) { //$imgSr default: exit(); } + if(!$myImage) exit(); $ratio_orig = $width_orig/$height_orig; if ($thumbnail_width/$thumbnail_height > $ratio_orig) { @@ -47,9 +51,10 @@ $img = $_GET['img']; $tmp = OC::$CONFIG_DATADIRECTORY . $img; -header('Content-Type: image/png'); -$image = CroppedThumbnail($tmp, $box_size, $box_size); - -imagepng($image); -imagedestroy($image); -?> +if(file_exists($tmp)) +{ + header('Content-Type: image/png'); + $image = CroppedThumbnail($tmp, $box_size, $box_size); + imagepng($image); + imagedestroy($image); +} \ No newline at end of file diff --git a/apps/gallery/lib_scanner.php b/apps/gallery/lib_scanner.php index 5490c4a55ad..1231de3f3c4 100644 --- a/apps/gallery/lib_scanner.php +++ b/apps/gallery/lib_scanner.php @@ -31,7 +31,7 @@ class OC_GALLERY_SCANNER { $stmt = OC_DB::prepare('SELECT * FROM *PREFIX*gallery_albums WHERE `uid_owner` = ? AND `album_name` = ?'); $result = $stmt->execute(array(OC_User::getUser(), $current_album['name'])); if ($result->numRows() == 0 && count($current_album['images'])) { - $stmt = OC_DB::prepare('REPLACE INTO *PREFIX*gallery_albums (`uid_owner`, `album_name`) VALUES (?, ?)'); + $stmt = OC_DB::prepare('INSERT INTO *PREFIX*gallery_albums (`uid_owner`, `album_name`) VALUES (?, ?)'); $stmt->execute(array(OC_User::getUser(), $current_album['name'])); } $stmt = OC_DB::prepare('SELECT * FROM *PREFIX*gallery_albums WHERE `uid_owner` = ? AND `album_name` = ?'); @@ -42,7 +42,7 @@ class OC_GALLERY_SCANNER { $stmt = OC_DB::prepare('SELECT * FROM *PREFIX*gallery_photos WHERE `album_id` = ? AND `file_path` = ?'); $result = $stmt->execute(array($albumId, $img)); if ($result->numRows() == 0) { - $stmt = OC_DB::prepare('REPLACE INTO *PREFIX*gallery_photos (`album_id`, `file_path`) VALUES (?, ?)'); + $stmt = OC_DB::prepare('INSERT INTO *PREFIX*gallery_photos (`album_id`, `file_path`) VALUES (?, ?)'); $stmt->execute(array($albumId, $img)); } } diff --git a/apps/media/css/player.css b/apps/media/css/player.css index c4a098543d1..0f29748f351 100644 --- a/apps/media/css/player.css +++ b/apps/media/css/player.css @@ -1,7 +1,7 @@ #playercontrols{ display:inline; margin-left:1em; - width:7em; + width:4em; height:1em; position:fixed; top:auto; diff --git a/files/index.php b/files/index.php index bd37598289a..8bb5b618d87 100644 --- a/files/index.php +++ b/files/index.php @@ -42,6 +42,10 @@ if(!isset($_SESSION['timezone'])){ OC_App::setActiveNavigationEntry( "files_index" ); // Load the files $dir = isset( $_GET['dir'] ) ? $_GET['dir'] : ''; +// Redirect if directory does not exist +if(!OC_Filesystem::is_dir($dir)) { + header("Location: ".$_SERVER['PHP_SELF'].""); +} $files = array(); foreach( OC_Files::getdirectorycontent( $dir ) as $i ){ diff --git a/files/js/filelist.js b/files/js/filelist.js index 3e85a35f6ef..863a3385d15 100644 --- a/files/js/filelist.js +++ b/files/js/filelist.js @@ -38,7 +38,7 @@ FileList={ }, addDir:function(name,size,lastModified){ var html='