diff options
| author | Jules Laplace <carbon@melanarchy.org> | 2013-08-02 17:14:41 -0500 |
|---|---|---|
| committer | Jules Laplace <carbon@melanarchy.org> | 2013-08-02 17:14:41 -0500 |
| commit | e9192b3d42660a5781101df4357d276318151e8a (patch) | |
| tree | 059eb6ace6147cf9559af74ed1ab5e221c80e280 /cgi-bin/services_th | |
| parent | 79670053c7247d3a49b607960efd284e93f057e5 (diff) | |
cgi-bin & lib
Diffstat (limited to 'cgi-bin/services_th')
| -rwxr-xr-x | cgi-bin/services_th | 54 |
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; |
