From 6eeb984a2cee866592cee9a55a0fe8864cb07464 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sun, 26 Jan 2025 22:55:10 +0200 Subject: feat: Separate topbar files --- controllers/archive.php | 92 +++---------------------------------------------- 1 file changed, 4 insertions(+), 88 deletions(-) (limited to 'controllers') diff --git a/controllers/archive.php b/controllers/archive.php index 6b6098c..c1ff4a2 100644 --- a/controllers/archive.php +++ b/controllers/archive.php @@ -355,93 +355,10 @@ class DownloadPage { } function getArchiveTop() : array { - $content = 'console.log(\"Debug Objects: " . $output . "\" );"; - } - debugPrintToConsole("This is necessary for some reason, without it the content is not actually shown!"); - - $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); - - echo "
"; - echo "
"; - echo "Title: $currentPage->Title"; - echo "Url: $currentPage->URL"; - echo "Date of archival: $currentPage->Date"; - echo "Visits: $currentPage->Visits"; - echo "Requested by: $requesterUsername->Username"; - - echo "
"; - if ($previousPageId != 0) { - echo "Previous version"; - } - if ($nextPageId != 0) { - echo "Next version"; - } - echo "
"; - echo "
"; - ?>'; - - $style = ' - .navbar { - display: flex; - justify-content: space-between; - align-items: center; - background-color: #343a40; - color: #ffffff; - padding: 10px; - border-bottom: 1px solid #ccc; - width: 100%; - position: fixed; - top: 0; - left: 0; - z-index: 1000; - } - - .navbar-info { - display: flex; - justify-content: center; - flex-grow: 1; - } - - .navbar-info span { - margin-right: 15px; - } - - .navbar-links { - display: flex; - gap: 20px; - } - - .navbar a { - text-decoration: none; - color: #007bff; - } - - .navbar a:hover { - text-decoration: underline; - color: #66b3ff; - } - - /* Add some margin to the body to prevent content from being hidden behind the navbar */ - body { - margin-top: 60px; - } - '; - return array($content, $style); + return array( + file_get_contents(__DIR__ . '/../views/archive/topbar.php'), + file_get_contents(__DIR__ . '/../views/archive/topbar.css') + ); } function createArchive($simular_pages) : void { @@ -467,7 +384,6 @@ class DownloadPage { // Add the header for the archives list($archive_top, $archive_top_style) = $this->getArchiveTop(); $phpTag = $dom->createElement('script', $archive_top); - $phpTag->setAttribute('type', 'text/php'); // Set the type to PHP $body = $dom->getElementsByTagName('body')->item(0); $body->appendChild($phpTag); -- cgit v1.2.3