summaryrefslogtreecommitdiff
path: root/cgi-bin/services_th
diff options
context:
space:
mode:
Diffstat (limited to 'cgi-bin/services_th')
-rwxr-xr-xcgi-bin/services_th54
1 files changed, 54 insertions, 0 deletions
diff --git a/cgi-bin/services_th b/cgi-bin/services_th
new file mode 100755
index 0000000..6e2bb67
--- /dev/null
+++ b/cgi-bin/services_th
@@ -0,0 +1,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;