Ignore:
Timestamp:
Oct 23, 2004, 7:56:46 PM (20 years ago)
Author:
z0rglub
Message:
  • refactoring of comments.php
  • creation of function get_thumbnail_src used everywhere a thumbnail must be displayed
  • creation of function parse_comment_content (used in comments.php and picture.php)
  • concerning undefined index on arrays retrieved in database, instead of testing possibly unset values, use of @ operator (smarter...)
  • add pre tag in default.css stylesheet for debugging purpose (need to have left aligned text)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/infos_images.php

    r577 r579  
    320320  while ($row = mysql_fetch_array($result))
    321321  {
    322     if (!isset($array_cat_directories[$row['storage_category_id']]))
    323     {
    324       $array_cat_directories[$row['storage_category_id']] =
    325         get_complete_dir($row['storage_category_id']);
    326     }
    327 
    328     // thumbnail url
    329     if (isset($row['tn_ext']) and $row['tn_ext'] != '')
    330     {
    331       $thumbnail_url = $array_cat_directories[$row['storage_category_id']];
    332       $thumbnail_url.= 'thumbnail/'.$conf['prefix_thumbnail'];
    333       $thumbnail_url.= get_filename_wo_extension($row['file']);
    334       $thumbnail_url.= '.'.$row['tn_ext'];
    335     }
    336     else
    337     {
    338       $thumbnail_url = PHPWG_ROOT_PATH;
    339       $thumbnail_url = 'template/'.$user['template'].'/mimetypes/';
    340       $thumbnail_url.= strtolower(get_extension($row['file'])).'.png';
    341     }
    342 
    343     // some fields are nullable in the images table
    344     $nullables = array('name','author','keywords','date_creation','comment');
    345     foreach ($nullables as $field)
    346     {
    347       if (isset($row[$field]))
    348       {
    349         $$field = $row[$field];
    350       }
    351       else
    352       {
    353         $$field = '';
    354       }
    355     }
     322    $thumbnail_url = get_thumbnail_src($row['file'],
     323                                       $row['storage_category_id'],
     324                                       @$row['tn_ext']);
    356325
    357326    $template->assign_block_vars(
     
    363332        'FILENAME_IMG'=>$row['file'],
    364333        'DEFAULTNAME_IMG'=>get_filename_wo_extension($row['file']),
    365         'NAME_IMG'=>$name,
    366         'DATE_IMG'=>date_convert_back($date_creation),
    367         'AUTHOR_IMG'=>$author,
    368         'KEYWORDS_IMG'=>$keywords,
    369         'COMMENT_IMG'=>$comment
     334        'NAME_IMG'=>@$row['name'],
     335        'DATE_IMG'=>date_convert_back(@$row['date_creation']),
     336        'AUTHOR_IMG'=>@$row['author'],
     337        'KEYWORDS_IMG'=>@$row['keywords'],
     338        'COMMENT_IMG'=>@$row['comment']
    370339       ));
    371340  }
Note: See TracChangeset for help on using the changeset viewer.