<?php

/**
 * This file is part of JohnCMS Content Management System.
 *
 * @copyright JohnCMS Community
 * @license   https://opensource.org/licenses/GPL-3.0 GPL-3.0
 * @link      https://johncms.com JohnCMS Project
 */

/**
 * @var $title
 * @var $page_title
 * @var $show_post_preview
 * @var $preview_message
 * @var $back_url
 * @var $msg
 * @var $page
 * @var $csrf_token
 * @var \Johncms\Users\User $message_author
 */

$this->layout(
    'system::layout/default',
    [
        'title'      => $title,
        'page_title' => $page_title,
    ]
);
?>

<form name="edit_post" action="/forum/edit-post/<?= $id ?>/<?= $page > 1 ? '?page=' . $page : '' ?>" method="post">
    <input type="hidden" name="csrf_token" value="<?= $csrf_token ?>">
    <?= $this->fetch(
        'system::app/ckeditor',
        [
            'label'        => __('Message'),
            'errors'       => implode(', ', $errors['message'] ?? []),
            'value'        => $msg,
            'name'         => 'msg',
            'allow_upload' => true,
            'upload_url'   => '/forum/upload_file/',
        ]
    ) ?>
    <div>
        <button type="submit" name="submit" value="1" class="btn btn-primary"><?= __('Save') ?></button>
    </div>
    <div class="mt-3">
        <a href="/help/?act=smileys" class="pe-2"><?= __('Smilies') ?></a> <a href="<?= $back_url ?>"><?= __('Back') ?></a>
    </div>
</form>
