<?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 $file_attached
 * @var $back_url
 */

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

<?php if ($file_attached): ?>
    <div class="alert alert-success">
        <?= __('File attached'); ?>
    </div>
    <div class="mt-3">
        <a href="/forum/?act=addfile&id=<?= $id ?>" class="btn btn-primary"><?= __('Add more') ?></a>
        <a href="<?= $back_url ?>" class="btn btn-secondary"><?= __('Back to topic') ?></a>
    </div>
<?php else: ?>
    <form name="new_topic" action="/forum/?act=addfile&amp;id=<?= $id ?>" method="post" enctype="multipart/form-data">
        <div class="input-group">
            <div class="custom-file">
                <input type="file" class="custom-file-input" id="fail" name="fail" aria-describedby="file_label" required>
                <label class="custom-file-label" for="fail"><?= __('Choose file') ?></label>
            </div>
        </div>
        <div class="text-muted mb-3 small">
            <?= __('Max. Size') ?>: <?= $config['flsz'] ?> kb.
        </div>
        <div>
            <button type="submit" name="submit" value="1" class="btn btn-primary"><?= __('Upload') ?></button>
            <a href="<?= $back_url ?>" class="btn btn-secondary"><?= __('Back to topic') ?></a>
        </div>
    </form>
<?php endif; ?>
