blob: 6e2bb673e9030a3e96e56c87debc17dbcb69f580 (
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
44
45
46
47
48
49
50
51
52
53
54
|
#!/usr/bin/perl
#########################################
# services_th
# feeds bPod the keyword list for logged in user
#########################################
use localbucky;
$dbh = DBI->connect ($dsn);
our ($USER, $lastlog) = checkin();
our $logged_in = ($USER != -1);
print "Content-type: text/html\r\n\r\n";
my $threads;
my $kws = {};
my $keyword = $input->{k};
if ($keyword =~ /^tag_/)
{
$keyword =~ s/^tag_//;
$threads = get_threads_by_tag( $keyword );
$kws = get_keywords();
}
else
{
$kws->{$keyword} = get_keyword($keyword);
$threads = get_threads_by_keyword( $keyword );
}
my $threads_allowed = [];
foreach my $thread (@$threads)
{
push ( @$threads_allowed, $thread ) if (check_privacy( $thread, $kws->{$thread->{keyword}} ) > 0);
}
my $numItems = @$threads_allowed;
my $returnString = " &numItems=" . ($numItems );
@$threads_allowed = sort{ lc($b->{title}) cmp lc($a->{title}) } @$threads_allowed;
my $threadCount = $numItems - 1;
foreach my $thread (@$threads_allowed)
{
$returnString .= "&title$threadCount=" . $thread->{title};
$returnString .= "&user$threadCount=" . $thread->{username};
$returnString .= "&id$threadCount=" . $thread->{id};
$threadCount--;
}
print $returnString ;
exit;
|