Website Summary Files Commits Branches @commit @diff @stats
path: root / views / archive / index.php
blob: f7c427fbe632d3bfb1b8ee899100911ebe2aa4fa (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
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
    $exists = null;
    $page = null;

    try {
        list($exists, $url) = Controller\doesWebsiteExist($url);
        Controller\normalizeUrl($url);

        $page = Database\Webpage::fromDB($url);
        $page->incrementVisits();
    }
    catch(Exception $e) {
    }
?>

<?php if ($page !== null): ?>
    <iframe src="<?= "/archives/{$page->WID}/index.php" ?>" scrolling="no"></iframe>

    <form action="#" method="POST">
        <input type="hidden" name="page_url" value="<?= $url ?>">
        <input type="submit" value="Archive Now!">
    </form>
    <!-- Button to add to list -->
    <!-- Button to delete -->

    <h2>Archives by date:</h2>
    <?php
        foreach ($page->allArchives() as $page) {
            include __DIR__ . '/item.php';
        }
        include_once __DIR__ . '/item_show.php';
    ?>

<?php elseif(!$exists): ?>
    <h2>"<?= $url ?>" Does not exist!</h2>
    <p>Submit another request or check the spelling of the site and try again</p>
    <a href="/">Go back!</a>


<?php else: ?>
    <h2>"<?= $url ?>" hasn't been archived yet!</h2>
    <form action="#" method="POST">
        <input type="hidden" name="page_url" value="<?= $url ?>">
        <input type="submit" value="Archive Now!">
    </form>

<?php endif; ?>