Skip to content
Extraits de code Groupes Projets
Valider 6e1be1b1 rédigé par Alexandre Morignot's avatar Alexandre Morignot
Parcourir les fichiers

Really fixes #1

parent 3408871a
Branches
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -24,9 +24,10 @@ sub exec { ...@@ -24,9 +24,10 @@ sub exec {
my $req; my $req;
my $sth; my $sth;
my @words; my @words = ($msg =~ /([a-zA-Z0-9_-]+)/g);
while ($msg =~ /(^| )([a-zA-Z0-9_-]+)/g) { my @words_param;
unshift @words, '%'.$2.'%'; while ($msg =~ /([a-zA-Z0-9_-]+)/g) {
unshift @words_param, '%'.$1.'%';
} }
my $words_sql; my $words_sql;
...@@ -39,7 +40,7 @@ sub exec { ...@@ -39,7 +40,7 @@ sub exec {
$sth = $dbh->prepare('select id, sender, title, url $sth = $dbh->prepare('select id, sender, title, url
from playbot from playbot
where id = ?'); where id = ?');
$sth->execute($tags[0]); $sth->execute($words[0]);
$content = $sth->fetch; $content = $sth->fetch;
...@@ -63,7 +64,7 @@ sub exec { ...@@ -63,7 +64,7 @@ sub exec {
limit 1'; limit 1';
$sth = $dbh->prepare($req); $sth = $dbh->prepare($req);
$sth->execute(@tags, @words, scalar @tags); $sth->execute(@tags, @words_param, scalar @tags);
} }
else { else {
$req = 'select p.id, p.sender, p.title, p.url $req = 'select p.id, p.sender, p.title, p.url
...@@ -79,7 +80,7 @@ sub exec { ...@@ -79,7 +80,7 @@ sub exec {
limit 1'; limit 1';
$sth = $dbh->prepare($req); $sth = $dbh->prepare($req);
$sth->execute(@tags, @words, $chan->[0], scalar @tags); $sth->execute(@tags, @words_param, $chan->[0], scalar @tags);
} }
$content = $sth->fetch; $content = $sth->fetch;
...@@ -96,7 +97,7 @@ sub exec { ...@@ -96,7 +97,7 @@ sub exec {
$req .= ' order by rand() limit 1'; $req .= ' order by rand() limit 1';
$sth = $dbh->prepare($req); $sth = $dbh->prepare($req);
$sth->execute (@words); $sth->execute (@words_param);
} }
else { else {
$req = 'select p.id, p.sender, p.title, p.url $req = 'select p.id, p.sender, p.title, p.url
...@@ -108,7 +109,7 @@ sub exec { ...@@ -108,7 +109,7 @@ sub exec {
limit 1'; limit 1';
$sth = $dbh->prepare($req); $sth = $dbh->prepare($req);
$sth->execute($chan->[0], @words); $sth->execute($chan->[0], @words_param);
} }
$content = $sth->fetch; $content = $sth->fetch;
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter