forked from GithubBackups/tinyib
Fix false positives when checking for an existing keyword
Resolves #234.
This commit is contained in:
parent
340b66fe1b
commit
884c1aa262
@ -107,9 +107,11 @@ function keywordByText($text) {
|
|||||||
$result = mysql_query("SELECT * FROM `" . TINYIB_DBKEYWORDS . "` WHERE `text` = '" . mysql_real_escape_string($text) . "'");
|
$result = mysql_query("SELECT * FROM `" . TINYIB_DBKEYWORDS . "` WHERE `text` = '" . mysql_real_escape_string($text) . "'");
|
||||||
if ($result) {
|
if ($result) {
|
||||||
while ($keyword = mysql_fetch_assoc($result)) {
|
while ($keyword = mysql_fetch_assoc($result)) {
|
||||||
|
if ($keyword['text'] === $text) {
|
||||||
return $keyword;
|
return $keyword;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,9 +124,11 @@ function keywordByText($text) {
|
|||||||
$result = mysqli_query($link, "SELECT * FROM `" . TINYIB_DBKEYWORDS . "` WHERE `text` = '" . mysqli_real_escape_string($link, $text) . "'");
|
$result = mysqli_query($link, "SELECT * FROM `" . TINYIB_DBKEYWORDS . "` WHERE `text` = '" . mysqli_real_escape_string($link, $text) . "'");
|
||||||
if ($result) {
|
if ($result) {
|
||||||
while ($keyword = mysqli_fetch_assoc($result)) {
|
while ($keyword = mysqli_fetch_assoc($result)) {
|
||||||
|
if ($keyword['text'] === $text) {
|
||||||
return $keyword;
|
return $keyword;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,12 +85,13 @@ function keywordByID($id) {
|
|||||||
|
|
||||||
function keywordByText($text) {
|
function keywordByText($text) {
|
||||||
$text = strtolower($text);
|
$text = strtolower($text);
|
||||||
$keywords = array();
|
|
||||||
$results = pdoQuery("SELECT * FROM " . TINYIB_DBKEYWORDS . " WHERE text = ?", array($text));
|
$results = pdoQuery("SELECT * FROM " . TINYIB_DBKEYWORDS . " WHERE text = ?", array($text));
|
||||||
while ($row = $results->fetch(PDO::FETCH_ASSOC)) {
|
while ($keyword = $results->fetch(PDO::FETCH_ASSOC)) {
|
||||||
$keywords[] = $row;
|
if ($keyword['text'] === $text) {
|
||||||
|
return $keyword;
|
||||||
}
|
}
|
||||||
return $keywords;
|
}
|
||||||
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
function allKeywords() {
|
function allKeywords() {
|
||||||
|
@ -93,8 +93,10 @@ function keywordByText($text) {
|
|||||||
$text = strtolower($text);
|
$text = strtolower($text);
|
||||||
$result = sqlite_fetch_all(sqlite_query($GLOBALS["db"], "SELECT * FROM " . TINYIB_DBKEYWORDS . " WHERE text = '" . sqlite_escape_string($text) . "'"), SQLITE_ASSOC);
|
$result = sqlite_fetch_all(sqlite_query($GLOBALS["db"], "SELECT * FROM " . TINYIB_DBKEYWORDS . " WHERE text = '" . sqlite_escape_string($text) . "'"), SQLITE_ASSOC);
|
||||||
foreach ($result as $keyword) {
|
foreach ($result as $keyword) {
|
||||||
|
if ($keyword['text'] === $text) {
|
||||||
return $keyword;
|
return $keyword;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,8 +108,10 @@ function keywordByText($text) {
|
|||||||
$text = strtolower($text);
|
$text = strtolower($text);
|
||||||
$result = $db->query("SELECT * FROM " . TINYIB_DBKEYWORDS . " WHERE text = '" . $db->escapeString($text) . "'");
|
$result = $db->query("SELECT * FROM " . TINYIB_DBKEYWORDS . " WHERE text = '" . $db->escapeString($text) . "'");
|
||||||
while ($keyword = $result->fetchArray()) {
|
while ($keyword = $result->fetchArray()) {
|
||||||
|
if ($keyword['text'] === $text) {
|
||||||
return $keyword;
|
return $keyword;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user