mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-27 01:39:22 +02:00
* moved forum actions (pages) to forum/ directory
* fixed account actions
This commit is contained in:
parent
1727df7082
commit
cb83e17710
@ -124,7 +124,7 @@ $errors = array();
|
|||||||
'players' => $account_players
|
'players' => $account_players
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
else if(file_exists(PAGES . 'account/' . $action)) {
|
else if(file_exists(PAGES . 'account/' . $action . '.php')) {
|
||||||
require(PAGES . 'account/' . $action . '.php');
|
require(PAGES . 'account/' . $action . '.php');
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -240,144 +240,10 @@ if(empty($action))
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$links_to_pages = '';
|
|
||||||
if($action == 'show_board')
|
|
||||||
{
|
|
||||||
$section_id = (int) $_REQUEST['id'];
|
|
||||||
$_page = (int) (isset($_REQUEST['page']) ? $_REQUEST['page'] : 0);
|
|
||||||
$threads_count = $db->query("SELECT COUNT(`" . TABLE_PREFIX . "forum`.`id`) AS threads_count FROM `players`, `" . TABLE_PREFIX . "forum` WHERE `players`.`id` = `" . TABLE_PREFIX . "forum`.`author_guid` AND `" . TABLE_PREFIX . "forum`.`section` = ".(int) $section_id." AND `" . TABLE_PREFIX . "forum`.`first_post` = `" . TABLE_PREFIX . "forum`.`id`")->fetch();
|
|
||||||
for($i = 0; $i < $threads_count['threads_count'] / $config['forum_threads_per_page']; $i++)
|
|
||||||
{
|
|
||||||
if($i != $_page)
|
|
||||||
$links_to_pages .= '<a href="' . getForumBoardLink($section_id, $i) . '">'.($i + 1).'</a> ';
|
|
||||||
else
|
|
||||||
$links_to_pages .= '<b>'.($i + 1).' </b>';
|
|
||||||
}
|
|
||||||
echo '<a href="' . getLink('forum') . '">Boards</a> >> <b>'.$sections[$section_id]['name'].'</b>';
|
|
||||||
if(!$sections[$section_id]['closed'] || Forum::isModerator())
|
|
||||||
{
|
|
||||||
echo '<br /><br />
|
|
||||||
<a href="?subtopic=forum&action=new_thread§ion_id='.$section_id.'"><img src="images/forum/topic.gif" border="0" /></a>';
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '<br /><br />Page: '.$links_to_pages.'<br />';
|
if($action == 'show_board' || $action == 'show_thread')
|
||||||
$last_threads = $db->query("SELECT `players`.`id` as `player_id`, `players`.`name`, `" . TABLE_PREFIX . "forum`.`post_text`, `" . TABLE_PREFIX . "forum`.`post_topic`, `" . TABLE_PREFIX . "forum`.`id`, `" . TABLE_PREFIX . "forum`.`last_post`, `" . TABLE_PREFIX . "forum`.`replies`, `" . TABLE_PREFIX . "forum`.`views`, `" . TABLE_PREFIX . "forum`.`post_date` FROM `players`, `" . TABLE_PREFIX . "forum` WHERE `players`.`id` = `" . TABLE_PREFIX . "forum`.`author_guid` AND `" . TABLE_PREFIX . "forum`.`section` = ".(int) $section_id." AND `" . TABLE_PREFIX . "forum`.`first_post` = `" . TABLE_PREFIX . "forum`.`id` ORDER BY `" . TABLE_PREFIX . "forum`.`last_post` DESC LIMIT ".$config['forum_threads_per_page']." OFFSET ".($_page * $config['forum_threads_per_page']))->fetchAll();
|
|
||||||
if(isset($last_threads[0]))
|
|
||||||
{
|
{
|
||||||
echo '<table width="100%"><tr bgcolor="'.$config['vdarkborder'].'" align="center"><td><font color="white" size="1"><b>Thread</b></font></td><td><font color="white" size="1"><b>Thread Starter</b></font></td><td><font color="white" size="1"><b>Replies</b></font></td><td><font color="white" size="1"><b>Views</b></font></td><td><font color="white" size="1"><b>Last Post</b></font></td></tr>';
|
require(PAGES . 'forum/' . $action . '.php');
|
||||||
|
|
||||||
$player = new OTS_Player();
|
|
||||||
foreach($last_threads as $thread)
|
|
||||||
{
|
|
||||||
echo '<tr bgcolor="' . getStyle($number_of_rows++) . '"><td>';
|
|
||||||
if(Forum::isModerator())
|
|
||||||
{
|
|
||||||
echo '<a href="?subtopic=forum&action=move_thread&id='.$thread['id'].'"\')"><span style="color:darkgreen">[MOVE]</span></a>';
|
|
||||||
echo '<a href="?subtopic=forum&action=remove_post&id='.$thread['id'].'" onclick="return confirm(\'Are you sure you want remove thread > '.$thread['post_topic'].' <?\')"><font color="red">[REMOVE]</font></a> ';
|
|
||||||
}
|
|
||||||
|
|
||||||
$player->load($thread['player_id']);
|
|
||||||
if(!$player->isLoaded()) {
|
|
||||||
error('Forum error: Player not loaded.');
|
|
||||||
die();
|
|
||||||
}
|
|
||||||
|
|
||||||
$player_account = $player->getAccount();
|
|
||||||
$canEditForum = $player_account->hasFlag(FLAG_CONTENT_FORUM) || $player_account->isAdmin();
|
|
||||||
|
|
||||||
echo '<a href="' . getForumThreadLink($thread['id']) . '">'.($canEditForum ? $thread['post_topic'] : htmlspecialchars($thread['post_topic'])) . '</a><br /><small>'.($canEditForum ? substr(strip_tags($thread['post_text']), 0, 50) : htmlspecialchars(substr($thread['post_text'], 0, 50))).'...</small></td><td>' . getPlayerLink($thread['name']) . '</td><td>'.(int) $thread['replies'].'</td><td>'.(int) $thread['views'].'</td><td>';
|
|
||||||
if($thread['last_post'] > 0)
|
|
||||||
{
|
|
||||||
$last_post = $db->query("SELECT `players`.`name`, `" . TABLE_PREFIX . "forum`.`post_date` FROM `players`, `" . TABLE_PREFIX . "forum` WHERE `" . TABLE_PREFIX . "forum`.`first_post` = ".(int) $thread['id']." AND `players`.`id` = `" . TABLE_PREFIX . "forum`.`author_guid` ORDER BY `post_date` DESC LIMIT 1")->fetch();
|
|
||||||
if(isset($last_post['name']))
|
|
||||||
echo date('d.m.y H:i:s', $last_post['post_date']).'<br />by ' . getPlayerLink($last_post['name']);
|
|
||||||
else
|
|
||||||
echo 'No posts.';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
echo date('d.m.y H:i:s', $thread['post_date']).'<br />by ' . getPlayerLink($thread['name']);
|
|
||||||
echo '</td></tr>';
|
|
||||||
}
|
|
||||||
echo '</table>';
|
|
||||||
if(!$sections[$section_id]['closed'] || Forum::isModerator())
|
|
||||||
echo '<br /><a href="?subtopic=forum&action=new_thread§ion_id='.$section_id.'"><img src="images/forum/topic.gif" border="0" /></a>';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
echo '<h3>No threads in this board.</h3>';
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if($action == 'show_thread')
|
|
||||||
{
|
|
||||||
$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` 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']))
|
|
||||||
{
|
|
||||||
$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 .= '<a href="' . getForumThreadLink($thread_id, $i) . '">'.($i + 1).'</a> ';
|
|
||||||
else
|
|
||||||
$links_to_pages .= '<b>'.($i + 1).' </b>';
|
|
||||||
}
|
|
||||||
$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 '<a href="' . getLink('forum') . '">Boards</a> >> <a href="' . getForumBoardLink($threads[0]['section']) . '">'.$sections[$threads[0]['section']]['name'].'</a> >> <b>'.$thread_name['post_topic'].'</b>';
|
|
||||||
echo '<br /><br /><a href="?subtopic=forum&action=new_post&thread_id='.$thread_id.'"><img src="images/forum/post.gif" border="0" /></a><br /><br />Page: '.$links_to_pages.'<br /><table width="100%"><tr bgcolor="'.$config['lightborder'].'" width="100%"><td colspan="2"><font size="4"><b>'.htmlspecialchars($thread_name['post_topic']).'</b></font><font size="1"><br />by ' . getPlayerLink($thread_name['name']) . '</font></td></tr><tr bgcolor="'.$config['vdarkborder'].'"><td width="200"><font color="white" size="1"><b>Author</b></font></td><td> </td></tr>';
|
|
||||||
$player = $ots->createObject('Player');
|
|
||||||
foreach($threads as $thread)
|
|
||||||
{
|
|
||||||
$player->load($thread['player_id']);
|
|
||||||
if(!$player->isLoaded()) {
|
|
||||||
error('Forum error: Player not loaded.');
|
|
||||||
die();
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '<tr bgcolor="' . getStyle($number_of_rows++) . '"><td valign="top">' . getPlayerLink($thread['name']) . '<br /><br /><font size="1">Profession: '.$config['vocations'][$player->getVocation()].'<br />Level: '.$thread['level'].'<br />';
|
|
||||||
|
|
||||||
$rank = $player->getRank();
|
|
||||||
if($rank->isLoaded())
|
|
||||||
{
|
|
||||||
$guild = $rank->getGuild();
|
|
||||||
if($guild->isLoaded())
|
|
||||||
echo $rank->getName().' of <a href="'.getGuildLink($guild->getName(), false).'">'.$guild->getName().'</a><br />';
|
|
||||||
}
|
|
||||||
$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 '<br />Posts: '.(int) $posts['posts'].'<br /></font></td><td valign="top">'.showPost(($canEditForum ? $thread['post_topic'] : htmlspecialchars($thread['post_topic'])), ($canEditForum ? $thread['post_text'] : htmlspecialchars($thread['post_text'])), $thread['post_smile']).'</td></tr>
|
|
||||||
<tr bgcolor="'.getStyle($number_of_rows++).'"><td><font size="1">'.date('d.m.y H:i:s', $thread['post_date']);
|
|
||||||
if($thread['edit_date'] > 0)
|
|
||||||
{
|
|
||||||
if($thread['last_edit_aid'] != $thread['author_aid'])
|
|
||||||
echo '<br />Edited by moderator';
|
|
||||||
else
|
|
||||||
echo '<br />Edited by '.$thread['name'];
|
|
||||||
echo '<br />on '.date('d.m.y H:i:s', $thread['edit_date']);
|
|
||||||
}
|
|
||||||
echo '</font></td><td>';
|
|
||||||
if(Forum::isModerator())
|
|
||||||
if($thread['first_post'] != $thread['id'])
|
|
||||||
echo '<a href="?subtopic=forum&action=remove_post&id='.$thread['id'].'" onclick="return confirm(\'Are you sure you want remove post of '.$thread['name'].'?\')"><font color="red">REMOVE POST</font></a>';
|
|
||||||
else
|
|
||||||
{
|
|
||||||
echo '<a href="?subtopic=forum&action=move_thread&id='.$thread['id'].'"\')"><span style="color:darkgreen">[MOVE]</span></a>';
|
|
||||||
echo '<br/><a href="?subtopic=forum&action=remove_post&id='.$thread['id'].'" onclick="return confirm(\'Are you sure you want remove thread > '.$thread['post_topic'].' <?\')"><font color="red">REMOVE THREAD</font></a>';
|
|
||||||
}
|
|
||||||
if($logged && ($thread['account_id'] == $account_logged->getId() || Forum::isModerator()))
|
|
||||||
echo '<br/><a href="?subtopic=forum&action=edit_post&id='.$thread['id'].'">EDIT POST</a>';
|
|
||||||
if($logged)
|
|
||||||
echo '<br/><a href="?subtopic=forum&action=new_post&thread_id='.$thread_id.'"e='.$thread['id'].'">Quote</a>';
|
|
||||||
echo '</td></tr>';
|
|
||||||
}
|
|
||||||
echo '</table><br /><a href="?subtopic=forum&action=new_post&thread_id='.$thread_id.'"><img src="images/forum/post.gif" border="0" /></a>';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
echo 'Thread with this ID does not exits.';
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -387,387 +253,8 @@ if(!$logged)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($action == 'remove_post')
|
if(file_exists(PAGES . 'forum/' . $action . '.php')) {
|
||||||
{
|
require(PAGES . 'forum/' . $action . '.php');
|
||||||
if(Forum::isModerator())
|
|
||||||
{
|
|
||||||
$id = (int) $_REQUEST['id'];
|
|
||||||
$post = $db->query("SELECT `id`, `first_post`, `section` FROM `" . TABLE_PREFIX . "forum` WHERE `id` = ".$id." LIMIT 1")->fetch();
|
|
||||||
if($post['id'] == $id)
|
|
||||||
{
|
|
||||||
if($post['id'] == $post['first_post'])
|
|
||||||
{
|
|
||||||
$db->query("DELETE FROM `" . TABLE_PREFIX . "forum` WHERE `first_post` = ".$post['id']);
|
|
||||||
header('Location: ' . getForumBoardLink($post['section']));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$post_page = $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`.`id` < ".$id." AND `" . TABLE_PREFIX . "forum`.`first_post` = ".(int) $post['first_post'])->fetch();
|
|
||||||
$_page = (int) ceil($post_page['posts_count'] / $config['forum_threads_per_page']) - 1;
|
|
||||||
$db->query("DELETE FROM `" . TABLE_PREFIX . "forum` WHERE `id` = ".$post['id']);
|
|
||||||
header('Location: ' . getForumThreadLink($post['first_post'], (int) $_page));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
echo 'Post with ID ' . $id . ' does not exist.';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
echo 'You are not logged in or you are not moderator.';
|
|
||||||
}
|
|
||||||
if($action == 'new_post')
|
|
||||||
{
|
|
||||||
if(Forum::canPost($account_logged))
|
|
||||||
{
|
|
||||||
$players_from_account = $db->query("SELECT `players`.`name`, `players`.`id` FROM `players` WHERE `players`.`account_id` = ".(int) $account_logged->getId())->fetchAll();
|
|
||||||
$thread_id = (int) $_REQUEST['thread_id'];
|
|
||||||
$thread = $db->query("SELECT `" . TABLE_PREFIX . "forum`.`post_topic`, `" . TABLE_PREFIX . "forum`.`id`, `" . TABLE_PREFIX . "forum`.`section` FROM `" . TABLE_PREFIX . "forum` WHERE `" . TABLE_PREFIX . "forum`.`id` = ".(int) $thread_id." AND `" . TABLE_PREFIX . "forum`.`first_post` = ".(int) $thread_id." LIMIT 1")->fetch();
|
|
||||||
echo '<a href="' . getLink('forum') . '">Boards</a> >> <a href="' . getForumBoardLink($thread['section']) . '">'.$sections[$thread['section']]['name'].'</a> >> <a href="' . getForumThreadLink($thread_id) . '">'.$thread['post_topic'].'</a> >> <b>Post new reply</b><br /><h3>'.$thread['post_topic'].'</h3>';
|
|
||||||
if(isset($thread['id']))
|
|
||||||
{
|
|
||||||
$quote = isset($_REQUEST['quote']) ? (int) $_REQUEST['quote'] : NULL;
|
|
||||||
$text = isset($_REQUEST['text']) ? stripslashes(trim($_REQUEST['text'])) : NULL;
|
|
||||||
$char_id = (int) (isset($_REQUEST['char_id']) ? $_REQUEST['char_id'] : 0);
|
|
||||||
$post_topic = isset($_REQUEST['topic']) ? stripslashes(trim($_REQUEST['topic'])) : '';
|
|
||||||
$smile = (int) (isset($_REQUEST['smile']) ? $_REQUEST['smile'] : 0);
|
|
||||||
$saved = false;
|
|
||||||
if(isset($_REQUEST['quote']))
|
|
||||||
{
|
|
||||||
$quoted_post = $db->query("SELECT `players`.`name`, `" . TABLE_PREFIX . "forum`.`post_text`, `" . TABLE_PREFIX . "forum`.`post_date` FROM `players`, `" . TABLE_PREFIX . "forum` WHERE `players`.`id` = `" . TABLE_PREFIX . "forum`.`author_guid` AND `" . TABLE_PREFIX . "forum`.`id` = ".(int) $quote)->fetchAll();
|
|
||||||
if(isset($quoted_post[0]['name']))
|
|
||||||
$text = '[i]Originally posted by '.$quoted_post[0]['name'].' on '.date('d.m.y H:i:s', $quoted_post[0]['post_date']).':[/i][quote]'.$quoted_post[0]['post_text'].'[/quote]';
|
|
||||||
}
|
|
||||||
elseif(isset($_REQUEST['save']))
|
|
||||||
{
|
|
||||||
$lenght = 0;
|
|
||||||
for($i = 0; $i < strlen($text); $i++)
|
|
||||||
{
|
|
||||||
if(ord($text[$i]) >= 33 && ord($text[$i]) <= 126)
|
|
||||||
$lenght++;
|
|
||||||
}
|
|
||||||
if($lenght < 1 || strlen($text) > 15000)
|
|
||||||
$errors[] = 'Too short or too long post (short: '.$lenght.' long: '.strlen($text).' letters). Minimum 1 letter, maximum 15000 letters.';
|
|
||||||
if($char_id == 0)
|
|
||||||
$errors[] = 'Please select a character.';
|
|
||||||
$player_on_account = false;
|
|
||||||
if(count($errors) == 0)
|
|
||||||
{
|
|
||||||
foreach($players_from_account as $player)
|
|
||||||
if($char_id == $player['id'])
|
|
||||||
$player_on_account = true;
|
|
||||||
if(!$player_on_account)
|
|
||||||
$errors[] = 'Player with selected ID '.$char_id.' doesn\'t exist or isn\'t on your account';
|
|
||||||
}
|
|
||||||
if(count($errors) == 0)
|
|
||||||
{
|
|
||||||
$last_post = 0;
|
|
||||||
$query = $db->query('SELECT post_date FROM ' . TABLE_PREFIX . 'forum ORDER BY post_date DESC LIMIT 1');
|
|
||||||
if($query->rowCount() > 0)
|
|
||||||
{
|
|
||||||
$query = $query->fetch();
|
|
||||||
$last_post = $query['post_date'];
|
|
||||||
}
|
|
||||||
if($last_post+$config['forum_post_interval']-time() > 0 && !Forum::isModerator())
|
|
||||||
$errors[] = 'You can post one time per '.$config['forum_post_interval'].' seconds. Next post after '.($last_post+$config['forum_post_interval']-time()).' second(s).';
|
|
||||||
}
|
|
||||||
if(count($errors) == 0)
|
|
||||||
{
|
|
||||||
$saved = true;
|
|
||||||
$db->query("INSERT INTO `" . TABLE_PREFIX . "forum` (`id` ,`first_post` ,`last_post` ,`section` ,`replies` ,`views` ,`author_aid` ,`author_guid` ,`post_text` ,`post_topic` ,`post_smile` ,`post_date` ,`last_edit_aid` ,`edit_date`, `post_ip`) VALUES (NULL, '".$thread['id']."', '0', '".$thread['section']."', '0', '0', '".$account_logged->getId()."', '".(int) $char_id."', ".$db->quote($text).", ".$db->quote($post_topic).", '".(int) $smile."', '".time()."', '0', '0', '".$_SERVER['REMOTE_ADDR']."')");
|
|
||||||
$db->query("UPDATE `" . TABLE_PREFIX . "forum` SET `replies`=`replies`+1, `last_post`=".time()." WHERE `id` = ".(int) $thread_id);
|
|
||||||
$post_page = $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`.`post_date` <= ".time()." AND `" . TABLE_PREFIX . "forum`.`first_post` = ".(int) $thread['id'])->fetch();
|
|
||||||
$_page = (int) ceil($post_page['posts_count'] / $config['forum_threads_per_page']) - 1;
|
|
||||||
header('Location: ' . getForumThreadLink($thread_id, $_page));
|
|
||||||
echo '<br />Thank you for posting.<br /><a href="' . getForumThreadLink($thread_id, $_page) . '">GO BACK TO LAST THREAD</a>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(!$saved)
|
|
||||||
{
|
|
||||||
if(!empty($errors))
|
|
||||||
echo $twig->render('error_box.html.twig', array('errors' => $errors));
|
|
||||||
|
|
||||||
echo '<form action="?" method="POST">
|
|
||||||
<input type="hidden" name="action" value="new_post" />
|
|
||||||
<input type="hidden" name="thread_id" value="'.$thread_id.'" />
|
|
||||||
<input type="hidden" name="subtopic" value="forum" />
|
|
||||||
<input type="hidden" name="save" value="save" />
|
|
||||||
<table width="100%">
|
|
||||||
<tr bgcolor="'.$config['vdarkborder'].'">
|
|
||||||
<td colspan="2"><font color="white"><b>Post New Reply</b></font></td>
|
|
||||||
</tr>
|
|
||||||
<tr bgcolor="'.$config['darkborder'].'">
|
|
||||||
<td width="180"><b>Character:</b></td>
|
|
||||||
<td>
|
|
||||||
<select name="char_id">
|
|
||||||
<option value="0">(Choose character)</option>';
|
|
||||||
foreach($players_from_account as $player)
|
|
||||||
{
|
|
||||||
echo '<option value="'.$player['id'].'"';
|
|
||||||
if($player['id'] == $char_id)
|
|
||||||
echo ' selected="selected"';
|
|
||||||
echo '>'.$player['name'].'</option>';
|
|
||||||
}
|
|
||||||
echo '</select></td></tr><tr bgcolor="'.$config['lightborder'].'"><td><b>Topic:</b></td><td><input type="text" name="topic" value="'.htmlspecialchars($post_topic).'" size="40" maxlength="60" /> (Optional)</td></tr>
|
|
||||||
<tr bgcolor="'.$config['darkborder'].'"><td valign="top"><b>Message:</b><font size="1"><br />You can use:<br />[player]Nick[/player]<br />[url]http://address.com/[/url]<br />[img]http://images.com/images3.gif[/img]<br />[code]Code[/code]<br />[b]<b>Text</b>[/b]<br />[i]<i>Text</i>[/i]<br />[u]<u>Text</u>[/u]<br />and smileys:<br />;) , :) , :D , :( , :rolleyes:<br />:cool: , :eek: , :o , :p</font></td><td><textarea rows="10" cols="60" name="text">'.htmlspecialchars($text).'</textarea><br />(Max. 15,000 letters)</td></tr>
|
|
||||||
<tr bgcolor="'.$config['lightborder'].'"><td valign="top">Options:</td><td><label><input type="checkbox" name="smile" value="1"';
|
|
||||||
if($smile == 1)
|
|
||||||
echo ' checked="checked"';
|
|
||||||
echo '/>Disable Smileys in This Post </label></td></tr></table><center><input type="submit" value="Post Reply" /></center></form>';
|
|
||||||
$threads = $db->query("SELECT `players`.`name`, `" . TABLE_PREFIX . "forum`.`post_text`, `" . TABLE_PREFIX . "forum`.`post_topic`, `" . TABLE_PREFIX . "forum`.`post_smile` 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` DESC LIMIT 10")->fetchAll();
|
|
||||||
echo '<table width="100%"><tr bgcolor="'.$config['vdarkborder'].'"><td colspan="2"><font color="white"><b>Last 5 posts from thread: '.$thread['post_topic'].'</b></font></td></tr>';
|
|
||||||
foreach($threads as $thread)
|
|
||||||
{
|
|
||||||
echo '<tr bgcolor="' . getStyle($number_of_rows++) . '"><td>'.$thread['name'].'</td><td>'.showPost($thread['post_topic'], $thread['post_text'], $thread['post_smile']).'</td></tr>';
|
|
||||||
}
|
|
||||||
echo '</table>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
echo 'Thread with ID '.$thread_id.' doesn\'t exist.';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
echo "Your account is banned, deleted or you don't have any player with level " . $config['forum_level_required'] . " on your account. You can't post.";
|
|
||||||
}
|
|
||||||
|
|
||||||
if($action == 'edit_post')
|
|
||||||
{
|
|
||||||
if(Forum::canPost($account_logged))
|
|
||||||
{
|
|
||||||
$post_id = (int) $_REQUEST['id'];
|
|
||||||
$thread = $db->query("SELECT `" . TABLE_PREFIX . "forum`.`author_guid`, `" . TABLE_PREFIX . "forum`.`author_aid`, `" . TABLE_PREFIX . "forum`.`first_post`, `" . TABLE_PREFIX . "forum`.`post_topic`, `" . TABLE_PREFIX . "forum`.`post_date`, `" . TABLE_PREFIX . "forum`.`post_text`, `" . TABLE_PREFIX . "forum`.`post_smile`, `" . TABLE_PREFIX . "forum`.`id`, `" . TABLE_PREFIX . "forum`.`section` FROM `" . TABLE_PREFIX . "forum` WHERE `" . TABLE_PREFIX . "forum`.`id` = ".(int) $post_id." LIMIT 1")->fetch();
|
|
||||||
if(isset($thread['id']))
|
|
||||||
{
|
|
||||||
$first_post = $db->query("SELECT `" . TABLE_PREFIX . "forum`.`author_guid`, `" . TABLE_PREFIX . "forum`.`author_aid`, `" . TABLE_PREFIX . "forum`.`first_post`, `" . TABLE_PREFIX . "forum`.`post_topic`, `" . TABLE_PREFIX . "forum`.`post_text`, `" . TABLE_PREFIX . "forum`.`post_smile`, `" . TABLE_PREFIX . "forum`.`id`, `" . TABLE_PREFIX . "forum`.`section` FROM `" . TABLE_PREFIX . "forum` WHERE `" . TABLE_PREFIX . "forum`.`id` = ".(int) $thread['first_post']." LIMIT 1")->fetch();
|
|
||||||
echo '<a href="' . getLink('forum') . '">Boards</a> >> <a href="' . getForumBoardLink($thread['section']) . '">'.$sections[$thread['section']]['name'].'</a> >> <a href="' . getForumThreadLink($thread['first_post']) . '">'.$first_post['post_topic'].'</a> >> <b>Edit post</b>';
|
|
||||||
if($account_logged->getId() == $thread['author_aid'] || Forum::isModerator())
|
|
||||||
{
|
|
||||||
$players_from_account = $db->query("SELECT `players`.`name`, `players`.`id` FROM `players` WHERE `players`.`account_id` = ".(int) $account_logged->getId())->fetchAll();
|
|
||||||
$saved = false;
|
|
||||||
if(isset($_REQUEST['save']))
|
|
||||||
{
|
|
||||||
$text = stripslashes(trim($_REQUEST['text']));
|
|
||||||
$char_id = (int) $_REQUEST['char_id'];
|
|
||||||
$post_topic = stripslashes(trim($_REQUEST['topic']));
|
|
||||||
$smile = (int) $_REQUEST['smile'];
|
|
||||||
$lenght = 0;
|
|
||||||
for($i = 0; $i <= strlen($post_topic); $i++)
|
|
||||||
{
|
|
||||||
if(ord($post_topic[$i]) >= 33 && ord($post_topic[$i]) <= 126)
|
|
||||||
$lenght++;
|
|
||||||
}
|
|
||||||
if(($lenght < 1 || strlen($post_topic) > 60) && $thread['id'] == $thread['first_post'])
|
|
||||||
$errors[] = 'Too short or too long topic (short: '.$lenght.' long: '.strlen($post_topic).' letters). Minimum 1 letter, maximum 60 letters.';
|
|
||||||
$lenght = 0;
|
|
||||||
for($i = 0; $i <= strlen($text); $i++)
|
|
||||||
{
|
|
||||||
if(ord($text[$i]) >= 33 && ord($text[$i]) <= 126)
|
|
||||||
$lenght++;
|
|
||||||
}
|
|
||||||
if($lenght < 1 || strlen($text) > 15000)
|
|
||||||
$errors[] = 'Too short or too long post (short: '.$lenght.' long: '.strlen($text).' letters). Minimum 1 letter, maximum 15000 letters.';
|
|
||||||
if($char_id == 0)
|
|
||||||
$errors[] = 'Please select a character.';
|
|
||||||
if(empty($post_topic) && $thread['id'] == $thread['first_post'])
|
|
||||||
$errors[] = 'Thread topic can\'t be empty.';
|
|
||||||
$player_on_account == false;
|
|
||||||
if(count($errors) == 0)
|
|
||||||
{
|
|
||||||
foreach($players_from_account as $player)
|
|
||||||
if($char_id == $player['id'])
|
|
||||||
$player_on_account = true;
|
|
||||||
if(!$player_on_account)
|
|
||||||
$errors[] = 'Player with selected ID '.$char_id.' doesn\'t exist or isn\'t on your account';
|
|
||||||
}
|
|
||||||
if(count($errors) == 0)
|
|
||||||
{
|
|
||||||
$saved = true;
|
|
||||||
if($account_logged->getId() != $thread['author_aid'])
|
|
||||||
$char_id = $thread['author_guid'];
|
|
||||||
$db->query("UPDATE `" . TABLE_PREFIX . "forum` SET `author_guid` = ".(int) $char_id.", `post_text` = ".$db->quote($text).", `post_topic` = ".$db->quote($post_topic).", `post_smile` = ".(int) $smile.", `last_edit_aid` = ".(int) $account_logged->getId().",`edit_date` = ".time()." WHERE `id` = ".(int) $thread['id']);
|
|
||||||
$post_page = $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`.`post_date` <= ".$thread['post_date']." AND `" . TABLE_PREFIX . "forum`.`first_post` = ".(int) $thread['first_post'])->fetch();
|
|
||||||
$_page = (int) ceil($post_page['posts_count'] / $config['forum_threads_per_page']) - 1;
|
|
||||||
header('Location: ' . getForumThreadLink($thread['first_post'], $_page));
|
|
||||||
echo '<br />Thank you for editing post.<br /><a href="' . getForumThreadLink($thread['first_post'], $_page) . '">GO BACK TO LAST THREAD</a>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$text = $thread['post_text'];
|
|
||||||
$char_id = (int) $thread['author_guid'];
|
|
||||||
$post_topic = $thread['post_topic'];
|
|
||||||
$smile = (int) $thread['post_smile'];
|
|
||||||
}
|
|
||||||
if(!$saved)
|
|
||||||
{
|
|
||||||
if(!empty($errors))
|
|
||||||
echo $twig->render('error_box.html.twig', array('errors' => $errors));
|
|
||||||
|
|
||||||
echo '<br /><form action="?" method="POST"><input type="hidden" name="action" value="edit_post" /><input type="hidden" name="id" value="'.$post_id.'" /><input type="hidden" name="subtopic" value="forum" /><input type="hidden" name="save" value="save" /><table width="100%"><tr bgcolor="'.$config['vdarkborder'].'"><td colspan="2"><font color="white"><b>Edit Post</b></font></td></tr><tr bgcolor="'.$config['darkborder'].'"><td width="180"><b>Character:</b></td><td><select name="char_id"><option value="0">(Choose character)</option>';
|
|
||||||
foreach($players_from_account as $player)
|
|
||||||
{
|
|
||||||
echo '<option value="'.$player['id'].'"';
|
|
||||||
if($player['id'] == $char_id)
|
|
||||||
echo ' selected="selected"';
|
|
||||||
echo '>'.$player['name'].'</option>';
|
|
||||||
}
|
|
||||||
echo '</select></td></tr><tr bgcolor="'.$config['lightborder'].'"><td><b>Topic:</b></td><td><input type="text" value="'.htmlspecialchars($post_topic).'" name="topic" size="40" maxlength="60" /> (Optional)</td></tr>
|
|
||||||
<tr bgcolor="'.$config['darkborder'].'"><td valign="top"><b>Message:</b><font size="1"><br />You can use:<br />[player]Nick[/player]<br />[url]http://address.com/[/url]<br />[img]http://images.com/images3.gif[/img]<br />[code]Code[/code]<br />[b]<b>Text</b>[/b]<br />[i]<i>Text</i>[/i]<br />[u]<u>Text</u>[/u]<br />and smileys:<br />;) , :) , :D , :( , :rolleyes:<br />:cool: , :eek: , :o , :p</font></td><td><textarea rows="10" cols="60" name="text">'.htmlspecialchars($text).'</textarea><br />(Max. 15,000 letters)</td></tr>
|
|
||||||
<tr bgcolor="'.$config['lightborder'].'"><td valign="top">Options:</td><td><label><input type="checkbox" name="smile" value="1"';
|
|
||||||
if($smile == 1)
|
|
||||||
echo ' checked="checked"';
|
|
||||||
echo '/>Disable Smileys in This Post </label></td></tr></table><center><input type="submit" value="Save Post" /></center></form>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
echo '<br />You are not an author of this post.';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
echo '<br />Post with ID '.$post_id.' doesn\'t exist.';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
echo '<br />Your account is banned, deleted or you don\'t have any player with level '.$config['forum_level_required'].' on your account. You can\'t post.';
|
|
||||||
}
|
|
||||||
|
|
||||||
if($action == 'new_thread')
|
|
||||||
{
|
|
||||||
if(Forum::canPost($account_logged))
|
|
||||||
{
|
|
||||||
$players_from_account = $db->query('SELECT `players`.`name`, `players`.`id` FROM `players` WHERE `players`.`account_id` = '.(int) $account_logged->getId())->fetchAll();
|
|
||||||
$section_id = isset($_REQUEST['section_id']) ? $_REQUEST['section_id'] : null;
|
|
||||||
if($section_id !== null) {
|
|
||||||
echo '<a href="' . getLink('forum') . '">Boards</a> >> <a href="' . getForumBoardLink($section_id) . '">' . $sections[$section_id]['name'] . '</a> >> <b>Post new thread</b><br />';
|
|
||||||
if (isset($sections[$section_id]['name'])) {
|
|
||||||
if ($sections[$section_id]['closed'] && !Forum::isModerator())
|
|
||||||
$errors[] = 'You cannot create topic on this board.';
|
|
||||||
|
|
||||||
$quote = (int)(isset($_REQUEST['quote']) ? $_REQUEST['quote'] : 0);
|
|
||||||
$text = isset($_REQUEST['text']) ? stripslashes($_REQUEST['text']) : '';
|
|
||||||
$char_id = (int)(isset($_REQUEST['char_id']) ? $_REQUEST['char_id'] : 0);
|
|
||||||
$post_topic = isset($_REQUEST['topic']) ? stripslashes($_REQUEST['topic']) : '';
|
|
||||||
$smile = (int)(isset($_REQUEST['smile']) ? $_REQUEST['smile'] : 0);
|
|
||||||
$saved = false;
|
|
||||||
if (isset($_REQUEST['save'])) {
|
|
||||||
$errors = array();
|
|
||||||
|
|
||||||
$lenght = 0;
|
|
||||||
for ($i = 0; $i < strlen($post_topic); $i++) {
|
|
||||||
if (ord($post_topic[$i]) >= 33 && ord($post_topic[$i]) <= 126)
|
|
||||||
$lenght++;
|
|
||||||
}
|
|
||||||
if ($lenght < 1 || strlen($post_topic) > 60)
|
|
||||||
$errors[] = 'Too short or too long topic (short: ' . $lenght . ' long: ' . strlen($post_topic) . ' letters). Minimum 1 letter, maximum 60 letters.';
|
|
||||||
$lenght = 0;
|
|
||||||
for ($i = 0; $i < strlen($text); $i++) {
|
|
||||||
if (ord($text[$i]) >= 33 && ord($text[$i]) <= 126)
|
|
||||||
$lenght++;
|
|
||||||
}
|
|
||||||
if ($lenght < 1 || strlen($text) > 15000)
|
|
||||||
$errors[] = 'Too short or too long post (short: ' . $lenght . ' long: ' . strlen($text) . ' letters). Minimum 1 letter, maximum 15000 letters.';
|
|
||||||
|
|
||||||
if ($char_id == 0)
|
|
||||||
$errors[] = 'Please select a character.';
|
|
||||||
$player_on_account = false;
|
|
||||||
|
|
||||||
if (count($errors) == 0) {
|
|
||||||
foreach ($players_from_account as $player)
|
|
||||||
if ($char_id == $player['id'])
|
|
||||||
$player_on_account = true;
|
|
||||||
if (!$player_on_account)
|
|
||||||
$errors[] = 'Player with selected ID ' . $char_id . ' doesn\'t exist or isn\'t on your account';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (count($errors) == 0) {
|
|
||||||
$last_post = 0;
|
|
||||||
$query = $db->query('SELECT `post_date` FROM `' . TABLE_PREFIX . 'forum` ORDER BY `post_date` DESC LIMIT 1');
|
|
||||||
if ($query->rowCount() > 0) {
|
|
||||||
$query = $query->fetch();
|
|
||||||
$last_post = $query['post_date'];
|
|
||||||
}
|
|
||||||
if ($last_post + $config['forum_post_interval'] - time() > 0 && !Forum::isModerator())
|
|
||||||
$errors[] = 'You can post one time per ' . $config['forum_post_interval'] . ' seconds. Next post after ' . ($last_post + $config['forum_post_interval'] - time()) . ' second(s).';
|
|
||||||
}
|
|
||||||
if (count($errors) == 0) {
|
|
||||||
$saved = true;
|
|
||||||
$db->query("INSERT INTO `" . TABLE_PREFIX . "forum` (`first_post` ,`last_post` ,`section` ,`replies` ,`views` ,`author_aid` ,`author_guid` ,`post_text` ,`post_topic` ,`post_smile` ,`post_date` ,`last_edit_aid` ,`edit_date`, `post_ip`) VALUES ('0', '" . time() . "', '" . (int)$section_id . "', '0', '0', '" . $account_logged->getId() . "', '" . (int)$char_id . "', " . $db->quote($text) . ", " . $db->quote($post_topic) . ", '" . (int)$smile . "', '" . time() . "', '0', '0', '" . $_SERVER['REMOTE_ADDR'] . "')");
|
|
||||||
$thread_id = $db->lastInsertId();
|
|
||||||
$db->query("UPDATE `" . TABLE_PREFIX . "forum` SET `first_post`=" . (int)$thread_id . " WHERE `id` = " . (int)$thread_id);
|
|
||||||
header('Location: ' . getForumThreadLink($thread_id));
|
|
||||||
echo '<br />Thank you for posting.<br /><a href="' . getForumThreadLink($thread_id) . '">GO BACK TO LAST THREAD</a>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!$saved) {
|
|
||||||
if (!empty($errors))
|
|
||||||
echo $twig->render('error_box.html.twig', array('errors' => $errors));
|
|
||||||
|
|
||||||
echo $twig->render('forum.new_thread.html.twig', array(
|
|
||||||
'section_id' => $section_id,
|
|
||||||
'players' => $players_from_account,
|
|
||||||
'post_player_id' => $char_id,
|
|
||||||
'post_thread' => $post_topic,
|
|
||||||
'text' => $text,
|
|
||||||
'smiles_enabled' => $smile > 0
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
echo 'Board with ID ' . $board_id . ' doesn\'t exist.';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
echo 'Please enter section_id.';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
echo 'Your account is banned, deleted or you don\'t have any player with level '.$config['forum_level_required'].' on your account. You can\'t post.';
|
|
||||||
}
|
|
||||||
|
|
||||||
//Board Change Function. Scripted by Cybermaster and Absolute Mango
|
|
||||||
if($action == 'move_thread')
|
|
||||||
{
|
|
||||||
if(Forum::isModerator())
|
|
||||||
{
|
|
||||||
$id = (int) $_REQUEST['id'];
|
|
||||||
$post = $db->query("SELECT `id`, `section`, `first_post`, `post_topic`, `author_guid` FROM `" . TABLE_PREFIX . "forum` WHERE `id` = ".$id." LIMIT 1")->fetch();
|
|
||||||
$name= $db->query("SELECT `name` FROM `players` WHERE `id` = ".$post['author_guid']." ")->fetch();
|
|
||||||
if($post['id'] == $id)
|
|
||||||
{
|
|
||||||
if($post['id'] == $post['first_post'])
|
|
||||||
{
|
|
||||||
echo $twig->render('forum.move_thread.html.twig', array(
|
|
||||||
'thread' => $post['post_topic'],
|
|
||||||
'author' => $name[0],
|
|
||||||
'board' => $sections[$post['section']]['name'],
|
|
||||||
'post_id' => $post['id'],
|
|
||||||
'sections' => $sections,
|
|
||||||
'section_link' => getForumBoardLink($post['section']),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
echo 'Post with ID '.$id.' does not exist.';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
echo 'You are not logged in or you are not moderator.';
|
|
||||||
}
|
|
||||||
|
|
||||||
if($action == 'moved_thread')
|
|
||||||
{
|
|
||||||
if(Forum::isModerator())
|
|
||||||
{
|
|
||||||
$id = (int) $_REQUEST['id'];
|
|
||||||
$board = (int) $_REQUEST['section'];
|
|
||||||
$post = $db->query("SELECT `id`, `first_post`, `section` FROM `" . TABLE_PREFIX . "forum` WHERE `id` = ".$id." LIMIT 1")->fetch();
|
|
||||||
if($post['id'] == $id)
|
|
||||||
{
|
|
||||||
if($post['id'] == $post['first_post'])
|
|
||||||
{
|
|
||||||
$db->query("UPDATE `" . TABLE_PREFIX . "forum` SET `section` = ".$board." WHERE `id` = ".$post['id']."") or die(mysql_error());
|
|
||||||
$nPost = $db->query( 'SELECT `section` FROM `' . TABLE_PREFIX . 'forum` WHERE `id` = \''.$id.'\' LIMIT 1;' )->fetch();
|
|
||||||
header('Location: ' . getForumBoardLink($nPost['section']));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
echo 'Post with ID ' . $id . ' does not exist.';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
echo 'You are not logged in or you are not moderator.';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class Forum
|
class Forum
|
||||||
|
110
system/pages/forum/edit_post.php
Normal file
110
system/pages/forum/edit_post.php
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Edit forum post
|
||||||
|
*
|
||||||
|
* @package MyAAC
|
||||||
|
* @author Gesior <jerzyskalski@wp.pl>
|
||||||
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
|
* @copyright 2017 MyAAC
|
||||||
|
* @version 0.6.0
|
||||||
|
* @link http://my-aac.org
|
||||||
|
*/
|
||||||
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
|
|
||||||
|
if(Forum::canPost($account_logged))
|
||||||
|
{
|
||||||
|
$post_id = (int) $_REQUEST['id'];
|
||||||
|
$thread = $db->query("SELECT `" . TABLE_PREFIX . "forum`.`author_guid`, `" . TABLE_PREFIX . "forum`.`author_aid`, `" . TABLE_PREFIX . "forum`.`first_post`, `" . TABLE_PREFIX . "forum`.`post_topic`, `" . TABLE_PREFIX . "forum`.`post_date`, `" . TABLE_PREFIX . "forum`.`post_text`, `" . TABLE_PREFIX . "forum`.`post_smile`, `" . TABLE_PREFIX . "forum`.`id`, `" . TABLE_PREFIX . "forum`.`section` FROM `" . TABLE_PREFIX . "forum` WHERE `" . TABLE_PREFIX . "forum`.`id` = ".(int) $post_id." LIMIT 1")->fetch();
|
||||||
|
if(isset($thread['id']))
|
||||||
|
{
|
||||||
|
$first_post = $db->query("SELECT `" . TABLE_PREFIX . "forum`.`author_guid`, `" . TABLE_PREFIX . "forum`.`author_aid`, `" . TABLE_PREFIX . "forum`.`first_post`, `" . TABLE_PREFIX . "forum`.`post_topic`, `" . TABLE_PREFIX . "forum`.`post_text`, `" . TABLE_PREFIX . "forum`.`post_smile`, `" . TABLE_PREFIX . "forum`.`id`, `" . TABLE_PREFIX . "forum`.`section` FROM `" . TABLE_PREFIX . "forum` WHERE `" . TABLE_PREFIX . "forum`.`id` = ".(int) $thread['first_post']." LIMIT 1")->fetch();
|
||||||
|
echo '<a href="' . getLink('forum') . '">Boards</a> >> <a href="' . getForumBoardLink($thread['section']) . '">'.$sections[$thread['section']]['name'].'</a> >> <a href="' . getForumThreadLink($thread['first_post']) . '">'.$first_post['post_topic'].'</a> >> <b>Edit post</b>';
|
||||||
|
if($account_logged->getId() == $thread['author_aid'] || Forum::isModerator())
|
||||||
|
{
|
||||||
|
$players_from_account = $db->query("SELECT `players`.`name`, `players`.`id` FROM `players` WHERE `players`.`account_id` = ".(int) $account_logged->getId())->fetchAll();
|
||||||
|
$saved = false;
|
||||||
|
if(isset($_REQUEST['save']))
|
||||||
|
{
|
||||||
|
$text = stripslashes(trim($_REQUEST['text']));
|
||||||
|
$char_id = (int) $_REQUEST['char_id'];
|
||||||
|
$post_topic = stripslashes(trim($_REQUEST['topic']));
|
||||||
|
$smile = (int) $_REQUEST['smile'];
|
||||||
|
$lenght = 0;
|
||||||
|
for($i = 0; $i <= strlen($post_topic); $i++)
|
||||||
|
{
|
||||||
|
if(ord($post_topic[$i]) >= 33 && ord($post_topic[$i]) <= 126)
|
||||||
|
$lenght++;
|
||||||
|
}
|
||||||
|
if(($lenght < 1 || strlen($post_topic) > 60) && $thread['id'] == $thread['first_post'])
|
||||||
|
$errors[] = 'Too short or too long topic (short: '.$lenght.' long: '.strlen($post_topic).' letters). Minimum 1 letter, maximum 60 letters.';
|
||||||
|
$lenght = 0;
|
||||||
|
for($i = 0; $i <= strlen($text); $i++)
|
||||||
|
{
|
||||||
|
if(ord($text[$i]) >= 33 && ord($text[$i]) <= 126)
|
||||||
|
$lenght++;
|
||||||
|
}
|
||||||
|
if($lenght < 1 || strlen($text) > 15000)
|
||||||
|
$errors[] = 'Too short or too long post (short: '.$lenght.' long: '.strlen($text).' letters). Minimum 1 letter, maximum 15000 letters.';
|
||||||
|
if($char_id == 0)
|
||||||
|
$errors[] = 'Please select a character.';
|
||||||
|
if(empty($post_topic) && $thread['id'] == $thread['first_post'])
|
||||||
|
$errors[] = 'Thread topic can\'t be empty.';
|
||||||
|
$player_on_account == false;
|
||||||
|
if(count($errors) == 0)
|
||||||
|
{
|
||||||
|
foreach($players_from_account as $player)
|
||||||
|
if($char_id == $player['id'])
|
||||||
|
$player_on_account = true;
|
||||||
|
if(!$player_on_account)
|
||||||
|
$errors[] = 'Player with selected ID '.$char_id.' doesn\'t exist or isn\'t on your account';
|
||||||
|
}
|
||||||
|
if(count($errors) == 0)
|
||||||
|
{
|
||||||
|
$saved = true;
|
||||||
|
if($account_logged->getId() != $thread['author_aid'])
|
||||||
|
$char_id = $thread['author_guid'];
|
||||||
|
$db->query("UPDATE `" . TABLE_PREFIX . "forum` SET `author_guid` = ".(int) $char_id.", `post_text` = ".$db->quote($text).", `post_topic` = ".$db->quote($post_topic).", `post_smile` = ".(int) $smile.", `last_edit_aid` = ".(int) $account_logged->getId().",`edit_date` = ".time()." WHERE `id` = ".(int) $thread['id']);
|
||||||
|
$post_page = $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`.`post_date` <= ".$thread['post_date']." AND `" . TABLE_PREFIX . "forum`.`first_post` = ".(int) $thread['first_post'])->fetch();
|
||||||
|
$_page = (int) ceil($post_page['posts_count'] / $config['forum_threads_per_page']) - 1;
|
||||||
|
header('Location: ' . getForumThreadLink($thread['first_post'], $_page));
|
||||||
|
echo '<br />Thank you for editing post.<br /><a href="' . getForumThreadLink($thread['first_post'], $_page) . '">GO BACK TO LAST THREAD</a>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$text = $thread['post_text'];
|
||||||
|
$char_id = (int) $thread['author_guid'];
|
||||||
|
$post_topic = $thread['post_topic'];
|
||||||
|
$smile = (int) $thread['post_smile'];
|
||||||
|
}
|
||||||
|
if(!$saved)
|
||||||
|
{
|
||||||
|
if(!empty($errors))
|
||||||
|
echo $twig->render('error_box.html.twig', array('errors' => $errors));
|
||||||
|
|
||||||
|
echo '<br /><form action="?" method="POST"><input type="hidden" name="action" value="edit_post" /><input type="hidden" name="id" value="'.$post_id.'" /><input type="hidden" name="subtopic" value="forum" /><input type="hidden" name="save" value="save" /><table width="100%"><tr bgcolor="'.$config['vdarkborder'].'"><td colspan="2"><font color="white"><b>Edit Post</b></font></td></tr><tr bgcolor="'.$config['darkborder'].'"><td width="180"><b>Character:</b></td><td><select name="char_id"><option value="0">(Choose character)</option>';
|
||||||
|
foreach($players_from_account as $player)
|
||||||
|
{
|
||||||
|
echo '<option value="'.$player['id'].'"';
|
||||||
|
if($player['id'] == $char_id)
|
||||||
|
echo ' selected="selected"';
|
||||||
|
echo '>'.$player['name'].'</option>';
|
||||||
|
}
|
||||||
|
echo '</select></td></tr><tr bgcolor="'.$config['lightborder'].'"><td><b>Topic:</b></td><td><input type="text" value="'.htmlspecialchars($post_topic).'" name="topic" size="40" maxlength="60" /> (Optional)</td></tr>
|
||||||
|
<tr bgcolor="'.$config['darkborder'].'"><td valign="top"><b>Message:</b><font size="1"><br />You can use:<br />[player]Nick[/player]<br />[url]http://address.com/[/url]<br />[img]http://images.com/images3.gif[/img]<br />[code]Code[/code]<br />[b]<b>Text</b>[/b]<br />[i]<i>Text</i>[/i]<br />[u]<u>Text</u>[/u]<br />and smileys:<br />;) , :) , :D , :( , :rolleyes:<br />:cool: , :eek: , :o , :p</font></td><td><textarea rows="10" cols="60" name="text">'.htmlspecialchars($text).'</textarea><br />(Max. 15,000 letters)</td></tr>
|
||||||
|
<tr bgcolor="'.$config['lightborder'].'"><td valign="top">Options:</td><td><label><input type="checkbox" name="smile" value="1"';
|
||||||
|
if($smile == 1)
|
||||||
|
echo ' checked="checked"';
|
||||||
|
echo '/>Disable Smileys in This Post </label></td></tr></table><center><input type="submit" value="Save Post" /></center></form>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
echo '<br />You are not an author of this post.';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
echo '<br />Post with ID '.$post_id.' doesn\'t exist.';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
echo '<br />Your account is banned, deleted or you don\'t have any player with level '.$config['forum_level_required'].' on your account. You can\'t post.';
|
||||||
|
|
||||||
|
?>
|
52
system/pages/forum/move_thread.php
Normal file
52
system/pages/forum/move_thread.php
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Move forum thread (for moderator)
|
||||||
|
*
|
||||||
|
* @package MyAAC
|
||||||
|
* @author Gesior <jerzyskalski@wp.pl>
|
||||||
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
|
* @copyright 2017 MyAAC
|
||||||
|
* @version 0.6.0
|
||||||
|
* @link http://my-aac.org
|
||||||
|
*/
|
||||||
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
|
|
||||||
|
$save = isset($_REQUEST['save']) ? (int)$_REQUEST['save'] == 1 : false;
|
||||||
|
if($save) {
|
||||||
|
if (Forum::isModerator()) {
|
||||||
|
$id = (int)$_REQUEST['id'];
|
||||||
|
$board = (int)$_REQUEST['section'];
|
||||||
|
$post = $db->query("SELECT `id`, `first_post`, `section` FROM `" . TABLE_PREFIX . "forum` WHERE `id` = " . $id . " LIMIT 1")->fetch();
|
||||||
|
if ($post['id'] == $id) {
|
||||||
|
if ($post['id'] == $post['first_post']) {
|
||||||
|
$db->query("UPDATE `" . TABLE_PREFIX . "forum` SET `section` = " . $board . " WHERE `id` = " . $post['id'] . "") or die(mysql_error());
|
||||||
|
$nPost = $db->query('SELECT `section` FROM `' . TABLE_PREFIX . 'forum` WHERE `id` = \'' . $id . '\' LIMIT 1;')->fetch();
|
||||||
|
header('Location: ' . getForumBoardLink($nPost['section']));
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
echo 'Post with ID ' . $id . ' does not exist.';
|
||||||
|
} else
|
||||||
|
echo 'You are not logged in or you are not moderator.';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (Forum::isModerator()) {
|
||||||
|
$id = (int)$_REQUEST['id'];
|
||||||
|
$post = $db->query("SELECT `id`, `section`, `first_post`, `post_topic`, `author_guid` FROM `" . TABLE_PREFIX . "forum` WHERE `id` = " . $id . " LIMIT 1")->fetch();
|
||||||
|
$name = $db->query("SELECT `name` FROM `players` WHERE `id` = " . $post['author_guid'] . " ")->fetch();
|
||||||
|
if ($post['id'] == $id) {
|
||||||
|
if ($post['id'] == $post['first_post']) {
|
||||||
|
echo $twig->render('forum.move_thread.html.twig', array(
|
||||||
|
'thread' => $post['post_topic'],
|
||||||
|
'author' => $name[0],
|
||||||
|
'board' => $sections[$post['section']]['name'],
|
||||||
|
'post_id' => $post['id'],
|
||||||
|
'sections' => $sections,
|
||||||
|
'section_link' => getForumBoardLink($post['section']),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
echo 'Post with ID ' . $id . ' does not exist.';
|
||||||
|
} else
|
||||||
|
echo 'You are not logged in or you are not moderator.';
|
||||||
|
}
|
||||||
|
?>
|
125
system/pages/forum/new_post.php
Normal file
125
system/pages/forum/new_post.php
Normal file
@ -0,0 +1,125 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* New forum post
|
||||||
|
*
|
||||||
|
* @package MyAAC
|
||||||
|
* @author Gesior <jerzyskalski@wp.pl>
|
||||||
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
|
* @copyright 2017 MyAAC
|
||||||
|
* @version 0.6.0
|
||||||
|
* @link http://my-aac.org
|
||||||
|
*/
|
||||||
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
|
|
||||||
|
if(Forum::canPost($account_logged))
|
||||||
|
{
|
||||||
|
$players_from_account = $db->query("SELECT `players`.`name`, `players`.`id` FROM `players` WHERE `players`.`account_id` = ".(int) $account_logged->getId())->fetchAll();
|
||||||
|
$thread_id = (int) $_REQUEST['thread_id'];
|
||||||
|
$thread = $db->query("SELECT `" . TABLE_PREFIX . "forum`.`post_topic`, `" . TABLE_PREFIX . "forum`.`id`, `" . TABLE_PREFIX . "forum`.`section` FROM `" . TABLE_PREFIX . "forum` WHERE `" . TABLE_PREFIX . "forum`.`id` = ".(int) $thread_id." AND `" . TABLE_PREFIX . "forum`.`first_post` = ".(int) $thread_id." LIMIT 1")->fetch();
|
||||||
|
echo '<a href="' . getLink('forum') . '">Boards</a> >> <a href="' . getForumBoardLink($thread['section']) . '">'.$sections[$thread['section']]['name'].'</a> >> <a href="' . getForumThreadLink($thread_id) . '">'.$thread['post_topic'].'</a> >> <b>Post new reply</b><br /><h3>'.$thread['post_topic'].'</h3>';
|
||||||
|
if(isset($thread['id']))
|
||||||
|
{
|
||||||
|
$quote = isset($_REQUEST['quote']) ? (int) $_REQUEST['quote'] : NULL;
|
||||||
|
$text = isset($_REQUEST['text']) ? stripslashes(trim($_REQUEST['text'])) : NULL;
|
||||||
|
$char_id = (int) (isset($_REQUEST['char_id']) ? $_REQUEST['char_id'] : 0);
|
||||||
|
$post_topic = isset($_REQUEST['topic']) ? stripslashes(trim($_REQUEST['topic'])) : '';
|
||||||
|
$smile = (int) (isset($_REQUEST['smile']) ? $_REQUEST['smile'] : 0);
|
||||||
|
$saved = false;
|
||||||
|
if(isset($_REQUEST['quote']))
|
||||||
|
{
|
||||||
|
$quoted_post = $db->query("SELECT `players`.`name`, `" . TABLE_PREFIX . "forum`.`post_text`, `" . TABLE_PREFIX . "forum`.`post_date` FROM `players`, `" . TABLE_PREFIX . "forum` WHERE `players`.`id` = `" . TABLE_PREFIX . "forum`.`author_guid` AND `" . TABLE_PREFIX . "forum`.`id` = ".(int) $quote)->fetchAll();
|
||||||
|
if(isset($quoted_post[0]['name']))
|
||||||
|
$text = '[i]Originally posted by '.$quoted_post[0]['name'].' on '.date('d.m.y H:i:s', $quoted_post[0]['post_date']).':[/i][quote]'.$quoted_post[0]['post_text'].'[/quote]';
|
||||||
|
}
|
||||||
|
elseif(isset($_REQUEST['save']))
|
||||||
|
{
|
||||||
|
$lenght = 0;
|
||||||
|
for($i = 0; $i < strlen($text); $i++)
|
||||||
|
{
|
||||||
|
if(ord($text[$i]) >= 33 && ord($text[$i]) <= 126)
|
||||||
|
$lenght++;
|
||||||
|
}
|
||||||
|
if($lenght < 1 || strlen($text) > 15000)
|
||||||
|
$errors[] = 'Too short or too long post (short: '.$lenght.' long: '.strlen($text).' letters). Minimum 1 letter, maximum 15000 letters.';
|
||||||
|
if($char_id == 0)
|
||||||
|
$errors[] = 'Please select a character.';
|
||||||
|
$player_on_account = false;
|
||||||
|
if(count($errors) == 0)
|
||||||
|
{
|
||||||
|
foreach($players_from_account as $player)
|
||||||
|
if($char_id == $player['id'])
|
||||||
|
$player_on_account = true;
|
||||||
|
if(!$player_on_account)
|
||||||
|
$errors[] = 'Player with selected ID '.$char_id.' doesn\'t exist or isn\'t on your account';
|
||||||
|
}
|
||||||
|
if(count($errors) == 0)
|
||||||
|
{
|
||||||
|
$last_post = 0;
|
||||||
|
$query = $db->query('SELECT post_date FROM ' . TABLE_PREFIX . 'forum ORDER BY post_date DESC LIMIT 1');
|
||||||
|
if($query->rowCount() > 0)
|
||||||
|
{
|
||||||
|
$query = $query->fetch();
|
||||||
|
$last_post = $query['post_date'];
|
||||||
|
}
|
||||||
|
if($last_post+$config['forum_post_interval']-time() > 0 && !Forum::isModerator())
|
||||||
|
$errors[] = 'You can post one time per '.$config['forum_post_interval'].' seconds. Next post after '.($last_post+$config['forum_post_interval']-time()).' second(s).';
|
||||||
|
}
|
||||||
|
if(count($errors) == 0)
|
||||||
|
{
|
||||||
|
$saved = true;
|
||||||
|
$db->query("INSERT INTO `" . TABLE_PREFIX . "forum` (`id` ,`first_post` ,`last_post` ,`section` ,`replies` ,`views` ,`author_aid` ,`author_guid` ,`post_text` ,`post_topic` ,`post_smile` ,`post_date` ,`last_edit_aid` ,`edit_date`, `post_ip`) VALUES (NULL, '".$thread['id']."', '0', '".$thread['section']."', '0', '0', '".$account_logged->getId()."', '".(int) $char_id."', ".$db->quote($text).", ".$db->quote($post_topic).", '".(int) $smile."', '".time()."', '0', '0', '".$_SERVER['REMOTE_ADDR']."')");
|
||||||
|
$db->query("UPDATE `" . TABLE_PREFIX . "forum` SET `replies`=`replies`+1, `last_post`=".time()." WHERE `id` = ".(int) $thread_id);
|
||||||
|
$post_page = $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`.`post_date` <= ".time()." AND `" . TABLE_PREFIX . "forum`.`first_post` = ".(int) $thread['id'])->fetch();
|
||||||
|
$_page = (int) ceil($post_page['posts_count'] / $config['forum_threads_per_page']) - 1;
|
||||||
|
header('Location: ' . getForumThreadLink($thread_id, $_page));
|
||||||
|
echo '<br />Thank you for posting.<br /><a href="' . getForumThreadLink($thread_id, $_page) . '">GO BACK TO LAST THREAD</a>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!$saved)
|
||||||
|
{
|
||||||
|
if(!empty($errors))
|
||||||
|
echo $twig->render('error_box.html.twig', array('errors' => $errors));
|
||||||
|
|
||||||
|
echo '<form action="?" method="POST">
|
||||||
|
<input type="hidden" name="action" value="new_post" />
|
||||||
|
<input type="hidden" name="thread_id" value="'.$thread_id.'" />
|
||||||
|
<input type="hidden" name="subtopic" value="forum" />
|
||||||
|
<input type="hidden" name="save" value="save" />
|
||||||
|
<table width="100%">
|
||||||
|
<tr bgcolor="'.$config['vdarkborder'].'">
|
||||||
|
<td colspan="2"><font color="white"><b>Post New Reply</b></font></td>
|
||||||
|
</tr>
|
||||||
|
<tr bgcolor="'.$config['darkborder'].'">
|
||||||
|
<td width="180"><b>Character:</b></td>
|
||||||
|
<td>
|
||||||
|
<select name="char_id">
|
||||||
|
<option value="0">(Choose character)</option>';
|
||||||
|
foreach($players_from_account as $player)
|
||||||
|
{
|
||||||
|
echo '<option value="'.$player['id'].'"';
|
||||||
|
if($player['id'] == $char_id)
|
||||||
|
echo ' selected="selected"';
|
||||||
|
echo '>'.$player['name'].'</option>';
|
||||||
|
}
|
||||||
|
echo '</select></td></tr><tr bgcolor="'.$config['lightborder'].'"><td><b>Topic:</b></td><td><input type="text" name="topic" value="'.htmlspecialchars($post_topic).'" size="40" maxlength="60" /> (Optional)</td></tr>
|
||||||
|
<tr bgcolor="'.$config['darkborder'].'"><td valign="top"><b>Message:</b><font size="1"><br />You can use:<br />[player]Nick[/player]<br />[url]http://address.com/[/url]<br />[img]http://images.com/images3.gif[/img]<br />[code]Code[/code]<br />[b]<b>Text</b>[/b]<br />[i]<i>Text</i>[/i]<br />[u]<u>Text</u>[/u]<br />and smileys:<br />;) , :) , :D , :( , :rolleyes:<br />:cool: , :eek: , :o , :p</font></td><td><textarea rows="10" cols="60" name="text">'.htmlspecialchars($text).'</textarea><br />(Max. 15,000 letters)</td></tr>
|
||||||
|
<tr bgcolor="'.$config['lightborder'].'"><td valign="top">Options:</td><td><label><input type="checkbox" name="smile" value="1"';
|
||||||
|
if($smile == 1)
|
||||||
|
echo ' checked="checked"';
|
||||||
|
echo '/>Disable Smileys in This Post </label></td></tr></table><center><input type="submit" value="Post Reply" /></center></form>';
|
||||||
|
$threads = $db->query("SELECT `players`.`name`, `" . TABLE_PREFIX . "forum`.`post_text`, `" . TABLE_PREFIX . "forum`.`post_topic`, `" . TABLE_PREFIX . "forum`.`post_smile` 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` DESC LIMIT 10")->fetchAll();
|
||||||
|
echo '<table width="100%"><tr bgcolor="'.$config['vdarkborder'].'"><td colspan="2"><font color="white"><b>Last 5 posts from thread: '.$thread['post_topic'].'</b></font></td></tr>';
|
||||||
|
foreach($threads as $thread)
|
||||||
|
{
|
||||||
|
echo '<tr bgcolor="' . getStyle($number_of_rows++) . '"><td>'.$thread['name'].'</td><td>'.showPost($thread['post_topic'], $thread['post_text'], $thread['post_smile']).'</td></tr>';
|
||||||
|
}
|
||||||
|
echo '</table>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
echo 'Thread with ID '.$thread_id.' doesn\'t exist.';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
echo "Your account is banned, deleted or you don't have any player with level " . $config['forum_level_required'] . " on your account. You can't post.";
|
||||||
|
|
||||||
|
?>
|
102
system/pages/forum/new_thread.php
Normal file
102
system/pages/forum/new_thread.php
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* New forum thread
|
||||||
|
*
|
||||||
|
* @package MyAAC
|
||||||
|
* @author Gesior <jerzyskalski@wp.pl>
|
||||||
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
|
* @copyright 2017 MyAAC
|
||||||
|
* @version 0.6.0
|
||||||
|
* @link http://my-aac.org
|
||||||
|
*/
|
||||||
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
|
|
||||||
|
if(Forum::canPost($account_logged))
|
||||||
|
{
|
||||||
|
$players_from_account = $db->query('SELECT `players`.`name`, `players`.`id` FROM `players` WHERE `players`.`account_id` = '.(int) $account_logged->getId())->fetchAll();
|
||||||
|
$section_id = isset($_REQUEST['section_id']) ? $_REQUEST['section_id'] : null;
|
||||||
|
if($section_id !== null) {
|
||||||
|
echo '<a href="' . getLink('forum') . '">Boards</a> >> <a href="' . getForumBoardLink($section_id) . '">' . $sections[$section_id]['name'] . '</a> >> <b>Post new thread</b><br />';
|
||||||
|
if (isset($sections[$section_id]['name'])) {
|
||||||
|
if ($sections[$section_id]['closed'] && !Forum::isModerator())
|
||||||
|
$errors[] = 'You cannot create topic on this board.';
|
||||||
|
|
||||||
|
$quote = (int)(isset($_REQUEST['quote']) ? $_REQUEST['quote'] : 0);
|
||||||
|
$text = isset($_REQUEST['text']) ? stripslashes($_REQUEST['text']) : '';
|
||||||
|
$char_id = (int)(isset($_REQUEST['char_id']) ? $_REQUEST['char_id'] : 0);
|
||||||
|
$post_topic = isset($_REQUEST['topic']) ? stripslashes($_REQUEST['topic']) : '';
|
||||||
|
$smile = (int)(isset($_REQUEST['smile']) ? $_REQUEST['smile'] : 0);
|
||||||
|
$saved = false;
|
||||||
|
if (isset($_REQUEST['save'])) {
|
||||||
|
$errors = array();
|
||||||
|
|
||||||
|
$lenght = 0;
|
||||||
|
for ($i = 0; $i < strlen($post_topic); $i++) {
|
||||||
|
if (ord($post_topic[$i]) >= 33 && ord($post_topic[$i]) <= 126)
|
||||||
|
$lenght++;
|
||||||
|
}
|
||||||
|
if ($lenght < 1 || strlen($post_topic) > 60)
|
||||||
|
$errors[] = 'Too short or too long topic (short: ' . $lenght . ' long: ' . strlen($post_topic) . ' letters). Minimum 1 letter, maximum 60 letters.';
|
||||||
|
$lenght = 0;
|
||||||
|
for ($i = 0; $i < strlen($text); $i++) {
|
||||||
|
if (ord($text[$i]) >= 33 && ord($text[$i]) <= 126)
|
||||||
|
$lenght++;
|
||||||
|
}
|
||||||
|
if ($lenght < 1 || strlen($text) > 15000)
|
||||||
|
$errors[] = 'Too short or too long post (short: ' . $lenght . ' long: ' . strlen($text) . ' letters). Minimum 1 letter, maximum 15000 letters.';
|
||||||
|
|
||||||
|
if ($char_id == 0)
|
||||||
|
$errors[] = 'Please select a character.';
|
||||||
|
$player_on_account = false;
|
||||||
|
|
||||||
|
if (count($errors) == 0) {
|
||||||
|
foreach ($players_from_account as $player)
|
||||||
|
if ($char_id == $player['id'])
|
||||||
|
$player_on_account = true;
|
||||||
|
if (!$player_on_account)
|
||||||
|
$errors[] = 'Player with selected ID ' . $char_id . ' doesn\'t exist or isn\'t on your account';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count($errors) == 0) {
|
||||||
|
$last_post = 0;
|
||||||
|
$query = $db->query('SELECT `post_date` FROM `' . TABLE_PREFIX . 'forum` ORDER BY `post_date` DESC LIMIT 1');
|
||||||
|
if ($query->rowCount() > 0) {
|
||||||
|
$query = $query->fetch();
|
||||||
|
$last_post = $query['post_date'];
|
||||||
|
}
|
||||||
|
if ($last_post + $config['forum_post_interval'] - time() > 0 && !Forum::isModerator())
|
||||||
|
$errors[] = 'You can post one time per ' . $config['forum_post_interval'] . ' seconds. Next post after ' . ($last_post + $config['forum_post_interval'] - time()) . ' second(s).';
|
||||||
|
}
|
||||||
|
if (count($errors) == 0) {
|
||||||
|
$saved = true;
|
||||||
|
$db->query("INSERT INTO `" . TABLE_PREFIX . "forum` (`first_post` ,`last_post` ,`section` ,`replies` ,`views` ,`author_aid` ,`author_guid` ,`post_text` ,`post_topic` ,`post_smile` ,`post_date` ,`last_edit_aid` ,`edit_date`, `post_ip`) VALUES ('0', '" . time() . "', '" . (int)$section_id . "', '0', '0', '" . $account_logged->getId() . "', '" . (int)$char_id . "', " . $db->quote($text) . ", " . $db->quote($post_topic) . ", '" . (int)$smile . "', '" . time() . "', '0', '0', '" . $_SERVER['REMOTE_ADDR'] . "')");
|
||||||
|
$thread_id = $db->lastInsertId();
|
||||||
|
$db->query("UPDATE `" . TABLE_PREFIX . "forum` SET `first_post`=" . (int)$thread_id . " WHERE `id` = " . (int)$thread_id);
|
||||||
|
header('Location: ' . getForumThreadLink($thread_id));
|
||||||
|
echo '<br />Thank you for posting.<br /><a href="' . getForumThreadLink($thread_id) . '">GO BACK TO LAST THREAD</a>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!$saved) {
|
||||||
|
if (!empty($errors))
|
||||||
|
echo $twig->render('error_box.html.twig', array('errors' => $errors));
|
||||||
|
|
||||||
|
echo $twig->render('forum.new_thread.html.twig', array(
|
||||||
|
'section_id' => $section_id,
|
||||||
|
'players' => $players_from_account,
|
||||||
|
'post_player_id' => $char_id,
|
||||||
|
'post_thread' => $post_topic,
|
||||||
|
'text' => $text,
|
||||||
|
'smiles_enabled' => $smile > 0
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
echo 'Board with ID ' . $board_id . ' doesn\'t exist.';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
echo 'Please enter section_id.';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
echo 'Your account is banned, deleted or you don\'t have any player with level '.$config['forum_level_required'].' on your account. You can\'t post.';
|
||||||
|
|
||||||
|
?>
|
37
system/pages/forum/remove_post.php
Normal file
37
system/pages/forum/remove_post.php
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Remove forum post
|
||||||
|
*
|
||||||
|
* @package MyAAC
|
||||||
|
* @author Gesior <jerzyskalski@wp.pl>
|
||||||
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
|
* @copyright 2017 MyAAC
|
||||||
|
* @version 0.6.0
|
||||||
|
* @link http://my-aac.org
|
||||||
|
*/
|
||||||
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
|
|
||||||
|
if(Forum::isModerator())
|
||||||
|
{
|
||||||
|
$id = (int) $_REQUEST['id'];
|
||||||
|
$post = $db->query("SELECT `id`, `first_post`, `section` FROM `" . TABLE_PREFIX . "forum` WHERE `id` = ".$id." LIMIT 1")->fetch();
|
||||||
|
if($post['id'] == $id)
|
||||||
|
{
|
||||||
|
if($post['id'] == $post['first_post'])
|
||||||
|
{
|
||||||
|
$db->query("DELETE FROM `" . TABLE_PREFIX . "forum` WHERE `first_post` = ".$post['id']);
|
||||||
|
header('Location: ' . getForumBoardLink($post['section']));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$post_page = $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`.`id` < ".$id." AND `" . TABLE_PREFIX . "forum`.`first_post` = ".(int) $post['first_post'])->fetch();
|
||||||
|
$_page = (int) ceil($post_page['posts_count'] / $config['forum_threads_per_page']) - 1;
|
||||||
|
$db->query("DELETE FROM `" . TABLE_PREFIX . "forum` WHERE `id` = ".$post['id']);
|
||||||
|
header('Location: ' . getForumThreadLink($post['first_post'], (int) $_page));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
echo 'Post with ID ' . $id . ' does not exist.';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
echo 'You are not logged in or you are not moderator.';
|
77
system/pages/forum/show_board.php
Normal file
77
system/pages/forum/show_board.php
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Show forum board
|
||||||
|
*
|
||||||
|
* @package MyAAC
|
||||||
|
* @author Gesior <jerzyskalski@wp.pl>
|
||||||
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
|
* @copyright 2017 MyAAC
|
||||||
|
* @version 0.6.0
|
||||||
|
* @link http://my-aac.org
|
||||||
|
*/
|
||||||
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
|
|
||||||
|
$links_to_pages = '';
|
||||||
|
$section_id = (int) $_REQUEST['id'];
|
||||||
|
$_page = (int) (isset($_REQUEST['page']) ? $_REQUEST['page'] : 0);
|
||||||
|
$threads_count = $db->query("SELECT COUNT(`" . TABLE_PREFIX . "forum`.`id`) AS threads_count FROM `players`, `" . TABLE_PREFIX . "forum` WHERE `players`.`id` = `" . TABLE_PREFIX . "forum`.`author_guid` AND `" . TABLE_PREFIX . "forum`.`section` = ".(int) $section_id." AND `" . TABLE_PREFIX . "forum`.`first_post` = `" . TABLE_PREFIX . "forum`.`id`")->fetch();
|
||||||
|
for($i = 0; $i < $threads_count['threads_count'] / $config['forum_threads_per_page']; $i++)
|
||||||
|
{
|
||||||
|
if($i != $_page)
|
||||||
|
$links_to_pages .= '<a href="' . getForumBoardLink($section_id, $i) . '">'.($i + 1).'</a> ';
|
||||||
|
else
|
||||||
|
$links_to_pages .= '<b>'.($i + 1).' </b>';
|
||||||
|
}
|
||||||
|
echo '<a href="' . getLink('forum') . '">Boards</a> >> <b>'.$sections[$section_id]['name'].'</b>';
|
||||||
|
if(!$sections[$section_id]['closed'] || Forum::isModerator())
|
||||||
|
{
|
||||||
|
echo '<br /><br />
|
||||||
|
<a href="?subtopic=forum&action=new_thread§ion_id='.$section_id.'"><img src="images/forum/topic.gif" border="0" /></a>';
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '<br /><br />Page: '.$links_to_pages.'<br />';
|
||||||
|
$last_threads = $db->query("SELECT `players`.`id` as `player_id`, `players`.`name`, `" . TABLE_PREFIX . "forum`.`post_text`, `" . TABLE_PREFIX . "forum`.`post_topic`, `" . TABLE_PREFIX . "forum`.`id`, `" . TABLE_PREFIX . "forum`.`last_post`, `" . TABLE_PREFIX . "forum`.`replies`, `" . TABLE_PREFIX . "forum`.`views`, `" . TABLE_PREFIX . "forum`.`post_date` FROM `players`, `" . TABLE_PREFIX . "forum` WHERE `players`.`id` = `" . TABLE_PREFIX . "forum`.`author_guid` AND `" . TABLE_PREFIX . "forum`.`section` = ".(int) $section_id." AND `" . TABLE_PREFIX . "forum`.`first_post` = `" . TABLE_PREFIX . "forum`.`id` ORDER BY `" . TABLE_PREFIX . "forum`.`last_post` DESC LIMIT ".$config['forum_threads_per_page']." OFFSET ".($_page * $config['forum_threads_per_page']))->fetchAll();
|
||||||
|
if(isset($last_threads[0]))
|
||||||
|
{
|
||||||
|
echo '<table width="100%"><tr bgcolor="'.$config['vdarkborder'].'" align="center"><td><font color="white" size="1"><b>Thread</b></font></td><td><font color="white" size="1"><b>Thread Starter</b></font></td><td><font color="white" size="1"><b>Replies</b></font></td><td><font color="white" size="1"><b>Views</b></font></td><td><font color="white" size="1"><b>Last Post</b></font></td></tr>';
|
||||||
|
|
||||||
|
$player = new OTS_Player();
|
||||||
|
foreach($last_threads as $thread)
|
||||||
|
{
|
||||||
|
echo '<tr bgcolor="' . getStyle($number_of_rows++) . '"><td>';
|
||||||
|
if(Forum::isModerator())
|
||||||
|
{
|
||||||
|
echo '<a href="?subtopic=forum&action=move_thread&id='.$thread['id'].'"\')"><span style="color:darkgreen">[MOVE]</span></a>';
|
||||||
|
echo '<a href="?subtopic=forum&action=remove_post&id='.$thread['id'].'" onclick="return confirm(\'Are you sure you want remove thread > '.$thread['post_topic'].' <?\')"><font color="red">[REMOVE]</font></a> ';
|
||||||
|
}
|
||||||
|
|
||||||
|
$player->load($thread['player_id']);
|
||||||
|
if(!$player->isLoaded()) {
|
||||||
|
error('Forum error: Player not loaded.');
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
|
||||||
|
$player_account = $player->getAccount();
|
||||||
|
$canEditForum = $player_account->hasFlag(FLAG_CONTENT_FORUM) || $player_account->isAdmin();
|
||||||
|
|
||||||
|
echo '<a href="' . getForumThreadLink($thread['id']) . '">'.($canEditForum ? $thread['post_topic'] : htmlspecialchars($thread['post_topic'])) . '</a><br /><small>'.($canEditForum ? substr(strip_tags($thread['post_text']), 0, 50) : htmlspecialchars(substr($thread['post_text'], 0, 50))).'...</small></td><td>' . getPlayerLink($thread['name']) . '</td><td>'.(int) $thread['replies'].'</td><td>'.(int) $thread['views'].'</td><td>';
|
||||||
|
if($thread['last_post'] > 0)
|
||||||
|
{
|
||||||
|
$last_post = $db->query("SELECT `players`.`name`, `" . TABLE_PREFIX . "forum`.`post_date` FROM `players`, `" . TABLE_PREFIX . "forum` WHERE `" . TABLE_PREFIX . "forum`.`first_post` = ".(int) $thread['id']." AND `players`.`id` = `" . TABLE_PREFIX . "forum`.`author_guid` ORDER BY `post_date` DESC LIMIT 1")->fetch();
|
||||||
|
if(isset($last_post['name']))
|
||||||
|
echo date('d.m.y H:i:s', $last_post['post_date']).'<br />by ' . getPlayerLink($last_post['name']);
|
||||||
|
else
|
||||||
|
echo 'No posts.';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
echo date('d.m.y H:i:s', $thread['post_date']).'<br />by ' . getPlayerLink($thread['name']);
|
||||||
|
echo '</td></tr>';
|
||||||
|
}
|
||||||
|
echo '</table>';
|
||||||
|
if(!$sections[$section_id]['closed'] || Forum::isModerator())
|
||||||
|
echo '<br /><a href="?subtopic=forum&action=new_thread§ion_id='.$section_id.'"><img src="images/forum/topic.gif" border="0" /></a>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
echo '<h3>No threads in this board.</h3>';
|
||||||
|
|
||||||
|
?>
|
85
system/pages/forum/show_thread.php
Normal file
85
system/pages/forum/show_thread.php
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Show forum thread
|
||||||
|
*
|
||||||
|
* @package MyAAC
|
||||||
|
* @author Gesior <jerzyskalski@wp.pl>
|
||||||
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
|
* @copyright 2017 MyAAC
|
||||||
|
* @version 0.6.0
|
||||||
|
* @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` 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']))
|
||||||
|
{
|
||||||
|
$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 .= '<a href="' . getForumThreadLink($thread_id, $i) . '">'.($i + 1).'</a> ';
|
||||||
|
else
|
||||||
|
$links_to_pages .= '<b>'.($i + 1).' </b>';
|
||||||
|
}
|
||||||
|
$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 '<a href="' . getLink('forum') . '">Boards</a> >> <a href="' . getForumBoardLink($threads[0]['section']) . '">'.$sections[$threads[0]['section']]['name'].'</a> >> <b>'.$thread_name['post_topic'].'</b>';
|
||||||
|
echo '<br /><br /><a href="?subtopic=forum&action=new_post&thread_id='.$thread_id.'"><img src="images/forum/post.gif" border="0" /></a><br /><br />Page: '.$links_to_pages.'<br /><table width="100%"><tr bgcolor="'.$config['lightborder'].'" width="100%"><td colspan="2"><font size="4"><b>'.htmlspecialchars($thread_name['post_topic']).'</b></font><font size="1"><br />by ' . getPlayerLink($thread_name['name']) . '</font></td></tr><tr bgcolor="'.$config['vdarkborder'].'"><td width="200"><font color="white" size="1"><b>Author</b></font></td><td> </td></tr>';
|
||||||
|
$player = $ots->createObject('Player');
|
||||||
|
foreach($threads as $thread)
|
||||||
|
{
|
||||||
|
$player->load($thread['player_id']);
|
||||||
|
if(!$player->isLoaded()) {
|
||||||
|
error('Forum error: Player not loaded.');
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '<tr bgcolor="' . getStyle($number_of_rows++) . '"><td valign="top">' . getPlayerLink($thread['name']) . '<br /><br /><font size="1">Profession: '.$config['vocations'][$player->getVocation()].'<br />Level: '.$thread['level'].'<br />';
|
||||||
|
|
||||||
|
$rank = $player->getRank();
|
||||||
|
if($rank->isLoaded())
|
||||||
|
{
|
||||||
|
$guild = $rank->getGuild();
|
||||||
|
if($guild->isLoaded())
|
||||||
|
echo $rank->getName().' of <a href="'.getGuildLink($guild->getName(), false).'">'.$guild->getName().'</a><br />';
|
||||||
|
}
|
||||||
|
$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 '<br />Posts: '.(int) $posts['posts'].'<br /></font></td><td valign="top">'.showPost(($canEditForum ? $thread['post_topic'] : htmlspecialchars($thread['post_topic'])), ($canEditForum ? $thread['post_text'] : htmlspecialchars($thread['post_text'])), $thread['post_smile']).'</td></tr>
|
||||||
|
<tr bgcolor="'.getStyle($number_of_rows++).'"><td><font size="1">'.date('d.m.y H:i:s', $thread['post_date']);
|
||||||
|
if($thread['edit_date'] > 0)
|
||||||
|
{
|
||||||
|
if($thread['last_edit_aid'] != $thread['author_aid'])
|
||||||
|
echo '<br />Edited by moderator';
|
||||||
|
else
|
||||||
|
echo '<br />Edited by '.$thread['name'];
|
||||||
|
echo '<br />on '.date('d.m.y H:i:s', $thread['edit_date']);
|
||||||
|
}
|
||||||
|
echo '</font></td><td>';
|
||||||
|
if(Forum::isModerator())
|
||||||
|
if($thread['first_post'] != $thread['id'])
|
||||||
|
echo '<a href="?subtopic=forum&action=remove_post&id='.$thread['id'].'" onclick="return confirm(\'Are you sure you want remove post of '.$thread['name'].'?\')"><font color="red">REMOVE POST</font></a>';
|
||||||
|
else
|
||||||
|
{
|
||||||
|
echo '<a href="?subtopic=forum&action=move_thread&id='.$thread['id'].'"\')"><span style="color:darkgreen">[MOVE]</span></a>';
|
||||||
|
echo '<br/><a href="?subtopic=forum&action=remove_post&id='.$thread['id'].'" onclick="return confirm(\'Are you sure you want remove thread > '.$thread['post_topic'].' <?\')"><font color="red">REMOVE THREAD</font></a>';
|
||||||
|
}
|
||||||
|
if($logged && ($thread['account_id'] == $account_logged->getId() || Forum::isModerator()))
|
||||||
|
echo '<br/><a href="?subtopic=forum&action=edit_post&id='.$thread['id'].'">EDIT POST</a>';
|
||||||
|
if($logged)
|
||||||
|
echo '<br/><a href="?subtopic=forum&action=new_post&thread_id='.$thread_id.'"e='.$thread['id'].'">Quote</a>';
|
||||||
|
echo '</td></tr>';
|
||||||
|
}
|
||||||
|
echo '</table><br /><a href="?subtopic=forum&action=new_post&thread_id='.$thread_id.'"><img src="images/forum/post.gif" border="0" /></a>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
echo 'Thread with this ID does not exits.';
|
||||||
|
|
||||||
|
?>
|
@ -8,9 +8,9 @@
|
|||||||
<table border="0" cellpadding="3" cellspacing="1" width="100%">
|
<table border="0" cellpadding="3" cellspacing="1" width="100%">
|
||||||
<tr bgcolor="{{ config.lightborder }}">
|
<tr bgcolor="{{ config.lightborder }}">
|
||||||
<td>
|
<td>
|
||||||
<form action="" method="get">
|
<form action="{{ getLink('forum') }}" method="get">
|
||||||
<input type="hidden" name="subtopic" value="forum" />
|
<input type="hidden" name="action" value="move_thread" />
|
||||||
<input type="hidden" name="action" value="moved_thread" />
|
<input type="hidden" name="save" value="1" />
|
||||||
<input type="hidden" name="id" value="{{ post_id }}" />
|
<input type="hidden" name="id" value="{{ post_id }}" />
|
||||||
<strong>THREAD:</strong> {{ thread }}<br/>
|
<strong>THREAD:</strong> {{ thread }}<br/>
|
||||||
<strong>AUTHOR:</strong> {{ author }}<br/>
|
<strong>AUTHOR:</strong> {{ author }}<br/>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user