From e9192b3d42660a5781101df4357d276318151e8a Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Fri, 2 Aug 2013 17:14:41 -0500 Subject: cgi-bin & lib --- cgi-bin/services_k | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100755 cgi-bin/services_k (limited to 'cgi-bin/services_k') diff --git a/cgi-bin/services_k b/cgi-bin/services_k new file mode 100755 index 0000000..3ce9940 --- /dev/null +++ b/cgi-bin/services_k @@ -0,0 +1,62 @@ +#!/usr/bin/perl +######################################### +# services_k +# feeds bPod the keyword list for logged in user +######################################### + +use localbucky; + +$dbh = DBI->connect ($dsn); + +our ($USER, $lastlog) = checkin(); + +our $logged_in = ($USER != -1); + +our $TAGS = [ 'Docks', 'Dings', 'Mexico', 'France', 'Breakfast', 'Baked', 'Sandwich' ]; + +# this start/end shit is all broken anyway +#my $start = $input->{s}; +#my $end = $input->{e}; + +my $keywords_hashref = get_keywords(); +my $keywords_arrayref = []; + +print "Content-type: text/html\r\n\r\n"; +foreach my $keyword (keys(%$keywords_hashref)) + { + my $k = $keywords_hashref->{$keyword}; + push ( @$keywords_arrayref, $keyword ) if (check_keyword($k)); + } + +my $numItems = @$keywords_arrayref; + +my $returnString = " &numItems=" . ($numItems ); +#$returnString = "duhhh"; + +@$keywords_arrayref = sort{ lc($a) cmp lc($b) } @$keywords_arrayref; + +my $keywordCount = 0; +foreach my $keyword (@$keywords_arrayref) + { + $returnString .= "&keyword$keywordCount=$keyword"; + my $color = $keywords_hashref->{$keyword}->{color} || "plain"; + $returnString .= "&color$keywordCount=$color"; + $keywordCount++; + } + +#@$tags_arrayref = sort{ $a cmp $b } @$TAGS; +my $tags_arrayref = get_tag_names(); +@$tags_arrayref = sort{ lc($a) cmp lc($b) } @$tags_arrayref; +my $numTags = @$tags_arrayref; + +$returnString .= "&numTags=" . $numTags; + +my $tagCount = 0; +foreach my $tag (@$tags_arrayref) + { + $returnString .= "&tag$tagCount=$tag"; + $tagCount++; + } + +print $returnString ; +exit(0); -- cgit v1.2.3-70-g09d2