';
$numofrows++;
$x = 1;
}
$imagelist = get_image_list($twg_album, false, false);
// we do the autoskipthumbs!
$skip_thumbnail_page = $skip_thumbnail_page_orig;
if ($auto_skip_thumbnail_page && $twg_smallnav == 'FALSE') {
if (count($imagelist) <= (($numberofpics * 2) + 1)) {
$subs = get_directories($localdir . '/' . $val);
$nrsubs = count($subs);
if ($nrsubs == 0) {
$skip_thumbnail_page = true;
}
}
}
$folderfile = $basedir . '/' . $twg_album . '/folder.png';
if (file_exists($folderfile)) {
$folderfileexists = true;
$borderwidth = '';
$folderfile = 'folder.png';
// $overflowstyle = "";
} else {
if ($autocreate_folder_image) {
$folderfile = $cachedir . '/_' . md5($twg_album . $privatelogin) . '_folder_top.tmp.png';
if (file_exists($folderfile)) {
// we check the time if it's over 1 day if yes we delete it
if ((time() - filemtime($folderfile)) >= $precache_main_top_x_interval * 3600) {
@unlink($folderfile);
}
}
clearstatcache ();
if (!file_exists($folderfile)) { // too old or it does not exist!
// create folder_top.png
$no_session_cache=true;
$folder_top = getTopXViewsImage($twg_album);
$imagesrc = $basedir . "/" . $twg_album . "/" . $folder_top;
if ($folder_top && file_exists($imagesrc)) {
// we create the folderfile ....
$imagesrc = $basedir . "/" . $twg_album . "/" . $folder_top;
// create the cache image in the right resolution!
include_once dirname(__FILE__) . "/imagefunctions.inc.php";
$print_watermark = false;
$print_text=false;
$show_clipped_images=true;
if (generatesmall($imagesrc, $folderfile, $menu_pic_size_x, $compression, 0, '')) {
$folderfileexists = true;
$folderfilecache = true;
$borderwidth = '';
} else { // image could not be generated. We use the default settings.
$folderfileexists = false;
$borderwidth = "width:" . $menu_pic_size_x . "px;";
}
} else {
$folderfileexists = false;
$borderwidth = "width:" . $menu_pic_size_x . "px;";
}
} else {
$folderfilecache = true;
$folderfileexists = true;
$borderwidth = '';
}
} else {
$folderfileexists = false;
$borderwidth = "width:" . $menu_pic_size_x . "px;";
}
// $overflowstyle = " style='overflow:hidden;' ";
}
if ($privatecheck) {
$privateimage = $basedir . "/" . $twg_album . "/private.png";
if (file_exists($privateimage)) {
$borderwidth = '';
// $overflowstyle = "";
} else {
$borderwidth = "width:" . $menu_pic_size_x . "px;";
// $overflowstyle = " style='overflow:hidden;' ";
}
}
$menuborder = ($hide_overview_image_border) ? '0' : '1';
// check new !
if (isset($_SESSION['new_tree'])) {
$new_galleries = $_SESSION['new_tree'];
} else {
$new_galleries = array();
}
if ($show_changes > 0 && $show_changes_type == "highlight" && in_array($basedir . "/" . $twg_album, $new_galleries)) {
$newstyle = " highlight";
} else {
$newstyle = '';
}
echo '';
if ($folderfileexists || $privatecheck) {
echo "";
includeMainAlbumDescriptionL($basedir . "/" . $twg_album);
echo '';
} else {
echo "";
includeMainAlbumDescriptionL($basedir . "/" . $twg_album);
echo "";
}
//
echo ' '; // center is needed - because thunderbird does otherwise not center !
// wenn angemeldet - alles gut
$new_link = '';
$twg_foffset_link = '';
if ($twg_foffset != '' && $twg_foffset != '0' && $twg_foffset != '0,0' ) { //
$twg_foffset_link = '&twg_foffset=' . $twg_foffset;
if (!$skip_thumbnail_page) {
$twg_foffset_link .= ',0';
}
}
if (!$privatecheck) {
$folderlink = $basedir . '/' . $twg_album . '/folderlink.txt';
if (file_exists($folderlink)) {
$folderlinkcontent = getFileContent($folderlink, '');
echo $folderlinkcontent;
} else if ($skip_thumbnail_page) { // we jump direct to the details page - x ist not found - by default the 1st image is twg_shown
$new_link = '';
} else {
$new_link = '';
}
}
// NEW SYMBOL
if ($show_changes > 0 && $show_changes_type == "image" && in_array($basedir . "/" . $twg_album, $new_galleries)) {
echo "".$new_link."  ";
if ($new_link != '') {
echo '';
}
echo ' ';
}
echo $new_link;
// END NEW SYMBOL
// if not logged in - we show the login iframe
if (!$privatecheck) {
if ($folderfileexists) {
$fadeold = $fade; // save settings
if ($folderfilecache) {
$folderfileindirect = $folderfile;
} else {
if (isset($direct_folderpng) && $direct_folderpng) { // TODO: remove in 1.7.8 because then the parameter does exist in all configs.
$folderfileindirect = $install_dir . $basedir .'/'. $twg_album . '/' .$folderfile;
} else {
$folderfileindirect = $install_dir . 'image.php?twg_album='.$album_enc.'&twg_type=png&twg_show=' . $folderfile;
}
}
$folderfile2 = $install_dir . $basedir . "/" . $twg_album . "/folder2.png";
if (file_exists($folderfile2)) { // we replace the fade effect!
// the js src is needed because of the preloader to work properly!
$folderfileindirect2js = $install_dir . 'image.php?twg_album='.$album_enc.'&twg_type=png&twg_show=folder2.png';
$fade = " onMouseout='this.src=\"" . $folderfileindirect . "\"' onmouseover='this.src=\"" . $folderfileindirect2js . "\"' ";
echo "";
}
if (!$resize_folder_gif) {
echo " "; // width='" . $menu_pic_size_x . "' height='" . $menu_pic_size_y . "'
} else {
echo " "; //
}
$fade = $fadeold; // restore
} else if ($imagelist == false) {
if (!$resize_folder_gif) {
$pad = ($menu_pic_size_y / 2)-23; // div before with pad only top!
// echo "";
//echo $new_link; // fix ie;
//echo "";
echo " ";
//if ($new_link != "") { // fix ie
// echo "";
//}
// echo "";
} else {
echo " ";
}
} else {
if ($show_colage) { // here we decide if we use 1 image or 4 for he galleryimage
$show_col = 4;
$show_dif = 2;
} else {
$show_col = 1;
$show_dif = 1;
}
if ($use_random_image_for_folder) {
srand ((double)microtime() * 100000); // needed before 4.2 !
$nrrand = (count($imagelist) > 3) ? 4 : count($imagelist);
if (count($imagelist) == 1) {
$keylist = array(0);
} else {
$keylist = array_rand ($imagelist, $nrrand);
}
if ($folder_effect == "change") {
if ($use_random_image_for_change) {
srand ((double)microtime() * 11111 + 4); // needed before 4.2 !
$nrrand2 = (count($imagelist) > 3) ? 4 : count($imagelist);
if (count($imagelist) == 1) {
$keylistchange = array(0);
} else {
$keylistchange = array_rand ($imagelist, $nrrand2);
}
} else {
$keylistchange = array_reverse($keylist);
}
}
// echo "vals" . count($imagelist) . ":" . $keylist[0] . $keylist[1] . $keylist[2] . $keylist[3];
} else {
$nrimages = count($imagelist);
$keylist = array(0, 1, 2, 3);
if ($folder_effect == "change") {
if ($use_random_image_for_change) {
srand ((double)microtime() * 11111 + 4); // needed before 4.2 !
$nrrand = ($nrimages > 3) ? 4 : $nrimages;
if ($nrimages == 1) {
$keylistchange = array(0);
} else {
$keylistchange = array_rand ($imagelist, $nrrand);
}
} else {
if ($nrimages > 3) {
$keylistchange = array(3, 2, 1, 0);
} else if ($nrimages > 2) {
$keylistchange = array(2, 0, 1, 0);
} else if ($nrimages > 1) {
$keylistchange = array(1, 0, 0, 0);
} else {
$keylistchange = array(0, 1, 2, 3);
}
}
}
}
// we twg_show a collage of 2x2 or 1 image depending on $show_colage
echo "";
for($current = 0, $i = 0; $i < $show_col; $i++) {
if ($i >= count($imagelist)) {
printf(" ", $fade, $install_dir, $menu_pic_size_x / $show_dif, $menu_pic_size_y / $show_dif);
} else {
$width = $menu_pic_size_x / $show_dif;
$height = $menu_pic_size_y / $show_dif;
$aktimage = replace_valid_url($imagelist[$keylist[$i]]);
$thumbimage = create_thumb_image($twg_album, $aktimage);
$thumb = create_cache_file($thumbimage,$extension_thumb);
if ($folder_effect == "change") {
$aktimagechange = $imagelist[$keylistchange[$i]];
$thumbimagechange = create_thumb_image($twg_album, $aktimagechange);
$thumbchange = create_cache_file(cacheencode($thumbimagechange),$extension_thumb,true);
}
if (!file_exists($thumb) || $disable_direct_thumbs_access) {
$ccomment = '';
loadXMLFiles($twg_album);
$ccount = getKommentarCount($imagelist[$i], $twg_album, $kwerte, $kindex);
if ($ccount > 0) {
$ccomment = "&twg_comment=" . $ccount; // this is done to cut of the upper right corner to indicate a comment!
}
if ($folder_effect == "change") {
$thumbchange = $install_dir . 'image.php?twg_album='.$album_enc.'&twg_type=thumb&twg_show=' . $aktimagechange;
$fadeall = " onMouseout='MM_swapImgRestore()' onmouseover=\"MM_swapImage('id" . (($xx * 100) + $i) . "','','" . $thumbchange . "',1);\" ";
$fade = $fadeall;
}
if ($show_colage) {
printf(" ", $fadeall , ($xx * 100) + $i , $install_dir , $album_enc, $imagelist[$keylist[$i]], $ccomment, $width, $height);
} else {
if ($show_clipped_images) {
printf(" ", $fade , (($xx * 100) + $i) , $install_dir, $album_enc, $imagelist[$keylist[$i]], $ccomment, $height, $height);
} else {
printf(" ", $fade , (($xx * 100) + $i) , $install_dir, $album_enc, $imagelist[$keylist[$i]], $ccomment);
}
}
} else {
$thumb = create_cache_file(cacheencode($thumbimage),$extension_thumb,true);
if ($folder_effect == "change") {
$fadeall = " onMouseout='MM_swapImgRestore()'
onmouseover=\"MM_swapImage('id" . (($xx * 100) + $i) . "','','" . ($thumbchange) . "',1);\" ";
$fade = $fadeall;
}
if ($show_colage) {
printf(" ", $fadeall, (($xx * 100) + $i) , $thumb, $width, $height);
} else {
if ($show_clipped_images) {
printf(" ", $fade, (($xx * 100) + $i) , $thumb, $height, $height);
} else {
printf(" ", $fade, (($xx * 100) + $i) , $thumb);
}
// this version shrinks the image to the right size - is not used because browser does the sameif you leave out the width
// printf(" ", $thumb, $xx, $xx, $width, $height, $twg_album);
}
}
}
if ($i == 1) {
echo " ";
}
}
echo "";
}
echo "";
} else {
$privateimage = $basedir . "/" . $twg_album . "/private.png";
$have_priv_image = file_exists($privateimage);
if (!$have_priv_image && $autogenerate_private_png) {
// we generate one with the first and store this in the cache !
if (isset($imagelist[0])) {
$image1 = $basedir . "/" . $twg_album . "/" . urldecode($imagelist[0]);
$cacheimage = $cachedir . "/pi_" . sha1($twg_album) . ".jpg";
if (!file_exists($cacheimage)) {
// create the cache image in the right resolution!
include_once dirname(__FILE__) . "/imagefunctions.inc.php";
$print_watermark = true;
$watermark_small= $install_dir . "buttons/private.gif";
$position= 5;
$transparency = 0;
$show_clipped_images=true;
generatesmall($image1, $cacheimage, $menu_pic_size_x, $compression, 0, '');
}
}
}
// we show the private picture
if ($session_available) {
$priv_link = "";
} else {
$priv_link = "";
}
if (!$have_priv_image && (!$autogenerate_private_png || !isset($imagelist[0]))) {
echo " ";
}
echo $priv_link;
if ($have_priv_image) {
$privatefileindirect = $install_dir . 'image.php?twg_album='.$album_enc.'&twg_type=png&twg_show=private.png';
if (!$resize_folder_gif) {
echo "  ";
} else {
echo "  ";
}
} else {
if ($autogenerate_private_png && isset($imagelist[0])) {
// echo "  ";
echo "  ";
} else {
echo "  ";
}
}
echo "";
if (!$have_priv_image && (!$autogenerate_private_png || !isset($imagelist[0]))) {
echo ' ';
}
}
echo ' | ';
//
includeMainAlbumDescriptionR($basedir . '/' . $twg_album);
echo ' ';
if (!hasAlbumDescription($basedir . '/' . $twg_album)) {
if (!$privatecheck) {
if (file_exists($folderlink)) {
echo $folderlinkcontent;
} else
echo $new_link;
} else {
echo $priv_link;
}
printf("%s", $titel);
if ($show_number_of_pic) {
printf(" (%d)", $nr_count_tree);
}
if ($privategal) {
if (in_array($privatelogin, $passwd)) {
printf("", $_SERVER['PHP_SELF'] , $twg_standalone);
echo " ";
} else {
echo " ";
}
}
echo '';
}
echo ' | ';
}
}
echo ' ';
echo ' ';
echo '';
//
// pager line
//
$menuxy = $menu_x * $menu_y ;
$actpage = 0;
if ($basedir != $localdir) {
$album_next = '&twg_album=' . urlencode(substr($localdir, strlen($basedir) + 1));
$album_next_js = '&twg_album=' . urlencode(substr($localdir, strlen($basedir) + 1));
} else {
$album_next = $album_next_js = '';
}
if ($nr > $menuxy) {
if ($paging_use_style) {
echo ' ';
echo '';
} else {
echo ' ';
}
if ($twg_foffset_local > 0) {
$twg_back_offset = $twg_foffset_prefix . ($twg_foffset_local - $menuxy);
if ($twg_back_offset != '' && $twg_back_offset != '0' && $twg_back_offset != '0,0') { //
$twg_back_offset = '?twg_foffset=' . $twg_back_offset;
} else {
$twg_back_offset = '?';
}
$hreflast = $_SERVER['PHP_SELF'] . $twg_back_offset . $album_next;
$hreflast_js = $_SERVER['PHP_SELF'] . $twg_back_offset. $album_next_js;
echo '';
printf(" %s ", $hreflast . $twg_standalone , $lang_thumb_back);
echo $spacer_char;
} else {
echo ' ' . $lang_thumb_back . ' ';
}
$numpages = ceil($nr / $menuxy);
if ($numpages <= $paging_steps) { // we show all
$paging_num = $paging_steps;
}
if ($numpages <= 25) { // 10 Schritte
$paging_steps = ceil($paging_steps/2);
}
for($i = 0; $i < $numpages ; $i++) {
$twg_foffset_ = $i * ($menuxy);
$trenner = false;
if ($twg_foffset_local >= $twg_foffset_ && $twg_foffset_local < $twg_foffset_+$menuxy) {
$actpage = $i;
echo "" . ($i + 1) . "";
$trenner = true;
} else {
if ( (abs($twg_foffset_local - $twg_foffset_) < ($paging_num * $menuxy)) || ($i == $numpages-1) || ($i == 0) || (($i % $paging_steps) == $paging_steps-1)) {
$twg_act_foffset = $twg_foffset_prefix . $twg_foffset_;
if ($twg_act_foffset != '' && $twg_act_foffset != '0' && $twg_act_foffset != '0,0') { //
$twg_act_foffset = '?twg_foffset=' . $twg_act_foffset;
} else {
$twg_act_foffset = '?';
}
printf("%s", $_SERVER['PHP_SELF'], $twg_act_foffset, $album_next, $twg_standalone , $i + 1);
$trenner = true;
}
}
if ($trenner && $actpage != $numpages - 1) {
echo $spacer_char;
}
}
if ($actpage != $numpages - 1) {
$twg_next_offset = $twg_foffset_prefix . ($twg_foffset_local + $menuxy);
if ($twg_next_offset != '' && $twg_next_offset != '0' && $twg_next_offset != '0,0') { //
$twg_next_offset = "?twg_foffset=" . $twg_next_offset;
} else {
$twg_next_offset = '?';
}
$hrefnext = $_SERVER['PHP_SELF']. $twg_next_offset . $album_next;
$hrefnext_js = $_SERVER['PHP_SELF']. $twg_next_offset . $album_next_js;
echo '';
printf(" %s ", $hrefnext . $twg_standalone , $lang_thumb_forward);
} else {
echo ' ' . $lang_thumb_forward . ' ';
}
if ($paging_use_style) {
echo '';
echo '
';
}
}
if ($basedir != $localdir && $show_subdirs_first) {
echo ' ';
}
// we return how many rows we twg_show because this is subtracted from the number of images rows twg_show on the same page
return $numofrows;
}
?> |