diff --git a/src/NodaBlacklistedTerms.php b/src/NodaBlacklistedTerms.php index e70c775..39e4456 100644 --- a/src/NodaBlacklistedTerms.php +++ b/src/NodaBlacklistedTerms.php @@ -62,4 +62,58 @@ final class NodaBlacklistedTerms { 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; + + } }