* replace "$twig->render()" with "$this->display"

This commit is contained in:
slawkens
2018-05-29 21:29:08 +02:00
parent 68d74a490b
commit c654ea329c
69 changed files with 413 additions and 413 deletions

View File

@@ -17,7 +17,7 @@ if(Forum::canPost($account_logged))
echo 'Please enter post id.';
return;
}
$thread = $db->query("SELECT `author_guid`, `author_aid`, `first_post`, `post_topic`, `post_date`, `post_text`, `post_smile`, `post_html`, `id`, `section` FROM `" . TABLE_PREFIX . "forum` WHERE `id` = ".$post_id." LIMIT 1")->fetch();
if(isset($thread['id']))
{
@@ -55,9 +55,9 @@ if(Forum::canPost($account_logged))
$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)
@@ -66,7 +66,7 @@ if(Forum::canPost($account_logged))
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'])
@@ -85,13 +85,13 @@ if(Forum::canPost($account_logged))
$smile = (int) $thread['post_smile'];
$html = (int) $thread['post_html'];
}
if(!$saved)
{
if(!empty($errors))
echo $twig->render('error_box.html.twig', array('errors' => $errors));
echo $twig->render('forum.edit_post.html.twig', array(
$twig->display('error_box.html.twig', array('errors' => $errors));
$twig->display('forum.edit_post.html.twig', array(
'post_id' => $post_id,
'players' => $players_from_account,
'player_id' => $char_id,

View File

@@ -38,17 +38,17 @@ else {
$post_id = (int)$_REQUEST['id'];
$post = $db->query("SELECT `id`, `section`, `first_post`, `post_topic`, `author_guid` FROM `" . TABLE_PREFIX . "forum` WHERE `id` = " . $post_id . " LIMIT 1")->fetch();
$name = $db->query("SELECT `name` FROM `players` WHERE `id` = " . $post['author_guid'] . " ")->fetch();
$sections_allowed = array();
foreach($sections as $id => $section) {
if(Forum::hasAccess($id)) {
$sections_allowed[$id] = $section;
}
}
if ($post['id'] == $post_id) {
if ($post['id'] == $post['first_post']) {
echo $twig->render('forum.move_thread.html.twig', array(
$twig->display('forum.move_thread.html.twig', array(
'thread' => $post['post_topic'],
'author' => $name['name'],
'board' => $sections[$post['section']]['name'],

View File

@@ -18,7 +18,7 @@ if(Forum::canPost($account_logged))
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();
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']) && Forum::hasAccess($thread['section']))
@@ -48,7 +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.';
if($char_id == 0)
$errors[] = 'Please select a character.';
$player_on_account = false;
if(count($errors) == 0)
{
@@ -81,12 +81,12 @@ if(Forum::canPost($account_logged))
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));
$twig->display('error_box.html.twig', array('errors' => $errors));
$threads = $db->query("SELECT `players`.`name`, `" . TABLE_PREFIX . "forum`.`post_text`, `" . TABLE_PREFIX . "forum`.`post_topic`, `" . TABLE_PREFIX . "forum`.`post_smile`, `" . TABLE_PREFIX . "forum`.`post_html`, `" . TABLE_PREFIX . "forum`.`author_aid` 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();
foreach($threads as &$thread) {
$player_account = new OTS_Account();
@@ -95,8 +95,8 @@ if(Forum::canPost($account_logged))
$thread['post'] = Forum::showPost(($thread['post_html'] > 0 ? $thread['post_topic'] : htmlspecialchars($thread['post_topic'])), ($thread['post_html'] > 0 ? $thread['post_text'] : htmlspecialchars($thread['post_text'])), $thread['post_smile'] == 0, $thread['post_html'] > 0);
}
}
echo $twig->render('forum.new_post.html.twig', array(
$twig->display('forum.new_post.html.twig', array(
'thread_id' => $thread_id,
'post_player_id' => $char_id,
'players' => $players_from_account,
@@ -116,4 +116,4 @@ if(Forum::canPost($account_logged))
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 $twig->render('forum.fullscreen.html.twig');
$twig->display('forum.fullscreen.html.twig');

View File

@@ -19,7 +19,7 @@ if(Forum::canPost($account_logged))
if(isset($sections[$section_id]['name']) && Forum::hasAccess($section_id)) {
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);
@@ -29,7 +29,7 @@ if(Forum::canPost($account_logged))
$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)
@@ -44,11 +44,11 @@ if(Forum::canPost($account_logged))
}
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'])
@@ -56,7 +56,7 @@ if(Forum::canPost($account_logged))
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');
@@ -76,12 +76,12 @@ if(Forum::canPost($account_logged))
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(
$twig->display('error_box.html.twig', array('errors' => $errors));
$twig->display('forum.new_thread.html.twig', array(
'section_id' => $section_id,
'players' => $players_from_account,
'post_player_id' => $char_id,

View File

@@ -49,7 +49,7 @@ foreach($posts as &$post)
error('Forum error: Player not loaded.');
die();
}
if($config['characters']['outfit']) {
$post['outfit'] = $config['outfit_images_url'] . '?id=' . $player->getLookType() . ($lookaddons ? '&addons=' . $player->getLookAddons() : '') . '&head=' . $player->getLookHead() . '&body=' . $player->getLookBody() . '&legs=' . $player->getLookLegs() . '&feet=' . $player->getLookFeet();
}
@@ -59,7 +59,7 @@ foreach($posts as &$post)
if($group->isLoaded()) {
$groupName = $group->getName();
}
$post['group'] = $groupName;
$post['player_link'] = getPlayerLink($player->getName());
@@ -75,7 +75,7 @@ foreach($posts as &$post)
$player_account = $player->getAccount();
$post['content'] = Forum::showPost(($post['post_html'] > 0 ? $post['post_topic'] : htmlspecialchars($post['post_topic'])), ($post['post_html'] > 0 ? $post['post_text'] : htmlspecialchars($post['post_text'])), $post['post_smile'] == 0, $post['post_html'] > 0);
$query = $db->query("SELECT COUNT(`id`) AS 'posts' FROM `" . TABLE_PREFIX . "forum` WHERE `author_aid`=".(int) $player_account->getId())->fetch();
$post['author_posts_count'] = (int)$query['posts'];
@@ -90,7 +90,7 @@ foreach($posts as &$post)
}
}
echo $twig->render('forum.show_thread.html.twig', array(
$twig->display('forum.show_thread.html.twig', array(
'thread_id' => $thread_id,
'posts' => $posts,
'links_to_pages' => $links_to_pages,
@@ -100,4 +100,4 @@ echo $twig->render('forum.show_thread.html.twig', array(
'is_moderator' => Forum::isModerator()
));
echo $twig->render('forum.fullscreen.html.twig');
$twig->display('forum.fullscreen.html.twig');