summaryrefslogtreecommitdiff
path: root/cgi-bin/bury
blob: 07fcd430320abc7be7e0e5d79ac73e3649b76449 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/perl
#########################################
# not bless
#########################################

use localbucky;

$dbh = DBI->connect ($dsn);

#our ($USER, $lastlog) = checkin();
#logout() unless ($USER != -1);

$input->{id} ||= $input->{object_from_uri} if defined($input->{object_from_uri});
if (exists($input->{id}) && $input->{id} > 0)
        { $id = $input->{id}; }
else
        { error("No post specified."); }
$id = $input->{id};

if (get_thread($id) == -1)
        { error("no such thread"); }
my $changed_date = get_most_recent_change($id);
if ($changed_date > 0) {
  update_thread_lastmodified($id, $changed_date);
}
redirect("$BUCKY/index");

$dbh->disconnect ();

sub get_most_recent_change {
  my ($id) = @_;
  my $files = get_recent_files($id);
  my $comments_date = get_thread_comment_modified($id);
  my $date = 0;
  if ($files != -1) {
    my $d = $files->[-1]->{'date'};
    $date = $d >= $date ? $d : $date;
  }
  if ($comments != -1) {
    my $d = $comments_date;
    $date = $d >= $date ? $d : $date;
  }
}