summaryrefslogtreecommitdiff
path: root/cgi-bin/services_k
blob: 3ce99408b3f5462f49009b2563725381a6231bae (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
55
56
57
58
59
60
61
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);