Changeset 303


Ignore:
Timestamp:
Jan 19, 2004, 11:02:38 PM (20 years ago)
Author:
z0rglub
Message:

Php warnings corrections

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/release-1_3/picture.php

    r301 r303  
    3636initialize_category( 'picture' );
    3737//------------------------------------- main picture information initialization
    38 $query = 'SELECT id,date_available,comment,hit,keywords';
    39 $query.= ',author,name,file,date_creation,filesize,width,height';
    40 $query.= ',storage_category_id';
    41 if ( is_numeric( $page['cat'] ) )
    42 {
    43   $query.= ',category_id';
    44 }
     38$infos = array( 'id','date_available','comment','hit','keywords','author'
     39                ,'name','file','date_creation','filesize','width','height'
     40                ,'storage_category_id' );
     41
     42$query = 'SELECT '.implode( ',', $infos );
     43if ( is_numeric( $page['cat'] ) ) $query.= ',category_id';
    4544$query.= ' FROM '.PREFIX_TABLE.'images';
    4645$query.= ' INNER JOIN '.PREFIX_TABLE.'image_category AS ic';
     
    6160}
    6261$row = mysql_fetch_array( $result );
    63 $page['id']             = $row['id'];
    64 $page['file']           = $row['file'];
    65 $page['name']           = $row['name'];
    66 $page['date_available'] = $row['date_available'];
    67 $page['comment']        = $row['comment'];
    68 $page['hit']            = $row['hit'];
    69 $page['author']         = $row['author'];
    70 $page['date_creation']  = $row['date_creation'];
    71 $page['filesize']       = $row['filesize'];
    72 $page['width']          = $row['width'];
    73 $page['height']         = $row['height'];
    74 if (is_numeric( $page['cat'] ))
    75         $page['category_id']    = $row['category_id'];
    76 $page['keywords']       = $row['keywords'];
    77 $page['storage_category_id'] = $row['storage_category_id'];
     62
     63foreach ( $infos as $info ) {
     64  if ( isset( $row[$info] ) ) $page[$info] = $row[$info];
     65  else                        $page[$info] = '';
     66}
     67if ( is_numeric( $page['cat'] ) ) $page['category_id'] = $row['category_id'];
    7868// retrieving the number of the picture in its category (in order)
    7969$query = 'SELECT DISTINCT(id)';
Note: See TracChangeset for help on using the changeset viewer.