public function main() { WoW_Template::SetTemplateTheme('wow'); WoW_Template::SetPageData('body_class', WoW_Locale::GetLocale(LOCALE_DOUBLE)); // Check query $searchQuery = isset($_GET['q']) ? $_GET['q'] : null; if ($searchQuery != null && mb_strlen($searchQuery) < 3) { $searchQuery = null; } if (preg_match('/\\@/', $searchQuery)) { $fast_access = explode('@', $searchQuery); if (isset($fast_access[0], $fast_access[1])) { header('Location: ' . WoW::GetWoWPath() . '/wow/' . WoW_Locale::GetLocale() . '/character/' . trim($fast_access[1]) . trim($fast_access[0]) . '/'); exit; } } WoW_Search::SetSearchQuery($searchQuery); // Perform Search WoW_Search::PerformSearch(); // Set active page if (isset($_GET['f']) && in_array($_GET['f'], array('search', 'wowarenateam', 'article', 'wowcharacter', 'wowitem', 'post', 'wowguild'))) { $page = $_GET['f']; } else { $page = 'search'; } WoW_Search::SetCurrentPage($page); WoW_Template::SetPageIndex('search'); WoW_Template::SetPageData('page', 'search'); WoW_Template::SetPageData('searchQuery', $searchQuery); WoW_Template::LoadTemplate('page_index'); }
protected static function ExtractCategory($page_type, $category, &$type, &$class_category) { if (strpos($category, '.')) { $cat_data = explode('.', $category); if (!$cat_data || !is_array($cat_data)) { return false; } } else { $cat_data = array($category); } self::$m_pageType = $page_type; // Max subcats count: 3 - type.cat1.cat2 $type = isset($cat_data[0]) && $cat_data[0] !== false ? $cat_data[0] : false; self::$m_categoryInfo[0] = $type; $breadcrumb = '0,' . self::GetCatIdForPage($page_type); // Find category for ($i = 0; $i < 3; ++$i) { if (isset($cat_data[$i]) && $cat_data[$i] >= 0) { $breadcrumb .= ',' . $cat_data[$i]; $class_category = $i >= 0 ? $cat_data[$i] : false; } } self::$m_categoryInfo[1] = $class_category; WoW_Template::SetPageData('breadcrumb', $breadcrumb); return true; }
public function main() { WoW_Template::SetTemplateTheme('bn'); WoW_Template::SetMenuIndex('index'); WoW_Template::SetPageIndex('landing'); WoW_Template::SetPageData('landing', 'what_is'); WoW_Template::LoadTemplate('page_landing'); }
public function main() { WoW_Template::SetPageData('body_class', sprintf('%s game-index', WoW_Locale::GetLocale(LOCALE_DOUBLE))); WoW_Template::SetTemplateTheme('wow'); $url_data = WoW::GetUrlData('game'); if (empty($url_data['action1'])) { WoW_Template::SetPageIndex('game'); WoW_Template::SetPageData('page', 'game'); } elseif ($url_data['action1'] == 'guide') { switch ($url_data['action2']) { case 'getting-started': case 'how-to-play': case 'playing-together': case 'late-game': WoW_Template::SetPageIndex('game_guide_' . str_replace('-', '_', $url_data['action2'])); WoW_Template::SetPageData('body_class', 'game-guide-' . $url_data['action2']); WoW_Template::SetPageData('page', 'game_guide_' . str_replace('-', '_', $url_data['action2'])); break; default: WoW_Template::SetPageIndex('game_guide_what_is_wow'); WoW_Template::SetPageData('body_class', 'game-guide-what-is-wow'); WoW_Template::SetPageData('page', 'game_guide_what_is_wow'); break; } } elseif ($url_data['action1'] == 'race') { $race_id = WoW_Utils::GetRaceIDByKey($url_data['action2']); if ($race_id > 0) { WoW_Game::LoadRace($race_id); WoW_Template::SetPageIndex('game_race'); WoW_Template::SetPageData('body_class', 'race-' . $url_data['action2']); WoW_Template::SetPageData('race', $url_data['action2']); WoW_Template::SetPageData('page', 'game_race'); WoW_Template::SetPageData('raceId', $race_id); } else { WoW_Template::SetPageIndex('game_race_index'); WoW_Template::SetPageData('body_class', 'game-race-index'); WoW_Template::SetPageData('page', 'game_race_index'); } } elseif ($url_data['action1'] == 'class') { $class_id = WoW_Utils::GetClassIDByKey($url_data['action2']); if ($class_id > 0) { WoW_Game::LoadClass($class_id); WoW_Template::SetPageIndex('game_class'); WoW_Template::SetPageData('body_class', 'class-' . $url_data['action2']); WoW_Template::SetPageData('class', $url_data['action2']); WoW_Template::SetPageData('classId', $class_id); WoW_Template::SetPageData('page', 'game_class'); } else { WoW_Template::SetPageIndex('game_class_index'); WoW_Template::SetPageData('body_class', 'game-classes-index'); WoW_Template::SetPageData('page', 'game_class_index'); } } else { WoW_Template::ErrorPage(404); } WoW_Template::SetMenuIndex('menu-game'); WoW_Template::LoadTemplate('page_index'); }
public function main() { WoW_Template::SetTemplateTheme('wow'); WoW_Template::SetPageData('body_class', WoW_Locale::GetLocale(LOCALE_DOUBLE)); WoW_Template::SetPageIndex('realm_status'); WoW_Template::SetPageData('page', 'realm_status'); WoW_Template::SetMenuIndex('menu-game'); WoW_Template::LoadTemplate('page_index'); }
public function main() { WoW_Template::SetPageData('carousel', WoW::GetCarouselData()); WoW_Template::SetPageData('wow_news', WoW::GetLastNews(20, isset($_GET['page']) ? (int) ($_GET['page'] - 1) : 0)); WoW_Template::SetPageData('body_class', sprintf('%s homepage', WoW_Locale::GetLocale(LOCALE_DOUBLE))); WoW_Template::SetTemplateTheme('wow'); WoW_Template::SetPageIndex('index'); WoW_Template::SetMenuIndex('menu-home'); WoW_Template::LoadTemplate('page_index'); }
public function main() { $url_data = WoW::GetUrlData('management'); if (!is_array($url_data) || !isset($url_data['action1']) || $url_data['action1'] != 'management') { header('Location: ' . WoW::GetWoWPath() . '/account/management/'); exit; } if (!WoW_Account::IsLoggedIn()) { header('Location: ' . WoW::GetWoWPath() . '/login/'); exit; } WoW_Template::SetTemplateTheme('account'); WoW_Account::UserGames(); WoW_Template::SetPageIndex('management'); WoW_Template::SetMenuIndex('management'); WoW_Template::SetPageData('page', 'management'); if ($url_data['action2'] == 'wow' && preg_match('/dashboard.html/i', $url_data['action3'])) { WoW_Account::InitializeAccount($_GET['accountName']); WoW_Template::SetPageIndex('dashboard'); WoW_Template::SetMenuIndex('games'); WoW_Template::SetPageData('page', 'dashboard'); } elseif ($url_data['action2'] == 'wow-account-conversion.html') { WoW_Template::SetPageData('conversion_page', 1); if (isset($_POST['targetpage'])) { switch ($_POST['targetpage']) { case '2': if (isset($_POST['username']) && isset($_POST['password'])) { if (WoW_Account::PerformConversionStep(1, array('username' => $_POST['username'], 'password' => $_POST['password']))) { WoW_Template::SetPageData('conversion_page', 2); } else { WoW_Template::SetPageData('conversion_page', 1); } } else { WoW_Template::SetPageData('conversion_page', 1); } break; case '3': WoW_Template::SetPageData('conversion_page', 3); break; case 'finish': if (!WoW_Account::PerformConversionStep(3)) { WoW_Template::SetPageData('conversion_page', 2); } break; default: break; } } WoW_Template::SetPageIndex('account_conversion'); Wow_Template::SetMenuIndex('games'); WoW_Template::SetPageData('page', 'account_conversion'); } WoW_Template::LoadTemplate('page_index'); }
public function main() { WoW_Template::SetTemplateTheme('wow'); WoW_Template::SetPageIndex('account_status'); WoW_Template::SetPageData('page', 'account_status'); if (!WoW_Account::IsLoggedIn()) { WoW_Template::SetPageData('account-status', 'no_session'); } elseif (WoW_Account::IsBanned()) { WoW_Template::SetPageData('account-status', 'no_subscribe'); } else { WoW_Template::SetPageData('account-status', 'success'); } WoW_Template::LoadTemplate('page_index'); }
public function main() { WoW_Template::SetPageData('body_class', sprintf('%s media-content', WoW_Locale::GetLocale(LOCALE_DOUBLE))); WoW_Template::SetTemplateTheme('wow'); $url_data = WoW::GetUrlData('media'); if (empty($url_data['action1'])) { WoW_Template::SetPageIndex('media'); WoW_Template::SetPageData('page', 'media'); } else { WoW_Template::ErrorPage(404); } WoW_Template::SetMenuIndex('menu-media'); WoW_Template::LoadTemplate('page_index'); }
public function main() { WoW_Template::SetPageData('body_class', WoW_Locale::GetLocale(LOCALE_DOUBLE)); WoW_Template::SetTemplateTheme('wow'); $url_data = WoW::GetUrlData('guild'); $guild_error = false; if (!$url_data) { WoW_Template::ErrorPage(404); } elseif (!WoW_Guild::LoadGuild($url_data['name'], WoW_Utils::GetRealmIDByName($url_data['realmName']))) { WoW_Template::ErrorPage(404); } else { $primary = WoW_Account::GetActiveCharacter(); WoW_Template::SetPageData('guild-authorized', false); if (is_array($primary) && isset($primary['realmName'])) { if ($primary['realmName'] == WoW_Guild::GetGuildRealmName() && $primary['guildId'] == WoW_Guild::GetGuildID()) { WoW_Template::SetPageData('guild-authorized', true); } } switch ($url_data['action0']) { default: WoW_Template::SetPageData('guild-page', 'summary'); WoW_Template::SetPageIndex('guild_page'); WoW_Template::SetPageData('page', 'guild_page'); break; case 'perk': WoW_Template::SetPageData('guild-page', 'perks'); WoW_Template::SetPageIndex('guild_perks'); WoW_Template::SetPageData('page', 'guild_perks'); break; case 'roster': switch ($url_data['action1']) { default: WoW_Template::SetPageIndex('guild_roster'); WoW_Template::SetPageData('page', 'guild_roster'); break; case 'professions': WoW_Guild::InitProfessions(); WoW_Template::SetPageIndex('guild_professions'); WoW_Template::SetPageData('page', 'guild_professions'); break; } WoW_Template::SetPageData('guild-page', 'roster'); break; } WoW_Template::SetPageData('guildName', $url_data['name']); WoW_Template::SetPageData('realmName', $url_data['realmName']); WoW_Template::SetMenuIndex('menu-game'); } WoW_Template::LoadTemplate('page_index'); }
public function main() { if (!isset($this->m_actions['action3'])) { $this->m_actions['action3'] = 'arena'; } WoW_Template::SetTemplateTheme('wow'); switch ($this->m_actions['action3']) { default: case 'arena': if (isset($this->m_actions['action4']) && $this->m_actions['action4'] != null) { // Try to find BG with provided name $bg_found = false; foreach (WoWConfig::$BattleGroups as &$bg) { if (mb_strtolower($bg['name']) == mb_strtolower(urldecode($this->m_actions['action4']))) { // BG was found $bg_found = true; WoW_Template::SetPageData('activeBG', mb_strtolower($bg['name'])); WoW_Template::SetPageData('bg', $bg); } } if (!$bg_found) { WoW_Template::ErrorPage(404); return false; } WoW_Template::SetPageIndex('pvp_arena_ladder'); WoW_Template::SetPageData('page', 'pvp_arena_ladder'); // Set team format if (!isset($this->m_actions['action4']) || $this->m_actions['action4'] == null) { $this->m_actions['action4'] = '2v2'; WoW_Template::SetPageData('teamFormat', 2); WoW_Template::SetPageData('teamFormatS', '2v2'); } else { $format = substr($this->m_actions['action5'], 0, 1); if (!in_array($format, array('2', '3', '5'))) { $format = 2; } WoW_Template::SetPageData('teamFormat', $format); WoW_Template::SetPageData('teamFormatS', $format . 'v' . $format); } } else { WoW_Template::SetPageIndex('pvp_arena'); WoW_Template::SetPageData('page', 'pvp_arena'); } WoW_Template::LoadTemplate('page_index'); break; case 'trending': break; } }
public function main() { WoW_Template::SetTemplateTheme('wow'); WoW_Template::SetPageData('body_class', WoW_Locale::GetLocale(LOCALE_DOUBLE)); $url_data = WoW::GetUrlData('blog'); $blog_id = $url_data['blog_id']; if (!$blog_id || !WoW::LoadBlog($blog_id)) { WoW_Template::ErrorPage(404); } else { WoW_Template::SetPageData('wow_news', WoW::GetLastNews()); WoW_Template::SetPageData('blog_title', WoW::GetBlogData('title')); WoW_Template::SetPageData('overall_meta_title', WoW::GetBlogData('title')); WoW_Template::SetPageData('overall_meta_img', '/cms/blog_thumbnail/' . WoW::GetBlogData('image')); WoW_Template::SetPageIndex('blog'); WoW_Template::SetPageData('page', 'blog'); } WoW_Template::SetMenuIndex('menu-home'); WoW_Template::LoadTemplate('page_index'); }
public function main() { WoW_Template::SetPageData('body_class', sprintf('%s zone-index expansion-3', WoW_Locale::GetLocale(LOCALE_DOUBLE))); WoW_Template::SetTemplateTheme('wow'); WoW_Template::SetPageIndex('zones'); WoW_Template::SetPageData('page', 'zones'); $url_data = WoW::GetUrlData('zone'); if (isset($url_data['action3'])) { exit; } if (isset($url_data['action1']) && $url_data['action1'] != null) { // Try to find zone if (WoW_Game::IsZone($url_data['action1'])) { WoW_Template::SetPageData('zoneKey', $url_data['action1']); if (isset($url_data['action2']) && $url_data['action2'] != null) { if (in_array($url_data['action2'], array('loot', 'quests', 'quest-rewards', 'achievements', 'comments'))) { die('NYI'); } if (WoW_Game::IsBoss($url_data['action2'])) { WoW_Template::SetPageIndex('boss'); WoW_Template::SetPageData('page', 'boss'); WoW_Template::SetPageData('bossKey', $url_data['action2']); WoW_Game::LoadBoss($url_data['action2']); // save in memory WoW_Template::SetPageData('body_class', sprintf('%s zone-%s boss-%s', WoW_Locale::GetLocale(LOCALE_DOUBLE), $url_data['action1'], $url_data['action2'])); } } else { WoW_Template::SetPageIndex('zone'); WoW_Template::SetPageData('page', 'zone'); WoW_Game::LoadZone($url_data['action1']); // save in memory WoW_Template::SetPageData('body_class', sprintf('%s zone-%s', WoW_Locale::GetLocale(LOCALE_DOUBLE), $url_data['action1'])); } } } WoW_Template::SetMenuIndex('menu-game'); WoW_Template::LoadTemplate('page_index'); }
public static function InitPage($page_type, $category) { if ($page_type != 'search') { WoW_Log::WriteError('%s : wrong page type (%s)!', __METHOD__, $page_type); return false; } if (!isset($_GET['q'])) { WoW::RedirectTo(); } if ($_GET['q'] == null) { WoW::RedirectTo(); } WoW_Template::SetPageData('search_query', $_GET['q']); self::$m_query = $_GET['q']; if (isset($_GET['opensearch'])) { echo '["ragnaros", ["Lil\' Ragnaros (Item)", "Ragnaros Core (Item)", "Spark of Ragnaros (Item)", "Sulfuras, Hand of Ragnaros (Item)", "Symbol of Ragnaros (Item)", "Ragnaros kills (Molten Core) (Achievement)", "Sulfuras, Hand of Ragnaros (Achievement)", "Sulfuras, Hand of Ragnaros - Guild Edition (Achievement)", "Dream of Ragnaros (Spell)", "Wrath of Ragnaros (Spell)"], [], [], [], [], [], [[3, 68385, "achievement_boss_ragnaros", 3], [3, 17982, "INV_Jewelry_Ring_25", 3], [3, 52332, "INV_Elemental_Primal_Fire", 1], [3, 17182, "INV_Hammer_Unique_Sulfuras", 5], [3, 10552, "INV_Jewelry_Talisman_04", 1], [10, 1099, "spell_fire_elemental_totem"], [10, 429, "inv_hammer_unique_sulfuras"], [10, 4997, "inv_hammer_unique_sulfuras"], [6, 75145, "INV_Chest_Cloth_57"], [6, 84402, "spell_fire_soulburn"]]]'; die; } WoW_Template::SetPageData('disable_breadcrumb', true); WoW_Template::SetPageData('activeTab', 0); // Do search self::PerformSearch(); }
public function main() { WoW_Template::SetPageData('body_class', sprintf('%s faction-index expansion-3', WoW_Locale::GetLocale(LOCALE_DOUBLE))); WoW_Template::SetTemplateTheme('wow'); WoW_Template::SetPageIndex('faction'); WoW_Template::SetPageData('page', 'faction'); $url_data = WoW::GetUrlData('faction'); if (isset($url_data['action2']) && $url_data['action2'] != null) { exit; // [PH] } if (isset($url_data['action1']) && $url_data['action1'] != null) { // Try to find zone if (WoW_Game::IsZone($url_data['action1'])) { WoW_Template::SetPageIndex('zone'); WoW_Template::SetPageData('page', 'zone'); WoW_Game::LoadZone($url_data['action1']); // save in memory } } WoW_Template::SetMenuIndex('menu-game'); WoW_Template::LoadTemplate('page_index'); }
public function main() { WoW_Template::SetTemplateTheme('wow'); WoW_Template::SetPageData('body_class', WoW_Locale::GetLocale(LOCALE_DOUBLE)); WoW_Template::SetMenuIndex('menu-forums'); $url_data = WoW::GetUrlData('forum'); $page = isset($_GET['page']) && preg_match('/([0-9]+)/i', $_GET['page']) ? $_GET['page'] : 1; WoW_Template::SetPageData('current_page', $page); // Clear category/thread values WoW_Forums::SetCategoryId(0); WoW_Forums::SetThreadId(0); // Check preview if (isset($url_data['action4'], $url_data['action5'], $url_data['action6']) && $url_data['action4'] . $url_data['action5'] . $url_data['action6'] == 'topicpostpreview') { $post_text = isset($_POST['post']) ? $_POST['post'] : null; if ($post_text == null) { //This can not be here, it causes error when preview blank post text //WoW_Template::ErrorPage(500); } // Convert BB codes to HTML WoW_Forums::BBCodesToHTML($post_text); // Output json header('Content-type: text/json'); echo '{"detail":"' . $post_text . '"}'; exit; } // Set values (if any) if ($url_data['category_id'] > 0) { if (!WoW_Forums::SetCategoryId($url_data['category_id'])) { WoW_Template::ErrorPage(404); exit; } if (isset($url_data['action5']) && $url_data['action5'] == 'topic' && WoW_Account::IsHaveActiveCharacter()) { // Check $_POST query if (isset($_POST['xstoken'])) { $post_allowed = true; $required_post_fields = array('xstoken', 'sessionPersist', 'subject', 'postCommand_detail'); foreach ($required_post_fields as $field) { if (!isset($_POST[$field])) { $post_allowed = false; } } if ($post_allowed) { $post_info = WoW_Forums::AddNewThread($url_data['category_id'], $_POST, false); if (is_array($post_info)) { header('Location: ' . WoW::GetWoWPath() . '/wow/' . WoW_Locale::GetLocale() . '/forum/topic/' . $post_info['thread_id']); exit; } } } // Topic create WoW_Template::SetPageIndex('forum_new_topic'); WoW_Template::SetPageData('page', 'forum_new_topic'); } else { WoW_Template::SetPageIndex('forum_category'); WoW_Template::SetPageData('page', 'forum_category'); } } elseif ($url_data['thread_id'] > 0) { if (!WoW_Forums::SetThreadId($url_data['thread_id'])) { WoW_Template::ErrorPage(404); exit; } if (isset($url_data['action4']) && $url_data['action4'] == 'topic' && preg_match('/([0-9]+)/i', $url_data['action5']) && WoW_Account::IsHaveActiveCharacter()) { // Check $_POST query if (isset($_POST['xstoken'])) { $post_allowed = true; $required_post_fields = array('xstoken', 'sessionPersist', 'detail'); foreach ($required_post_fields as $field) { if (!isset($_POST[$field])) { $post_allowed = false; } } if ($post_allowed) { $post_info = WoW_Forums::AddNewPost(null, $url_data['thread_id'], $_POST); if (is_array($post_info)) { header('Location: ' . WoW::GetWoWPath() . '/wow/' . WoW_Locale::GetLocale() . '/forum/topic/' . $url_data['thread_id']); exit; } } } } WoW_Template::SetPageIndex('forum_thread'); WoW_Template::SetPageData('page', 'forum_thread'); } elseif (isset($url_data['action4']) && $url_data['action4'] == 'topic' && isset($url_data['action5']) && $url_data['action5'] == 'post' && isset($url_data['action6']) && preg_match('/([0-9]+)/i', $url_data['action6'])) { if (isset($url_data['action7']) && WoW_Account::IsHaveActiveCharacter()) { switch ($url_data['action7']) { case 'frag': $Quote = WoW_Forums::QuotePost($url_data['action6']); header('Content-type: text/json'); echo '{"detail":"' . $Quote['message'] . '","name":"' . $Quote['name'] . '"}'; exit; break; case 'edit': if (isset($_POST['xstoken'])) { $post_allowed = true; $required_post_fields = array('xstoken', 'sessionPersist', 'postCommand_detail'); foreach ($required_post_fields as $field) { if (!isset($_POST[$field])) { $post_allowed = false; } } if ($post_allowed) { $thread_id = WoW_Forums::EditPost($url_data['action6'], $_POST); if ($thread_id) { header('Location: ' . WoW::GetWoWPath() . '/wow/' . WoW_Locale::GetLocale() . '/forum/topic/' . $thread_id); exit; } } } if ($post = WoW_Forums::GetPost($url_data['action6'])) { if (!WoW_Forums::SetThreadId($post['thread_id'])) { WoW_Template::ErrorPage(404); exit; } WoW_Template::SetPageData('edit_text', $post['message']); WoW_Template::SetPageIndex('forum_edit_post'); WoW_Template::SetPageData('page', 'forum_edit_post'); } break; } } } elseif ($url_data['action4'] == 'blizztracker') { // Set Blizz tracker as active WoW_Forums::SetBlizzTrackerActive(); // Init Blizz tracker! WoW_Forums::InitBlizzTracker(false, $page); WoW_Template::SetPageIndex('forum_blizztracker'); WoW_Template::SetPageData('page', 'forum_blizztracker'); } else { // Init Blizz tracker! WoW_Forums::InitBlizzTracker(true); WoW_Template::SetPageIndex('forum_index'); WoW_Template::SetPageData('page', 'forum_index'); WoW_Template::SetPageData('body_class', WoW_Locale::GetLocale(LOCALE_DOUBLE) . ' station-home'); } // Init the forums! WoW_Forums::InitForums($page); WoW_Template::SetPageData('forum_category_title', WoW_Forums::GetCategoryTitle()); WoW_Template::SetPageData('forum_thread_title', WoW_Forums::GetThreadTitle()); WoW_Template::LoadTemplate('page_index'); }
public function main() { $url_data = WoW::GetUrlData('vault'); // Check session if ($url_data['action0'] != 'vault') { // Wrong URL parsing header('Location: ' . WoW::GetWoWPath() . '/wow/'); exit; } if (!WoW_Account::IsLoggedIn()) { header('Location: ' . WoW::GetWoWPath() . '/login/?ref=' . urlencode($_SERVER['REQUEST_URI'])); exit; } WoW_Template::SetTemplateTheme('wow'); switch ($url_data['action1']) { case 'character': switch ($url_data['action2']) { case 'auction': $auction_side = $url_data['action3']; if (!$auction_side || !in_array($auction_side, array('alliance', 'horde', 'neutral'))) { WoW::RedirectTo('wow/' . WoW_Locale::GetLocale() . '/vault/character/auction/' . WoW_Account::GetActiveCharacterInfo('faction_text')); } // Check active character if (WoW_Account::GetActiveCharacterInfo('guid') == 0) { WoW::RedirectTo(); } switch ($url_data['action4']) { default: WoW_Template::SetPageData('auction_side', $auction_side); WoW_Template::SetPageIndex('auction_lots'); WoW_Template::SetPageData('page', 'auction_lots'); break; case 'cancel': // Cancelling, adding, etc. requires core support! if (!isset($_POST['auc'])) { exit; } $auction_id = (int) $_POST['auc']; header('Content-type: text/plain'); echo WoW_Auction::CancelAuction($auction_id); exit; /* if(isset($_POST['auc'])) { $auction_id = (int) $_POST['auc']; // WoW REMOTE FEATURE } file_put_contents('cancel.txt', print_r($_POST, true)); exit; */ break; } break; default: WoW_Template::ErrorPage(404); break; } break; default: WoW_Template::ErrorPage(404); break; } WoW_Template::LoadTemplate('page_index'); }
public function LoadItem($item_entry, $itemGuid = 0, $ownerGuid = 0) { $item_row = DB::World()->selectRow("\n SELECT\n `a`.*,\n %s\n `b`.`icon`,\n `d`.`patch`\n FROM `item_template` AS `a`\n LEFT JOIN `DBPREFIX_icons` AS `b` ON `b`.`displayid` = `a`.`displayid`\n LEFT JOIN `locales_item` AS `c` ON `c`.`entry` = `a`.`entry`\n LEFT JOIN `DBPREFIX_item_version` AS `d` ON `d`.`entry` = `a`.`entry`\n WHERE `a`.`entry` = %d LIMIT 1", WoW_Locale::GetLocaleID() > 0 ? sprintf('`c`.`name_loc%d` AS `name_loc`, `c`.`description_loc%d` AS `desc_loc`,', WoW_Locale::GetLocaleID(), WoW_Locale::GetLocaleID()) : null, $item_entry); if (!$item_row) { WoW_Log::WriteError('%s : item #%d (GUID: %d) was not found in `item_template` table.', __METHOD__, $item_entry, $itemGuid); return false; } // FlagsExtra check if (isset($item_row['FlagsExtra'])) { $item_row['Flags2'] = $item_row['FlagsExtra']; unset($item_row['FlagsExtra']); // For compatibility } // Assign variables foreach ($item_row as $field => $value) { $this->{$field} = $value; } // Create arrays // Item mods for ($i = 0; $i < MAX_ITEM_PROTO_STATS + 1; $i++) { $key = $i + 1; if (isset($this->{'stat_type' . $key})) { $this->ItemStat[$i] = array('type' => $this->{'stat_type' . $key}, 'value' => $this->{'stat_value' . $key}); } } // Item damages for ($i = 0; $i < MAX_ITEM_PROTO_DAMAGES + 1; $i++) { $key = $i + 1; if (isset($this->{'dmg_type' . $key})) { $this->Damage[$i] = array('type' => $this->{'dmg_type' . $key}, 'min' => $this->{'dmg_min' . $key}, 'max' => $this->{'dmg_max' . $key}); } } // Item spells for ($i = 0; $i < MAX_ITEM_PROTO_SPELLS + 1; $i++) { $key = $i + 1; if (isset($this->{'spellid_' . $key})) { $this->Spells[$i] = array('spellid' => $this->{'spellid_' . $key}, 'trigger' => $this->{'spelltrigger_' . $key}, 'charges' => $this->{'spellcharges_' . $key}, 'ppmRate' => $this->{'spellppmRate_' . $key}, 'cooldown' => $this->{'spellcooldown_' . $key}, 'category' => $this->{'spellcategory_' . $key}, 'categorycooldown' => $this->{'spellcategorycooldown_' . $key}); } } // Item sockets for ($i = 0; $i < MAX_ITEM_PROTO_SOCKETS + 1; $i++) { $key = $i + 1; if (isset($this->{'socketColor_' . $key})) { $this->Socket[$i] = array('color' => $this->{'socketColor_' . $key}, 'content' => $this->{'socketContent_' . $key}, 'filter' => 0, 'name' => ''); switch ($this->Socket[$i]['color']) { case 1: $this->Socket[$i]['filter'] = $this->Socket[$i]['color']; $this->Socket[$i]['name'] = 'meta'; case 2: $this->Socket[$i]['filter'] = $this->Socket[$i]['color']; $this->Socket[$i]['name'] = 'red'; break; case 4: $this->Socket[$i]['filter'] = 3; $this->Socket[$i]['name'] = 'yellow'; break; case 8: $this->Socket[$i]['filter'] = 4; $this->Socket[$i]['name'] = 'blue'; break; } } } // Set locale if (WoW_Locale::GetLocaleID() != LOCALE_EN) { $this->name = $this->name_loc != null ? $this->name_loc : $this->name; $this->description = $this->desc_loc != null ? $this->desc_loc : $this->description; } // Data to template class WoW_Template::SetPageData('item_name', $this->name); // Set class/subclass/inventory type names $itemsubclass = DB::World()->selectRow("SELECT `subclass_name_%s` AS `subclass`, `class_name_%s` AS `class` FROM `DBPREFIX_item_subclass` WHERE `subclass` = %d AND `class` = %d LIMIT 1", WoW_Locale::GetLocale(), WoW_Locale::GetLocale(), $this->subclass, $this->class); if (is_array($itemsubclass)) { $this->subclass_name = $itemsubclass['subclass']; $this->class_name = $itemsubclass['class']; } if (in_array($this->class, array(ITEM_CLASS_ARMOR, ITEM_CLASS_WEAPON))) { $this->InventoryType_name = $this->InventoryType > 0 ? WoW_Locale::GetString('template_item_invtype_' . $this->InventoryType) : null; } // Faction if ($this->Flags2 & ITEM_FLAGS2_HORDE_ONLY) { $this->faction = FACTION_HORDE; $this->faction_convert = DB::World()->selectCell("SELECT `item_alliance` FROM `DBPREFIX_item_equivalents` WHERE `item_horde` = %d", $this->entry); } elseif ($this->Flags2 & ITEM_FLAGS2_ALLIANCE_ONLY) { $this->faction = FACTION_ALLIANCE; $this->faction_convert = DB::World()->selectCell("SELECT `item_horde` FROM `DBPREFIX_item_equivalents` WHERE `item_alliance` = %d", $this->entry); } // GUIDs $this->m_guid = $itemGuid; // Can be NULL. $this->m_owner = $ownerGuid; // Can be NULL. $this->loaded = true; return true; }
<?php header('Content-type: text/javascript'); echo WoW_Template::GetPageData('js-data'); WoW_Template::SetPageData('js-data', null); // Must be freed after using! exit; // Do not load anything after loading "block_data" template!
private static function HandleNPC() { if (!is_array(self::$m_npc)) { return false; } if (WoW_Locale::GetLocaleID() != LOCALE_EN) { if (isset(self::$m_npc['name_loc']) && self::$m_npc['name_loc'] != null) { self::$m_npc['name'] = self::$m_npc['name_loc']; unset(self::$m_npc['name_loc']); } if (isset(self::$m_npc['subname_loc']) && self::$m_npc['subname_loc'] != null) { self::$m_npc['subname'] = self::$m_npc['subname_loc']; unset(self::$m_npc['subname_loc']); } } WoW_Template::SetPageData('db_page_title', self::$m_npc['name'] . ' - '); self::$m_npc['zone_info'] = WoW_Utils::GetNpcAreaInfo(self::$m_npc['entry']); if (is_array(self::$m_npc['zone_info'])) { $zone =& self::$m_npc['zone_info']; if (WoW_Locale::GetLocaleID() != LOCALE_EN && $zone['zoneName_loc'] != null) { $zone['zoneName'] = $zone['zoneName_loc']; } unset($zone['zoneName_loc']); } else { unset(self::$m_npc['zone_info']); } if (self::$m_npc['minlevel'] == self::$m_npc['maxlevel']) { if (self::$m_npc['minlevel'] == MAX_PLAYER_LEVEL + 3) { self::$m_npc['level'] = '??'; } else { self::$m_npc['level'] = self::$m_npc['minlevel']; } } else { self::$m_npc['level'] = self::$m_npc['maxlevel']; } if (self::$m_npc['minhealth'] == self::$m_npc['maxhealth']) { self::$m_npc['health'] = number_format(self::$m_npc['minhealth']); } else { self::$m_npc['health'] = number_format(self::$m_npc['minhealth']) . ' - ' . number_format(self::$m_npc['maxhealth']); } self::$m_npc['money'] = 0; if (self::$m_npc['mingold'] > 0 || self::$m_npc['maxgold'] > 0) { self::$m_npc['money'] = max(self::$m_npc['mingold'], self::$m_npc['maxgold']); } // Loot self::$m_npc['loot'] = self::GetNpcLoot(self::$m_npc['entry']); // Spells self::$m_npc['spells'] = self::GetNpcSpells(self::$m_npc['entry']); // Achievements self::$m_npc['achievements'] = self::GetNpcAchievements(self::$m_npc['entry']); // Same model as $model_id = array(); for ($i = 1; $i < 5; ++$i) { if (self::$m_npc['modelid_' . $i] > 0) { $model_id[] = self::$m_npc['modelid_' . $i]; } } self::$m_npc['npcs'] = self::GetNpcSameModel($model_id, self::$m_npc['entry']); }
public function main() { $url_data = WoW::GetUrlData('management'); if (!is_array($url_data) || !isset($url_data['action1'])) { header('Location: ' . WoW::GetWoWPath() . '/account/management/'); exit; } if ($url_data['action1'] == 'creation') { include CONTROLLERS_DIR . 'account' . DS . 'creation.php'; $controller = new Creation($this->m_actions, 'account'); $controller->main(); exit; } if (!WoW_Account::IsLoggedIn()) { if ($url_data['action1'] == 'support') { WoW_Template::SetTemplateTheme('account'); switch ($url_data['action2']) { default: case 'password-reset.html': WoW_Template::SetPageIndex('password_reset'); WoW_Template::SetPageData('page', 'password_reset'); break; case 'password-reset-select.html': if (isset($_POST['csrftoken'])) { $user_data = array('email' => $_POST['email'], 'username' => $_POST['firstName']); WoW_Account::DropLastErrorCode(); if (WoW_Account::RecoverPasswordSelect($user_data)) { $_SESSION['wow_password_recovery'] = WoW_Account::GetRecoverPasswordData(); WoW_Template::SetPageIndex('password_reset_select'); WoW_Template::SetPageData('page', 'password_reset_select'); } else { WoW_Account::SetLastErrorCode(ERORR_INVALID_PASSWORD_RECOVERY_COMBINATION); WoW_Template::SetPageIndex('password_reset'); WoW_Template::SetPageData('page', 'password_reset'); } } break; case 'password-reset-secred-answer.html': WoW_Account::SetRecoverPasswordData($_SESSION['wow_password_recovery']); if (isset($_POST['verificationMethod']) && $_POST['verificationMethod'] == 'SECURITY_QUESTION') { WoW_Template::SetPageIndex('password_reset_secred_answer'); WoW_Template::SetPageData('page', 'password_reset_secred_answer'); } else { WoW_Template::SetPageIndex('password_reset_select'); WoW_Template::SetPageData('page', 'password_reset_select'); } break; case 'password-reset-success.html': WoW_Account::SetRecoverPasswordData($_SESSION['wow_password_recovery']); if (isset($_POST['secretAnswer'])) { WoW_Account::DropLastErrorCode(); if (WoW_Account::RecoverPasswordSuccess($_POST['secretAnswer'])) { WoW_Template::SetPageIndex('password_reset_success'); WoW_Template::SetPageData('page', 'password_reset_success'); } else { WoW_Account::SetLastErrorCode(ERORR_INVALID_PASSWORD_RECOVERY_ANSWER); WoW_Template::SetPageIndex('password_reset_secred_answer'); WoW_Template::SetPageData('page', 'password_reset_secred_answer'); } } break; case 'password-reset-confirm.xml': if (isset($_POST['email']) && isset($_POST['ticket'])) { $data = array('newPassword' => $_POST['newPassword'], 'reNewPassword' => $_POST['reNewPassword']); WoW_Account::DropLastErrorCode(); if ($data['newPassword'] != $data['reNewPassword']) { WoW_Account::SetLastErrorCode(ERORR_NEW_PASSWORD_NOT_MATCH); WoW_Template::SetPageIndex('password_reset_confirm'); WoW_Template::SetPageData('page', 'password_reset_confirm'); } elseif (WoW_Account::RecoverPasswordChange($data['newPassword'])) { WoW_Template::SetPageIndex('password_reset_changed'); WoW_Template::SetPageData('page', 'password_reset_confirm'); } else { WoW_Account::SetLastErrorCode(ERORR_NEW_PASSWORD_FAIL); WoW_Template::SetPageIndex('password_reset_confirm'); WoW_Template::SetPageData('page', 'password_reset_confirm'); } } break; } if (preg_match('/password-reset-confirm.xml\\?ticket=([a-z0-9A-Z]{32})$/i', $url_data['action2'], $matches)) { if (WoW_Account::validTicket($matches[1])) { WoW_Template::SetPageIndex('password_reset_confirm'); WoW_Template::SetPageData('page', 'password_reset_confirm'); } } WoW_Template::LoadTemplate('support_index'); exit; } else { header('Location: ' . WoW::GetWoWPath() . '/login/'); exit; } } WoW_Template::SetTemplateTheme('account'); WoW_Account::UserGames(); WoW_Template::SetPageIndex('management'); WoW_Template::SetMenuIndex('management'); WoW_Template::SetPageData('page', 'management'); if ($url_data['action2'] == 'wow' && preg_match('/dashboard.html/i', $url_data['action3'])) { WoW_Account::InitializeAccount($_GET['accountName']); WoW_Template::SetPageIndex('dashboard'); WoW_Template::SetMenuIndex('games'); WoW_Template::SetPageData('page', 'dashboard'); WoW_Template::LoadTemplate('page_index'); } elseif ($url_data['action2'] == 'wow-account-conversion.html') { WoW_Template::SetPageData('conversion_page', 1); if (isset($_POST['targetpage'])) { switch ($_POST['targetpage']) { case '2': if (isset($_POST['username']) && isset($_POST['password'])) { if (WoW_Account::PerformConversionStep(1, array('username' => $_POST['username'], 'password' => $_POST['password']))) { WoW_Template::SetPageData('conversion_page', 2); } else { WoW_Template::SetPageData('conversion_page', 1); } } else { WoW_Template::SetPageData('conversion_page', 1); } break; case '3': WoW_Template::SetPageData('conversion_page', 3); break; case 'finish': if (!WoW_Account::PerformConversionStep(3)) { WoW_Template::SetPageData('conversion_page', 2); } break; default: break; } } WoW_Template::SetPageIndex('account_conversion'); Wow_Template::SetMenuIndex('games'); WoW_Template::SetPageData('page', 'account_conversion'); WoW_Template::LoadTemplate('page_index'); } WoW_Template::LoadTemplate('page_index'); }
private static function InitData() { WoW_Template::SetPageIndex('data'); $js_contents = null; switch (self::GetPageAction()) { case 'spell-scaling': case 'item-scaling': case 'realms.weight-presets': case 'user': $js_contents = file_get_contents('data/' . self::GetPageAction() . '.js'); break; // Locale-depended files // Locale-depended files case 'weight-presets.zones': case 'zones': case 'glyphs': $js_contents = file_get_contents('data/' . self::GetPageAction() . '-' . WoW_Locale::GetLocaleID() . '.js'); break; case 'talents': $class_id = isset($_GET['class']) ? (int) $_GET['class'] : 6; $js_contents = file_get_contents('data/talents-' . $class_id . '-' . WoW_Locale::GetLocaleID() . '.js'); break; } WoW_Template::SetPageData('js-data', $js_contents); // Must be freed after using! }
private static function HandleZone() { if (!is_array(self::$m_zone)) { return false; } if (self::$m_zone['expansion'] < EXPANSION_CLASSIC || self::$m_zone['expansion'] > EXPANSION_CATA) { WoW_Log::WriteError('%s : instance %d (zone key: "%s") has wrong expansionID (%d)!', __METHOD__, self::$m_zone['zone_id'], self::$m_zone['zone_key'], self::$m_zone['expansion']); return false; } if (self::$m_zone['flags'] <= 0) { WoW_Log::WriteError('%s : instance %d (zone key: "%s") has no flags setted!', __METHOD__, self::$m_zone['zone_id'], self::$m_zone['zone_key']); return false; } if (!(self::$m_zone['flags'] & INSTANCE_FLAG_DUNGEON) && !(self::$m_zone['flags'] & INSTANCE_FLAG_RAID)) { WoW_Log::WriteError('%s : instance %d (zone key: "%s") has no type flag (dungeon/raid)!', __METHOD__, self::$m_zone['zone_id'], self::$m_zone['zone_key']); return false; } if (self::$m_zone['name'] == null) { self::$m_zone['name'] = self::$m_zone['nameOriginal']; } if (self::$m_zone['dungeonGroupName'] == null && self::$m_zone['dungeonGroup'] > 0) { self::$m_zone['dungeonGroupName'] = self::$m_zone['dungeonGroupNameOriginal']; } if (self::$m_zone['locationName'] == null) { self::$m_zone['locationName'] = self::$m_zone['locationNameOriginal']; } if (self::$m_zone['flags'] & INSTANCE_FLAG_DUNGEON) { self::$m_zone['type'] = 'dungeon'; self::$m_zone['players'] = 5; } else { self::$m_zone['type'] = 'raid'; if (self::$m_zone['flags'] & INSTANCE_FLAG_RAID1_MODE_ONLY) { self::$m_zone['players'] = 10; } elseif (self::$m_zone['flags'] & INSTANCE_FLAG_RAID2_MODE_ONLY) { self::$m_zone['players'] = 25; } elseif (self::$m_zone['flags'] & INSTANCE_FLAG_RAID3_MODE_ONLY) { self::$m_zone['players'] = 40; } else { self::$m_zone['players'] = '10/25'; } } self::$m_zone['location_name'] = sprintf('%s%s', self::$m_zone['dungeonGroupName'] != null ? self::$m_zone['dungeonGroupName'] . ', ' : null, self::$m_zone['locationName']); self::$m_zone['suggested_level'] = self::$m_zone['minLevel'] == self::$m_zone['maxLevel'] ? self::$m_zone['maxLevel'] : sprintf('%d–%d', self::$m_zone['minLevel'], self::$m_zone['maxLevel']); self::$m_zone['heroic_level'] = 0; if (self::$m_zone['flags'] & INSTANCE_FLAG_REVAMPED && self::$m_zone['flags'] & INSTANCE_FLAG_CATA_REVAMP) { self::$m_zone['suggested_level'] = self::$m_zone['minLevelExtra'] == self::$m_zone['maxLevelExtra'] ? self::$m_zone['maxLevelExtra'] : sprintf('%d–%d', self::$m_zone['minLevelExtra'], self::$m_zone['maxLevelExtra']); self::$m_zone['heroic_level'] = max(self::$m_zone['maxLevel'], self::$m_zone['maxLevelExtra']); } elseif (self::$m_zone['maxLevelExtra'] > self::$m_zone['maxLevel']) { self::$m_zone['heroic_level'] = self::$m_zone['maxLevelExtra']; } if (self::$m_zone['floorLevelsCount'] > 0 && self::$m_zone['floorLevels'] != null) { $zone_floors = explode('|', self::$m_zone['floorLevels']); if ($zone_floors) { self::$m_zone['floorLevels'] = $zone_floors; } else { self::$m_zone['floorLevelsCount'] = 0; } } WoW_Template::SetPageData('zone_name', self::$m_zone['name']); WoW_Template::SetPageData('zone_key', self::$m_zone['zone_key']); }
public function main() { WoW_Template::SetTemplateTheme('wow'); WoW_Template::SetPageIndex('item_info'); WoW_Template::SetPageData('page', 'item_info'); WoW_Template::SetMenuIndex('menu-game'); $url_data = WoW::GetUrlData('item'); if (!$url_data) { if (!isset($_GET['t'])) { WoW_Template::ErrorPage(404); } exit; } $item_entry = $url_data['item_entry']; if ($item_entry == 0) { $breadcrumbs = WoW_Items::GetBreadCrumbsForItem($_GET); WoW_Template::SetPageIndex('item_list'); WoW_Template::SetPageData('body_class', 'item-index'); WoW_Template::SetPageData('page', 'item_list'); WoW_Template::SetPageData('breadcrumbs', $breadcrumbs); WoW_Template::SetPageData('last-crumb', is_array($breadcrumbs) ? $breadcrumbs[sizeof($breadcrumbs) - 1]['caption'] : WoW_Locale::GetString('template_menu_items')); WoW_Template::LoadTemplate('page_index'); exit; } // Load proto $proto = new WoW_ItemPrototype(); $proto->LoadItem($item_entry); if (!$proto->IsCorrect()) { if (!isset($_GET['t']) && (!isset($url_data['action0']) || $url_data['action0'] != 'tooltip')) { WoW_Template::ErrorPage(404); } exit; } WoW_Template::SetPageData('item_entry', $item_entry); // SSD and SSV data $ssd = DB::WoW()->selectRow("SELECT * FROM `DBPREFIX_ssd` WHERE `entry` = %d", $proto->ScalingStatDistribution); $ssd_level = MAX_PLAYER_LEVEL; if (isset($_GET['pl'])) { $ssd_level = (int) $_GET['pl']; if (is_array($ssd) && $ssd_level > $ssd['MaxLevel']) { $ssd_level = $ssd['MaxLevel']; } } $ssv = DB::WoW()->selectRow("SELECT * FROM `DBPREFIX_ssv` WHERE `level` = %d", $ssd_level); if (isset($_GET['t'])) { $url_data['tooltip'] = true; } if ($url_data['tooltip'] == true) { WoW_Template::SetPageIndex('item_tooltip'); WoW_Template::SetPageData('tooltip', true); WoW_Template::SetPageData('page', 'item_tooltip'); WoW_Template::SetPageData('proto', $proto); WoW_Template::SetPageData('ssd', $ssd); WoW_Template::SetPageData('ssd_level', $ssd_level); WoW_Template::SetPageData('ssv', $ssv); WoW_Template::LoadTemplate('page_item_tooltip'); } else { if (isset($url_data['action0']) && $url_data['action0'] != null) { WoW_Template::SetPageData('tab_type', $url_data['action0']); WoW_Template::LoadTemplate('page_item_tab'); exit; } WoW_Template::SetPageIndex('item'); WoW_Template::SetPageData('tooltip', false); WoW_Template::SetPageData('itemName', $proto->name); WoW_Template::SetPageData('page', 'item'); WoW_Template::SetPageData('proto', $proto); WoW_Template::SetPageData('ssd', $ssd); WoW_Template::SetPageData('ssd_level', $ssd_level); WoW_Template::SetPageData('ssv', $ssv); WoW_Template::LoadTemplate('page_index'); } unset($proto); }
/** * Performs account conversion (merging) step * * @access public * @static WoW_Account::PerformConversionStep($step, $post_data = false) * @param int $step * @param array $post_data = false * @category Account Manager Class * @return bool **/ public static function PerformConversionStep($step, $post_data = false) { switch ($step) { case 1: // Find account in realm DB and check passwords matching if (!is_array($post_data)) { // Wrong post data WoW_Template::SetPageData('conversion_error', true); WoW_Template::SetPageData('account_creation_error_msg', WoW_Locale::GetString('template_account_conversion_error1')); return false; } $info = DB::Realm()->selectRow("SELECT `id`, `sha_pass_hash` FROM `account` WHERE `username` = '%s' LIMIT 1", $post_data['username']); $sha = sha1(strtoupper($post_data['username']) . ':' . strtoupper($post_data['password'])); if (!$info || $info['sha_pass_hash'] != $sha) { // Wrong post data WoW_Template::SetPageData('conversion_error', true); WoW_Template::SetPageData('account_creation_error_msg', WoW_Locale::GetString('template_account_conversion_error1')); return false; } // Check account link if (DB::WoW()->selectCell("SELECT 1 FROM `DBPREFIX_users_accounts` WHERE `account_id` = %d", $info['id'])) { // Already linked WoW_Template::SetPageData('conversion_error', true); WoW_Template::SetPageData('account_creation_error_msg', WoW_Locale::GetString('template_account_conversion_error2')); return false; } // All fine $_SESSION['conversion_userName'] = $post_data['username']; $_SESSION['conversion_userID'] = $info['id']; break; case 3: // Check session $conversion_allowed = true; if (!isset($_SESSION['conversion_userName']) || !isset($_SESSION['conversion_userID'])) { $conversion_allowed = false; } else { if ($_SESSION['conversion_userName'] == null) { $conversion_allowed = false; } if ($_SESSION['conversion_userID'] == 0) { $conversion_allowed = false; } } if (!$conversion_allowed) { header('Location: ' . WoW::GetWoWPath() . '/account/management/wow-account-conversion.html'); exit; } // Link account if (DB::WoW()->query("INSERT INTO `DBPREFIX_users_accounts` VALUES (%d, %d)", self::GetUserID(), (int) $_SESSION['conversion_userID'])) { header('Location: ' . WoW::GetWoWPath() . '/account/management/wow/dashboard.html?accountName=' . $_SESSION['conversion_userName'] . '®ion=EU'); exit; } break; default: return false; } return true; }
private static function HandleAchievement() { if (!is_array(self::$m_achievement)) { return false; } $ach =& self::$m_achievement; $ach['name'] = $ach['name_' . WoW_Locale::GetLocale()]; $ach['desc'] = $ach['desc_' . WoW_Locale::GetLocale()]; $ach['titleReward'] = $ach['titleReward_' . WoW_Locale::GetLocale()]; WoW_Template::SetPageData('db_page_title', $ach['name'] . ' - '); if ($ach['parentCategory'] == 1) { $ach['type'] = 2; } else { $ach['type'] = 1; } // Check titleReward if ($ach['titleReward'] != null) { // Check rewards (item or title) $rewards = DB::World()->selectRow("SELECT * FROM achievement_reward WHERE entry = %d", $ach['id']); if (is_array($rewards)) { // Item? $ach['titleReward'] = array(); if ($rewards['item'] > 0) { $ach['titleReward'][] = array('type' => 'item', 'data' => WoW_Items::GetBasicItemInfo($rewards['item'])); } if ($rewards['title_A'] > 0 || $rewards['title_H'] > 0) { $ach['titleReward'][] = array('type' => 'title', 'data' => DB::World()->select("SELECT id, title_M_%s AS title FROM DBPREFIX_titles WHERE id IN (%s)", WoW_Locale::GetLocale(), array($rewards['title_A'], $rewards['title_H']))); } } } else { $ach['titleReward'] = array(); } WoW_Template::SetPageData('breadcrumb', '0,9,' . $ach['categoryId']); if (is_array($ach['criterias'])) { // CRITERA STRING SHOULD BE GENERATED HERE, NOT IN VIEW! foreach ($ach['criterias'] as &$cr) { $cr['name'] = $cr['name_' . WoW_Locale::GetLocale()]; $cr['criteria_string'] = $cr['name']; switch ($cr['requiredType']) { case ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE: $cr['criteria_string'] = '<a href="' . WoW::GetWoWPath() . '/npc=' . $cr['data'] . '">' . WoW_NPCs::GetNPCInfo($cr['data'], 'name') . '</a> ' . WoW_Locale::GetString('template_achievement_slain'); break; case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_ACHIEVEMENT: $cr['criteria_string'] = '<a href="' . WoW::GetWoWPath() . '/achievement=' . $cr['data'] . '">' . self::GetAchievementInfo($cr['data'], 'name') . '</a>'; //$cr['data_achievement'] = self::GetBasicAchievementInfo($cr['data']); break; case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SPELL: break; case ACHIEVEMENT_CRITERIA_TYPE_OWN_ITEM: case ACHIEVEMENT_CRITERIA_TYPE_USE_ITEM: case ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM: case ACHIEVEMENT_CRITERIA_TYPE_EQUIP_EPIC_ITEM: case ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM: break; case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LEVEL: case ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL: break; case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL: break; case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST: break; case ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION: break; case ACHIEVEMENT_CRITERIA_TYPE_GAIN_EXALTED_REPUTATION: break; } } } }
private static function GetFiltersForItems() { $filter_string = null; $andOr = 1; $all_filters = WoW::GetFilters(); if (is_array($all_filters)) { foreach ($all_filters as $filter) { if (!isset($filter['key']) || !isset($filter['values'])) { continue; } $val_count = count($filter['values']); switch ($filter['key']) { // Name case 'na': if (WoW_Locale::GetLocaleID() > 0) { $filter_string .= sprintf(" {COND} ((`b`.`name_loc%d` LIKE '%s') OR (`a`.`name` LIKE '%s'))", WoW_Locale::GetLocaleID(), '%' . $filter['values'][0] . '%', '%' . $filter['values'][0] . '%'); } else { $filter_string .= sprintf("' {COND} `a`.`name` LIKE '%s'", '%' . $filter['values'][0] . '%'); } break; // Quality // Quality case 'qu': if ($val_count == 1) { $filter_string .= sprintf(' {COND} `a`.`Quality` = %d', $filter['values'][0]); } else { $filter_string .= ' {COND} `a`.`Quality` IN ( '; self::ApplyMultiFiltersToString($val_count, $filter, $filter_string); } break; // Min item level // Min item level case 'minle': $filter_string .= sprintf(' {COND} `a`.`ItemLevel` >= %d', $filter['values'][0]); break; // Max item level // Max item level case 'maxle': $filter_string .= sprintf(' {COND} `a`.`ItemLevel` <= %d', $filter['values'][0]); break; // At least one? // At least one? case 'ma': if ($filter['values'][0] == 1) { $andOr = 2; } break; // Min req level // Min req level case 'minrl': $filter_string .= sprintf(' {COND} `a`.`RequiredLevel` >= %d', $filter['values'][0]); break; // Max req level // Max req level case 'maxrl': $filter_string .= sprintf(' {COND} `a`.`RequiredLevel` <= %d', $filter['values'][0]); break; // Slot // Slot case 'sl': if ($val_count == 1) { $filter_string .= sprintf(' {COND} `a`.`InventoryType` = %d', $filter['values'][0]); WoW_Template::SetPageData('breadcrumb', WoW_Template::GetPageData('breadcrumb') . ',' . $filter['values'][0]); } else { $filter_string .= ' {COND} `a`.`InventoryType` IN( '; self::ApplyMultiFiltersToString($val_count, $filter, $filter_string); } break; // Side // Side case 'si': switch ($filter['values'][0]) { case -1: // Alliance only $filter_string .= ' {COND} `a`.`AllowableRace` = ' . WoW_Utils::GetFactionBitMaskByFactionId(FACTION_ALLIANCE); break; case 1: // Alliance $filter_string .= ' {COND} `a`.`AllowableRace` & ' . WoW_Utils::GetFactionBitMaskByFactionId(FACTION_ALLIANCE); break; case -2: // Horde only $filter_string .= ' {COND} `a`.`AllowableRace` = ' . WoW_Utils::GetFactionBitMaskByFactionId(FACTION_HORDE); break; case 2: // Horde $filter_string .= ' {COND} `a`.`AllowableRace` & ' . WoW_Utils::GetFactionBitMaskByFactionId(FACTION_HORDE); break; default: // Skip "3" - useable by all break; } break; // Useable by class ID // Useable by class ID case 'ub': if (!($filter['values'][0] < CLASS_WARRIOR) && !($filter['values'][0] >= MAX_CLASSES)) { $filter_string .= ' {COND} `a`.`AllowableClass` & ' . WoW_Utils::GetClassBitMaskByClassId($filter['values'][0]); } break; } } } if (self::$m_items_class >= 0) { $filter_string .= sprintf(' {COND} `a`.`class` = %d', self::$m_items_class); } if (self::$m_items_subclass >= 0) { $filter_string .= sprintf(' {COND} `a`.`subclass` = %d', self::$m_items_subclass); } $filter_string = str_replace('{COND}', $andOr == 2 ? 'OR' : 'AND', $filter_string); $filter_string = substr($filter_string, 5); return $filter_string; }
public function main() { $url_data = WoW::GetUrlData('management'); if (!is_array($url_data) || !isset($url_data['action1']) || $url_data['action1'] != 'creation') { header('Location: ' . WoW::GetWoWPath() . '/account/creation/tos.html'); exit; } WoW_Template::SetTemplateTheme('account'); if ($url_data['action2'] == 'wow' && $url_data['action3'] == 'signup') { if (!WoW_Account::IsLoggedIn()) { header('Location: ' . WoW::GetWoWPath() . '/login/?ref=' . urlencode('http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'])); exit; } if (isset($_POST['emailAddress'])) { $account_data = array('username' => $_POST['emailAddress'], 'sha' => sha1(strtoupper($_POST['emailAddress']) . ':' . strtoupper($_POST['password']))); if (WoW_Account::RegisterGameAccount($account_data)) { header('Location: ' . WoW::GetWoWPath() . '/account/management/wow/dashboard.html?accountName=' . $account_data['username']); exit; } } WoW_Template::LoadTemplate('creation_wow'); exit; } if (preg_match('/tos.html/i', $url_data['action2'])) { WoW_Template::SetPageIndex('creation_tos'); WoW_Template::SetPageData('page', 'creation_tos'); if (isset($_POST['csrftoken'])) { $registration_allowed = true; $required_post_fields = array('firstname', 'lastname', array('emailAddress', 'emailAddressConfirmation'), array('password', 'rePassword'), 'gender', 'question1', 'answer1', 'dobDay', 'dobMonth', 'dobYear', 'country'); // Check POST fields foreach ($required_post_fields as $field) { if (is_array($field)) { if (!isset($_POST[$field[0]], $_POST[$field[1]])) { $registration_allowed = false; WoW_Template::SetPageData('account_creation_error_msg', WoW_Locale::GetString('template_account_creation_error_fields')); } if ($_POST[$field[0]] != $_POST[$field[1]] || empty($_POST[$field[0]]) || empty($_POST[$field[1]])) { $registration_allowed = false; WoW_Template::SetPageData('account_creation_error_msg', WoW_Locale::GetString('template_account_creation_error_fields')); } } else { if (!isset($_POST[$field]) || $_POST[$field] == null) { $registration_allowed = false; WoW_Template::SetPageData('account_creation_error_msg', WoW_Locale::GetString('template_account_creation_error_fields')); } } } if ($registration_allowed) { // Generate user data $user_data = array('first_name' => $_POST['firstname'], 'last_name' => $_POST['lastname'], 'password' => $_POST['password'], 'sha' => sha1(strtoupper($_POST['emailAddress']) . ':' . strtoupper($_POST['password'])), 'treatment' => $_POST['gender'], 'email' => $_POST['emailAddress'], 'question_id' => $_POST['question1'], 'question_answer' => $_POST['answer1'], 'birthdate' => strtotime(sprintf('%d.%d.%d', $_POST['dobDay'], $_POST['dobMonth'], $_POST['dobYear'])), 'country_code' => $_POST['country']); // And try to register new account if (WoW_Account::RegisterUser($user_data, true)) { // Account created, redirect user to manager index header('Location: ' . WoW::GetWoWPath() . '/account/management/'); exit; } } else { WoW_Template::SetPageData('creation_error', true); } } } WoW_Template::LoadTemplate('creation_index'); }
private static function LoadMounts() { if (!self::$m_spells) { self::LoadSpells(); } $category = WoW_Template::GetPageData('category'); if ($category == null) { $category = 'companion'; WoW_Template::SetPageData('category', $category); } $type = 0; switch ($category) { case 'mount': $type = 1; break; case 'companion': $type = 2; break; } if ($type == 0) { WoW_Log::WriteError('%s : unknown mount type (type: %d, category: %s)!', __METHOD__, $type, $category); return false; } self::$m_mounts = DB::WoW()->select("SELECT `spell`, `type`, `name_%s` AS `name`, `mount_type`, `icon`, `quality`, `npc_id`, `item_id`, `source`, `source_%s` AS `sourceText` FROM `DBPREFIX_mounts` WHERE `type` = %d ORDER BY `quality` DESC, `name_%s` ASC", WoW_Locale::GetLocale(), WoW_Locale::GetLocale(), $type, WoW_Locale::GetLocale()); }
public function main() { WoW_Template::SetPageData('body_class', WoW_Locale::GetLocale(LOCALE_DOUBLE)); WoW_Template::SetTemplateTheme('wow'); $url_data = WoW::GetUrlData('character'); if (!$url_data) { WoW_Template::SetPageIndex('404'); WoW_Template::SetPageData('page', '404'); WoW_Template::SetPageData('errorProfile', 'template_404'); } else { if ($url_data['action0'] == 'advanced') { // Set "wow.character.summary.view" cookie as "advanced" setcookie('wow.character.summary.view', 'advanced', strtotime('NEXT YEAR'), '/' . WoW::GetWoWPath() . '/character/'); } elseif ($url_data['action0'] == null && (isset($url_data['name']) && isset($url_data['realmName']))) { WoW::RedirectToCorrectProfilePage('simple'); //change to WoW::RedirectTo()? } elseif ($url_data['action0'] == 'simple') { // Set "wow.character.summary.view" cookie as "simple" setcookie('wow.character.summary.view', 'simple', strtotime('NEXT YEAR'), '/' . WoW::GetWoWPath() . '/character/'); } $load_result = WoW_Characters::LoadCharacter($url_data['name'], WoW_Utils::GetRealmIDByName($url_data['realmName']), true, true); if (!WoW_Characters::IsCorrect() || $load_result != 3) { if ($url_data['action0'] == 'tooltip') { exit; } if ($load_result == 2) { WoW_Template::SetPageData('errorProfile', 'template_lowlevel'); } else { WoW_Template::SetPageData('errorProfile', 'template_404'); } WoW_Template::SetPageIndex('404'); WoW_Template::SetPageData('page', '404'); } else { WoW_Achievements::Initialize(); WoW_Template::SetPageData('characterName', WoW_Characters::GetName()); WoW_Template::SetPageData('characterRealmName', WoW_Characters::GetRealmName()); switch ($url_data['action0']) { default: WoW_Template::SetPageIndex('character_profile_simple'); WoW_Template::SetPageData('page', 'character_profile'); WoW_Characters::CalculateStats(true); break; case 'advanced': WoW_Template::SetPageIndex('character_profile_advanced'); WoW_Template::SetPageData('page', 'character_profile'); WoW_Characters::CalculateStats(true); break; /* case 'talent': WoW_Template::SetPageIndex('character_talents'); WoW_Template::SetPageData('page', 'character_talents'); WoW_Template::SetPageData('talents', 'primary'); if($url_data['action1'] == 'secondary') { WoW_Template::SetPageData('talents', 'secondary'); } break; */ /* case 'talent': WoW_Template::SetPageIndex('character_talents'); WoW_Template::SetPageData('page', 'character_talents'); WoW_Template::SetPageData('talents', 'primary'); if($url_data['action1'] == 'secondary') { WoW_Template::SetPageData('talents', 'secondary'); } break; */ case 'tooltip': WoW_Template::LoadTemplate('page_character_tooltip'); exit; break; case 'achievement': for ($i = 2; $i > 0; $i--) { if (isset($url_data['action' . $i]) && $url_data['action' . $i] != null) { WoW_Achievements::SetCategoryForTemplate($url_data['action' . $i]); WoW_Template::LoadTemplate('page_character_achievements'); exit; } } WoW_Template::SetPageIndex('character_achievements'); WoW_Template::SetPageData('page', 'character_achievements'); break; case 'reputation': if (isset($url_data['action1']) && $url_data['action1'] == 'tabular') { WoW_Template::SetPageIndex('character_reputation_tabular'); } else { WoW_Template::SetPageIndex('character_reputation'); } WoW_Template::SetPageData('page', 'character_reputation'); WoW_Reputation::InitReputation(WoW_Characters::GetGUID()); break; case 'pvp': WoW_Template::SetPageIndex('character_pvp'); WoW_Template::SetPageData('page', 'character_pvp'); WoW_Characters::InitPvP(); break; case 'statistic': for ($i = 2; $i > 0; $i--) { if (isset($url_data['action' . $i]) && $url_data['action' . $i] != null) { WoW_Achievements::SetCategoryForTemplate($url_data['action' . $i]); WoW_Template::LoadTemplate('page_character_statistics'); exit; } } WoW_Template::SetPageIndex('character_statistics'); WoW_Template::SetPageData('page', 'character_statistics'); break; case 'feed': WoW_Template::SetPageIndex('character_feed'); WoW_Template::SetPageData('page', 'character_feed'); break; case 'companion': case 'mount': WoW_Template::SetPageIndex('character_companions_mounts'); WoW_Template::SetPageData('page', 'character_companions_mounts'); WoW_Template::SetPageData('category', $url_data['action0']); WoW_Characters::InitMounts(); break; } } } WoW_Template::SetMenuIndex('menu-game'); WoW_Template::LoadTemplate('page_index'); }