* @author Slawkens * @copyright 2017 MyAAC * @link http://my-aac.org */ defined('MYAAC') or die('Direct access not allowed!'); $links_to_pages = ''; $thread_id = (int) $_REQUEST['id']; $_page = (int) (isset($_REQUEST['page']) ? $_REQUEST['page'] : 0); $thread_name = $db->query("SELECT `players`.`name`, `" . TABLE_PREFIX . "forum`.`post_topic`, `" . TABLE_PREFIX . "forum`.`section` FROM `players`, `" . TABLE_PREFIX . "forum` WHERE `" . TABLE_PREFIX . "forum`.`first_post` = ".(int) $thread_id." AND `" . TABLE_PREFIX . "forum`.`id` = `" . TABLE_PREFIX . "forum`.`first_post` AND `players`.`id` = `" . TABLE_PREFIX . "forum`.`author_guid` LIMIT 1")->fetch(); if(empty($thread_name['name'])) { echo 'Thread with this ID does not exits.'; return; } if(!Forum::hasAccess($thread_name['section'])) { echo "You don't have access to view this thread."; return; } $posts_count = $db->query("SELECT COUNT(`" . TABLE_PREFIX . "forum`.`id`) AS posts_count FROM `players`, `" . TABLE_PREFIX . "forum` WHERE `players`.`id` = `" . TABLE_PREFIX . "forum`.`author_guid` AND `" . TABLE_PREFIX . "forum`.`first_post` = ".(int) $thread_id)->fetch(); for($i = 0; $i < $posts_count['posts_count'] / $config['forum_threads_per_page']; $i++) { if($i != $_page) $links_to_pages .= ''.($i + 1).' '; else $links_to_pages .= ''.($i + 1).' '; } $threads = $db->query("SELECT `players`.`id` as `player_id`, `players`.`name`, `players`.`account_id`, `players`.`vocation`" . (fieldExist('promotion', 'players') ? ", `players`.`promotion`" : "") . ", `players`.`level`, `" . TABLE_PREFIX . "forum`.`id`,`" . TABLE_PREFIX . "forum`.`first_post`, `" . TABLE_PREFIX . "forum`.`section`,`" . TABLE_PREFIX . "forum`.`post_text`, `" . TABLE_PREFIX . "forum`.`post_topic`, `" . TABLE_PREFIX . "forum`.`post_date`, `" . TABLE_PREFIX . "forum`.`post_smile`, `" . TABLE_PREFIX . "forum`.`author_aid`, `" . TABLE_PREFIX . "forum`.`author_guid`, `" . TABLE_PREFIX . "forum`.`last_edit_aid`, `" . TABLE_PREFIX . "forum`.`edit_date` FROM `players`, `" . TABLE_PREFIX . "forum` WHERE `players`.`id` = `" . TABLE_PREFIX . "forum`.`author_guid` AND `" . TABLE_PREFIX . "forum`.`first_post` = ".(int) $thread_id." ORDER BY `" . TABLE_PREFIX . "forum`.`post_date` LIMIT ".$config['forum_posts_per_page']." OFFSET ".($_page * $config['forum_posts_per_page']))->fetchAll(); if(isset($threads[0]['name'])) $db->query("UPDATE `" . TABLE_PREFIX . "forum` SET `views`=`views`+1 WHERE `id` = ".(int) $thread_id); echo 'Boards >> '.$sections[$threads[0]['section']]['name'].' >> '.$thread_name['post_topic'].''; echo '



Page: '.$links_to_pages.'
'; $player = $ots->createObject('Player'); foreach($threads as $thread) { $player->load($thread['player_id']); if(!$player->isLoaded()) { error('Forum error: Player not loaded.'); die(); } echo ''; } echo '
'.htmlspecialchars($thread_name['post_topic']).'
by ' . getPlayerLink($thread_name['name']) . '
Author 
' . getPlayerLink($thread['name']) . '

Profession: '.$config['vocations'][$player->getVocation()].'
Level: '.$thread['level'].'
'; $rank = $player->getRank(); if($rank->isLoaded()) { $guild = $rank->getGuild(); if($guild->isLoaded()) echo $rank->getName().' of '.$guild->getName().'
'; } $player_account = $player->getAccount(); $canEditForum = $player_account->hasFlag(FLAG_CONTENT_FORUM) || $player_account->isAdmin(); $posts = $db->query("SELECT COUNT(`id`) AS 'posts' FROM `" . TABLE_PREFIX . "forum` WHERE `author_aid`=".(int) $thread['account_id'])->fetch(); echo '
Posts: '.(int) $posts['posts'].'
'.Forum::showPost(($canEditForum ? $thread['post_topic'] : htmlspecialchars($thread['post_topic'])), ($canEditForum ? $thread['post_text'] : htmlspecialchars($thread['post_text'])), $thread['post_smile']).'
'.date('d.m.y H:i:s', $thread['post_date']); if($thread['edit_date'] > 0) { if($thread['last_edit_aid'] != $thread['author_aid']) echo '
Edited by moderator'; else echo '
Edited by '.$thread['name']; echo '
on '.date('d.m.y H:i:s', $thread['edit_date']); } echo '
'; if(Forum::isModerator()) if($thread['first_post'] != $thread['id']) echo 'REMOVE POST'; else { echo '[MOVE]'; echo '
REMOVE THREAD'; } if($logged && ($thread['account_id'] == $account_logged->getId() || Forum::isModerator())) echo '
EDIT POST'; if($logged) echo '
Quote'; echo '

'; ?>