From 8deafc754318b0e50b1fd3ac91e15fa8f2be3303 Mon Sep 17 00:00:00 2001 From: Alex Cabal Date: Tue, 24 Nov 2020 12:43:22 -0600 Subject: [PATCH] Add warnings pointing to latest manual version on all old manual pages --- lib/Manual.php | 23 +++++++++++++++++++++++ templates/OldManualVersionWarning.php | 7 +++++++ www/css/manual.css | 4 ++++ www/manual/index.php | 7 ++----- 4 files changed, 36 insertions(+), 5 deletions(-) create mode 100644 lib/Manual.php create mode 100644 templates/OldManualVersionWarning.php diff --git a/lib/Manual.php b/lib/Manual.php new file mode 100644 index 00000000..a7676f4a --- /dev/null +++ b/lib/Manual.php @@ -0,0 +1,23 @@ + + + + diff --git a/www/css/manual.css b/www/css/manual.css index 87c21697..f02d341a 100644 --- a/www/css/manual.css +++ b/www/css/manual.css @@ -643,6 +643,10 @@ figure code.css{ overflow-x: auto; } +main.manual aside.alert p{ + text-align: center; +} + @media(max-width: 1700px){ main.manual > article{ margin-left: 10rem; diff --git a/www/manual/index.php b/www/manual/index.php index 565e6d1b..9e2fb942 100644 --- a/www/manual/index.php +++ b/www/manual/index.php @@ -6,10 +6,7 @@ use function Safe\sort; // Redirect to the latest version of the manual -$dirs = glob(MANUAL_PATH . '/*', GLOB_ONLYDIR); -sort($dirs); - -$currentManual = str_replace(WEB_ROOT, '', $dirs[sizeof($dirs) - 1]); +$currentManual = Manual::GetLatestVersion(); $url = HttpInput::GetString('url', true, ''); $url = preg_replace('|^/|ius', '', $url); @@ -21,4 +18,4 @@ if($url != ''){ } http_response_code(302); -header('Location: ' . $currentManual . $url); +header('Location: /manual/' . $currentManual . $url);