public static function init($with_permission = true, $flush_cache = false) { static $inited = false; if ($flush_cache === true || $inited === false) { $boards = self::table(__CLASS__); $permquery = $with_permission === true ? self::getPermQuery() : ''; $bby = Common::getGet('bby', 'board_pos'); $bdir = Common::getGet('bdir', 'ASC'); $orderby = $boards->getMultiOrderby($bby, $bdir); if (false === ($all = $boards->selectObjects('*', $permquery, $orderby))) { return false; } # Put in keys :/ self::$boardcache = array(); foreach ($all as $board) { self::addBoardToCache($board); } # Assign childs foreach (self::$boardcache as $board) { $board instanceof GWF_ForumBoard; // if ('0' !== ($pid = $board->getParentID())) $pid = $board->getParentID(); if (isset(self::$boardcache[$pid])) { self::$boardcache[$pid]->addChild($board); } } $inited = true; } return $inited === true; }