From cedd2515b6b21404a419c1381a58b634b38aa304 Mon Sep 17 00:00:00 2001 From: z0rglub Date: Thu, 5 Aug 2004 17:38:14 +0000 Subject: non picture files management git-svn-id: http://piwigo.org/svn/trunk@470 68402e56-0260-453c-a942-63ccdbb3a9ee --- include/category_calendar.inc.php | 58 ++++++++++++++++++++++++++++-------- include/category_default.inc.php | 15 ++++++++-- include/category_recent_cats.inc.php | 14 +++++++-- include/category_subcats.inc.php | 14 +++++++-- 4 files changed, 79 insertions(+), 22 deletions(-) (limited to 'include') diff --git a/include/category_calendar.inc.php b/include/category_calendar.inc.php index 0c44c5ea8..6ce68f31d 100644 --- a/include/category_calendar.inc.php +++ b/include/category_calendar.inc.php @@ -234,9 +234,17 @@ SELECT file,tn_ext,date_available,storage_category_id $file = get_filename_wo_extension($row['file']); // creating links for thumbnail and associated category - $thumbnail_link = get_complete_dir($row['storage_category_id']); - $thumbnail_link.= 'thumbnail/'.$conf['prefix_thumbnail']; - $thumbnail_link.= $file.'.'.$row['tn_ext']; + if (isset($row['tn_ext']) and $row['tn_ext'] != '') + { + $thumbnail_link = get_complete_dir($row['storage_category_id']); + $thumbnail_link.= 'thumbnail/'.$conf['prefix_thumbnail']; + $thumbnail_link.= $file.'.'.$row['tn_ext']; + } + else + { + $thumbnail_link = './template/'.$user['template'].'/mimetypes/'; + $thumbnail_link.= strtolower(get_extension($row['file'])).'.png'; + } $name = $calendar_year.' ('.$nb_pics.')'; @@ -284,11 +292,19 @@ SELECT file,tn_ext,date_available,storage_category_id $row = mysql_fetch_array(mysql_query($query)); $file = get_filename_wo_extension($row['file']); - + // creating links for thumbnail and associated category - $thumbnail_link = get_complete_dir($row['storage_category_id']); - $thumbnail_link.= 'thumbnail/'.$conf['prefix_thumbnail']; - $thumbnail_link.= $file.'.'.$row['tn_ext']; + if (isset($row['tn_ext']) and $row['tn_ext'] != '') + { + $thumbnail_link = get_complete_dir($row['storage_category_id']); + $thumbnail_link.= 'thumbnail/'.$conf['prefix_thumbnail']; + $thumbnail_link.= $file.'.'.$row['tn_ext']; + } + else + { + $thumbnail_link = './template/'.$user['template'].'/mimetypes/'; + $thumbnail_link.= strtolower(get_extension($row['file'])).'.png'; + } $name = $lang['month'][$calendar_month]; $name.= ' '.$page['calendar_year']; @@ -344,9 +360,17 @@ SELECT file,tn_ext,date_available,storage_category_id $file = get_filename_wo_extension($row['file']); // creating links for thumbnail and associated category - $thumbnail_link = get_complete_dir($row['storage_category_id']); - $thumbnail_link.= 'thumbnail/'.$conf['prefix_thumbnail']; - $thumbnail_link.= $file.'.'.$row['tn_ext']; + if (isset($row['tn_ext']) and $row['tn_ext'] != '') + { + $thumbnail_link = get_complete_dir($row['storage_category_id']); + $thumbnail_link.= 'thumbnail/'.$conf['prefix_thumbnail']; + $thumbnail_link.= $file.'.'.$row['tn_ext']; + } + else + { + $thumbnail_link = './template/'.$user['template'].'/mimetypes/'; + $thumbnail_link.= strtolower(get_extension($row['file'])).'.png'; + } list($year,$month,$day) = explode('-', $calendar_day); $unixdate = mktime(0,0,0,$month,$day,$year); @@ -416,9 +440,17 @@ SELECT file,tn_ext,date_available,storage_category_id $file = get_filename_wo_extension($row['file']); // creating links for thumbnail and associated category - $thumbnail_link = get_complete_dir($row['storage_category_id']); - $thumbnail_link.= 'thumbnail/'.$conf['prefix_thumbnail']; - $thumbnail_link.= $file.'.'.$row['tn_ext']; + if (isset($row['tn_ext']) and $row['tn_ext'] != '') + { + $thumbnail_link = get_complete_dir($row['storage_category_id']); + $thumbnail_link.= 'thumbnail/'.$conf['prefix_thumbnail']; + $thumbnail_link.= $file.'.'.$row['tn_ext']; + } + else + { + $thumbnail_link = './template/'.$user['template'].'/mimetypes/'; + $thumbnail_link.= strtolower(get_extension($row['file'])).'.png'; + } $thumbnail_title = $lang['calendar_picture_hint'].$name; diff --git a/include/category_default.inc.php b/include/category_default.inc.php index 5c8023f73..c7069ae9e 100644 --- a/include/category_default.inc.php +++ b/include/category_default.inc.php @@ -85,9 +85,18 @@ while ($row = mysql_fetch_array($result)) $name = replace_search($name, $_GET['search']); } // thumbnail url - $thumbnail_url = $cat_directory; - $thumbnail_url.= 'thumbnail/'.$conf['prefix_thumbnail']; - $thumbnail_url.= $file.'.'.$row['tn_ext']; + if (isset($row['tn_ext']) and $row['tn_ext'] != '') + { + $thumbnail_url = $cat_directory; + $thumbnail_url.= 'thumbnail/'.$conf['prefix_thumbnail']; + $thumbnail_url.= $file.'.'.$row['tn_ext']; + } + else + { + $thumbnail_url = './template/'.$user['template'].'/mimetypes/'; + $thumbnail_url.= strtolower(get_extension($row['file'])).'.png'; + } + // message in title for the thumbnail $thumbnail_title = $row['file']; if ($row['filesize'] == '') diff --git a/include/category_recent_cats.inc.php b/include/category_recent_cats.inc.php index c91a738fa..283d15ec6 100644 --- a/include/category_recent_cats.inc.php +++ b/include/category_recent_cats.inc.php @@ -80,9 +80,17 @@ SELECT id,file,tn_ext,storage_category_id $file = get_filename_wo_extension( $subrow['file'] ); // creating links for thumbnail and associated category - $thumbnail_link = get_complete_dir( $subrow['storage_category_id'] ); - $thumbnail_link.= 'thumbnail/'.$conf['prefix_thumbnail']; - $thumbnail_link.= $file.'.'.$subrow['tn_ext']; + if (isset($subrow['tn_ext']) and $subrow['tn_ext'] != '') + { + $thumbnail_link = get_complete_dir($subrow['storage_category_id']); + $thumbnail_link.= 'thumbnail/'.$conf['prefix_thumbnail']; + $thumbnail_link.= $file.'.'.$subrow['tn_ext']; + } + else + { + $thumbnail_link = './template/'.$user['template'].'/mimetypes/'; + $thumbnail_link.= strtolower(get_extension($subrow['file'])).'.png'; + } $url_link = PHPWG_ROOT_PATH.'category.php?cat='.$row['category_id']; diff --git a/include/category_subcats.inc.php b/include/category_subcats.inc.php index cf63d7e1f..a7791a5a2 100644 --- a/include/category_subcats.inc.php +++ b/include/category_subcats.inc.php @@ -89,9 +89,17 @@ SELECT file,tn_ext,storage_category_id $file = get_filename_wo_extension($image_row['file']); // creating links for thumbnail and associated category - $thumbnail_link = get_complete_dir($image_row['storage_category_id']); - $thumbnail_link.= 'thumbnail/'.$conf['prefix_thumbnail']; - $thumbnail_link.= $file.'.'.$image_row['tn_ext']; + if (isset($image_row['tn_ext']) and $image_row['tn_ext'] != '') + { + $thumbnail_link = get_complete_dir($image_row['storage_category_id']); + $thumbnail_link.= 'thumbnail/'.$conf['prefix_thumbnail']; + $thumbnail_link.= $file.'.'.$image_row['tn_ext']; + } + else + { + $thumbnail_link = './template/'.$user['template'].'/mimetypes/'; + $thumbnail_link.= strtolower(get_extension($image_row['file'])).'.png'; + } $thumbnail_title = $lang['hint_category']; -- cgit v1.2.3