Website Summary Files Commits Branches @commit @diff @stats
path: root / views / archive / topbar.php
blob: f521fcb1b361583be108982b5f795720377c9fbc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<!-- Dirty hack to escape all PHP dom sanitization and checks -->
</script>

<?php
    require_once "../../models/database.php";
    require_once "../../models/webpage.php";
    require_once "../../models/user.php";

    $currentPageId = basename(__DIR__);
    $currentPage = Database\Webpage::fromDBwid($currentPageId);
    $requesterUsername = Database\User::fromDBuid($currentPage->RequesterUID);

    $previousPageId = Database\Webpage::getPreviousPageId($currentPage->URL, $currentPage->Date);
    $nextPageId = Database\Webpage::getNextPageId($currentPage->URL, $currentPage->Date);
?>

<div class="navbar">
    <div class="navbar-info">
        <span>Title: <?= $currentPage->Title ?></span>
        <span>Url: <?= $currentPage->URL ?></span>
        <span>Date of archival: <?= $currentPage->Date ?></span>
        <span>Visits: <?= $currentPage->Visits ?></span>
        <span>Requested by: <?= $requesterUsername->Username ?></span>
    </div>

    <div class="navbar-links">
        <? if ($previousPageId != 0): ?>
            <a href="<?= "../$previousPageId/index.php" ?>">Previous version</a>
        <? endif; ?>
        <? if ($nextPageId != 0): ?>
            <a href="<?= "../$nextPageId/index.php" ?>">Next version</a>
        <? endif; ?>
    </div>
</div>