Website Summary Files Commits Branches @commit @diff @stats
path: root / views / archive / index.php
diff options
context:
space:
mode:
Commitbfa238c056f31f36c00faad1c5995cbb8af3bd26 (patch)
Author
 Syndamia <kamen@syndamia.com>
2025-01-26 14:04:11 +0200
Committer
 Syndamia <kamen@syndamia.com>
2025-01-26 14:04:11 +0200
Filese35d6b33fff3e79ae905d7dad699134553a1292d /views/archive/index.php
nowayforward_human-bfa238c056f31f36c00faad1c5995cbb8af3bd26.tar
nowayforward_human-bfa238c056f31f36c00faad1c5995cbb8af3bd26.tar.gz
nowayforward_human-bfa238c056f31f36c00faad1c5995cbb8af3bd26.zip
Parentc36f74386bcbb19c13915fe3796cb757aa7d1845 (diff)
feat!: Rework all views to be used with the router
1 files changed, 17 insertions, 12 deletions
-rw-r--r--views/archive/index.php29
diff --git a/views/archive/index.php b/views/archive/index.php
index 64d6a77..4195eb2 100644
--- a/views/archive/index.php
+++ b/views/archive/index.php
@@ -1,16 +1,21 @@
<?php
- $title = $_GET["page_url"] . ' archive';
- include '../meta.php';
-
+ $exists = null;
$page = null;
- runController('archive');
+
+ try {
+ $page = Database\Webpage::fromDB($url);
+ $page->incrementVisits();
+ }
+ catch(Exception $e) {
+ $exists = Controller\doesWebsiteExist($url);
+ }
?>
<?php if ($page !== null): ?>
<iframe src="<?= "/archives/{$page->WID}" ?>" scrolling="no"></iframe>
- <form action="/sample_archive/index.php" method="POST">
- <input type="hidden" name="page_url" value="<?= $_GET["page_url"] ?>">
+ <form action="#" method="POST">
+ <input type="hidden" name="page_url" value="<?= $url ?>">
<input type="submit" value="Archive Now!">
</form>
<!-- Button to add to list -->
@@ -39,16 +44,16 @@
</section>
<?php endforeach; ?>
-<?php elseif(!doesWebsiteExist($_GET["page_url"])): ?>
- <h2>"<?= $_GET["page_url"] ?>" Does not exist!</h2>
+<?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="/home/index.php">Go back!</a>
+ <a href="/">Go back!</a>
<?php else: ?>
- <h2>"<?= $_GET["page_url"] ?>" hasn't been archived yet!</h2>
- <form action="/sample_archive/index.php" method="POST">
- <input type="hidden" name="page_url" value="<?= $_GET["page_url"] ?>">
+ <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>