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() { if (!isset($_POST['index']) || !WoW_Account::IsLoggedIn()) { WoW_Template::ErrorPage(404); exit; } $character_index = $_POST['index']; DB::WoW()->query("UPDATE `DBPREFIX_user_characters` SET `isActive` = 0 WHERE `bn_id` = %d", WoW_Account::GetUserID()); // Clear all DB::WoW()->query("UPDATE `DBPREFIX_user_characters` SET `isActive` = 1 WHERE `index` = %d AND `bn_id` = %d", $character_index, WoW_Account::GetUserID()); }
private static function LoadAchievement() { // Load achievement self::$m_achievement = DB::World()->selectRow("\n SELECT\n a.*,\n b.parentCategory,\n c.icon\n FROM DBPREFIX_achievement AS a\n LEFT JOIN DBPREFIX_achievement_category AS b ON b.id = a.categoryId\n LEFT JOIN DBPREFIX_spell_icon AS c ON c.id = a.iconID\n WHERE a.id = %d", self::GetID()); if (!self::$m_achievement) { WoW_Template::ErrorPage(404, 'achievement'); return false; } // Load criterias (if exists) self::$m_achievement['criterias'] = DB::World()->select("SELECT * FROM DBPREFIX_achievement_criteria WHERE referredAchievement = %d", self::$m_achievement['id']); }
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() { if (!isset($this->m_actions['action3']) || !isset($this->m_actions['action4'])) { WoW_Template::ErrorPage(404); exit; } $ach_id = (int) $this->m_actions['action3']; $isTooltip = $this->m_actions['action4'] == 'tooltip' ? true : false; if (!$isTooltip || !$ach_id) { WoW_Template::ErrorPage(404); exit; } $ach = WoW_Achievements::GetAchievement($ach_id); header('Content-type: text/xml'); echo '<div class="wiki-tooltip"> <span class="icon-frame frame-56 " style=\'background-image: url("http://eu.media.blizzard.com/wow/icons/56/' . $ach['iconname'] . '.jpg");\'></span> <h3> <span class="float-right color-q0">' . $ach['points'] . ' очков</span>' . $ach['name'] . ' </h3> <span class="color-tooltip-yellow">' . $ach['desc'] . '</span> </div>'; }
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'); }
private static function LoadNPC() { self::$m_npc = DB::World()->selectRow("\n SELECT\n `a`.*,\n %s\n FROM `creature_template` AS `a`\n %s\n WHERE `a`.`entry` = %d", WoW_Locale::GetLocaleID() != LOCALE_EN ? '`b`.`name_loc' . WoW_Locale::GetLocaleID() . '` AS `name_loc`, `b`.`subname_loc' . WoW_Locale::GetLocaleID() . '` AS `subname_loc`' : 'NULL', WoW_Locale::GetLocaleID() != LOCALE_EN ? 'LEFT JOIN `locales_creature` AS `b` ON `b`.`entry` = `a`.`entry`' : null, self::GetID()); if (!self::$m_npc) { WoW_Template::ErrorPage(404, 'npc'); } }
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); }
public function main() { WoW_Template::ErrorPage(isset($_GET['code']) && in_array($_GET['code'], array(403, 404, 500)) ? $_GET['code'] : 404); }
private static function LoadItem() { self::$m_item = new WoW_ItemPrototype(); self::$m_item->LoadItem(self::GetID()); if (!self::$m_item->entry || self::$m_item->entry == 0) { WoW_Template::ErrorPage(404, 'item'); return false; } self::HandleItem(); }
private function LoadController() { if (!$this->m_controller) { WoW_Log::WriteError('%s : unable to detect controller name (type: %s)!', __METHOD__, $this->m_type); WoW_Template::ErrorPage(404); return false; } $this->m_allowErrorPage = true; switch (strtolower($this->m_controller)) { case 'marketing': case 'ta': case 'login_frag': case 'data': case 'discussion': case 'pref': $this->m_allowErrorPage = false; break; case 'item': if (isset($this->m_actions['action4']) && strtolower($this->m_actions['action4']) == 'tooltip') { $this->m_allowErrorPage = false; } break; } $controller_file = CONTROLLERS_DIR . $this->m_type . DS . $this->m_controller . '.php'; if (!file_exists($controller_file)) { if ($this->m_allowErrorPage) { WoW_Template::ErrorPage(404, null, $this->m_type == 'wow' ? false : true); } exit; } include $controller_file; if (!class_exists($this->m_controller, false)) { if ($this->m_allowErrorPage) { WoW_Template::ErrorPage(404); } exit; } $this->m_controller = new $this->m_controller($this->m_actions, $this->m_type); if (!is_object($this->m_controller) || !method_exists($this->m_controller, 'main')) { if ($this->m_allowErrorPage) { WoW_Template::ErrorPage(404, null, $this->m_type == 'wow' ? false : true); } exit; } // Run page $this->m_controller->main(); }