mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
Page/Search
* dropped support of wildcard characters * search for literal usage of underscore
This commit is contained in:
@@ -1204,9 +1204,9 @@ abstract class Filter
|
||||
foreach ($parts as $p)
|
||||
{
|
||||
if ($p[0] == '-' && (mb_strlen($p) > 3 || $shortStr))
|
||||
$sub[] = [$f, sprintf($exPH, mb_substr($p, 1)), '!'];
|
||||
$sub[] = [$f, sprintf($exPH, str_replace('_', '\\_', mb_substr($p, 1))), '!'];
|
||||
else if ($p[0] != '-' && (mb_strlen($p) > 2 || $shortStr))
|
||||
$sub[] = [$f, sprintf($exPH, $p)];
|
||||
$sub[] = [$f, sprintf($exPH, str_replace('_', '\\_', $p))];
|
||||
}
|
||||
|
||||
// single cnd?
|
||||
|
||||
@@ -319,8 +319,8 @@ class AchievementListFilter extends Filter
|
||||
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, '/[\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
|
||||
'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
|
||||
|
||||
@@ -70,12 +70,12 @@ class AreaTriggerListFilter extends Filter
|
||||
|
||||
// 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_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
|
||||
);
|
||||
|
||||
protected function createSQLForCriterium(&$cr)
|
||||
|
||||
@@ -47,7 +47,7 @@ class ArenaTeamListFilter 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, '/[\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
|
||||
|
||||
@@ -335,8 +335,8 @@ class CreatureListFilter extends Filter
|
||||
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, '/[\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
|
||||
'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
|
||||
|
||||
@@ -307,12 +307,12 @@ class EnchantmentListFilter extends Filter
|
||||
|
||||
// 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_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
|
||||
);
|
||||
|
||||
protected function createSQLForCriterium(&$cr)
|
||||
|
||||
@@ -170,7 +170,7 @@ class GameObjectListFilter extends Filter
|
||||
'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
|
||||
'na' => [FILTER_V_REGEX, '/[\p{C};%\\\\]/ui', false], // name - only printable chars, no delimiter
|
||||
'ma' => [FILTER_V_EQUAL, 1, false] // match any / all filter
|
||||
);
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ class GuildListFilter 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, '/[\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
|
||||
|
||||
@@ -135,7 +135,7 @@ class IconListFilter extends 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_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
|
||||
'na' => [FILTER_V_REGEX, '/[\p{C};%\\\\]/ui', false], // name - only printable chars, no delimiter
|
||||
'ma' => [FILTER_V_EQUAL, 1, false] // match any / all filter
|
||||
);
|
||||
|
||||
|
||||
@@ -1948,10 +1948,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, '/[\p{C};:%\\\\]/ui', true ], // criteria values - only printable chars, no delimiters
|
||||
'upg' => [FILTER_V_RANGE, [1, 999999], true ], // 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, '/[\p{C};%\\\\]/ui', 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
|
||||
|
||||
@@ -186,8 +186,8 @@ class ItemsetListFilter extends Filter
|
||||
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, '/[\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
|
||||
'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
|
||||
|
||||
@@ -287,8 +287,8 @@ class ProfileListFilter extends Filter
|
||||
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
|
||||
'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
|
||||
|
||||
@@ -469,7 +469,7 @@ class QuestListFilter extends Filter
|
||||
'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
|
||||
'na' => [FILTER_V_REGEX, '/[\p{C};%\\\\]/ui', 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
|
||||
|
||||
@@ -105,7 +105,7 @@ 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, '/[\p{C};%\\\\]/ui', 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
|
||||
);
|
||||
|
||||
|
||||
@@ -2504,8 +2504,8 @@ class SpellListFilter extends Filter
|
||||
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, '/[\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
|
||||
'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
|
||||
|
||||
@@ -53,8 +53,8 @@ class SearchPage extends GenericPage
|
||||
|
||||
public function __construct($pageCall, $pageParam)
|
||||
{
|
||||
$this->search = trim(urlDecode($pageParam));
|
||||
$this->query = strtr($this->search, '?*', '_%');
|
||||
$this->search =
|
||||
$this->query = trim(urlDecode($pageParam));
|
||||
|
||||
// restricted access
|
||||
if ($this->reqUGroup && !User::isInGroup($this->reqUGroup))
|
||||
@@ -124,23 +124,25 @@ class SearchPage extends GenericPage
|
||||
if (!$this->query)
|
||||
return;
|
||||
|
||||
foreach (explode(' ', $this->query) as $p)
|
||||
foreach (explode(' ', $this->query) as $raw)
|
||||
{
|
||||
if (!$p) // multiple spaces
|
||||
$clean = str_replace(['\\', '%'], '', $raw);
|
||||
|
||||
if (!$clean) // multiple spaces
|
||||
continue;
|
||||
else if ($p[0] == '-')
|
||||
else if ($clean[0] == '-')
|
||||
{
|
||||
if (mb_strlen($p) < 4)
|
||||
$this->invalid[] = mb_substr($p, 1);
|
||||
if (mb_strlen($clean) < 4)
|
||||
$this->invalid[] = mb_substr($raw, 1);
|
||||
else
|
||||
$this->excluded[] = mb_substr($p, 1);
|
||||
$this->excluded[] = mb_substr(str_replace('_', '\\_', $clean), 1);
|
||||
}
|
||||
else if ($p !== '')
|
||||
else if ($clean !== '')
|
||||
{
|
||||
if (mb_strlen($p) < 3)
|
||||
$this->invalid[] = $p;
|
||||
if (mb_strlen($clean) < 3)
|
||||
$this->invalid[] = $raw;
|
||||
else
|
||||
$this->included[] = $p;
|
||||
$this->included[] = str_replace('_', '\\_', $clean);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2593,7 +2593,7 @@ var LANG = {
|
||||
user: "Benutzer",
|
||||
views: "Ansichten",
|
||||
userpage: "Benutzerseite",
|
||||
wins: "Siegt",
|
||||
wins: "Siege",
|
||||
when: "Wann",
|
||||
today: "heute",
|
||||
yes: "Ja",
|
||||
|
||||
Reference in New Issue
Block a user