#!/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;