From 138fe984a2838a19571c0e8f1888a9c8c3ebe68b Mon Sep 17 00:00:00 2001 From: z0rglub Date: Sun, 3 Oct 2004 18:58:00 +0000 Subject: bug 43 : disable possibility to create thumbnail for pictures containing wrong characters git-svn-id: http://piwigo.org/svn/branches/release-1_3@549 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin/thumbnail.php | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/admin/thumbnail.php b/admin/thumbnail.php index 75ecc60eb..d2269762f 100644 --- a/admin/thumbnail.php +++ b/admin/thumbnail.php @@ -47,17 +47,20 @@ function get_images_without_thumbnail( $dir ) { while ( $file = readdir( $opendir ) ) { - $path = $dir.'/'.$file; - if ( is_image( $path, true ) ) + if (preg_match('/^[a-zA-Z0-9-_.]+$/', $file)) { - if ( !TN_exists( $dir, $file ) ) + $path = $dir.'/'.$file; + if ( is_image( $path, true ) ) { - $image_infos = getimagesize( $path ); - $size = floor( filesize( $path ) / 1024 ). ' KB'; - array_push( $images, array( 'name' => $file, - 'width' => $image_infos[0], - 'height' => $image_infos[1], - 'size' => $size ) ); + if ( !TN_exists( $dir, $file ) ) + { + $image_infos = getimagesize( $path ); + $size = floor( filesize( $path ) / 1024 ). ' KB'; + array_push( $images, array( 'name' => $file, + 'width' => $image_infos[0], + 'height' => $image_infos[1], + 'size' => $size ) ); + } } } } @@ -427,4 +430,4 @@ else } //----------------------------------------------------------- sending html code $vtp->Parse( $handle , 'sub', $sub ); -?> \ No newline at end of file +?> -- cgit v1.2.3