######################################################## # FILES ######################################################## sub zip_this_button { my ($t) = @_; return if ($USER == -1); return if (check_key($t->{display}, "no-zip-button")); return if (check_key($t->{display}, "nfl")); if ($t->{zipped} == -1) { print qq!
\n!; } elsif ($t->{zipped} == 0 && ($t->{files} > 10 || ($t->{files} > 3 && $t->{size} < 160*1024*1024))) { onebutton($t->{id}, "zip", "ZIP THESE FILES"); } elsif ($t->{zipped} == 1) { my $zipfile = generate_zip_filename($t); if (! -e qq!$data_path/$t->{id}/$zipfile!) { update_thread_zipped($t->{id}, 0); onebutton($t->{id}, "zip", "ZIP THESE FILES"); } else { print qq!\n!; } } } sub retrieve_zip_mechanism { my ($t) = @_; my $zipfile = generate_zip_filename($t); if (-e qq!$data_path/$t->{id}/$zipfile!) { my @stats = stat(qq!$data_path/$t->{id}/$zipfile!); my $size = $stats[7]; my $date = $stats[9]; add_file($t->{id}, $t->{username}, $zipfile, $size, $date); update_thread_zipped($t->{id}, 1); update_thread_size($t->{id}, $t->{size}); system($CHMOD_PATH, "644", "$data_path/$t->{id}/$zipfile"); $t->{zipped} = 1; return $zipfile; } return -1; } sub generate_zip_filename { my ($t) = @_; my $cleantitle = $t->{title}; $cleantitle =~ s/\W//g; $cleantitle =~ s/^\s+//; $cleantitle =~ s/\s+$//; return qq($cleantitle.zip); } sub situate_files { my ($pid, $uname) = @_; my ($filename, $size, $date); my $newfilename; my $totalsize = 0; foreach my $k (keys %$input) { next if ($k !~ /^file/); next if (! -e $temp_path."/".$$input{$k}); $filename = $$input{$k}; if ($filename =~ /temp_$/) { system("$RM_PATH", $temp_path."/".$filename); } else { print $filename if ($DEBUG); if (! -e $data_path."/".$pid) { print "creating $data_path/$pid\n\n!;
}
print <';
print ' \n\n!;
}
sub display_file
{
my ($f, $r, $cbox) = @_;
my $color = carbondate($f->{date});
my $checked = 0;
my $bright = 0;
$checked = check_key($cbox, $f->{id});
if ($DEBUG)
{
print qq!Displaying file $f->{id}!;
print qq! (checked)! if ($checked);
print qq!';
print qq!total size: !.hushsize($size, 1, 1).qq!
\n!;
}
print qq[];
if ($cbox)
{
print qq! \n];
}
1;
!;
}
if ($0 !~ /(details|maintain)/)
{
print qq[ go to post > ];
}
if ((time - $f->{date}) < 150000 || $checked)
{ print qq[]; }
else
{ print qq[ ]; }
if (length($f->{filename}) > 50)
{
my $filen = substr $f->{filename}, 0, 47;
my $filext = substr $f->{filename}, -4, 4;
print qq[$filen..$filext];
}
else
{
print qq[$f->{filename}];
}
print qq[ ];
my ($date, $time) = verbosedatetime($f->{date});
# print qq[]. (get_age($f->{date})), qq[ ];
print qq[$date ];
print qq[ $time ];
print qq[], hushsize($f->{size},2), qq[ ];
print qq[$f->{username} ];
print qq[