/** * Game accounts handler * * @access public * @static WoW_Account::UserGames() * @category Account Manager Class * @return bool **/ public static function UserGames() { self::$myGames = DB::WoW()->selectCell("SELECT COUNT(*) FROM `DBPREFIX_users_accounts` WHERE `id` = %d", self::GetUserID()); self::$myGamesList = DB::WoW()->select("SELECT `account_id` FROM `DBPREFIX_users_accounts` WHERE `id` = %d", self::GetUserID()); $account_ids = array(); $count = count(self::$myGamesList); for ($i = 0; $i < $count; ++$i) { $account_ids[] = self::$myGamesList[$i]['account_id']; } if (!empty($account_ids)) { self::$userGames = DB::Realm()->select("SELECT a.*, b.`bandate`, b.`unbandate`, b.`banreason`, b.`bannedby`, b.`active` AS `active_ban` FROM `account` a LEFT JOIN `account_banned` b ON b.`id` IN (%s) WHERE a.`id` IN (%s)", $account_ids, $account_ids); } for ($i = 0; $i < count(self::$userGames); $i++) { self::$gameAccountData[strtolower(self::$userGames[$i]['username'])] = self::$userGames[$i]; } return true; }