unicode searches
git-svn-id: http://yolanda.mister-muffin.de/svn@51 7eef14d0-6ed0-489d-bf55-20463b2d70db
This commit is contained in:
parent
d8d4bd14e3
commit
bd398c9423
3 changed files with 4 additions and 5 deletions
|
@ -5,6 +5,7 @@ use CGI::Session;
|
|||
use DBI;
|
||||
use XML::Simple qw(:strict);
|
||||
use Digest::SHA;
|
||||
use Encode;
|
||||
|
||||
$gnutube_root = '/var/www/gnutube';
|
||||
|
||||
|
|
|
@ -9,14 +9,12 @@ $session = new CGI::Session;
|
|||
#check if query is set
|
||||
if($query->param('query'))
|
||||
{
|
||||
my $search_query = $query->param('query');
|
||||
|
||||
$page = XMLin("$gnutube_root/search.xml", ForceArray => 1, KeyAttr => {} );
|
||||
|
||||
#if a username is associated with session id, username is nonempty
|
||||
$page->{username} = get_username_from_sid($session->id);
|
||||
|
||||
$page->{results}->{query} = $query->param('query');
|
||||
$page->{results}->{query} = decode_utf8($query->param('query'));
|
||||
|
||||
#connect to db
|
||||
my $dbh = DBI->connect("DBI:mysql:$database:$dbhost", $dbuser, $dbpass) or die $dbh->errstr;
|
||||
|
@ -25,7 +23,7 @@ if($query->param('query'))
|
|||
my $sth = $dbh->prepare(qq{select title, caption, timestamp from videos where match(title, caption) against( ? ) }) or die $dbh->errstr;
|
||||
|
||||
#execute it
|
||||
$sth->execute($search_query) or die $dbh->errstr;
|
||||
$sth->execute($query->param('query')) or die $dbh->errstr;
|
||||
|
||||
#get every returned value
|
||||
while (my ($title, $caption, $timestamp) = $sth->fetchrow_array())
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<xsl:output
|
||||
doctype-public="-//W3C//DTD XHTML 1.1//EN"
|
||||
doctype-system="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"
|
||||
encoding="us-ascii"
|
||||
encoding="utf8"
|
||||
indent="yes"
|
||||
method="xml"
|
||||
media-type="application/xhtml+xml"
|
||||
|
|
Loading…
Reference in a new issue