diff --git a/includes/ajaxHandler/admin.class.php b/includes/ajaxHandler/admin.class.php index 9d176dca..42ce2f97 100644 --- a/includes/ajaxHandler/admin.class.php +++ b/includes/ajaxHandler/admin.class.php @@ -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)); } diff --git a/includes/ajaxHandler/comment.class.php b/includes/ajaxHandler/comment.class.php index 2e43250a..d8da5295 100644 --- a/includes/ajaxHandler/comment.class.php +++ b/includes/ajaxHandler/comment.class.php @@ -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']); } } diff --git a/includes/basetype.class.php b/includes/basetype.class.php index b3decd1e..9141d7f9 100644 --- a/includes/basetype.class.php +++ b/includes/basetype.class.php @@ -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() { diff --git a/includes/types/item.class.php b/includes/types/item.class.php index c274de14..c4ea7d0f 100644 --- a/includes/types/item.class.php +++ b/includes/types/item.class.php @@ -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 diff --git a/pages/classes.php b/pages/classes.php index 28af9f69..9b8a2448 100644 --- a/pages/classes.php +++ b/pages/classes.php @@ -25,7 +25,7 @@ class ClassesPage extends GenericPage protected function generateContent() { - $classes = new CharClassList([true]); + $classes = new CharClassList(); if (!$classes->error) $this->lvTabs[] = ['class', ['data' => array_values($classes->getListviewData())]]; } diff --git a/pages/emotes.php b/pages/emotes.php index fddbfea1..68a3a37a 100644 --- a/pages/emotes.php +++ b/pages/emotes.php @@ -26,7 +26,7 @@ class EmotesPage extends GenericPage protected function generateContent() { $tabData = array( - 'data' => array_values((new EmoteList([true]))->getListviewData()), + 'data' => array_values((new EmoteList())->getListviewData()), 'name' => Util::ucFirst(Lang::game('emotes')) ); diff --git a/pages/pets.php b/pages/pets.php index cbd48a32..5fb9ed08 100644 --- a/pages/pets.php +++ b/pages/pets.php @@ -36,6 +36,7 @@ class PetsPage extends GenericPage if ($this->category) $conditions[] = ['type', (int)$this->category[0]]; + $data = []; $pets = new PetList($conditions); if (!$pets->error) { @@ -49,9 +50,8 @@ class PetsPage extends GenericPage if (!$pets->hasDiffFields(['type'])) $data['hiddenCols'] = ['type']; - - $this->lvTabs[] = ['pet', $data, 'petFoodCol']; }; + $this->lvTabs[] = ['pet', $data, 'petFoodCol']; } protected function generateTitle() diff --git a/pages/quest.php b/pages/quest.php index c9941591..243fe53d 100644 --- a/pages/quest.php +++ b/pages/quest.php @@ -562,7 +562,7 @@ class QuestPage extends GenericPage BUTTON_WOWHEAD => true, BUTTON_LINKS => array( 'linkColor' => 'ffffff00', - 'linkId' => 'quest:'.$this->typeId.':'.$_level; + 'linkId' => 'quest:'.$this->typeId.':'.$_level, 'linkName' => $this->name, 'type' => $this->type, 'typeId' => $this->typeId diff --git a/pages/races.php b/pages/races.php index 1008d3ba..ce1ccac2 100644 --- a/pages/races.php +++ b/pages/races.php @@ -30,9 +30,12 @@ class RacesPage extends GenericPage if (!User::isInGroup(U_GROUP_EMPLOYEE)) $conditions[] = [['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0]; + $data = []; $races = new CharRaceList($conditions); if (!$races->error) - $this->lvTabs[] = ['race', ['data' => array_values($races->getListviewData())]]; + $data = array_values($races->getListviewData()); + + $this->lvTabs[] = ['race', ['data' => $data]]; } protected function generateTitle()