* moved forum.new_post to twig templates

* moved forum functions to Forum class
* minimum PHP version to install AAC is now 5.3.0 cause of Anonymous functions used by Twig
This commit is contained in:
slawkens 2017-10-18 10:29:54 +02:00
parent bbae0c3ade
commit 1850ef70d8
7 changed files with 185 additions and 132 deletions

View File

@ -22,7 +22,7 @@ function version_check($name, $ok, $info = '', $warning = false)
$failed = false; $failed = false;
// start validating // start validating
version_check($locale['step_requirements_php_version'], (PHP_VERSION_ID >= 50200), PHP_VERSION); version_check($locale['step_requirements_php_version'], (PHP_VERSION_ID >= 50300), PHP_VERSION);
foreach(array('config.local.php', 'images/guilds', 'images/houses', 'images/gallery') as $value) foreach(array('config.local.php', 'images/guilds', 'images/houses', 'images/gallery') as $value)
{ {
$perms = (int) substr(decoct(fileperms(BASE . $value)), 2); $perms = (int) substr(decoct(fileperms(BASE . $value)), 2);

View File

@ -24,96 +24,6 @@ if(strtolower($config['forum']) != 'site')
return; return;
} }
function parseSmiles($text)
{
$smileys = array(
';D' => 1,
':D' => 1,
':cool:' => 2,
';cool;' => 2,
':ekk:' => 3,
';ekk;' => 3,
';o' => 4,
';O' => 4,
':o' => 4,
':O' => 4,
':(' => 5,
';(' => 5,
':mad:' => 6,
';mad;' => 6,
';rolleyes;' => 7,
':rolleyes:' => 7,
':)' => 8,
';d' => 9,
':d' => 9,
';)' => 10
);
foreach($smileys as $search => $replace)
$text = str_replace($search, '<img src="images/forum/smile/'.$replace.'.gif" alt="'. $search .'" title="' . $search . '" />', $text);
return $text;
}
function parseBBCode($text, $smiles)
{
$rows = 0;
while(stripos($text, '[code]') !== false && stripos($text, '[/code]') !== false )
{
$code = substr($text, stripos($text, '[code]')+6, stripos($text, '[/code]') - stripos($text, '[code]') - 6);
if(!is_int($rows / 2)) { $bgcolor = 'ABED25'; } else { $bgcolor = '23ED25'; } $rows++;
$text = str_ireplace('[code]'.$code.'[/code]', '<i>Code:</i><br /><table cellpadding="0" style="background-color: #'.$bgcolor.'; width: 480px; border-style: dotted; border-color: #CCCCCC; border-width: 2px"><tr><td>'.$code.'</td></tr></table>', $text);
}
$rows = 0;
while(stripos($text, '[quote]') !== false && stripos($text, '[/quote]') !== false )
{
$quote = substr($text, stripos($text, '[quote]')+7, stripos($text, '[/quote]') - stripos($text, '[quote]') - 7);
if(!is_int($rows / 2)) { $bgcolor = 'AAAAAA'; } else { $bgcolor = 'CCCCCC'; } $rows++;
$text = str_ireplace('[quote]'.$quote.'[/quote]', '<table cellpadding="0" style="background-color: #'.$bgcolor.'; width: 480px; border-style: dotted; border-color: #007900; border-width: 2px"><tr><td>'.$quote.'</td></tr></table>', $text);
}
$rows = 0;
while(stripos($text, '[url]') !== false && stripos($text, '[/url]') !== false )
{
$url = substr($text, stripos($text, '[url]')+5, stripos($text, '[/url]') - stripos($text, '[url]') - 5);
$text = str_ireplace('[url]'.$url.'[/url]', '<a href="'.$url.'" target="_blank">'.$url.'</a>', $text);
}
$xhtml = false;
$tags = array(
'#\[b\](.*?)\[/b\]#si' => ($xhtml ? '<strong>\\1</strong>' : '<b>\\1</b>'),
'#\[i\](.*?)\[/i\]#si' => ($xhtml ? '<em>\\1</em>' : '<i>\\1</i>'),
'#\[u\](.*?)\[/u\]#si' => ($xhtml ? '<span style="text-decoration: underline;">\\1</span>' : '<u>\\1</u>'),
'#\[s\](.*?)\[/s\]#si' => ($xhtml ? '<strike>\\1</strike>' : '<s>\\1</s>'),
'#\[guild\](.*?)\[/guild\]#si' => urldecode(generateLink(getGuildLink('$1', false), '$1', true)),
'#\[house\](.*?)\[/house\]#si' => urldecode(generateLink(getHouseLink('$1', false), '$1', true)),
'#\[player\](.*?)\[/player\]#si' => urldecode(generateLink(getPlayerLink('$1', false), '$1', true)),
// TODO: [poll] tag
'#\[color=(.*?)\](.*?)\[/color\]#si' => ($xhtml ? '<span style="color: \\1;">\\2</span>' : '<font color="\\1">\\2</font>'),
'#\[img\](.*?)\[/img\]#si' => ($xhtml ? '<img src="\\1" border="0" alt="" />' : '<img src="\\1" border="0" alt="">'),
'#\[url=(.*?)\](.*?)\[/url\]#si' => '<a href="\\1" title="\\2">\\2</a>',
// '#\[email\](.*?)\[/email\]#si' => '<a href="mailto:\\1" title="Email \\1">\\1</a>',
'#\[code\](.*?)\[/code\]#si' => '<code>\\1</code>',
// '#\[align=(.*?)\](.*?)\[/align\]#si' => ($xhtml ? '<div style="text-align: \\1;">\\2</div>' : '<div align="\\1">\\2</div>'),
// '#\[br\]#si' => ($xhtml ? '<br style="clear: both;" />' : '<br>'),
);
foreach($tags as $search => $replace)
$text = preg_replace($search, $replace, $text);
return ($smiles == 0 ? parseSmiles($text) : $text);
}
function showPost($topic, $text, $smiles)
{
$text = nl2br($text);
$post = '';
if(!empty($topic))
$post .= '<b>'.($smiles == 0 ? parseSmiles($topic) : $topic).'</b><hr />';
$post .= parseBBCode($text, $smiles);
return $post;
}
if(!$logged) if(!$logged)
echo 'You are not logged in. <a href="?subtopic=accountmanagement&redirect=' . BASE_URL . urlencode('?subtopic=forum') . '">Log in</a> to post on the forum.<br /><br />'; echo 'You are not logged in. <a href="?subtopic=accountmanagement&redirect=' . BASE_URL . urlencode('?subtopic=forum') . '">Log in</a> to post on the forum.<br /><br />';
@ -280,6 +190,21 @@ class Forum
return hasFlag(FLAG_CONTENT_FORUM) || admin(); return hasFlag(FLAG_CONTENT_FORUM) || admin();
} }
static public function add_post($thread_id, $section, $author_aid, $author_guid, $post_text, $post_topic, $smile)
{
global $db;
$db->insert(TABLE_PREFIX . 'forum', array(
'first_post' => $thread_id,
'section' => $section,
'author_aid' => $author_aid,
'author_guid' => $author_guid,
'post_text' => $post_text,
'post_topic' => $post_topic,
'post_smile' => $smile,
'post_date' => time(),
'post_ip' => $_SERVER['REMOTE_ADDR']
));
}
static public function add_board($name, $description, &$errors) static public function add_board($name, $description, &$errors)
{ {
global $db; global $db;
@ -373,4 +298,95 @@ class Forum
return !count($errors); return !count($errors);
} }
public static function parseSmiles($text)
{
$smileys = array(
';D' => 1,
':D' => 1,
':cool:' => 2,
';cool;' => 2,
':ekk:' => 3,
';ekk;' => 3,
';o' => 4,
';O' => 4,
':o' => 4,
':O' => 4,
':(' => 5,
';(' => 5,
':mad:' => 6,
';mad;' => 6,
';rolleyes;' => 7,
':rolleyes:' => 7,
':)' => 8,
';d' => 9,
':d' => 9,
';)' => 10
);
foreach($smileys as $search => $replace)
$text = str_replace($search, '<img src="images/forum/smile/'.$replace.'.gif" alt="'. $search .'" title="' . $search . '" />', $text);
return $text;
}
public static function parseBBCode($text, $smiles)
{
$rows = 0;
while(stripos($text, '[code]') !== false && stripos($text, '[/code]') !== false )
{
$code = substr($text, stripos($text, '[code]')+6, stripos($text, '[/code]') - stripos($text, '[code]') - 6);
if(!is_int($rows / 2)) { $bgcolor = 'ABED25'; } else { $bgcolor = '23ED25'; } $rows++;
$text = str_ireplace('[code]'.$code.'[/code]', '<i>Code:</i><br /><table cellpadding="0" style="background-color: #'.$bgcolor.'; width: 480px; border-style: dotted; border-color: #CCCCCC; border-width: 2px"><tr><td>'.$code.'</td></tr></table>', $text);
}
$rows = 0;
while(stripos($text, '[quote]') !== false && stripos($text, '[/quote]') !== false )
{
$quote = substr($text, stripos($text, '[quote]')+7, stripos($text, '[/quote]') - stripos($text, '[quote]') - 7);
if(!is_int($rows / 2)) { $bgcolor = 'AAAAAA'; } else { $bgcolor = 'CCCCCC'; } $rows++;
$text = str_ireplace('[quote]'.$quote.'[/quote]', '<table cellpadding="0" style="background-color: #'.$bgcolor.'; width: 480px; border-style: dotted; border-color: #007900; border-width: 2px"><tr><td>'.$quote.'</td></tr></table>', $text);
}
$rows = 0;
while(stripos($text, '[url]') !== false && stripos($text, '[/url]') !== false )
{
$url = substr($text, stripos($text, '[url]')+5, stripos($text, '[/url]') - stripos($text, '[url]') - 5);
$text = str_ireplace('[url]'.$url.'[/url]', '<a href="'.$url.'" target="_blank">'.$url.'</a>', $text);
}
$xhtml = false;
$tags = array(
'#\[b\](.*?)\[/b\]#si' => ($xhtml ? '<strong>\\1</strong>' : '<b>\\1</b>'),
'#\[i\](.*?)\[/i\]#si' => ($xhtml ? '<em>\\1</em>' : '<i>\\1</i>'),
'#\[u\](.*?)\[/u\]#si' => ($xhtml ? '<span style="text-decoration: underline;">\\1</span>' : '<u>\\1</u>'),
'#\[s\](.*?)\[/s\]#si' => ($xhtml ? '<strike>\\1</strike>' : '<s>\\1</s>'),
'#\[guild\](.*?)\[/guild\]#si' => urldecode(generateLink(getGuildLink('$1', false), '$1', true)),
'#\[house\](.*?)\[/house\]#si' => urldecode(generateLink(getHouseLink('$1', false), '$1', true)),
'#\[player\](.*?)\[/player\]#si' => urldecode(generateLink(getPlayerLink('$1', false), '$1', true)),
// TODO: [poll] tag
'#\[color=(.*?)\](.*?)\[/color\]#si' => ($xhtml ? '<span style="color: \\1;">\\2</span>' : '<font color="\\1">\\2</font>'),
'#\[img\](.*?)\[/img\]#si' => ($xhtml ? '<img src="\\1" border="0" alt="" />' : '<img src="\\1" border="0" alt="">'),
'#\[url=(.*?)\](.*?)\[/url\]#si' => '<a href="\\1" title="\\2">\\2</a>',
// '#\[email\](.*?)\[/email\]#si' => '<a href="mailto:\\1" title="Email \\1">\\1</a>',
'#\[code\](.*?)\[/code\]#si' => '<code>\\1</code>',
// '#\[align=(.*?)\](.*?)\[/align\]#si' => ($xhtml ? '<div style="text-align: \\1;">\\2</div>' : '<div align="\\1">\\2</div>'),
// '#\[br\]#si' => ($xhtml ? '<br style="clear: both;" />' : '<br>'),
);
foreach($tags as $search => $replace)
$text = preg_replace($search, $replace, $text);
return ($smiles == 0 ? Forum::parseSmiles($text) : $text);
}
public static function showPost($topic, $text, $smiles)
{
$text = nl2br($text);
$post = '';
if(!empty($topic))
$post .= '<b>'.($smiles == 0 ? self::parseSmiles($topic) : $topic).'</b><hr />';
$post .= self::parseBBCode($text, $smiles);
return $post;
}
} }

View File

@ -105,9 +105,9 @@ if(Forum::canPost($account_logged))
echo '<br/>You are not an author of this post.'; echo '<br/>You are not an author of this post.';
} }
else else
echo '<br/>Post with ID '.$post_id.' doesn\'t exist.'; echo "<br/>Post with ID " . $post_id . " doesn't exist.";
} }
else 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.'; 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.";
?> ?>

View File

@ -14,7 +14,12 @@ defined('MYAAC') or die('Direct access not allowed!');
if(Forum::canPost($account_logged)) 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(); $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_id = isset($_REQUEST['thread_id']) ? (int) $_REQUEST['thread_id'] : 0;
if($thread_id == 0) {
echo "Thread with this id doesn't exist.";
return;
}
$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(); $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>'; 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'])) if(isset($thread['id']))
@ -43,6 +48,7 @@ if(Forum::canPost($account_logged))
$errors[] = 'Too short or too long post (short: '.$lenght.' long: '.strlen($text).' letters). Minimum 1 letter, maximum 15000 letters.'; $errors[] = 'Too short or too long post (short: '.$lenght.' long: '.strlen($text).' letters). Minimum 1 letter, maximum 15000 letters.';
if($char_id == 0) if($char_id == 0)
$errors[] = 'Please select a character.'; $errors[] = 'Please select a character.';
$player_on_account = false; $player_on_account = false;
if(count($errors) == 0) if(count($errors) == 0)
{ {
@ -67,7 +73,7 @@ if(Forum::canPost($account_logged))
if(count($errors) == 0) if(count($errors) == 0)
{ {
$saved = true; $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']."')"); Forum::add_post($thread['id'], $thread['section'], $account_logged->getId(), (int) $char_id, $text, $post_topic, (int) $smile, time(), $_SERVER['REMOTE_ADDR']);
$db->query("UPDATE `" . TABLE_PREFIX . "forum` SET `replies`=`replies`+1, `last_post`=".time()." WHERE `id` = ".(int) $thread_id); $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(); $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; $_page = (int) ceil($post_page['posts_count'] / $config['forum_threads_per_page']) - 1;
@ -80,44 +86,26 @@ if(Forum::canPost($account_logged))
if(!empty($errors)) if(!empty($errors))
echo $twig->render('error_box.html.twig', array('errors' => $errors)); echo $twig->render('error_box.html.twig', array('errors' => $errors));
echo '<form action="?" method="POST"> $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 5")->fetchAll();
<input type="hidden" name="action" value="new_post" />
<input type="hidden" name="thread_id" value="'.$thread_id.'" /> foreach($threads as &$thread) {
<input type="hidden" name="subtopic" value="forum" /> $thread['post'] = Forum::showPost($thread['post_topic'], $thread['post_text'], $thread['post_smile']);
<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> echo $twig->render('forum.new_post.html.twig', array(
<tr bgcolor="'.$config['lightborder'].'"><td valign="top">Options:</td><td><label><input type="checkbox" name="smile" value="1"'; 'thread_id' => $thread_id,
if($smile == 1) 'post_player_id' => $char_id,
echo ' checked="checked"'; 'players' => $players_from_account,
echo '/>Disable Smileys in This Post </label></td></tr></table><center><input type="submit" value="Post Reply" /></center></form>'; 'post_topic' => $post_topic,
$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(); 'post_text' => $text,
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>'; 'post_smile' => $smile,
foreach($threads as $thread) 'topic' => $thread['post_topic'],
{ 'threads' => $threads
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 else
echo 'Thread with ID '.$thread_id.' doesn\'t exist.'; echo "Thread with ID " . $thread_id . " doesn't exist.";
} }
else 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."; 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.";

View File

@ -52,7 +52,7 @@ if(!empty($thread_name['name']))
$canEditForum = $player_account->hasFlag(FLAG_CONTENT_FORUM) || $player_account->isAdmin(); $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(); $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> echo '<br />Posts: '.(int) $posts['posts'].'<br /></font></td><td valign="top">'.Forum::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']); <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['edit_date'] > 0)
{ {

View File

@ -0,0 +1,50 @@
<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>
{% for player in players %}
<option value="{{ player.id }}"{% if player.id == post_player_id %} selected="selected"{% endif %}>{{ player.name }}</option>
{% endfor %}
</select>
</td>
</tr>
<tr bgcolor="{{ config.lightborder }}">
<td><b>Topic:</b></td>
<td><input type="text" name="topic" value="{{ post_topic|escape }}" 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">{{ post_text|escape }}</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 post_smile == 1 %} checked="checked"{% endif %}/>Disable Smileys in This Post </label></td>
</tr>
</table>
<center>
<input type="submit" value="Post Reply" />
</center>
</form>
<table width="100%">
<tr bgcolor="{{ config.vdarkborder }}">
<td colspan="2">
<font color="white"><b>Last 5 posts from thread: {{ topic|raw }}</b></font>
</td>
</tr>
{% set i = 0 %}
{% for thread in threads %}
<tr bgcolor="{{ getStyle(i) }}"><td>{{ thread.name }}</td><td>{{ thread.post|raw }}</td></tr>
{% set i = i + 1 %}
{% endfor %}
</table>

View File

@ -14,8 +14,7 @@
<td> <td>
<select name="char_id"><option value="0">(Choose character)</option> <select name="char_id"><option value="0">(Choose character)</option>
{% for player in players %} {% for player in players %}
<option value="{{ player.id }}" <option value="{{ player.id }}"{% if player.id == post_player_id %} selected="selected"{% endif %}>{{ player.name }}</option>
{% if player.id == post_player_id %} selected="selected"{% endif %}>{{ player.name }}</option>
{% endfor %} {% endfor %}
</select> </select>
</td> </td>