Ejemplo n.º 1
0
 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');
 }
Ejemplo n.º 2
0
    	<div class="page-comment-interior">
            <h3>
                <?php 
echo sprintf('%s (%d)', WoW_Locale::GetString('template_blog_comments'), WoW::GetBlogData('comments_count'));
?>
            </h3>
			<div class="comments-container">
	<script type="text/javascript">
		//<![CDATA[
			var textAreaFocused = false;
		//]]>
	</script>

<?php 
if (WoW_Account::IsLoggedIn()) {
    if (!WoW_Account::IsHaveActiveCharacter()) {
        echo WoW_Locale::GetString('template_characters_not_found');
    } else {
        WoW_Template::LoadTemplate('block_post_blog_reply_logged');
    }
} else {
    WoW_Template::LoadTemplate('block_post_blog_reply_not_logged');
}
$comments = WoW::GetBlogComments();
if (is_array($comments)) {
    $i = 0;
    foreach ($comments as $comment) {
        // Load char
        $character = DB::WoW()->selectRow("SELECT `guid`, `name`, `class`, `race`, `gender`, `level`, `realmName`, `url` FROM `DBPREFIX_user_characters` WHERE `guid` = %d AND `account` = %d AND `realmId` = %d", $comment['character_guid'], $comment['account'], $comment['realm_id']);
        if (!$character) {
            continue;
Ejemplo n.º 3
0
<!-- Start: Sidebar -->
<?php 
$sidebar_data = "'sotd', 'forums'";
if (WoW_Account::IsLoggedIn() && WoW_Account::IsHaveActiveCharacter()) {
    $sidebar_data = "'auctions','guild-news','friends','forums','sotd'";
    ?>

<div class="sidebar-module" id="sidebar-auctions">
    <div class="sidebar-title">
        <h3 class="title-auctions"><?php 
    echo WoW_Locale::GetString('template_auction_auction');
    ?>
</h3>
    </div>
    <div class="sidebar-content loading"></div>
</div>

<div class="sidebar-module" id="sidebar-guild-news">
    <div class="sidebar-title">
        <h3 class="title-guild-news"><?php 
    echo WoW_Locale::GetString('template_guild_news_sidebar');
    ?>
</h3>
    </div>
    <div class="sidebar-content loading"></div>
</div>

<div class="sidebar-module" id="sidebar-friends">
    <div class="sidebar-title">
        <h3 class="title-friends"><?php 
    echo WoW_Locale::GetString('template_character_friends_sidebar');
?>
          <span class="clear"><!-- --></span>
        </div>
      </div>
      <div class="talkback"><a id="new-post"></a>
        <form method="post" onsubmit="return Cms.Topic.postValidate(this);" action="#new-post">
    			<div>
            <input type="hidden" name="xstoken" value="fbc9d52f-99bf-4639-b2b5-7a535e7f31fe"/>
            <input type="hidden" name="sessionPersist" value="forum.topic.post"/>
            <div class="post ">
<?php 
if (WoW_Forums::IsClosedThread()) {
    echo sprintf('<table class="dynamic-center "><tr><td>%s</td></tr></table>', WoW_Locale::GetString('template_forum_topic_closed'));
} elseif (!WoW_Account::IsLoggedIn()) {
    echo sprintf('<table class="dynamic-center "><tr><td><a class="ui-button button1 " href="?login" onclick="return Login.open(\'%s/login/login.frag\')"><span><span>%s</span></span></a></td></tr></table>', WoW::GetWoWPath(), WoW_Locale::GetString('template_forum_add_reply'));
} elseif (WoW_Account::IsHaveActiveCharacter()) {
    WoW_Template::LoadTemplate('content_forum_new_post');
} else {
    echo sprintf('<table class="dynamic-center "><tr><td><div class="noCharacter"><p>%s</p></div></td></tr></table>', WoW_Locale::GetString('template_forum_need_char_to_post'));
}
?>

            </div>
    			</div>
        </form>
	      <span class="clear"><!-- --></span>
        <div class="talkback-code">
          <div class="talkback-code-interior">
            <div class="talkback-icon">
              <h4 class="code-header">Please report any Code of Conduct violations, including:</h4>
              <p>Threats of violence. <strong>We take these seriously and will alert the proper authorities.</strong></p>
 public static function EditPost($post_id, &$post_data)
 {
     if (WoW_Account::IsHaveActiveCharacter()) {
         $post_data['message'] = isset($post_data['postCommand_detail']) ? $post_data['postCommand_detail'] : $post_data['detail'];
         //self::BBCodesToHTML($post_data['message']);
         $thread_id = DB::WoW()->selectCell("SELECT `thread_id` FROM `DBPREFIX_forum_posts` WHERE `post_id` = %d LIMIT 1", $post_id);
         DB::WoW()->query("\n            UPDATE `DBPREFIX_forum_posts`\n            SET `character_guid` = %d,\n                `message` = '%s',\n                `edit_date` = NOW()\n            WHERE `post_id` = %d AND bn_id = %d", WoW_Account::GetActiveCharacterInfo('guid'), $post_data['message'], $post_id, WoW_Account::GetUserID());
         return $thread_id;
     } else {
         return false;
     }
 }
            }
        }
        echo '</tbody>';
    }
}
?>
    			</table>
        </div>
        <div class="forum-info">
          <div class="forum-actions topic-bottom">
        		<div class="actions-panel">
<?php 
echo WoW_Paginator::Initialize(WoW_Template::GetPageData('current_page'), WoW_Forums::GetTotalCategoryThreads(), 20, 'forum');
?>
          	  <a class="ui-button button1<?php 
echo WoW_Account::IsLoggedIn() && !WoW_Account::IsHaveActiveCharacter() ? ' disabled' : null;
?>
" href="topic"<?php 
echo !WoW_Account::IsLoggedIn() ? ' onclick="return Login.open(\'' . WoW::GetWoWPath() . '/login/login.frag\');"' : null;
?>
>
            		<span>
            			<span><?php 
echo WoW_Locale::GetString('template_forums_create_thread');
?>
</span>
            		</span>
            	</a>
        	    <span class="clear"><!-- --></span>
            </div>
          </div>