#!/usr/bin/perl

use strict;
use lib "/home/slowtwitch/forum.slowtwitch.com/cgi-bin/admin";
use GForum qw/$IN $CFG $DB/;
use GForum::SEO;

GForum::init("/home/slowtwitch/forum.slowtwitch.com/cgi-bin/admin");

my @ids = split(/\s*,\s*/, $IN->param('id') || '');

print $IN->header;
if (scalar @ids) {
    my $posts = $DB->table('Post')->select(/post_id post_subject/, { post_id => \@ids })->fetchall_hashref;
    my %posts = map { $_->{post_id} => $_ } @$posts;

    my ($count, $html) = (0, "");
    foreach my $id (@ids) {
        $count++;
        my $url = $CFG->{cgi_root_url} . GForum::SEO::url(type => "post", id => $id);
        $html .= qq!<div class="link"><div><span>$count</span></div><a href="$url">$posts{$id}{post_subject}</a></div>!;
    }
    print qq!<div class="list">$html</div>!;
}
