# 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
include "dmi-conf.inc.php";
include "dmi-lib.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,$WIDTH,$AREA);
#s_log("table_head: $table_head");
#echo "$table_head\n";
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>=$AREA)
break;
s_log("key: $key\tval: $val\tFIRST: $i\tcell_count: $cell_count");
if( $cell_count >= $WIDTH) {
$replace=array(
'###IMAGES###' => $img_row
);
$table_row.=h_template_get_parsed_file("$template_prefix-table_image-row", $replace);
$img_row='';
$cell_count = 0;
}
$thumb_size=is_array($thumb_infos[$key])?$thumb_infos[$key][3]:"width=$THUMB_WIDTH height=$THUMB_HEIGHT";
$thumb_name=str_replace("+", "%20", urlencode($files[$key]));
$thumb_alt=htmlspecialchars($files[$key]);
if(defined('__DMI_BIG')) {
$replace=array(
'###IMG_LINK###' => "$WEB_PHOTO_DIR/$thumb_name",
'###IMG_SIZE###' => "$thumb_size",
'###IMG_SRC###' => "$BIG_SCRIPT?thumb=1&name=$thumb_name",
'###IMG_ALT###' => "$thumb_alt",
'###IMG_CTIME###' => date($template_date_format,$img_infos[$key]['ctime']),
'###IMG_BORDER###' => "$THUMB_BORDER",
'###IMG_TITLE###' => $img_infos[$key]['title']
);
s_log("--------------------------------------------------------");
s_log("###IMG_TITLE###: ".$img_infos[$key]['title']);
$img_string=h_template_get_parsed_file("$template_prefix-table_image-big", $replace);
} else {
$replace=array(
'###IMG_LINK###' => "$BIG_SCRIPT?FIRST=$j",
'###IMG_SIZE###' => "$thumb_size",
'###IMG_SRC###' => "$THUMB_SCRIPT?name=$thumb_name",
'###IMG_ALT###' => "$thumb_alt",
'###IMG_CTIME###' => date($template_date_format,$img_infos[$key]['ctime']),
'###IMG_BORDER###' => "$THUMB_BORDER",
'###IMG_TITLE###' => $img_infos[$key]['title']
);
$img_string=h_template_get_parsed_file("$template_prefix-table_image", $replace);
}
$img_row.=$img_string;
$cell_count++;
$i++;
}
}
//if($BOT_NAV_SHOW)
// echo "$table_head\n";
// fill up all the empty sells
for($i=$cell_count;$i<$WIDTH;$i++) {
$img_row.=h_template_get_file("$template_prefix-table_image-empty");
}
$replace=array(
'###IMAGES###' => $img_row
);
$table_row.=h_template_get_parsed_file("$template_prefix-table_image-row", $replace);
$cell_count = 0;
$replace=array(
'###TABLE_WIDTH###' => $WIDTH,
'###TABLE_HEAD###' => $table_head,
'###TABLE_ROWS###' => $table_row
);
if(defined('__DMI_BIG'))
$table=h_template_get_parsed_file("$template_prefix-table-big", $replace);
else
$table=h_template_get_parsed_file("$template_prefix-table", $replace);
echo $table;
if($ALLOW_UPLOAD) {
?>