|
|
@ -62,6 +62,7 @@ sub save { |
|
|
|
if $self->req->is_limit_exceeded; |
|
|
|
if $self->req->is_limit_exceeded; |
|
|
|
|
|
|
|
|
|
|
|
my $expire = $self->req->param('expire') || 7; # days |
|
|
|
my $expire = $self->req->param('expire') || 7; # days |
|
|
|
|
|
|
|
my $hidden = $self->req->param('hidden') || 0; |
|
|
|
my $upload = $self->req->upload('file'); |
|
|
|
my $upload = $self->req->upload('file'); |
|
|
|
die "no file uploaded\n" unless ($upload and $upload->size > 0); |
|
|
|
die "no file uploaded\n" unless ($upload and $upload->size > 0); |
|
|
|
die "file too large\n" if ($upload->size > $conf->{file_maxsize}); |
|
|
|
die "file too large\n" if ($upload->size > $conf->{file_maxsize}); |
|
|
@ -75,6 +76,7 @@ sub save { |
|
|
|
|
|
|
|
|
|
|
|
my $file = { |
|
|
|
my $file = { |
|
|
|
created => $time, expire => $time + $expire * 86400, |
|
|
|
created => $time, expire => $time + $expire * 86400, |
|
|
|
|
|
|
|
hidden => $hidden, |
|
|
|
ftype => 'b', # default -- generic binary |
|
|
|
ftype => 'b', # default -- generic binary |
|
|
|
fsize => $upload->size, |
|
|
|
fsize => $upload->size, |
|
|
|
fname => $upload->filename, |
|
|
|
fname => $upload->filename, |
|
|
@ -134,7 +136,7 @@ sub latest { |
|
|
|
|
|
|
|
|
|
|
|
eval { |
|
|
|
eval { |
|
|
|
my $now = time(); |
|
|
|
my $now = time(); |
|
|
|
my @files = $self->app->db->select('filebin', '*', {expire => {'>=' => $now}}, {-desc => 'created'})->hashes; |
|
|
|
my @files = $self->app->db->select('filebin', '*', {expire => {'>=' => $now}, hidden => 0}, {-desc => 'created'})->hashes; |
|
|
|
splice(@files, 15); # first 15 elements |
|
|
|
splice(@files, 15); # first 15 elements |
|
|
|
foreach my $file (@files) { |
|
|
|
foreach my $file (@files) { |
|
|
|
$file->{thumb} = $self->_file_path($file->{created}, $file->{fext}); |
|
|
|
$file->{thumb} = $self->_file_path($file->{created}, $file->{fext}); |
|
|
|