From e9622e6991e575e932858cac4df95ad151a915f0 Mon Sep 17 00:00:00 2001 From: Sarjuuk Date: Tue, 23 May 2023 03:23:37 +0200 Subject: [PATCH] Filter/Cleanup * move shared criteria enums to parent * define shared regex patterns filter * set missing enum checks * fixed some filters --- includes/basetype.class.php | 67 +++++++-- includes/types/achievement.class.php | 12 +- includes/types/areatrigger.class.php | 14 +- includes/types/arenateam.class.php | 15 +- includes/types/creature.class.php | 34 +++-- includes/types/enchantment.class.php | 20 ++- includes/types/gameobject.class.php | 30 ++-- includes/types/guild.class.php | 13 +- includes/types/icon.class.php | 26 ++-- includes/types/item.class.php | 196 +++++++++++---------------- includes/types/itemset.class.php | 16 ++- includes/types/profile.class.php | 67 ++++----- includes/types/quest.class.php | 35 +++-- includes/types/sound.class.php | 3 +- includes/types/spell.class.php | 12 +- static/js/locale_dede.js | 2 +- static/js/locale_enus.js | 2 +- static/js/locale_eses.js | 2 +- static/js/locale_frfr.js | 2 +- static/js/locale_ruru.js | 2 +- static/js/locale_zhcn.js | 2 +- 21 files changed, 283 insertions(+), 289 deletions(-) diff --git a/includes/basetype.class.php b/includes/basetype.class.php index 33000704..1b1f2994 100644 --- a/includes/basetype.class.php +++ b/includes/basetype.class.php @@ -897,16 +897,31 @@ trait sourceHelper abstract class Filter { - private static $wCards = ['*' => '%', '?' => '_']; + private static $wCards = ['*' => '%', '?' => '_']; - public $error = false; // erronous search fields + public $error = false; // erronous search fields - private $cndSet = []; + private $cndSet = []; - protected $parentCats = []; // used to validate ty-filter - protected $inputFields = []; // list of input fields defined per page - protected $fiData = ['c' => [], 'v' =>[]]; - protected $formData = array( // data to fill form fields + /* genericFilter: [FILTER_TYPE, colOrFnName, param1, param2] + [FILTER_CR_BOOLEAN, , , null] + [FILTER_CR_FLAG, , , ] # default param2: matchExact + [FILTER_CR_NUMERIC, , , ] + [FILTER_CR_STRING, , , null] + [FILTER_CR_ENUM, , , ] + [FILTER_CR_STAFFFLAG, , null, null] + [FILTER_CR_CALLBACK, , , ] + [FILTER_CR_NYI_PH, null, , param2] # mostly 1: to ignore this criterium; 0: to fail the whole query + */ + protected $genericFilter = []; + + /* + fieldId => [checkType, checkValue[, fieldIsArray]] + */ + protected $inputFields = []; // list of input fields defined per page + protected $parentCats = []; // used to validate ty-filter + protected $fiData = ['c' => [], 'v' =>[]]; + protected $formData = array( // data to fill form fields 'form' => [], // base form - unsanitized 'setCriteria' => [], // dynamic criteria list - index checked 'setWeights' => [], // dynamic weights list - index checked @@ -914,6 +929,36 @@ abstract class Filter 'reputationCols' => [] // simlar and exclusive to extraCols - added as required ); + protected const PATTERN_NAME = '/[\p{C};%\\\\]/ui'; + protected const PATTERN_CRV = '/[\p{C};:%\\\\]/ui'; + protected const PATTERN_INT = '/\D/'; + + protected const ENUM_FACTION = array( 469, 1037, 1106, 529, 1012, 87, 21, 910, 609, 942, 909, 530, 69, 577, 930, 1068, 1104, 729, 369, 92, + 54, 946, 67, 1052, 749, 47, 989, 1090, 1098, 978, 1011, 93, 1015, 1038, 76, 470, 349, 1031, 1077, 809, + 911, 890, 970, 169, 730, 72, 70, 932, 1156, 933, 510, 1126, 1067, 1073, 509, 941, 1105, 990, 934, 935, + 1094, 1119, 1124, 1064, 967, 1091, 59, 947, 81, 576, 922, 68, 1050, 1085, 889, 589, 270); + protected const ENUM_CURRENCY = array(32572, 32569, 29736, 44128, 20560, 20559, 29434, 37829, 23247, 44990, 24368, 52027, 52030, 43016, 41596, 34052, 45624, 49426, 40752, 47241, + 40753, 29024, 24245, 26045, 26044, 38425, 29735, 24579, 24581, 32897, 22484, 52026, 52029, 4291, 28558, 43228, 34664, 47242, 52025, 52028, + 37836, 20558, 34597, 43589); + protected const ENUM_EVENT = array( 372, 283, 285, 353, 420, 400, 284, 201, 374, 409, 141, 324, 321, 424, 423, 327, 341, 181, 404, 398, + 301); + protected const ENUM_ZONE = array( 4494, 36, 2597, 3358, 45, 331, 3790, 4277, 16, 3524, 3, 3959, 719, 1584, 25, 1583, 2677, 3702, 3522, 4, + 3525, 3537, 46, 1941, 2918, 3905, 4024, 2817, 4395, 4378, 148, 393, 1657, 41, 2257, 405, 2557, 65, 4196, 1, + 14, 10, 15, 139, 12, 3430, 3820, 361, 357, 3433, 721, 394, 3923, 4416, 2917, 4272, 4820, 4264, 3483, 3562, + 267, 495, 4742, 3606, 210, 4812, 1537, 4710, 4080, 3457, 38, 4131, 3836, 3792, 2100, 2717, 493, 215, 3518, 3698, + 3456, 3523, 2367, 2159, 1637, 4813, 4298, 2437, 722, 491, 44, 3429, 3968, 796, 2057, 51, 3607, 3791, 3789, 209, + 3520, 3703, 3711, 1377, 3487, 130, 3679, 406, 1519, 4384, 33, 2017, 1477, 4075, 8, 440, 141, 3428, 3519, 3848, + 17, 2366, 3840, 3713, 3847, 3775, 4100, 1581, 3557, 3845, 4500, 4809, 47, 3849, 4265, 4493, 4228, 3698, 4406, 3714, + 3717, 3715, 717, 67, 3716, 457, 4415, 400, 1638, 1216, 85, 4723, 4722, 1337, 4273, 490, 1497, 206, 1196, 4603, + 718, 3277, 28, 40, 11, 4197, 618, 3521, 3805, 66, 1176, 1977); + protected const ENUM_HEROICDUNGEON = array( 4494, 3790, 4277, 4196, 4416, 4272, 4820, 4264, 3562, 4131, 3792, 2367, 4813, 3791, 3789, 3848, 2366, 3713, 3847, 4100, + 4809, 3849, 4265, 4228, 3714, 3717, 3715, 3716, 4415, 4723, 206, 1196); + protected const ENUM_MULTIMODERAID = array( 4812, 3456, 2159, 4500, 4493, 4722, 4273, 4603, 4987); + protected const ENUM_HEROICRAID = array( 4987, 4812, 4722); + protected const ENUM_CLASSS = array( null, 1, 2, 3, 4, 5, 6, 7, 8, 9, null, 11, true, false); + protected const ENUM_RACE = array( null, 1, 2, 3, 4, 5, 6, 7, 8, null, 10, 11, true, false); + protected const ENUM_PROFESSION = array( null, 171, 164, 185, 333, 202, 129, 755, 165, 186, 197, true, false, 356, 182, 773); + // parse the provided request into a usable format public function __construct($fromPOST = false, $opts = []) { @@ -1420,9 +1465,9 @@ abstract class Filter return $this->modularizeString([$field], (string)$value, $strFlags & STR_MATCH_EXACT, $strFlags & STR_ALLOW_SHORT); } - private function genericNumeric($field, &$value, $op, $castInt) + private function genericNumeric($field, &$value, $op, $typeCast) { - if (!Util::checkNumeric($value, $castInt)) + if (!Util::checkNumeric($value, $typeCast)) return null; if ($this->int2Op($op)) @@ -1471,8 +1516,8 @@ abstract class Filter case FILTER_CR_ENUM: if (isset($this->enums[$cr[0]][$cr[1]])) $result = $this->genericEnum($gen[1], $this->enums[$cr[0]][$cr[1]]); - else if (intval($cr[1]) != 0) - $result = $this->genericEnum($gen[1], intval($cr[1])); + else if (($gen[2] && $cr[1] == FILTER_ENUM_ANY) || ($gen[3] && $cr[1] == FILTER_ENUM_NONE)) + $result = $this->genericEnum($gen[1], $cr[1]); break; case FILTER_CR_CALLBACK: $result = $this->{$gen[1]}($cr, $gen[2], $gen[3]); diff --git a/includes/types/achievement.class.php b/includes/types/achievement.class.php index b33d4b11..41c5b3a3 100644 --- a/includes/types/achievement.class.php +++ b/includes/types/achievement.class.php @@ -280,9 +280,10 @@ class AchievementListFilter extends Filter { protected $enums = array( + 4 => parent::ENUM_ZONE, // location 11 => array( 327 => 160, // Lunar Festival - 335 => 187, // Love is in the Air + 423 => 187, // Love is in the Air 181 => 159, // Noblegarden 201 => 163, // Children's Week 341 => 161, // Midsummer Fire Festival @@ -301,7 +302,7 @@ class AchievementListFilter extends Filter ) ); - protected $genericFilter = array( // misc (bool): _NUMERIC => useFloat; _STRING => localized; _FLAG => match Value; _BOOLEAN => stringSet + protected $genericFilter = array( 2 => [FILTER_CR_BOOLEAN, 'reward_loc0', true ], // givesreward 3 => [FILTER_CR_STRING, 'reward', STR_LOCALIZED ], // rewardtext 4 => [FILTER_CR_NYI_PH, null, 1, ], // location [enum] @@ -317,12 +318,11 @@ class AchievementListFilter extends Filter 18 => [FILTER_CR_STAFFFLAG, 'flags', ] // flags ); - // fieldId => [checkType, checkValue[, fieldIsArray]] protected $inputFields = array( 'cr' => [FILTER_V_RANGE, [2, 18], true ], // criteria ids 'crs' => [FILTER_V_LIST, [FILTER_ENUM_NONE, FILTER_ENUM_ANY, [0, 99999]], true ], // criteria operators - 'crv' => [FILTER_V_REGEX, '/[\p{C};:%\\\\]/ui', true ], // criteria values - only printable chars, no delimiters - 'na' => [FILTER_V_REGEX, '/[\p{C};%\\\\]/ui', false], // name / description - only printable chars, no delimiter + 'crv' => [FILTER_V_REGEX, parent::PATTERN_CRV, true ], // criteria values - only printable chars, no delimiters + 'na' => [FILTER_V_REGEX, parent::PATTERN_NAME, false], // name / description - only printable chars, no delimiter 'ex' => [FILTER_V_EQUAL, 'on', false], // extended name search 'ma' => [FILTER_V_EQUAL, 1, false], // match any / all filter 'si' => [FILTER_V_LIST, [1, 2, 3, -1, -2], false], // side @@ -333,7 +333,7 @@ class AchievementListFilter extends Filter protected function createSQLForCriterium(&$cr) { if (in_array($cr[0], array_keys($this->genericFilter))) - if ($genCr = $this->genericCriterion($cr)) + if (($genCr = $this->genericCriterion($cr)) !== null) return $genCr; unset($cr); diff --git a/includes/types/areatrigger.class.php b/includes/types/areatrigger.class.php index 80c5bee2..90a639d0 100644 --- a/includes/types/areatrigger.class.php +++ b/includes/types/areatrigger.class.php @@ -57,17 +57,17 @@ class AreaTriggerList extends BaseType class AreaTriggerListFilter extends Filter { protected $genericFilter = array( - 2 => [FILTER_CR_NUMERIC, 'id', NUM_CAST_INT] // id + 2 => [FILTER_CR_NUMERIC, 'id', NUM_CAST_INT] // id ); // fieldId => [checkType, checkValue[, fieldIsArray]] protected $inputFields = array( - 'cr' => [FILTER_V_LIST, [2], true ], // criteria ids - 'crs' => [FILTER_V_RANGE, [1, 6], true ], // criteria operators - 'crv' => [FILTER_V_RANGE, [0, 99999], true ], // criteria values - all criteria are numeric here - 'na' => [FILTER_V_REGEX, '/[\p{C};\\\\]/ui', false], // name - only printable chars, no delimiter - 'ma' => [FILTER_V_EQUAL, 1, false], // match any / all filter - 'ty' => [FILTER_V_RANGE, [0, 5], true ] // types + 'cr' => [FILTER_V_LIST, [2], true ], // criteria ids + 'crs' => [FILTER_V_RANGE, [1, 6], true ], // criteria operators + 'crv' => [FILTER_V_REGEX, parent::PATTERN_INT, true ], // criteria values - all criteria are numeric here + 'na' => [FILTER_V_REGEX, parent::PATTERN_NAME, false], // name - only printable chars, no delimiter + 'ma' => [FILTER_V_EQUAL, 1, false], // match any / all filter + 'ty' => [FILTER_V_RANGE, [0, 5], true ] // types ); protected function createSQLForCriterium(&$cr) diff --git a/includes/types/arenateam.class.php b/includes/types/arenateam.class.php index 8007107d..1a141947 100644 --- a/includes/types/arenateam.class.php +++ b/includes/types/arenateam.class.php @@ -45,15 +45,14 @@ class ArenaTeamListFilter extends Filter public $extraOpts = []; protected $genericFilter = []; - // fieldId => [checkType, checkValue[, fieldIsArray]] protected $inputFields = array( - 'na' => [FILTER_V_REGEX, '/[\p{C};%\\\\]/ui', false], // name - only printable chars, no delimiter - 'ma' => [FILTER_V_EQUAL, 1, false], // match any / all filter - 'ex' => [FILTER_V_EQUAL, 'on', false], // only match exact - 'si' => [FILTER_V_LIST, [1, 2], false], // side - 'sz' => [FILTER_V_LIST, [2, 3, 5], false], // tema size - 'rg' => [FILTER_V_CALLBACK, 'cbRegionCheck', false], // region - 'sv' => [FILTER_V_CALLBACK, 'cbServerCheck', false], // server + 'na' => [FILTER_V_REGEX, parent::PATTERN_NAME, false], // name - only printable chars, no delimiter + 'ma' => [FILTER_V_EQUAL, 1, false], // match any / all filter + 'ex' => [FILTER_V_EQUAL, 'on', false], // only match exact + 'si' => [FILTER_V_LIST, [1, 2], false], // side + 'sz' => [FILTER_V_LIST, [2, 3, 5], false], // tema size + 'rg' => [FILTER_V_CALLBACK, 'cbRegionCheck', false], // region + 'sv' => [FILTER_V_CALLBACK, 'cbServerCheck', false], // server ); protected function createSQLForCriterium(&$cr) { } diff --git a/includes/types/creature.class.php b/includes/types/creature.class.php index 9b3d3406..f4c890cc 100644 --- a/includes/types/creature.class.php +++ b/includes/types/creature.class.php @@ -283,19 +283,19 @@ class CreatureListFilter extends Filter { public $extraOpts = null; protected $enums = array( - 3 => array( 469, 1037, 1106, 529, 1012, 87, 21, 910, 609, 942, 909, 530, 69, 577, 930, 1068, 1104, 729, 369, 92, 54, 946, 67, 1052, 749, - 47, 989, 1090, 1098, 978, 1011, 93, 1015, 1038, 76, 470, 349, 1031, 1077, 809, 911, 890, 970, 169, 730, 72, 70, 932, 1156, 933, - 510, 1126, 1067, 1073, 509, 941, 1105, 990, 934, 935, 1094, 1119, 1124, 1064, 967, 1091, 59, 947, 81, 576, 922, 68, 1050, 1085, 889, - 589, 270) + 3 => parent::ENUM_FACTION, // faction + 6 => parent::ENUM_ZONE, // foundin + 42 => parent::ENUM_FACTION, // increasesrepwith + 43 => parent::ENUM_FACTION, // decreasesrepwith + 38 => parent::ENUM_EVENT // relatedevent ); - // cr => [type, field, misc, extraCol] - protected $genericFilter = array( // misc (bool): _NUMERIC => useFloat; _STRING => localized; _FLAG => match Value; _BOOLEAN => stringSet + protected $genericFilter = array( 1 => [FILTER_CR_CALLBACK, 'cbHealthMana', 'healthMax', 'healthMin'], // health [num] 2 => [FILTER_CR_CALLBACK, 'cbHealthMana', 'manaMin', 'manaMax' ], // mana [num] 3 => [FILTER_CR_CALLBACK, 'cbFaction', null, null ], // faction [enum] 5 => [FILTER_CR_FLAG, 'npcflag', NPC_FLAG_REPAIRER ], // canrepair - 6 => [FILTER_CR_ENUM, 's.areaId', null ], // foundin + 6 => [FILTER_CR_ENUM, 's.areaId', ], // foundin 7 => [FILTER_CR_CALLBACK, 'cbQuestRelation', 'startsQuests', 0x1 ], // startsquest [enum] 8 => [FILTER_CR_CALLBACK, 'cbQuestRelation', 'endsQuests', 0x2 ], // endsquest [enum] 9 => [FILTER_CR_BOOLEAN, 'lootId', ], // lootable @@ -329,12 +329,11 @@ class CreatureListFilter extends Filter 44 => [FILTER_CR_CALLBACK, 'cbSpecialSkinLoot', NPC_TYPEFLAG_ENGINEERLOOT, null ] // salvageable [yn] ); - // fieldId => [checkType, checkValue[, fieldIsArray]] protected $inputFields = array( 'cr' => [FILTER_V_LIST, [[1, 3],[5, 12], 15, 16, [18, 25], [27, 29], [31, 35], 37, 38, [40, 44]], true ], // criteria ids 'crs' => [FILTER_V_LIST, [FILTER_ENUM_NONE, FILTER_ENUM_ANY, [0, 9999]], true ], // criteria operators - 'crv' => [FILTER_V_REGEX, '/[\p{C}:;%\\\\]/ui', true ], // criteria values - only printable chars, no delimiter - 'na' => [FILTER_V_REGEX, '/[\p{C};%\\\\]/ui', false], // name / subname - only printable chars, no delimiter + 'crv' => [FILTER_V_REGEX, parent::PATTERN_CRV, true ], // criteria values - only printable chars, no delimiter + 'na' => [FILTER_V_REGEX, parent::PATTERN_NAME, false], // name / subname - only printable chars, no delimiter 'ex' => [FILTER_V_EQUAL, 'on', false], // also match subname 'ma' => [FILTER_V_EQUAL, 1, false], // match any / all filter 'fa' => [FILTER_V_CALLBACK, 'cbPetFamily', true ], // pet family [list] - cat[0] == 1 @@ -417,9 +416,6 @@ class CreatureListFilter extends Filter protected function cbRelEvent($cr) { - if (!Util::checkNumeric($cr[1], NUM_REQ_INT)) - return false; - if ($cr[1] == FILTER_ENUM_ANY) { $eventIds = DB::Aowow()->selectCol('SELECT id FROM ?_events WHERE holidayId <> 0'); @@ -432,11 +428,13 @@ class CreatureListFilter extends Filter $cGuids = DB::World()->selectCol('SELECT DISTINCT guid FROM game_event_creature WHERE eventEntry IN (?a)', $eventIds); return ['s.guid', $cGuids, '!']; } - else if ($cr[1]) + else if (in_array($cr[1], $this->enums[$cr[0]])) { - $eventIds = DB::Aowow()->selectCol('SELECT id FROM ?_events WHERE holidayId = ?d', $cr[1]); - $cGuids = DB::World()->selectCol('SELECT DISTINCT guid FROM game_event_creature WHERE eventEntry IN (?a)', $eventIds); - return ['s.guid', $cGuids]; + if ($eventIds = DB::Aowow()->selectCol('SELECT id FROM ?_events WHERE holidayId = ?d', $cr[1])) + if ($cGuids = DB::World()->selectCol('SELECT DISTINCT guid FROM game_event_creature WHERE eventEntry IN (?a)', $eventIds)) + return ['s.guid', $cGuids]; + + return [0]; } return false; @@ -518,7 +516,7 @@ class CreatureListFilter extends Filter protected function cbReputation($cr, $op) { - if (!in_array($cr[1], $this->enums[3])) // reuse + if (!in_array($cr[1], $this->enums[$cr[0]])) return false; if ($_ = DB::Aowow()->selectRow('SELECT * FROM ?_factions WHERE id = ?d', $cr[1])) diff --git a/includes/types/enchantment.class.php b/includes/types/enchantment.class.php index 136f6649..ebb674ac 100644 --- a/includes/types/enchantment.class.php +++ b/includes/types/enchantment.class.php @@ -238,13 +238,10 @@ class EnchantmentList extends BaseType class EnchantmentListFilter extends Filter { protected $enums = array( - 3 => array( // requiresprof - null, SKILL_ALCHEMY, SKILL_BLACKSMITHING, SKILL_COOKING, SKILL_ENCHANTING, SKILL_ENGINEERING, SKILL_FIRST_AID, SKILL_JEWELCRAFTING, - SKILL_LEATHERWORKING, SKILL_MINING, SKILL_TAILORING, true, false, SKILL_FISHING, SKILL_HERBALISM, SKILL_INSCRIPTION - ) + 3 => parent::ENUM_PROFESSION // requiresprof ); - protected $genericFilter = array( // misc (bool): _NUMERIC => useFloat; _STRING => localized; _FLAG => match Value; _BOOLEAN => stringSet + protected $genericFilter = array( 2 => [FILTER_CR_NUMERIC, 'id', NUM_CAST_INT, true], // id 3 => [FILTER_CR_ENUM, 'skillLine' ], // requiresprof 4 => [FILTER_CR_NUMERIC, 'skillLevel', NUM_CAST_INT ], // reqskillrank @@ -306,14 +303,13 @@ class EnchantmentListFilter extends Filter 123 => [FILTER_CR_NUMERIC, 'is.splpwr', NUM_CAST_INT, true] // splpwr ); - // fieldId => [checkType, checkValue[, fieldIsArray]] protected $inputFields = array( - 'cr' => [FILTER_V_RANGE, [2, 123], true ], // criteria ids - 'crs' => [FILTER_V_RANGE, [1, 15], true ], // criteria operators - 'crv' => [FILTER_V_RANGE, [0, 99999], true ], // criteria values - only numerals - 'na' => [FILTER_V_REGEX, '/[\p{C};%\\\\]/ui', false], // name - only printable chars, no delimiter - 'ma' => [FILTER_V_EQUAL, 1, false], // match any / all filter - 'ty' => [FILTER_V_RANGE, [1, 8], true ] // types + 'cr' => [FILTER_V_RANGE, [2, 123], true ], // criteria ids + 'crs' => [FILTER_V_RANGE, [1, 15], true ], // criteria operators + 'crv' => [FILTER_V_REGEX, parent::PATTERN_INT, true ], // criteria values - only numerals + 'na' => [FILTER_V_REGEX, parent::PATTERN_NAME, false], // name - only printable chars, no delimiter + 'ma' => [FILTER_V_EQUAL, 1, false], // match any / all filter + 'ty' => [FILTER_V_RANGE, [1, 8], true ] // types ); protected function createSQLForCriterium(&$cr) diff --git a/includes/types/gameobject.class.php b/includes/types/gameobject.class.php index cffc44d8..9b9d36e4 100644 --- a/includes/types/gameobject.class.php +++ b/includes/types/gameobject.class.php @@ -142,36 +142,35 @@ class GameObjectListFilter extends Filter { public $extraOpts = []; protected $enums = array( + 1 => parent::ENUM_ZONE, + 16 => parent::ENUM_EVENT, 50 => array( null, 1, 2, 3, 4, 663 => 663, - 883 => 883, - FILTER_ENUM_ANY => true, - FILTER_ENUM_NONE => false + 883 => 883 ) ); protected $genericFilter = array( - 1 => [FILTER_CR_ENUM, 's.areaId', null ], // foundin + 1 => [FILTER_CR_ENUM, 's.areaId' ], // foundin 2 => [FILTER_CR_CALLBACK, 'cbQuestRelation', 'startsQuests', 0x1 ], // startsquest [side] 3 => [FILTER_CR_CALLBACK, 'cbQuestRelation', 'endsQuests', 0x2 ], // endsquest [side] 4 => [FILTER_CR_CALLBACK, 'cbOpenable', null, null], // openable [yn] - 5 => [FILTER_CR_NYI_PH, null, null ], // averagemoneycontained [op] [int] - GOs don't contain money, match against 0 + 5 => [FILTER_CR_NYI_PH, null, 0 ], // averagemoneycontained [op] [int] - GOs don't contain money, match against 0 7 => [FILTER_CR_NUMERIC, 'reqSkill', NUM_CAST_INT ], // requiredskilllevel 11 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_SCREENSHOT ], // hasscreenshots 13 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_COMMENT ], // hascomments 15 => [FILTER_CR_NUMERIC, 'id', NUM_CAST_INT ], // id 16 => [FILTER_CR_CALLBACK, 'cbRelEvent', null, null], // relatedevent (ignore removed by event) 18 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_VIDEO ], // hasvideos - 50 => [FILTER_CR_ENUM, 'spellFocusId', null, ], // SpellFocus + 50 => [FILTER_CR_ENUM, 'spellFocusId', true, true], // spellfocus ); - // fieldId => [checkType, checkValue[, fieldIsArray]] protected $inputFields = array( 'cr' => [FILTER_V_LIST, [[1, 5], 7, 11, 13, 15, 16, 18, 50], true ], // criteria ids 'crs' => [FILTER_V_LIST, [FILTER_ENUM_NONE, FILTER_ENUM_ANY, [0, 5000]], true ], // criteria operators - 'crv' => [FILTER_V_RANGE, [0, 99999], true ], // criteria values - only numeric input values expected - 'na' => [FILTER_V_REGEX, '/[\p{C};%\\\\]/ui', false], // name - only printable chars, no delimiter + 'crv' => [FILTER_V_REGEX, parent::PATTERN_INT, true ], // criteria values - only numeric input values expected + 'na' => [FILTER_V_REGEX, parent::PATTERN_NAME, false], // name - only printable chars, no delimiter 'ma' => [FILTER_V_EQUAL, 1, false] // match any / all filter ); @@ -229,9 +228,6 @@ class GameObjectListFilter extends Filter protected function cbRelEvent($cr) { - if (!Util::checkNumeric($cr[1], NUM_REQ_INT)) - return false;; - if ($cr[1] == FILTER_ENUM_ANY) { $eventIds = DB::Aowow()->selectCol('SELECT id FROM ?_events WHERE holidayId <> 0'); @@ -244,11 +240,13 @@ class GameObjectListFilter extends Filter $goGuids = DB::World()->selectCol('SELECT DISTINCT guid FROM game_event_gameobject WHERE eventEntry IN (?a)', $eventIds); return ['s.guid', $goGuids, '!']; } - else if ($cr[1]) + else if (in_array($cr[1], $this->enums[$cr[0]])) { - $eventIds = DB::Aowow()->selectCol('SELECT id FROM ?_events WHERE holidayId = ?d', $cr[1]); - $goGuids = DB::World()->selectCol('SELECT DISTINCT guid FROM game_event_gameobject WHERE eventEntry IN (?a)', $eventIds); - return ['s.guid', $goGuids]; + if ($eventIds = DB::Aowow()->selectCol('SELECT id FROM ?_events WHERE holidayId = ?d', $cr[1])) + if ($goGuids = DB::World()->selectCol('SELECT DISTINCT guid FROM game_event_gameobject WHERE eventEntry IN (?a)', $eventIds)) + return ['s.guid', $goGuids]; + + return [0]; } return false; diff --git a/includes/types/guild.class.php b/includes/types/guild.class.php index 981cc3bf..f51fe452 100644 --- a/includes/types/guild.class.php +++ b/includes/types/guild.class.php @@ -88,14 +88,13 @@ class GuildListFilter extends Filter public $extraOpts = []; protected $genericFilter = []; - // fieldId => [checkType, checkValue[, fieldIsArray]] protected $inputFields = array( - 'na' => [FILTER_V_REGEX, '/[\p{C};%\\\\]/ui', false], // name - only printable chars, no delimiter - 'ma' => [FILTER_V_EQUAL, 1, false], // match any / all filter - 'ex' => [FILTER_V_EQUAL, 'on', false], // only match exact - 'si' => [FILTER_V_LIST, [1, 2], false], // side - 'rg' => [FILTER_V_CALLBACK, 'cbRegionCheck', false], // region - 'sv' => [FILTER_V_CALLBACK, 'cbServerCheck', false], // server + 'na' => [FILTER_V_REGEX, parent::PATTERN_NAME, false], // name - only printable chars, no delimiter + 'ma' => [FILTER_V_EQUAL, 1, false], // match any / all filter + 'ex' => [FILTER_V_EQUAL, 'on', false], // only match exact + 'si' => [FILTER_V_LIST, [1, 2], false], // side + 'rg' => [FILTER_V_CALLBACK, 'cbRegionCheck', false], // region + 'sv' => [FILTER_V_CALLBACK, 'cbServerCheck', false], // server ); protected function createSQLForCriterium(&$cr) { } diff --git a/includes/types/icon.class.php b/includes/types/icon.class.php index f74f69e7..756ff07b 100644 --- a/includes/types/icon.class.php +++ b/includes/types/icon.class.php @@ -103,7 +103,6 @@ class IconListFilter extends Filter { public $extraOpts = null; - // cr => [type, field, misc, extraCol] private $criterion2field = array( 1 => '?_items', // items [num] 2 => '?_spell', // spells [num] @@ -121,22 +120,21 @@ class IconListFilter extends Filter private $totalUses = []; protected $genericFilter = array( - 1 => [FILTER_CR_CALLBACK, 'cbUseAny' ], // items [num] - 2 => [FILTER_CR_CALLBACK, 'cbUseAny' ], // spells [num] - 3 => [FILTER_CR_CALLBACK, 'cbUseAny' ], // achievements [num] - 6 => [FILTER_CR_CALLBACK, 'cbUseAny' ], // currencies [num] - 9 => [FILTER_CR_CALLBACK, 'cbUseAny' ], // hunterpets [num] - 11 => [FILTER_CR_NYI_PH, null, null], // classes [num] - 13 => [FILTER_CR_CALLBACK, 'cbUseAll' ] // used [num] + 1 => [FILTER_CR_CALLBACK, 'cbUseAny' ], // items [num] + 2 => [FILTER_CR_CALLBACK, 'cbUseAny' ], // spells [num] + 3 => [FILTER_CR_CALLBACK, 'cbUseAny' ], // achievements [num] + 6 => [FILTER_CR_CALLBACK, 'cbUseAny' ], // currencies [num] + 9 => [FILTER_CR_CALLBACK, 'cbUseAny' ], // hunterpets [num] + 11 => [FILTER_CR_NYI_PH, null, 0], // classes [num] + 13 => [FILTER_CR_CALLBACK, 'cbUseAll' ] // used [num] ); - // fieldId => [checkType, checkValue[, fieldIsArray]] protected $inputFields = array( - 'cr' => [FILTER_V_LIST, [1, 2, 3, 6, 9, 11, 13], true ], // criteria ids - 'crs' => [FILTER_V_RANGE, [1, 6], true ], // criteria operators - 'crv' => [FILTER_V_RANGE, [0, 99999], true ], // criteria values - all criteria are numeric here - 'na' => [FILTER_V_REGEX, '/[\p{C};%\\\\]/ui', false], // name - only printable chars, no delimiter - 'ma' => [FILTER_V_EQUAL, 1, false] // match any / all filter + 'cr' => [FILTER_V_LIST, [1, 2, 3, 6, 9, 11, 13], true ], // criteria ids + 'crs' => [FILTER_V_RANGE, [1, 6], true ], // criteria operators + 'crv' => [FILTER_V_REGEX, parent::PATTERN_INT, true ], // criteria values - all criteria are numeric here + 'na' => [FILTER_V_REGEX, parent::PATTERN_NAME, false], // name - only printable chars, no delimiter + 'ma' => [FILTER_V_EQUAL, 1, false] // match any / all filter ); private function _getCnd($op, $val, $tbl) diff --git a/includes/types/item.class.php b/includes/types/item.class.php index 697156a9..7c08f533 100644 --- a/includes/types/item.class.php +++ b/includes/types/item.class.php @@ -1735,69 +1735,63 @@ class ItemListFilter extends Filter private $ubFilter = []; // usable-by - limit weapon/armor selection per CharClass - itemClass => available itemsubclasses private $extCostQuery = 'SELECT item FROM npc_vendor WHERE extendedCost IN (?a) UNION SELECT item FROM game_event_npc_vendor WHERE extendedCost IN (?a)'; - private $otFields = [18 => 4, 68 => 15, 69 => 16, 70 => 17, 72 => 2, 73 => 19, 75 => 21, 76 => 23, 88 => 20, 92 => 5, 93 => 3, 143 => 18, 171 => 8, 172 => 12]; public $extraOpts = []; // score for statWeights public $wtCnd = []; protected $enums = array( - 16 => array( // drops in zone - 4494, 36, 2597, 3358, 45, 331, 3790, 4277, 16, 3524, 3, 3959, 719, 1584, 25, 1583, 2677, 3702, 3522, 4, 3525, 3537, 46, 1941, - 2918, 3905, 4024, 2817, 4395, 4378, 148, 393, 1657, 41, 2257, 405, 2557, 65, 4196, 1, 14, 10, 15, 139, 12, 3430, 3820, 361, - 357, 3433, 721, 394, 3923, 4416, 2917, 4272, 4820, 4264, 3483, 3562, 267, 495, 4742, 3606, 210, 4812, 1537, 4710, 4080, 3457, 38, 4131, - 3836, 3792, 2100, 2717, 493, 215, 3518, 3698, 3456, 3523, 2367, 2159, 1637, 4813, 4298, 2437, 722, 491, 44, 3429, 3968, 796, 2057, 51, - 3607, 3791, 3789, 209, 3520, 3703, 3711, 1377, 3487, 130, 3679, 406, 1519, 4384, 33, 2017, 1477, 4075, 8, 440, 141, 3428, 3519, 3848, - 17, 2366, 3840, 3713, 3847, 3775, 4100, 1581, 3557, 3845, 4500, 4809, 47, 3849, 4265, 4493, 4228, 3698, 4406, 3714, 3717, 3715, 717, 67, - 3716, 457, 4415, 400, 1638, 1216, 85, 4723, 4722, 1337, 4273, 490, 1497, 206, 1196, 4603, 718, 3277, 28, 40, 11, 4197, 618, 3521, - 3805, 66, 1176, 1977 + 16 => parent::ENUM_ZONE, // drops in zone + 17 => parent::ENUM_FACTION, // requiresrepwith + 99 => parent::ENUM_PROFESSION, // requiresprof + 86 => parent::ENUM_PROFESSION, // craftedprof + 87 => parent::ENUM_PROFESSION, // reagentforability + 105 => parent::ENUM_HEROICDUNGEON, // drops in nh dungeon + 106 => parent::ENUM_HEROICDUNGEON, // drops in hc dungeon + 126 => parent::ENUM_ZONE, // rewardedbyquestin + 147 => parent::ENUM_MULTIMODERAID, // drops in nh raid 10 + 148 => parent::ENUM_MULTIMODERAID, // drops in nh raid 25 + 149 => parent::ENUM_HEROICRAID, // drops in hc raid 10 + 150 => parent::ENUM_HEROICRAID, // drops in hc raid 25 + 152 => parent::ENUM_CLASSS, // class-specific + 153 => parent::ENUM_RACE, // race-specific + 160 => parent::ENUM_EVENT, // relatedevent + 169 => parent::ENUM_EVENT, // requiresevent + 158 => parent::ENUM_CURRENCY, // purchasablewithcurrency + 118 => array( // itemcurrency + 34853, 34854, 34855, 34856, 34857, 34858, 34848, 34851, 34852, 40625, 40626, 40627, 45632, 45633, 45634, 34169, 34186, 29754, 29753, 29755, + 31089, 31091, 31090, 40610, 40611, 40612, 30236, 30237, 30238, 45635, 45636, 45637, 34245, 34332, 34339, 34345, 40631, 40632, 40633, 45638, + 45639, 45640, 34244, 34208, 34180, 34229, 34350, 40628, 40629, 40630, 45641, 45642, 45643, 29757, 29758, 29756, 31092, 31094, 31093, 40613, + 40614, 40615, 30239, 30240, 30241, 45644, 45645, 45646, 34342, 34211, 34243, 29760, 29761, 29759, 31097, 31095, 31096, 40616, 40617, 40618, + 30242, 30243, 30244, 45647, 45648, 45649, 34216, 29766, 29767, 29765, 31098, 31100, 31099, 40619, 40620, 40621, 30245, 30246, 30247, 45650, + 45651, 45652, 34167, 40634, 40635, 40636, 45653, 45654, 45655, 40637, 40638, 40639, 45656, 45657, 45658, 34170, 34192, 29763, 29764, 29762, + 31101, 31103, 31102, 30248, 30249, 30250, 47557, 47558, 47559, 34233, 34234, 34202, 34195, 34209, 40622, 40623, 40624, 34193, 45659, 45660, + 45661, 34212, 34351, 34215 ), - 66 => array( // profession specialization - 1 => -1, - 2 => [ 9788, 9787, 17041, 17040, 17039 ], - 3 => -1, - 4 => -1, - 5 => [20219, 20222 ], - 6 => -1, - 7 => -1, - 8 => [10656, 10658, 10660 ], - 9 => -1, - 10 => [26798, 26801, 26797 ], - 11 => [ 9788, 9787, 17041, 17040, 17039, 20219, 20222, 10656, 10658, 10660, 26798, 26801, 26797], // i know, i know .. lazy as fuck - 12 => false, - 13 => -1, - 14 => -1, - 15 => -1 + 163 => array( // enchantment mats + 34057, 22445, 11176, 34052, 11082, 34055, 16203, 10939, 11135, 11175, 22446, 16204, 34054, 14344, 11084, 11139, 22449, 11178, 10998, 34056, + 16202, 10938, 11134, 11174, 22447, 20725, 14343, 34053, 10978, 11138, 22448, 11177, 11083, 10940, 11137, 22450 ), - 99 => array( // profession | recycled for 86, 87 - null, 171, 164, 185, 333, 202, 129, 755, 165, 186, 197, true, false, 356, 182, 773 + 91 => array( // tool + 3, 14, 162, 168, 141, 2, 4, 169, 161, 15, 167, 81, 21, 165, 12, 62, 10, 101, 189, 6, + 63, 41, 8, 7, 190, 9, 166, 121, 5 ), - 105 => array( // drops in nh dungeon - 4494, 3790, 4277, 4196, 4416, 4272, 4820, 4264, 3562, 4131, 3792, 2367, 4813, 3791, 3789, 3848, 2366, 3713, 3847, 4100, - 4809, 3849, 4265, 4228, 3714, 3717, 3715, 3716, 4415, 4723, 206, 1196 - ), - 106 => array( // drops in hc dungeon - 4494, 3790, 4277, 4196, 4416, 4272, 4820, 4264, 3562, 4131, 3792, 2367, 4813, 3791, 3789, 3848, 2366, 3713, 3847, 4100, - 4809, 3849, 4265, 4228, 3714, 3717, 3715, 3716, 4415, 4723, 206, 1196 - ), - 118 => array( // tokens - 34853, 34854, 34855, 34856, 34857, 34858, 34848, 34851, 34852, 40625, 40626, 40627, 45632, 45633, 45634, 34169, 34186, 29754, 29753, 29755, 31089, 31091, 31090, - 40610, 40611, 40612, 30236, 30237, 30238, 45635, 45636, 45637, 34245, 34332, 34339, 34345, 40631, 40632, 40633, 45638, 45639, 45640, 34244, 34208, 34180, 34229, - 34350, 40628, 40629, 40630, 45641, 45642, 45643, 29757, 29758, 29756, 31092, 31094, 31093, 40613, 40614, 40615, 30239, 30240, 30241, 45644, 45645, 45646, 34342, - 34211, 34243, 29760, 29761, 29759, 31097, 31095, 31096, 40616, 40617, 40618, 30242, 30243, 30244, 45647, 45648, 45649, 34216, 29766, 29767, 29765, 31098, 31100, - 31099, 40619, 40620, 40621, 30245, 30246, 30247, 45650, 45651, 45652, 34167, 40634, 40635, 40636, 45653, 45654, 45655, 40637, 40638, 40639, 45656, 45657, 45658, - 34170, 34192, 29763, 29764, 29762, 31101, 31103, 31102, 30248, 30249, 30250, 47557, 47558, 47559, 34233, 34234, 34202, 34195, 34209, 40622, 40623, 40624, 34193, - 45659, 45660, 45661, 34212, 34351, 34215 - ), - 126 => array( // Zones - 4494, 36, 2597, 3358, 45, 331, 3790, 4277, 16, 3524, 3, 3959, 719, 1584, 25, 1583, 2677, 3702, 3522, 4, 3525, 3537, 46, 1941, - 2918, 3905, 4024, 2817, 4395, 4378, 148, 393, 1657, 41, 2257, 405, 2557, 65, 4196, 1, 14, 10, 15, 139, 12, 3430, 3820, 361, - 357, 3433, 721, 394, 3923, 4416, 2917, 4272, 4820, 4264, 3483, 3562, 267, 495, 4742, 3606, 210, 4812, 1537, 4710, 4080, 3457, 38, 4131, - 3836, 3792, 2100, 2717, 493, 215, 3518, 3698, 3456, 3523, 2367, 2159, 1637, 4813, 4298, 2437, 722, 491, 44, 3429, 3968, 796, 2057, 51, - 3607, 3791, 3789, 209, 3520, 3703, 3711, 1377, 3487, 130, 3679, 406, 1519, 4384, 33, 2017, 1477, 4075, 8, 440, 141, 3428, 3519, 3848, - 17, 2366, 3840, 3713, 3847, 3775, 4100, 1581, 3557, 3845, 4500, 4809, 47, 3849, 4265, 4493, 4228, 3698, 4406, 3714, 3717, 3715, 717, 67, - 3716, 457, 4415, 400, 1638, 1216, 85, 4723, 4722, 1337, 4273, 490, 1497, 206, 1196, 4603, 718, 3277, 28, 40, 11, 4197, 618, 3521, - 3805, 66, 1176, 1977 - ), - 128 => array( // source + 66 => array( // profession specialization + 1 => -1, + 2 => [ 9788, 9787, 17041, 17040, 17039 ], + 3 => -1, + 4 => -1, + 5 => [20219, 20222 ], + 6 => -1, + 7 => -1, + 8 => [10656, 10658, 10660 ], + 9 => -1, + 10 => [26798, 26801, 26797 ], + 11 => [ 9788, 9787, 17041, 17040, 17039, 20219, 20222, 10656, 10658, 10660, 26798, 26801, 26797], // i know, i know .. lazy as fuck + 12 => false, + 13 => -1, + 14 => -1, + 15 => -1 + ), + 128 => array( // source 1 => true, // Any 2 => false, // None 3 => 1, // Crafted @@ -1808,37 +1802,10 @@ class ItemListFilter extends Filter 9 => 10, // Starter 10 => 11, // Event 11 => 12 // Achievement - ), - 147 => array( // drops in nh raid 10 - 4812, 3456, 2159, 4500, 4493, 4722, 4273, 4603, 4987 - ), - 148 => array( // drops in nh raid 25 - 4812, 3456, 2159, 4500, 4493, 4722, 4273, 4603, 4987 - ), - 149 => array( // drops in hc raid 10 - 4987, 4812, 4722 - ), - 150 => array( // drops in hc raid 25 - 4987, 4812, 4722 - ), - 152 => array( // class-specific - null, 1, 2, 3, 4, 5, 6, 7, 8, 9, null, 11, true, false - ), - 153 => array( // race-specific - null, 1, 2, 3, 4, 5, 6, 7, 8, null, 10, 11, true, false - ), - 158 => array( // currency - 32572, 32569, 29736, 44128, 20560, 20559, 29434, 37829, 23247, 44990, 24368, 52027, 52030, 43016, 41596, 34052, 45624, 49426, 40752, 47241, 40753, 29024, - 24245, 26045, 26044, 38425, 29735, 24579, 24581, 32897, 22484, 52026, 52029, 4291, 28558, 43228, 34664, 47242, 52025, 52028, 37836, 20558, 34597, 43589 - ), - 163 => array( // enchantment mats - 34057, 22445, 11176, 34052, 11082, 34055, 16203, 10939, 11135, 11175, 22446, 16204, 34054, 14344, 11084, 11139, 22449, 11178, - 10998, 34056, 16202, 10938, 11134, 11174, 22447, 20725, 14343, 34053, 10978, 11138, 22448, 11177, 11083, 10940, 11137, 22450 ) ); - // cr => [type, field, misc, extraCol] - protected $genericFilter = array( // misc (bool): _NUMERIC => useFloat; _STRING => localized; _FLAG => match Value; _BOOLEAN => stringSet + protected $genericFilter = array( 2 => [FILTER_CR_CALLBACK, 'cbFieldHasVal', 'bonding', 1 ], // bindonpickup [yn] 3 => [FILTER_CR_CALLBACK, 'cbFieldHasVal', 'bonding', 2 ], // bindonequip [yn] 4 => [FILTER_CR_CALLBACK, 'cbFieldHasVal', 'bonding', 3 ], // bindonuse [yn] @@ -1854,7 +1821,7 @@ class ItemListFilter extends Filter 14 => [FILTER_CR_BOOLEAN, 'pageTextId' ], // readable 15 => [FILTER_CR_CALLBACK, 'cbFieldHasVal', 'maxCount', 1 ], // unique [yn] 16 => [FILTER_CR_CALLBACK, 'cbDropsInZone', null, null ], // dropsin [zone] - 17 => [FILTER_CR_ENUM, 'requiredFaction' ], // requiresrepwith + 17 => [FILTER_CR_ENUM, 'requiredFaction', true, true ], // requiresrepwith 18 => [FILTER_CR_CALLBACK, 'cbFactionQuestReward', null, null ], // rewardedbyfactionquest [side] 20 => [FILTER_CR_NUMERIC, 'is.str', NUM_CAST_INT, true ], // str 21 => [FILTER_CR_NUMERIC, 'is.agi', NUM_CAST_INT, true ], // agi @@ -1900,15 +1867,15 @@ class ItemListFilter extends Filter 64 => [FILTER_CR_NUMERIC, 'sellPrice', NUM_CAST_INT, true ], // sellprice 65 => [FILTER_CR_CALLBACK, 'cbAvgMoneyContent', null, null ], // avgmoney [op] [int] 66 => [FILTER_CR_ENUM, 'requiredSpell' ], // requiresprofspec - 68 => [FILTER_CR_CALLBACK, 'cbObtainedBy', null, null ], // otdisenchanting [yn] - 69 => [FILTER_CR_CALLBACK, 'cbObtainedBy', null, null ], // otfishing [yn] - 70 => [FILTER_CR_CALLBACK, 'cbObtainedBy', null, null ], // otherbgathering [yn] + 68 => [FILTER_CR_CALLBACK, 'cbObtainedBy', 15, null ], // otdisenchanting [yn] + 69 => [FILTER_CR_CALLBACK, 'cbObtainedBy', 16, null ], // otfishing [yn] + 70 => [FILTER_CR_CALLBACK, 'cbObtainedBy', 17, null ], // otherbgathering [yn] 71 => [FILTER_CR_FLAG, 'cuFlags', ITEM_CU_OT_ITEMLOOT ], // otitemopening [yn] - 72 => [FILTER_CR_CALLBACK, 'cbObtainedBy', null, null ], // otlooting [yn] - 73 => [FILTER_CR_CALLBACK, 'cbObtainedBy', null, null ], // otmining [yn] + 72 => [FILTER_CR_CALLBACK, 'cbObtainedBy', 2, null ], // otlooting [yn] + 73 => [FILTER_CR_CALLBACK, 'cbObtainedBy', 19, null ], // otmining [yn] 74 => [FILTER_CR_FLAG, 'cuFlags', ITEM_CU_OT_OBJECTLOOT ], // otobjectopening [yn] - 75 => [FILTER_CR_CALLBACK, 'cbObtainedBy', null, null ], // otpickpocketing [yn] - 76 => [FILTER_CR_CALLBACK, 'cbObtainedBy', null, null ], // otskinning [yn] + 75 => [FILTER_CR_CALLBACK, 'cbObtainedBy', 21, null ], // otpickpocketing [yn] + 76 => [FILTER_CR_CALLBACK, 'cbObtainedBy', 23, null ], // otskinning [yn] 77 => [FILTER_CR_NUMERIC, 'is.atkpwr', NUM_CAST_INT, true ], // atkpwr 78 => [FILTER_CR_NUMERIC, 'is.mlehastertng', NUM_CAST_INT, true ], // mlehastertng 79 => [FILTER_CR_NUMERIC, 'is.resirtng', NUM_CAST_INT, true ], // resirtng @@ -1919,12 +1886,12 @@ class ItemListFilter extends Filter 85 => [FILTER_CR_CALLBACK, 'cbObjectiveOfQuest', null, null ], // objectivequest [side] 86 => [FILTER_CR_CALLBACK, 'cbCraftedByProf', null, null ], // craftedprof [enum] 87 => [FILTER_CR_CALLBACK, 'cbReagentForAbility', null, null ], // reagentforability [enum] - 88 => [FILTER_CR_CALLBACK, 'cbObtainedBy', null, null ], // otprospecting [yn] + 88 => [FILTER_CR_CALLBACK, 'cbObtainedBy', 20, null ], // otprospecting [yn] 89 => [FILTER_CR_FLAG, 'flags', ITEM_FLAG_PROSPECTABLE ], // prospectable 90 => [FILTER_CR_CALLBACK, 'cbAvgBuyout', null, null ], // avgbuyout [op] [int] 91 => [FILTER_CR_ENUM, 'totemCategory' ], // tool - 92 => [FILTER_CR_CALLBACK, 'cbObtainedBy', null, null ], // soldbyvendor [yn] - 93 => [FILTER_CR_CALLBACK, 'cbObtainedBy', null, null ], // otpvp [pvp] + 92 => [FILTER_CR_CALLBACK, 'cbObtainedBy', 5, null ], // soldbyvendor [yn] + 93 => [FILTER_CR_CALLBACK, 'cbObtainedBy', 3, null ], // otpvp [pvp] 94 => [FILTER_CR_NUMERIC, 'is.splpen', NUM_CAST_INT, true ], // splpen 95 => [FILTER_CR_NUMERIC, 'is.mlehitrtng', NUM_CAST_INT, true ], // mlehitrtng 96 => [FILTER_CR_NUMERIC, 'is.critstrkrtng', NUM_CAST_INT, true ], // critstrkrtng @@ -1966,9 +1933,9 @@ class ItemListFilter extends Filter 140 => [FILTER_CR_NUMERIC, 'is.rgddmgmax', NUM_CAST_INT, true ], // rgddmgmax 141 => [FILTER_CR_NUMERIC, 'is.rgdspeed', NUM_CAST_FLOAT, true ], // rgdspeed 142 => [FILTER_CR_STRING, 'ic.name' ], // icon - 143 => [FILTER_CR_CALLBACK, 'cbObtainedBy', null, null ], // otmilling [yn] + 143 => [FILTER_CR_CALLBACK, 'cbObtainedBy', 18, null ], // otmilling [yn] 144 => [FILTER_CR_CALLBACK, 'cbPvpPurchasable', 'reqHonorPoints', null ], // purchasablewithhonor [yn] - 145 => [FILTER_CR_CALLBACK, 'cbPvpPurchasable', 'reqHonorPoints', null ], // purchasablewitharena [yn] + 145 => [FILTER_CR_CALLBACK, 'cbPvpPurchasable', 'reqArenaPoints', null ], // purchasablewitharena [yn] 146 => [FILTER_CR_FLAG, 'flags', ITEM_FLAG_HEROIC ], // heroic 147 => [FILTER_CR_CALLBACK, 'cbDropsInInstance', SRC_FLAG_RAID_DROP, 1, ], // dropsinnormal10 [multimoderaid-any] 148 => [FILTER_CR_CALLBACK, 'cbDropsInInstance', SRC_FLAG_RAID_DROP, 2, ], // dropsinnormal25 [multimoderaid-any] @@ -1990,14 +1957,13 @@ class ItemListFilter extends Filter 165 => [FILTER_CR_NUMERIC, 'repairPrice', NUM_CAST_INT, true ], // repaircost 167 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_VIDEO ], // hasvideos 168 => [FILTER_CR_CALLBACK, 'cbFieldHasVal', 'spellId1', LEARN_SPELLS ], // teachesspell [yn] - 169 => [FILTER_CR_ENUM, 'e.holidayId' ], // requiresevent - 171 => [FILTER_CR_CALLBACK, 'cbObtainedBy', null, null ], // otredemption [yn] - 172 => [FILTER_CR_CALLBACK, 'cbObtainedBy', null, null ], // rewardedbyachievement [yn] + 169 => [FILTER_CR_ENUM, 'e.holidayId', true, true ], // requiresevent + 171 => [FILTER_CR_CALLBACK, 'cbObtainedBy', 8, null ], // otredemption [yn] + 172 => [FILTER_CR_CALLBACK, 'cbObtainedBy', 12, null ], // rewardedbyachievement [yn] 176 => [FILTER_CR_STAFFFLAG, 'flags' ], // flags 177 => [FILTER_CR_STAFFFLAG, 'flagsExtra' ], // flags2 ); - // fieldId => [checkType, checkValue[, fieldIsArray]] protected $inputFields = array( 'wt' => [FILTER_V_CALLBACK, 'cbWeightKeyCheck', true ], // weight keys 'wtv' => [FILTER_V_RANGE, [1, 999], true ], // weight values @@ -2005,10 +1971,10 @@ class ItemListFilter extends Filter 'gm' => [FILTER_V_LIST, [2, 3, 4], false], // gem rarity for weight calculation 'cr' => [FILTER_V_RANGE, [1, 177], true ], // criteria ids 'crs' => [FILTER_V_LIST, [FILTER_ENUM_NONE, FILTER_ENUM_ANY, [0, 99999]], true ], // criteria operators - 'crv' => [FILTER_V_REGEX, '/[\p{C};:%\\\\]/ui', true ], // criteria values - only printable chars, no delimiters + 'crv' => [FILTER_V_REGEX, parent::PATTERN_CRV, true ], // criteria values - only printable chars, no delimiters 'upg' => [FILTER_V_REGEX, '/[^\d:]/ui', false], // upgrade item ids 'gb' => [FILTER_V_LIST, [0, 1, 2, 3], false], // search result grouping - 'na' => [FILTER_V_REGEX, '/[\p{C};%\\\\]/ui', false], // name - only printable chars, no delimiter + 'na' => [FILTER_V_REGEX, parent::PATTERN_NAME, false], // name - only printable chars, no delimiter 'ma' => [FILTER_V_EQUAL, 1, false], // match any / all filter 'ub' => [FILTER_V_LIST, [[1, 9], 11], false], // usable by classId 'qu' => [FILTER_V_RANGE, [0, 7], true ], // quality ids @@ -2211,22 +2177,18 @@ class ItemListFilter extends Filter protected function cbFactionQuestReward($cr) { - if (!isset($this->otFields[$cr[0]])) - return false; - - $field = 'src.src'.$this->otFields[$cr[0]]; switch ($cr[1]) { case 1: // Yes - return [$field, null, '!']; + return ['src.src4', null, '!']; case 2: // Alliance - return [$field, 1]; + return ['src.src4', 1]; case 3: // Horde - return [$field, 2]; + return ['src.src4', 2]; case 4: // Both - return [$field, 3]; + return ['src.src4', 3]; case 5: // No - return [$field, null]; + return ['src.src4', null]; } return false; @@ -2362,10 +2324,10 @@ class ItemListFilter extends Filter protected function cbCraftedByProf($cr) { - if (!isset($this->enums[99][$cr[1]])) + if (!isset($this->enums[$cr[0]][$cr[1]])) return false; - $_ = $this->enums[99][$cr[1]]; + $_ = $this->enums[$cr[0]][$cr[1]]; if (is_bool($_)) return ['src.src1', null, $_ ? '!' : null]; else if (is_int($_)) @@ -2510,7 +2472,7 @@ class ItemListFilter extends Filter protected function cbObtainedBy($cr, $field) { if ($this->int2Bool($cr[1])) - return ['src.src'.$this->otFields[$cr[0]], null, $cr[1] ? '!' : null]; + return ['src.src'.$field, null, $cr[1] ? '!' : null]; return false; } @@ -2585,10 +2547,10 @@ class ItemListFilter extends Filter protected function cbReagentForAbility($cr) { - if (!isset($this->enums[99][$cr[1]])) + if (!isset($this->enums[$cr[0]][$cr[1]])) return false; - $_ = $this->enums[99][$cr[1]]; + $_ = $this->enums[$cr[0]][$cr[1]]; if ($_ === null) return false; diff --git a/includes/types/itemset.class.php b/includes/types/itemset.class.php index 12ed5638..35ee19b4 100644 --- a/includes/types/itemset.class.php +++ b/includes/types/itemset.class.php @@ -171,25 +171,27 @@ class ItemsetList extends BaseType // missing filter: "Available to Players" class ItemsetListFilter extends Filter { - // cr => [type, field, misc, extraCol] - protected $genericFilter = array( // misc (bool): _NUMERIC => useFloat; _STRING => localized; _FLAG => match Value; _BOOLEAN => stringSet + protected $enums = array( + 6 => parent::ENUM_EVENT + ); + + protected $genericFilter = array( 2 => [FILTER_CR_NUMERIC, 'id', NUM_CAST_INT, true], // id 3 => [FILTER_CR_NUMERIC, 'npieces', NUM_CAST_INT ], // pieces 4 => [FILTER_CR_STRING, 'bonusText', STR_LOCALIZED ], // bonustext - 5 => [FILTER_CR_BOOLEAN, 'heroic', ], // heroic - 6 => [FILTER_CR_ENUM, 'e.holidayId', ], // relatedevent + 5 => [FILTER_CR_BOOLEAN, 'heroic' ], // heroic + 6 => [FILTER_CR_ENUM, 'e.holidayId', true, true], // relatedevent 8 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_COMMENT ], // hascomments 9 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_SCREENSHOT ], // hasscreenshots 10 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_VIDEO ], // hasvideos 12 => [FILTER_CR_NYI_PH, null, 1 ] // available to players [yn] - ugh .. scan loot, quest and vendor templates and write to ?_itemset ); - // fieldId => [checkType, checkValue[, fieldIsArray]] protected $inputFields = array( 'cr' => [FILTER_V_RANGE, [2, 12], true ], // criteria ids 'crs' => [FILTER_V_LIST, [FILTER_ENUM_NONE, FILTER_ENUM_ANY, [0, 424]], true ], // criteria operators - 'crv' => [FILTER_V_REGEX, '/[\p{C};:%\\\\]/ui', true ], // criteria values - only printable chars, no delimiters - 'na' => [FILTER_V_REGEX, '/[\p{C};%\\\\]/ui', false], // name / description - only printable chars, no delimiter + 'crv' => [FILTER_V_REGEX, parent::PATTERN_CRV, true ], // criteria values - only printable chars, no delimiters + 'na' => [FILTER_V_REGEX, parent::PATTERN_NAME, false], // name / description - only printable chars, no delimiter 'ma' => [FILTER_V_EQUAL, 1, false], // match any / all filter 'qu' => [FILTER_V_RANGE, [0, 7], true ], // quality 'ty' => [FILTER_V_RANGE, [1, 12], true ], // set type diff --git a/includes/types/profile.class.php b/includes/types/profile.class.php index 0fd5a2ae..d629463c 100644 --- a/includes/types/profile.class.php +++ b/includes/types/profile.class.php @@ -240,32 +240,23 @@ class ProfileListFilter extends Filter private $realms = []; - protected $enums = array( - -1 => array( // arena team sizes - // by name by rating by contrib - 12 => 2, 13 => 2, 14 => 2, - 15 => 3, 16 => 3, 17 => 3, - 18 => 5, 19 => 5, 20 => 5 - ) - ); - - protected $genericFilter = array( // misc (bool): _NUMERIC => useFloat; _STRING => localized; _FLAG => match Value; _BOOLEAN => stringSet + protected $genericFilter = array( 2 => [FILTER_CR_NUMERIC, 'gearscore', NUM_CAST_INT ], // gearscore [num] 3 => [FILTER_CR_CALLBACK, 'cbAchievs', null, null], // achievementpoints [num] 5 => [FILTER_CR_NUMERIC, 'talenttree1', NUM_CAST_INT ], // talenttree1 [num] 6 => [FILTER_CR_NUMERIC, 'talenttree2', NUM_CAST_INT ], // talenttree2 [num] 7 => [FILTER_CR_NUMERIC, 'talenttree3', NUM_CAST_INT ], // talenttree3 [num] - 9 => [FILTER_CR_STRING, 'g.name', ], // guildname + 9 => [FILTER_CR_STRING, 'g.name' ], // guildname 10 => [FILTER_CR_CALLBACK, 'cbHasGuildRank', null, null], // guildrank - 12 => [FILTER_CR_CALLBACK, 'cbTeamName', null, null], // teamname2v2 - 15 => [FILTER_CR_CALLBACK, 'cbTeamName', null, null], // teamname3v3 - 18 => [FILTER_CR_CALLBACK, 'cbTeamName', null, null], // teamname5v5 - 13 => [FILTER_CR_CALLBACK, 'cbTeamRating', null, null], // teamrtng2v2 - 16 => [FILTER_CR_CALLBACK, 'cbTeamRating', null, null], // teamrtng3v3 - 19 => [FILTER_CR_CALLBACK, 'cbTeamRating', null, null], // teamrtng5v5 - 14 => [FILTER_CR_NYI_PH, 0 ], // teamcontrib2v2 [num] - 17 => [FILTER_CR_NYI_PH, 0 ], // teamcontrib3v3 [num] - 20 => [FILTER_CR_NYI_PH, 0 ], // teamcontrib5v5 [num] + 12 => [FILTER_CR_CALLBACK, 'cbTeamName', 2, null], // teamname2v2 + 15 => [FILTER_CR_CALLBACK, 'cbTeamName', 3, null], // teamname3v3 + 18 => [FILTER_CR_CALLBACK, 'cbTeamName', 5, null], // teamname5v5 + 13 => [FILTER_CR_CALLBACK, 'cbTeamRating', 2, null], // teamrtng2v2 + 16 => [FILTER_CR_CALLBACK, 'cbTeamRating', 3, null], // teamrtng3v3 + 19 => [FILTER_CR_CALLBACK, 'cbTeamRating', 5, null], // teamrtng5v5 + 14 => [FILTER_CR_NYI_PH, null, 0 /* 2 */ ], // teamcontrib2v2 [num] + 17 => [FILTER_CR_NYI_PH, null, 0 /* 3 */ ], // teamcontrib3v3 [num] + 20 => [FILTER_CR_NYI_PH, null, 0 /* 5 */ ], // teamcontrib5v5 [num] 21 => [FILTER_CR_CALLBACK, 'cbWearsItems', null, null], // wearingitem [str] 23 => [FILTER_CR_CALLBACK, 'cbCompletedAcv', null, null], // completedachievement 25 => [FILTER_CR_CALLBACK, 'cbProfession', SKILL_ALCHEMY, null], // alchemy [num] @@ -282,22 +273,20 @@ class ProfileListFilter extends Filter 36 => [FILTER_CR_CALLBACK, 'cbHasGuild', null, null] // hasguild [yn] ); - - // fieldId => [checkType, checkValue[, fieldIsArray]] protected $inputFields = array( - 'cr' => [FILTER_V_RANGE, [1, 36], true ], // criteria ids - 'crs' => [FILTER_V_LIST, [FILTER_ENUM_NONE, FILTER_ENUM_ANY, [0, 5000]], true ], // criteria operators - 'crv' => [FILTER_V_REGEX, '/[\p{C}:;%\\\\]/ui', true ], // criteria values - 'na' => [FILTER_V_REGEX, '/[\p{C};%\\\\]/ui', false], // name - only printable chars, no delimiter - 'ma' => [FILTER_V_EQUAL, 1, false], // match any / all filter - 'ex' => [FILTER_V_EQUAL, 'on', false], // only match exact - 'si' => [FILTER_V_LIST, [1, 2], false], // side - 'ra' => [FILTER_V_LIST, [[1, 8], 10, 11], true ], // race - 'cl' => [FILTER_V_LIST, [[1, 9], 11], true ], // class - 'minle' => [FILTER_V_RANGE, [1, MAX_LEVEL], false], // min level - 'maxle' => [FILTER_V_RANGE, [1, MAX_LEVEL], false], // max level - 'rg' => [FILTER_V_CALLBACK, 'cbRegionCheck', false], // region - 'sv' => [FILTER_V_CALLBACK, 'cbServerCheck', false], // server + 'cr' => [FILTER_V_RANGE, [1, 36], true ], // criteria ids + 'crs' => [FILTER_V_LIST, [FILTER_ENUM_NONE, FILTER_ENUM_ANY, [0, 5000]], true ], // criteria operators + 'crv' => [FILTER_V_REGEX, parent::PATTERN_CRV, true ], // criteria values + 'na' => [FILTER_V_REGEX, parent::PATTERN_NAME, false], // name - only printable chars, no delimiter + 'ma' => [FILTER_V_EQUAL, 1, false], // match any / all filter + 'ex' => [FILTER_V_EQUAL, 'on', false], // only match exact + 'si' => [FILTER_V_LIST, [1, 2], false], // side + 'ra' => [FILTER_V_LIST, [[1, 8], 10, 11], true ], // race + 'cl' => [FILTER_V_LIST, [[1, 9], 11], true ], // class + 'minle' => [FILTER_V_RANGE, [1, MAX_LEVEL], false], // min level + 'maxle' => [FILTER_V_RANGE, [1, MAX_LEVEL], false], // max level + 'rg' => [FILTER_V_CALLBACK, 'cbRegionCheck', false], // region + 'sv' => [FILTER_V_CALLBACK, 'cbServerCheck', false], // server ); /* heads up! @@ -490,20 +479,20 @@ class ProfileListFilter extends Filter return ['gm.rank', $cr[2], $cr[1]]; } - protected function cbTeamName($cr) + protected function cbTeamName($cr, $size) { if ($_ = $this->modularizeString(['at.name'], $cr[2])) - return ['AND', ['at.type', $this->enums[-1][$cr[0]]], $_]; + return ['AND', ['at.type', $size], $_]; return false; } - protected function cbTeamRating($cr) + protected function cbTeamRating($cr, $size) { if (!Util::checkNumeric($cr[2], NUM_CAST_INT) || !$this->int2Op($cr[1])) return false; - return ['AND', ['at.type', $this->enums[-1][$cr[0]]], ['at.rating', $cr[2], $cr[1]]]; + return ['AND', ['at.type', $size], ['at.rating', $cr[2], $cr[1]]]; } protected function cbAchievs($cr) diff --git a/includes/types/quest.class.php b/includes/types/quest.class.php index acda7080..d1af282e 100644 --- a/includes/types/quest.class.php +++ b/includes/types/quest.class.php @@ -425,10 +425,16 @@ class QuestList extends BaseType class QuestListFilter extends Filter { public $extraOpts = []; - protected $enums = array( // massive enums could be put here, if you want to restrict inputs further to be valid IDs instead of just integers - 37 => [null, 1, 2, 3, 4, 5, 6, 7, 8, 9, null, 11, true, false], - 38 => [null, 1, 2, 3, 4, 5, 6, 7, 8, null, 10, 11, true, false], + protected $enums = array( + 37 => parent::ENUM_CLASSS, // classspecific + 38 => parent::ENUM_RACE, // racespecific + 9 => parent::ENUM_FACTION, // objectiveearnrepwith + 33 => parent::ENUM_EVENT, // relatedevent + 43 => parent::ENUM_CURRENCY, // currencyrewarded + 1 => parent::ENUM_FACTION, // increasesrepwith + 10 => parent::ENUM_FACTION // decreasesrepwith ); + protected $genericFilter = array( 1 => [FILTER_CR_CALLBACK, 'cbReputation', '>', null], // increasesrepwith 2 => [FILTER_CR_NUMERIC, 'rewardXP', NUM_CAST_INT ], // experiencegained @@ -453,7 +459,7 @@ class QuestListFilter extends Filter 28 => [FILTER_CR_FLAG, 'flags', QUEST_FLAG_WEEKLY ], // weekly 29 => [FILTER_CR_CALLBACK, 'cbRepeatable', null ], // repeatable 30 => [FILTER_CR_NUMERIC, 'id', NUM_CAST_INT, true], // id - 33 => [FILTER_CR_ENUM, 'e.holidayId' ], // relatedevent + 33 => [FILTER_CR_ENUM, 'e.holidayId', true, true], // relatedevent 34 => [FILTER_CR_CALLBACK, 'cbAvailable', null, null], // availabletoplayers [yn] 36 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_VIDEO ], // hasvideos 37 => [FILTER_CR_CALLBACK, 'cbClassSpec', null, null], // classspecific [enum] @@ -464,12 +470,11 @@ class QuestListFilter extends Filter 45 => [FILTER_CR_BOOLEAN, 'rewardTitleId' ] // titlerewarded ); - // fieldId => [checkType, checkValue[, fieldIsArray]] protected $inputFields = array( 'cr' => [FILTER_V_RANGE, [1, 45], true ], // criteria ids 'crs' => [FILTER_V_LIST, [FILTER_ENUM_NONE, FILTER_ENUM_ANY, [0, 99999]], true ], // criteria operators - 'crv' => [FILTER_V_REGEX, '/\D/', true ], // criteria values - only numerals - 'na' => [FILTER_V_REGEX, '/[\p{C};%\\\\]/ui', false], // name / text - only printable chars, no delimiter + 'crv' => [FILTER_V_REGEX, parent::PATTERN_INT, true ], // criteria values - only numerals + 'na' => [FILTER_V_REGEX, parent::PATTERN_NAME, false], // name / text - only printable chars, no delimiter 'ex' => [FILTER_V_EQUAL, 'on', false], // also match subname 'ma' => [FILTER_V_EQUAL, 1, false], // match any / all filter 'minle' => [FILTER_V_RANGE, [1, 99], false], // min quest level @@ -560,7 +565,10 @@ class QuestListFilter extends Filter protected function cbReputation($cr, $sign) { - if (!Util::checkNumeric($cr[1], NUM_REQ_INT) || $cr[1] <= 0) + if (!Util::checkNumeric($cr[1], NUM_REQ_INT)) + return false; + + if (!in_array($cr[1], $this->enums[$cr[0]])) return false; if ($_ = DB::Aowow()->selectRow('SELECT * FROM ?_factions WHERE id = ?d', $cr[1])) @@ -593,7 +601,10 @@ class QuestListFilter extends Filter protected function cbCurrencyReward($cr) { - if (!Util::checkNumeric($cr[1], NUM_REQ_INT) || $cr[1] <= 0) + if (!Util::checkNumeric($cr[1], NUM_REQ_INT)) + return false; + + if (!in_array($cr[1], $this->enums[$cr[0]])) return false; return [ @@ -672,12 +683,12 @@ class QuestListFilter extends Filter if (!Util::checkNumeric($cr[1], NUM_REQ_INT)) return false; - if ($cr[1] > 0) - return ['OR', ['reqFactionId1', $cr[1]], ['reqFactionId2', $cr[1]]]; - else if ($cr[1] == FILTER_ENUM_ANY) // any + if ($cr[1] == FILTER_ENUM_ANY) // any return ['OR', ['reqFactionId1', 0, '>'], ['reqFactionId2', 0, '>']]; else if ($cr[1] == FILTER_ENUM_NONE) // none return ['AND', ['reqFactionId1', 0], ['reqFactionId2', 0]]; + else if (in_array($cr[1], $this->enums[$cr[0]])) + return ['OR', ['reqFactionId1', $cr[1]], ['reqFactionId2', $cr[1]]]; return false; } diff --git a/includes/types/sound.class.php b/includes/types/sound.class.php index 0b7d00cf..950d3c5a 100644 --- a/includes/types/sound.class.php +++ b/includes/types/sound.class.php @@ -96,9 +96,8 @@ class SoundList extends BaseType class SoundListFilter extends Filter { - // fieldId => [checkType, checkValue[, fieldIsArray]] protected $inputFields = array( - 'na' => [FILTER_V_REGEX, '/[\p{C};%\\\\]/ui', false], // name - only printable chars, no delimiter + 'na' => [FILTER_V_REGEX, parent::PATTERN_NAME, false], // name - only printable chars, no delimiter 'ty' => [FILTER_V_LIST, [[1, 4], 6, 9, 10, 12, 13, 14, 16, 17, [19, 23], [25, 31], 50, 52, 53], true ] // type ); diff --git a/includes/types/spell.class.php b/includes/types/spell.class.php index d29f2f0a..6f7905c1 100644 --- a/includes/types/spell.class.php +++ b/includes/types/spell.class.php @@ -2426,8 +2426,7 @@ class SpellListFilter extends Filter ) ); - // cr => [type, field, misc, extraCol] - protected $genericFilter = array( // misc (bool): _NUMERIC => useFloat; _STRING => localized; _FLAG => match Value; _BOOLEAN => stringSet + protected $genericFilter = array( 1 => [FILTER_CR_CALLBACK, 'cbCost', ], // costAbs [op] [int] 2 => [FILTER_CR_NUMERIC, 'powerCostPercent', NUM_CAST_INT ], // prcntbasemanarequired 3 => [FILTER_CR_BOOLEAN, 'spellFocusObject' ], // requiresnearbyobject @@ -2529,12 +2528,11 @@ class SpellListFilter extends Filter 116 => [FILTER_CR_BOOLEAN, 'startRecoveryTime' ] // onGlobalCooldown [yn] ); - // fieldId => [checkType, checkValue[, fieldIsArray]] protected $inputFields = array( 'cr' => [FILTER_V_RANGE, [1, 116], true ], // criteria ids 'crs' => [FILTER_V_LIST, [FILTER_ENUM_NONE, FILTER_ENUM_ANY, [0, 99999]], true ], // criteria operators - 'crv' => [FILTER_V_REGEX, '/[\p{C};:%\\\\]/ui', true ], // criteria values - only printable chars, no delimiters - 'na' => [FILTER_V_REGEX, '/[\p{C};%\\\\]/ui', false], // name / text - only printable chars, no delimiter + 'crv' => [FILTER_V_REGEX, parent::PATTERN_CRV, true ], // criteria values - only printable chars, no delimiters + 'na' => [FILTER_V_REGEX, parent::PATTERN_NAME, false], // name / text - only printable chars, no delimiter 'ex' => [FILTER_V_EQUAL, 'on', false], // extended name search 'ma' => [FILTER_V_EQUAL, 1, false], // match any / all filter 'minle' => [FILTER_V_RANGE, [1, 99], false], // spell level min @@ -2694,7 +2692,7 @@ class SpellListFilter extends Filter protected function cbAuraNames($cr) { - if (!Util::checkNumeric($cr[1], NUM_CAST_INT) || $cr[1] <= 0 || $cr[1] > self::MAX_SPELL_AURA) + if (!$this->checkInput(FILTER_V_RANGE, [1, self::MAX_SPELL_AURA], $cr[1])) return false; return ['OR', ['effect1AuraId', $cr[1]], ['effect2AuraId', $cr[1]], ['effect3AuraId', $cr[1]]]; @@ -2702,7 +2700,7 @@ class SpellListFilter extends Filter protected function cbEffectNames($cr) { - if (!Util::checkNumeric($cr[1], NUM_CAST_INT) || $cr[1] <= 0 || $cr[1] > self::MAX_SPELL_EFFECT) + if (!$this->checkInput(FILTER_V_RANGE, [1, self::MAX_SPELL_EFFECT], $cr[1])) return false; return ['OR', ['effect1Id', $cr[1]], ['effect2Id', $cr[1]], ['effect3Id', $cr[1]]]; diff --git a/static/js/locale_dede.js b/static/js/locale_dede.js index f0333879..12b69525 100644 --- a/static/js/locale_dede.js +++ b/static/js/locale_dede.js @@ -3645,7 +3645,7 @@ var LANG = { ], event: [ [424, "Angelwettstreit der Kalu'ak"], [301, "Anglerwettbewerb im Schlingendorntal"], [372, "Braufest"], [374, "Dunkelmond-Jahrmarkt"], - [321, "Erntedankfest"], [201, "Kinderwoche"], [335, "Liebe liegt in der Luft"], [327, "Mondfest"], [181, "Nobelgartenfest"], + [321, "Erntedankfest"], [201, "Kinderwoche"], [423, "Liebe liegt in der Luft"], [327, "Mondfest"], [181, "Nobelgartenfest"], [404, "Pilgerfreudenfest"], [398, "Piratentag"], [324, "Schlotternächte"], [341, "Sonnenwendfest"], [409, "Tag der Toten"], [141, "Winterhauchfest"], [283, "Zu den Waffen: Alteractal"], [285, "Zu den Waffen: Arathibecken"], [353, "Zu den Waffen: Auge des Sturms"],[420, "Zu den Waffen: Insel der Eroberung"], [284, "Zu den Waffen: Kriegshymnenschlucht"], [400, "Zu den Waffen: Strand der Uralten"] diff --git a/static/js/locale_enus.js b/static/js/locale_enus.js index bf81bafe..a6cc5434 100644 --- a/static/js/locale_enus.js +++ b/static/js/locale_enus.js @@ -3696,7 +3696,7 @@ var LANG = { [372, "Brewfest"], [283, "Call to Arms: Alterac Valley"], [285, "Call to Arms: Arathi Basin"], [353, "Call to Arms: Eye of the Storm"],[420, "Call to Arms: Isle of Conquest"], [400, "Call to Arms: Strand of the Ancients"], [284, "Call to Arms: Warsong Gulch"], [201, "Children's Week"], [374, "Darkmoon Faire"], [409, "Day of the Dead"], [141, "Feast of Winter Veil"], [324, "Hallow's End"], [321, "Harvest Festival"], [424, "Kalu'ak Fishing Derby"], - [335, "Love is in the Air"], [327, "Lunar Festival"], [341, "Midsummer Fire Festival"], [181, "Noblegarden"], [404, "Pilgrim's Bounty"], + [423, "Love is in the Air"], [327, "Lunar Festival"], [341, "Midsummer Fire Festival"], [181, "Noblegarden"], [404, "Pilgrim's Bounty"], [398, "Pirates' Day"], [301, "Stranglethorn Fishing Extravaganza"] ], pvp: [ [1, "Yes"], [3, "Arena"], [4, "Battleground"], [5, "World"], [2, "No"] ], diff --git a/static/js/locale_eses.js b/static/js/locale_eses.js index b3c0243b..235914bc 100644 --- a/static/js/locale_eses.js +++ b/static/js/locale_eses.js @@ -3645,7 +3645,7 @@ var LANG = { [4603, "La Cámara de Archavon"], [3456, "Naxxramas"], [4722, "Prueba del Cruzado"], [4273, "Ulduar"] ], event: [ - [335, "Amor en el aire"], [424, "Competición de pesca Kalu'ak"], [398, "Día de los Piratas"], [141, "El festín del Festival de Invierno"], + [423, "Amor en el aire"], [424, "Competición de pesca Kalu'ak"], [398, "Día de los Piratas"], [141, "El festín del Festival de Invierno"], [374, "Feria de la Luna Negra"], [327, "Festival Lunar"], [341, "Festival de Fuego del Solsticio de Verano"], [321, "Festival de la Cosecha"], [409, "Festividad de los Muertos"], [372, "Fiesta de la cerveza"], [404, "Generosidad del Peregrino"], [301, "Gran espectáculo de pesca de Tuercespina"], [324, "Halloween"], [181, "Jardín Noble"], [285, "Llamamiento a las armas: Cuenca de Arathi"], [284, "Llamamiento a las armas: Garganta Grito de Guerra"], diff --git a/static/js/locale_frfr.js b/static/js/locale_frfr.js index 0d6242fe..7ad58e7e 100644 --- a/static/js/locale_frfr.js +++ b/static/js/locale_frfr.js @@ -3647,7 +3647,7 @@ var LANG = { event: [ [285, "Appel aux armes : bassin d'Arathi"], [284, "Appel aux armes : goulet des Chanteguerres"], [400, "Appel aux armes : rivage des Anciens"], [283, "Appel aux armes : vallée d'Alterac"], [420, "Appel aux armes : île des Conquérants"], [353, "Appel aux armes : Œil du cyclone"], - [301, "Concours de pêche de Strangleronce"], [335, "De l'amour dans l'air"], [374, "Foire de Sombrelune"], [372, "Fête des Brasseurs"], + [301, "Concours de pêche de Strangleronce"], [423, "De l'amour dans l'air"], [374, "Foire de Sombrelune"], [372, "Fête des Brasseurs"], [321, "Fête des moissons"], [341, "Fête du Feu du solstice d'été"], [327, "Fête lunaire"], [409, "Jour des morts"], [398, "Jour des pirates"], [181, "Le Jardin des nobles"], [404, "Les Bienfaits du pèlerin"], [324, "Sanssaint"], [201, "Semaine des enfants"], [424, "Tournoi de pêche kalu'ak"], [141, "Voile d'hiver"] diff --git a/static/js/locale_ruru.js b/static/js/locale_ruru.js index bf26973a..4e3e9146 100644 --- a/static/js/locale_ruru.js +++ b/static/js/locale_ruru.js @@ -3647,7 +3647,7 @@ var LANG = { event: [ [409, "День мертвых"], [398, "День пирата"], [201, "Детская неделя"], [141, "Зимний Покров"], [283, "К оружию! Альтеракская долина"], [400, "К оружию! Берег Древних"], [285, "К оружию! Низина Арати"], [353, "К оружию! Око Бури"], [420, "К оружию! Остров Завоеваний"], [284, "К оружию! Ущелье Песни Войны"], - [424, "Калуакское рыбоборье"], [327, "Лунный фестиваль"], [335, "Любовная лихорадка"], [321, "Неделя урожая"], [341, "Огненный солнцеворот"], + [424, "Калуакское рыбоборье"], [327, "Лунный фестиваль"], [423, "Любовная лихорадка"], [321, "Неделя урожая"], [341, "Огненный солнцеворот"], [404, "Пиршество странников"], [301, "Рыбомания Тернистой долины"], [181, "Сад чудес"], [324, "Тыквовин"], [372, "Хмельной фестиваль"], [374, "Ярмарка Новолуния"] ], diff --git a/static/js/locale_zhcn.js b/static/js/locale_zhcn.js index e5f37443..234f09ad 100644 --- a/static/js/locale_zhcn.js +++ b/static/js/locale_zhcn.js @@ -3694,7 +3694,7 @@ var LANG = { event: [ [141, "冬幕节"], [181, "复活节"], [201, "儿童周"], [283, "战斗的召唤:奥特兰克山谷"], [284, "战斗的召唤:战歌峡谷"], [285, "战斗的召唤:阿拉希盆地"], [301, "荆棘谷钓鱼大赛"], [321, "收获节"], [324, "万圣节"], [327, "春节"], - [335, "情人节"], [341, "仲夏火焰节"], [353, "战斗的召唤:风暴之眼"], [372, "美酒节"], [374, "暗月马戏团"], + [423, "情人节"], [341, "仲夏火焰节"], [353, "战斗的召唤:风暴之眼"], [372, "美酒节"], [374, "暗月马戏团"], [398, "海盗日"], [400, "战斗的召唤:远古海滩"], [404, "感恩节"], [409, "悼念日"], [420, "战斗的召唤:征服之岛"], [424, "卡鲁亚克钓鱼大赛"] ],