Add function to check if a time name is blacklisted
This commit is contained in:
parent
37715bc3e8
commit
d55361e29b
|
@ -122,4 +122,31 @@ final class NodaBlacklistedTerms {
|
|||
return true;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a time 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 checkTimeBlacklistedInDb(MDMysqli $mysqli, string $lang, string $name):bool {
|
||||
|
||||
$result = $mysqli->query_by_stmt("SELECT 1
|
||||
FROM `" . DATABASENAME_NODA . "`.`zeiten_blacklist`
|
||||
WHERE `language` = ?
|
||||
AND `zeit_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