ListPages/Filter

* vastly improved input validation
 * content and type validation occurs when filter is created
 * contextual filters like itemTypes are now only applied in context
This commit is contained in:
Sarjuuk
2017-04-16 00:14:33 +02:00
parent 178a67e180
commit 959d0ace0b
42 changed files with 2333 additions and 2043 deletions

View File

@@ -0,0 +1,96 @@
<?php
if (!defined('AOWOW_REVISION'))
die('illegal access');
class AjaxFilter extends AjaxHandler
{
public $doRedirect = true;
private $cat = [];
private $page = '';
private $filter = null;
public function __construct(array $params)
{
if (!$params)
return;
$p = explode('=', $params[0]);
$this->page = $p[0];
if (isset($p[1]))
$this->cat[] = $p[1];
if (count($params) > 1)
for ($i = 1; $i < count($params); $i++)
$this->cat[] = $params[$i];
$opts = ['parentCats' => $this->cat];
switch ($p[0])
{
case 'achievements':
$this->filter = (new AchievementListFilter(true, $opts));
break;
case 'enchantments':
$this->filter = (new EnchantmentListFilter(true, $opts));
break;
case 'icons':
$this->filter = (new IconListFilter(true, $opts));
break;
case 'items':
$this->filter = (new ItemListFilter(true, $opts));
break;
case 'itemsets':
$this->filter = (new ItemsetListFilter(true, $opts));
break;
case 'npcs':
$this->filter = (new CreatureListFilter(true, $opts));
break;
case 'objects':
$this->filter = (new GameObjectListFilter(true, $opts));
break;
case 'quests':
$this->filter = (new QuestListFilter(true, $opts));
break;
case 'sounds':
$this->filter = (new SoundListFilter(true, $opts));
break;
case 'spells':
$this->filter = (new SpellListFilter(true, $opts));
break;
default:
return;
}
parent::__construct($params);
// always this one
$this->handler = 'handleFilter';
}
protected function handleFilter()
{
$url = '?'.$this->page;
if ($this->cat)
$url .= '='.implode('.', $this->cat);
$fi = [];
if ($x = $this->filter->getFilterString())
$url .= '&filter='.$x;
if ($this->filter->error)
$_SESSION['fiError'] = get_class($this->filter);
if ($fi)
$url .= '&filter='.implode(';', $fi);
// do get request
return $url;
}
}

View File

@@ -754,16 +754,16 @@ trait spawnHelper
abstract class Filter abstract class Filter
{ {
private static $pattern = "/[\p{C}]/ui"; // delete unprintable characters private static $wCards = ['*' => '%', '?' => '_'];
private static $wCards = ['*' => '%', '?' => '_'];
private static $criteria = ['cr', 'crs', 'crv']; // [cr]iterium, [cr].[s]ign, [cr].[v]alue
public $error = false; // erronous search fields public $error = false; // erronous search fields
private $cndSet = []; private $cndSet = [];
protected $fiData = ['c' => [], 'v' =>[]]; protected $parentCats = []; // used to validate ty-filter
protected $formData = array( // data to fill form fields protected $inputFields = []; // list of input fields defined per page
protected $fiData = ['c' => [], 'v' =>[]];
protected $formData = array( // data to fill form fields
'form' => [], // base form - unsanitized 'form' => [], // base form - unsanitized
'setCriteria' => [], // dynamic criteria list - index checked 'setCriteria' => [], // dynamic criteria list - index checked
'setWeights' => [], // dynamic weights list - index checked 'setWeights' => [], // dynamic weights list - index checked
@@ -771,130 +771,24 @@ abstract class Filter
'reputationCols' => [] // simlar and exclusive to extraCols - added as required 'reputationCols' => [] // simlar and exclusive to extraCols - added as required
); );
// parse the provided request into a usable format; recall self with GET-params if nessecary // parse the provided request into a usable format
public function __construct() public function __construct($fromPOST = false, $opts = [])
{ {
// prefer POST over GET, translate to url if (!empty($opts['parentCats']))
if (!empty($_POST)) $this->parentCats = $opts['parentCats'];
if ($fromPOST)
$this->evaluatePOST();
else
{ {
foreach ($_POST as $k => $v) // an error occured, while processing POST
if (isset($_SESSION['fiError']))
{ {
if (is_array($v)) // array -> max depths:1 $this->error = $_SESSION['fiError'] == get_class($this);
{ unset($_SESSION['fiError']);
if (in_array($k, ['cr', 'wt']) && empty($v[0]))
continue;
$sub = [];
foreach ($v as $sk => $sv)
$sub[$sk] = Util::checkNumeric($sv) ? $sv : urlencode($sv);
if (!empty($sub) && in_array($k, self::$criteria))
$this->fiData['c'][$k] = $sub;
else if (!empty($sub))
$this->fiData['v'][$k] = $sub;
}
else // stings and integer
{
if (in_array($k, self::$criteria))
$this->fiData['c'][$k] = Util::checkNumeric($v) ? $v : urlencode($v);
else
$this->fiData['v'][$k] = Util::checkNumeric($v) ? $v : urlencode($v);
}
} }
// do get request $this->evaluateGET();
header('Location: '.HOST_URL.'?'.$_SERVER['QUERY_STRING'].'='.$this->urlize(), true, 302);
}
// sanitize input and build sql
else if (!empty($_GET['filter']))
{
$tmp = explode(';', $_GET['filter']);
$cr = $crs = $crv = [];
foreach (self::$criteria as $c)
{
foreach ($tmp as $i => $term)
{
if (strpos($term, $c.'=') === 0)
{
$$c = explode(':', explode('=', $term)[1]);
unset($tmp[$i]);
}
}
}
// handle erronous input
if (count($cr) != count($crv) || count($cr) != count($crs))
{
// use min provided criterion as basis
$min = min(count($cr), count($crv), count($crs));
if (count($cr) > $min)
array_splice($cr, $min);
if (count($crv) > $min)
array_splice($crv, $min);
if (count($crs) > $min)
array_splice($crs, $min);
$this->error = true;
}
foreach (self::$criteria as $c)
$this->formData['setCriteria'][$c] = $$c;
for ($i = 0; $i < count($cr); $i++)
{
if (!isset($cr[$i]) || !isset($crs[$i]) || !isset($crv[$i]) ||
!intVal($cr[$i]) || $crs[$i] === '' || $crv[$i] === '')
{
$this->error = true;
continue;
}
$this->sanitize($crv[$i]);
if ($crv[$i] !== '')
{
$this->fiData['c']['cr'][] = intVal($cr[$i]);
$this->fiData['c']['crs'][] = intVal($crs[$i]);
$this->fiData['c']['crv'][] = $crv[$i];
}
else
$this->error = true;
}
foreach ($tmp as $v)
{
if (!strstr($v, '='))
continue;
$w = explode('=', $v);
if (strstr($w[1], ':'))
{
$tmp2 = explode(':', $w[1]);
$this->formData['form'][$w[0]] = $tmp2;
array_walk($tmp2, function(&$v) {
$v = intVal($v);
});
$this->fiData['v'][$w[0]] = $tmp2;
}
else
{
$this->formData['form'][$w[0]] = $w[1];
$this->sanitize($w[1]);
if ($w[1] !== '')
$this->fiData['v'][$w[0]] = $w[1];
else
$this->error = true;
}
}
} }
} }
@@ -904,7 +798,25 @@ abstract class Filter
return ['formData']; return ['formData'];
} }
public function urlize(array $override = [], array $addCr = []) private function &criteriaIterator()
{
if (!$this->fiData['c'])
return;
for ($i = 0; $i < count($this->fiData['c']['cr']); $i++)
{
// throws a notice if yielded directly "Only variable references should be yielded by reference"
$v = [&$this->fiData['c']['cr'][$i], &$this->fiData['c']['crs'][$i], &$this->fiData['c']['crv'][$i]];
yield $i => $v;
}
}
/***********************/
/* get prepared values */
/***********************/
public function getFilterString(array $override = [], array $addCr = [])
{ {
$_ = []; $_ = [];
foreach (array_merge($this->fiData['c'], $this->fiData['v'], $override) as $k => $v) foreach (array_merge($this->fiData['c'], $this->fiData['v'], $override) as $k => $v)
@@ -932,79 +844,315 @@ abstract class Filter
return implode(';', $_); return implode(';', $_);
} }
// todo: kill data, that is unexpected or points to wrong indizes public function getExtraCols()
private function evaluateFilter()
{ {
// values return $this->formData['extraCols'];
$this->cndSet = $this->createSQLForValues();
// criteria
foreach ($this->criteriaIterator() as &$_cr)
$this->cndSet[] = $this->createSQLForCriterium($_cr);
if ($this->cndSet)
array_unshift($this->cndSet, empty($this->fiData['v']['ma']) ? 'AND' : 'OR');
} }
public function getForm($key = null, $raw = false) public function getSetCriteria()
{ {
$form = []; return $this->formData['setCriteria'];
}
if (!$this->formData) public function getSetWeights()
return $form; {
return $this->formData['setWeights'];
}
foreach ($this->formData as $name => $data) public function getReputationCols()
{ {
if (!$data || ($key && $name != $key)) return $this->formData['reputationCols'];
continue; }
switch ($name) public function getForm()
{ {
case 'setCriteria': return $this->formData['form'];
if ($data || $raw)
$form[$name] = $raw ? $data : 'fi_setCriteria('.Util::toJSON($data['cr']).', '.Util::toJSON($data['crs']).', '.Util::toJSON($data['crv']).');';
else
$form[$name] = 'fi_setCriteria([], [], []);';
break;
case 'extraCols':
$form[$name] = $raw ? $data : 'fi_extraCols = '.Util::toJSON(array_unique($data)).';';
break;
case 'setWeights':
$form[$name] = $raw ? $data : 'fi_setWeights('.Util::toJSON($data).', 0, 1, 1);';
break;
case 'form':
case 'reputationCols':
if ($key == $name) // only if explicitely specified
$form[$name] = $data;
break;
default:
break;
}
}
return $key ? (empty($form[$key]) ? [] : $form[$key]) : $form;
} }
public function getConditions() public function getConditions()
{ {
if (!$this->cndSet) if (!$this->cndSet)
$this->evaluateFilter(); {
// values
$this->cndSet = $this->createSQLForValues();
// criteria
foreach ($this->criteriaIterator() as &$_cr)
$this->cndSet[] = $this->createSQLForCriterium($_cr);
if ($this->cndSet)
array_unshift($this->cndSet, empty($this->fiData['v']['ma']) ? 'AND' : 'OR');
}
return $this->cndSet; return $this->cndSet;
} }
// santas little helper..
private function &criteriaIterator() /**********************/
/* input sanitization */
/**********************/
private function evaluatePOST()
{ {
if (!$this->fiData['c']) // doesn't need to set formData['form']; this happens in GET-step
foreach ($this->inputFields as $inp => list($type, $valid, $asArray))
{
if (!isset($_POST[$inp]) || $_POST[$inp] === '')
continue;
$val = $_POST[$inp];
$k = in_array($inp, ['cr', 'crs', 'crv']) ? 'c' : 'v';
if ($asArray)
{
$buff = [];
foreach ((array)$val as $v)
if ($v !== '' && $this->checkInput($type, $valid, $v))
$buff[] = $v;
if ($buff)
$this->fiData[$k][$inp] = $buff;
}
else if ($this->checkInput($type, $valid, $val))
$this->fiData[$k][$inp] = $val;
}
$this->setWeights();
$this->setCriteria();
}
private function evaluateGET()
{
if (empty($_GET['filter']))
return; return;
for ($i = 0; $i < count($this->fiData['c']['cr']); $i++) // squash into usable format
$post = [];
foreach (explode(';', $_GET['filter']) as $f)
{ {
// throws a notice if yielded directly "Only variable references should be yielded by reference" if (!strstr($f, '='))
$v = [&$this->fiData['c']['cr'][$i], &$this->fiData['c']['crs'][$i], &$this->fiData['c']['crv'][$i]]; {
yield $i => $v; $this->error = true;
continue;
}
$_ = explode('=', $f);
$post[$_[0]] = $_[1];
} }
$cr = $crs = $crv = [];
foreach ($this->inputFields as $inp => list($type, $valid, $asArray))
{
if (!isset($post[$inp]) || $post[$inp] === '')
continue;
$val = $post[$inp];
$k = in_array($inp, ['cr', 'crs', 'crv']) ? 'c' : 'v';
if ($asArray)
{
$buff = [];
foreach (explode(':', $val) as $v)
if ($v !== '' && $this->checkInput($type, $valid, $v))
$buff[] = $v;
if ($buff)
{
if ($k == 'v')
$this->formData['form'][$inp] = $buff;
$this->fiData[$k][$inp] = array_map(function ($x) { return strtr($x, Filter::$wCards); }, $buff);
}
}
else if ($this->checkInput($type, $valid, $val))
{
if ($k == 'v')
$this->formData['form'][$inp] = $val;
$this->fiData[$k][$inp] = strtr($val, Filter::$wCards);
}
}
$this->setWeights();
$this->setCriteria();
}
private function setCriteria() // [cr]iterium, [cr].[s]ign, [cr].[v]alue
{
if (empty($this->fiData['c']['cr']) && empty($this->fiData['c']['crs']) && empty($this->fiData['c']['crv']))
return;
else if (empty($this->fiData['c']['cr']) || empty($this->fiData['c']['crs']) || empty($this->fiData['c']['crv']))
{
unset($this->fiData['c']['cr']);
unset($this->fiData['c']['crs']);
unset($this->fiData['c']['crv']);
$this->error = true;
return;
}
$_cr = &$this->fiData['c']['cr'];
$_crs = &$this->fiData['c']['crs'];
$_crv = &$this->fiData['c']['crv'];
if (count($_cr) != count($_crv) || count($_cr) != count($_crs))
{
// use min provided criterion as basis
$min = min(count($_cr), count($_crv), count($_crs));
if (count($_cr) > $min)
array_splice($_cr, $min);
if (count($_crv) > $min)
array_splice($_crv, $min);
if (count($_crs) > $min)
array_splice($_crs, $min);
$this->error = true;
}
for ($i = 0; $i < count($_cr); $i++)
{
// conduct filter specific checks & casts here
$unsetme = false;
if (isset($this->genericFilter[$_cr[$i]]))
{
$gf = $this->genericFilter[$_cr[$i]];
switch ($gf[0])
{
case FILTER_CR_NUMERIC:
$_ = $_crs[$i];
if (!Util::checkNumeric($_crv[$i], $gf[2]) || !$this->int2Op($_))
$unsetme = true;
break;
case FILTER_CR_BOOLEAN:
case FILTER_CR_FLAG:
case FILTER_CR_STAFFFLAG:
$_ = $_crs[$i];
if (!$this->int2Bool($_))
$unsetme = true;
break;
case FILTER_CR_ENUM:
if (!Util::checkNumeric($_crs[$i], NUM_REQ_INT))
$unsetme = true;
break;
}
}
if (!$unsetme && intval($_cr[$i]) && $_crs[$i] !== '' && $_crv[$i] !== '')
continue;
unset($_cr[$i]);
unset($_crs[$i]);
unset($_crv[$i]);
$this->error = true;
}
$this->formData['setCriteria'] = array(
'cr' => $_cr,
'crs' => $_crs,
'crv' => $_crv
);
}
private function setWeights()
{
if (empty($this->fiData['v']['wt']) && empty($this->fiData['v']['wtv']))
return;
$_wt = &$this->fiData['v']['wt'];
$_wtv = &$this->fiData['v']['wtv'];
if (empty($_wt) && !empty($_wtv))
{
unset($_wtv);
$this->error = true;
return;
}
if (empty($_wtv) && !empty($_wt))
{
unset($_wt);
$this->error = true;
return;
}
$nwt = count($_wt);
$nwtv = count($_wtv);
if ($nwt > $nwtv)
{
array_splice($_wt, $nwtv);
$this->error = true;
}
else if ($nwtv > $nwt)
{
array_splice($_wtv, $nwt);
$this->error = true;
}
$this->formData['setWeights'] = [$_wt, $_wtv];
}
protected function checkInput($type, $valid, &$val, $recursive = false)
{
switch ($type)
{
case FILTER_V_EQUAL:
if (gettype($valid) == 'integer')
$val = intval($val);
else if (gettype($valid) == 'double')
$val = floatval($val);
else /* if (gettype($valid) == 'string') */
$var = strval($val);
if ($valid == $val)
return true;
break;
case FILTER_V_LIST:
if (!Util::checkNumeric($val, NUM_CAST_INT))
return false;
foreach ($valid as $k => $v)
{
if (gettype($v) != 'array')
continue;
if ($this->checkInput(FILTER_V_RANGE, $v, $val, true))
return true;
unset($valid[$k]);
}
if (in_array($val, $valid))
return true;
break;
case FILTER_V_RANGE:
if (Util::checkNumeric($val, NUM_CAST_INT) && $val >= $valid[0] && $val <= $valid[1])
return true;
break;
case FILTER_V_CALLBACK:
if ($this->$valid($val))
return true;
break;
case FILTER_V_REGEX:
if (!preg_match($valid, $val))
return true;
break;
}
if (!$recursive)
$this->error = true;
return false;
} }
protected function modularizeString(array $fields, $string = '', $exact = false) protected function modularizeString(array $fields, $string = '', $exact = false)
@@ -1072,36 +1220,22 @@ abstract class Filter
} }
} }
protected function list2Mask($list, $noOffset = false) protected function list2Mask(array $list, $noOffset = false)
{ {
$mask = 0x0; $mask = 0x0;
$o = $noOffset ? 0 : 1; // schoolMask requires this..? $o = $noOffset ? 0 : 1; // schoolMask requires this..?
if (!is_array($list)) foreach ($list as $itm)
$mask = (1 << (intVal($list) - $o)); $mask += (1 << (intval($itm) - $o));
else
foreach ($list as $itm)
$mask += (1 << (intVal($itm) - $o));
return $mask; return $mask;
} }
protected function isSaneNumeric(&$val, $castInt = true)
{
if ($castInt && is_float($val))
$val = intVal($val);
if (is_int($val) || (is_float($val) && $val >= 0.0)) /**************************/
return true; /* create conditions from */
/* generic criteria */
return false; /**************************/
}
private function sanitize(&$str)
{
$str = preg_replace(Filter::$pattern, '', trim($str));
$str = Util::checkNumeric($str) ? $str : strtr($str, Filter::$wCards);
}
private function genericBoolean($field, $op, $isString) private function genericBoolean($field, $op, $isString)
{ {
@@ -1134,7 +1268,7 @@ abstract class Filter
private function genericNumeric($field, &$value, $op, $castInt) private function genericNumeric($field, &$value, $op, $castInt)
{ {
if (!$this->isSaneNumeric($value, $castInt)) if (!Util::checkNumeric($value, $castInt))
return null; return null;
if ($this->int2Op($op)) if ($this->int2Op($op))
@@ -1165,7 +1299,7 @@ abstract class Filter
switch ($gen[0]) switch ($gen[0])
{ {
case FILTER_CR_NUMERIC: case FILTER_CR_NUMERIC:
$result = $this->genericNumeric($gen[1], $cr[2], $cr[1], empty($gen[2])); $result = $this->genericNumeric($gen[1], $cr[2], $cr[1], $gen[2]);
break; break;
case FILTER_CR_FLAG: case FILTER_CR_FLAG:
$result = $this->genericBooleanFlags($gen[1], $gen[2], $cr[1]); $result = $this->genericBooleanFlags($gen[1], $gen[2], $cr[1]);
@@ -1183,17 +1317,40 @@ abstract class Filter
case FILTER_CR_ENUM: case FILTER_CR_ENUM:
if (isset($this->enums[$cr[0]][$cr[1]])) if (isset($this->enums[$cr[0]][$cr[1]]))
$result = $this->genericEnum($gen[1], $this->enums[$cr[0]][$cr[1]]); $result = $this->genericEnum($gen[1], $this->enums[$cr[0]][$cr[1]]);
else if (intVal($cr[1]) != 0) else if (intval($cr[1]) != 0)
$result = $this->genericEnum($gen[1], intVal($cr[1])); $result = $this->genericEnum($gen[1], intval($cr[1]));
break; break;
case FILTER_CR_CALLBACK:
$result = $this->{$gen[1]}($cr, $gen[2], $gen[3]);
break;
case FILTER_CR_NYI_PH: // do not limit with not implemented filters
if (is_int($gen[2]))
return [$gen[2]];
// for nonsensical values; compare against 0
if ($this->int2Op($cr[1]) && Util::checkNumeric($cr[2]))
{
if ($cr[1] == '=')
$cr[1] = '==';
return eval('return ('.$cr[2].' '.$cr[1].' 0);') ? [1] : [0];
}
else
return [0];
} }
if ($result && !empty($gen[3])) if ($result && $gen[0] == FILTER_CR_NUMERIC && !empty($gen[3]))
$this->formData['extraCols'][] = $cr[0]; $this->formData['extraCols'][] = $cr[0];
return $result; return $result;
} }
/***********************************/
/* create conditions from */
/* non-generic values and criteria */
/***********************************/
abstract protected function createSQLForCriterium(&$cr); abstract protected function createSQLForCriterium(&$cr);
abstract protected function createSQLForValues(); abstract protected function createSQLForValues();
} }

View File

@@ -7,6 +7,8 @@ if (!defined('AOWOW_REVISION'))
* Page * Page
*/ */
define('E_AOWOW', E_ALL & ~(E_DEPRECATED | E_USER_DEPRECATED | E_STRICT));
// TypeIds // TypeIds
define('TYPE_NPC', 1); define('TYPE_NPC', 1);
define('TYPE_OBJECT', 2); define('TYPE_OBJECT', 2);
@@ -171,6 +173,13 @@ define('FILTER_CR_NUMERIC', 3);
define('FILTER_CR_STRING', 4); define('FILTER_CR_STRING', 4);
define('FILTER_CR_ENUM', 5); define('FILTER_CR_ENUM', 5);
define('FILTER_CR_STAFFFLAG', 6); define('FILTER_CR_STAFFFLAG', 6);
define('FILTER_CR_CALLBACK', 7);
define('FILTER_CR_NYI_PH', 999);
define('FILTER_V_EQUAL', 8);
define('FILTER_V_RANGE', 9);
define('FILTER_V_LIST', 10);
define('FILTER_V_CALLBACK', 11);
define('FILTER_V_REGEX', 12);
define('FILTER_ENUM_ANY', -2323); define('FILTER_ENUM_ANY', -2323);
define('FILTER_ENUM_NONE', -2324); define('FILTER_ENUM_NONE', -2324);
@@ -214,6 +223,12 @@ define('CONTRIBUTE_SS', 0x2);
define('CONTRIBUTE_VI', 0x4); define('CONTRIBUTE_VI', 0x4);
define('CONTRIBUTE_ANY', CONTRIBUTE_CO | CONTRIBUTE_SS | CONTRIBUTE_VI); define('CONTRIBUTE_ANY', CONTRIBUTE_CO | CONTRIBUTE_SS | CONTRIBUTE_VI);
define('NUM_ANY', 0);
define('NUM_CAST_INT', 1);
define('NUM_CAST_FLOAT', 2);
define('NUM_REQ_INT', 3);
define('NUM_REQ_FLOAT', 4);
/* /*
* Game * Game
*/ */

View File

@@ -26,7 +26,7 @@ require_once 'pages/genericPage.class.php';
// autoload List-classes, associated filters and pages // autoload List-classes, associated filters and pages
spl_autoload_register(function ($class) { spl_autoload_register(function ($class) {
$class = strtolower(str_replace('Filter', '', $class)); $class = strtolower(str_replace('ListFilter', 'List', $class));
if (class_exists($class)) // already registered if (class_exists($class)) // already registered
return; return;
@@ -117,7 +117,7 @@ foreach ($sets as $k => $v)
// handle non-fatal errors and notices // handle non-fatal errors and notices
error_reporting(!empty($AoWoWconf['aowow']) && CFG_DEBUG ? (E_ALL & ~(E_DEPRECATED | E_USER_DEPRECATED | E_STRICT)) : 0); error_reporting(!empty($AoWoWconf['aowow']) && CFG_DEBUG ? E_AOWOW : 0);
set_error_handler(function($errNo, $errStr, $errFile, $errLine) set_error_handler(function($errNo, $errStr, $errFile, $errLine)
{ {
$errName = 'unknown error'; // errors not in this list can not be handled by set_error_handler (as per documentation) or are ignored $errName = 'unknown error'; // errors not in this list can not be handled by set_error_handler (as per documentation) or are ignored
@@ -149,7 +149,7 @@ set_error_handler(function($errNo, $errStr, $errFile, $errLine)
); );
return true; return true;
}, E_ALL & ~(E_DEPRECATED | E_USER_DEPRECATED | E_STRICT)); }, E_AOWOW);
// handle exceptions // handle exceptions
set_exception_handler(function ($ex) set_exception_handler(function ($ex)

View File

@@ -1,6 +1,6 @@
<?php <?php
define('AOWOW_REVISION', 25); define('AOWOW_REVISION', 26);
define('CLI', PHP_SAPI === 'cli'); define('CLI', PHP_SAPI === 'cli');

View File

@@ -281,62 +281,42 @@ class AchievementListFilter extends Filter
321 => -1, 424 => -1, 301 => -1 321 => -1, 424 => -1, 301 => -1
) )
); );
protected $genericFilter = array( // misc (bool): _NUMERIC => useFloat; _STRING => localized; _FLAG => match Value; _BOOLEAN => stringSet protected $genericFilter = array( // misc (bool): _NUMERIC => useFloat; _STRING => localized; _FLAG => match Value; _BOOLEAN => stringSet
2 => [FILTER_CR_BOOLEAN, 'reward_loc0', true ], // givesreward 2 => [FILTER_CR_BOOLEAN, 'reward_loc0', true ], // givesreward
3 => [FILTER_CR_STRING, 'reward', true ], // rewardtext 3 => [FILTER_CR_STRING, 'reward', true ], // rewardtext
7 => [FILTER_CR_BOOLEAN, 'chainId', ], // partseries 4 => [FILTER_CR_NYI_PH, null, 1, ], // location [enum]
9 => [FILTER_CR_NUMERIC, 'id', null, true], // id 5 => [FILTER_CR_CALLBACK, 'cbSeries', ACHIEVEMENT_CU_FIRST_SERIES, null], // first in series [yn]
10 => [FILTER_CR_STRING, 'ic.name', ], // icon 6 => [FILTER_CR_CALLBACK, 'cbSeries', ACHIEVEMENT_CU_LAST_SERIES, null], // last in series [yn]
18 => [FILTER_CR_STAFFFLAG, 'flags', ], // flags 7 => [FILTER_CR_BOOLEAN, 'chainId', ], // partseries
14 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_COMMENT ], // hascomments 9 => [FILTER_CR_NUMERIC, 'id', NUM_CAST_INT, true], // id
15 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_SCREENSHOT ], // hasscreenshots 10 => [FILTER_CR_STRING, 'ic.name', ], // icon
16 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_VIDEO ], // hasvideos 11 => [FILTER_CR_CALLBACK, 'cbRelEvent', null, null], // related event [enum]
14 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_COMMENT ], // hascomments
15 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_SCREENSHOT ], // hasscreenshots
16 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_VIDEO ], // hasvideos
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
'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
'minpt' => [FILTER_V_RANGE, [1, 99], false], // required level min
'maxpt' => [FILTER_V_RANGE, [1, 99], false] // required level max
); );
protected function createSQLForCriterium(&$cr) protected function createSQLForCriterium(&$cr)
{ {
if (in_array($cr[0], array_keys($this->genericFilter))) if (in_array($cr[0], array_keys($this->genericFilter)))
{
if ($genCr = $this->genericCriterion($cr)) if ($genCr = $this->genericCriterion($cr))
return $genCr; return $genCr;
unset($cr);
$this->error = true;
return [1];
}
switch ($cr[0])
{
case 4: // location [enum]
/* todo */ return [1]; // no plausible locations parsed yet
case 5: // first in series [yn]
if ($this->int2Bool($cr[1]))
return $cr[1] ? ['AND', ['chainId', 0, '!'], ['cuFlags', ACHIEVEMENT_CU_FIRST_SERIES, '&']] : ['AND', ['chainId', 0, '!'], [['cuFlags', ACHIEVEMENT_CU_FIRST_SERIES, '&'], 0]];
break;
case 6: // last in series [yn]
if ($this->int2Bool($cr[1]))
return $cr[1] ? ['AND', ['chainId', 0, '!'], ['cuFlags', ACHIEVEMENT_CU_LAST_SERIES, '&']] : ['AND', ['chainId', 0, '!'], [['cuFlags', ACHIEVEMENT_CU_LAST_SERIES, '&'], 0]];
break;
case 11: // Related Event [enum]
$_ = isset($this->enums[$cr[0]][$cr[1]]) ? $this->enums[$cr[0]][$cr[1]] : null;
if ($_ !== null)
{
if (is_int($_))
return ($_ > 0) ? ['category', $_] : ['id', abs($_)];
else
{
$ids = array_filter($this->enums[$cr[0]], function($x) {
return is_int($x) && $x > 0;
});
return ['category', $ids, $_ ? null : '!'];
}
}
break;
}
unset($cr); unset($cr);
$this->error = true; $this->error = true;
return [1]; return [1];
@@ -362,45 +342,57 @@ class AchievementListFilter extends Filter
// points min // points min
if (isset($_v['minpt'])) if (isset($_v['minpt']))
{ $parts[] = ['points', $_v['minpt'], '>='];
if ($this->isSaneNumeric($_v['minpt']))
$parts[] = ['points', $_v['minpt'], '>='];
else
unset($_v['minpt']);
}
// points max // points max
if (isset($_v['maxpt'])) if (isset($_v['maxpt']))
{ $parts[] = ['points', $_v['maxpt'], '<='];
if ($this->isSaneNumeric($_v['maxpt']))
$parts[] = ['points', $_v['maxpt'], '<='];
else
unset($_v['maxpt']);
}
// faction (side) // faction (side)
if (isset($_v['si'])) if (isset($_v['si']))
{ {
switch ($_v['si']) switch ($_v['si'])
{ {
case 3: // both
$parts[] = ['faction', 0];
break;
case -1: // faction, exclusive both case -1: // faction, exclusive both
case -2: case -2:
$parts[] = ['faction', -$_v['si']]; $parts[] = ['faction', -$_v['si']];
break; break;
case 1: // faction, inclusive both case 1: // faction, inclusive both
case 2: case 2:
$parts[] = ['OR', ['faction', 0], ['faction', $_v['si']]]; case 3: // both
$parts[] = ['faction', $_v['si'], '&'];
break; break;
default:
unset($_v['si']);
} }
} }
return $parts; return $parts;
} }
protected function cbRelEvent($cr, $value)
{
if (!isset($this->enums[$cr[0]][$cr[1]]))
return false;
$_ = $this->enums[$cr[0]][$cr[1]];
if (is_int($_))
return ($_ > 0) ? ['category', $_] : ['id', abs($_)];
else
{
$ids = array_filter($this->enums[$cr[0]], function($x) { return is_int($x) && $x > 0; });
return ['category', $ids, $_ ? null : '!'];
}
return false;
}
protected function cbSeries($cr, $value)
{
if ($this->int2Bool($cr[1]))
return $cr[1] ? ['AND', ['chainId', 0, '!'], ['cuFlags', $value, '&']] : ['AND', ['chainId', 0, '!'], [['cuFlags', $value, '&'], 0]];
return false;
}
} }
?> ?>

View File

@@ -169,7 +169,7 @@ class CreatureList extends BaseType
$data = []; $data = [];
$rewRep = []; $rewRep = [];
if ($addInfoMask & NPCINFO_REP) if ($addInfoMask & NPCINFO_REP && $this->getFoundIDs())
{ {
$rewRep = DB::World()->selectCol(' $rewRep = DB::World()->selectCol('
SELECT creature_id AS ARRAY_KEY, RewOnKillRepFaction1 AS ARRAY_KEY2, RewOnKillRepValue1 FROM creature_onkill_reputation WHERE creature_id IN (?a) AND RewOnKillRepFaction1 > 0 UNION SELECT creature_id AS ARRAY_KEY, RewOnKillRepFaction1 AS ARRAY_KEY2, RewOnKillRepValue1 FROM creature_onkill_reputation WHERE creature_id IN (?a) AND RewOnKillRepFaction1 > 0 UNION
@@ -179,6 +179,7 @@ class CreatureList extends BaseType
); );
} }
foreach ($this->iterate() as $__) foreach ($this->iterate() as $__)
{ {
if ($addInfoMask & NPCINFO_MODEL) if ($addInfoMask & NPCINFO_MODEL)
@@ -221,6 +222,7 @@ class CreatureList extends BaseType
'react' => [$this->curTpl['A'], $this->curTpl['H']], 'react' => [$this->curTpl['A'], $this->curTpl['H']],
); );
if ($this->getField('startsQuests')) if ($this->getField('startsQuests'))
$data[$this->id]['hasQuests'] = 1; $data[$this->id]['hasQuests'] = 1;
@@ -275,6 +277,7 @@ class CreatureList extends BaseType
public function addRewardsToJScript(&$refs) { } public function addRewardsToJScript(&$refs) { }
} }
@@ -290,234 +293,66 @@ class CreatureListFilter extends Filter
// cr => [type, field, misc, extraCol] // cr => [type, field, misc, extraCol]
protected $genericFilter = array( // misc (bool): _NUMERIC => useFloat; _STRING => localized; _FLAG => match Value; _BOOLEAN => stringSet protected $genericFilter = array( // misc (bool): _NUMERIC => useFloat; _STRING => localized; _FLAG => match Value; _BOOLEAN => stringSet
5 => [FILTER_CR_FLAG, 'npcflag', NPC_FLAG_REPAIRER ], // canrepair 1 => [FILTER_CR_CALLBACK, 'cbHealthMana', 'healthMax', 'healthMin'], // health [num]
6 => [FILTER_CR_ENUM, 's.areaId', null ], // foundin 2 => [FILTER_CR_CALLBACK, 'cbHealthMana', 'manaMin', 'manaMax' ], // mana [num]
9 => [FILTER_CR_BOOLEAN, 'lootId', ], // lootable 3 => [FILTER_CR_CALLBACK, 'cbFaction', null, null ], // faction [enum]
11 => [FILTER_CR_BOOLEAN, 'pickpocketLootId', ], // pickpocketable 5 => [FILTER_CR_FLAG, 'npcflag', NPC_FLAG_REPAIRER ], // canrepair
18 => [FILTER_CR_FLAG, 'npcflag', NPC_FLAG_AUCTIONEER ], // auctioneer 6 => [FILTER_CR_ENUM, 's.areaId', null ], // foundin
19 => [FILTER_CR_FLAG, 'npcflag', NPC_FLAG_BANKER ], // banker 7 => [FILTER_CR_CALLBACK, 'cbQuestRelation', 'startsQuests', 0x1 ], // startsquest [enum]
20 => [FILTER_CR_FLAG, 'npcflag', NPC_FLAG_BATTLEMASTER ], // battlemaster 8 => [FILTER_CR_CALLBACK, 'cbQuestRelation', 'endsQuests', 0x2 ], // endsquest [enum]
21 => [FILTER_CR_FLAG, 'npcflag', NPC_FLAG_FLIGHT_MASTER ], // flightmaster 9 => [FILTER_CR_BOOLEAN, 'lootId', ], // lootable
22 => [FILTER_CR_FLAG, 'npcflag', NPC_FLAG_GUILD_MASTER ], // guildmaster 10 => [FILTER_CR_BOOLEAN, 'cbRegularSkinLoot', NPC_TYPEFLAG_SPECIALLOOT ], // skinnable [yn]
23 => [FILTER_CR_FLAG, 'npcflag', NPC_FLAG_INNKEEPER ], // innkeeper 11 => [FILTER_CR_BOOLEAN, 'pickpocketLootId', ], // pickpocketable
24 => [FILTER_CR_FLAG, 'npcflag', NPC_FLAG_CLASS_TRAINER ], // talentunlearner 12 => [FILTER_CR_CALLBACK, 'cbMoneyDrop', null, null ], // averagemoneydropped [op] [int]
25 => [FILTER_CR_FLAG, 'npcflag', NPC_FLAG_GUILD_MASTER ], // tabardvendor 15 => [FILTER_CR_CALLBACK, 'cbSpecialSkinLoot', NPC_TYPEFLAG_HERBLOOT, null ], // gatherable [yn]
27 => [FILTER_CR_FLAG, 'npcflag', NPC_FLAG_STABLE_MASTER ], // stablemaster 16 => [FILTER_CR_CALLBACK, 'cbSpecialSkinLoot', NPC_TYPEFLAG_ENGINEERLOOT, null ], // minable [yn]
28 => [FILTER_CR_FLAG, 'npcflag', NPC_FLAG_TRAINER ], // trainer 18 => [FILTER_CR_FLAG, 'npcflag', NPC_FLAG_AUCTIONEER ], // auctioneer
29 => [FILTER_CR_FLAG, 'npcflag', NPC_FLAG_VENDOR ], // vendor 19 => [FILTER_CR_FLAG, 'npcflag', NPC_FLAG_BANKER ], // banker
19 => [FILTER_CR_FLAG, 'npcflag', NPC_FLAG_BANKER ], // banker 20 => [FILTER_CR_FLAG, 'npcflag', NPC_FLAG_BATTLEMASTER ], // battlemaster
37 => [FILTER_CR_NUMERIC, 'id', null, true], // id 21 => [FILTER_CR_FLAG, 'npcflag', NPC_FLAG_FLIGHT_MASTER ], // flightmaster
35 => [FILTER_CR_STRING, 'textureString' ], // useskin 22 => [FILTER_CR_FLAG, 'npcflag', NPC_FLAG_GUILD_MASTER ], // guildmaster
32 => [FILTER_CR_FLAG, 'cuFlags', NPC_CU_INSTANCE_BOSS ], // instanceboss 23 => [FILTER_CR_FLAG, 'npcflag', NPC_FLAG_INNKEEPER ], // innkeeper
33 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_COMMENT ], // hascomments 24 => [FILTER_CR_FLAG, 'npcflag', NPC_FLAG_CLASS_TRAINER ], // talentunlearner
31 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_SCREENSHOT ], // hasscreenshots 25 => [FILTER_CR_FLAG, 'npcflag', NPC_FLAG_GUILD_MASTER ], // tabardvendor
40 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_VIDEO ], // hasvideos 27 => [FILTER_CR_FLAG, 'npcflag', NPC_FLAG_STABLE_MASTER ], // stablemaster
28 => [FILTER_CR_FLAG, 'npcflag', NPC_FLAG_TRAINER ], // trainer
29 => [FILTER_CR_FLAG, 'npcflag', NPC_FLAG_VENDOR ], // vendor
31 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_SCREENSHOT ], // hasscreenshots
32 => [FILTER_CR_FLAG, 'cuFlags', NPC_CU_INSTANCE_BOSS ], // instanceboss
33 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_COMMENT ], // hascomments
34 => [FILTER_CR_NYI_PH, 1, null ], // usemodel [str] - displayId -> id:creatureDisplayInfo.dbc/model -> id:cratureModelData.dbc/modelPath
35 => [FILTER_CR_STRING, 'textureString' ], // useskin
37 => [FILTER_CR_NUMERIC, 'id', NUM_CAST_INT, true ], // id
38 => [FILTER_CR_CALLBACK, 'cbRelEvent', null, null ], // relatedevent [enum]
40 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_VIDEO ], // hasvideos
41 => [FILTER_CR_NYI_PH, 1, null ], // haslocation [yn] [staff]
42 => [FILTER_CR_CALLBACK, 'cbReputation', '>', null ], // increasesrepwith [enum]
43 => [FILTER_CR_CALLBACK, 'cbReputation', '<', null ], // decreasesrepwith [enum]
44 => [FILTER_CR_CALLBACK, 'cbSpecialSkinLoot', NPC_TYPEFLAG_MININGLOOT, 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
'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
'minle' => [FILTER_V_RANGE, [1, 99], false], // min level [int]
'maxle' => [FILTER_V_RANGE, [1, 99], false], // max level [int]
'cl' => [FILTER_V_RANGE, [0, 4], true ], // classification [list]
'ra' => [FILTER_V_LIST, [-1, 0, 1], false], // react alliance [int]
'rh' => [FILTER_V_LIST, [-1, 0, 1], false] // react horde [int]
); );
protected function createSQLForCriterium(&$cr) protected function createSQLForCriterium(&$cr)
{ {
if (in_array($cr[0], array_keys($this->genericFilter))) if (in_array($cr[0], array_keys($this->genericFilter)))
{
if ($genCr = $this->genericCriterion($cr)) if ($genCr = $this->genericCriterion($cr))
return $genCr; return $genCr;
unset($cr);
$this->error = true;
return [1];
}
switch ($cr[0])
{
case 1: // health [num]
if (!$this->isSaneNumeric($cr[2]) || !$this->int2Op($cr[1]))
break;
// remap OP for this special case
switch ($cr[1])
{
case '=': // min > max is totally possible
$this->extraOpts['ct']['h'][] = 'healthMin = healthMax AND healthMin = '.$cr[2];
break;
case '>':
$this->extraOpts['ct']['h'][] = 'IF(healthMin > healthMax, healthMax, healthMin) > '.$cr[2];
break;
case '>=':
$this->extraOpts['ct']['h'][] = 'IF(healthMin > healthMax, healthMax, healthMin) >= '.$cr[2];
break;
case '<':
$this->extraOpts['ct']['h'][] = 'IF(healthMin > healthMax, healthMin, healthMax) < '.$cr[2];
break;
case '<=':
$this->extraOpts['ct']['h'][] = 'IF(healthMin > healthMax, healthMin, healthMax) <= '.$cr[2];
break;
}
return [1]; // always true, use post-filter
case 2: // mana [num]
if (!$this->isSaneNumeric($cr[2]) || !$this->int2Op($cr[1]))
break;
// remap OP for this special case
switch ($cr[1])
{
case '=':
$this->extraOpts['ct']['h'][] = 'manaMin = manaMax AND manaMin = '.$cr[2];
break;
case '>':
$this->extraOpts['ct']['h'][] = 'IF(manaMin > manaMax, manaMin, manaMax) > '.$cr[2];
break;
case '>=':
$this->extraOpts['ct']['h'][] = 'IF(manaMin > manaMax, manaMin, manaMax) >= '.$cr[2];
break;
case '<':
$this->extraOpts['ct']['h'][] = 'IF(manaMin > manaMax, manaMax, manaMin) < '.$cr[2];
break;
case '<=':
$this->extraOpts['ct']['h'][] = 'IF(manaMin > manaMax, manaMax, manaMin) <= '.$cr[2];
break;
}
return [1]; // always true, use post-filter
case 7: // startsquest [enum]
switch ($cr[1])
{
case 1: // any
return ['AND', ['qse.method', 0x1, '&'], ['qse.questId', null, '!']];
case 2: // alliance
return ['AND', ['qse.method', 0x1, '&'], ['qse.questId', null, '!'], [['qt.reqRaceMask', RACE_MASK_HORDE, '&'], 0], ['qt.reqRaceMask', RACE_MASK_ALLIANCE, '&']];
case 3: // horde
return ['AND', ['qse.method', 0x1, '&'], ['qse.questId', null, '!'], [['qt.reqRaceMask', RACE_MASK_ALLIANCE, '&'], 0], ['qt.reqRaceMask', RACE_MASK_HORDE, '&']];
case 4: // both
return ['AND', ['qse.method', 0x1, '&'], ['qse.questId', null, '!'], ['OR', ['AND', ['qt.reqRaceMask', RACE_MASK_ALLIANCE, '&'], ['qt.reqRaceMask', RACE_MASK_HORDE, '&']], ['qt.reqRaceMask', 0]]];
case 5: // none
$this->extraOpts['ct']['h'][] = 'startsQuests = 0';
return [1];
}
break;
case 8: // endsquest [enum]
switch ($cr[1])
{
case 1: // any
return ['AND', ['qse.method', 0x2, '&'], ['qse.questId', null, '!']];
case 2: // alliance
return ['AND', ['qse.method', 0x2, '&'], ['qse.questId', null, '!'], [['qt.reqRaceMask', RACE_MASK_HORDE, '&'], 0], ['qt.reqRaceMask', RACE_MASK_ALLIANCE, '&']];
case 3: // horde
return ['AND', ['qse.method', 0x2, '&'], ['qse.questId', null, '!'], [['qt.reqRaceMask', RACE_MASK_ALLIANCE, '&'], 0], ['qt.reqRaceMask', RACE_MASK_HORDE, '&']];
case 4: // both
return ['AND', ['qse.method', 0x2, '&'], ['qse.questId', null, '!'], ['OR', ['AND', ['qt.reqRaceMask', RACE_MASK_ALLIANCE, '&'], ['qt.reqRaceMask', RACE_MASK_HORDE, '&']], ['qt.reqRaceMask', 0]]];
case 5: // none
$this->extraOpts['ct']['h'][] = 'endsQuests = 0';
return [1];
}
break;
case 3: // faction [enum]
if (in_array($cr[1], $this->enums[$cr[0]]))
{
$facTpls = [];
$facs = new FactionList(array('OR', ['parentFactionId', $cr[1]], ['id', $cr[1]]));
foreach ($facs->iterate() as $__)
$facTpls = array_merge($facTpls, $facs->getField('templateIds'));
if (!$facTpls)
return [0];
return ['faction', $facTpls];
}
break;
case 38; // relatedevent
if (!$this->isSaneNumeric($cr[1]))
break;
if ($cr[1] == FILTER_ENUM_ANY)
{
$eventIds = DB::Aowow()->selectCol('SELECT id FROM ?_events WHERE holidayId <> 0');
$cGuids = DB::World()->selectCol('SELECT DISTINCT guid FROM game_event_creature WHERE eventEntry IN (?a)', $eventIds);
return ['s.guid', $cGuids];
}
else if ($cr[1] == FILTER_ENUM_NONE)
{
$eventIds = DB::Aowow()->selectCol('SELECT id FROM ?_events WHERE holidayId <> 0');
$cGuids = DB::World()->selectCol('SELECT DISTINCT guid FROM game_event_creature WHERE eventEntry IN (?a)', $eventIds);
return ['s.guid', $cGuids, '!'];
}
else if ($cr[1])
{
$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];
}
break;
case 42: // increasesrepwith [enum]
if (in_array($cr[1], $this->enums[3])) // reuse
{
if ($_ = DB::Aowow()->selectRow('SELECT * FROM ?_factions WHERE id = ?d', $cr[1]))
$this->formData['reputationCols'][] = [$cr[1], Util::localizedString($_, 'name')];
if ($cIds = DB::World()->selectCol('SELECT creature_id FROM creature_onkill_reputation WHERE (RewOnKillRepFaction1 = ?d AND RewOnKillRepValue1 > 0) OR (RewOnKillRepFaction2 = ?d AND RewOnKillRepValue2 > 0)', $cr[1], $cr[1]))
return ['id', $cIds];
else
return [0];
}
break;
case 43: // decreasesrepwith [enum]
if (in_array($cr[1], $this->enums[3])) // reuse
{
if ($_ = DB::Aowow()->selectRow('SELECT * FROM ?_factions WHERE id = ?d', $cr[1]))
$this->formData['reputationCols'][] = [$cr[1], Util::localizedString($_, 'name')];
if ($cIds = DB::World()->selectCol('SELECT creature_id FROM creature_onkill_reputation WHERE (RewOnKillRepFaction1 = ?d AND RewOnKillRepValue1 < 0) OR (RewOnKillRepFaction2 = ?d AND RewOnKillRepValue2 < 0)', $cr[1], $cr[1]))
return ['id', $cIds];
else
return [0];
}
break;
case 12: // averagemoneydropped [op] [int]
if (!$this->isSaneNumeric($cr[2]) || !$this->int2Op($cr[1]))
break;
return ['AND', ['((minGold + maxGold) / 2)', $cr[2], $cr[1]]];
case 15: // gatherable [yn]
if ($this->int2Bool($cr[1]))
{
if ($cr[1])
return ['AND', ['skinLootId', 0, '>'], ['typeFlags', NPC_TYPEFLAG_HERBLOOT, '&']];
else
return ['OR', ['skinLootId', 0], [['typeFlags', NPC_TYPEFLAG_HERBLOOT, '&'], 0]];
}
break;
case 44: // salvageable [yn]
if ($this->int2Bool($cr[1]))
{
if ($cr[1])
return ['AND', ['skinLootId', 0, '>'], ['typeFlags', NPC_TYPEFLAG_ENGINEERLOOT, '&']];
else
return ['OR', ['skinLootId', 0], [['typeFlags', NPC_TYPEFLAG_ENGINEERLOOT, '&'], 0]];
}
break;
case 16: // minable [yn]
if ($this->int2Bool($cr[1]))
{
if ($cr[1])
return ['AND', ['skinLootId', 0, '>'], ['typeFlags', NPC_TYPEFLAG_MININGLOOT, '&']];
else
return ['OR', ['skinLootId', 0], [['typeFlags', NPC_TYPEFLAG_MININGLOOT, '&'], 0]];
}
break;
case 10: // skinnable [yn]
if ($this->int2Bool($cr[1]))
{
if ($cr[1])
return ['AND', ['skinLootId', 0, '>'], [['typeFlags', NPC_TYPEFLAG_SPECIALLOOT, '&'], 0]];
else
return ['OR', ['skinLootId', 0], [['typeFlags', NPC_TYPEFLAG_SPECIALLOOT, '&'], 0, '!']];
}
break;
case 34: // usemodel [str] // displayId -> id:creatureDisplayInfo.dbc/model -> id:cratureModelData.dbc/modelPath
case 41: // haslocation [yn] [staff]
/* todo */ return [1];
}
unset($cr); unset($cr);
$this->error = true; $this->error = true;
return [1]; return [1];
@@ -543,65 +378,176 @@ class CreatureListFilter extends Filter
// pet family [list] // pet family [list]
if (isset($_v['fa'])) if (isset($_v['fa']))
{ $parts[] = ['family', $_v['fa']];
$_ = (array)$_v['fa'];
if (!array_diff($_, [1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 20, 21, 24, 25, 26, 27, 30, 31, 32, 33, 34, 35, 37, 38, 39, 41, 42, 43, 44, 45, 46]))
$parts[] = ['family', $_];
else
unset($_v['cl']);
}
// creatureLevel min [int] // creatureLevel min [int]
if (isset($_v['minle'])) if (isset($_v['minle']))
{ $parts[] = ['minLevel', $_v['minle'], '>='];
if (is_int($_v['minle']) && $_v['minle'] > 0)
$parts[] = ['minLevel', $_v['minle'], '>='];
else
unset($_v['minle']);
}
// creatureLevel max [int] // creatureLevel max [int]
if (isset($_v['maxle'])) if (isset($_v['maxle']))
{ $parts[] = ['maxLevel', $_v['maxle'], '<='];
if (is_int($_v['maxle']) && $_v['maxle'] > 0)
$parts[] = ['maxLevel', $_v['maxle'], '<='];
else
unset($_v['maxle']);
}
// classification [list] // classification [list]
if (isset($_v['cl'])) if (isset($_v['cl']))
{ $parts[] = ['rank', $_v['cl']];
$_ = (array)$_v['cl'];
if (!array_diff($_, [0, 1, 2, 3, 4]))
$parts[] = ['rank', $_];
else
unset($_v['cl']);
}
// react Alliance [int] // react Alliance [int]
if (isset($_v['ra'])) if (isset($_v['ra']))
{ $parts[] = ['ft.A', $_v['ra']];
$_ = (int)$_v['ra'];
if (in_array($_, [-1, 0, 1]))
$parts[] = ['ft.A', $_];
else
unset($_v['ra']);
}
// react Horde [int] // react Horde [int]
if (isset($_v['rh'])) if (isset($_v['rh']))
{ $parts[] = ['ft.H', $_v['rh']];
$_ = (int)$_v['rh'];
if (in_array($_, [-1, 0, 1]))
$parts[] = ['ft.H', $_];
else
unset($_v['rh']);
}
return $parts; return $parts;
} }
protected function cbPetFamily(&$val)
{
if (!$this->parentCats || $this->parentCats[0] != 1)
return false;
if (!Util::checkNumeric($val, NUM_REQ_INT))
return false;
$type = FILTER_V_LIST;
$valid = [[1, 9], 11, 12, 20, 21, [24, 27], [30, 35], [37, 39], [41, 46]];
return $this->checkInput($type, $valid, $val);
}
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');
$cGuids = DB::World()->selectCol('SELECT DISTINCT guid FROM game_event_creature WHERE eventEntry IN (?a)', $eventIds);
return ['s.guid', $cGuids];
}
else if ($cr[1] == FILTER_ENUM_NONE)
{
$eventIds = DB::Aowow()->selectCol('SELECT id FROM ?_events WHERE holidayId <> 0');
$cGuids = DB::World()->selectCol('SELECT DISTINCT guid FROM game_event_creature WHERE eventEntry IN (?a)', $eventIds);
return ['s.guid', $cGuids, '!'];
}
else if ($cr[1])
{
$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];
}
return false;
}
protected function cbMoneyDrop($cr)
{
if (!Util::checkNumeric($cr[2], NUM_CAST_INT) || !$this->int2Op($cr[1]))
return false;
return ['AND', ['((minGold + maxGold) / 2)', $cr[2], $cr[1]]];
}
protected function cbQuestRelation($cr, $field, $val)
{
switch ($cr[1])
{
case 1: // any
return ['AND', ['qse.method', $val, '&'], ['qse.questId', null, '!']];
case 2: // alliance
return ['AND', ['qse.method', $val, '&'], ['qse.questId', null, '!'], [['qt.reqRaceMask', RACE_MASK_HORDE, '&'], 0], ['qt.reqRaceMask', RACE_MASK_ALLIANCE, '&']];
case 3: // horde
return ['AND', ['qse.method', $val, '&'], ['qse.questId', null, '!'], [['qt.reqRaceMask', RACE_MASK_ALLIANCE, '&'], 0], ['qt.reqRaceMask', RACE_MASK_HORDE, '&']];
case 4: // both
return ['AND', ['qse.method', $val, '&'], ['qse.questId', null, '!'], ['OR', ['AND', ['qt.reqRaceMask', RACE_MASK_ALLIANCE, '&'], ['qt.reqRaceMask', RACE_MASK_HORDE, '&']], ['qt.reqRaceMask', 0]]];
case 5: // none
$this->extraOpts['ct']['h'][] = $field.' = 0';
return [1];
}
return false;
}
protected function cbHealthMana($cr, $minField, $maxField)
{
if (!Util::checkNumeric($cr[2], NUM_CAST_INT) || !$this->int2Op($cr[1]))
return false;
// remap OP for this special case
switch ($cr[1])
{
case '=': // min > max is totally possible
$this->extraOpts['ct']['h'][] = $minField.' = '.$maxField.' AND '.$minField.' = '.$cr[2];
break;
case '>':
case '>=':
case '<':
case '<=':
$this->extraOpts['ct']['h'][] = 'IF('.$minField.' > '.$maxField.', '.$maxField.', '.$minField.') '.$cr[1].' '.$cr[2];
break;
}
return [1]; // always true, use post-filter
}
protected function cbSpecialSkinLoot($cr, $typeFlag)
{
if (!$this->int2Bool($cr[1]))
return false;
if ($cr[1])
return ['AND', ['skinLootId', 0, '>'], ['typeFlags', $typeFlag, '&']];
else
return ['OR', ['skinLootId', 0], [['typeFlags', $typeFlag, '&'], 0]];
}
protected function cbRegularSkinLoot($cr, $typeFlag)
{
if (!$this->int2Bool($cr[1]))
return false;
if ($cr[1])
return ['AND', ['skinLootId', 0, '>'], [['typeFlags', $typeFlag, '&'], 0]];
else
return ['OR', ['skinLootId', 0], ['typeFlags', $typeFlag, '&']];
}
protected function cbReputation($cr, $op)
{
if (!in_array($cr[1], $this->enums[3])) // reuse
return false;
if ($_ = DB::Aowow()->selectRow('SELECT * FROM ?_factions WHERE id = ?d', $cr[1]))
$this->formData['reputationCols'][] = [$cr[1], Util::localizedString($_, 'name')];
if ($cIds = DB::World()->selectCol('SELECT creature_id FROM creature_onkill_reputation WHERE (RewOnKillRepFaction1 = ?d AND RewOnKillRepValue1 '.$op.' 0) OR (RewOnKillRepFaction2 = ?d AND RewOnKillRepValue2 '.$op.' 0)', $cr[1], $cr[1]))
return ['id', $cIds];
else
return [0];
}
protected function cbFaction($cr)
{
if (!Util::checkNumeric($cr[1], NUM_REQ_INT))
return false;
if (!in_array($cr[1], $this->enums[$cr[0]]))
return false;
$facTpls = [];
$facs = new FactionList(array('OR', ['parentFactionId', $cr[1]], ['id', $cr[1]]));
foreach ($facs->iterate() as $__)
$facTpls = array_merge($facTpls, $facs->getField('templateIds'));
return $facTpls ? ['faction', $facTpls] : [0];
}
} }
?> ?>

View File

@@ -244,78 +244,86 @@ class EnchantmentListFilter extends Filter
); );
protected $genericFilter = array( // misc (bool): _NUMERIC => useFloat; _STRING => localized; _FLAG => match Value; _BOOLEAN => stringSet protected $genericFilter = array( // misc (bool): _NUMERIC => useFloat; _STRING => localized; _FLAG => match Value; _BOOLEAN => stringSet
2 => [FILTER_CR_NUMERIC, 'id', null, true], // id 2 => [FILTER_CR_NUMERIC, 'id', NUM_CAST_INT, true], // id
3 => [FILTER_CR_ENUM, 'skillLine' ], // requiresprof 3 => [FILTER_CR_ENUM, 'skillLine' ], // requiresprof
4 => [FILTER_CR_NUMERIC, 'skillLevel', ], // reqskillrank 4 => [FILTER_CR_NUMERIC, 'skillLevel', NUM_CAST_INT ], // reqskillrank
5 => [FILTER_CR_BOOLEAN, 'conditionId' ], // hascondition 5 => [FILTER_CR_BOOLEAN, 'conditionId' ], // hascondition
10 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_COMMENT ], // hascomments 10 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_COMMENT ], // hascomments
11 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_SCREENSHOT ], // hasscreenshots 11 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_SCREENSHOT ], // hasscreenshots
12 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_VIDEO ], // hasvideos 12 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_VIDEO ], // hasvideos
21 => [FILTER_CR_NUMERIC, 'is.agi', null, true], // agi 20 => [FILTER_CR_NUMERIC, 'is.str', NUM_CAST_INT, true], // str
23 => [FILTER_CR_NUMERIC, 'is.int', null, true], // int 21 => [FILTER_CR_NUMERIC, 'is.agi', NUM_CAST_INT, true], // agi
22 => [FILTER_CR_NUMERIC, 'is.sta', null, true], // sta 22 => [FILTER_CR_NUMERIC, 'is.sta', NUM_CAST_INT, true], // sta
24 => [FILTER_CR_NUMERIC, 'is.spi', null, true], // spi 23 => [FILTER_CR_NUMERIC, 'is.int', NUM_CAST_INT, true], // int
20 => [FILTER_CR_NUMERIC, 'is.str', null, true], // str 24 => [FILTER_CR_NUMERIC, 'is.spi', NUM_CAST_INT, true], // spi
115 => [FILTER_CR_NUMERIC, 'is.health', null, true], // health 25 => [FILTER_CR_NUMERIC, 'is.arcres', NUM_CAST_INT, true], // arcres
116 => [FILTER_CR_NUMERIC, 'is.mana', null, true], // mana 26 => [FILTER_CR_NUMERIC, 'is.firres', NUM_CAST_INT, true], // firres
60 => [FILTER_CR_NUMERIC, 'is.healthrgn', null, true], // healthrgn 27 => [FILTER_CR_NUMERIC, 'is.natres', NUM_CAST_INT, true], // natres
61 => [FILTER_CR_NUMERIC, 'is.manargn', null, true], // manargn 28 => [FILTER_CR_NUMERIC, 'is.frores', NUM_CAST_INT, true], // frores
41 => [FILTER_CR_NUMERIC, 'is.armor' , null, true], // armor 29 => [FILTER_CR_NUMERIC, 'is.shares', NUM_CAST_INT, true], // shares
44 => [FILTER_CR_NUMERIC, 'is.blockrtng', null, true], // blockrtng 30 => [FILTER_CR_NUMERIC, 'is.holres', NUM_CAST_INT, true], // holres
43 => [FILTER_CR_NUMERIC, 'is.block', null, true], // block 32 => [FILTER_CR_NUMERIC, 'is.dps', NUM_CAST_FLOAT, true], // dps
42 => [FILTER_CR_NUMERIC, 'is.defrtng', null, true], // defrtng 34 => [FILTER_CR_NUMERIC, 'is.dmg', NUM_CAST_FLOAT, true], // dmg
45 => [FILTER_CR_NUMERIC, 'is.dodgertng', null, true], // dodgertng 37 => [FILTER_CR_NUMERIC, 'is.mleatkpwr', NUM_CAST_INT, true], // mleatkpwr
46 => [FILTER_CR_NUMERIC, 'is.parryrtng', null, true], // parryrtng 38 => [FILTER_CR_NUMERIC, 'is.rgdatkpwr', NUM_CAST_INT, true], // rgdatkpwr
79 => [FILTER_CR_NUMERIC, 'is.resirtng', null, true], // resirtng 39 => [FILTER_CR_NUMERIC, 'is.rgdhitrtng', NUM_CAST_INT, true], // rgdhitrtng
77 => [FILTER_CR_NUMERIC, 'is.atkpwr', null, true], // atkpwr 40 => [FILTER_CR_NUMERIC, 'is.rgdcritstrkrtng', NUM_CAST_INT, true], // rgdcritstrkrtng
97 => [FILTER_CR_NUMERIC, 'is.feratkpwr', null, true], // feratkpwr 41 => [FILTER_CR_NUMERIC, 'is.armor' , NUM_CAST_INT, true], // armor
114 => [FILTER_CR_NUMERIC, 'is.armorpenrtng', null, true], // armorpenrtng 42 => [FILTER_CR_NUMERIC, 'is.defrtng', NUM_CAST_INT, true], // defrtng
96 => [FILTER_CR_NUMERIC, 'is.critstrkrtng', null, true], // critstrkrtng 43 => [FILTER_CR_NUMERIC, 'is.block', NUM_CAST_INT, true], // block
117 => [FILTER_CR_NUMERIC, 'is.exprtng', null, true], // exprtng 44 => [FILTER_CR_NUMERIC, 'is.blockrtng', NUM_CAST_INT, true], // blockrtng
103 => [FILTER_CR_NUMERIC, 'is.hastertng', null, true], // hastertng 45 => [FILTER_CR_NUMERIC, 'is.dodgertng', NUM_CAST_INT, true], // dodgertng
119 => [FILTER_CR_NUMERIC, 'is.hitrtng', null, true], // hitrtng 46 => [FILTER_CR_NUMERIC, 'is.parryrtng', NUM_CAST_INT, true], // parryrtng
94 => [FILTER_CR_NUMERIC, 'is.splpen', null, true], // splpen 48 => [FILTER_CR_NUMERIC, 'is.splhitrtng', NUM_CAST_INT, true], // splhitrtng
123 => [FILTER_CR_NUMERIC, 'is.splpwr', null, true], // splpwr 49 => [FILTER_CR_NUMERIC, 'is.splcritstrkrtng', NUM_CAST_INT, true], // splcritstrkrtng
52 => [FILTER_CR_NUMERIC, 'is.arcsplpwr', null, true], // arcsplpwr 50 => [FILTER_CR_NUMERIC, 'is.splheal', NUM_CAST_INT, true], // splheal
53 => [FILTER_CR_NUMERIC, 'is.firsplpwr', null, true], // firsplpwr 51 => [FILTER_CR_NUMERIC, 'is.spldmg', NUM_CAST_INT, true], // spldmg
54 => [FILTER_CR_NUMERIC, 'is.frosplpwr', null, true], // frosplpwr 52 => [FILTER_CR_NUMERIC, 'is.arcsplpwr', NUM_CAST_INT, true], // arcsplpwr
55 => [FILTER_CR_NUMERIC, 'is.holsplpwr', null, true], // holsplpwr 53 => [FILTER_CR_NUMERIC, 'is.firsplpwr', NUM_CAST_INT, true], // firsplpwr
56 => [FILTER_CR_NUMERIC, 'is.natsplpwr', null, true], // natsplpwr 54 => [FILTER_CR_NUMERIC, 'is.frosplpwr', NUM_CAST_INT, true], // frosplpwr
57 => [FILTER_CR_NUMERIC, 'is.shasplpwr', null, true], // shasplpwr 55 => [FILTER_CR_NUMERIC, 'is.holsplpwr', NUM_CAST_INT, true], // holsplpwr
32 => [FILTER_CR_NUMERIC, 'is.dps', true, true], // dps 56 => [FILTER_CR_NUMERIC, 'is.natsplpwr', NUM_CAST_INT, true], // natsplpwr
34 => [FILTER_CR_NUMERIC, 'is.dmg', true, true], // dmg 57 => [FILTER_CR_NUMERIC, 'is.shasplpwr', NUM_CAST_INT, true], // shasplpwr
25 => [FILTER_CR_NUMERIC, 'is.arcres', null, true], // arcres 60 => [FILTER_CR_NUMERIC, 'is.healthrgn', NUM_CAST_INT, true], // healthrgn
26 => [FILTER_CR_NUMERIC, 'is.firres', null, true], // firres 61 => [FILTER_CR_NUMERIC, 'is.manargn', NUM_CAST_INT, true], // manargn
28 => [FILTER_CR_NUMERIC, 'is.frores', null, true], // frores 77 => [FILTER_CR_NUMERIC, 'is.atkpwr', NUM_CAST_INT, true], // atkpwr
30 => [FILTER_CR_NUMERIC, 'is.holres', null, true], // holres 78 => [FILTER_CR_NUMERIC, 'is.mlehastertng', NUM_CAST_INT, true], // mlehastertng
27 => [FILTER_CR_NUMERIC, 'is.natres', null, true], // natres 79 => [FILTER_CR_NUMERIC, 'is.resirtng', NUM_CAST_INT, true], // resirtng
29 => [FILTER_CR_NUMERIC, 'is.shares', null, true], // shares 84 => [FILTER_CR_NUMERIC, 'is.mlecritstrkrtng', NUM_CAST_INT, true], // mlecritstrkrtng
37 => [FILTER_CR_NUMERIC, 'is.mleatkpwr', null, true], // mleatkpwr 94 => [FILTER_CR_NUMERIC, 'is.splpen', NUM_CAST_INT, true], // splpen
84 => [FILTER_CR_NUMERIC, 'is.mlecritstrkrtng', null, true], // mlecritstrkrtng 95 => [FILTER_CR_NUMERIC, 'is.mlehitrtng', NUM_CAST_INT, true], // mlehitrtng
78 => [FILTER_CR_NUMERIC, 'is.mlehastertng', null, true], // mlehastertng 96 => [FILTER_CR_NUMERIC, 'is.critstrkrtng', NUM_CAST_INT, true], // critstrkrtng
95 => [FILTER_CR_NUMERIC, 'is.mlehitrtng', null, true], // mlehitrtng 97 => [FILTER_CR_NUMERIC, 'is.feratkpwr', NUM_CAST_INT, true], // feratkpwr
38 => [FILTER_CR_NUMERIC, 'is.rgdatkpwr', null, true], // rgdatkpwr 101 => [FILTER_CR_NUMERIC, 'is.rgdhastertng', NUM_CAST_INT, true], // rgdhastertng
40 => [FILTER_CR_NUMERIC, 'is.rgdcritstrkrtng', null, true], // rgdcritstrkrtng 102 => [FILTER_CR_NUMERIC, 'is.splhastertng', NUM_CAST_INT, true], // splhastertng
101 => [FILTER_CR_NUMERIC, 'is.rgdhastertng', null, true], // rgdhastertng 103 => [FILTER_CR_NUMERIC, 'is.hastertng', NUM_CAST_INT, true], // hastertng
39 => [FILTER_CR_NUMERIC, 'is.rgdhitrtng', null, true], // rgdhitrtng 114 => [FILTER_CR_NUMERIC, 'is.armorpenrtng', NUM_CAST_INT, true], // armorpenrtng
49 => [FILTER_CR_NUMERIC, 'is.splcritstrkrtng', null, true], // splcritstrkrtng 115 => [FILTER_CR_NUMERIC, 'is.health', NUM_CAST_INT, true], // health
102 => [FILTER_CR_NUMERIC, 'is.splhastertng', null, true], // splhastertng 116 => [FILTER_CR_NUMERIC, 'is.mana', NUM_CAST_INT, true], // mana
48 => [FILTER_CR_NUMERIC, 'is.splhitrtng', null, true], // splhitrtng 117 => [FILTER_CR_NUMERIC, 'is.exprtng', NUM_CAST_INT, true], // exprtng
51 => [FILTER_CR_NUMERIC, 'is.spldmg', null, true], // spldmg 119 => [FILTER_CR_NUMERIC, 'is.hitrtng', NUM_CAST_INT, true], // hitrtng
50 => [FILTER_CR_NUMERIC, 'is.splheal', null, true] // splheal 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
); );
protected function createSQLForCriterium(&$cr) protected function createSQLForCriterium(&$cr)
{ {
if (in_array($cr[0], array_keys($this->genericFilter))) if (in_array($cr[0], array_keys($this->genericFilter)))
{
if ($genCr = $this->genericCriterion($cr)) if ($genCr = $this->genericCriterion($cr))
return $genCr; return $genCr;
unset($cr); unset($cr);
$this->error = true; $this->error = true;
return [1]; return [1];
}
} }
protected function createSQLForValues() protected function createSQLForValues()

View File

@@ -142,98 +142,36 @@ class GameObjectListFilter extends Filter
public $extraOpts = []; public $extraOpts = [];
protected $genericFilter = array( protected $genericFilter = array(
1 => [FILTER_CR_ENUM, 's.areaId', null ], // foundin 1 => [FILTER_CR_ENUM, 's.areaId', null ], // foundin
7 => [FILTER_CR_NUMERIC, 'reqSkill', null ], // requiredskilllevel 2 => [FILTER_CR_CALLBACK, 'cbQuestRelation', 'startsQuests', 0x1 ], // startsquest [side]
11 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_SCREENSHOT], // hasscreenshots 3 => [FILTER_CR_CALLBACK, 'cbQuestRelation', 'endsQuests', 0x2 ], // endsquest [side]
13 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_COMMENT ], // hascomments 4 => [FILTER_CR_CALLBACK, 'cbOpenable', null, null], // openable [yn]
15 => [FILTER_CR_NUMERIC, 'id', null ], // id 5 => [FILTER_CR_NYI_PH, null, null ], // averagemoneycontained [op] [int] - GOs don't contain money, match against 0
18 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_VIDEO ], // hasvideos 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
);
// fieldId => [checkType, checkValue[, fieldIsArray]]
protected $inputFields = array(
'cr' => [FILTER_V_LIST, [[1, 5], 7, 11, 13, 15, 16, 18], 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
'ma' => [FILTER_V_EQUAL, 1, false] // match any / all filter
); );
protected function createSQLForCriterium(&$cr) protected function createSQLForCriterium(&$cr)
{ {
if (in_array($cr[0], array_keys($this->genericFilter))) if (in_array($cr[0], array_keys($this->genericFilter)))
{
if ($genCR = $this->genericCriterion($cr)) if ($genCR = $this->genericCriterion($cr))
return $genCR; return $genCR;
unset($cr);
$this->error = true;
return [1];
}
switch ($cr[0])
{
case 4:
if (!$this->int2Bool($cr[1]))
break;
return $cr[1] ? ['OR', ['flags', 0x2, '&'], ['type', 3]] : ['AND', [['flags', 0x2, '&'], 0], ['type', 3, '!']];
case 5: // averagemoneycontained [op] [int] GOs don't contain money .. eval to 0 == true
if (!$this->isSaneNumeric($cr[2], false) || !$this->int2Op($cr[1]))
break;
return eval('return ('.$cr[2].' '.$cr[1].' 0)') ? [1] : [0];
case 2: // startsquest [side]
switch ($cr[1])
{
case 1: // any
return ['AND', ['qse.method', 0x1, '&'], ['qse.questId', null, '!']];
case 2: // alliance only
return ['AND', ['qse.method', 0x1, '&'], ['qse.questId', null, '!'], [['qt.reqRaceMask', RACE_MASK_HORDE, '&'], 0], ['qt.reqRaceMask', RACE_MASK_ALLIANCE, '&']];
case 3: // horde only
return ['AND', ['qse.method', 0x1, '&'], ['qse.questId', null, '!'], [['qt.reqRaceMask', RACE_MASK_ALLIANCE, '&'], 0], ['qt.reqRaceMask', RACE_MASK_HORDE, '&']];
case 4: // both
return ['AND', ['qse.method', 0x1, '&'], ['qse.questId', null, '!'], ['OR', ['AND', ['qt.reqRaceMask', RACE_MASK_ALLIANCE, '&'], ['qt.reqRaceMask', RACE_MASK_HORDE, '&']], ['qt.reqRaceMask', 0]]];
case 5: // none
$this->extraOpts['o']['h'][] = 'startsQuests = 0';
return [1];
}
break;
case 3: // endsquest [side]
switch ($cr[1])
{
case 1: // any
return ['AND', ['qse.method', 0x2, '&'], ['qse.questId', null, '!']];
case 2: // alliance only
return ['AND', ['qse.method', 0x2, '&'], ['qse.questId', null, '!'], [['qt.reqRaceMask', RACE_MASK_HORDE, '&'], 0], ['qt.reqRaceMask', RACE_MASK_ALLIANCE, '&']];
case 3: // horde only
return ['AND', ['qse.method', 0x2, '&'], ['qse.questId', null, '!'], [['qt.reqRaceMask', RACE_MASK_ALLIANCE, '&'], 0], ['qt.reqRaceMask', RACE_MASK_HORDE, '&']];
case 4: // both
return ['AND', ['qse.method', 0x2, '&'], ['qse.questId', null, '!'], ['OR', ['AND', ['qt.reqRaceMask', RACE_MASK_ALLIANCE, '&'], ['qt.reqRaceMask', RACE_MASK_HORDE, '&']], ['qt.reqRaceMask', 0]]];
case 5: // none todo: broken, if entry starts and ends quests...
$this->extraOpts['o']['h'][] = 'endsQuests = 0';
return [1];
}
break;
case 16; // relatedevent (ignore removed by event)
if (!$this->isSaneNumeric($cr[1]))
break;
if ($cr[1] == FILTER_ENUM_ANY)
{
$eventIds = DB::Aowow()->selectCol('SELECT id FROM ?_events WHERE holidayId <> 0');
$goGuids = DB::World()->selectCol('SELECT DISTINCT guid FROM game_event_gameobject WHERE eventEntry IN (?a)', $eventIds);
return ['s.guid', $goGuids];
}
else if ($cr[1] == FILTER_ENUM_NONE)
{
$eventIds = DB::Aowow()->selectCol('SELECT id FROM ?_events WHERE holidayId <> 0');
$goGuids = DB::World()->selectCol('SELECT DISTINCT guid FROM game_event_gameobject WHERE eventEntry IN (?a)', $eventIds);
return ['s.guid', $goGuids, '!'];
}
else if ($cr[1])
{
$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];
}
break;
}
unset($cr); unset($cr);
$this->error = 1; $this->error = true;
return [1]; return [1];
} }
@@ -249,6 +187,61 @@ class GameObjectListFilter extends Filter
return $parts; return $parts;
} }
protected function cbOpenable($cr)
{
if ($this->int2Bool($cr[1]))
return $cr[1] ? ['OR', ['flags', 0x2, '&'], ['type', 3]] : ['AND', [['flags', 0x2, '&'], 0], ['type', 3, '!']];
return false;
}
protected function cbQuestRelation($cr, $field, $value)
{
switch ($cr[1])
{
case 1: // any
return ['AND', ['qse.method', $value, '&'], ['qse.questId', null, '!']];
case 2: // alliance only
return ['AND', ['qse.method', $value, '&'], ['qse.questId', null, '!'], [['qt.reqRaceMask', RACE_MASK_HORDE, '&'], 0], ['qt.reqRaceMask', RACE_MASK_ALLIANCE, '&']];
case 3: // horde only
return ['AND', ['qse.method', $value, '&'], ['qse.questId', null, '!'], [['qt.reqRaceMask', RACE_MASK_ALLIANCE, '&'], 0], ['qt.reqRaceMask', RACE_MASK_HORDE, '&']];
case 4: // both
return ['AND', ['qse.method', $value, '&'], ['qse.questId', null, '!'], ['OR', ['AND', ['qt.reqRaceMask', RACE_MASK_ALLIANCE, '&'], ['qt.reqRaceMask', RACE_MASK_HORDE, '&']], ['qt.reqRaceMask', 0]]];
case 5: // none todo (low): broken, if entry starts and ends quests...
$this->extraOpts['o']['h'][] = $field.' = 0';
return [1];
}
return false;
}
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');
$goGuids = DB::World()->selectCol('SELECT DISTINCT guid FROM game_event_gameobject WHERE eventEntry IN (?a)', $eventIds);
return ['s.guid', $goGuids];
}
else if ($cr[1] == FILTER_ENUM_NONE)
{
$eventIds = DB::Aowow()->selectCol('SELECT id FROM ?_events WHERE holidayId <> 0');
$goGuids = DB::World()->selectCol('SELECT DISTINCT guid FROM game_event_gameobject WHERE eventEntry IN (?a)', $eventIds);
return ['s.guid', $goGuids, '!'];
}
else if ($cr[1])
{
$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];
}
return false;
}
} }
?> ?>

View File

@@ -120,6 +120,25 @@ class IconListFilter extends Filter
); );
private $totalUses = []; 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]
);
// 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
);
private function _getCnd($op, $val, $tbl) private function _getCnd($op, $val, $tbl)
{ {
switch ($op) switch ($op)
@@ -147,47 +166,11 @@ class IconListFilter extends Filter
return $ids ? ['id', array_keys($ids), '!'] : [1]; return $ids ? ['id', array_keys($ids), '!'] : [1];
} }
protected function createSQLForCriterium(&$cr) protected function createSQLForCriterium(&$cr)
{ {
if (isset($this->criterion2field[$cr[0]])) if (in_array($cr[0], array_keys($this->genericFilter)))
{ if ($genCr = $this->genericCriterion($cr))
if ($cr[0] == 13 && $this->isSaneNumeric($cr[2]) && $this->int2Op($cr[1])) return $genCr;
{
if (!$this->totalUses)
{
foreach ($this->criterion2field as $tbl)
{
if (!$tbl)
continue;
$res = DB::Aowow()->selectCol('SELECT iconId AS ARRAY_KEY, COUNT(*) AS n FROM ?# GROUP BY iconId', $tbl);
Util::arraySumByKey($this->totalUses, $res);
}
}
if ($cr[1] == '=')
$cr[1] = '==';
$op = $cr[1];
if ($cr[1] == '<=' && $cr[2])
$op = '>';
else if ($cr[1] == '<' && $cr[2])
$op = '>=';
else if ($cr[1] == '!=' && $cr[2])
$op = '==';
$ids = array_filter($this->totalUses, function ($x) use ($op, $cr) { return eval('return '.$x.' '.$op.' '.$cr[2].';'); });
if ($cr[1] != $op)
return $ids ? ['id', array_keys($ids), '!'] : [1];
else
return $ids ? ['id', array_keys($ids)] : ['id', array_keys($this->totalUses), '!'];
}
else if ($cr[0] == 11)
return [0];
else if ($this->isSaneNumeric($cr[2]) && $this->int2Op($cr[1]))
return $this->_getCnd($cr[1], $cr[2], $this->criterion2field[$cr[0]]);
}
unset($cr); unset($cr);
$this->error = true; $this->error = true;
@@ -206,6 +189,49 @@ class IconListFilter extends Filter
return $parts; return $parts;
} }
protected function cbUseAny($cr, $value)
{
if (Util::checkNumeric($cr[2], NUM_CAST_INT) && $this->int2Op($cr[1]))
return $this->_getCnd($cr[1], $cr[2], $this->criterion2field[$cr[0]]);
return false;
}
protected function cbUseAll($cr)
{
if (!Util::checkNumeric($cr[2], NUM_CAST_INT) || !$this->int2Op($cr[1]))
return false;
if (!$this->totalUses)
{
foreach ($this->criterion2field as $tbl)
{
if (!$tbl)
continue;
$res = DB::Aowow()->selectCol('SELECT iconId AS ARRAY_KEY, COUNT(*) AS n FROM ?# GROUP BY iconId', $tbl);
Util::arraySumByKey($this->totalUses, $res);
}
}
if ($cr[1] == '=')
$cr[1] = '==';
$op = $cr[1];
if ($cr[1] == '<=' && $cr[2])
$op = '>';
else if ($cr[1] == '<' && $cr[2])
$op = '>=';
else if ($cr[1] == '!=' && $cr[2])
$op = '==';
$ids = array_filter($this->totalUses, function ($x) use ($op, $cr) { return eval('return '.$x.' '.$op.' '.$cr[2].';'); });
if ($cr[1] != $op)
return $ids ? ['id', array_keys($ids), '!'] : [1];
else
return $ids ? ['id', array_keys($ids)] : ['id', array_keys($this->totalUses), '!'];
}
} }
?> ?>

File diff suppressed because it is too large Load Diff

View File

@@ -171,34 +171,40 @@ class ItemsetListFilter extends Filter
{ {
// cr => [type, field, misc, extraCol] // cr => [type, field, misc, extraCol]
protected $genericFilter = array( // misc (bool): _NUMERIC => useFloat; _STRING => localized; _FLAG => match Value; _BOOLEAN => stringSet protected $genericFilter = array( // misc (bool): _NUMERIC => useFloat; _STRING => localized; _FLAG => match Value; _BOOLEAN => stringSet
2 => [FILTER_CR_NUMERIC, 'id', null, true], // id 2 => [FILTER_CR_NUMERIC, 'id', NUM_CAST_INT, true], // id
3 => [FILTER_CR_NUMERIC, 'npieces', ], // pieces 3 => [FILTER_CR_NUMERIC, 'npieces', NUM_CAST_INT ], // pieces
4 => [FILTER_CR_STRING, 'bonusText', true ], // bonustext 4 => [FILTER_CR_STRING, 'bonusText', true ], // bonustext
5 => [FILTER_CR_BOOLEAN, 'heroic', ], // heroic 5 => [FILTER_CR_BOOLEAN, 'heroic', ], // heroic
6 => [FILTER_CR_ENUM, 'e.holidayId', ], // relatedevent 6 => [FILTER_CR_ENUM, 'e.holidayId', ], // relatedevent
8 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_COMMENT ], // hascomments 8 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_COMMENT ], // hascomments
9 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_SCREENSHOT ], // hasscreenshots 9 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_SCREENSHOT ], // hasscreenshots
10 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_VIDEO ], // hasvideos 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
'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
'minle' => [FILTER_V_RANGE, [1, 999], false], // min item level
'maxle' => [FILTER_V_RANGE, [1, 999], false], // max itemlevel
'minrl' => [FILTER_V_RANGE, [1, MAX_LEVEL], false], // min required level
'maxrl' => [FILTER_V_RANGE, [1, MAX_LEVEL], false], // max required level
'cl' => [FILTER_V_LIST, [[1, 9], 11], false], // class
'ta' => [FILTER_V_RANGE, [1, 30], false] // tag / content group
); );
protected function createSQLForCriterium(&$cr) protected function createSQLForCriterium(&$cr)
{ {
if (in_array($cr[0], array_keys($this->genericFilter))) if (in_array($cr[0], array_keys($this->genericFilter)))
{
if ($genCR = $this->genericCriterion($cr)) if ($genCR = $this->genericCriterion($cr))
return $genCR; return $genCR;
unset($cr);
$this->error = true;
return [1];
}
switch ($cr[0])
{
case 12: // available to players [yn] ugh .. scan loot, quest and vendor templates and write to ?_itemset
/* todo */ return [1];
}
unset($cr); unset($cr);
$this->error = true; $this->error = true;
return [1]; return [1];
@@ -216,65 +222,35 @@ class ItemsetListFilter extends Filter
// quality [enum] // quality [enum]
if (isset($_v['qu'])) if (isset($_v['qu']))
$parts[] = ['quality', (array)$_v['qu']]; $parts[] = ['quality', $_v['qu']];
// type [enum] // type [enum]
if (isset($_v['ty'])) if (isset($_v['ty']))
$parts[] = ['type', (array)$_v['ty']]; $parts[] = ['type', $_v['ty']];
// itemLevel min [int] // itemLevel min [int]
if (isset($_v['minle'])) if (isset($_v['minle']))
{ $parts[] = ['minLevel', $_v['minle'], '>='];
if (is_int($_v['minle']) && $_v['minle'] > 0)
$parts[] = ['minLevel', $_v['minle'], '>='];
else
unset($_v['minle']);
}
// itemLevel max [int] // itemLevel max [int]
if (isset($_v['maxle'])) if (isset($_v['maxle']))
{ $parts[] = ['maxLevel', $_v['maxle'], '<='];
if (is_int($_v['maxle']) && $_v['maxle'] > 0)
$parts[] = ['maxLevel', $_v['maxle'], '<='];
else
unset($_v['maxle']);
}
// reqLevel min [int] // reqLevel min [int]
if (isset($_v['minrl'])) if (isset($_v['minrl']))
{ $parts[] = ['reqLevel', $_v['minrl'], '>='];
if (is_int($_v['minrl']) && $_v['minrl'] > 0)
$parts[] = ['reqLevel', $_v['minrl'], '>='];
else
unset($_v['minrl']);
}
// reqLevel max [int] // reqLevel max [int]
if (isset($_v['maxrl'])) if (isset($_v['maxrl']))
{ $parts[] = ['reqLevel', $_v['maxrl'], '<='];
if (is_int($_v['maxrl']) && $_v['maxrl'] > 0)
$parts[] = ['reqLevel', $_v['maxrl'], '<='];
else
unset($_v['maxrl']);
}
// class [enum] // class [enum]
if (isset($_v['cl'])) if (isset($_v['cl']))
{ $parts[] = ['classMask', $this->list2Mask([$_v['cl']]), '&'];
if (in_array($_v['cl'], [1, 2, 3, 4, 5, 6, 7, 8, 9, 11]))
$parts[] = ['classMask', $this->list2Mask($_v['cl']), '&'];
else
unset($_v['cl']);
}
// tag [enum] // tag [enum]
if (isset($_v['ta'])) if (isset($_v['ta']))
{ $parts[] = ['contentGroup', intVal($_v['ta'])];
if ($_v['ta'] > 0 && $_v['ta'] < 31)
$parts[] = ['contentGroup', intVal($_v['ta'])];
else
unset($_v['ta']);
}
return $parts; return $parts;
} }

View File

@@ -430,195 +430,64 @@ class QuestListFilter extends Filter
38 => [null, 1, 2, 3, 4, 5, 6, 7, 8, null, 10, 11, true, false], 38 => [null, 1, 2, 3, 4, 5, 6, 7, 8, null, 10, 11, true, false],
); );
protected $genericFilter = array( protected $genericFilter = array(
1 => [FILTER_CR_CALLBACK, 'cbReputation', '>', null], // increasesrepwith
2 => [FILTER_CR_NUMERIC, 'rewardXP', NUM_CAST_INT ], // experiencegained
3 => [FILTER_CR_NUMERIC, 'rewardOrReqMoney', NUM_CAST_INT ], // moneyrewarded
4 => [FILTER_CR_CALLBACK, 'cbSpellRewards', null, null], // spellrewarded [yn]
5 => [FILTER_CR_FLAG, 'flags', QUEST_FLAG_SHARABLE ], // sharable
6 => [FILTER_CR_NUMERIC, 'timeLimit', NUM_CAST_INT ], // timer
7 => [FILTER_CR_NYI_PH, null, 1 ], // firstquestseries
9 => [FILTER_CR_CALLBACK, 'cbEarnReputation', null, null], // objectiveearnrepwith [enum]
10 => [FILTER_CR_CALLBACK, 'cbReputation', '<', null], // decreasesrepwith
11 => [FILTER_CR_NUMERIC, 'suggestedPlayers', NUM_CAST_INT ], // suggestedplayers
15 => [FILTER_CR_NYI_PH, null, 1 ], // lastquestseries
16 => [FILTER_CR_NYI_PH, null, 1 ], // partseries
18 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_SCREENSHOT ], // hasscreenshots
19 => [FILTER_CR_CALLBACK, 'cbQuestRelation', 0x1, null], // startsfrom [enum]
21 => [FILTER_CR_CALLBACK, 'cbQuestRelation', 0x2, null], // endsat [enum]
22 => [FILTER_CR_CALLBACK, 'cbItemRewards', null, null], // itemrewards [op] [int]
23 => [FILTER_CR_CALLBACK, 'cbItemChoices', null, null], // itemchoices [op] [int]
24 => [FILTER_CR_CALLBACK, 'cbLacksStartEnd', null, null], // lacksstartend [yn]
25 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_COMMENT ], // hascomments
27 => [FILTER_CR_FLAG, 'flags', QUEST_FLAG_DAILY ], // daily 27 => [FILTER_CR_FLAG, 'flags', QUEST_FLAG_DAILY ], // daily
28 => [FILTER_CR_FLAG, 'flags', QUEST_FLAG_WEEKLY ], // weekly 28 => [FILTER_CR_FLAG, 'flags', QUEST_FLAG_WEEKLY ], // weekly
29 => [FILTER_CR_FLAG, 'flags', QUEST_FLAG_REPEATABLE ], // repeatable 29 => [FILTER_CR_FLAG, 'flags', QUEST_FLAG_REPEATABLE ], // repeatable
30 => [FILTER_CR_NUMERIC, 'id', null, true], // id 30 => [FILTER_CR_NUMERIC, 'id', NUM_CAST_INT, true], // id
5 => [FILTER_CR_FLAG, 'flags', QUEST_FLAG_SHARABLE ], // sharable 33 => [FILTER_CR_ENUM, 'e.holidayId' ], // relatedevent
11 => [FILTER_CR_NUMERIC, 'suggestedPlayers', ], // suggestedplayers 34 => [FILTER_CR_CALLBACK, 'cbAvailable', null, null], // availabletoplayers [yn]
6 => [FILTER_CR_NUMERIC, 'timeLimit', ], // timer
42 => [FILTER_CR_STAFFFLAG, 'flags', ], // flags
45 => [FILTER_CR_BOOLEAN, 'rewardTitleId', ], // titlerewarded
2 => [FILTER_CR_NUMERIC, 'rewardXP', ], // experiencegained
3 => [FILTER_CR_NUMERIC, 'rewardOrReqMoney', ], // moneyrewarded
33 => [FILTER_CR_ENUM, 'e.holidayId', ], // relatedevent
25 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_COMMENT ], // hascomments
18 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_SCREENSHOT ], // hasscreenshots
36 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_VIDEO ], // hasvideos 36 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_VIDEO ], // hasvideos
37 => [FILTER_CR_CALLBACK, 'cbClassSpec', null, null], // classspecific [enum]
37 => [FILTER_CR_CALLBACK, 'cbRaceSpec', null, null], // racespecific [enum]
42 => [FILTER_CR_STAFFFLAG, 'flags' ], // flags
43 => [FILTER_CR_CALLBACK, 'cbCurrencyReward', null, null], // currencyrewarded [enum]
44 => [FILTER_CR_CALLBACK, 'cbLoremaster', null, null], // countsforloremaster_stc [yn]
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
'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
'maxle' => [FILTER_V_RANGE, [1, 99], false], // max quest level
'minrl' => [FILTER_V_RANGE, [1, 99], false], // min required level
'maxrl' => [FILTER_V_RANGE, [1, 99], false], // max required level
'si' => [FILTER_V_LIST, [-2, -1, 1, 2, 3], false], // siede
'ty' => [FILTER_V_LIST, [0, 1, 21, 41, 62, [81, 85], 88, 89], true ] // type
); );
protected function createSQLForCriterium(&$cr) protected function createSQLForCriterium(&$cr)
{ {
if (in_array($cr[0], array_keys($this->genericFilter))) if (in_array($cr[0], array_keys($this->genericFilter)))
{
if ($genCr = $this->genericCriterion($cr)) if ($genCr = $this->genericCriterion($cr))
return $genCr; return $genCr;
unset($cr);
$this->error = true;
return [1];
}
switch ($cr[0])
{
case 1: // increasesrepwith
if ($this->isSaneNumeric($cr[1]) && $cr[1] > 0)
{
if ($_ = DB::Aowow()->selectRow('SELECT * FROM ?_factions WHERE id = ?d', $cr[1]))
$this->formData['reputationCols'][] = [$cr[1], Util::localizedString($_, 'name')];
return [
'OR',
['AND', ['rewardFactionId1', $cr[1]], ['rewardFactionValue1', 0, '>']],
['AND', ['rewardFactionId2', $cr[1]], ['rewardFactionValue2', 0, '>']],
['AND', ['rewardFactionId3', $cr[1]], ['rewardFactionValue3', 0, '>']],
['AND', ['rewardFactionId4', $cr[1]], ['rewardFactionValue4', 0, '>']],
['AND', ['rewardFactionId5', $cr[1]], ['rewardFactionValue5', 0, '>']]
];
}
break;
case 10: // decreasesrepwith
if ($this->isSaneNumeric($cr[1]) && $cr[1] > 0)
{
if ($_ = DB::Aowow()->selectRow('SELECT * FROM ?_factions WHERE id = ?d', $cr[1]))
$this->formData['reputationCols'][] = [$cr[1], Util::localizedString($_, 'name')];
return [
'OR',
['AND', ['rewardFactionId1', $cr[1]], ['rewardFactionValue1', 0, '<']],
['AND', ['rewardFactionId2', $cr[1]], ['rewardFactionValue2', 0, '<']],
['AND', ['rewardFactionId3', $cr[1]], ['rewardFactionValue3', 0, '<']],
['AND', ['rewardFactionId4', $cr[1]], ['rewardFactionValue4', 0, '<']],
['AND', ['rewardFactionId5', $cr[1]], ['rewardFactionValue5', 0, '<']]
];
}
break;
case 43: // currencyrewarded
if ($this->isSaneNumeric($cr[1]) && $cr[1] > 0)
{
return [
'OR',
['rewardItemId1', $cr[1]], ['rewardItemId2', $cr[1]], ['rewardItemId3', $cr[1]], ['rewardItemId4', $cr[1]],
['rewardChoiceItemId1', $cr[1]], ['rewardChoiceItemId2', $cr[1]], ['rewardChoiceItemId3', $cr[1]], ['rewardChoiceItemId4', $cr[1]], ['rewardChoiceItemId5', $cr[1]], ['rewardChoiceItemId6', $cr[1]]
];
}
break;
case 34: // availabletoplayers
if ($this->int2Bool($cr[1]))
{
if ($cr[1])
return [['cuFlags', CUSTOM_UNAVAILABLE | CUSTOM_DISABLED, '&'], 0];
else
return ['cuFlags', CUSTOM_UNAVAILABLE | CUSTOM_DISABLED, '&'];
}
break;
case 23: // itemchoices [op] [int]
if (!$this->isSaneNumeric($cr[2], false) || !$this->int2Op($cr[1]))
break;
$this->extraOpts['q']['s'][] = ', (IF(rewardChoiceItemId1, 1, 0) + IF(rewardChoiceItemId2, 1, 0) + IF(rewardChoiceItemId3, 1, 0) + IF(rewardChoiceItemId4, 1, 0) + IF(rewardChoiceItemId5, 1, 0) + IF(rewardChoiceItemId6, 1, 0)) as numChoices';
$this->extraOpts['q']['h'][] = 'numChoices '.$cr[1].' '.$cr[2];
return [1];
case 22: // itemrewards [op] [int]
if (!$this->isSaneNumeric($cr[2], false) || !$this->int2Op($cr[1]))
break;
$this->extraOpts['q']['s'][] = ', (IF(rewardItemId1, 1, 0) + IF(rewardItemId2, 1, 0) + IF(rewardItemId3, 1, 0) + IF(rewardItemId4, 1, 0)) as numRewards';
$this->extraOpts['q']['h'][] = 'numRewards '.$cr[1].' '.$cr[2];
return [1];
case 44: // countsforloremaster_stc [bool]
if ($this->int2Bool($cr[1]))
{
if ($cr[1])
return ['AND', ['zoneOrSort', 0, '>'], [['flags', QUEST_FLAG_DAILY | QUEST_FLAG_WEEKLY | QUEST_FLAG_REPEATABLE , '&'], 0], [['specialFlags', QUEST_FLAG_SPECIAL_REPEATABLE | QUEST_FLAG_SPECIAL_MONTHLY , '&'], 0]];
else
return ['OR', ['zoneOrSort', 0, '<'], ['flags', QUEST_FLAG_DAILY | QUEST_FLAG_WEEKLY | QUEST_FLAG_REPEATABLE , '&'], ['specialFlags', QUEST_FLAG_SPECIAL_REPEATABLE | QUEST_FLAG_SPECIAL_MONTHLY , '&']];;
}
break;
case 4: // spellrewarded [bool]
if ($this->int2Bool($cr[1]))
{
if ($cr[1])
return ['OR', ['sourceSpellId', 0, '>'], ['rewardSpell', 0, '>'], ['rsc.effect1Id', SpellList::$effects['teach']], ['rsc.effect2Id', SpellList::$effects['teach']], ['rsc.effect3Id', SpellList::$effects['teach']]];
else
return ['AND', ['sourceSpellId', 0], ['rewardSpell', 0], ['rewardSpellCast', 0]];
}
break;
case 9: // objectiveearnrepwith [enum]
$_ = intVal($cr[1]);
if ($_ > 0)
return ['OR', ['reqFactionId1', $_], ['reqFactionId2', $_]];
else 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]];
break;
case 37: // classspecific [enum]
$_ = isset($this->enums[$cr[0]][$cr[1]]) ? $this->enums[$cr[0]][$cr[1]] : null;
if ($_ !== null)
{
if ($_ === true)
return ['AND', ['reqClassMask', 0, '!'], [['reqClassMask', CLASS_MASK_ALL, '&'], CLASS_MASK_ALL, '!']];
else if ($_ === false)
return ['OR', ['reqClassMask', 0], [['reqClassMask', CLASS_MASK_ALL, '&'], CLASS_MASK_ALL]];
else if (is_int($_))
return ['AND', ['reqClassMask', (1 << ($_ - 1)), '&'], [['reqClassMask', CLASS_MASK_ALL, '&'], CLASS_MASK_ALL, '!']];
}
break;
case 38: // racespecific [enum]
$_ = isset($this->enums[$cr[0]][$cr[1]]) ? $this->enums[$cr[0]][$cr[1]] : null;
if ($_ !== null)
{
if ($_ === true)
return ['AND', ['reqRaceMask', 0, '!'], [['reqRaceMask', RACE_MASK_ALL, '&'], RACE_MASK_ALL, '!'], [['reqRaceMask', RACE_MASK_ALLIANCE, '&'], RACE_MASK_ALLIANCE, '!'], [['reqRaceMask', RACE_MASK_HORDE, '&'], RACE_MASK_HORDE, '!']];
else if ($_ === false)
return ['OR', ['reqRaceMask', 0], ['reqRaceMask', RACE_MASK_ALL], ['reqRaceMask', RACE_MASK_ALLIANCE], ['reqRaceMask', RACE_MASK_HORDE]];
else if (is_int($_))
return ['AND', ['reqRaceMask', (1 << ($_ - 1)), '&'], [['reqRaceMask', RACE_MASK_ALLIANCE, '&'], RACE_MASK_ALLIANCE, '!'], [['reqRaceMask', RACE_MASK_HORDE, '&'], RACE_MASK_HORDE, '!']];
}
break;
case 19: // startsfrom [enum]
switch ($cr[1])
{
case 1: // npc
return ['AND', ['qse.type', TYPE_NPC], ['qse.method', 0x1, '&']];
case 2: // object
return ['AND', ['qse.type', TYPE_OBJECT], ['qse.method', 0x1, '&']];
case 3: // item
return ['AND', ['qse.type', TYPE_ITEM], ['qse.method', 0x1, '&']];
}
break;
case 21: // endsat [enum]
switch ($cr[1])
{
case 1: // npc
return ['AND', ['qse.type', TYPE_NPC], ['qse.method', 0x2, '&']];
case 2: // object
return ['AND', ['qse.type', TYPE_OBJECT], ['qse.method', 0x2, '&']];
}
break;
case 24: // lacksstartend [bool]
$missing = DB::Aowow()->selectCol('SELECT questId, max(method) a, min(method) b FROM ?_quests_startend GROUP BY questId HAVING (a | b) <> 3');
if ($this->int2Bool($cr[1]))
{
if ($cr[1])
return ['id', $missing];
else
return ['id', $missing, '!'];
}
break;
case 7: // firstquestseries
case 15: // lastquestseries
case 16: // partseries
/* todo */ return [1]; // self-joining eats substential amounts of time: should restructure that and also incorporate reqQ and openQ cases from infobox
default:
break;
}
unset($cr); unset($cr);
$this->error = 1; $this->error = true;
return [1]; return [1];
} }
@@ -642,39 +511,19 @@ class QuestListFilter extends Filter
// level min // level min
if (isset($_v['minle'])) if (isset($_v['minle']))
{ $parts[] = ['level', $_v['minle'], '>=']; // not considering quests that are always at player level (-1)
if (is_int($_v['minle']) && $_v['minle'] > 0)
$parts[] = ['level', $_v['minle'], '>=']; // not considering quests that are always at player level (-1)
else
unset($_v['minle']);
}
// level max // level max
if (isset($_v['maxle'])) if (isset($_v['maxle']))
{ $parts[] = ['level', $_v['maxle'], '<='];
if (is_int($_v['maxle']) && $_v['maxle'] > 0)
$parts[] = ['level', $_v['maxle'], '<='];
else
unset($_v['maxle']);
}
// reqLevel min // reqLevel min
if (isset($_v['minrl'])) if (isset($_v['minrl']))
{ $parts[] = ['minLevel', $_v['minrl'], '>=']; // ignoring maxLevel
if (is_int($_v['minrl']) && $_v['minrl'] > 0)
$parts[] = ['minLevel', $_v['minrl'], '>='];// ignoring maxLevel
else
unset($_v['minrl']);
}
// reqLevel max // reqLevel max
if (isset($_v['maxrl'])) if (isset($_v['maxrl']))
{ $parts[] = ['minLevel', $_v['maxrl'], '<=']; // ignoring maxLevel
if (is_int($_v['maxrl']) && $_v['maxrl'] > 0)
$parts[] = ['minLevel', $_v['maxrl'], '<='];// ignoring maxLevel
else
unset($_v['maxrl']);
}
// side // side
if (isset($_v['si'])) if (isset($_v['si']))
@@ -699,23 +548,172 @@ class QuestListFilter extends Filter
case -1: case -1:
$parts[] = ['AND', $ex, ['reqRaceMask', RACE_MASK_ALLIANCE, '&']]; $parts[] = ['AND', $ex, ['reqRaceMask', RACE_MASK_ALLIANCE, '&']];
break; break;
default:
unset($_v['si']);
} }
} }
// type [list] // type [list]
if (isset($_v['ty'])) if (isset($_v['ty']))
{ $parts[] = ['type', $_v['ty']];
$_ = (array)$_v['ty'];
if (!array_diff($_, [0, 1, 21, 41, 62, 81, 82, 83, 84, 85, 88, 89]))
$parts[] = ['type', $_];
else
unset($_v['ty']);
}
return $parts; return $parts;
} }
protected function cbReputation($cr, $sign)
{
if (!Util::checkNumeric($cr[1], NUM_REQ_INT) || $cr[1] <= 0)
return false;
if ($_ = DB::Aowow()->selectRow('SELECT * FROM ?_factions WHERE id = ?d', $cr[1]))
$this->formData['reputationCols'][] = [$cr[1], Util::localizedString($_, 'name')];
return [
'OR',
['AND', ['rewardFactionId1', $cr[1]], ['rewardFactionValue1', 0, $sign]],
['AND', ['rewardFactionId2', $cr[1]], ['rewardFactionValue2', 0, $sign]],
['AND', ['rewardFactionId3', $cr[1]], ['rewardFactionValue3', 0, $sign]],
['AND', ['rewardFactionId4', $cr[1]], ['rewardFactionValue4', 0, $sign]],
['AND', ['rewardFactionId5', $cr[1]], ['rewardFactionValue5', 0, $sign]]
];
}
protected function cbQuestRelation($cr, $flags)
{
switch ($cr[1])
{
case 1: // npc
return ['AND', ['qse.type', TYPE_NPC], ['qse.method', $flags, '&']];
case 2: // object
return ['AND', ['qse.type', TYPE_OBJECT], ['qse.method', $flags, '&']];
case 3: // item
return ['AND', ['qse.type', TYPE_ITEM], ['qse.method', $flags, '&']];
}
return false;
}
protected function cbCurrencyReward($cr)
{
if (!Util::checkNumeric($cr[1], NUM_REQ_INT) || $cr[1] <= 0)
return false;
return [
'OR',
['rewardItemId1', $cr[1]], ['rewardItemId2', $cr[1]], ['rewardItemId3', $cr[1]], ['rewardItemId4', $cr[1]],
['rewardChoiceItemId1', $cr[1]], ['rewardChoiceItemId2', $cr[1]], ['rewardChoiceItemId3', $cr[1]], ['rewardChoiceItemId4', $cr[1]], ['rewardChoiceItemId5', $cr[1]], ['rewardChoiceItemId6', $cr[1]]
];
}
protected function cbAvailable($cr)
{
if (!$this->int2Bool($cr[1]))
return false;
if ($cr[1])
return [['cuFlags', CUSTOM_UNAVAILABLE | CUSTOM_DISABLED, '&'], 0];
else
return ['cuFlags', CUSTOM_UNAVAILABLE | CUSTOM_DISABLED, '&'];
}
protected function cbItemChoices($cr)
{
if (!Util::checkNumeric($cr[2], NUM_CAST_INT) || !$this->int2Op($cr[1]))
return false;
$this->extraOpts['q']['s'][] = ', (IF(rewardChoiceItemId1, 1, 0) + IF(rewardChoiceItemId2, 1, 0) + IF(rewardChoiceItemId3, 1, 0) + IF(rewardChoiceItemId4, 1, 0) + IF(rewardChoiceItemId5, 1, 0) + IF(rewardChoiceItemId6, 1, 0)) as numChoices';
$this->extraOpts['q']['h'][] = 'numChoices '.$cr[1].' '.$cr[2];
return [1];
}
protected function cbItemRewards($cr)
{
if (!Util::checkNumeric($cr[2], NUM_CAST_INT) || !$this->int2Op($cr[1]))
return false;
$this->extraOpts['q']['s'][] = ', (IF(rewardItemId1, 1, 0) + IF(rewardItemId2, 1, 0) + IF(rewardItemId3, 1, 0) + IF(rewardItemId4, 1, 0)) as numRewards';
$this->extraOpts['q']['h'][] = 'numRewards '.$cr[1].' '.$cr[2];
return [1];
}
protected function cbLoremaster($cr)
{
if (!$this->int2Bool($cr[1]))
return false;
if ($cr[1])
return ['AND', ['zoneOrSort', 0, '>'], [['flags', QUEST_FLAG_DAILY | QUEST_FLAG_WEEKLY | QUEST_FLAG_REPEATABLE , '&'], 0], [['specialFlags', QUEST_FLAG_SPECIAL_REPEATABLE | QUEST_FLAG_SPECIAL_MONTHLY , '&'], 0]];
else
return ['OR', ['zoneOrSort', 0, '<'], ['flags', QUEST_FLAG_DAILY | QUEST_FLAG_WEEKLY | QUEST_FLAG_REPEATABLE , '&'], ['specialFlags', QUEST_FLAG_SPECIAL_REPEATABLE | QUEST_FLAG_SPECIAL_MONTHLY , '&']];;
}
protected function cbSpellRewards($cr)
{
if (!$this->int2Bool($cr[1]))
return false;
if ($cr[1])
return ['OR', ['sourceSpellId', 0, '>'], ['rewardSpell', 0, '>'], ['rsc.effect1Id', SpellList::$effects['teach']], ['rsc.effect2Id', SpellList::$effects['teach']], ['rsc.effect3Id', SpellList::$effects['teach']]];
else
return ['AND', ['sourceSpellId', 0], ['rewardSpell', 0], ['rewardSpellCast', 0]];
}
protected function cbEarnReputation($cr)
{
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
return ['OR', ['reqFactionId1', 0, '>'], ['reqFactionId2', 0, '>']];
else if ($cr[1] == FILTER_ENUM_NONE) // none
return ['AND', ['reqFactionId1', 0], ['reqFactionId2', 0]];
return false;
}
protected function cbClassSpec($cr)
{
if (!isset($this->enums[$cr[0]][$cr[1]]))
return false;
$_ = $this->enums[$cr[0]][$cr[1]];
if ($_ === true)
return ['AND', ['reqClassMask', 0, '!'], [['reqClassMask', CLASS_MASK_ALL, '&'], CLASS_MASK_ALL, '!']];
else if ($_ === false)
return ['OR', ['reqClassMask', 0], [['reqClassMask', CLASS_MASK_ALL, '&'], CLASS_MASK_ALL]];
else if (is_int($_))
return ['AND', ['reqClassMask', (1 << ($_ - 1)), '&'], [['reqClassMask', CLASS_MASK_ALL, '&'], CLASS_MASK_ALL, '!']];
return false;
}
protected function cbRaceSpec($cr)
{
if (!isset($this->enums[$cr[0]][$cr[1]]))
return false;
$_ = $this->enums[$cr[0]][$cr[1]];
if ($_ === true)
return ['AND', ['reqRaceMask', 0, '!'], [['reqRaceMask', RACE_MASK_ALL, '&'], RACE_MASK_ALL, '!'], [['reqRaceMask', RACE_MASK_ALLIANCE, '&'], RACE_MASK_ALLIANCE, '!'], [['reqRaceMask', RACE_MASK_HORDE, '&'], RACE_MASK_HORDE, '!']];
else if ($_ === false)
return ['OR', ['reqRaceMask', 0], ['reqRaceMask', RACE_MASK_ALL], ['reqRaceMask', RACE_MASK_ALLIANCE], ['reqRaceMask', RACE_MASK_HORDE]];
else if (is_int($_))
return ['AND', ['reqRaceMask', (1 << ($_ - 1)), '&'], [['reqRaceMask', RACE_MASK_ALLIANCE, '&'], RACE_MASK_ALLIANCE, '!'], [['reqRaceMask', RACE_MASK_HORDE, '&'], RACE_MASK_HORDE, '!']];
return false;
}
protected function cbLacksStartEnd($cr)
{
if (!$this->int2Bool($cr[1]))
return false;
$missing = DB::Aowow()->selectCol('SELECT questId, max(method) a, min(method) b FROM ?_quests_startend GROUP BY questId HAVING (a | b) <> 3');
if ($cr[1])
return ['id', $missing];
else
return ['id', $missing, '!'];
}
} }

View File

@@ -109,6 +109,12 @@ class SoundListFilter extends Filter
return [1]; return [1];
} }
// fieldId => [checkType, checkValue[, fieldIsArray]]
protected $inputFields = array(
'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
);
protected function createSQLForValues() protected function createSQLForValues()
{ {
$parts = []; $parts = [];
@@ -121,15 +127,7 @@ class SoundListFilter extends Filter
// type [list] // type [list]
if (isset($_v['ty'])) if (isset($_v['ty']))
{ $parts[] = ['cat', $_v['ty']];
if ($_ = array_intersect((array)$_v['ty'], [1, 2, 3, 4, 6, 9, 10, 12, 13, 14, 16, 17, 19, 20, 21, 22, 23, 25, 26, 27, 28, 29, 30, 31, 50, 52, 53]))
$parts[] = ['cat', $_];
else
{
$this->error = true;
unset($_v['ty']);
}
}
return $parts; return $parts;
} }

View File

@@ -2159,66 +2159,51 @@ class SpellListFilter extends Filter
// cr => [type, field, misc, extraCol] // cr => [type, field, misc, extraCol]
protected $genericFilter = array( // misc (bool): _NUMERIC => useFloat; _STRING => localized; _FLAG => match Value; _BOOLEAN => stringSet protected $genericFilter = array( // misc (bool): _NUMERIC => useFloat; _STRING => localized; _FLAG => match Value; _BOOLEAN => stringSet
2 => [FILTER_CR_NUMERIC, 'powerCostPercent', ], // prcntbasemanarequired 1 => [FILTER_CR_CALLBACK, 'cbCost', null, null], // costAbs [op] [int]
3 => [FILTER_CR_BOOLEAN, 'spellFocusObject' ], // requiresnearbyobject 2 => [FILTER_CR_NUMERIC, 'powerCostPercent', NUM_CAST_INT ], // prcntbasemanarequired
4 => [FILTER_CR_NUMERIC, 'trainingcost' ], // trainingcost 3 => [FILTER_CR_BOOLEAN, 'spellFocusObject' ], // requiresnearbyobject
5 => [FILTER_CR_BOOLEAN, 'reqSpellId' ], // requiresprofspec 4 => [FILTER_CR_NUMERIC, 'trainingcost', NUM_CAST_INT ], // trainingcost
10 => [FILTER_CR_FLAG, 'cuFlags', SPELL_CU_FIRST_RANK ], // firstrank 5 => [FILTER_CR_BOOLEAN, 'reqSpellId' ], // requiresprofspec
12 => [FILTER_CR_FLAG, 'cuFlags', SPELL_CU_LAST_RANK ], // lastrank 8 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_SCREENSHOT ], // hasscreenshots
13 => [FILTER_CR_NUMERIC, 'rankNo', ], // rankno 9 => [FILTER_CR_CALLBACK, 'cbSource', null, null], // source [enum]
14 => [FILTER_CR_NUMERIC, 'id', null, true], // id 10 => [FILTER_CR_FLAG, 'cuFlags', SPELL_CU_FIRST_RANK ], // firstrank
15 => [FILTER_CR_STRING, 'ic.name', ], // icon 11 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_COMMENT ], // hascomments
19 => [FILTER_CR_FLAG, 'attributes0', 0x80000 ], // scaling 12 => [FILTER_CR_FLAG, 'cuFlags', SPELL_CU_LAST_RANK ], // lastrank
25 => [FILTER_CR_BOOLEAN, 'skillLevelYellow' ], // rewardsskillups 13 => [FILTER_CR_NUMERIC, 'rankNo', NUM_CAST_INT ], // rankno
11 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_COMMENT ], // hascomments 14 => [FILTER_CR_NUMERIC, 'id', NUM_CAST_INT, true], // id
8 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_SCREENSHOT ], // hasscreenshots 15 => [FILTER_CR_STRING, 'ic.name', ], // icon
17 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_VIDEO ], // hasvideos 17 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_VIDEO ], // hasvideos
19 => [FILTER_CR_FLAG, 'attributes0', 0x80000 ], // scaling
20 => [FILTER_CR_CALLBACK, 'cbReagents', null, null], // has Reagents [yn]
25 => [FILTER_CR_BOOLEAN, 'skillLevelYellow' ] // rewardsskillups
);
// fieldId => [checkType, checkValue[, fieldIsArray]]
protected $inputFields = array(
'cr' => [FILTER_V_RANGE, [1, 25], 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
'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
'maxle' => [FILTER_V_RANGE, [1, 99], false], // spell level max
'minrs' => [FILTER_V_RANGE, [1, 999], false], // required skill level min
'maxrs' => [FILTER_V_RANGE, [1, 999], false], // required skill level max
'ra' => [FILTER_V_LIST, [[1, 8], 10, 11], false], // races
'cl' => [FILTER_V_CALLBACK, 'cbClasses', true ], // classes
'gl' => [FILTER_V_CALLBACK, 'cbGlyphs', true ], // glyph type
'sc' => [FILTER_V_RANGE, [0, 6], true ], // magic schools
'dt' => [FILTER_V_LIST, [[1, 6], 9], false], // dispel types
'me' => [FILTER_V_RANGE, [1, 31], false] // mechanics
); );
protected function createSQLForCriterium(&$cr) protected function createSQLForCriterium(&$cr)
{ {
if (in_array($cr[0], array_keys($this->genericFilter))) if (in_array($cr[0], array_keys($this->genericFilter)))
{
if ($genCr = $this->genericCriterion($cr)) if ($genCr = $this->genericCriterion($cr))
return $genCr; return $genCr;
unset($cr);
$this->error = true;
return [1];
}
switch ($cr[0])
{
case 1: // costAbs [op] [int]
if (!$this->isSaneNumeric($cr[2]))
break;
if (!$this->int2Op($cr[1]))
break;
return ['OR', ['AND', ['powerType', [1, 6]], ['powerCost', (10 * $cr[2]), $cr[1]]], ['AND', ['powerType', [1, 6], '!'], ['powerCost', $cr[2], $cr[1]]]];
case 9: // source [enum]
$_ = isset($this->enums[$cr[0]][$cr[1]]) ? $this->enums[$cr[0]][$cr[1]] : null;
if ($_ !== null)
{
if (is_int($_)) // specific
return ['src.src'.$_, null, '!'];
else if ($_) // any
return ['OR', ['src.src1', null, '!'], ['src.src2', null, '!'], ['src.src4', null, '!'], ['src.src5', null, '!'], ['src.src6', null, '!'], ['src.src7', null, '!'], ['src.src9', null, '!']];
else if (!$_) // none
return ['AND', ['src.src1', null], ['src.src2', null], ['src.src4', null], ['src.src5', null], ['src.src6', null], ['src.src7', null], ['src.src9', null]];
}
break;
case 20: // has Reagents [yn]
if ($this->int2Bool($cr[1]))
{
if ($cr[1])
return ['OR', ['reagent1', 0, '>'], ['reagent2', 0, '>'], ['reagent3', 0, '>'], ['reagent4', 0, '>'], ['reagent5', 0, '>'], ['reagent6', 0, '>'], ['reagent7', 0, '>'], ['reagent8', 0, '>']];
else
return ['AND', ['reagent1', 0], ['reagent2', 0], ['reagent3', 0], ['reagent4', 0], ['reagent5', 0], ['reagent6', 0], ['reagent7', 0], ['reagent8', 0]];
}
}
unset($cr); unset($cr);
$this->error = true; $this->error = true;
return [1]; return [1];
@@ -2244,98 +2229,109 @@ class SpellListFilter extends Filter
// spellLevel min todo (low): talentSpells (typeCat -2) commonly have spellLevel 1 (and talentLevel >1) -> query is inaccurate // spellLevel min todo (low): talentSpells (typeCat -2) commonly have spellLevel 1 (and talentLevel >1) -> query is inaccurate
if (isset($_v['minle'])) if (isset($_v['minle']))
{ $parts[] = ['spellLevel', $_v['minle'], '>='];
if (is_int($_v['minle']) && $_v['minle'] > 0)
$parts[] = ['spellLevel', $_v['minle'], '>='];
else
unset($_v['minle']);
}
// spellLevel max // spellLevel max
if (isset($_v['maxle'])) if (isset($_v['maxle']))
{ $parts[] = ['spellLevel', $_v['maxle'], '<='];
if (is_int($_v['maxle']) && $_v['maxle'] > 0)
$parts[] = ['spellLevel', $_v['maxle'], '<='];
else
unset($_v['maxle']);
}
// skillLevel min // skillLevel min
if (isset($_v['minrs'])) if (isset($_v['minrs']))
{ $parts[] = ['learnedAt', $_v['minrs'], '>='];
if (is_int($_v['minrs']) && $_v['minrs'] > 0)
$parts[] = ['learnedAt', $_v['minrs'], '>='];
else
unset($_v['minrs']);
}
// skillLevel max // skillLevel max
if (isset($_v['maxrs'])) if (isset($_v['maxrs']))
{ $parts[] = ['learnedAt', $_v['maxrs'], '<='];
if (is_int($_v['maxrs']) && $_v['maxrs'] > 0)
$parts[] = ['learnedAt', $_v['maxrs'], '<='];
else
unset($_v['maxrs']);
}
// race // race
if (isset($_v['ra'])) if (isset($_v['ra']))
{ $parts[] = ['AND', [['reqRaceMask', RACE_MASK_ALL, '&'], RACE_MASK_ALL, '!'], ['reqRaceMask', $this->list2Mask([$_v['ra']]), '&']];
if (in_array($_v['ra'], [1, 2, 3, 4, 5, 6, 7, 8, 10, 11]))
$parts[] = ['AND', [['reqRaceMask', RACE_MASK_ALL, '&'], RACE_MASK_ALL, '!'], ['reqRaceMask', $this->list2Mask($_v['ra']), '&']];
else
unset($_v['ra']);
}
// class [list] // class [list]
if (isset($_v['cl'])) if (isset($_v['cl']))
{ $parts[] = ['reqClassMask', $this->list2Mask($_v['cl']), '&'];
$_ = (array)$_v['cl'];
if (!array_diff($_, [1, 2, 3, 4, 5, 6, 7, 8, 9, 11]))
$parts[] = ['reqClassMask', $this->list2Mask($_), '&'];
else
unset($_v['cl']);
}
// school [list] // school [list]
if (isset($_v['sc'])) if (isset($_v['sc']))
{ $parts[] = ['schoolMask', $this->list2Mask($_v['sc'], true), '&'];
$_ = (array)$_v['sc'];
if (!array_diff($_, [0, 1, 2, 3, 4, 5, 6]))
$parts[] = ['schoolMask', $this->list2Mask($_, true), '&'];
else
unset($_v['sc']);
}
// glyph type [list] wonky, admittedly, but consult SPELL_CU_* in defines and it makes sense // glyph type [list] wonky, admittedly, but consult SPELL_CU_* in defines and it makes sense
if (isset($_v['gl'])) if (isset($_v['gl']))
{ $parts[] = ['cuFlags', ($this->list2Mask($_v['gl']) << 6), '&'];
if (in_array($_v['gl'], [1, 2]))
$parts[] = ['cuFlags', ($this->list2Mask($_v['gl']) << 6), '&'];
else
unset($_v['gl']);
}
// dispel type // dispel type
if (isset($_v['dt'])) if (isset($_v['dt']))
{ $parts[] = ['dispelType', $_v['dt']];
if (in_array($_v['dt'], [1, 2, 3, 4, 5, 6, 9]))
$parts[] = ['dispelType', $_v['dt']];
else
unset($_v['dt']);
}
// mechanic // mechanic
if (isset($_v['me'])) if (isset($_v['me']))
{ $parts[] = ['OR', ['mechanic', $_v['me']], ['effect1Mechanic', $_v['me']], ['effect2Mechanic', $_v['me']], ['effect3Mechanic', $_v['me']]];
if ($_v['me'] > 0 && $_v['me'] < 32)
$parts[] = ['OR', ['mechanic', $_v['me']], ['effect1Mechanic', $_v['me']], ['effect2Mechanic', $_v['me']], ['effect3Mechanic', $_v['me']]];
else
unset($_v['me']);
}
return $parts; return $parts;
} }
protected function cbClasses(&$val)
{
if (!$this->parentCats || !in_array($this->parentCats[0], [-13, -2, 7]))
return false;
if (!Util::checkNumeric($val, NUM_REQ_INT))
return false;
$type = FILTER_V_LIST;
$valid = [[1, 9], 11];
return $this->checkInput($type, $valid, $val);
}
protected function cbGlyphs(&$val)
{
if (!$this->parentCats || $this->parentCats[0] != -13)
return false;
if (!Util::checkNumeric($val, NUM_REQ_INT))
return false;
$type = FILTER_V_LIST;
$valid = [1, 2];
return $this->checkInput($type, $valid, $val);
}
protected function cbCost($cr)
{
if (!Util::checkNumeric($cr[2], NUM_CAST_INT) || !$this->int2Op($cr[1]))
return false;
return ['OR', ['AND', ['powerType', [1, 6]], ['powerCost', (10 * $cr[2]), $cr[1]]], ['AND', ['powerType', [1, 6], '!'], ['powerCost', $cr[2], $cr[1]]]];
}
protected function cbSource($cr)
{
if (!isset($this->enums[$cr[0]][$cr[1]]))
return false;
$_ = $this->enums[$cr[0]][$cr[1]];
if (is_int($_)) // specific
return ['src.src'.$_, null, '!'];
else if ($_) // any
return ['OR', ['src.src1', null, '!'], ['src.src2', null, '!'], ['src.src4', null, '!'], ['src.src5', null, '!'], ['src.src6', null, '!'], ['src.src7', null, '!'], ['src.src9', null, '!']];
else if (!$_) // none
return ['AND', ['src.src1', null], ['src.src2', null], ['src.src4', null], ['src.src5', null], ['src.src6', null], ['src.src7', null], ['src.src9', null]];
return false;
}
protected function cbReagents($cr)
{
if (!$this->int2Bool($cr[1]))
return false;
if ($cr[1])
return ['OR', ['reagent1', 0, '>'], ['reagent2', 0, '>'], ['reagent3', 0, '>'], ['reagent4', 0, '>'], ['reagent5', 0, '>'], ['reagent6', 0, '>'], ['reagent7', 0, '>'], ['reagent8', 0, '>']];
else
return ['AND', ['reagent1', 0], ['reagent2', 0], ['reagent3', 0], ['reagent4', 0], ['reagent5', 0], ['reagent6', 0], ['reagent7', 0], ['reagent8', 0]];
}
} }
?> ?>

View File

@@ -96,7 +96,6 @@ class Util
public static $tryFilteringString = '$$WH.sprintf(%s, %s, %s) + LANG.dash + LANG.lvnote_tryfiltering.replace(\'<a>\', \'<a href="javascript:;" onclick="fi_toggle()">\')'; public static $tryFilteringString = '$$WH.sprintf(%s, %s, %s) + LANG.dash + LANG.lvnote_tryfiltering.replace(\'<a>\', \'<a href="javascript:;" onclick="fi_toggle()">\')';
public static $tryFilteringEntityString = '$$WH.sprintf(LANG.lvnote_entitiesfound, %s, %s, %s) + LANG.dash + LANG.lvnote_tryfiltering.replace(\'<a>\', \'<a href="javascript:;" onclick="fi_toggle()">\')'; public static $tryFilteringEntityString = '$$WH.sprintf(LANG.lvnote_entitiesfound, %s, %s, %s) + LANG.dash + LANG.lvnote_tryfiltering.replace(\'<a>\', \'<a href="javascript:;" onclick="fi_toggle()">\')';
public static $tryNarrowingString = '$$WH.sprintf(%s, %s, %s) + LANG.dash + LANG.lvnote_trynarrowing'; public static $tryNarrowingString = '$$WH.sprintf(%s, %s, %s) + LANG.dash + LANG.lvnote_trynarrowing';
public static $setCriteriaString = "fi_setCriteria(%s, %s, %s);\n";
public static $dfnString = '<dfn title="%s" class="w">%s</dfn>'; public static $dfnString = '<dfn title="%s" class="w">%s</dfn>';
@@ -496,31 +495,37 @@ class Util
} }
// note: valid integer > 32bit are returned as float // note: valid integer > 32bit are returned as float
public static function checkNumeric(&$data) public static function checkNumeric(&$data, $typeCast = NUM_ANY)
{ {
if ($data === null) if ($data === null)
return false; return false;
else if (!is_array($data)) else if (!is_array($data))
{ {
$data = trim($data); $data = trim($data);
if (preg_match('/^-?\d*,\d+$/', $data))
$data = strtr($data, ',', '.');
if (is_numeric($data)) if (is_numeric($data))
{ {
$data += 0; $data += 0; // becomes float or int
return true;
} if ((is_float($data) && $typeCast == NUM_REQ_INT) ||
else if (preg_match('/^\d*,\d+$/', $data)) (is_int($data) && $typeCast == NUM_REQ_FLOAT))
{ return false;
$data = floatVal(strtr($data, ',', '.'));
if (is_float($data) && $typeCast == NUM_CAST_INT)
$data = intval($data);
if (is_int($data) && $typeCast == NUM_CAST_FLOAT)
$data = floatval($data);
return true; return true;
} }
return false; return false;
} }
array_walk($data, function(&$item, $key) { array_walk($data, function(&$x) use($typeCast) { self::checkNumeric($x, $typeCast); });
self::checkNumeric($item);
});
return false; // always false for passed arrays return false; // always false for passed arrays
} }

View File

@@ -82,7 +82,7 @@ switch ($pageCall)
case 'cookie': // lossless cookies and user settings case 'cookie': // lossless cookies and user settings
case 'contactus': case 'contactus':
case 'comment': case 'comment':
// case 'filter': // just a note: this would be accessed from filtrable pages as ?filter=typeStr (with POST-data) and forwards back to page with GET-data .. why? Hell if i know.. case 'filter': // pre-evaluate filter POST-data; sanitize and forward as GET-data
case 'go-to-comment': // find page the comment is on and forward case 'go-to-comment': // find page the comment is on and forward
case 'locale': // subdomain-workaround, change the language case 'locale': // subdomain-workaround, change the language
$cleanName = str_replace(['-', '_'], '', ucFirst($altClass ?: $pageCall)); $cleanName = str_replace(['-', '_'], '', ucFirst($altClass ?: $pageCall));

View File

@@ -42,8 +42,8 @@ class AchievementsPage extends GenericPage
public function __construct($pageCall, $pageParam) public function __construct($pageCall, $pageParam)
{ {
$this->filterObj = new AchievementListFilter();
$this->getCategoryFromUrl($pageParam); $this->getCategoryFromUrl($pageParam);
$this->filterObj = new AchievementListFilter(false, $this->category);
parent::__construct($pageCall, $pageParam); parent::__construct($pageCall, $pageParam);
@@ -63,9 +63,12 @@ class AchievementsPage extends GenericPage
$conditions[] = ['category', (int)end($this->category)]; $conditions[] = ['category', (int)end($this->category)];
// recreate form selection // recreate form selection
$this->filter = $this->filterObj->getForm('form'); $this->filter = $this->filterObj->getForm();
$this->filter['query'] = isset($_GET['filter']) ? $_GET['filter'] : null; $this->filter['query'] = isset($_GET['filter']) ? $_GET['filter'] : null;
$this->filter['fi'] = $this->filterObj->getForm(); $this->filter['initData'] = ['init' => 'achievements'];
if ($x = $this->filterObj->getSetCriteria())
$this->filter['initData']['sc'] = $x;
if ($fiCnd = $this->filterObj->getConditions()) if ($fiCnd = $this->filterObj->getConditions())
$conditions[] = $fiCnd; $conditions[] = $fiCnd;

View File

@@ -19,8 +19,8 @@ class EnchantmentsPage extends GenericPage
public function __construct($pageCall, $pageParam) public function __construct($pageCall, $pageParam)
{ {
$this->filterObj = new EnchantmentListFilter();
$this->getCategoryFromUrl($pageParam);; $this->getCategoryFromUrl($pageParam);;
$this->filterObj = new EnchantmentListFilter(false, ['parentCats' => $this->category]);
parent::__construct($pageCall, $pageParam); parent::__construct($pageCall, $pageParam);
@@ -49,11 +49,14 @@ class EnchantmentsPage extends GenericPage
$this->extendGlobalData($ench->getJSGlobals()); $this->extendGlobalData($ench->getJSGlobals());
// recreate form selection // recreate form selection
$this->filter = array_merge($this->filterObj->getForm('form'), $this->filter); $this->filter = $this->filterObj->getForm();
$this->filter['query'] = isset($_GET['filter']) ? $_GET['filter'] : NULL; $this->filter['query'] = isset($_GET['filter']) ? $_GET['filter'] : NULL;
$this->filter['fi'] = $this->filterObj->getForm(); $this->filter['initData'] = ['init' => 'enchantments'];
$xCols = $this->filterObj->getForm('extraCols', true); if ($x = $this->filterObj->getSetCriteria())
$this->filter['initData']['sc'] = $x;
$xCols = $this->filterObj->getExtraCols();
foreach (Util::$itemFilter as $fiId => $str) foreach (Util::$itemFilter as $fiId => $str)
if (array_column($tabData['data'], $str)) if (array_column($tabData['data'], $str))
$xCols[] = $fiId; $xCols[] = $fiId;
@@ -62,9 +65,9 @@ class EnchantmentsPage extends GenericPage
$xCols[] = 34; $xCols[] = 34;
if ($xCols) if ($xCols)
$this->filter['fi']['extraCols'] = "fi_extraCols = ".Util::toJSON(array_values(array_unique($xCols))).";"; $this->filter['initData']['ec'] = array_values(array_unique($xCols));
if (!empty($this->filter['fi']['extraCols'])) if ($xCols)
$tabData['extraCols'] = '$fi_getExtraCols(fi_extraCols, 0, 0)'; $tabData['extraCols'] = '$fi_getExtraCols(fi_extraCols, 0, 0)';
if ($ench->getMatches() > CFG_SQL_LIMIT_DEFAULT) if ($ench->getMatches() > CFG_SQL_LIMIT_DEFAULT)

View File

@@ -48,9 +48,12 @@ class IconsPage extends GenericPage
$this->extendGlobalData($icons->getJSGlobals()); $this->extendGlobalData($icons->getJSGlobals());
// recreate form selection // recreate form selection
$this->filter = array_merge($this->filterObj->getForm('form'), $this->filter); $this->filter = $this->filterObj->getForm();
$this->filter['query'] = isset($_GET['filter']) ? $_GET['filter'] : null; $this->filter['query'] = isset($_GET['filter']) ? $_GET['filter'] : null;
$this->filter['fi'] = $this->filterObj->getForm(); $this->filter['initData'] = ['init' => 'icons'];
if ($x = $this->filterObj->getSetCriteria())
$this->filter['initData']['sc'] = $x;
if ($icons->getMatches() > $sqlLimit) if ($icons->getMatches() > $sqlLimit)
{ {
@@ -66,7 +69,7 @@ class IconsPage extends GenericPage
protected function generateTitle() protected function generateTitle()
{ {
$setCrt = $this->filterObj->getForm('setCriteria', true); $setCrt = $this->filterObj->getSetCriteria();
$title = $this->name; $title = $this->name;
if (isset($setCrt['cr']) && count($setCrt['cr']) == 1) if (isset($setCrt['cr']) && count($setCrt['cr']) == 1)
{ {
@@ -98,7 +101,7 @@ class IconsPage extends GenericPage
protected function generatePath() protected function generatePath()
{ {
$setCrt = $this->filterObj->getForm('setCriteria', true); $setCrt = $this->filterObj->getSetCriteria();
if (isset($setCrt['cr']) && count($setCrt['cr']) == 1) if (isset($setCrt['cr']) && count($setCrt['cr']) == 1)
$this->path[] = $setCrt['cr'][0]; $this->path[] = $setCrt['cr'][0];
} }

View File

@@ -81,13 +81,14 @@ class ItemsPage extends GenericPage
public function __construct($pageCall, $pageParam) public function __construct($pageCall, $pageParam)
{ {
$this->filterObj = new ItemListFilter();
$this->getCategoryFromUrl($pageParam); $this->getCategoryFromUrl($pageParam);
$this->filterObj = new ItemListFilter(false, ['parentCats' => $this->category]);
parent::__construct($pageCall, $pageParam); parent::__construct($pageCall, $pageParam);
$this->name = Util::ucFirst(Lang::game('items')); $this->name = Util::ucFirst(Lang::game('items'));
$this->subCat = $pageParam !== NULL ? '='.$pageParam : ''; $this->subCat = $pageParam !== null ? '='.$pageParam : '';
} }
protected function generateContent() protected function generateContent()
@@ -107,9 +108,19 @@ class ItemsPage extends GenericPage
if ($_ = $this->filterObj->getConditions()) if ($_ = $this->filterObj->getConditions())
$conditions[] = $_; $conditions[] = $_;
$this->filter = array_merge($this->filterObj->getForm('form'), $this->filter); $this->filter = $this->filterObj->getForm();
$this->filter['query'] = isset($_GET['filter']) ? $_GET['filter'] : null; $this->filter['query'] = isset($_GET['filter']) ? $_GET['filter'] : null;
$this->filter['fi'] = $this->filterObj->getForm(); $this->filter['initData'] = ['init' => 'items'];
if ($x = $this->filterObj->getSetCriteria())
$this->filter['initData']['sc'] = $x;
$xCols = $this->filterObj->getExtraCols();
if ($xCols)
$this->filter['initData']['ec'] = $xCols;
if ($x = $this->filterObj->getSetWeights())
$this->filter['initData']['sw'] = $x;
$menu = $this->createExtraMenus(); $menu = $this->createExtraMenus();
foreach ($menu['type'][0] as $k => $str) foreach ($menu['type'][0] as $k => $str)
@@ -123,13 +134,12 @@ class ItemsPage extends GenericPage
if (isset($this->filter['slot'][INVTYPE_SHIELD])) // "Off Hand" => "Shield" if (isset($this->filter['slot'][INVTYPE_SHIELD])) // "Off Hand" => "Shield"
$this->filter['slot'][INVTYPE_SHIELD] = Lang::item('armorSubClass', 6); $this->filter['slot'][INVTYPE_SHIELD] = Lang::item('armorSubClass', 6);
$xCols = $this->filterObj->getForm('extraCols', true);
$infoMask = ITEMINFO_JSON; $infoMask = ITEMINFO_JSON;
if (array_intersect([63, 64, 125], $xCols)) // 63:buyPrice; 64:sellPrice; 125:reqarenartng if (array_intersect([63, 64, 125], $xCols)) // 63:buyPrice; 64:sellPrice; 125:reqarenartng
$infoMask |= ITEMINFO_VENDOR; $infoMask |= ITEMINFO_VENDOR;
if (!empty($this->filter['fi']['extraCols'])) if ($xCols)
$this->sharedLV['extraCols'] = '$fi_getExtraCols(fi_extraCols, '.(isset($this->filter['gm']) ? $this->filter['gm'] : 0).', '.(array_intersect([63], $xCols) ? 1 : 0).')'; $this->sharedLV['extraCols'] = '$fi_getExtraCols(fi_extraCols, '.(isset($this->filter['gm']) ? $this->filter['gm'] : 0).', '.(array_intersect([63], $xCols) ? 1 : 0).')';
if ($this->filterObj->error) if ($this->filterObj->error)
@@ -157,7 +167,7 @@ class ItemsPage extends GenericPage
/*************************/ /*************************/
$upgItemData = []; $upgItemData = [];
if (!empty($this->filter['upg']) && !empty($this->filter['fi']['setWeights'])) if (!empty($this->filter['upg']) && !empty($this->filterObj->getSetWeights()))
{ {
$upgItems = new ItemList(array(['id', array_keys($this->filter['upg'])]), ['extraOpts' => $this->filterObj->extraOpts]); $upgItems = new ItemList(array(['id', array_keys($this->filter['upg'])]), ['extraOpts' => $this->filterObj->extraOpts]);
if (!$upgItems->error) if (!$upgItems->error)
@@ -352,7 +362,7 @@ class ItemsPage extends GenericPage
$tabData['tabs'] = '$tabsGroups'; $tabData['tabs'] = '$tabsGroups';
} }
if (!empty($this->filter['fi']['setWeights'])) if (!empty($this->filterObj->getSetWeights()))
if ($items->hasSetFields(['armor'])) if ($items->hasSetFields(['armor']))
$tabData['visibleCols'][] = 'armor'; $tabData['visibleCols'][] = 'armor';
@@ -449,7 +459,7 @@ class ItemsPage extends GenericPage
$this->path[] = $c; $this->path[] = $c;
// if slot-dropdown is available && Armor && $path points to Armor-Class // if slot-dropdown is available && Armor && $path points to Armor-Class
$form = $this->filterObj->getForm('form'); $form = $this->filterObj->getForm();
if (count($this->path) == 4 && $this->category[0] == 4 && isset($form['sl']) && !is_array($form['sl'])) if (count($this->path) == 4 && $this->category[0] == 4 && isset($form['sl']) && !is_array($form['sl']))
$this->path[] = $form['sl']; $this->path[] = $form['sl'];
else if (!empty($this->category[0]) && $this->category[0] == 0 && isset($form['ty']) && !is_array($form['ty'])) else if (!empty($this->category[0]) && $this->category[0] == 0 && isset($form['ty']) && !is_array($form['ty']))
@@ -461,7 +471,7 @@ class ItemsPage extends GenericPage
{ {
$gemScores = []; $gemScores = [];
if (empty($this->filter['fi']['setWeights'])) if (empty($this->filterObj->getSetWeights()))
return []; return [];
if (!empty($this->filter['gm'])) if (!empty($this->filter['gm']))

View File

@@ -19,8 +19,8 @@ class ItemsetsPage extends GenericPage
public function __construct($pageCall, $pageParam) public function __construct($pageCall, $pageParam)
{ {
$this->filterObj = new ItemsetListFilter();
$this->getCategoryFromUrl($pageParam); $this->getCategoryFromUrl($pageParam);
$this->filterObj = new ItemsetListFilter(false, ['parentCats' => $this->category]);
parent::__construct($pageCall, $pageParam); parent::__construct($pageCall, $pageParam);
@@ -29,6 +29,8 @@ class ItemsetsPage extends GenericPage
protected function generateContent() protected function generateContent()
{ {
$this->addJS('?data=weight-presets&locale='.User::$localeId.'&t='.$_SESSION['dataKey']);
$conditions = []; $conditions = [];
if (!User::isInGroup(U_GROUP_EMPLOYEE)) if (!User::isInGroup(U_GROUP_EMPLOYEE))
@@ -41,15 +43,20 @@ class ItemsetsPage extends GenericPage
$this->extendGlobalData($itemsets->getJSGlobals()); $this->extendGlobalData($itemsets->getJSGlobals());
// recreate form selection // recreate form selection
$this->filter = array_merge($this->filterObj->getForm('form'), $this->filter); $this->filter = $this->filterObj->getForm();
$this->filter['query'] = isset($_GET['filter']) ? $_GET['filter'] : NULL; $this->filter['query'] = isset($_GET['filter']) ? $_GET['filter'] : NULL;
$this->filter['fi'] = $this->filterObj->getForm(); $this->filter['initData'] = ['init' => 'itemsets'];
$this->addJS('?data=weight-presets&locale='.User::$localeId.'&t='.$_SESSION['dataKey']); if ($x = $this->filterObj->getSetCriteria())
$this->filter['initData']['sc'] = $x;
$xCols = $this->filterObj->getExtraCols();
if ($xCols)
$this->filter['initData']['ec'] = $xCols;
$tabData = ['data' => array_values($itemsets->getListviewData())]; $tabData = ['data' => array_values($itemsets->getListviewData())];
if (!empty($this->filter['fi']['extraCols'])) if ($xCols)
$tabData['extraCols'] = '$fi_getExtraCols(fi_extraCols, 0, 0)'; $tabData['extraCols'] = '$fi_getExtraCols(fi_extraCols, 0, 0)';
// create note if search limit was exceeded // create note if search limit was exceeded

View File

@@ -20,8 +20,8 @@ class NpcsPage extends GenericPage
public function __construct($pageCall, $pageParam) public function __construct($pageCall, $pageParam)
{ {
$this->filterObj = new CreatureListFilter();
$this->getCategoryFromUrl($pageParam);; $this->getCategoryFromUrl($pageParam);;
$this->filterObj = new CreatureListFilter(false, ['parentCats' => $this->category]);
parent::__construct($pageCall, $pageParam); parent::__construct($pageCall, $pageParam);
@@ -53,19 +53,26 @@ class NpcsPage extends GenericPage
$npcs = new CreatureList($conditions, ['extraOpts' => $this->filterObj->extraOpts]); $npcs = new CreatureList($conditions, ['extraOpts' => $this->filterObj->extraOpts]);
// recreate form selection // recreate form selection
$this->filter = array_merge($this->filterObj->getForm('form'), $this->filter); $this->filter = $this->filterObj->getForm();
$this->filter['query'] = isset($_GET['filter']) ? $_GET['filter'] : NULL; $this->filter['query'] = isset($_GET['filter']) ? $_GET['filter'] : null;
$this->filter['fi'] = $this->filterObj->getForm(); $this->filter['initData'] = ['init' => 'npcs'];
$repCols = $this->filterObj->getForm('reputationCols'); $rCols = $this->filterObj->getReputationCols();
$xCols = $this->filterObj->getExtraCols();
if ($rCols)
$this->filter['initData']['rc'] = $rCols;
$tabData = array( if ($xCols)
'data' => array_values($npcs->getListviewData($repCols ? NPCINFO_REP : 0x0)), $this->filter['initData']['ec'] = $xCols;
);
if ($repCols) if ($x = $this->filterObj->getSetCriteria())
$tabData['extraCols'] = '$fi_getReputationCols('.Util::toJSON($repCols).')'; $this->filter['initData']['sc'] = $x;
else if (!empty($this->filter['fi']['extraCols']))
$tabData = ['data' => array_values($npcs->getListviewData($rCols ? NPCINFO_REP : 0x0))];
if ($rCols) // never use pretty-print
$tabData['extraCols'] = '$fi_getReputationCols('.Util::toJSON($rCols, JSON_NUMERIC_CHECK | JSON_UNESCAPED_UNICODE).')';
else if ($xCols)
$tabData['extraCols'] = '$fi_getExtraCols(fi_extraCols, 0, 0)'; $tabData['extraCols'] = '$fi_getExtraCols(fi_extraCols, 0, 0)';
if ($this->category) if ($this->category)

View File

@@ -20,8 +20,8 @@ class ObjectsPage extends GenericPage
public function __construct($pageCall, $pageParam) public function __construct($pageCall, $pageParam)
{ {
$this->filterObj = new GameObjectListFilter();
$this->getCategoryFromUrl($pageParam);; $this->getCategoryFromUrl($pageParam);;
$this->filterObj = new GameObjectListFilter(false, ['parentCats' => $this->category]);
parent::__construct($pageCall, $pageParam); parent::__construct($pageCall, $pageParam);
@@ -42,9 +42,12 @@ class ObjectsPage extends GenericPage
$conditions[] = ['typeCat', (int)$this->category[0]]; $conditions[] = ['typeCat', (int)$this->category[0]];
// recreate form selection // recreate form selection
$this->filter = $this->filterObj->getForm('form'); $this->filter = $this->filterObj->getForm();
$this->filter['query'] = isset($_GET['filter']) ? $_GET['filter'] : null; $this->filter['query'] = isset($_GET['filter']) ? $_GET['filter'] : null;
$this->filter['fi'] = $this->filterObj->getForm(); $this->filter['initData'] = ['init' => 'objects'];
if ($x = $this->filterObj->getSetCriteria())
$this->filter['initData']['sc'] = $x;
if ($_ = $this->filterObj->getConditions()) if ($_ = $this->filterObj->getConditions())
$conditions[] = $_; $conditions[] = $_;

View File

@@ -21,8 +21,8 @@ class QuestsPage extends GenericPage
{ {
$this->validCats = Game::$questClasses; // needs reviewing (not allowed to set this as default) $this->validCats = Game::$questClasses; // needs reviewing (not allowed to set this as default)
$this->filterObj = new QuestListFilter();
$this->getCategoryFromUrl($pageParam); $this->getCategoryFromUrl($pageParam);
$this->filterObj = new QuestListFilter(false, ['parentCats' => $this->category]);
parent::__construct($pageCall, $pageParam); parent::__construct($pageCall, $pageParam);
@@ -50,15 +50,26 @@ class QuestsPage extends GenericPage
$this->extendGlobalData($quests->getJSGlobals()); $this->extendGlobalData($quests->getJSGlobals());
// recreate form selection // recreate form selection
$this->filter = array_merge($this->filterObj->getForm('form'), $this->filter); $this->filter = $this->filterObj->getForm();
$this->filter['query'] = isset($_GET['filter']) ? $_GET['filter'] : NULL; $this->filter['query'] = isset($_GET['filter']) ? $_GET['filter'] : null;
$this->filter['fi'] = $this->filterObj->getForm(); $this->filter['initData'] = ['init' => 'quests'];
$rCols = $this->filterObj->getReputationCols();
$xCols = $this->filterObj->getExtraCols();
if ($rCols)
$this->filter['initData']['rc'] = $rCols;
if ($xCols)
$this->filter['initData']['ec'] = $xCols;
if ($x = $this->filterObj->getSetCriteria())
$this->filter['initData']['sc'] = $x;
$tabData = ['data' => array_values($quests->getListviewData())]; $tabData = ['data' => array_values($quests->getListviewData())];
if ($_ = $this->filterObj->getForm('reputationCols')) if ($rCols)
$tabData['extraCols'] = '$fi_getReputationCols('.json_encode($_, JSON_NUMERIC_CHECK).')'; $tabData['extraCols'] = '$fi_getReputationCols('.json_encode($rCols, JSON_NUMERIC_CHECK | JSON_UNESCAPED_UNICODE).')';
else if (!empty($this->filter['fi']['extraCols'])) else if ($xCols)
$tabData['extraCols'] = '$fi_getExtraCols(fi_extraCols, 0, 0)'; $tabData['extraCols'] = '$fi_getExtraCols(fi_extraCols, 0, 0)';
// create note if search limit was exceeded // create note if search limit was exceeded

View File

@@ -198,7 +198,7 @@ class ScreenshotPage extends GenericPage
if (count($dims) != 4) if (count($dims) != 4)
return 3; return 3;
Util::checkNumeric($dims); Util::checkNumeric($dims, NUM_REQ_INT);
// actually crop the image // actually crop the image
$srcImg = imagecreatefromjpeg($fullPath); $srcImg = imagecreatefromjpeg($fullPath);

View File

@@ -40,7 +40,6 @@ class SearchPage extends GenericPage
protected $search = ''; // output protected $search = ''; // output
protected $invalid = []; protected $invalid = [];
private $statWeight = ['wt' => null, 'wtv' => null];
private $maxResults = CFG_SQL_LIMIT_SEARCH; private $maxResults = CFG_SQL_LIMIT_SEARCH;
private $searchMask = 0x0; private $searchMask = 0x0;
private $query = ''; // lookup private $query = ''; // lookup
@@ -64,15 +63,6 @@ class SearchPage extends GenericPage
if ($this->reqUGroup && !User::isInGroup($this->reqUGroup)) if ($this->reqUGroup && !User::isInGroup($this->reqUGroup))
$this->error(); $this->error();
// statWeight for JSON-search
if (isset($_GET['wt']) && isset($_GET['wtv']))
{
$this->statWeight = array(
'wt' => explode(':', $_GET['wt']),
'wtv' => explode(':', $_GET['wtv'])
);
}
// select search mode // select search mode
if (isset($_GET['json'])) if (isset($_GET['json']))
{ {
@@ -577,8 +567,12 @@ class SearchPage extends GenericPage
if ($_ = array_filter($slots)) if ($_ = array_filter($slots))
$cnd[] = ['slot', $_]; $cnd[] = ['slot', $_];
// trick ItemListFilter into evaluating weights
if (isset($_GET['wt']) && isset($_GET['wtv']))
$_GET['filter'] = 'wt='.$_GET['wt'].';wtv='.$_GET['wtv'];
$itemFilter = new ItemListFilter(); $itemFilter = new ItemListFilter();
if ($_ = $itemFilter->createConditionsForWeights($this->statWeight)) if ($_ = $itemFilter->createConditionsForWeights())
{ {
$miscData['extraOpts'] = $itemFilter->extraOpts; $miscData['extraOpts'] = $itemFilter->extraOpts;
$cnd = array_merge($cnd, [$_]); $cnd = array_merge($cnd, [$_]);

View File

@@ -39,9 +39,8 @@ class SoundsPage extends GenericPage
if ($_ = $this->filterObj->getConditions()) if ($_ = $this->filterObj->getConditions())
$conditions[] = $_; $conditions[] = $_;
$this->filter = array_merge($this->filterObj->getForm('form'), $this->filter); $this->filter = $this->filterObj->getForm();
$this->filter['query'] = isset($_GET['filter']) ? $_GET['filter'] : null; $this->filter['query'] = isset($_GET['filter']) ? $_GET['filter'] : null;
$this->filter['fi'] = $this->filterObj->getForm();
$sounds = new SoundList($conditions); $sounds = new SoundList($conditions);
$tabData = []; $tabData = [];
@@ -66,15 +65,15 @@ class SoundsPage extends GenericPage
protected function generateTitle() protected function generateTitle()
{ {
$form = $this->filterObj->getForm('form'); $form = $this->filterObj->getForm();
if (isset($form['ty']) && !is_array($form['ty'])) if (isset($form['ty']) && count($form['ty']) == 1)
array_unshift($this->title, Lang::sound('cat', $form['ty'])); array_unshift($this->title, Lang::sound('cat', $form['ty'][0]));
} }
protected function generatePath() protected function generatePath()
{ {
$form = $this->filterObj->getForm('form'); $form = $this->filterObj->getForm();
if (isset($form['ty']) && !is_array($form['ty'])) if (isset($form['ty']) && count($form['ty']) == 1)
$this->path[] = $form['ty']; $this->path[] = $form['ty'];
} }
} }

View File

@@ -630,11 +630,8 @@ class SpellPage extends GenericPage
$lv[$bar]['condition'][0][$this->typeId][] = [[CND_SPELL, $extraItem['requiredSpecialization']]]; $lv[$bar]['condition'][0][$this->typeId][] = [[CND_SPELL, $extraItem['requiredSpecialization']]];
$this->extendGlobalIds(TYPE_SPELL, $extraItem['requiredSpecialization']); $this->extendGlobalIds(TYPE_SPELL, $extraItem['requiredSpecialization']);
$extraCols[] = '$Listview.extraCols.condition'; $extraCols[] = '$Listview.extraCols.condition';
if ($max = $extraItem['additionalMaxNum']) if ($max = ($extraItem['additionalMaxNum'] - 1))
{ $lv[$bar]['stack'] = [1, $max];
$lv[$bar]['mincount'] = 1;
$lv[$bar]['maxcount'] = $max;
}
break; // skill_extra_item_template can only contain 1 item break; // skill_extra_item_template can only contain 1 item
} }

View File

@@ -85,14 +85,16 @@ class SpellsPage extends GenericPage
public function __construct($pageCall, $pageParam) public function __construct($pageCall, $pageParam)
{ {
$this->filterObj = new SpellListFilter();
$this->getCategoryFromUrl($pageParam);; $this->getCategoryFromUrl($pageParam);;
$this->filterObj = new SpellListFilter(false, ['parentCats' => $this->category]);
parent::__construct($pageCall, $pageParam); parent::__construct($pageCall, $pageParam);
$this->name = Util::ucFirst(Lang::game('spells')); $this->name = Util::ucFirst(Lang::game('spells'));
$this->subCat = $pageParam !== null ? '='.$pageParam : ''; $this->subCat = $pageParam !== null ? '='.$pageParam : '';
$this->filter = ['classPanel' => false, 'glyphPanel' => false];
$this->classPanel = false;
$this->glyphPanel = false;
} }
protected function generateContent() protected function generateContent()
@@ -108,7 +110,7 @@ class SpellsPage extends GenericPage
switch ($this->category[0]) switch ($this->category[0])
{ {
case -2: // Character Talents case -2: // Character Talents
$this->filter['classPanel'] = true; $this->classPanel = true;
array_push($visibleCols, 'singleclass', 'level', 'schools', 'tier'); array_push($visibleCols, 'singleclass', 'level', 'schools', 'tier');
@@ -218,8 +220,8 @@ class SpellsPage extends GenericPage
break; break;
case -13: // Glyphs case -13: // Glyphs
$this->filter['classPanel'] = true; $this->classPanel = true;
$this->filter['glyphPanel'] = true; $this->glyphPanel = true;
array_push($visibleCols, 'singleclass', 'glyphtype'); array_push($visibleCols, 'singleclass', 'glyphtype');
@@ -230,7 +232,7 @@ class SpellsPage extends GenericPage
break; break;
case 7: // Abilities case 7: // Abilities
$this->filter['classPanel'] = true; $this->classPanel = true;
array_push($visibleCols, 'level', 'singleclass', 'schools'); array_push($visibleCols, 'level', 'singleclass', 'schools');
@@ -366,12 +368,24 @@ class SpellsPage extends GenericPage
$tabData['data'] = array_values($spells->getListviewData()); $tabData['data'] = array_values($spells->getListviewData());
// recreate form selection // recreate form selection
$this->filter = array_merge($this->filterObj->getForm('form'), $this->filter); $this->filter = $this->filterObj->getForm();
$this->filter['query'] = isset($_GET['filter']) ? $_GET['filter'] : NULL; $this->filter['query'] = isset($_GET['filter']) ? $_GET['filter'] : NULL;
$this->filter['fi'] = $this->filterObj->getForm(); $this->filter['initData'] = ['init' => 'spells'];
if (!empty($this->filter['fi']['extraCols'])) if ($ec = $this->filterObj->getExtraCols())
{
$this->filter['initData']['ec'] = $ec;
$tabData['extraCols'] = '$fi_getExtraCols(fi_extraCols, 0, 0)'; $tabData['extraCols'] = '$fi_getExtraCols(fi_extraCols, 0, 0)';
}
if ($sc = $this->filterObj->getSetCriteria())
{
$this->filter['initData']['sc'] = $sc;
// add source to cols if explicitly searching for it
if (in_array(9, $sc['cr']) && !in_array('source', $visibleCols))
$visibleCols[] = 'source';
}
// create note if search limit was exceeded; overwriting 'note' is intentional // create note if search limit was exceeded; overwriting 'note' is intentional
if ($spells->getMatches() > CFG_SQL_LIMIT_DEFAULT) if ($spells->getMatches() > CFG_SQL_LIMIT_DEFAULT)
@@ -383,10 +397,6 @@ class SpellsPage extends GenericPage
if ($this->filterObj->error) if ($this->filterObj->error)
$tabData['_errors'] = 1; $tabData['_errors'] = 1;
// add source to cols if explicitly searching for it
if ($_ = $this->filterObj->getForm('setCriteria', true))
if (in_array(9, $_['cr']) && !in_array('source', $visibleCols))
$visibleCols[] = 'source';
$mask = $spells->hasSetFields(['reagent1', 'skillLines', 'trainingCost', 'reqClassMask']); $mask = $spells->hasSetFields(['reagent1', 'skillLines', 'trainingCost', 'reqClassMask']);
if ($mask & 0x1) if ($mask & 0x1)
@@ -444,8 +454,8 @@ class SpellsPage extends GenericPage
foreach ($this->category as $c) foreach ($this->category as $c)
$this->path[] = $c; $this->path[] = $c;
$form = $this->filterObj->getForm('form'); $form = $this->filterObj->getForm();
if (count($this->path) == 4 && $this->category[0] == -13 && isset($form['gl']) && !is_array($form['gl'])) if (count($this->path) == 4 && $this->category[0] == -13 && isset($form['gl']) && count($form['gl']) == 1)
$this->path[] = $form['gl']; $this->path[] = $form['gl'];
} }
} }

View File

@@ -0,0 +1,14 @@
<script type="text/javascript">//<![CDATA[
fi_init('<?=$fi['init'];?>');
<?php
if (!empty($fi['sc'])):
echo ' fi_setCriteria('.Util::toJSON($fi['sc']['cr'] ?: []).', '.Util::toJSON($fi['sc']['crs'] ?: []).', '.Util::toJSON($fi['sc']['crv'] ?: []).");\n";
endif;
if (!empty($fi['sw'])):
echo ' fi_setWeights('.Util::toJSON($fi['sw']).", 0, 1, 1);\n";
endif;
if (!empty($fi['ec'])):
echo ' fi_extraCols = '.Util::toJSON($fi['ec']).";\n";
endif;
?>
//]]></script>

View File

@@ -14,7 +14,7 @@ $this->brick('pageTemplate', ['fi' => empty($f['query']) ? null : ['query' => $f
?> ?>
<div id="fi" style="display: <?php echo empty($f['query']) ? 'none' : 'block'; ?>;"> <div id="fi" style="display: <?php echo empty($f['query']) ? 'none' : 'block'; ?>;">
<form action="?achievements<?php echo $this->subCat; ?>&filter" method="post" name="fi" onsubmit="return fi_submit(this)" onreset="return fi_reset(this)"> <form action="?filter=achievements<?php echo $this->subCat; ?>" method="post" name="fi" onsubmit="return fi_submit(this)" onreset="return fi_reset(this)">
<table> <table>
<tr> <tr>
<td><?php echo Util::ucFirst(Lang::main('name')).Lang::main('colon'); ?></td> <td><?php echo Util::ucFirst(Lang::main('name')).Lang::main('colon'); ?></td>
@@ -63,14 +63,7 @@ endforeach;
<div class="pad"></div> <div class="pad"></div>
</div> </div>
<script type="text/javascript">//<![CDATA[ <?php $this->brick('filter', ['fi' => $f['initData']]); ?>
fi_init('achievements');
<?php
foreach ($f['fi'] as $str):
echo ' '.$str."\n";
endforeach;
?>
//]]></script>
<?php $this->brick('lvTabs'); ?> <?php $this->brick('lvTabs'); ?>

View File

@@ -13,11 +13,11 @@ $this->brick('announcement');
$this->brick('pageTemplate', ['fi' => empty($f['query']) ? null : ['query' => $f['query'], 'menuItem' => 101]]); $this->brick('pageTemplate', ['fi' => empty($f['query']) ? null : ['query' => $f['query'], 'menuItem' => 101]]);
?> ?>
<div id="fi" style="display: <?php echo empty($f['query']) ? 'none' : 'block' ?>;"> <div id="fi" style="display: <?=(empty($f['query']) ? 'none' : 'block'); ?>;">
<form action="?enchantments&filter" method="post" name="fi" onsubmit="return fi_submit(this)" onreset="return fi_reset(this)"> <form action="?filter=enchantments" method="post" name="fi" onsubmit="return fi_submit(this)" onreset="return fi_reset(this)">
<div class="rightpanel"> <div class="rightpanel">
<div style="float: left"><?php echo Util::ucFirst(Lang::game('type')).Lang::main('colon'); ?></div> <div style="float: left"><?=Util::ucFirst(Lang::game('type')).Lang::main('colon'); ?></div>
<small><a href="javascript:;" onclick="document.forms['fi'].elements['ty[]'].selectedIndex = -1; return false" onmousedown="return false"><?php echo Lang::main('clear'); ?></a></small> <small><a href="javascript:;" onclick="document.forms['fi'].elements['ty[]'].selectedIndex = -1; return false" onmousedown="return false"><?=Lang::main('clear'); ?></a></small>
<div class="clear"></div> <div class="clear"></div>
<select name="ty[]" size="8" multiple="multiple" class="rightselect"> <select name="ty[]" size="8" multiple="multiple" class="rightselect">
<?php <?php
@@ -31,40 +31,33 @@ endforeach;
</div> </div>
<table> <table>
<tr> <tr>
<td><?php echo Util::ucFirst(Lang::main('name')).Lang::main('colon'); ?></td> <td><?=Util::ucFirst(Lang::main('name')).Lang::main('colon'); ?></td>
<td colspan="2"> <td colspan="2">
<table><tr> <table><tr>
<td>&nbsp;<input type="text" name="na" size="30" <?php echo isset($f['na']) ? 'value="'.Util::htmlEscape($f['na']).'" ' : null; ?>/></td> <td>&nbsp;<input type="text" name="na" size="30" <?=(isset($f['na']) ? 'value="'.Util::htmlEscape($f['na']).'" ' : null); ?>/></td>
</tr></table> </tr></table>
</td> </td>
</tr><tr> </tr><tr>
</table> </table>
<div id="fi_criteria" class="padded criteria"><div></div></div><div><a href="javascript:;" id="fi_addcriteria" onclick="fi_addCriterion(this); return false"><?php echo Lang::main('addFilter'); ?></a></div> <div id="fi_criteria" class="padded criteria"><div></div></div><div><a href="javascript:;" id="fi_addcriteria" onclick="fi_addCriterion(this); return false"><?=Lang::main('addFilter'); ?></a></div>
<div class="padded2"> <div class="padded2">
<?php echo Lang::main('match').Lang::main('colon'); ?><input type="radio" name="ma" value="" id="ma-0" <?php echo !isset($f['ma']) ? 'checked="checked" ' : null ?>/><label for="ma-0"><?php echo Lang::main('allFilter'); ?></label><input type="radio" name="ma" value="1" id="ma-1" <?php echo isset($f['ma']) ? 'checked="checked" ' : null ?> /><label for="ma-1"><?php echo Lang::main('oneFilter'); ?></label> <?=Lang::main('match').Lang::main('colon'); ?><input type="radio" name="ma" value="" id="ma-0" <?=()!isset($f['ma']) ? 'checked="checked" ' : null); ?>/><label for="ma-0"><?=Lang::main('allFilter'); ?></label><input type="radio" name="ma" value="1" id="ma-1" <?=(isset($f['ma']) ? 'checked="checked" ' : null); ?> /><label for="ma-1"><?=Lang::main('oneFilter'); ?></label>
</div> </div>
<div class="clear"></div> <div class="clear"></div>
<div class="padded"> <div class="padded">
<input type="submit" value="<?php echo Lang::main('applyFilter'); ?>" /> <input type="submit" value="<?=Lang::main('applyFilter'); ?>" />
<input type="reset" value="<?php echo Lang::main('resetForm'); ?>" /> <input type="reset" value="<?=Lang::main('resetForm'); ?>" />
</div> </div>
</form> </form>
<div class="pad"></div> <div class="pad"></div>
</div> </div>
<script type="text/javascript">//<![CDATA[ <?php $this->brick('filter', ['fi' => $f['initData']]); ?>
fi_init('enchantments');
<?php
foreach ($f['fi'] as $str):
echo ' '.$str."\n";
endforeach;
?>
//]]></script>
<?php $this->brick('lvTabs'); ?> <?php $this->brick('lvTabs'); ?>

View File

@@ -13,44 +13,37 @@ $this->brick('announcement');
$this->brick('pageTemplate', ['fi' => empty($f['query']) ? null : ['query' => $f['query'], 'menuItem' => 101]]); $this->brick('pageTemplate', ['fi' => empty($f['query']) ? null : ['query' => $f['query'], 'menuItem' => 101]]);
?> ?>
<div id="fi" style="display: <?php echo empty($f['query']) ? 'none' : 'block' ?>;"> <div id="fi" style="display: <?=(empty($f['query']) ? 'none' : 'block'); ?>;">
<form action="?icons&filter" method="post" name="fi" onsubmit="return fi_submit(this)" onreset="return fi_reset(this)"> <form action="?filter=icons" method="post" name="fi" onsubmit="return fi_submit(this)" onreset="return fi_reset(this)">
<table> <table>
<tr> <tr>
<td><?php echo Util::ucFirst(Lang::main('name')).Lang::main('colon'); ?></td> <td><?=Util::ucFirst(Lang::main('name')).Lang::main('colon'); ?></td>
<td colspan="2"> <td colspan="2">
<table><tr> <table><tr>
<td>&nbsp;<input type="text" name="na" size="30" <?php echo isset($f['na']) ? 'value="'.Util::htmlEscape($f['na']).'" ' : null; ?>/></td> <td>&nbsp;<input type="text" name="na" size="30" <?=(isset($f['na']) ? 'value="'.Util::htmlEscape($f['na']).'" ' : null); ?>/></td>
</tr></table> </tr></table>
</td> </td>
</tr><tr> </tr><tr>
</table> </table>
<div id="fi_criteria" class="padded criteria"><div></div></div><div><a href="javascript:;" id="fi_addcriteria" onclick="fi_addCriterion(this); return false"><?php echo Lang::main('addFilter'); ?></a></div> <div id="fi_criteria" class="padded criteria"><div></div></div><div><a href="javascript:;" id="fi_addcriteria" onclick="fi_addCriterion(this); return false"><?=Lang::main('addFilter'); ?></a></div>
<div class="padded2"> <div class="padded2">
<?php echo Lang::main('match').Lang::main('colon'); ?><input type="radio" name="ma" value="" id="ma-0" <?php echo !isset($f['ma']) ? 'checked="checked" ' : null ?>/><label for="ma-0"><?php echo Lang::main('allFilter'); ?></label><input type="radio" name="ma" value="1" id="ma-1" <?php echo isset($f['ma']) ? 'checked="checked" ' : null ?> /><label for="ma-1"><?php echo Lang::main('oneFilter'); ?></label> <?=Lang::main('match').Lang::main('colon'); ?><input type="radio" name="ma" value="" id="ma-0" <?=(!isset($f['ma']) ? 'checked="checked" ' : null); ?>/><label for="ma-0"><?=Lang::main('allFilter'); ?></label><input type="radio" name="ma" value="1" id="ma-1" <?=(isset($f['ma']) ? 'checked="checked" ' : null); ?> /><label for="ma-1"><?=Lang::main('oneFilter'); ?></label>
</div> </div>
<div class="clear"></div> <div class="clear"></div>
<div class="padded"> <div class="padded">
<input type="submit" value="<?php echo Lang::main('applyFilter'); ?>" /> <input type="submit" value="<?=Lang::main('applyFilter'); ?>" />
<input type="reset" value="<?php echo Lang::main('resetForm'); ?>" /> <input type="reset" value="<?=Lang::main('resetForm'); ?>" />
</div> </div>
</form> </form>
<div class="pad"></div> <div class="pad"></div>
</div> </div>
<script type="text/javascript">//<![CDATA[ <?php $this->brick('filter', ['fi' => $f['initData']]); ?>
fi_init('icons');
<?php
foreach ($f['fi'] as $str):
echo ' '.$str."\n";
endforeach;
?>
//]]></script>
<?php $this->brick('lvTabs'); ?> <?php $this->brick('lvTabs'); ?>

View File

@@ -13,11 +13,11 @@ $this->brick('announcement');
$this->brick('pageTemplate', ['fi' => empty($f['query']) ? null : ['query' => $f['query'], 'menuItem' => 0]]); $this->brick('pageTemplate', ['fi' => empty($f['query']) ? null : ['query' => $f['query'], 'menuItem' => 0]]);
?> ?>
<div id="fi" style="display: <?php echo empty($f['query']) ? 'none' : 'block' ?>;"> <div id="fi" style="display: <?=(empty($f['query']) ? 'none' : 'block'); ?>;">
<form action="?items<?php echo $this->subCat; ?>&filter" method="post" name="fi" onsubmit="return fi_submit(this)" onreset="return fi_reset(this)"> <form action="?filter=items<?=$this->subCat; ?>" method="post" name="fi" onsubmit="return fi_submit(this)" onreset="return fi_reset(this)">
<div class="rightpanel"> <div class="rightpanel">
<div style="float: left"><?php echo Lang::item('_quality').Lang::main('colon'); ?></div> <div style="float: left"><?=Lang::item('_quality').Lang::main('colon'); ?></div>
<small><a href="javascript:;" onclick="document.forms['fi'].elements['qu[]'].selectedIndex = -1; return false" onmousedown="return false"><?php echo Lang::main('clear'); ?></a></small> <small><a href="javascript:;" onclick="document.forms['fi'].elements['qu[]'].selectedIndex = -1; return false" onmousedown="return false"><?=Lang::main('clear'); ?></a></small>
<div class="clear"></div> <div class="clear"></div>
<select name="qu[]" size="7" multiple="multiple" class="rightselect" style="background-color: #181818"> <select name="qu[]" size="7" multiple="multiple" class="rightselect" style="background-color: #181818">
<?php <?php
@@ -32,10 +32,10 @@ endforeach;
if (!empty($f['slot'])): if (!empty($f['slot'])):
?> ?>
<div class="rightpanel2"> <div class="rightpanel2">
<div style="float: left"><?php echo Lang::item('slot').Lang::main('colon'); ?></div> <div style="float: left"><?=Lang::item('slot').Lang::main('colon'); ?></div>
<small><a href="javascript:;" onclick="document.forms['fi'].elements['sl[]'].selectedIndex = -1; return false" onmousedown="return false"><?php echo Lang::main('clear'); ?></a></small> <small><a href="javascript:;" onclick="document.forms['fi'].elements['sl[]'].selectedIndex = -1; return false" onmousedown="return false"><?=Lang::main('clear'); ?></a></small>
<div class="clear"></div> <div class="clear"></div>
<select name="sl[]" size="<?php echo min(count($f['slot']), 7); ?>" multiple="multiple" class="rightselect"> <select name="sl[]" size="<?=min(count($f['slot']), 7); ?>" multiple="multiple" class="rightselect">
<?php <?php
foreach ($f['slot'] as $k => $str): foreach ($f['slot'] as $k => $str):
echo ' <option value="'.$k.'" '.(isset($f['sl']) && in_array($k, (array)$f['sl']) ? ' selected' : null).'>'.$str."</option>\n"; echo ' <option value="'.$k.'" '.(isset($f['sl']) && in_array($k, (array)$f['sl']) ? ' selected' : null).'>'.$str."</option>\n";
@@ -49,10 +49,10 @@ endif;
if (!empty($f['type'])): if (!empty($f['type'])):
?> ?>
<div class="rightpanel2"> <div class="rightpanel2">
<div style="float: left"><?php echo Lang::game('type').Lang::main('colon'); ?></div> <div style="float: left"><?=Lang::game('type').Lang::main('colon'); ?></div>
<small><a href="javascript:;" onclick="document.forms['fi'].elements['ty[]'].selectedIndex = -1; return false" onmousedown="return false"><?php echo Lang::main('clear'); ?></a></small> <small><a href="javascript:;" onclick="document.forms['fi'].elements['ty[]'].selectedIndex = -1; return false" onmousedown="return false"><?=Lang::main('clear'); ?></a></small>
<div class="clear"></div> <div class="clear"></div>
<select name="ty[]" size="<?php echo min(count($f['type']), 7); ?>" multiple="multiple" class="rightselect"> <select name="ty[]" size="<?=min(count($f['type']), 7); ?>" multiple="multiple" class="rightselect">
<?php <?php
foreach ($f['type'] as $k => $str): foreach ($f['type'] as $k => $str):
$selected = false; $selected = false;
@@ -71,23 +71,23 @@ if (!empty($f['type'])):
<table> <table>
<tr> <tr>
<td><?php echo Util::ucFirst(Lang::main('name')).Lang::main('colon'); ?></td> <td><?=Util::ucFirst(Lang::main('name')).Lang::main('colon'); ?></td>
<td colspan="2">&nbsp;<input type="text" name="na" size="30" <?php echo isset($f['na']) ? 'value="'.Util::htmlEscape($f['na']).'" ' : null; ?>/></td> <td colspan="2">&nbsp;<input type="text" name="na" size="30" <?=(isset($f['na']) ? 'value="'.Util::htmlEscape($f['na']).'" ' : null); ?>/></td>
<td></td> <td></td>
</tr><tr> </tr><tr>
<td class="padded"><?php echo Lang::game('level').Lang::main('colon'); ?></td> <td class="padded"><?=Lang::game('level').Lang::main('colon'); ?></td>
<td class="padded">&nbsp;<input type="text" name="minle" maxlength="3" class="smalltextbox2" <?php echo isset($f['minle']) ? 'value="'.$f['minle'].'" ' : null; ?>/> - <input type="text" name="maxle" maxlength="3" class="smalltextbox2" <?php echo isset($f['maxle']) ? 'value="'.$f['maxle'].'" ' : null; ?>/></td> <td class="padded">&nbsp;<input type="text" name="minle" maxlength="3" class="smalltextbox2" <?=(isset($f['minle']) ? 'value="'.$f['minle'].'" ' : null); ?>/> - <input type="text" name="maxle" maxlength="3" class="smalltextbox2" <?=(isset($f['maxle']) ? 'value="'.$f['maxle'].'" ' : null); ?>/></td>
<td class="padded"> <td class="padded">
<table> <table>
<tr> <tr>
<td>&nbsp;&nbsp;&nbsp;<?php echo Lang::main('_reqLevel').Lang::main('colon'); ?></td> <td>&nbsp;&nbsp;&nbsp;<?=Lang::main('_reqLevel').Lang::main('colon'); ?></td>
<td>&nbsp;<input type="text" name="minrl" maxlength="2" class="smalltextbox" <?php echo isset($f['minrl']) ? 'value="'.$f['minrl'].'" ' : null; ?>/> - <input type="text" name="maxrl" maxlength="2" class="smalltextbox" <?php echo isset($f['maxrl']) ? 'value="'.$f['maxrl'].'" ' : null; ?>/></td> <td>&nbsp;<input type="text" name="minrl" maxlength="2" class="smalltextbox" <?=(isset($f['minrl']) ? 'value="'.$f['minrl'].'" ' : null); ?>/> - <input type="text" name="maxrl" maxlength="2" class="smalltextbox" <?=(isset($f['maxrl']) ? 'value="'.$f['maxrl'].'" ' : null); ?>/></td>
</tr> </tr>
</table> </table>
</td> </td>
<td></td> <td></td>
</tr><tr> </tr><tr>
<td class="padded"><?php echo Lang::item('usableBy').Lang::main('colon'); ?></td> <td class="padded"><?=Lang::item('usableBy').Lang::main('colon'); ?></td>
<td class="padded">&nbsp;<select name="si" style="margin-right: 0.5em"> <td class="padded">&nbsp;<select name="si" style="margin-right: 0.5em">
<option></option> <option></option>
<?php <?php
@@ -111,47 +111,47 @@ endforeach;
</tr> </tr>
</table> </table>
<div id="fi_criteria" class="padded criteria"><div></div></div><div><a href="javascript:;" id="fi_addcriteria" onclick="fi_addCriterion(this); return false"><?php echo Lang::main('addFilter'); ?></a></div> <div id="fi_criteria" class="padded criteria"><div></div></div><div><a href="javascript:;" id="fi_addcriteria" onclick="fi_addCriterion(this); return false"><?=Lang::main('addFilter'); ?></a></div>
<div class="padded2"> <div class="padded2">
<div style="float: right"><?php echo Lang::main('refineSearch'); ?></div> <div style="float: right"><?=Lang::main('refineSearch'); ?></div>
<?php echo Lang::main('match').Lang::main('colon'); ?><input type="radio" name="ma" value="" id="ma-0" <?php echo !isset($f['ma']) ? 'checked="checked" ' : null; ?>/><label for="ma-0"><?php echo Lang::main('allFilter'); ?></label><input type="radio" name="ma" value="1" id="ma-1" <?php echo isset($f['ma']) ? 'checked="checked" ' : null; ?>/><label for="ma-1"><?php echo Lang::main('oneFilter'); ?></label> <?=Lang::main('match').Lang::main('colon'); ?><input type="radio" name="ma" value="" id="ma-0" <?=(!isset($f['ma']) ? 'checked="checked" ' : null); ?>/><label for="ma-0"><?=Lang::main('allFilter'); ?></label><input type="radio" name="ma" value="1" id="ma-1" <?=(isset($f['ma']) ? 'checked="checked" ' : null); ?>/><label for="ma-1"><?=Lang::main('oneFilter'); ?></label>
</div> </div>
<div class="pad3"></div> <div class="pad3"></div>
<div class="text"> <div class="text">
<h3 class="first"><a id="fi_weight_toggle" href="javascript:;" class="disclosure-off" onclick="return g_disclose($WH.ge('statweight-disclosure'), this)"><?php echo Lang::main('createWS'); ?></a></h3> <h3 class="first"><a id="fi_weight_toggle" href="javascript:;" class="disclosure-off" onclick="return g_disclose($WH.ge('statweight-disclosure'), this)"><?=Lang::main('createWS'); ?></a></h3>
</div> </div>
<div id="statweight-disclosure" style="display: none"> <div id="statweight-disclosure" style="display: none">
<div id="statweight-help"> <div id="statweight-help">
<div><a href="?help=stat-weighting" target="_blank" id="statweight-help" class="icon-help"><?php echo Lang::main('help'); ?></a></div> <div><a href="?help=stat-weighting" target="_blank" id="statweight-help" class="icon-help"><?=Lang::main('help'); ?></a></div>
</div> </div>
<table> <table>
<tr> <tr>
<td><?php echo Lang::main('preset').Lang::main('colon'); ?></td> <td><?=Lang::main('preset').Lang::main('colon'); ?></td>
<td id="fi_presets"></td> <td id="fi_presets"></td>
</tr> </tr>
<tr> <tr>
<td class="padded"><?php echo Lang::item('gems').Lang::main('colon'); ?></td> <td class="padded"><?=Lang::item('gems').Lang::main('colon'); ?></td>
<td class="padded"> <td class="padded">
<select name="gm"> <select name="gm">
<option<?php echo !isset($f['gm']) ? ' selected' : null; ?>></option> <option<?=(!isset($f['gm']) ? ' selected' : null); ?>></option>
<option value="2"<?php echo (isset($f['gm']) && $f['gm'] == 2 ? ' selected' : null).'>'.Lang::item('quality', 2); ?></option> <option value="2"<?=(isset($f['gm']) && $f['gm'] == 2 ? ' selected' : null).'>'.Lang::item('quality', 2); ?></option>
<option value="3"<?php echo (isset($f['gm']) && $f['gm'] == 3 ? ' selected' : null).'>'.Lang::item('quality', 3); ?></option> <option value="3"<?=(isset($f['gm']) && $f['gm'] == 3 ? ' selected' : null).'>'.Lang::item('quality', 3); ?></option>
<option value="4"<?php echo (isset($f['gm']) && $f['gm'] == 4 ? ' selected' : null).'>'.Lang::item('quality', 4); ?></option> <option value="4"<?=(isset($f['gm']) && $f['gm'] == 4 ? ' selected' : null).'>'.Lang::item('quality', 4); ?></option>
</select> </select>
&nbsp; <input type="checkbox" name="jc" value="1" id="jc" <?php echo isset($f['jc']) && $f['jc'] == 1 ? 'checked="checked" ' : null; ?>/><label for="jc"><?php echo sprintf(Lang::main('jcGemsOnly'), ' class="tip" onmouseover="$WH.Tooltip.showAtCursor(event, LANG.tooltip_jconlygems, 0, 0, \'q\')" onmousemove="$WH.Tooltip.cursorUpdate(event)" onmouseout="$WH.Tooltip.hide()"'); ?></label> &nbsp; <input type="checkbox" name="jc" value="1" id="jc" <?=(isset($f['jc']) && $f['jc'] == 1 ? 'checked="checked" ' : null); ?>/><label for="jc"><?=sprintf(Lang::main('jcGemsOnly'), ' class="tip" onmouseover="$WH.Tooltip.showAtCursor(event, LANG.tooltip_jconlygems, 0, 0, \'q\')" onmousemove="$WH.Tooltip.cursorUpdate(event)" onmouseout="$WH.Tooltip.hide()"'); ?></label>
</td> </td>
</tr> </tr>
</table> </table>
<div id="fi_weight" class="criteria" style="display: none"><div></div></div> <div id="fi_weight" class="criteria" style="display: none"><div></div></div>
<div><a href="javascript:;" id="fi_addweight" onclick="fi_addCriterion(this); return false" style="display: none"><?php echo Lang::main('addWeight'); ?></a></div> <div><a href="javascript:;" id="fi_addweight" onclick="fi_addCriterion(this); return false" style="display: none"><?=Lang::main('addWeight'); ?></a></div>
<div class="pad2"></div> <div class="pad2"></div>
<small><?php echo Lang::main('cappedHint'); ?></small> <small><?=Lang::main('cappedHint'); ?></small>
</div> </div>
@@ -172,11 +172,11 @@ endforeach;
<div class="clear"></div> <div class="clear"></div>
<div class="padded"> <div class="padded">
<input type="submit" value="<?php echo Lang::main('applyFilter'); ?>" /> <input type="submit" value="<?=Lang::main('applyFilter'); ?>" />
<input type="reset" value="<?php echo Lang::main('resetForm'); ?>" /> <input type="reset" value="<?=Lang::main('resetForm'); ?>" />
</div> </div>
<input type="hidden" name="upg"<?php echo !empty($f['upg']) ? ' value="'.$f['upg'].'"' : null; ?>/> <input type="hidden" name="upg"<?=(!empty($f['upg']) ? ' value="'.$f['upg'].'"' : null); ?>/>
<div class="pad"></div> <div class="pad"></div>
@@ -184,14 +184,7 @@ endforeach;
<div class="pad"></div> <div class="pad"></div>
</div> </div>
<script type="text/javascript">//<![CDATA[ <?php $this->brick('filter', ['fi' => $f['initData']]); ?>
fi_init('items');
<?php
foreach ($f['fi'] as $str):
echo ' '.$str."\n";
endforeach;
?>
//]]></script>
<?php $this->brick('lvTabs'); ?> <?php $this->brick('lvTabs'); ?>

View File

@@ -13,11 +13,11 @@ $this->brick('announcement');
$this->brick('pageTemplate', ['fi' => empty($f['query']) ? null : ['query' => $f['query'], 'menuItem' => 2]]); $this->brick('pageTemplate', ['fi' => empty($f['query']) ? null : ['query' => $f['query'], 'menuItem' => 2]]);
?> ?>
<div id="fi" style="display: <?php echo empty($f['query']) ? 'none' : 'block' ?>;"> <div id="fi" style="display: <?=(empty($f['query']) ? 'none' : 'block'); ?>;">
<form action="?itemsets&filter" method="post" name="fi" onsubmit="return fi_submit(this)" onreset="return fi_reset(this)"> <form action="?filter=itemsets" method="post" name="fi" onsubmit="return fi_submit(this)" onreset="return fi_reset(this)">
<div class="rightpanel"> <div class="rightpanel">
<div style="float: left"><?php echo Lang::item('_quality').Lang::main('colon'); ?></div> <div style="float: left"><?=Lang::item('_quality').Lang::main('colon'); ?></div>
<small><a href="javascript:;" onclick="document.forms['fi'].elements['qu[]'].selectedIndex = -1; return false" onmousedown="return false"><?php echo Lang::main('clear'); ?></a></small> <small><a href="javascript:;" onclick="document.forms['fi'].elements['qu[]'].selectedIndex = -1; return false" onmousedown="return false"><?=Lang::main('clear'); ?></a></small>
<div class="clear"></div> <div class="clear"></div>
<select name="qu[]" size="7" multiple="multiple" class="rightselect" style="background-color: #181818"> <select name="qu[]" size="7" multiple="multiple" class="rightselect" style="background-color: #181818">
<?php <?php
@@ -29,8 +29,8 @@ endforeach;
</div> </div>
<div class="rightpanel2"> <div class="rightpanel2">
<div style="float: left"><?php echo Lang::game('type').Lang::main('colon'); ?></div> <div style="float: left"><?=Lang::game('type').Lang::main('colon'); ?></div>
<small><a href="javascript:;" onclick="document.forms['fi'].elements['ty[]'].selectedIndex = -1; return false" onmousedown="return false"><?php echo Lang::main('clear'); ?></a></small> <small><a href="javascript:;" onclick="document.forms['fi'].elements['ty[]'].selectedIndex = -1; return false" onmousedown="return false"><?=Lang::main('clear'); ?></a></small>
<div class="clear"></div> <div class="clear"></div>
<select name="ty[]" size="7" multiple="multiple" class="rightselect"> <select name="ty[]" size="7" multiple="multiple" class="rightselect">
<?php <?php
@@ -45,19 +45,19 @@ endforeach;
<table> <table>
<tr> <tr>
<td><?php echo Util::ucFirst(Lang::main('name')).Lang::main('colon'); ?></td> <td><?=Util::ucFirst(Lang::main('name')).Lang::main('colon'); ?></td>
<td colspan="3">&nbsp;<input type="text" name="na" size="30" <?php echo isset($f['na']) ? 'value="'.Util::htmlEscape($f['na']).'" ' : null; ?>/></td> <td colspan="3">&nbsp;<input type="text" name="na" size="30" <?=(isset($f['na']) ? 'value="'.Util::htmlEscape($f['na']).'" ' : null); ?>/></td>
</tr><tr> </tr><tr>
<td class="padded"><?php echo Lang::game('level').Lang::main('colon'); ?></td> <td class="padded"><?=Lang::game('level').Lang::main('colon'); ?></td>
<td class="padded">&nbsp;<input type="text" name="minle" maxlength="3" class="smalltextbox2" <?php echo isset($f['minle']) ? 'value="'.$f['minle'].'" ' : null; ?>/> - <input type="text" name="maxle" maxlength="3" class="smalltextbox2" <?php echo isset($f['maxle']) ? 'value="'.$f['maxle'].'" ' : null; ?>/></td> <td class="padded">&nbsp;<input type="text" name="minle" maxlength="3" class="smalltextbox2" <?=(isset($f['minle']) ? 'value="'.$f['minle'].'" ' : null); ?>/> - <input type="text" name="maxle" maxlength="3" class="smalltextbox2" <?=(isset($f['maxle']) ? 'value="'.$f['maxle'].'" ' : null); ?>/></td>
<td class="padded" width="100%"> <td class="padded" width="100%">
<table><tr> <table><tr>
<td>&nbsp;&nbsp;&nbsp;<?php echo Lang::main('_reqLevel').Lang::main('colon'); ?></td> <td>&nbsp;&nbsp;&nbsp;<?=Lang::main('_reqLevel').Lang::main('colon'); ?></td>
<td>&nbsp;<input type="text" name="minrl" maxlength="2" class="smalltextbox" <?php echo isset($f['minrl']) ? 'value="'.$f['minrl'].'" ' : null; ?>/> - <input type="text" name="maxrl" maxlength="2" class="smalltextbox" <?php echo isset($f['maxrl']) ? 'value="'.$f['maxrl'].'" ' : null; ?>/></td> <td>&nbsp;<input type="text" name="minrl" maxlength="2" class="smalltextbox" <?=(isset($f['minrl']) ? 'value="'.$f['minrl'].'" ' : null); ?>/> - <input type="text" name="maxrl" maxlength="2" class="smalltextbox" <?=(isset($f['maxrl']) ? 'value="'.$f['maxrl'].'" ' : null); ?>/></td>
</tr></table> </tr></table>
</td> </td>
</tr><tr> </tr><tr>
<td class="padded"><?php echo Util::ucFirst(Lang::game('class')).Lang::main('colon'); ?></td> <td class="padded"><?=Util::ucFirst(Lang::game('class')).Lang::main('colon'); ?></td>
<td class="padded">&nbsp;<select name="cl"> <td class="padded">&nbsp;<select name="cl">
<option></option> <option></option>
<?php <?php
@@ -70,7 +70,7 @@ endforeach;
</select></td> </select></td>
<td class="padded"> <td class="padded">
<table><tr> <table><tr>
<td>&nbsp;&nbsp;&nbsp;<?php echo Lang::itemset('_tag').Lang::main('colon'); ?></td> <td>&nbsp;&nbsp;&nbsp;<?=Lang::itemset('_tag').Lang::main('colon'); ?></td>
<td>&nbsp;<select name="ta"> <td>&nbsp;<select name="ta">
<option></option> <option></option>
<?php <?php
@@ -86,32 +86,25 @@ endforeach;
</tr> </tr>
</table> </table>
<div id="fi_criteria" class="padded criteria"><div></div></div><div><a href="javascript:;" id="fi_addcriteria" onclick="fi_addCriterion(this); return false"><?php echo Lang::main('addFilter'); ?></a></div> <div id="fi_criteria" class="padded criteria"><div></div></div><div><a href="javascript:;" id="fi_addcriteria" onclick="fi_addCriterion(this); return false"><?=Lang::main('addFilter'); ?></a></div>
<div class="padded2"> <div class="padded2">
<div style="float: right"><?php echo Lang::main('refineSearch'); ?></div> <div style="float: right"><?=Lang::main('refineSearch'); ?></div>
<?php echo Lang::main('match').Lang::main('colon'); ?><input type="radio" name="ma" value="" id="ma-0" <?php echo !isset($f['ma']) ? 'checked="checked" ' : null ?>/><label for="ma-0"><?php echo Lang::main('allFilter'); ?></label><input type="radio" name="ma" value="1" id="ma-1" <?php echo isset($f['ma']) ? 'checked="checked" ' : null ?> /><label for="ma-1"><?php echo Lang::main('oneFilter'); ?></label> <?=Lang::main('match').Lang::main('colon'); ?><input type="radio" name="ma" value="" id="ma-0" <?=(!isset($f['ma']) ? 'checked="checked" ' : null); ?>/><label for="ma-0"><?=Lang::main('allFilter'); ?></label><input type="radio" name="ma" value="1" id="ma-1" <?=(isset($f['ma']) ? 'checked="checked" ' : null); ?> /><label for="ma-1"><?=Lang::main('oneFilter'); ?></label>
</div> </div>
<div class="clear"></div> <div class="clear"></div>
<div class="padded"> <div class="padded">
<input type="submit" value="<?php echo Lang::main('applyFilter'); ?>" /> <input type="submit" value="<?=Lang::main('applyFilter'); ?>" />
<input type="reset" value="<?php echo Lang::main('resetForm'); ?>" /> <input type="reset" value="<?=Lang::main('resetForm'); ?>" />
</div> </div>
</form> </form>
<div class="pad"></div> <div class="pad"></div>
</div> </div>
<script type="text/javascript">//<![CDATA[ <?php $this->brick('filter', ['fi' => $f['initData']]); ?>
fi_init('itemsets');
<?php
foreach ($f['fi'] as $str):
echo ' '.$str."\n";
endforeach;
?>
//]]></script>
<?php $this->brick('lvTabs'); ?> <?php $this->brick('lvTabs'); ?>

View File

@@ -13,11 +13,11 @@ $this->brick('announcement');
$this->brick('pageTemplate', ['fi' => empty($f['query']) ? null : ['query' => $f['query'], 'menuItem' => 4]]); $this->brick('pageTemplate', ['fi' => empty($f['query']) ? null : ['query' => $f['query'], 'menuItem' => 4]]);
?> ?>
<div id="fi" style="display: <?php echo empty($f['query']) ? 'none' : 'block' ?>;"> <div id="fi" style="display: <?=(empty($f['query']) ? 'none' : 'block'); ?>;">
<form action="?npcs<?php echo $this->subCat; ?>&filter" method="post" name="fi" onsubmit="return fi_submit(this)" onreset="return fi_reset(this)"> <form action="?filter=npcs<?=$this->subCat; ?>" method="post" name="fi" onsubmit="return fi_submit(this)" onreset="return fi_reset(this)">
<div class="rightpanel"> <div class="rightpanel">
<div style="float: left"><?php echo Lang::npc('classification').Lang::main('colon'); ?></div> <div style="float: left"><?=Lang::npc('classification').Lang::main('colon'); ?></div>
<small><a href="javascript:;" onclick="document.forms['fi'].elements['cl[]'].selectedIndex = -1; return false" onmousedown="return false"><?php echo Lang::main('clear'); ?></a></small> <small><a href="javascript:;" onclick="document.forms['fi'].elements['cl[]'].selectedIndex = -1; return false" onmousedown="return false"><?=Lang::main('clear'); ?></a></small>
<div class="clear"></div> <div class="clear"></div>
<select name="cl[]" size="5" multiple="multiple" class="rightselect" style="width: 9.5em"> <select name="cl[]" size="5" multiple="multiple" class="rightselect" style="width: 9.5em">
<?php <?php
@@ -31,7 +31,7 @@ endforeach;
</div> </div>
<?php if ($this->petFamPanel): ?> <?php if ($this->petFamPanel): ?>
<div class="rightpanel2"> <div class="rightpanel2">
<div style="float: left"><?php echo Lang::npc('petFamily').Lang::main('colon'); ?></div><small><a href="javascript:;" onclick="document.forms['fi'].elements['fa[]'].selectedIndex = -1; return false" onmousedown="return false"><?php echo Lang::main('clear'); ?></a></small> <div style="float: left"><?=Lang::npc('petFamily').Lang::main('colon'); ?></div><small><a href="javascript:;" onclick="document.forms['fi'].elements['fa[]'].selectedIndex = -1; return false" onmousedown="return false"><?=Lang::main('clear'); ?></a></small>
<div class="clear"></div> <div class="clear"></div>
<select name="fa[]" size="7" multiple="multiple" class="rightselect"> <select name="fa[]" size="7" multiple="multiple" class="rightselect">
<?php <?php
@@ -46,31 +46,31 @@ endforeach;
<?php endif; ?> <?php endif; ?>
<table> <table>
<tr> <tr>
<td><?php echo Util::ucFirst(Lang::main('name')).Lang::main('colon'); ?></td> <td><?=Util::ucFirst(Lang::main('name')).Lang::main('colon'); ?></td>
<td colspan="2"> <td colspan="2">
<table><tr> <table><tr>
<td>&nbsp;<input type="text" name="na" size="30" <?php echo isset($f['na']) ? 'value="'.Util::htmlEscape($f['na']).'" ' : null; ?>/></td> <td>&nbsp;<input type="text" name="na" size="30" <?=(isset($f['na']) ? 'value="'.Util::htmlEscape($f['na']).'" ' : null); ?>/></td>
<td>&nbsp; <input type="checkbox" name="ex" value="on" id="npc-ex" <?php echo isset($f['ex']) ? 'checked="checked" ' : null; ?>/></td> <td>&nbsp; <input type="checkbox" name="ex" value="on" id="npc-ex" <?=(isset($f['ex']) ? 'checked="checked" ' : null); ?>/></td>
<td><label for="npc-ex"><span class="tip" onmouseover="$WH.Tooltip.showAtCursor(event, LANG.tooltip_extendednpcsearch, 0, 0, 'q')" onmousemove="$WH.Tooltip.cursorUpdate(event)" onmouseout="$WH.Tooltip.hide()"><?php echo Lang::main('extSearch'); ?></span></label></td> <td><label for="npc-ex"><span class="tip" onmouseover="$WH.Tooltip.showAtCursor(event, LANG.tooltip_extendednpcsearch, 0, 0, 'q')" onmousemove="$WH.Tooltip.cursorUpdate(event)" onmouseout="$WH.Tooltip.hide()"><?=Lang::main('extSearch'); ?></span></label></td>
</tr></table> </tr></table>
</td> </td>
</tr><tr> </tr><tr>
<td class="padded"><?php echo Lang::game('level').Lang::main('colon'); ?></td> <td class="padded"><?=Lang::game('level').Lang::main('colon'); ?></td>
<td class="padded">&nbsp;<input type="text" name="minle" maxlength="2" class="smalltextbox" <?php echo isset($f['minle']) ? 'value="'.$f['minle'].'" ' : null; ?>/> - <input type="text" name="maxle" maxlength="2" class="smalltextbox" <?php echo isset($f['maxle']) ? 'value="'.$f['maxle'].'" ' : null; ?>/></td> <td class="padded">&nbsp;<input type="text" name="minle" maxlength="2" class="smalltextbox" <?=(isset($f['minle']) ? 'value="'.$f['minle'].'" ' : null); ?>/> - <input type="text" name="maxle" maxlength="2" class="smalltextbox" <?=(isset($f['maxle']) ? 'value="'.$f['maxle'].'" ' : null); ?>/></td>
<td class="padded" width="100%"> <td class="padded" width="100%">
<table><tr> <table><tr>
<td>&nbsp;&nbsp;&nbsp;<?php echo Lang::npc('react').Lang::main('colon'); ?></td> <td>&nbsp;&nbsp;&nbsp;<?=Lang::npc('react').Lang::main('colon'); ?></td>
<td>&nbsp;<select name="ra" onchange="fi_dropdownSync(this)" onkeyup="fi_dropdownSync(this)" style="background-color: #181818"<?php echo isset($f['ra']) ? ' class="q'.($f['ra'] == 1 ? '2' : ($f['ra'] == -1 ? '10' : null)).'"' : null; ?>> <td>&nbsp;<select name="ra" onchange="fi_dropdownSync(this)" onkeyup="fi_dropdownSync(this)" style="background-color: #181818"<?=(isset($f['ra']) ? ' class="q'.($f['ra'] == 1 ? '2' : ($f['ra'] == -1 ? '10' : null)).'"' : null); ?>>
<option></option> <option></option>
<option value="1" class="q2"<?php echo isset($f['ra']) && $f['ra'] == 1 ? ' selected' : null; ?>>A</option> <option value="1" class="q2"<?=(isset($f['ra']) && $f['ra'] == 1 ? ' selected' : null); ?>>A</option>
<option value="0" class="q"<?php echo isset($f['ra']) && $f['ra'] == 0 ? ' selected' : null; ?>>A</option> <option value="0" class="q"<?=(isset($f['ra']) && $f['ra'] == 0 ? ' selected' : null); ?>>A</option>
<option value="-1" class="q10"<?php echo isset($f['ra']) && $f['ra'] == -1 ? ' selected' : null; ?>>A</option> <option value="-1" class="q10"<?=(isset($f['ra']) && $f['ra'] == -1 ? ' selected' : null); ?>>A</option>
</select> </select>
<select name="rh" onchange="fi_dropdownSync(this)" onkeyup="fi_dropdownSync(this)" style="background-color: #181818"<?php echo isset($f['rh']) ? ' class="q'.($f['rh'] == 1 ? '2' : ($f['rh'] == -1 ? '10' : null)).'"' : null; ?>> <select name="rh" onchange="fi_dropdownSync(this)" onkeyup="fi_dropdownSync(this)" style="background-color: #181818"<?=(isset($f['rh']) ? ' class="q'.($f['rh'] == 1 ? '2' : ($f['rh'] == -1 ? '10' : null)).'"' : null); ?>>
<option></option> <option></option>
<option value="1" class="q2"<?php echo isset($f['rh']) && $f['rh'] == 1 ? ' selected' : null; ?>>H</option> <option value="1" class="q2"<?=(isset($f['rh']) && $f['rh'] == 1 ? ' selected' : null); ?>>H</option>
<option value="0" class="q"<?php echo isset($f['rh']) && $f['rh'] == 0 ? ' selected' : null; ?>>H</option> <option value="0" class="q"<?=(isset($f['rh']) && $f['rh'] == 0 ? ' selected' : null); ?>>H</option>
<option value="-1" class="q10"<?php echo isset($f['rh']) && $f['rh'] == -1 ? ' selected' : null; ?>>H</option> <option value="-1" class="q10"<?=(isset($f['rh']) && $f['rh'] == -1 ? ' selected' : null); ?>>H</option>
</select> </select>
</td> </td>
</tr></table> </tr></table>
@@ -78,32 +78,25 @@ endforeach;
</tr> </tr>
</table> </table>
<div id="fi_criteria" class="padded criteria"><div></div></div><div><a href="javascript:;" id="fi_addcriteria" onclick="fi_addCriterion(this); return false"><?php echo Lang::main('addFilter'); ?></a></div> <div id="fi_criteria" class="padded criteria"><div></div></div><div><a href="javascript:;" id="fi_addcriteria" onclick="fi_addCriterion(this); return false"><?=Lang::main('addFilter'); ?></a></div>
<div class="padded2 clear"> <div class="padded2 clear">
<div style="float: right"><?php echo Lang::main('refineSearch'); ?></div> <div style="float: right"><?=Lang::main('refineSearch'); ?></div>
<?php echo Lang::main('match').Lang::main('colon'); ?><input type="radio" name="ma" value="" id="ma-0" <?php echo !isset($f['ma']) ? 'checked="checked" ' : null ?>/><label for="ma-0"><?php echo Lang::main('allFilter'); ?></label><input type="radio" name="ma" value="1" id="ma-1" <?php echo isset($f['ma']) ? 'checked="checked" ' : null ?> /><label for="ma-1"><?php echo Lang::main('oneFilter'); ?></label> <?=Lang::main('match').Lang::main('colon'); ?><input type="radio" name="ma" value="" id="ma-0" <?=(!isset($f['ma']) ? 'checked="checked" ' : null); ?>/><label for="ma-0"><?=Lang::main('allFilter'); ?></label><input type="radio" name="ma" value="1" id="ma-1" <?=(isset($f['ma']) ? 'checked="checked" ' : null); ?> /><label for="ma-1"><?=Lang::main('oneFilter'); ?></label>
</div> </div>
<div class="clear"></div> <div class="clear"></div>
<div class="padded"> <div class="padded">
<input type="submit" value="<?php echo Lang::main('applyFilter'); ?>" /> <input type="submit" value="<?=Lang::main('applyFilter'); ?>" />
<input type="reset" value="<?php echo Lang::main('resetForm'); ?>" /> <input type="reset" value="<?=Lang::main('resetForm'); ?>" />
</div> </div>
</form> </form>
<div class="pad"></div> <div class="pad"></div>
</div> </div>
<script type="text/javascript">//<![CDATA[ <?php $this->brick('filter', ['fi' => $f['initData']]); ?>
fi_init('npcs');
<?php
foreach ($f['fi'] as $str):
echo ' '.$str."\n";
endforeach;
?>
//]]></script>
<?php $this->brick('lvTabs'); ?> <?php $this->brick('lvTabs'); ?>

View File

@@ -13,38 +13,31 @@ $this->brick('announcement');
$this->brick('pageTemplate', ['fi' => empty($f['query']) ? null : ['query' => $f['query'], 'menuItem' => 5]]); $this->brick('pageTemplate', ['fi' => empty($f['query']) ? null : ['query' => $f['query'], 'menuItem' => 5]]);
?> ?>
<div id="fi" style="display: <?php echo empty($f['query']) ? 'none' : 'block' ?>;"> <div id="fi" style="display: <?=(empty($f['query']) ? 'none' : 'block'); ?>;">
<form action="?objects<?php echo $this->subCat; ?>&filter" method="post" name="fi" onsubmit="return fi_submit(this)" onreset="return fi_reset(this)"> <form action="?filter=objects<?=$this->subCat; ?>" method="post" name="fi" onsubmit="return fi_submit(this)" onreset="return fi_reset(this)">
<table> <table>
<tr><td><?php echo Util::ucFirst(Lang::main('name')).Lang::main('colon'); ?></td><td>&nbsp;<input type="text" name="na" size="30" <?php echo isset($f['na']) ? 'value="'.Util::htmlEscape($f['na']).'" ' : null; ?>/></td></tr> <tr><td><?=Util::ucFirst(Lang::main('name')).Lang::main('colon'); ?></td><td>&nbsp;<input type="text" name="na" size="30" <?=(isset($f['na']) ? 'value="'.Util::htmlEscape($f['na']).'" ' : null); ?>/></td></tr>
</table> </table>
<div id="fi_criteria" class="padded criteria"><div></div></div><div><a href="javascript:;" id="fi_addcriteria" onclick="fi_addCriterion(this); return false"><?php echo Lang::main('addFilter'); ?></a></div> <div id="fi_criteria" class="padded criteria"><div></div></div><div><a href="javascript:;" id="fi_addcriteria" onclick="fi_addCriterion(this); return false"><?=Lang::main('addFilter'); ?></a></div>
<div class="padded2 clear"> <div class="padded2 clear">
<div style="float: right"><?php echo Lang::main('refineSearch'); ?></div> <div style="float: right"><?=Lang::main('refineSearch'); ?></div>
<?php echo Lang::main('match').Lang::main('colon'); ?><input type="radio" name="ma" value="" id="ma-0" <?php echo !isset($f['ma']) ? 'checked="checked" ' : null ?>/><label for="ma-0"><?php echo Lang::main('allFilter'); ?></label><input type="radio" name="ma" value="1" id="ma-1" <?php echo isset($f['ma']) ? 'checked="checked" ' : null ?> /><label for="ma-1"><?php echo Lang::main('oneFilter'); ?></label> <?=Lang::main('match').Lang::main('colon'); ?><input type="radio" name="ma" value="" id="ma-0" <?=(!isset($f['ma']) ? 'checked="checked" ' : null); ?>/><label for="ma-0"><?=Lang::main('allFilter'); ?></label><input type="radio" name="ma" value="1" id="ma-1" <?=(isset($f['ma']) ? 'checked="checked" ' : null); ?> /><label for="ma-1"><?=Lang::main('oneFilter'); ?></label>
</div> </div>
<div class="clear"></div> <div class="clear"></div>
<div class="padded"> <div class="padded">
<input type="submit" value="<?php echo Lang::main('applyFilter'); ?>" /> <input type="submit" value="<?=Lang::main('applyFilter'); ?>" />
<input type="reset" value="<?php echo Lang::main('resetForm'); ?>" /> <input type="reset" value="<?=Lang::main('resetForm'); ?>" />
</div> </div>
</form> </form>
<div class="pad"></div> <div class="pad"></div>
</div> </div>
<script type="text/javascript">//<![CDATA[ <?php $this->brick('filter', ['fi' => $f['initData']]); ?>
fi_init('objects');
<?php
foreach ($f['fi'] as $str):
echo ' '.$str."\n";
endforeach;
?>
//]]></script>
<?php $this->brick('lvTabs'); ?> <?php $this->brick('lvTabs'); ?>

View File

@@ -15,7 +15,7 @@ $this->brick('pageTemplate');
# for some arcane reason a newline (\n) means, the first childNode is a text instead of the form for the following div # for some arcane reason a newline (\n) means, the first childNode is a text instead of the form for the following div
?> ?>
<div id="fi" style="display: <?php echo empty($f['query']) ? 'none' : 'block' ?>;"><form <div id="fi" style="display: <?php echo empty($f['query']) ? 'none' : 'block' ?>;"><form
action="?profiles&filter" method="post" name="fi" onsubmit="return fi_submit(this)" onreset="return fi_reset(this)"> action="?filter=profiles" method="post" name="fi" onsubmit="return fi_submit(this)" onreset="return fi_reset(this)">
<div class="rightpanel"> <div class="rightpanel">
<div style="float: left"><?php echo Util::ucFirst(Lang::game('class')).Lang::main('colon'); ?></div> <div style="float: left"><?php echo Util::ucFirst(Lang::game('class')).Lang::main('colon'); ?></div>
<small><a href="javascript:;" onclick="document.forms['fi'].elements['cl[]'].selectedIndex = -1; return false" onmousedown="return false"><?php echo Lang::main('clear'); ?></a></small> <small><a href="javascript:;" onclick="document.forms['fi'].elements['cl[]'].selectedIndex = -1; return false" onmousedown="return false"><?php echo Lang::main('clear'); ?></a></small>

View File

@@ -13,10 +13,10 @@ $this->brick('announcement');
$this->brick('pageTemplate', ['fi' => empty($f['query']) ? null : ['query' => $f['query'], 'menuItem' => 3]]); $this->brick('pageTemplate', ['fi' => empty($f['query']) ? null : ['query' => $f['query'], 'menuItem' => 3]]);
?> ?>
<div id="fi" style="display: <?php echo empty($f['query']) ? 'none' : 'block' ?>;"> <div id="fi" style="display: <?=(empty($f['query']) ? 'none' : 'block'); ?>;">
<form action="?quests<?php echo $this->subCat; ?>&filter" method="post" name="fi" onsubmit="return fi_submit(this)" onreset="return fi_reset(this)"> <form action="?filter=quests<?=$this->subCat; ?>" method="post" name="fi" onsubmit="return fi_submit(this)" onreset="return fi_reset(this)">
<div class="rightpanel"> <div class="rightpanel">
<div style="float: left"><?php echo Lang::game('type').Lang::main('colon'); ?></div><small><a href="javascript:;" onclick="document.forms['fi'].elements['ty[]'].selectedIndex = -1; return false" onmousedown="return false"><?php echo Lang::main('clear'); ?></a></small> <div style="float: left"><?=Lang::game('type').Lang::main('colon'); ?></div><small><a href="javascript:;" onclick="document.forms['fi'].elements['ty[]'].selectedIndex = -1; return false" onmousedown="return false"><?=Lang::main('clear'); ?></a></small>
<div class="clear"></div> <div class="clear"></div>
<select name="ty[]" size="6" multiple="multiple" class="rightselect"> <select name="ty[]" size="6" multiple="multiple" class="rightselect">
<?php <?php
@@ -29,27 +29,27 @@ endforeach;
<table> <table>
<tr> <tr>
<td><?php echo Util::ucFirst(Lang::main('name')).Lang::main('colon'); ?></td> <td><?=Util::ucFirst(Lang::main('name')).Lang::main('colon'); ?></td>
<td colspan="3"> <td colspan="3">
<table><tr> <table><tr>
<td>&nbsp;<input type="text" name="na" size="30" <?php echo isset($f['na']) ? 'value="'.Util::htmlEscape($f['na']).'" ' : null; ?>/></td> <td>&nbsp;<input type="text" name="na" size="30" <?=(isset($f['na']) ? 'value="'.Util::htmlEscape($f['na']).'" ' : null); ?>/></td>
<td>&nbsp; <input type="checkbox" name="ex" value="on" id="quest-ex" <?php echo isset($f['ex']) ? 'checked ' : null; ?>/></td> <td>&nbsp; <input type="checkbox" name="ex" value="on" id="quest-ex" <?=(isset($f['ex']) ? 'checked ' : null); ?>/></td>
<td><label for="quest-ex"><span class="tip" onmouseover="$WH.Tooltip.showAtCursor(event, LANG.tooltip_extendedquestsearch, 0, 0, 'q')" onmousemove="$WH.Tooltip.cursorUpdate(event)" onmouseout="$WH.Tooltip.hide()"><?php echo Lang::main('extSearch'); ?></span></label></td> <td><label for="quest-ex"><span class="tip" onmouseover="$WH.Tooltip.showAtCursor(event, LANG.tooltip_extendedquestsearch, 0, 0, 'q')" onmousemove="$WH.Tooltip.cursorUpdate(event)" onmouseout="$WH.Tooltip.hide()"><?=Lang::main('extSearch'); ?></span></label></td>
</tr></table> </tr></table>
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="padded"><?php echo Lang::game('level').Lang::main('colon'); ?></td> <td class="padded"><?=Lang::game('level').Lang::main('colon'); ?></td>
<td class="padded">&nbsp;<input type="text" name="minle" maxlength="2" class="smalltextbox" <?php echo isset($f['minle']) ? 'value="'.$f['minle'].'" ' : null; ?>/> - <input type="text" name="maxle" maxlength="2" class="smalltextbox" <?php echo isset($f['maxle']) ? 'value="'.$f['maxle'].'" ' : null; ?>/></td> <td class="padded">&nbsp;<input type="text" name="minle" maxlength="2" class="smalltextbox" <?=(isset($f['minle']) ? 'value="'.$f['minle'].'" ' : null); ?>/> - <input type="text" name="maxle" maxlength="2" class="smalltextbox" <?=(isset($f['maxle']) ? 'value="'.$f['maxle'].'" ' : null); ?>/></td>
<td class="padded" width="100%"> <td class="padded" width="100%">
<table><tr> <table><tr>
<td>&nbsp;&nbsp;&nbsp;<?php echo Lang::main('_reqLevel').Lang::main('colon'); ?></td> <td>&nbsp;&nbsp;&nbsp;<?=Lang::main('_reqLevel').Lang::main('colon'); ?></td>
<td>&nbsp;<input type="text" name="minrl" maxlength="2" class="smalltextbox" <?php echo isset($f['minrl']) ? 'value="'.$f['minrl'].'" ' : null; ?>/> - <input type="text" name="maxrl" maxlength="2" class="smalltextbox" <?php echo isset($f['maxrl']) ? 'value="'.$f['maxrl'].'" ' : null; ?>/></td> <td>&nbsp;<input type="text" name="minrl" maxlength="2" class="smalltextbox" <?=(isset($f['minrl']) ? 'value="'.$f['minrl'].'" ' : null); ?>/> - <input type="text" name="maxrl" maxlength="2" class="smalltextbox" <?=(isset($f['maxrl']) ? 'value="'.$f['maxrl'].'" ' : null); ?>/></td>
</tr></table> </tr></table>
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="padded"><?php echo Lang::main('side').Lang::main('colon'); ?></td> <td class="padded"><?=Lang::main('side').Lang::main('colon'); ?></td>
<td class="padded" colspan="3">&nbsp;<select name="si"> <td class="padded" colspan="3">&nbsp;<select name="si">
<option></option> <option></option>
<?php <?php
@@ -60,32 +60,25 @@ endforeach;
</select></td> </select></td>
</tr> </tr>
</table> </table>
<div id="fi_criteria" class="padded criteria"><div></div></div><div><a href="javascript:;" id="fi_addcriteria" onclick="fi_addCriterion(this); return false"><?php echo Lang::main('addFilter'); ?></a></div> <div id="fi_criteria" class="padded criteria"><div></div></div><div><a href="javascript:;" id="fi_addcriteria" onclick="fi_addCriterion(this); return false"><?=Lang::main('addFilter'); ?></a></div>
<div class="padded2 clear"> <div class="padded2 clear">
<div style="float: right"><?php echo Lang::main('refineSearch'); ?></div> <div style="float: right"><?=Lang::main('refineSearch'); ?></div>
<?php echo Lang::main('match').Lang::main('colon'); ?><input type="radio" name="ma" value="" id="ma-0" <?php echo !isset($f['ma']) ? 'checked="checked" ' : null ?>/><label for="ma-0"><?php echo Lang::main('allFilter'); ?></label><input type="radio" name="ma" value="1" id="ma-1" <?php echo isset($f['ma']) ? 'checked="checked" ' : null ?> /><label for="ma-1"><?php echo Lang::main('oneFilter'); ?></label> <?=Lang::main('match').Lang::main('colon'); ?><input type="radio" name="ma" value="" id="ma-0" <?=(!isset($f['ma']) ? 'checked="checked" ' : null); ?>/><label for="ma-0"><?=Lang::main('allFilter'); ?></label><input type="radio" name="ma" value="1" id="ma-1" <?=(isset($f['ma']) ? 'checked="checked" ' : null); ?> /><label for="ma-1"><?=Lang::main('oneFilter'); ?></label>
</div> </div>
<div class="clear"></div> <div class="clear"></div>
<div class="padded"> <div class="padded">
<input type="submit" value="<?php echo Lang::main('applyFilter'); ?>" /> <input type="submit" value="<?=Lang::main('applyFilter'); ?>" />
<input type="reset" value="<?php echo Lang::main('resetForm'); ?>" /> <input type="reset" value="<?=Lang::main('resetForm'); ?>" />
</div> </div>
</form> </form>
<div class="pad"></div> <div class="pad"></div>
</div> </div>
<script type="text/javascript">//<![CDATA[ <?php $this->brick('filter', ['fi' => $f['initData']]); ?>
fi_init('quests');
<?php
foreach ($f['fi'] as $str):
echo ' '.$str."\n";
endforeach;
?>
//]]></script>
<?php $this->brick('lvTabs'); ?> <?php $this->brick('lvTabs'); ?>

View File

@@ -13,11 +13,11 @@ $this->brick('announcement');
$this->brick('pageTemplate', ['fi' => empty($f['query']) ? null : ['query' => $f['query'], 'menuItem' => 101]]); $this->brick('pageTemplate', ['fi' => empty($f['query']) ? null : ['query' => $f['query'], 'menuItem' => 101]]);
?> ?>
<div class="text"><h1><?=$this->name; ?>&nbsp;<?=$this->brick('redButtons'); ?></h1></div> <div class="text"><h1><?=$this->name; ?>&nbsp;<?=$this->brick('redButtons'); ?></h1></div>
<div id="fi" style="display: <?php echo empty($f['query']) ? 'none' : 'block' ?>;"> <div id="fi" style="display: <?=(empty($f['query']) ? 'none' : 'block'); ?>;">
<form action="?sounds&filter" method="post" name="fi" onsubmit="return fi_submit(this)" onreset="return fi_reset(this)"> <form action="?filter=sounds" method="post" name="fi" onsubmit="return fi_submit(this)" onreset="return fi_reset(this)">
<div class="rightpanel"> <div class="rightpanel">
<div style="float: left"><?php echo Util::ucFirst(Lang::game('type')).Lang::main('colon'); ?></div> <div style="float: left"><?=Util::ucFirst(Lang::game('type')).Lang::main('colon'); ?></div>
<small><a href="javascript:;" onclick="document.forms['fi'].elements['ty[]'].selectedIndex = -1; return false" onmousedown="return false"><?php echo Lang::main('clear'); ?></a></small> <small><a href="javascript:;" onclick="document.forms['fi'].elements['ty[]'].selectedIndex = -1; return false" onmousedown="return false"><?=Lang::main('clear'); ?></a></small>
<div class="clear"></div> <div class="clear"></div>
<select name="ty[]" size="6" multiple="multiple" class="rightselect"> <select name="ty[]" size="6" multiple="multiple" class="rightselect">
<?php <?php
@@ -31,10 +31,10 @@ endforeach;
</div> </div>
<table> <table>
<tr> <tr>
<td><?php echo Util::ucFirst(Lang::main('name')).Lang::main('colon'); ?></td> <td><?=Util::ucFirst(Lang::main('name')).Lang::main('colon'); ?></td>
<td colspan="2"> <td colspan="2">
<table><tr> <table><tr>
<td>&nbsp;<input type="text" name="na" size="30" <?php echo isset($f['na']) ? 'value="'.Util::htmlEscape($f['na']).'" ' : null; ?>/></td> <td>&nbsp;<input type="text" name="na" size="30" <?=(isset($f['na']) ? 'value="'.Util::htmlEscape($f['na']).'" ' : null); ?>/></td>
</tr></table> </tr></table>
</td> </td>
</tr><tr> </tr><tr>
@@ -43,8 +43,8 @@ endforeach;
<div class="clear"></div> <div class="clear"></div>
<div class="padded"> <div class="padded">
<input type="submit" value="<?php echo Lang::main('applyFilter'); ?>" /> <input type="submit" value="<?=Lang::main('applyFilter'); ?>" />
<input type="reset" value="<?php echo Lang::main('resetForm'); ?>" /> <input type="reset" value="<?=Lang::main('resetForm'); ?>" />
</div> </div>
</form> </form>

View File

@@ -13,11 +13,11 @@ $this->brick('announcement');
$this->brick('pageTemplate', ['fi' => empty($f['query']) ? null : ['query' => $f['query'], 'menuItem' => 1]]); $this->brick('pageTemplate', ['fi' => empty($f['query']) ? null : ['query' => $f['query'], 'menuItem' => 1]]);
?> ?>
<div id="fi" style="display: <?php echo empty($f['query']) ? 'none' : 'block' ?>;"> <div id="fi" style="display: <?=(empty($f['query']) ? 'none' : 'block'); ?>;">
<form action="?spells<?php echo $this->subCat; ?>&filter" method="post" name="fi" onsubmit="return fi_submit(this)" onreset="return fi_reset(this)"> <form action="?filter=spells<?=$this->subCat; ?>" method="post" name="fi" onsubmit="return fi_submit(this)" onreset="return fi_reset(this)">
<div class="rightpanel"> <div class="rightpanel">
<div style="float: left"><?php echo Lang::game('school').Lang::main('colon'); ?></div> <div style="float: left"><?=Lang::game('school').Lang::main('colon'); ?></div>
<small><a href="javascript:;" onclick="document.forms['fi'].elements['sc[]'].selectedIndex = -1; return false" onmousedown="return false"><?php echo Lang::main('clear'); ?></a></small> <small><a href="javascript:;" onclick="document.forms['fi'].elements['sc[]'].selectedIndex = -1; return false" onmousedown="return false"><?=Lang::main('clear'); ?></a></small>
<div class="clear"></div> <div class="clear"></div>
<select name="sc[]" size="7" multiple="multiple" class="rightselect" style="width: 8em"> <select name="sc[]" size="7" multiple="multiple" class="rightselect" style="width: 8em">
<?php <?php
@@ -29,10 +29,10 @@ endforeach;
?> ?>
</select> </select>
</div> </div>
<?php if ($f['classPanel']): ?> <?php if ($this->classPanel): ?>
<div class="rightpanel2"> <div class="rightpanel2">
<div style="float: left"><?php echo Util::ucFirst(Lang::game('class')).Lang::main('colon'); ?></div> <div style="float: left"><?=Util::ucFirst(Lang::game('class')).Lang::main('colon'); ?></div>
<small><a href="javascript:;" onclick="document.forms['fi'].elements['cl[]'].selectedIndex = -1; return false" onmousedown="return false"><?php echo Lang::main('clear'); ?></a></small> <small><a href="javascript:;" onclick="document.forms['fi'].elements['cl[]'].selectedIndex = -1; return false" onmousedown="return false"><?=Lang::main('clear'); ?></a></small>
<div class="clear"></div> <div class="clear"></div>
<select name="cl[]" size="8" multiple="multiple" class="rightselect" style="width: 8em; background-color: #181818"> <select name="cl[]" size="8" multiple="multiple" class="rightselect" style="width: 8em; background-color: #181818">
<?php <?php
@@ -47,11 +47,11 @@ endforeach;
<?php <?php
endif; endif;
if ($f['glyphPanel']): if ($this->glyphPanel):
?> ?>
<div class="rightpanel2"> <div class="rightpanel2">
<div style="float: left"><?php echo Util::ucFirst(Lang::game('glyphType')).Lang::main('colon'); ?></div> <div style="float: left"><?=Util::ucFirst(Lang::game('glyphType')).Lang::main('colon'); ?></div>
<small><a href="javascript:;" onclick="document.forms['fi'].elements['gl[]'].selectedIndex = -1; return false" onmousedown="return false"><?php echo Lang::main('clear'); ?></a></small> <small><a href="javascript:;" onclick="document.forms['fi'].elements['gl[]'].selectedIndex = -1; return false" onmousedown="return false"><?=Lang::main('clear'); ?></a></small>
<div class="clear"></div> <div class="clear"></div>
<select name="gl[]" size="2" multiple="multiple" class="rightselect" style="width: 8em"> <select name="gl[]" size="2" multiple="multiple" class="rightselect" style="width: 8em">
<?php <?php
@@ -66,25 +66,25 @@ endforeach;
<?php endif; ?> <?php endif; ?>
<table> <table>
<tr> <tr>
<td><?php echo Util::ucFirst(Lang::main('name')).Lang::main('colon'); ?></td> <td><?=Util::ucFirst(Lang::main('name')).Lang::main('colon'); ?></td>
<td colspan="2"> <td colspan="2">
<table><tr> <table><tr>
<td>&nbsp;<input type="text" name="na" size="30" <?php echo isset($f['na']) ? 'value="'.Util::htmlEscape($f['na']).'" ' : null; ?>/></td> <td>&nbsp;<input type="text" name="na" size="30" <?=(isset($f['na']) ? 'value="'.Util::htmlEscape($f['na']).'" ' : null); ?>/></td>
<td>&nbsp; <input type="checkbox" name="ex" value="on" id="spell-ex" <?php echo isset($f['ex']) ? 'checked="checked" ' : null; ?>/></td> <td>&nbsp; <input type="checkbox" name="ex" value="on" id="spell-ex" <?=(isset($f['ex']) ? 'checked="checked" ' : null); ?>/></td>
<td><label for="spell-ex"><span class="tip" onmouseover="$WH.Tooltip.showAtCursor(event, LANG.tooltip_extendedspellsearch, 0, 0, 'q')" onmousemove="$WH.Tooltip.cursorUpdate(event)" onmouseout="$WH.Tooltip.hide()"><?php echo Lang::main('extSearch'); ?></span></label></td> <td><label for="spell-ex"><span class="tip" onmouseover="$WH.Tooltip.showAtCursor(event, LANG.tooltip_extendedspellsearch, 0, 0, 'q')" onmousemove="$WH.Tooltip.cursorUpdate(event)" onmouseout="$WH.Tooltip.hide()"><?=Lang::main('extSearch'); ?></span></label></td>
</tr></table> </tr></table>
</td> </td>
</tr><tr> </tr><tr>
<td class="padded"><?php echo Lang::game('level').Lang::main('colon'); ?></td> <td class="padded"><?=Lang::game('level').Lang::main('colon'); ?></td>
<td class="padded">&nbsp;<input type="text" name="minle" maxlength="2" class="smalltextbox" <?php echo isset($f['minle']) ? 'value="'.$f['minle'].'" ' : null; ?>/> - <input type="text" name="maxle" maxlength="2" class="smalltextbox" <?php echo isset($f['maxle']) ? 'value="'.$f['maxle'].'" ' : null; ?>/></td> <td class="padded">&nbsp;<input type="text" name="minle" maxlength="2" class="smalltextbox" <?=(isset($f['minle']) ? 'value="'.$f['minle'].'" ' : null); ?>/> - <input type="text" name="maxle" maxlength="2" class="smalltextbox" <?=(isset($f['maxle']) ? 'value="'.$f['maxle'].'" ' : null); ?>/></td>
<td class="padded"> <td class="padded">
<table cellpadding="0" cellspacing="0" border="0"><tr> <table cellpadding="0" cellspacing="0" border="0"><tr>
<td>&nbsp;&nbsp;&nbsp;<?php echo Lang::game('reqSkillLevel').Lang::main('colon'); ?></td> <td>&nbsp;&nbsp;&nbsp;<?=Lang::game('reqSkillLevel').Lang::main('colon'); ?></td>
<td>&nbsp;<input type="text" name="minrs" maxlength="3" class="smalltextbox2" <?php echo isset($f['minrs']) ? 'value="'.$f['minrs'].'" ' : null; ?>/> - <input type="text" name="maxrs" maxlength="3" class="smalltextbox2" <?php echo isset($f['maxrs']) ? 'value="'.$f['maxrs'].'" ' : null; ?>/></td> <td>&nbsp;<input type="text" name="minrs" maxlength="3" class="smalltextbox2" <?=(isset($f['minrs']) ? 'value="'.$f['minrs'].'" ' : null); ?>/> - <input type="text" name="maxrs" maxlength="3" class="smalltextbox2" <?=(isset($f['maxrs']) ? 'value="'.$f['maxrs'].'" ' : null); ?>/></td>
</tr></table> </tr></table>
</td> </td>
</tr><tr> </tr><tr>
<td class="padded"><?php echo Util::ucFirst(Lang::game('race')).Lang::main('colon'); ?></td> <td class="padded"><?=Util::ucFirst(Lang::game('race')).Lang::main('colon'); ?></td>
<td class="padded">&nbsp;<select name="ra"> <td class="padded">&nbsp;<select name="ra">
<option></option> <option></option>
<?php <?php
@@ -97,7 +97,7 @@ endforeach;
</select></td> </select></td>
<td class="padded"></td> <td class="padded"></td>
</tr><tr> </tr><tr>
<td class="padded"><?php echo Lang::game('mechAbbr').Lang::main('colon'); ?></td> <td class="padded"><?=Lang::game('mechAbbr').Lang::main('colon'); ?></td>
<td class="padded">&nbsp;<select name="me"> <td class="padded">&nbsp;<select name="me">
<option></option> <option></option>
<?php <?php
@@ -110,7 +110,7 @@ endforeach;
</select></td> </select></td>
<td> <td>
<table cellpadding="0" cellspacing="0" border="0"><tr> <table cellpadding="0" cellspacing="0" border="0"><tr>
<td class="padded">&nbsp;&nbsp;&nbsp;<?php echo Lang::game('dispelType').Lang::main('colon'); ?></td> <td class="padded">&nbsp;&nbsp;&nbsp;<?=Lang::game('dispelType').Lang::main('colon'); ?></td>
<td class="padded">&nbsp;<select name="dt"> <td class="padded">&nbsp;<select name="dt">
<option></option> <option></option>
<?php <?php
@@ -126,32 +126,25 @@ endforeach;
</tr> </tr>
</table> </table>
<div id="fi_criteria" class="padded criteria"><div></div></div><div><a href="javascript:;" id="fi_addcriteria" onclick="fi_addCriterion(this); return false"><?php echo Lang::main('addFilter'); ?></a></div> <div id="fi_criteria" class="padded criteria"><div></div></div><div><a href="javascript:;" id="fi_addcriteria" onclick="fi_addCriterion(this); return false"><?=Lang::main('addFilter'); ?></a></div>
<div class="padded2"> <div class="padded2">
<div style="float: right"><?php echo Lang::main('refineSearch'); ?></div> <div style="float: right"><?=Lang::main('refineSearch'); ?></div>
<?php echo Lang::main('match').Lang::main('colon'); ?><input type="radio" name="ma" value="" id="ma-0" <?php echo !isset($f['ma']) ? 'checked="checked" ' : null ?>/><label for="ma-0"><?php echo Lang::main('allFilter'); ?></label><input type="radio" name="ma" value="1" id="ma-1" <?php echo isset($f['ma']) ? 'checked="checked" ' : null ?> /><label for="ma-1"><?php echo Lang::main('oneFilter'); ?></label> <?=Lang::main('match').Lang::main('colon'); ?><input type="radio" name="ma" value="" id="ma-0" <?=(!isset($f['ma']) ? 'checked="checked" ' : null); ?>/><label for="ma-0"><?=Lang::main('allFilter'); ?></label><input type="radio" name="ma" value="1" id="ma-1" <?=(isset($f['ma']) ? 'checked="checked" ' : null); ?> /><label for="ma-1"><?=Lang::main('oneFilter'); ?></label>
</div> </div>
<div class="clear"></div> <div class="clear"></div>
<div class="padded"> <div class="padded">
<input type="submit" value="<?php echo Lang::main('applyFilter'); ?>" /> <input type="submit" value="<?=Lang::main('applyFilter'); ?>" />
<input type="reset" value="<?php echo Lang::main('resetForm'); ?>" /> <input type="reset" value="<?=Lang::main('resetForm'); ?>" />
</div> </div>
</form> </form>
<div class="pad"></div> <div class="pad"></div>
</div> </div>
<script type="text/javascript">//<![CDATA[ <?php $this->brick('filter', ['fi' => $f['initData']]); ?>
fi_init('spells');
<?php
foreach ($f['fi'] as $str):
echo ' '.$str."\n";
endforeach;
?>
//]]></script>
<?php $this->brick('lvTabs'); ?> <?php $this->brick('lvTabs'); ?>