From 46873b13aa4a650f9b6e5c07855dd96f2c201dda Mon Sep 17 00:00:00 2001 From: z0rglub Date: Thu, 5 Aug 2004 17:27:09 +0000 Subject: - non picture files management - refactoring git-svn-id: http://piwigo.org/svn/trunk@464 68402e56-0260-453c-a942-63ccdbb3a9ee --- comments.php | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/comments.php b/comments.php index f829e44d7..38d2f5392 100644 --- a/comments.php +++ b/comments.php @@ -159,28 +159,39 @@ while ( $row = mysql_fetch_array( $result ) ) if (!empty($subrow['name'])) $name.= $subrow['name']; else $name.= str_replace( '_', ' ', $file ); $name.= ' [ '.$subrow['file'].' ]'; - // source of the thumbnail picture - $src = $array_cat_directories[$subrow['cat_id']]; - $src.= 'thumbnail/'.$conf['prefix_thumbnail']; - $src.= $file.'.'.$subrow['tn_ext']; - // link to the full size picture + // source of the thumbnail picture + if (isset($subrow['tn_ext']) and $subrow['tn_ext'] != '') + { + $src = $array_cat_directories[$subrow['cat_id']]; + $src.= 'thumbnail/'.$conf['prefix_thumbnail']; + $src.= $file.'.'.$subrow['tn_ext']; + } + else + { + $src = './template/'.$user['template'].'/mimetypes/'; + $src.= strtolower(get_extension($subrow['file'])).'.png'; + } + + // link to the full size picture $url = PHPWG_ROOT_PATH.'picture.php?cat='.$category_id; $url.= '&image_id='.$row['image_id']; - - $template->assign_block_vars('picture',array( - 'TITLE_IMG'=>$name, - 'I_THUMB'=>$src, - 'U_THUMB'=>add_session_id( $url ) - )); - + + $template->assign_block_vars( + 'picture', + array( + 'TITLE_IMG'=>$name, + 'I_THUMB'=>$src, + 'U_THUMB'=>add_session_id( $url ) + )); + // for each picture, retrieving all comments $query = 'SELECT * FROM '.COMMENTS_TABLE; $query.= ' WHERE image_id = '.$row['image_id']; $query.= ' AND date > FROM_UNIXTIME('.$maxtime.')'; - if ( $user['status'] != 'admin' ) + if ( $user['status'] != 'admin' ) { $query.= " AND validated = 'true'"; - } + } $query.= ' ORDER BY date DESC'; $query.= ';'; $handleresult = mysql_query( $query ); -- cgit v1.2.3