aboutsummaryrefslogtreecommitdiffstats
path: root/picture.php
diff options
context:
space:
mode:
authorz0rglub <z0rglub@piwigo.org>2004-01-19 22:02:38 +0000
committerz0rglub <z0rglub@piwigo.org>2004-01-19 22:02:38 +0000
commitff1fbe962e5b47f24eadc249cef1380235773375 (patch)
tree53e6d495ad8653c684a88ff6f8d61250d374e829 /picture.php
parentdd6edbb30c9ab2d8de213d3316ed362136fb2be3 (diff)
Php warnings corrections
git-svn-id: http://piwigo.org/svn/branches/release-1_3@303 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'picture.php')
-rw-r--r--picture.php34
1 files changed, 12 insertions, 22 deletions
diff --git a/picture.php b/picture.php
index 9430ef538..6c8815458 100644
--- a/picture.php
+++ b/picture.php
@@ -35,13 +35,12 @@ $query.= ';';
//-------------------------------------------------------------- initialization
initialize_category( 'picture' );
//------------------------------------- main picture information initialization
-$query = 'SELECT id,date_available,comment,hit,keywords';
-$query.= ',author,name,file,date_creation,filesize,width,height';
-$query.= ',storage_category_id';
-if ( is_numeric( $page['cat'] ) )
-{
- $query.= ',category_id';
-}
+$infos = array( 'id','date_available','comment','hit','keywords','author'
+ ,'name','file','date_creation','filesize','width','height'
+ ,'storage_category_id' );
+
+$query = 'SELECT '.implode( ',', $infos );
+if ( is_numeric( $page['cat'] ) ) $query.= ',category_id';
$query.= ' FROM '.PREFIX_TABLE.'images';
$query.= ' INNER JOIN '.PREFIX_TABLE.'image_category AS ic';
$query.= ' ON id = ic.image_id';
@@ -60,21 +59,12 @@ if ( mysql_num_rows( $result ) == 0 )
exit();
}
$row = mysql_fetch_array( $result );
-$page['id'] = $row['id'];
-$page['file'] = $row['file'];
-$page['name'] = $row['name'];
-$page['date_available'] = $row['date_available'];
-$page['comment'] = $row['comment'];
-$page['hit'] = $row['hit'];
-$page['author'] = $row['author'];
-$page['date_creation'] = $row['date_creation'];
-$page['filesize'] = $row['filesize'];
-$page['width'] = $row['width'];
-$page['height'] = $row['height'];
-if (is_numeric( $page['cat'] ))
- $page['category_id'] = $row['category_id'];
-$page['keywords'] = $row['keywords'];
-$page['storage_category_id'] = $row['storage_category_id'];
+
+foreach ( $infos as $info ) {
+ if ( isset( $row[$info] ) ) $page[$info] = $row[$info];
+ else $page[$info] = '';
+}
+if ( is_numeric( $page['cat'] ) ) $page['category_id'] = $row['category_id'];
// retrieving the number of the picture in its category (in order)
$query = 'SELECT DISTINCT(id)';
$query.= ' FROM '.PREFIX_TABLE.'images';