" . $lang_search_results . "
";
} else {
$show_spacer = false;
echo "" . sprintf($lang_topx, $number_top10) . "
";
echo "
";
$hrefstart = $install_dir . "image.php?twg_album=";
echo "";
// views
if ($show_count_views) {
if ($top10_type == "views") {
echo "" . $lang_fileinfo_views . "";
} else {
echo "" . $lang_fileinfo_views . "";
}
$show_spacer = true;
}
// download
if ($enable_download_counter && $show_download_counter && $enable_download) {
$show_spacer = print_spacer($show_spacer);
if ($top10_type == "dl") {
echo "" . $lang_fileinfo_dl . "";
} else {
echo "" . $lang_fileinfo_dl . "";
}
}
// rating
if ($show_image_rating) {
$show_spacer = print_spacer($show_spacer);
if ($top10_type == "average") {
echo "" . $lang_fileinfo_rating . "";
} else {
echo "" . $lang_fileinfo_rating . "";
}
echo " | ";
if ($top10_type == "votes") {
echo "" . $lang_rating_vote . "";
} else {
echo "" . $lang_rating_vote . "";
}
}
// comments
if ($show_comments) {
$show_spacer = print_spacer($show_spacer);
if ($top10_type == "comments") {
echo "" . $lang_last_comments . "";
} else {
echo "" . $lang_last_comments . "";
}
}
echo "
";
}
// - end header
// start get data
$minus_rows = 2;
if ($twg_album != false) {
$dd = get_view_dirs($basedir . "/" . $album_dec, $privatelogin);
} else {
$dd = get_view_dirs($basedir, $privatelogin);
}
$offset = 10;
if ($top10_type == "dl") {
$imagelist = getTopXDownloads($dd);
$lang_views = "";
} else if ($top10_type == "average") {
$imagelist = getTopXAverage($dd);
$lang_views = "";
} else if ($top10_type == "votes") {
$imagelist = getTopXVotes($dd);
$lang_views = "";
} else if ($top10_type == "comments") {
$imagelist = getLatestKomments($dd);
// $imagelist = searchCaption($dd,"a");
$lang_views = "";
} else if ($top10_type == "search") {
$imagelist = Array();
if ($twg_search_tags) {
$resultlist = search_tags($dd, $twg_search_term, $twg_search_exact);
if ($resultlist) {
$imagelist = array_merge($imagelist , $resultlist);
}
}
if ($twg_search_folders) {
$resultlist = searchFolders($dd, $twg_search_term);
if ($resultlist) {
$imagelist = array_merge($imagelist , $resultlist);
}
}
if ($twg_search_latest) {
$resultlist = searchLatest($basedir, $twg_search_term, $dd, $twg_search_num);
if ($resultlist) {
$imagelist = array_merge($imagelist , $resultlist);
}
}
if ($twg_search_caption) {
$resultlist = searchCaption($dd, $twg_search_term);
if ($resultlist) {
$imagelist = array_merge($imagelist , $resultlist);
}
}
if ($twg_search_comment) {
$resultlist = searchComments($dd, $twg_search_term);
if ($resultlist) {
$imagelist = array_merge($imagelist , $resultlist);
}
}
if ($twg_search_filename) {
$resultlist = search_filenames($basedir, $twg_search_term, $dd);
if ($resultlist) {
$imagelist = array_merge($imagelist , $resultlist);
}
}
if (count($imagelist) == 0) {
$imagelist = false;
} else {
$nrimages = count($imagelist);
$imagelist = array_slice($imagelist, $twg_offset, $twg_search_max);
}
$lang_views = "";
} else {
$imagelist = getTopXViews($dd);
}
// end get data
$imageid = 0;
if ($imagelist) {
// start show first image bigger when topx
if ($top10_type != "search") {
$imageid = 1;
// we twg_show nr 1 bigger
if ($top10_type == "comments") {
list ($cdatum, $cname, $ccomment, $clink) = explode("=||=", $imagelist[0]);
$nameid = explode("-||-", $cname);
$cname = $nameid[0];
if (count($nameid) > 1) {
$ip = " - " . $nameid[1];
}
$imagelist[0] = sprintf("%010s", $cdatum) . "_" . $clink;
}
$src_value = str_replace("type=thumb", "type=small", $imagelist[0]);
// the href value has to be encoded differently because the image is sent to
// the index.php and not the image.php
$href_image = substr($imagelist[0], 11);
if ($use_original_on_topxpage) {
$src_value_small = str_replace("type=thumb", "type=original", $href_image);
} else {
$src_value_small = str_replace("type=thumb", "type=small", $href_image);
}
$src_value_small = getTWGHttpRoot() . $src_value_small;
$src_value_opt = opimizeSmallLink(substr($src_value, $offset + 1));
$href_value = str_replace($install_dir . "image.php", $_SERVER['PHP_SELF'], $href_image);
$pos = strrpos($href_value, "=");
$posimage = substr($href_value, $pos + 5);
$href_value = str_replace(urlencode($posimage), $posimage, $href_value) . "&twg_top10=" . $top10_type;
$beschreibung = " alt='' title='' ";
echo "
";
echo "";
if ($activate_lightbox_topx) {
if (!$activate_lightbox_topx_full) {
echo "";
echo " ";
} else {
echo " ";
}
} else {
echo " ";
}
echo " |
";
if (($top10_type == "comments") && ($show_topx_comments_details)) {
if ($cdatum != "") {
$image_date = " (" . date("j.n.Y G:i", $cdatum) . $ip . ")" ;
} else {
$image_date = "";
}
echo "" . $cname . "" . $image_date . "
" . $ccomment;
} else {
if ($top10_type == "comments") {
echo date("j.n.Y G:i", $cdatum . $ip);
} else if ($top10_type == "average") {
echo sprintf('%3.2f', substr($src_value, 0, $offset));
} else {
echo sprintf('%d', substr($src_value, 0, $offset));
}
echo $lang_views;
}
echo "
";
// end show first image bigger when topx
} else {
if ($nrimages == 1) {
if ($top10_type == "search" && $autojump_if_one_result) {
list ($cdatum, $cname, $ccomment, $clink) = explode("=||=", $imagelist[0]);
$nameid = explode("-||-", $cname);
$cname = $nameid[0];
if (count($nameid) > 1) {
$ip = " - " . $nameid[1];
}
$imagelist[0] = sprintf("%010s", $cdatum) . "_" . $clink;
$href_value = substr(str_replace($install_dir . "image.php", $_SERVER['PHP_SELF'], $imagelist[0]), 11);
$href_value = str_replace("&", "&", $href_value);
echo "";
exit;
}
}
echo sprintf($lang_search_hits, $nrimages);
if ($nrimages > $twg_search_max) {
// we show 1 | 2 | 3 ...
echo "
";
// add the parameters !!
$actpage = 0;
$s1 = $twg_search_term ? "twg_search_term=" . $twg_search_term: "";
$s2 = $twg_search_caption ? "twg_search_caption=" . $twg_search_caption: "";
$s3 = $twg_search_comment ? "twg_search_comment=" . $twg_search_comment: "";
$s4 = $twg_search_filename ? "twg_search_filename=" . $twg_search_filename: "";
$s5 = $twg_search_folders ? "twg_search_folders=" . $twg_search_folders: "";
$s6 = $twg_search_tags ? "twg_search_tags=" . $twg_search_tags: "";
$s7 = $twg_search_max ? "twg_search_max=" . $twg_search_max: "";
$s8 = $twg_search_num ? "twg_search_num=" . $twg_search_num: "";
$s9 = $twg_search_latest ? "twg_search_latest=" . $twg_search_latest : "";
$twg_standalone .= "&twg_top10=search&" . $s1 . "&" . $s2 . "&" . $s3 . "&" . $s4 . "&" . $s5 . "&" . $s6 . "&" . $s7 ."&" . $s8."&" . $s9;
$twg_standalonejs .= "&twg_top10=search&" . $s1 . "&" . $s2 . "&" . $s3 . "&" . $s4 . "&" . $s5 . "&" . $s6 . "&" . $s7. "&" . $s8 ."&" . $s9 ;
if ($twg_offset > 0) {
$hreflast = sprintf("%s?twg_album=%s&twg_offset=%s%s", $_SERVER['PHP_SELF'], $album_enc, $twg_offset - $twg_search_max, $twg_standalone);
$hreflastjs = sprintf("%s?twg_album=%s&twg_offset=%s%s", $_SERVER['PHP_SELF'], $album_enc, $twg_offset - $twg_search_max, $twg_standalonejs);
echo '';
printf(" %s", $hreflast , $lang_thumb_back);
}
print " |";
$numpages = ceil($nrimages / $twg_search_max);
for($i = 0; $i < $numpages ; $i++) {
$twg_offset_ = $i * ($twg_search_max);
if ($twg_offset == $twg_offset_) {
$actpage = $i;
echo "";
}
printf(" %s", $_SERVER['PHP_SELF'], $album_enc, $twg_offset_, $twg_standalone, $i + 1);
if ($twg_offset == $twg_offset_) {
echo "";
}
echo " | ";
}
if ($actpage != $numpages - 1) {
$hrefnext = sprintf("%s?twg_album=%s&twg_offset=%s%s", $_SERVER['PHP_SELF'], $album_enc, $twg_offset + $twg_search_max, $twg_standalone);
$hrefnextjs = sprintf("%s?twg_album=%s&twg_offset=%s%s", $_SERVER['PHP_SELF'], $album_enc, $twg_offset + $twg_search_max, $twg_standalonejs);
echo '';
printf(" %s", $hrefnext , $lang_thumb_forward);
}
}
echo "
";
}
if (($top10_type == "comments") && ($show_topx_comments_details)) {
$thumbnails_x = 2;
$thumbnails_y = ceil((count($imagelist)-1) / 2);
if ($thumbnails_y > (($number_top10-1) / 2)) {
$thumbnails_y = ceil(($number_top10-1) / 2);
}
$minus_rows = 0;
}
if ($top10_type == "search") {
if ($show_topx_search_details) {
$thumbnails_y = ceil(count($imagelist) / 2);
// max detection here !!
$thumbnails_x = 2;
} else {
$thumbnails_y = ceil(count($imagelist) / $thumbnails_x);
}
$minus_rows = 0;
}
// we show the remaining pictures
if ((($top10_type == "comments") && ($show_topx_comments_details)) || ($top10_type == "search")) {
if ($show_topx_search_details || (($top10_type == "comments") && ($show_topx_comments_details))) {
$extraheight = "style='height:" . ($thumbnails_y * ($thumb_pic_size)) . "px;'";
} else {
$extraheight = "style='height:" . ($thumbnails_y * ($thumb_pic_size + 55)) . "px;'";;
}
echo "\n";
} else {
echo "\n";
}
for($i = 0; $i < $thumbnails_y - $minus_rows; $i++) {
print "";
for($j = 0; $j < $thumbnails_x; $j++) {
if (($imageid >= count($imagelist))/* || ($imageid >= $number_top10 && $top10_type != "search") */) { // we fill the last line to get a nice layout
printf(" | "); // class='left_top10'
} else {
if (($top10_type == "comments") || ($top10_type == "search")) {
list ($cdatum, $cname, $ccomment, $clink) = explode("=||=", $imagelist[$imageid]);
$nameid = explode("-||-", $cname);
$cname = $nameid[0];
if (count($nameid) > 1) {
$ip = " - " . $nameid[1];
}
$imagelist[$imageid] = sprintf("%010s", $cdatum) . "_" . $clink;
if (($top10_type == "search")) {
// we check and replace foldername.txt !
$ccomment = html_entity_decode_fixed(getDirectoryName($basedir . "/" . $ccomment, $ccomment) , ENT_NOQUOTES, $charset);
}
}
$src_value = $imagelist[$imageid];
// the href value has to be encoded differently because the image is sent to
// the index.php and not the image.php
if ($use_original_on_topxpage) {
$src_value_small = substr(str_replace("type=thumb", "type=original", $src_value), 11);
} else {
$src_value_small = substr(str_replace("type=thumb", "type=small", $src_value), 11);
}
$src_value_small = getTWGHttpRoot() . $src_value_small;
$href_value = substr(str_replace($install_dir . "image.php", $_SERVER['PHP_SELF'], $imagelist[$imageid]), 11);
$pos = strrpos($href_value, "=");
$posimage = substr($href_value, $pos + 5);
if (strpos ($src_value, "isalbum")) {
$href_value = str_replace(urlencode($posimage), $posimage, $href_value);
} else {
$href_value = str_replace(urlencode($posimage), $posimage, $href_value) . "&twg_top10=" . $top10_type;
}
$beschreibung = " alt='' title='' ";
if ((($top10_type == "comments") && ($show_topx_comments_details)) || (($top10_type == "search") && ($show_topx_search_details))) {
if ($cdatum != "") {
$image_date = " (" . date("j.n.Y G:i", $cdatum) . $ip . ")" ;
} else {
$image_date = "";
}
$count_str = "" . $cname . "" . $image_date . "
" . $ccomment;
} else if ($top10_type == "comments") {
$count_str = date("j.n.Y G:i", $cdatum . $ip);
} else if ($top10_type == "average") {
$count_str = sprintf('%3.2f', substr($src_value, 0, $offset));
} else if ($top10_type == "search") {
if ($cdatum != "") {
$image_date = " (" . date("j.n.Y G:i", $cdatum) . $ip . ")
" ;
$spacer = "";
} else {
$image_date = "";
$spacer = "
";
}
$strip_name = optimize_strip($cname, $showcharacters);
$strip_comment = optimize_strip($ccomment, $showcharacters);
$count_str = $image_date . "" . $strip_name . "" . "
" . $strip_comment . $spacer ;
} else {
$count_str = sprintf('%d', substr($src_value, 0, $offset));
}
if ($show_clipped_images) {
$theight = " height='" . $thumb_pic_size . "' width='" . $thumb_pic_size . "' ";
} else {
$theight = "";
}
if ((($top10_type == "comments") && ($show_topx_comments_details)) || (($top10_type == "search") && $show_topx_search_details)) {
if ($show_clipped_images) {
$defineheight = "width:" . ($thumb_pic_size + 2) . "px; height:" . ($thumb_pic_size + 4) . "px;";
} else {
$defineheight = "width:" . ($thumb_pic_size + 2) . "px;";
}
if (strpos ($src_value, "isalbum")) {
$src_value_image = $install_dir . "buttons/ordner.gif";
$activate_lightbox_topx = false;
$half = $thumb_pic_size / 2;
$leftpad = $half - 27;
$rightpad = $half - 28;
$toppad = $half - 23;
$bottompad = $half - 24;
$theight = " style='padding-top:" . $toppad . "px;padding-bottom:" . $bottompad . "px;padding-left:" . $leftpad . "px;padding-right:" . $rightpad . "px;' ";
} else {
$src_value_image = substr($src_value, 11);
}
$src_value_image = opimizeLink($src_value_image);
echo "
";
if ($activate_lightbox_topx) {
if (!$activate_lightbox_topx_full) {
echo "";
echo " ";
} else {
echo " ";
}
} else {
echo " ";
}
echo " | " . $count_str . " |
| ";
} else {
$extrastyle = "style='vertical-align:top;'";
echo "
";
if (strpos ($src_value, "isalbum")) {
$activate_lightbox_topx = false;
}
if ($activate_lightbox_topx) {
$src_value_image = opimizeLink(substr($src_value, 11));
if (!$activate_lightbox_topx_full) {
echo "";
echo " ";
} else {
echo " ";
}
} else {
if (strpos ($src_value, "isalbum")) {
$src_value_image = $install_dir . "buttons/ordner.gif";
$half = $thumb_pic_size / 2;
$leftpad = $half - 27;
$rightpad = $half - 28;
$toppad = $half - 23;
$bottompad = $half - 24;
$theight = " style='padding-top:" . $toppad . "px;padding-bottom:" . $bottompad . "px;padding-left:" . $leftpad . "px;padding-right:" . $rightpad . "px;' ";
} else {
$src_value_image = substr($src_value, 11);
}
$src_value_image = opimizeLink($src_value_image);
echo " ";
}
echo " | " . $count_str . $lang_views . " | ";
}
}
$imageid++;
}
print "
\n";
}
if ($top10_type == "search") {
// echo "| | |
";
}
print "
\n";
} else { // if we on't have anything we twg_show an empty image :)
echo "
";
echo $lang_no_topx_images;
}
}
/*
truncated a string to a certain length - if a blank or _ or . comes in the next 3 characters the cut is done later!
baad function - I have to reimplement this ;)
*/
function optimize_strip($value, $showcharacters)
{
global $charset;
if (isset ($charset)) {
$charsetloc = $charset;
} else {
$charsetloc = "ISO-8859-15";
}
$extra_limit = 3;
set_error_handler("on_error_no_output"); // is needed because error are most likly but we don't care about fields we don't even know
$stripped_value = html_entity_decode_fixed(str_replace("
", " - ", strip_tags($value, "
")), ENT_NOQUOTES, $charsetloc);
set_error_handler("on_error");
// length greater then the extra bonus!
if (strlen($stripped_value) < $showcharacters + $extra_limit) {
$showcharacters += $extra_limit;
} else {
$pos = strpos ($stripped_value, " " , $showcharacters-2);
if ($pos === false) {
$pos = strpos ($stripped_value, "." , $showcharacters-2);
if ($pos === false) {
$pos = strpos ($stripped_value, "_" , $showcharacters-2);
if ($pos === false) {
} else {
if ($pos < $showcharacters + $extra_limit) {
$showcharacters = $pos;
}
}
} else {
if ($pos < $showcharacters + $extra_limit) {
$showcharacters = $pos;
}
}
} else {
if ($pos < $showcharacters + $extra_limit) {
$showcharacters = $pos;
}
}
}
return htmlentities(substr($stripped_value, 0, $showcharacters), ENT_NOQUOTES, $charsetloc);
}
?>