From 562fb6c0be9b48ddab40e198e36b1f0252354b4b Mon Sep 17 00:00:00 2001 From: marsooooo Date: Fri, 12 Apr 2024 15:48:47 +0200 Subject: [PATCH] Fixes #2147 Add style elements to generated page Updated generated html code so it fits the design Added warning triangle icon as svg Page now hides the login button in case user is already logged in --- include/functions_html.inc.php | 24 ++++++++++++++++++------ themes/default/icon/warning-triangle.svg | 3 +++ 2 files changed, 21 insertions(+), 6 deletions(-) create mode 100644 themes/default/icon/warning-triangle.svg diff --git a/include/functions_html.inc.php b/include/functions_html.inc.php index bf838cfed..b8620f80a 100644 --- a/include/functions_html.inc.php +++ b/include/functions_html.inc.php @@ -255,7 +255,7 @@ function tag_alpha_compare($a, $b) } /** - * Exits the current script (or redirect to login page if not logged). + * Exits the current script. */ function access_denied() { @@ -265,14 +265,19 @@ function access_denied() get_root_url().'identification.php?redirect=' .urlencode(urlencode($_SERVER['REQUEST_URI'])); + $access_denied_html = + ''. + '
'. + '
'. + 'warning-triangle'. + '

'.l10n('You are not authorized to access the requested page').'

'; + if ( isset($user) and !is_a_guest() ) { set_status_header(401); - echo ''; - echo '
'.l10n('You are not authorized to access the requested page').'
'; - echo ''.l10n('Identification').' '; - echo ''.l10n('Home').'
'; + echo $access_denied_html; + echo ''.l10n('Home').'
'; echo str_repeat( ' ', 512); //IE6 doesn't error output if below a size exit(); } @@ -282,10 +287,17 @@ function access_denied() } else { - redirect_html($login_url); + set_status_header(401); + + echo $access_denied_html; + echo ''.l10n('Identification').''; + echo ''.l10n('Home').''; + echo str_repeat( ' ', 512); //IE6 doesn't error output if below a size + exit(); } } + /** * Exits the current script with 403 code. * @todo nice display if $template loaded diff --git a/themes/default/icon/warning-triangle.svg b/themes/default/icon/warning-triangle.svg new file mode 100644 index 000000000..eb80354f5 --- /dev/null +++ b/themes/default/icon/warning-triangle.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file