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);
|
$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);
|
$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));
|
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);
|
DB::Aowow()->query('INSERT INTO ?_comments_rates (commentId, userId, value) VALUES (?d, 0, 1)', $postIdx);
|
||||||
|
|
||||||
// flag target with hasComment
|
// 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']);
|
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']
|
$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']);
|
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)
|
if ($ok)
|
||||||
{
|
{
|
||||||
$coInfo = DB::Aowow()->selectRow('SELECT type, typeId FROM ?_comments WHERE id = ?d', $this->_post['id']);
|
$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']);
|
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
|
* 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
|
* 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 = [];
|
$where = [];
|
||||||
$linking = ' AND ';
|
$linking = ' AND ';
|
||||||
$limit = CFG_SQL_LIMIT_DEFAULT;
|
$limit = CFG_SQL_LIMIT_DEFAULT;
|
||||||
$className = get_class($this);
|
$className = get_class($this);
|
||||||
|
|
||||||
if (!$this->queryBase || !$conditions)
|
if (!$this->queryBase || $conditions === null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
$prefixes = [];
|
$prefixes = [];
|
||||||
@@ -289,6 +289,8 @@ abstract class BaseType
|
|||||||
|
|
||||||
public function &iterate()
|
public function &iterate()
|
||||||
{
|
{
|
||||||
|
$oldIdx = $this->id;
|
||||||
|
|
||||||
// reset on __construct
|
// reset on __construct
|
||||||
$this->reset();
|
$this->reset();
|
||||||
|
|
||||||
@@ -302,8 +304,18 @@ abstract class BaseType
|
|||||||
unset($this->curTpl); // kill reference or it will 'bleed' into the next iteration
|
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();
|
$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()
|
protected function reset()
|
||||||
|
|||||||
@@ -1313,6 +1313,7 @@ class ItemList extends BaseType
|
|||||||
{
|
{
|
||||||
$buff = [];
|
$buff = [];
|
||||||
$this->sourceMore = [];
|
$this->sourceMore = [];
|
||||||
|
|
||||||
foreach ($this->iterate() as $_curTpl)
|
foreach ($this->iterate() as $_curTpl)
|
||||||
if ($_curTpl['moreType'] && $_curTpl['moreTypeId'])
|
if ($_curTpl['moreType'] && $_curTpl['moreTypeId'])
|
||||||
$buff[$_curTpl['moreType']][] = $_curTpl['moreTypeId'];
|
$buff[$_curTpl['moreType']][] = $_curTpl['moreTypeId'];
|
||||||
@@ -1793,7 +1794,7 @@ class ItemListFilter extends Filter
|
|||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$classes = new CharClassList([true]);
|
$classes = new CharClassList();
|
||||||
foreach ($classes->iterate() as $cId => $_tpl)
|
foreach ($classes->iterate() as $cId => $_tpl)
|
||||||
{
|
{
|
||||||
// preselect misc subclasses
|
// preselect misc subclasses
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class ClassesPage extends GenericPage
|
|||||||
|
|
||||||
protected function generateContent()
|
protected function generateContent()
|
||||||
{
|
{
|
||||||
$classes = new CharClassList([true]);
|
$classes = new CharClassList();
|
||||||
if (!$classes->error)
|
if (!$classes->error)
|
||||||
$this->lvTabs[] = ['class', ['data' => array_values($classes->getListviewData())]];
|
$this->lvTabs[] = ['class', ['data' => array_values($classes->getListviewData())]];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ class EmotesPage extends GenericPage
|
|||||||
protected function generateContent()
|
protected function generateContent()
|
||||||
{
|
{
|
||||||
$tabData = array(
|
$tabData = array(
|
||||||
'data' => array_values((new EmoteList([true]))->getListviewData()),
|
'data' => array_values((new EmoteList())->getListviewData()),
|
||||||
'name' => Util::ucFirst(Lang::game('emotes'))
|
'name' => Util::ucFirst(Lang::game('emotes'))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ class PetsPage extends GenericPage
|
|||||||
if ($this->category)
|
if ($this->category)
|
||||||
$conditions[] = ['type', (int)$this->category[0]];
|
$conditions[] = ['type', (int)$this->category[0]];
|
||||||
|
|
||||||
|
$data = [];
|
||||||
$pets = new PetList($conditions);
|
$pets = new PetList($conditions);
|
||||||
if (!$pets->error)
|
if (!$pets->error)
|
||||||
{
|
{
|
||||||
@@ -49,9 +50,8 @@ class PetsPage extends GenericPage
|
|||||||
|
|
||||||
if (!$pets->hasDiffFields(['type']))
|
if (!$pets->hasDiffFields(['type']))
|
||||||
$data['hiddenCols'] = ['type'];
|
$data['hiddenCols'] = ['type'];
|
||||||
|
|
||||||
$this->lvTabs[] = ['pet', $data, 'petFoodCol'];
|
|
||||||
};
|
};
|
||||||
|
$this->lvTabs[] = ['pet', $data, 'petFoodCol'];
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function generateTitle()
|
protected function generateTitle()
|
||||||
|
|||||||
@@ -562,7 +562,7 @@ class QuestPage extends GenericPage
|
|||||||
BUTTON_WOWHEAD => true,
|
BUTTON_WOWHEAD => true,
|
||||||
BUTTON_LINKS => array(
|
BUTTON_LINKS => array(
|
||||||
'linkColor' => 'ffffff00',
|
'linkColor' => 'ffffff00',
|
||||||
'linkId' => 'quest:'.$this->typeId.':'.$_level;
|
'linkId' => 'quest:'.$this->typeId.':'.$_level,
|
||||||
'linkName' => $this->name,
|
'linkName' => $this->name,
|
||||||
'type' => $this->type,
|
'type' => $this->type,
|
||||||
'typeId' => $this->typeId
|
'typeId' => $this->typeId
|
||||||
|
|||||||
@@ -30,9 +30,12 @@ class RacesPage extends GenericPage
|
|||||||
if (!User::isInGroup(U_GROUP_EMPLOYEE))
|
if (!User::isInGroup(U_GROUP_EMPLOYEE))
|
||||||
$conditions[] = [['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0];
|
$conditions[] = [['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0];
|
||||||
|
|
||||||
|
$data = [];
|
||||||
$races = new CharRaceList($conditions);
|
$races = new CharRaceList($conditions);
|
||||||
if (!$races->error)
|
if (!$races->error)
|
||||||
$this->lvTabs[] = ['race', ['data' => array_values($races->getListviewData())]];
|
$data = array_values($races->getListviewData());
|
||||||
|
|
||||||
|
$this->lvTabs[] = ['race', ['data' => $data]];
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function generateTitle()
|
protected function generateTitle()
|
||||||
|
|||||||
Reference in New Issue
Block a user