Update warnings and http response templates

This commit is contained in:
DariusIII
2017-08-30 12:42:23 +02:00
parent dc90af1107
commit cd7152c684
10 changed files with 101 additions and 90 deletions
+1
View File
@@ -1,4 +1,5 @@
2017-08-30 DariusIII
* Chg: Update warnings and http response templates
* Chg: Disable caching for php-tmdb
* Chg: Update Tmux class, use Models/Tmux and change usage of $pdo variable
* Chg: Update bytesToSizeString function in Utility class
+10 -6
View File
@@ -211,12 +211,7 @@ class BasePage
public function showFloodWarning($seconds = 5): void
{
header('Retry-After: ' . $seconds);
$this->show503(
sprintf(
'Too many requests!</p><p>You must wait <b>%s seconds</b> before trying again.',
$seconds
)
);
$this->show503();
}
/**
@@ -291,6 +286,15 @@ class BasePage
die(view('errors.maintenance'));
}
/**
* Show Security token mismatch page.
*/
public function showTokenError(): void
{
header('HTTP/1.1 503 Service Temporarily Unavailable');
die(view('errors.tokenError'));
}
/**
* @param string $retry
*/
+1 -1
View File
@@ -41,7 +41,7 @@ if (!isset($_POST['username']) || !isset($_POST['password'])) {
$logging->LogBadPasswd($username, $_SERVER['REMOTE_ADDR']);
}
} else {
$page->show503('Security token mismatch!');
$page->showTokenError();
}
}
+1 -1
View File
@@ -84,7 +84,7 @@ if ($showRegister === 1) {
}
}
} else {
$page->show503('Security token mismatch');
$page->showTokenError();
}
}
break;
+7 -41
View File
@@ -1,43 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<title>HTTP/1.1 404 Not Found</title>
@extends('errors.layout)
<link href="https://fonts.googleapis.com/css?family=Lato:100" rel="stylesheet" type="text/css">
@section('title')
HTTP/1.1 404 Not Found
@endsection
<style>
html, body {
height: 100%;
}
body {
margin: 0;
padding: 0;
width: 100%;
color: #B0BEC5;
display: table;
font-weight: 100;
font-family: \'Lato\', sans-serif;
}
.container {
text-align: center;
display: table-cell;
vertical-align: middle;
}
.content {
text-align: center;
display: inline-block;
}
.title {
font-size: 72px;
margin-bottom: 40px;
}
</style>
</head>
<body>
<div class="container">
<div class="content">
<div class="title">We could not find page you are looking for. <br> Monkeys are hard at work to find it for you! <br> Or you could try on your own. </div>
</div>
</div>
</body>
</html>
@section('content')
We could not find page you are looking for. <br> Monkeys are hard at work to find it for you! <br> Or you could try on your own.
@endsection
+7 -41
View File
@@ -1,43 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<title>Be right back.</title>
@extends('errors.layout)
<link href="https://fonts.googleapis.com/css?family=Lato:100" rel="stylesheet" type="text/css">
@section('title')
Be right back.
@endsection
<style>
html, body {
height: 100%;
}
body {
margin: 0;
padding: 0;
width: 100%;
color: #B0BEC5;
display: table;
font-weight: 100;
font-family: \'Lato\', sans-serif;
}
.container {
text-align: center;
display: table-cell;
vertical-align: middle;
}
.content {
text-align: center;
display: inline-block;
}
.title {
font-size: 72px;
margin-bottom: 40px;
}
</style>
</head>
<body>
<div class="container">
<div class="content">
<div class="title">Service temporarily unavailable. Please try again later!</div>
</div>
</div>
</body>
</html>
@section('content')
Service temporarily unavailable. Please try again later!
@endsection
+9
View File
@@ -0,0 +1,9 @@
@extends('errors.layout)
@section('title')
Too many requests.
@endsection
@section('content')
Too many requests, retry after 5 seconds!
@endsection
+47
View File
@@ -0,0 +1,47 @@
<!DOCTYPE html>
<html>
<head>
<title>
@yield('title')
</title>
<link href="https://fonts.googleapis.com/css?family=Lato:100" rel="stylesheet" type="text/css">
<style>
html, body {
height: 100%;
}
body {
margin: 0;
padding: 0;
width: 100%;
color: #B0BEC5;
display: table;
font-weight: 100;
font-family: \'Lato\', sans-serif;
}
.container {
text-align: center;
display: table-cell;
vertical-align: middle;
}
.content {
text-align: center;
display: inline-block;
}
.title {
font-size: 72px;
margin-bottom: 40px;
}
</style>
</head>
<body>
<div class="container">
@yield('content')
</div>
</body>
</html>
@@ -1,3 +1,12 @@
@extends('errors.layout)
@section('title')
Be right back.
@endsection
@section('content')
We are currently performing maintenance. Please try again later!
@endsection
<!DOCTYPE html>
<html>
<head>
@@ -0,0 +1,9 @@
@extends('errors.layout)
@section('title')
Security token mismatch
@endsection
@section('content')
Security token mismatch!
@endsection