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/picture_modify.php

    r577 r579  
    188188$row = mysql_fetch_array(mysql_query($query));
    189189
    190 // some fields are nullable in the images table
    191 $nullables = array('name','author','keywords','date_creation','comment',
    192                    'width','height');
    193 foreach ($nullables as $field)
    194 {
    195   if (!isset($row[$field]))
    196   {
    197     $row[$field] = '';
    198   }
    199 }
    200 
    201190if (empty($row['name']))
    202191{
     
    211200$dir_path = get_cat_display_name($current_category['name'], '->', '');
    212201
    213 // thumbnail url
    214 if (isset($row['tn_ext']) and $row['tn_ext'] != '')
    215 {
    216   $thumbnail_url = get_complete_dir($row['storage_category_id']);
    217   $thumbnail_url.= 'thumbnail/'.$conf['prefix_thumbnail'];
    218   $thumbnail_url.= get_filename_wo_extension($row['file']);
    219   $thumbnail_url.= '.'.$row['tn_ext'];
    220 }
    221 else
    222 {
    223   $thumbnail_url = PHPWG_ROOT_PATH;
    224   $thumbnail_url = 'template/'.$user['template'].'/mimetypes/';
    225   $thumbnail_url.= strtolower(get_extension($row['file'])).'.png';
    226 }
     202$thumbnail_url = get_thumbnail_src($row['file'],
     203                                   $row['storage_category_id'],
     204                                   @$row['tn_ext']);
    227205
    228206$url_img = PHPWG_ROOT_PATH.'picture.php?image_id='.$_GET['image_id'];
    229207$url_img .= '&cat='.$row['storage_category_id'];
    230208$date = isset($_POST['date_creation']) && empty($errors)
    231           ?$_POST['date_creation']:date_convert_back($row['date_creation']);
     209          ?$_POST['date_creation']:date_convert_back(@$row['date_creation']);
    232210
    233211// retrieving all the linked categories
     
    258236  'DEFAULT_NAME_IMG'=>str_replace('_',' ',get_filename_wo_extension($row['file'])),
    259237  'FILE_IMG'=>$row['file'],
    260   'NAME_IMG'=>isset($_POST['name'])?$_POST['name']:$row['name'],
    261   'SIZE_IMG'=>$row['width'].' * '.$row['height'],
    262   'FILESIZE_IMG'=>$row['filesize'].' KB',
     238  'NAME_IMG'=>isset($_POST['name'])?$_POST['name']:@$row['name'],
     239  'SIZE_IMG'=>@$row['width'].' * '.@$row['height'],
     240  'FILESIZE_IMG'=>@$row['filesize'].' KB',
    263241  'REGISTRATION_DATE_IMG'=> format_date($row['date_available']),
    264   'AUTHOR_IMG'=>isset($_POST['author'])?$_POST['author']:$row['author'],
     242  'AUTHOR_IMG'=>isset($_POST['author'])?$_POST['author']:@$row['author'],
    265243  'CREATION_DATE_IMG'=>$date,
    266   'KEYWORDS_IMG'=>isset($_POST['keywords'])?$_POST['keywords']:$row['keywords'],
    267   'COMMENT_IMG'=>isset($_POST['comment'])?$_POST['comment']:$row['comment'],
     244  'KEYWORDS_IMG'=>isset($_POST['keywords'])?$_POST['keywords']:@$row['keywords'],
     245  'COMMENT_IMG'=>isset($_POST['comment'])?$_POST['comment']:@$row['comment'],
    268246  'ASSOCIATED_CATEGORIES'=>$categories,
    269247 
Note: See TracChangeset for help on using the changeset viewer.