Changeset 307


Ignore:
Timestamp:
Jan 21, 2004, 11:03:20 PM (21 years ago)
Author:
z0rglub
Message:

Php warnings correction

File:
1 edited

Legend:

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

    r301 r307  
    2424
    2525check_cat_id( $_GET['cat_id'] );
     26
     27$errors = array();
     28
    2629if ( isset( $page['cat'] ) )
    2730{
     
    2932  if ( isset( $_POST['submit'] ) )
    3033  {
    31     $errors = array();
    3234    if ( isset( $_POST['associate'] ) )
    3335    {
     
    4850    }
    4951
     52    $associate = false;
     53   
    5054    $query = 'SELECT id,file';
    5155    $query.= ' FROM '.PREFIX_TABLE.'images';
     
    5458    $query.= ';';
    5559    $result = mysql_query( $query );
    56     $i = 1;
    5760    while ( $row = mysql_fetch_array( $result ) )
    5861    {
     
    9194
    9295        $query.= ', keywords = ';
     96
    9397        $keywords_array = get_keywords( $_POST[$keywords] );
    94         if ( count( $keywords_array ) == 0 )
    95           $query.= 'NULL';
    96         else
    97         {
    98           $query.= "'";
    99           foreach ( $keywords_array as $i => $keyword ) {
    100             if ( $i > 0 ) $query.= ',';
    101             $query.= $keyword;
    102           }
    103           $query.= "'";
    104         }
     98        if ( count( $keywords_array ) == 0 ) $query.= 'NULL';
     99        else $query.= "'".implode( ',', $keywords_array )."'";
    105100
    106101        $query.= ' WHERE id = '.$row['id'];
     
    109104      }
    110105      // add link to another category
    111       if ( $_POST['check-'.$row['id']] == 1 and count( $errors ) == 0 )
     106      if ( isset( $_POST['check-'.$row['id']] ) and count( $errors ) == 0 )
    112107      {
    113108        $query = 'INSERT INTO '.PREFIX_TABLE.'image_category';
     
    116111        $query.= ';';
    117112        mysql_query( $query );
     113        $associate = true;
    118114      }
    119115    }
    120116    update_category( $_POST['associate'] );
     117    if ( $associate ) synchronize_all_users();
    121118//------------------------------------------------------ update general options
    122     if ( $_POST['use_common_author'] == 1 )
     119    if ( isset( $_POST['use_common_author'] ) )
    123120    {
    124121      $query = 'SELECT image_id';
     
    143140      }
    144141    }
    145     if ( $_POST['use_common_date_creation'] == 1 )
     142    if ( isset( $_POST['use_common_date_creation'] ) )
    146143    {
    147144      if ( check_date_format( $_POST['date_creation_cat'] ) )
     
    234231  }
    235232
    236   if ( is_numeric( $_GET['num'] ) and $_GET['num'] >= 0 )
     233  if ( isset($_GET['num']) and is_numeric($_GET['num']) and $_GET['num'] >= 0 )
    237234  {
    238235    $page['start'] =
     
    277274  $array_cat_directories = array();
    278275
    279   $query = 'SELECT id,file,comment,author,tn_ext,name,date_creation,keywords';
    280   $query.= ',storage_category_id,category_id';
     276  $infos = array( 'id','file','comment','author','tn_ext','name'
     277                  ,'date_creation','keywords','storage_category_id'
     278                  ,'category_id' );
     279 
     280  $query = 'SELECT '.implode( ',', $infos );
    281281  $query.= ' FROM '.PREFIX_TABLE.'images';
    282282  $query.= ' INNER JOIN '.PREFIX_TABLE.'image_category ON id = image_id';
     
    288288  while ( $row = mysql_fetch_array( $result ) )
    289289  {
     290    foreach ($infos as $info) { if (!isset($row[$info])) $row[$info] = ''; }
     291   
    290292    $vtp->addSession( $sub, 'picture' );
    291293    $vtp->setVar( $sub, 'picture.id', $row['id'] );
     
    300302    $vtp->setVar( $sub, 'picture.default_name', $file );
    301303    // creating url to thumbnail
    302     if ( $array_cat_directories[$row['storage_category_id']] == '' )
     304    if ( !isset( $array_cat_directories[$row['storage_category_id']] ) )
    303305    {
    304306      $array_cat_directories[$row['storage_category_id']] =
Note: See TracChangeset for help on using the changeset viewer.