mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
Whoops
* partially revert 99760d7c72
* fixed another type on quests list page
* added default cases for empty data to pets and races list pages
* improved typelist iterator to be recursively callable
This commit is contained in:
@@ -247,7 +247,7 @@ class AjaxAdmin extends AjaxHandler
|
||||
{
|
||||
$typeIds = explode(',', $typeIds);
|
||||
$toUnflag = DB::Aowow()->selectCol('SELECT typeId AS ARRAY_KEY, IF(BIT_OR(`status`) & ?d, 1, 0) AS hasMore FROM ?_screenshots WHERE `type` = ?d AND typeId IN (?a) GROUP BY typeId HAVING hasMore = 0', CC_FLAG_APPROVED, $type, $typeIds);
|
||||
if ($toUnflag && Util::$typeClasses[$type] && ($tbl = (new Util::$typeClasses[$type])::$dataTable))
|
||||
if ($toUnflag && Util::$typeClasses[$type] && ($tbl = (new Util::$typeClasses[$type](null))::$dataTable))
|
||||
DB::Aowow()->query('UPDATE '.$tbl.' SET cuFlags = cuFlags & ~?d WHERE id IN (?a)', CUSTOM_HAS_SCREENSHOT, array_keys($toUnflag));
|
||||
}
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ class AjaxComment extends AjaxHandler
|
||||
DB::Aowow()->query('INSERT INTO ?_comments_rates (commentId, userId, value) VALUES (?d, 0, 1)', $postIdx);
|
||||
|
||||
// flag target with hasComment
|
||||
if (Util::$typeClasses[$this->_get['type']] && ($tbl = (new Util::$typeClasses[$this->_get['type']])::$dataTable))
|
||||
if (Util::$typeClasses[$this->_get['type']] && ($tbl = (new Util::$typeClasses[$this->_get['type']](null))::$dataTable))
|
||||
DB::Aowow()->query('UPDATE '.$tbl.' SET cuFlags = cuFlags | ?d WHERE id = ?d', CUSTOM_HAS_COMMENT, $this->_get['typeid']);
|
||||
}
|
||||
}
|
||||
@@ -151,7 +151,7 @@ class AjaxComment extends AjaxHandler
|
||||
$this->_post['id']
|
||||
);
|
||||
|
||||
if (!$coInfo['hasMore'] && Util::$typeClasses[$coInfo['type']] && ($tbl = (new Util::$typeClasses[$coInfo['type']])::$dataTable))
|
||||
if (!$coInfo['hasMore'] && Util::$typeClasses[$coInfo['type']] && ($tbl = (new Util::$typeClasses[$coInfo['type']](null))::$dataTable))
|
||||
DB::Aowow()->query('UPDATE '.$tbl.' SET cuFlags = cuFlags & ~?d WHERE id = ?d', CUSTOM_HAS_COMMENT, $coInfo['typeId']);
|
||||
}
|
||||
}
|
||||
@@ -172,7 +172,7 @@ class AjaxComment extends AjaxHandler
|
||||
if ($ok)
|
||||
{
|
||||
$coInfo = DB::Aowow()->selectRow('SELECT type, typeId FROM ?_comments WHERE id = ?d', $this->_post['id']);
|
||||
if (Util::$typeClasses[$coInfo['type']] && ($tbl = (new Util::$typeClasses[$coInfo['type']])::$dataTable))
|
||||
if (Util::$typeClasses[$coInfo['type']] && ($tbl = (new Util::$typeClasses[$coInfo['type']](null))::$dataTable))
|
||||
DB::Aowow()->query('UPDATE '.$tbl.' SET cuFlags = cuFlags | ?d WHERE id = ?d', CUSTOM_HAS_COMMENT, $coInfo['typeId']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,14 +50,14 @@ abstract class BaseType
|
||||
* results in
|
||||
* WHERE ((`id` = 45) OR (`name` NOT LIKE "test%") OR ((`flags` & 255) AND (`flags2` & 15)) OR ((`mask` & 3) = 0)) OR (`joinedTbl`.`field` IS NULL) LIMIT 5
|
||||
*/
|
||||
public function __construct(array $conditions = [], $miscData = null)
|
||||
public function __construct($conditions = [], $miscData = null)
|
||||
{
|
||||
$where = [];
|
||||
$linking = ' AND ';
|
||||
$limit = CFG_SQL_LIMIT_DEFAULT;
|
||||
$className = get_class($this);
|
||||
|
||||
if (!$this->queryBase || !$conditions)
|
||||
if (!$this->queryBase || $conditions === null)
|
||||
return;
|
||||
|
||||
$prefixes = [];
|
||||
@@ -289,6 +289,8 @@ abstract class BaseType
|
||||
|
||||
public function &iterate()
|
||||
{
|
||||
$oldIdx = $this->id;
|
||||
|
||||
// reset on __construct
|
||||
$this->reset();
|
||||
|
||||
@@ -302,9 +304,19 @@ abstract class BaseType
|
||||
unset($this->curTpl); // kill reference or it will 'bleed' into the next iteration
|
||||
}
|
||||
|
||||
// reset on __destruct .. Generator, Y U NO HAVE __destruct ?!
|
||||
// fforward to old index
|
||||
$this->reset();
|
||||
}
|
||||
do
|
||||
{
|
||||
if (key($this->templates) != $oldIdx)
|
||||
continue;
|
||||
|
||||
$this->curTpl = current($this->templates);
|
||||
$this->id = key($this->templates);
|
||||
break;
|
||||
}
|
||||
while (next($this->templates));
|
||||
}
|
||||
|
||||
protected function reset()
|
||||
{
|
||||
|
||||
@@ -1313,6 +1313,7 @@ class ItemList extends BaseType
|
||||
{
|
||||
$buff = [];
|
||||
$this->sourceMore = [];
|
||||
|
||||
foreach ($this->iterate() as $_curTpl)
|
||||
if ($_curTpl['moreType'] && $_curTpl['moreTypeId'])
|
||||
$buff[$_curTpl['moreType']][] = $_curTpl['moreTypeId'];
|
||||
@@ -1793,7 +1794,7 @@ class ItemListFilter extends Filter
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$classes = new CharClassList([true]);
|
||||
$classes = new CharClassList();
|
||||
foreach ($classes->iterate() as $cId => $_tpl)
|
||||
{
|
||||
// preselect misc subclasses
|
||||
|
||||
Reference in New Issue
Block a user