From f2126d34818b8741a4e318002ccae0fba9ef78b1 Mon Sep 17 00:00:00 2001 From: David Ball Date: Thu, 23 May 2024 21:46:13 -0400 Subject: [PATCH] Added defunct archived.php code. --- archived.php | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 archived.php diff --git a/archived.php b/archived.php new file mode 100644 index 00000000..57539fbb --- /dev/null +++ b/archived.php @@ -0,0 +1,42 @@ +'.' '. +'.__archived__content__, .__archived__content__ p, .__archived__content__ h2 { background-color: #007bff; color: #fff; font-family: "Saira Extra Condensed", Verdana, Arial, sans-serif; text-align: center; }'.' '. +'.__archived__content__ { padding: 0.5rem; }'.' '. +'.__archived__content__:first-of-type { margin-top: 0rem; margin-bottom: 1rem; }'.' '. +'.__archived__content__:last-of-type { margin-top: 1rem; margin-bottom: 0; }'.' '. +'.__archived__content__, .__archived__content__ p { font-size: 1.2rem; }'.' '. +'.__archived__content__, .__archived__content__ h2 { font-size: 2rem; }'.' '. +'.__archived__content__ a:link, .__archived__content__ a:visited { color: #fff; }'.' '. +'.__archived__content__ a:hover, .__archived__content__ a:active { text-decoration: none; }'. +''; +$headFooterContent = ''; +$bodyHeaderContent = '

Archived Web Site

This is an archived version of the original website. Some features may not be functional. Do not submit any personal information to this archived website.

Current Working Directory List | Back to Archive Index

'; +$bodyFooterContent = '

This is an archived version of the original website. Some features may not be functional. Do not submit any personal information to this archived website.

Current Working Directory Listing | Back to Archive Index

'; + +// Get the requested HTML file +$requestedFile = $_SERVER['REQUEST_URI']; + +// Validate and sanitize the requested file path to ensure it's within the intended directory. +$filePath = realpath($htmlDir . DIRECTORY_SEPARATOR . $requestedFile); + +if (strpos($filePath, $htmlDir) === 0 && is_file($filePath)) { + + // Read the HTML file + $htmlContent = file_get_contents($filePath); + + // Add archive branding + $maxReplacements = 1; // do not replace more than one + $htmlContent = preg_replace('/]*>/i', '$0' . $headHeaderContent, $htmlContent, $maxReplacements); + $htmlContent = str_replace('', $headFooterContent . '', $htmlContent); + $htmlContent = preg_replace('/]*>/i', '$0' . $bodyHeaderContent, $htmlContent, $maxReplacements); + $htmlContent = str_replace('', $bodyFooterContent . '', $htmlContent); + + // Output the modified HTML content + echo $htmlContent; +} +