From 1d7758f029c150046aae7da7e089bd1e4e813a76 Mon Sep 17 00:00:00 2001 From: z0rglub Date: Mon, 22 Sep 2003 20:45:44 +0000 Subject: Filename must use the same characters as the directories git-svn-id: http://piwigo.org/svn/trunk@160 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin/update.php | 59 ++++++++++++++++++++++++++++++++------------------------ 1 file changed, 34 insertions(+), 25 deletions(-) (limited to 'admin') diff --git a/admin/update.php b/admin/update.php index 56f96e336..1c8b49634 100644 --- a/admin/update.php +++ b/admin/update.php @@ -219,35 +219,44 @@ function insert_local_image( $rep, $category_id ) $result = mysql_query( $query ); if ( mysql_num_rows( $result ) == 0 ) { - $picture = array(); - $picture['file'] = $file; - $picture['tn_ext'] = $tn_ext; - $picture['date'] = date( 'Y-m-d', filemtime ( $rep.'/'.$file ) ); - $picture['filesize'] = floor( filesize( $rep.'/'.$file ) / 1024); - $image_size = @getimagesize( $rep.'/'.$file ); - $picture['width'] = $image_size[0]; - $picture['height'] = $image_size[1]; - if ( $waiting['validated'] == 'true' ) + // the name of the file must not use acentuated characters or + // blank space.. + if ( preg_match( '/^[a-zA-Z0-9-_.]+$/', $file ) ) { - // retrieving infos from the XML description of - // $waiting['infos'] - $infos = nl2br( $waiting['infos'] ); - $picture['author'] = getAttribute( $infos, 'author' ); - $picture['comment'] = getAttribute( $infos, 'comment' ); - $unixtime = getAttribute( $infos, 'date_creation' ); - $picture['date_creation'] = ''; - if ( $unixtime != '' ) + $picture = array(); + $picture['file'] = $file; + $picture['tn_ext'] = $tn_ext; + $picture['date'] = date( 'Y-m-d', filemtime($rep.'/'.$file) ); + $picture['filesize'] = floor( filesize($rep.'/'.$file) / 1024); + $image_size = @getimagesize( $rep.'/'.$file ); + $picture['width'] = $image_size[0]; + $picture['height'] = $image_size[1]; + if ( $waiting['validated'] == 'true' ) { - $picture['date_creation'] = date( 'Y-m-d', $unixtime ); + // retrieving infos from the XML description of + // $waiting['infos'] + $infos = nl2br( $waiting['infos'] ); + $picture['author'] = getAttribute( $infos, 'author' ); + $picture['comment'] = getAttribute( $infos, 'comment'); + $unixtime = getAttribute( $infos, 'date_creation' ); + $picture['date_creation'] = ''; + if ( $unixtime != '' ) + $picture['date_creation'] = date( 'Y-m-d', $unixtime ); + $picture['name'] = getAttribute( $infos, 'name' ); + // deleting the waiting element + $query = 'DELETE FROM '.PREFIX_TABLE.'waiting'; + $query.= ' WHERE id = '.$waiting['id']; + $query.= ';'; + mysql_query( $query ); } - $picture['name'] = getAttribute( $infos, 'name' ); - // deleting the waiting element - $query = 'DELETE FROM '.PREFIX_TABLE.'waiting'; - $query.= ' WHERE id = '.$waiting['id']; - $query.= ';'; - mysql_query( $query ); + array_push( $pictures, $picture ); } - array_push( $pictures, $picture ); + else + { + $output.= '"'.$file.'" : '; + $output.= $lang['update_wrong_dirname'].'
'; + } + } } else -- cgit v1.2.3