Add functions for checking if places or actor names are blacklisted
Close #6, close #7
This commit is contained in:
parent
e877e4edf1
commit
b1bd14bc56
|
@ -62,4 +62,58 @@ final class NodaBlacklistedTerms {
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if a place name is blacklisted in the DB.
|
||||||
|
*
|
||||||
|
* @param MDMysqli $mysqli DB connection.
|
||||||
|
* @param string $lang The user's currently used language.
|
||||||
|
* @param string $name The name entered by the user.
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public static function checkPlaceBlacklistedInDb(MDMysqli $mysqli, string $lang, string $name):bool {
|
||||||
|
|
||||||
|
$result = $mysqli->query_by_stmt("SELECT 1
|
||||||
|
FROM `" . DATABASENAME_NODA . "`.`orte_blacklist`
|
||||||
|
WHERE `language` = ?
|
||||||
|
AND `ort_name` = ?
|
||||||
|
LIMIT 1", "ss", $lang, $name);
|
||||||
|
|
||||||
|
if ($result->num_rows === 0) {
|
||||||
|
$result->close();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$result->close();
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if an actor name is blacklisted in the DB.
|
||||||
|
*
|
||||||
|
* @param MDMysqli $mysqli DB connection.
|
||||||
|
* @param string $lang The user's currently used language.
|
||||||
|
* @param string $name The name entered by the user.
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public static function checkPersinstBlacklistedInDb(MDMysqli $mysqli, string $lang, string $name):bool {
|
||||||
|
|
||||||
|
$result = $mysqli->query_by_stmt("SELECT 1
|
||||||
|
FROM `" . DATABASENAME_NODA . "`.`persinst_blacklist`
|
||||||
|
WHERE `language` = ?
|
||||||
|
AND `persinst_name` = ?
|
||||||
|
LIMIT 1", "ss", $lang, $name);
|
||||||
|
|
||||||
|
if ($result->num_rows === 0) {
|
||||||
|
$result->close();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$result->close();
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user