2021-07-14 13:37:18 +02:00
|
|
|
<?PHP
|
|
|
|
/**
|
|
|
|
* Contains a class of blacklists for unwanted terms.
|
|
|
|
*
|
|
|
|
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
|
|
|
*/
|
|
|
|
declare(strict_types = 1);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Contains lists of disallowed terms by language.
|
|
|
|
*/
|
|
|
|
final class NodaBlacklistedTerms {
|
|
|
|
/**
|
|
|
|
* A blacklist of disallowed tags. All entries are listed in full lowercase.
|
|
|
|
*/
|
2025-01-24 13:45:28 +01:00
|
|
|
public const TAG_BLACKLIST = [
|
2021-07-14 13:37:18 +02:00
|
|
|
'de' => [
|
|
|
|
'andere',
|
2021-10-16 19:27:43 +02:00
|
|
|
'anderes',
|
2021-07-14 21:58:14 +02:00
|
|
|
'sonst',
|
|
|
|
'sonst.',
|
|
|
|
'sonstige',
|
2022-01-13 18:46:51 +01:00
|
|
|
'sonstiges',
|
2021-07-14 21:58:14 +02:00
|
|
|
'versch.',
|
|
|
|
'verschiedenes',
|
2021-07-14 22:01:46 +02:00
|
|
|
'unbekannt',
|
2021-10-16 19:27:43 +02:00
|
|
|
'weitere',
|
2021-07-14 13:37:18 +02:00
|
|
|
'weiteres',
|
2022-02-27 22:26:46 +01:00
|
|
|
|
|
|
|
'objekt',
|
|
|
|
'objekte',
|
|
|
|
'noch nicht bestimmte objekte',
|
|
|
|
'ding',
|
|
|
|
'dinge',
|
2024-01-15 01:46:21 +01:00
|
|
|
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
|
2024-11-24 16:08:14 +01:00
|
|
|
'nichtmünzliches',
|
2025-01-24 13:45:28 +01:00
|
|
|
'unbestimmt',
|
|
|
|
'-',
|
|
|
|
'?',
|
2021-07-14 22:01:46 +02:00
|
|
|
],
|
|
|
|
'en' => [
|
2021-10-16 19:27:43 +02:00
|
|
|
'other',
|
|
|
|
'others',
|
2021-07-14 22:01:46 +02:00
|
|
|
'unknown',
|
|
|
|
'various',
|
2025-01-24 13:45:28 +01:00
|
|
|
'-',
|
|
|
|
'?',
|
2021-07-14 22:01:46 +02:00
|
|
|
],
|
|
|
|
'hu' => [
|
2021-10-16 19:27:43 +02:00
|
|
|
'ism.',
|
2021-07-14 22:01:46 +02:00
|
|
|
'ismeretlen',
|
2025-01-24 13:45:28 +01:00
|
|
|
'-',
|
|
|
|
'?',
|
2021-07-14 22:01:46 +02:00
|
|
|
],
|
2021-07-14 13:37:18 +02:00
|
|
|
];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Checks if an tag name is blacklisted.
|
|
|
|
*
|
|
|
|
* @param string $lang Input language.
|
|
|
|
* @param string $name Input name to check.
|
|
|
|
*
|
|
|
|
* @return boolean
|
|
|
|
*/
|
|
|
|
public static function tagIsInBlacklist(string $lang, string $name):bool {
|
|
|
|
|
|
|
|
$toCheck = \strtolower($name);
|
|
|
|
|
|
|
|
if (!isset(self::TAG_BLACKLIST[$lang])) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (\in_array($toCheck, self::TAG_BLACKLIST[$lang], true)) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
2022-02-18 22:09:26 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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;
|
|
|
|
|
|
|
|
}
|
2023-10-18 01:54:40 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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;
|
|
|
|
|
|
|
|
}
|
2021-07-14 13:37:18 +02:00
|
|
|
}
|