#!/usr/bin/perl ######################################## # details ######################################### use localbucky; $dbh = DBI->connect ($dsn); our ($USER, $lastlog) = checkin(); our $loggedin = ($USER != -1); our ($t, $kw, $files, $comments) = details_init(); details_run($t, $kw, $files, $comments); sub details_init { $input->{id} ||= $input->{object_from_uri} if defined($input->{object_from_uri}); my $id = exists($input->{id}) ? $input->{id} : error("No such thread!"); my $t = get_thread($id); error("No such post.") if ($t == -1); my $kw = get_keyword($t->{keyword}); my $files = get_files($t->{id}); my $comments = get_comments ($t->{id}); if ( ! check_privacy($t, $kw) ) # || check_participation($files, $comments) ) #unless ( check_privacy($t, $kw) || check_participation($files, $comments) ) { error("No such post!"); } # Reset NULL viewed if ( ! $t->{viewed} ) { $t->{viewed} = 0; } # Increment viewed for this thread $t->{viewed}++; # Update thread viewed count update_thread_viewed( $t->{id}, $t->{viewed} ); return ($t, $kw, $files, $comments); } sub details_run { my ($t, $kw, $files, $comments) = @_; my $header_args = { title => $t->{title}, sticky => $t->{keyword}, color => get_color($t, $kw, $comments) # participation => check_participation($files, $comments) }; my $age = get_age($t->{lastmodified}); $age .= " ago" unless $age eq "now"; $header_args->{subtitle} = qq!posted by $t->{username} on ! . verbosedate($t->{createdate}) . " · active " . $age . qq! · $t->{viewed} view! . courtesy_s($t->{viewed}); if ($t->{username} eq $USER->{username} || check_op($kw) || $header_args->{participation} == 2 || $USER->{ulevel} == 3) { $header_args->{subtitle} .= qq! · !; $header_args->{subtitle} .= qq!options!; } # else # { # $header_args->{subtitle} .= # qq! · go to index!; # } $header_args->{subtitle} .= qq! · !; $header_args->{subtitle} .= qq!download\!!; my @participants = get_participants($t, $files, $comments); $header_args->{sidetitle} = details_participation(@participants) if (@participants > 0); $header_args->{sidesubtitle} = "see also: ".details_tags_box($t, $kw)."" if (@{$t->{tags}}); header($header_args); # 20070903 - marc - new menu args calling style my $menu_args; $menu_args->{keywords} = $kw if $kw; $menu_args->{ftp} = 1 if ($t->{files}+$t->{comments} + 1); menu( $menu_args ); details_view($t, $kw, $comments, $files); footer(); } ############################## sub details_view { my ($t, $kw, $comments, $files) = @_; my ($many_jpgs, $flagged) = find_jpeg_v2($files, $t->{flagged}); if ($many_jpgs > 6) { print qq(
);
print qq(
| ); print_flagged_jpeg($flagged); } elsif ($many_jpgs > 1 || @$files > $many_jpgs) { print qq( | ); } else { print qq( | );
}
if ($many_jpgs > 1)
{
if ($many_jpgs < 6) # && @$files == $many_jpgs)
{ image_column($files, $flagged, $many_jpgs); }
else
{ image_gallery($files, $flagged, $many_jpgs); }
}
if (@$files > $many_jpgs)
{
if (find_mp3($files))
{
my $z_playlist = "/cgi-bin/bucky/playlist/$t->{id}";
my $z_autoplay = "false";
if (check_key($USER->{boxes}, "autoplay"))
{ $z_autoplay = "true"; }
print <<__PLAYLIST__;
LOADING MP3 PLAYER ...
__PLAYLIST__
}
if (check_key($t->{display}, "nfl")) # no file list
{ ; }
elsif (check_key($t->{display}, "ffl")) # full file list
{
file_list($files, 0, 1, 0);
}
else # "terse" file list
{
file_list($files, 0, 1, $many_jpgs);
}
}
if ($ZIP_BUTTON_ENABLED && @$files > 4)
{
zip_this_button($t);
}
details_keywords_box($t, $kw);
print " | ";
print qq(|||||