# Copyright (c) 2002 Sandino Araico Sánchez /* This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ # Changelog: # 2002-01-25 Tony J. White tjw@tjw.org - DirectoryMediaIndex (dmi) 1.2 # 2002-03-14 Sandino Araico Sánchez - separated dmi-gal from dmi-1.2.php # Reverse chronological order # Single image navigation # Config font size for the Thumbnails text # View thumbnails message # 2002-04-09 Sandino Araico Sánchez - HOPP templates support # Different templates for dmi-big # 2002-04-20 Sandino Araico Sánchez - Fixed missing title in thumbnail Bug # 2002-08-29 Sandino Araico Sánchez - Moved config to constants include "dmi-conf.inc.php"; include "dmi-core.inc"; $listing = getListing(); $files = $listing[0]; $thumb_infos = $listing[1]; $img_infos = $listing[2]; $sort_infos = $listing[3]; $numfiles=count($sort_infos); $table_head=getTableHead($numfiles,$FIRST,__DMI_TABLE_COLS,__DMI_TABLE_AREA); #s_log("table_head: $table_head"); #echo "$table_head\n"; s_log("Before sort infos"); if(is_array($sort_infos)) { //reset($sort_infos); $i = 0; $j=-1; $cell_count = 0; foreach ($sort_infos as $key => $val) { $j++; s_log("key: $key\tval: $val\tFIRST: $i\tcell_count: $cell_count"); if($j<$FIRST) continue; s_log("key: $key\tval: $val\tFIRST: $i\tcell_count: $cell_count"); if($i>=__DMI_TABLE_AREA) break; s_log("key: $key\tval: $val\tFIRST: $i\tcell_count: $cell_count"); if( $cell_count >= __DMI_TABLE_COLS) { $replace=array( '###IMAGES###' => $img_row ); $table_row.=h_template_get_parsed_file(__DMI_TEMPLATE_PREFIX."-table_image-row", $replace); $img_row=''; $cell_count = 0; } $thumb_size=is_array($thumb_infos[$key])?$thumb_infos[$key][3]:('width='.__DMI_THUMB_WIDTH.' height='.__DMI_THUMB_HEIGHT); $thumb_name=str_replace("+", "%20", urlencode($files[$key])); $thumb_alt=htmlspecialchars($files[$key]); if(defined('__DMI_BIG')) { $replace=array( '###IMG_LINK###' => __DMI_WEB_PHOTO_DIR."/$thumb_name", '###IMG_SIZE###' => "$thumb_size", '###IMG_SRC###' => __DMI_BIG_SCRIPT."?thumb=1&name=$thumb_name", '###IMG_ALT###' => "$thumb_alt", '###IMG_CTIME###' => date(__DMI_TEMPLATE_DATE_FORMAT,$img_infos[$key]['ctime']), '###IMG_BORDER###' => __DMI_THUMB_BORDER, '###IMG_TITLE###' => $img_infos[$key]['title'] ); s_log("------------------__DMI_BIG--------------------------------------"); s_log("###IMG_TITLE###: ".$img_infos[$key]['title']); $img_string=h_template_get_parsed_file(__DMI_TEMPLATE_PREFIX."-table_image-big", $replace); } else { $replace=array( '###IMG_LINK###' => __DMI_BIG_SCRIPT."?FIRST=$j", '###IMG_SIZE###' => "$thumb_size", '###IMG_SRC###' => __DMI_THUMB_SCRIPT."?name=$thumb_name", '###IMG_ALT###' => "$thumb_alt", '###IMG_CTIME###' => date(__DMI_TEMPLATE_DATE_FORMAT,$img_infos[$key]['ctime']), '###IMG_BORDER###' => __DMI_THUMB_BORDER, '###IMG_TITLE###' => $img_infos[$key]['title'] ); s_log("--------------------------------------------------------"); s_log("template_prefix: ".__DMI_TEMPLATE_PREFIX); $img_string=h_template_get_parsed_file(__DMI_TEMPLATE_PREFIX."-table_image", $replace); } $img_row.=$img_string; $cell_count++; $i++; } } if(__DMI_BOT_NAV_SHOW) echo "$table_head\n"; // fill up all the empty sells for($i=$cell_count;$i<__DMI_TABLE_COLS;$i++) { $img_row.=h_template_get_file(__DMI_TEMPLATE_PREFIX."-table_image-empty"); } $replace=array( '###IMAGES###' => $img_row ); $table_row.=h_template_get_parsed_file(__DMI_TEMPLATE_PREFIX."-table_image-row", $replace); $cell_count = 0; $replace=array( '###TABLE_WIDTH###' => __DMI_TABLE_COLS, '###TABLE_HEAD###' => $table_head, '###TABLE_ROWS###' => $table_row ); if(defined('__DMI_BIG')) $table=h_template_get_parsed_file(__DMI_TEMPLATE_PREFIX."-table-big", $replace); else $table=h_template_get_parsed_file(__DMI_TEMPLATE_PREFIX."-table", $replace); echo $table; if($ALLOW_UPLOAD) { ?>