diff --git a/includes/profiler.class.php b/includes/profiler.class.php index 6dcb3c81..84f8f723 100644 --- a/includes/profiler.class.php +++ b/includes/profiler.class.php @@ -183,7 +183,24 @@ class Profiler { if (DB::isConnectable(DB_AUTH) && !self::$realms) { - self::$realms = DB::Auth()->select('SELECT id AS ARRAY_KEY, name, IF(timezone IN (8, 9, 10, 11, 12), "eu", "us") AS region FROM realmlist WHERE allowedSecurityLevel = 0 AND gamebuild = ?d', WOW_BUILD); + self::$realms = DB::Auth()->select('SELECT + id AS ARRAY_KEY, + `name`, + CASE + WHEN timezone IN (2, 3, 4) THEN "us" + WHEN timezone IN (8, 9, 10, 11, 12) THEN "eu" + WHEN timezone = 6 THEN "kr" + WHEN timezone = 14 THEN "tw" + WHEN timezone = 16 THEN "cn" + END AS region + FROM + realmlist + WHERE + allowedSecurityLevel = 0 AND + gamebuild = ?d', + WOW_BUILD + ); + foreach (self::$realms as $rId => $rData) { if (DB::isConnectable(DB_CHARACTERS . $rId)) diff --git a/includes/types/arenateam.class.php b/includes/types/arenateam.class.php index 62ee178c..a2e8bcc2 100644 --- a/includes/types/arenateam.class.php +++ b/includes/types/arenateam.class.php @@ -88,7 +88,7 @@ class ArenaTeamListFilter extends Filter protected function cbRegionCheck(&$v) { - if ($v == 'eu' || $v == 'us') + if (in_array($v, Util::$regions)) { $this->parentCats[0] = $v; // directly redirect onto this region $v = ''; // remove from filter diff --git a/includes/types/guild.class.php b/includes/types/guild.class.php index 2bafc990..c219e360 100644 --- a/includes/types/guild.class.php +++ b/includes/types/guild.class.php @@ -126,7 +126,7 @@ class GuildListFilter extends Filter protected function cbRegionCheck(&$v) { - if ($v == 'eu' || $v == 'us') + if (in_array($v, Util::$regions)) { $this->parentCats[0] = $v; // directly redirect onto this region $v = ''; // remove from filter diff --git a/includes/types/profile.class.php b/includes/types/profile.class.php index 94643aec..77cd62c3 100644 --- a/includes/types/profile.class.php +++ b/includes/types/profile.class.php @@ -379,7 +379,7 @@ class ProfileListFilter extends Filter protected function cbRegionCheck(&$v) { - if ($v == 'eu' || $v == 'us') + if (in_array($v, Util::$regions)) { $this->parentCats[0] = $v; // directly redirect onto this region $v = ''; // remove from filter diff --git a/includes/utilities.php b/includes/utilities.php index 4aed8c51..99874241 100644 --- a/includes/utilities.php +++ b/includes/utilities.php @@ -326,6 +326,10 @@ class Util 'www', null, 'fr', 'de', 'cn', null, 'es', null, 'ru' ); + public static $regions = array( + 'us', 'eu', 'kr', 'tw', 'cn' + ); + public static $typeClasses = array( null, 'CreatureList', 'GameObjectList', 'ItemList', 'ItemsetList', 'QuestList', 'SpellList', 'ZoneList', 'FactionList', 'PetList', 'AchievementList', 'TitleList', 'WorldEventList', 'CharClassList', diff --git a/localization/lang.class.php b/localization/lang.class.php index 5c3ace07..39559e56 100644 --- a/localization/lang.class.php +++ b/localization/lang.class.php @@ -52,13 +52,6 @@ class Lang // *cough* .. reuse-hacks (because copy-pastaing text for 5 locales sucks) self::$item['cat'][2] = [self::$item['cat'][2], self::$spell['weaponSubClass']]; self::$item['cat'][2][1][14] .= ' ('.self::$item['cat'][2][0].')'; - - // not localized .. for whatever reason - self::$profiler['regions'] = array( - 'eu' => "Europe", - 'us' => "US & Oceanic" - ); - self::$main['moreTitles']['privilege'] = self::$privileges['_privileges']; } diff --git a/localization/locale_dede.php b/localization/locale_dede.php index 473648aa..d24f3e69 100644 --- a/localization/locale_dede.php +++ b/localization/locale_dede.php @@ -112,7 +112,6 @@ $lang = array( // search 'search' => "Suche", - 'searchButton' => "Suche", 'foundResult' => "Suchergebnisse für", 'noResult' => "Keine Ergebnisse für", 'tryAgain' => "Bitte versucht es mit anderen Suchbegriffen oder überprüft deren Schreibweise.", @@ -175,6 +174,13 @@ $lang = array( 'arenateam' => "Dieses Arena Team existiert nicht oder wurde noch nicht in die Datenbank übernommen.", 'profile' => "Dieser Charakter existiert nicht oder wurde noch nicht in die Datenbank übernommen." ), + 'regions' => array( + 'us' => "Americas", + 'eu' => "Europa", + 'kr' => "Korea", + 'tw' => "Taiwan", + 'cn' => "China" + ), 'encounterNames'=> array( 243 => "Die Sieben", 334 => "Großchampions", diff --git a/localization/locale_enus.php b/localization/locale_enus.php index 98373cce..12d573e5 100644 --- a/localization/locale_enus.php +++ b/localization/locale_enus.php @@ -112,7 +112,6 @@ $lang = array( // search 'search' => "Search", - 'searchButton' => "Search", 'foundResult' => "Search Results for", 'noResult' => "No Results for", 'tryAgain' => "Please try some different keywords or check your spelling.", @@ -175,6 +174,13 @@ $lang = array( 'arenateam' => "This Arena Team doesn't exist or is not yet in the database.", 'profile' => "This character doesn't exist or is not yet in the database." ), + 'regions' => array( + 'us' => "Americas", + 'eu' => "Europe", + 'kr' => "Korea", + 'tw' => "Taiwan", + 'cn' => "China" + ), 'encounterNames'=> array( // from dungeonencounter.dbc 243 => "The Seven", 334 => "Grand Champions", diff --git a/localization/locale_eses.php b/localization/locale_eses.php index a93443e7..7d62e4bc 100644 --- a/localization/locale_eses.php +++ b/localization/locale_eses.php @@ -112,7 +112,6 @@ $lang = array( // search 'search' => "Búsqueda", - 'searchButton' => "búsqueda", 'foundResult' => "Resultados de busqueda para", 'noResult' => "Ningún resultado para", 'tryAgain' => "Por favor, introduzca otras palabras claves o verifique el término ingresado.", @@ -154,7 +153,7 @@ $lang = array( 'profiler' => array( 'realm' => "Reino", 'region' => "Región", - 'viewCharacter' => "View Character", + 'viewCharacter' => "Ver personaje", '_cpHint' => "l Gestor de perfiles te permite editar tu personaje, encontrar mejoras de equipo, comprobar tu gearscore, ¡y más!", '_cpHelp' => "Para comenzar, sigue los pasos abajo indicados. Si quieres más información, revisa nuestra amplia página de ayuda.", '_cpFooter' => "Si quieres una búsqueda más refinada, prueba con nuestras opciones de búsqueda avanzada. También puedes crear un perfil nuevo personalizado.", @@ -175,6 +174,13 @@ $lang = array( 'arenateam' => "[This Arena Team doesn't exist or is not yet in the database.]", 'profile' => "Este personaje no existe o no está aun en la base de datos.", ), + 'regions' => array( + 'us' => "Américas", + 'eu' => "Europa", + 'kr' => "Corea", + 'tw' => "Taiwán", + 'cn' => "China" + ), 'encounterNames'=> array( 243 => "Los Siete", 334 => "Grandes Campeones", diff --git a/localization/locale_frfr.php b/localization/locale_frfr.php index afce72bf..aa264aed 100644 --- a/localization/locale_frfr.php +++ b/localization/locale_frfr.php @@ -112,7 +112,6 @@ $lang = array( // search 'search' => "Recherche", - 'searchButton' => "Rechercher", 'foundResult' => "Résultats de recherche pour", 'noResult' => "Aucun résultat pour malordawsne", 'tryAgain' => "Veuillez essayer d'autres mots ou vérifiez l'orthographe des termes de recherche.", @@ -175,6 +174,13 @@ $lang = array( 'arenateam' => "[This Arena Team doesn't exist or is not yet in the database.]", 'profile' => "[This character doesn't exist or is not yet in the database.]" ), + 'regions' => array( + 'us' => "Amériques", + 'eu' => "L'Europe", + 'kr' => "Corée", + 'tw' => "Taïwan", + 'cn' => "Chine" + ), 'encounterNames'=> array( 243 => "Les Sept", 334 => "Grands champions", diff --git a/localization/locale_ruru.php b/localization/locale_ruru.php index b1c78496..870c90a6 100644 --- a/localization/locale_ruru.php +++ b/localization/locale_ruru.php @@ -112,7 +112,6 @@ $lang = array( // search 'search' => "Поиск", - 'searchButton' => "Поиск", 'foundResult' => "Результаты поиска для", 'noResult' => "Ничего не найдено для", 'tryAgain' => "Пожалуйста, попробуйте другие ключевые слова или проверьте правильность запроса.", @@ -175,6 +174,13 @@ $lang = array( 'arenateam' => "[This Arena Team doesn't exist or is not yet in the database.]", 'guild' => "Такая гильдия не существует, или еще не добавлена в базу данных." ), + 'regions' => array( + 'us' => "Америка", + 'eu' => "Европа", + 'kr' => "Корея", + 'tw' => "Тайвань", + 'cn' => "Китай" + ), 'encounterNames'=> array( 243 => "Семеро", 334 => "Абсолютные чемпионы", diff --git a/localization/locale_zhcn.php b/localization/locale_zhcn.php index d38ba315..e9a82f33 100644 --- a/localization/locale_zhcn.php +++ b/localization/locale_zhcn.php @@ -112,7 +112,6 @@ $lang = array( // search 'search' => "搜索", - 'searchButton' => "搜索", 'foundResult' => "搜索结果关于", 'noResult' => "没有搜索结果关于", 'tryAgain' => "请尝试不同的关键词或检查你的拼写。", @@ -175,6 +174,13 @@ $lang = array( 'arenateam' => "This Arena Team doesn't exist or is not yet in the database.", 'profile' => "This character doesn't exist or is not yet in the database." ), + 'regions' => array( + 'us' => "美洲地区", + 'eu' => "欧洲", + 'kr' => "韩国", + 'tw' => "台湾", + 'cn' => "中国" + ), 'encounterNames'=> array( 243 => "黑铁七贤", 334 => "总冠军", diff --git a/pages/genericPage.class.php b/pages/genericPage.class.php index f6688584..91fe4458 100644 --- a/pages/genericPage.class.php +++ b/pages/genericPage.class.php @@ -108,7 +108,7 @@ trait TrProfiler $cat = array_map('urldecode', $cat); - if ($cat[0] !== 'eu' && $cat[0] !== 'us') + if (array_search($cat[0], Util::$regions) === false) return; $this->region = $cat[0]; diff --git a/pages/profile.php b/pages/profile.php index 65fbd617..79b2f861 100644 --- a/pages/profile.php +++ b/pages/profile.php @@ -102,7 +102,7 @@ class ProfilePage extends GenericPage $char['cuFlags'] = PROFILER_CU_NEEDS_RESYNC; if ($char['at_login'] & 0x1) - $char['renameItr'] = DB::Aowow()->selectCell('SELECT MAX(renameItr) FROM ?_profiler_profiles WHERE realm = ?d AND realmGUID IS NOT NULL AND name = ?', $realmId, $char['name']); + $char['renameItr'] = DB::Aowow()->selectCell('SELECT MAX(renameItr) FROM ?_profiler_profiles WHERE realm = ?d AND realmGUID IS NOT NULL AND name = ?', $this->realmId, $char['name']); if ($char['guildGUID']) { diff --git a/setup/tools/CLISetup.class.php b/setup/tools/CLISetup.class.php index 3faa2909..0c5e9b0b 100644 --- a/setup/tools/CLISetup.class.php +++ b/setup/tools/CLISetup.class.php @@ -109,7 +109,7 @@ class CLISetup // alternative data source (no quotes, use forward slash) if (isset(self::$opts['mpqDataDir'])) - self::$srcDir = CLI::nicePath($self::$opts['mpqDataDir']); + self::$srcDir = CLI::nicePath(self::$opts['mpqDataDir']); // optional limit handled locales if (isset(self::$opts['locales'])) diff --git a/setup/tools/filegen/realmMenu.func.php b/setup/tools/filegen/realmMenu.func.php index 933cfd6c..a25bb5ac 100644 --- a/setup/tools/filegen/realmMenu.func.php +++ b/setup/tools/filegen/realmMenu.func.php @@ -38,41 +38,34 @@ if (!CLI) function realmMenu() { - $subEU = []; - $subUS = []; - $set = 0x0; - $menu = [ + $subs = []; + $set = 0x0; + $menu = [ // skip usage of battlegroup // ['us', Lang::profiler('regions', 'us'), null,[[Profiler::urlize(CFG_BATTLEGROUP), CFG_BATTLEGROUP, null, &$subUS]]], // ['eu', Lang::profiler('regions', 'eu'), null,[[Profiler::urlize(CFG_BATTLEGROUP), CFG_BATTLEGROUP, null, &$subEU]]] - ['us', Lang::profiler('regions', 'us'), null, &$subUS], - ['eu', Lang::profiler('regions', 'eu'), null, &$subEU] ]; + foreach (Util::$regions as $idx => $n) + $subs[$idx] = []; + foreach (Profiler::getRealms() as $row) { - if ($row['region'] == 'eu') + $idx = array_search($row['region'], Util::$regions); + if ($idx !== false) { - $set |= 0x1; - $subEU[] = [Profiler::urlize($row['name'], true), $row['name']]; - } - else if ($row['region'] == 'us') - { - $set |= 0x2; - $subUS[] = [Profiler::urlize($row['name'], true), $row['name']]; + $set |= (1 << $idx); + $subs[$idx][] = [Profiler::urlize($row['name'], true), $row['name']]; } + } - if (!$set) - CLI::write(' - realmMenu: Auth-DB not set up .. menu will be empty', CLI::LOG_WARN); + CLI::write(' - realmMenu: Auth-DB not set up .. realm menu will be empty', CLI::LOG_WARN); - if (!($set & 0x1)) - array_pop($menu); - - if (!($set & 0x2)) - array_shift($menu); + foreach (Util::$regions as $idx => $n) + if ($set & (1 << $idx)) + $menu[] = [$n, Lang::profiler('regions', $n), null, &$subs[$idx]]; return Util::toJSON($menu); } - ?> diff --git a/template/pages/profiler.tpl.php b/template/pages/profiler.tpl.php index 64dcdeaa..9ca44beb 100644 --- a/template/pages/profiler.tpl.php +++ b/template/pages/profiler.tpl.php @@ -27,8 +27,11 @@