コード例 #1
0
    if ($flags & THREAD_FLAG_FEATURED) {
        $flag[] = WoW_Locale::GetString('template_forum_thread_featured');
    }
    if ($flags & THREAD_FLAG_PINNED) {
        $flag[] = WoW_Locale::GetString('template_forum_thread_sticky');
    }
    if ($flags & THREAD_FLAG_CLOSED) {
        $flag[] = WoW_Locale::GetString('template_forum_thread_closed');
    }
    if (isset($flag)) {
        echo '(' . implode(' ', $flag) . ')';
    }
}
?>
        <span class="sub-title"><?php 
echo WoW_Forums::GetThreadTitle();
?>
</span>
      </div>
      <div class="forum-actions top">
  		  <div class="actions-panel">
<?php 
echo WoW_Paginator::Initialize(WoW_Template::GetPageData('current_page'), WoW_Forums::GetTotalThreadPosts(), 20, 'forum');
?>
          <a class="ui-button button1<?php 
echo WoW_Forums::IsClosedThread() || !WoW_Account::IsHaveActiveCharacter() ? ' disabled' : null;
?>
" href="<?php 
echo WoW_Forums::IsClosedThread() || !WoW_Account::IsLoggedIn() ? ' javascript:;' : '#new-post';
?>
"<?php 
コード例 #2
0
ファイル: forum.php プロジェクト: JunkyBulgaria/WoWCS
 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');
 }
コード例 #3
0
 public static function NavigationMenu()
 {
     // Maybe breadcrumb content should be filled from appropriate page controller? // Shadez
     $navigationMenu[0] = WoW_Locale::$navigation;
     $url_data = WoW::GetUrlData();
     $path_data = NULL;
     $path_search_data = NULL;
     $last = false;
     $dynamic_content = false;
     switch ($url_data[1]) {
         case '/zone/':
             $dynamic_content = true;
             @($zone_info = WoW_Game::GetZone());
             $_data = array(0 => '/', 1 => '/game/', 2 => '/zone/', 3 => '/zone/#expansion=' . @$zone_info['expansion'] . '&type=' . @$zone_info['type'] . 's', 4 => '/zone/' . @$url_data[2], 5 => '/zone/' . @$url_data[2] . '/' . @$url_data[3]);
             for ($a = 0; $a <= count($url_data); ++$a) {
                 $path_search_data[$a] = $_data[$a];
             }
             if (isset($url_data[2])) {
                 $path_search_data[4] = $_data[4];
             }
             break;
         case '/faction/':
             $dynamic_content = true;
             /**
              *  WoW_Game::GetFaction() is not defined    
              *                           
              *  TODO
              *  Create function WoW_Game::GetFaction() with same rules as WoW_Game::GetZone()
              *  and edit wow_content_faction.php template to load datas from DB same as wow_content_zones.php template
              *  
              *  Create template and DB data to load and display each faction details.                              
              */
             //@$faction_info = WoW_Game::GetFaction();
             $_data = array(0 => '/', 1 => '/game/', 2 => '/faction/', 3 => '/faction/#expansion=' . @$faction_info['expansion'], 4 => '/faction/' . @$url_data[2]);
             for ($a = 0; $a <= count($url_data); ++$a) {
                 $path_search_data[$a] = $_data[$a];
             }
             if (isset($url_data[2])) {
                 $path_search_data[4] = $_data[4];
             }
             break;
         case '/item/':
             $dynamic_content = true;
             //WoW_Items::GetBreadCrumbsForItem($_GET) is NOT needed now
             if (isset($url_data[2])) {
                 $preg = preg_match('/\\/(\\?classId=([0-9]+)((&subClassId=([0-9]+))?(&invType=([0-9]+))?)?)|([0-9]+)\\/{0,1}/i', $url_data[2], $matches);
             }
             $_data = array(0 => '/', 1 => '/game/', 2 => '/item/', 3 => NULL, 4 => NULL, 5 => NULL);
             for ($a = 0; $a <= count($url_data); ++$a) {
                 $path_search_data[$a] = $_data[$a];
             }
             if (isset($matches) && array_key_exists(8, $matches)) {
                 $proto = new WoW_ItemPrototype();
                 $proto->LoadItem($matches[8]);
                 $matches[2] = $proto->class;
                 $matches[5] = $proto->subclass;
                 if ($matches[2] == 4 && in_array($matches[5], array(0, 1, 2, 3, 4))) {
                     $matches[7] = $proto->InventoryType;
                     $path_search_data[6] = '/item/' . $matches[8];
                     $label[6] = $proto->name;
                 } else {
                     unset($matches[7]);
                     $path_search_data[5] = '/item/' . $matches[8];
                     $label[5] = $proto->name;
                 }
             }
             if (isset($matches) && (array_key_exists(2, $matches) || array_key_exists(8, $matches))) {
                 $path_search_data[3] = '/item/?classId=' . $matches[2];
             }
             if (isset($matches) && (array_key_exists(5, $matches) || array_key_exists(8, $matches))) {
                 $path_search_data[4] = '/item/?classId=' . $matches[2] . '&subClassId=' . $matches[5];
             }
             if (isset($matches) && array_key_exists(7, $matches)) {
                 $path_search_data[5] = '/item/?classId=' . $matches[2] . '&subClassId=' . $matches[5] . '&invType=' . $matches[7];
             }
             break;
         case '/profession/':
             $dynamic_content = true;
             $_data = array(0 => '/', 1 => '/game/', 2 => '/profession/', 3 => '/profession/' . @$url_data[2]);
             for ($a = 0; $a <= count($url_data); ++$a) {
                 $path_search_data[$a] = $_data[$a];
             }
             break;
         case '/pvp/':
             $dynamic_content = true;
             $_data = array(0 => '/', 1 => '/game/', 2 => '/pvp/', 3 => '/pvp/' . @$url_data[2]);
             for ($a = 0; $a <= count($url_data); ++$a) {
                 $path_search_data[$a] = $_data[$a];
             }
             break;
         case '/status/':
             $dynamic_content = true;
             $_data = array(0 => '/', 1 => '/game/', 2 => '/status/', 3 => '/status/' . @$url_data[2]);
             for ($a = 0; $a <= count($url_data); ++$a) {
                 $path_search_data[$a] = $_data[$a];
             }
             break;
         case '/character/':
             $dynamic_content = true;
             $subdata4 = '';
             $data3 = '';
             $count = 0;
             @($url_data[3] = @urldecode($url_data[3]));
             if (isset($url_data[4])) {
                 if (in_array($url_data[4], array('/simple/', '/advanced/'))) {
                     $count = 2;
                     $subdata4 = @$url_data[4];
                 } elseif ($url_data[4] == '/achievement/') {
                     $count = 3;
                     $data3 = '/character/' . @$url_data[2] . @$url_data[3] . @$url_data[4];
                     $label[3] = WoW_Locale::GetString('template_profile_achievements');
                 } elseif ($url_data[4] == '/statistic/') {
                     $count = 3;
                     $data3 = '/character/' . @$url_data[2] . @$url_data[3] . @$url_data[4];
                     $label[3] = WoW_Locale::GetString('template_profile_statistics');
                 } elseif ($url_data[4] == '/reputation/') {
                     $count = 3;
                     $data3 = '/character/' . @$url_data[2] . @$url_data[3] . @$url_data[4];
                     $label[3] = WoW_Locale::GetString('template_profile_reputation');
                 } elseif ($url_data[4] == '/pvp/') {
                     $count = 3;
                     $data3 = '/character/' . @$url_data[2] . @$url_data[3] . @$url_data[4];
                     $label[3] = 'PvP';
                 } elseif ($url_data[4] == '/feed/') {
                     $count = 3;
                     $data3 = '/character/' . @$url_data[2] . @$url_data[3] . @$url_data[4];
                     $label[3] = WoW_Locale::GetString('template_profile_feed');
                 } elseif ($url_data[4] == '/mount/') {
                     $count = 3;
                     $data3 = '/character/' . @$url_data[2] . @$url_data[3] . @$url_data[4];
                     $label[3] = WoW_Locale::GetString('template_profile_mounts');
                 } elseif ($url_data[4] == '/companion/') {
                     $count = 3;
                     $data3 = '/character/' . @$url_data[2] . @$url_data[3] . @$url_data[4];
                     $label[3] = WoW_Locale::GetString('template_profile_companions');
                 }
             }
             $label[2] = str_replace(array('/', '+'), array('', ' '), @$url_data[3] . ' @ ' . @$url_data[2]);
             $_data = array(0 => '/', 1 => '/game/', 2 => '/character/' . @$url_data[2] . @$url_data[3] . $subdata4, 3 => $data3, 4 => NULL, 5 => NULL);
             for ($a = 0; $a <= $count; ++$a) {
                 $path_search_data[$a] = $_data[$a];
             }
             break;
         case '/blog/':
             $dynamic_content = true;
             $_data = array(0 => '/', 1 => '/blog/' . @$url_data[2]);
             $label[1] = WoW::GetBlogData('title');
             for ($a = 0; $a < count($_data); ++$a) {
                 $path_search_data[$a] = $_data[$a];
             }
             break;
         case '/forum/':
             $dynamic_content = true;
             $_data = array(0 => '/', 1 => '/forum/', 2 => '/forum/#forum' . WoW_Forums::GetGlobalCategoryId(), 3 => '/forum/' . WoW_Forums::GetCategoryId() . '/', 4 => '/forum/topic/' . WoW_Forums::GetThreadId() . '/', 5 => '/forum/topic/post/' . @$url_data[4] . '/edit', 6 => '/forum/topic/post/' . @$url_data[4] . '/delete', 7 => '/forum/blizztracker/');
             for ($a = 0; $a < count($url_data); ++$a) {
                 $path_search_data[$a] = $_data[$a];
             }
             if (isset($url_data[2]) && $url_data[2] != '/topic/') {
                 if (isset($url_data[2]) && $url_data[2] == '/blizztracker/') {
                     $path_search_data[2] = $_data[7];
                     $label[2] = WoW_Locale::GetString('template_blizztracker_title');
                     unset($path_search_data[3]);
                 } else {
                     $path_search_data[3] = $_data[3];
                 }
             }
             if (isset($url_data[2]) && $url_data[2] == '/topic/') {
                 if ($url_data[3] == '/post/') {
                     $path_search_data[3] = $_data[3];
                     $path_search_data[4] = $_data[5];
                     $label[4] = WoW_Forums::GetThreadTitle();
                     unset($path_search_data[5]);
                     unset($path_search_data[6]);
                 } else {
                     $path_search_data[3] = $_data[3];
                     $path_search_data[4] = $_data[4];
                     $label[4] = WoW_Forums::GetThreadTitle();
                 }
             }
             break;
         default:
             $path_search_data = $url_data;
             break;
     }
     /*
      * BUG!!! Need Rewritten and Reworked script...
      * Need This <span class="breadcrumb-arrow"></span>
      */
     echo '<ol class="ui-breadcrumb">';
     $path_data = '';
     for ($i = 0; $i < count($path_search_data); ++$i) {
         if ($i == count($path_search_data) - 1) {
             $last = true;
         }
         if ($dynamic_content) {
             $path_data = $path_search_data[$i];
         } else {
             $path_data .= $url_data[$i];
         }
         $path_data = str_replace('//', '/', $path_data);
         if (!isset($label[$i])) {
             $menu = self::array_searchRecursive($path_data, $navigationMenu);
         } else {
             $menu['label'] = $label[$i];
         }
         echo '<li' . ($last == true ? ' class="last"' : null) . '><a href="' . WoW::GetWoWPath() . '/wow/' . WoW_Locale::GetLocale() . $path_data . '" rel="np">' . $menu['label'] . '</a></li>';
     }
     echo '</ol>';
 }