<?php
/*
 * pages/read.php
 * PHP logic: INTACT - $article si $read_id sunt setate de include/functions/news.php
 * HTML: design Nostalgia2
 *
 * Variabile disponibile:
 *   $article['title'], $article['time'], $article['content']
 *   $read_id - id-ul articolului
 *   $web_admin, $jsondataPrivileges['news']
 */

if(!$offline && $database->is_loggedin())
    if($web_admin >= $jsondataPrivileges['news'])
        include 'include/functions/edit-news.php';
?>

<!-- Header bara titlu -->
<nav class="navbar navbar-dark bg-news-header mb-2">
    <div class="container-fluid">
        <h4 class="h4 small m-0 text-uppercase">
            <?php echo htmlspecialchars($article['title']); ?>
        </h4>
        <div class="d-flex d-none d-md-block">
            <ul class="navbar-nav list-group-horizontal small">
                <li class="nav-item px-2">
                    <span class="text-green small"><?php echo $article['time']; ?></span>
                </li>
            </ul>
        </div>
    </div>
</nav>

<!-- Continut complet articol -->
<div class="row mx-auto">
    <div class="col-12 background-white py-3 p-4 mx-auto">

        <!-- Butoane admin -->
        <?php if(!$offline && $database->is_loggedin() && $web_admin >= $jsondataPrivileges['news']) { ?>
        <div class="d-flex justify-content-end mb-3">
            <a href="<?php echo $site_url; ?>?delete=<?php echo $read_id; ?>"
               onclick="return confirm('<?php echo addslashes($lang['sure?']); ?>');"
               class="text-danger">
                <i class="fa fa-trash-o fa-lg"></i> <?php echo $lang['delete']; ?>
            </a>
        </div>
        <?php } ?>

        <div class="clearfix">
            <div class="col-12 small text-muted news__content">
                <?php echo $article['content']; ?>
            </div>
        </div>

        <!-- Inapoi -->
        <div class="d-flex read-more justify-content-center mt-4">
            <hr>
            <a href="<?php echo $site_url; ?>news">
                <button class="btn btn-read">&laquo; <?php echo $lang['news']; ?></button>
            </a>
        </div>
    </div>
</div>
