mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-03-28 17:42:57 +01:00
fixes #2434 always redirect server-side, not browser-side"
... this will avoid to try loading theme templates (with unset variables)
This commit is contained in:
@@ -261,35 +261,23 @@ function access_denied()
|
|||||||
{
|
{
|
||||||
global $user, $conf;
|
global $user, $conf;
|
||||||
|
|
||||||
$login_url =
|
|
||||||
get_root_url().'identification.php?redirect='
|
|
||||||
.urlencode(urlencode($_SERVER['REQUEST_URI']));
|
|
||||||
|
|
||||||
$access_denied_html =
|
|
||||||
'<meta http-equiv="Content-Type" content="text/html; charset=utf-8">'.
|
|
||||||
'<link rel="shortcut icon" type="image/x-icon" href="themes/default/icon/favicon.ico">'.
|
|
||||||
'<div style="display: flex; justify-content: center;align-items: center;height: 100vh;margin: 0;color: #3C3C3C;font-family: \'Open Sans\', sans-serif;font-size: 20px;font-style: normal;font-weight: 600;line-height: normal;">'.
|
|
||||||
'<div style="text-align:center;">'.
|
|
||||||
'<img src="themes/default/icon/warning-triangle.svg" alt="warning-triangle" >'.
|
|
||||||
'<p style="max-width: 400px; margin-top 20px;">'.l10n('You are not authorized to access the requested page').'</p>';
|
|
||||||
|
|
||||||
if ( isset($user) and !is_a_guest() )
|
if ( isset($user) and !is_a_guest() )
|
||||||
{
|
{
|
||||||
set_status_header(401);
|
set_status_header(401);
|
||||||
|
|
||||||
echo $access_denied_html;
|
echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
echo '<a href="'.make_index_url().'" style="display: inline-block;padding: 10px 20px;margin: 10px;margin-top: 50px;border-radius: 7px;cursor: pointer;width: 150px;background-color: #F77000;color: #fff;text-decoration: none;border: 2px solid #F77000;">'.l10n('Home').'</a></div></div>';
|
<link rel="shortcut icon" type="image/x-icon" href="themes/default/icon/favicon.ico">
|
||||||
echo str_repeat( ' ', 512); //IE6 doesn't error output if below a size
|
<div style="display: flex; justify-content: center;align-items: center;height: 100vh;margin: 0;color: #3C3C3C;font-family: \'Open Sans\', sans-serif;font-size: 20px;font-style: normal;font-weight: 600;line-height: normal;">
|
||||||
|
<div style="text-align:center;">
|
||||||
|
<img src="themes/default/icon/warning-triangle.svg" alt="warning-triangle" >
|
||||||
|
<p style="max-width: 400px; margin-top 20px;">'.l10n('You are not authorized to access the requested page').'</p>
|
||||||
|
<a href="'.make_index_url().'" style="display: inline-block;padding: 10px 20px;margin: 10px;margin-top: 50px;border-radius: 7px;cursor: pointer;width: 150px;background-color: #F77000;color: #fff;text-decoration: none;border: 2px solid #F77000;">'.l10n('Home').'</a>
|
||||||
|
</div>
|
||||||
|
</div>';
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
elseif (!$conf['guest_access'] and is_a_guest())
|
|
||||||
{
|
redirect_http(get_root_url().'identification.php?redirect='.urlencode(urlencode($_SERVER['REQUEST_URI'])));
|
||||||
redirect_http($login_url);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
redirect_html($login_url);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user