From 3d635646d4deaa036c7649f50767aec353a087a6 Mon Sep 17 00:00:00 2001 From: josch Date: Sat, 1 Dec 2007 22:49:58 +0000 Subject: [PATCH] cleaned url generation (slashes at the end, proper encoding), added apache.conf, fixed bug #5 git-svn-id: http://yolanda.mister-muffin.de/svn@193 7eef14d0-6ed0-489d-bf55-20463b2d70db --- trunk/functions.pl | 26 -------------------------- trunk/index.pl | 22 +++++++++++++++++++++- 2 files changed, 21 insertions(+), 27 deletions(-) diff --git a/trunk/functions.pl b/trunk/functions.pl index 67f0c60..098d261 100644 --- a/trunk/functions.pl +++ b/trunk/functions.pl @@ -1,32 +1,6 @@ #!/usr/bin/perl require "include.pl"; -#get tags from database and fill $page with xml -sub fill_tagcloud -{ - #connect to db - my $dbh = DBI->connect("DBI:mysql:$database:$dbhost", $dbuser, $dbpass); - - #prepare query - my $sth = $dbh->prepare(qq{select text, count from tagcloud }) or die $dbh->errstr; - - #execute it - $sth->execute() or die $dbh->errstr; - - #get every returned value - while (my ($text, $count) = $sth->fetchrow_array()) - { - #push the new value to the $page->tagcloud array - push @{ $page->{tagcloud}->{tag} }, { text => [$text =~ / / ? "\"$text\"" : $text], count => [$count] }; - } - - #finish query - $sth->finish() or die $dbh->errstr; - - #close db - $dbh->disconnect() or die $dbh->errstr; -} - sub get_userinfo_from_sid { #get parameters diff --git a/trunk/index.pl b/trunk/index.pl index 9bbeb2b..872cf50 100644 --- a/trunk/index.pl +++ b/trunk/index.pl @@ -26,7 +26,27 @@ elsif($query->param('error')) $page->{'message'}->{'text'} = $query->param('error'); } -fill_tagcloud; +#connect to db +my $dbh = DBI->connect("DBI:mysql:$database:$dbhost", $dbuser, $dbpass); + +#prepare query +my $sth = $dbh->prepare(qq{select text, count from tagcloud }) or die $dbh->errstr; + +#execute it +$sth->execute() or die $dbh->errstr; + +#get every returned value +while (my ($text, $count) = $sth->fetchrow_array()) +{ + #push the new value to the $page->tagcloud array + push @{ $page->{tagcloud}->{tag} }, { text => [$text =~ / / ? "\"$text\"" : $text], count => [$count] }; +} + +#finish query +$sth->finish() or die $dbh->errstr; + +#close db +$dbh->disconnect() or die $dbh->errstr; #print xml http header along with session cookie print $session->header(-type=>'text/xml', -charset=>'UTF-8');