aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorz0rglub <z0rglub@piwigo.org>2004-08-05 17:27:09 +0000
committerz0rglub <z0rglub@piwigo.org>2004-08-05 17:27:09 +0000
commit46873b13aa4a650f9b6e5c07855dd96f2c201dda (patch)
tree7c0cd97e12b9d966a170b12d36318e17cbb538bd
parent52a3531e7e140077c7fd4ce82acfc085091fffb0 (diff)
- non picture files management
- refactoring git-svn-id: http://piwigo.org/svn/trunk@464 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r--comments.php39
1 files 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.= '&amp;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 );