From 8c7fc032969cdb0a989b5f18e8b5ce915de2a0f4 Mon Sep 17 00:00:00 2001 From: Brice Maron Date: Fri, 21 Oct 2011 23:30:12 +0200 Subject: [PATCH 1/9] Correct unknown breadcrumb add '/' permanantly in it and DRY code for last breadcrumb --- files/index.php | 4 ++-- files/templates/part.breadcrumb.php | 10 +++------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/files/index.php b/files/index.php index bd37598289a..7a9bf793a0e 100644 --- a/files/index.php +++ b/files/index.php @@ -41,7 +41,7 @@ if(!isset($_SESSION['timezone'])){ } OC_App::setActiveNavigationEntry( "files_index" ); // Load the files -$dir = isset( $_GET['dir'] ) ? $_GET['dir'] : ''; +$dir = isset( $_GET['dir'] ) && $_GET['dir'] != '/' ? $_GET['dir'] : ''; $files = array(); foreach( OC_Files::getdirectorycontent( $dir ) as $i ){ @@ -63,7 +63,7 @@ foreach( OC_Files::getdirectorycontent( $dir ) as $i ){ } // Make breadcrumb -$breadcrumb = array(); +$breadcrumb = array('/'); $pathtohere = ""; foreach( explode( "/", $dir ) as $i ){ if( $i != "" ){ diff --git a/files/templates/part.breadcrumb.php b/files/templates/part.breadcrumb.php index b26f6097153..ab81cc5c039 100644 --- a/files/templates/part.breadcrumb.php +++ b/files/templates/part.breadcrumb.php @@ -1,10 +1,6 @@ - -
")'> +
svg" data-dir='' style='background-image:url("")'> ">
- -
")'> - "> -
\ No newline at end of file + \ No newline at end of file From 4c256433c0f77382885b5b5f8d2874c27d8e2b66 Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Sat, 22 Oct 2011 00:29:45 +0200 Subject: [PATCH 2/9] removed '/' from file path because only Unix people understand the concept of that. Plus, 'Files' itself is the root. --- files/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/index.php b/files/index.php index 7a9bf793a0e..bd37598289a 100644 --- a/files/index.php +++ b/files/index.php @@ -41,7 +41,7 @@ if(!isset($_SESSION['timezone'])){ } OC_App::setActiveNavigationEntry( "files_index" ); // Load the files -$dir = isset( $_GET['dir'] ) && $_GET['dir'] != '/' ? $_GET['dir'] : ''; +$dir = isset( $_GET['dir'] ) ? $_GET['dir'] : ''; $files = array(); foreach( OC_Files::getdirectorycontent( $dir ) as $i ){ @@ -63,7 +63,7 @@ foreach( OC_Files::getdirectorycontent( $dir ) as $i ){ } // Make breadcrumb -$breadcrumb = array('/'); +$breadcrumb = array(); $pathtohere = ""; foreach( explode( "/", $dir ) as $i ){ if( $i != "" ){ From 50bf7a98c2d34e919144885db0b56ffed4e8e9c3 Mon Sep 17 00:00:00 2001 From: Michael Gapczynski Date: Sat, 22 Oct 2011 01:50:40 -0400 Subject: [PATCH 3/9] Redirect file browser if directory does not exist --- files/index.php | 4 ++++ 1 file changed, 4 insertions(+) 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 ){ From aa087f8661462fe97a1d67ef1f66b50b98f186be Mon Sep 17 00:00:00 2001 From: Michael Gapczynski Date: Sat, 22 Oct 2011 02:11:32 -0400 Subject: [PATCH 4/9] Change javascript new folder from old icon to new --- files/js/filelist.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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=''; - html+=''+name+''; + html+=''+name+''; if(size!='Pending'){ simpleSize=simpleFileSize(size); }else{ From 0d4240e1963cbf2c0335f518cd2e7e1dac6d6daa Mon Sep 17 00:00:00 2001 From: Michael Gapczynski Date: Sat, 22 Oct 2011 02:31:16 -0400 Subject: [PATCH 5/9] Fix music navigation entry controls going over the sidebar --- apps/media/css/player.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; From 9d46c378b9cb7abe78958c087912e5533d1f2144 Mon Sep 17 00:00:00 2001 From: Brice Maron Date: Sat, 22 Oct 2011 11:01:06 +0200 Subject: [PATCH 6/9] Fix unescessary use of non portable 'replace' sql and add loging when GD not installed --- apps/gallery/ajax/thumbnail.php | 3 +++ apps/gallery/lib_scanner.php | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/gallery/ajax/thumbnail.php b/apps/gallery/ajax/thumbnail.php index f24782390f6..325adb46bda 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": 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)); } } From 42306f1e35f901346feffed296397b2ed751fe74 Mon Sep 17 00:00:00 2001 From: Brice Maron Date: Sat, 22 Oct 2011 11:34:49 +0200 Subject: [PATCH 7/9] Avoid error when no image is provided for cover or thumbnail --- apps/gallery/ajax/getCovers.php | 8 ++++++-- apps/gallery/ajax/thumbnail.php | 14 ++++++++------ 2 files changed, 14 insertions(+), 8 deletions(-) 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 325adb46bda..a1416452932 100644 --- a/apps/gallery/ajax/thumbnail.php +++ b/apps/gallery/ajax/thumbnail.php @@ -21,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) { @@ -50,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 From af1f0305eb6a9bbb918cdba0afd7777ef533fa06 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Sat, 22 Oct 2011 12:03:34 +0200 Subject: [PATCH 8/9] fix log level check --- lib/log.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/log.php b/lib/log.php index a951b676037..98333be54fe 100644 --- a/lib/log.php +++ b/lib/log.php @@ -41,7 +41,7 @@ class OC_Log{ */ public static function write($app,$message,$level){ $minLevel=OC_Config::getValue( "loglevel", 2 ); - if($level>$minLevel){ + if($level>=$minLevel){ $datadir=OC_Config::getValue( "datadirectory", OC::$SERVERROOT.'/data' ); $logFile=OC_Config::getValue( "logfile", $datadir.'/owncloud.log' ); $entry=array('app'=>$app,'message'=>$message,'level'=>$level,'time'=>time()); From 7761765a4b018f41c945946693226f8b5a99487c Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Sat, 22 Oct 2011 12:31:07 +0200 Subject: [PATCH 9/9] change licencing headers for sqlite3 driver --- lib/MDB2/Driver/Datatype/sqlite3.php | 65 +++++++++------------------- lib/MDB2/Driver/Function/sqlite3.php | 64 +++++++++------------------ lib/MDB2/Driver/Manager/sqlite3.php | 64 +++++++++------------------ lib/MDB2/Driver/Native/sqlite3.php | 64 +++++++++------------------ lib/MDB2/Driver/Reverse/sqlite3.php | 64 +++++++++------------------ lib/MDB2/Driver/sqlite3.php | 64 +++++++++------------------ 6 files changed, 120 insertions(+), 265 deletions(-) diff --git a/lib/MDB2/Driver/Datatype/sqlite3.php b/lib/MDB2/Driver/Datatype/sqlite3.php index 378d5540cbe..d74badbe4f1 100644 --- a/lib/MDB2/Driver/Datatype/sqlite3.php +++ b/lib/MDB2/Driver/Datatype/sqlite3.php @@ -1,49 +1,24 @@ . + * + */ require_once('MDB2/Driver/Datatype/Common.php'); diff --git a/lib/MDB2/Driver/Function/sqlite3.php b/lib/MDB2/Driver/Function/sqlite3.php index 0d6b329f0ad..a013aea165a 100644 --- a/lib/MDB2/Driver/Function/sqlite3.php +++ b/lib/MDB2/Driver/Function/sqlite3.php @@ -1,48 +1,24 @@ | -// +----------------------------------------------------------------------+ -// -// +/** + * ownCloud + * + * @author Robin Appelman + * @copyright 2011 Robin Appelman icewind1991@gmail.com + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE + * License as published by the Free Software Foundation; either + * version 3 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with this library. If not, see . + * + */ require_once('MDB2/Driver/Function/Common.php'); diff --git a/lib/MDB2/Driver/Manager/sqlite3.php b/lib/MDB2/Driver/Manager/sqlite3.php index eabbb72b3c2..c5c19a90fb5 100644 --- a/lib/MDB2/Driver/Manager/sqlite3.php +++ b/lib/MDB2/Driver/Manager/sqlite3.php @@ -1,48 +1,24 @@ | -// +----------------------------------------------------------------------+ -// -// +/** + * ownCloud + * + * @author Robin Appelman + * @copyright 2011 Robin Appelman icewind1991@gmail.com + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE + * License as published by the Free Software Foundation; either + * version 3 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with this library. If not, see . + * + */ require_once('MDB2/Driver/Manager/Common.php'); diff --git a/lib/MDB2/Driver/Native/sqlite3.php b/lib/MDB2/Driver/Native/sqlite3.php index 81dc67dea65..de650107238 100644 --- a/lib/MDB2/Driver/Native/sqlite3.php +++ b/lib/MDB2/Driver/Native/sqlite3.php @@ -1,48 +1,24 @@ | -// +----------------------------------------------------------------------+ -// -// +/** + * ownCloud + * + * @author Robin Appelman + * @copyright 2011 Robin Appelman icewind1991@gmail.com + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE + * License as published by the Free Software Foundation; either + * version 3 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with this library. If not, see . + * + */ require_once 'MDB2/Driver/Native/Common.php'; /** diff --git a/lib/MDB2/Driver/Reverse/sqlite3.php b/lib/MDB2/Driver/Reverse/sqlite3.php index d488977b158..d5595da84c5 100644 --- a/lib/MDB2/Driver/Reverse/sqlite3.php +++ b/lib/MDB2/Driver/Reverse/sqlite3.php @@ -1,48 +1,24 @@ | -// +----------------------------------------------------------------------+ -// -// +/** + * ownCloud + * + * @author Robin Appelman + * @copyright 2011 Robin Appelman icewind1991@gmail.com + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE + * License as published by the Free Software Foundation; either + * version 3 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with this library. If not, see . + * + */ require_once('MDB2/Driver/Reverse/Common.php'); diff --git a/lib/MDB2/Driver/sqlite3.php b/lib/MDB2/Driver/sqlite3.php index a41aeed4850..e42d36176c4 100644 --- a/lib/MDB2/Driver/sqlite3.php +++ b/lib/MDB2/Driver/sqlite3.php @@ -1,48 +1,24 @@ | -// +----------------------------------------------------------------------+ -// -// +/** + * ownCloud + * + * @author Robin Appelman + * @copyright 2011 Robin Appelman icewind1991@gmail.com + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE + * License as published by the Free Software Foundation; either + * version 3 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with this library. If not, see . + * + */ /** * MDB2 SQLite3 driver