commit
db36b8812d
3 changed files with 45 additions and 6 deletions
|
@ -1101,4 +1101,17 @@ div.dailyNoEntry {
|
||||||
ul.errors {
|
ul.errors {
|
||||||
color: red;
|
color: red;
|
||||||
float: left;
|
float: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 404 page */
|
||||||
|
.error-container {
|
||||||
|
|
||||||
|
margin: 50px;
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-container h1 {
|
||||||
|
text-decoration: none;
|
||||||
|
font-style: normal;
|
||||||
|
color: #80AD48;
|
||||||
|
}
|
||||||
|
|
19
index.php
19
index.php
|
@ -472,7 +472,7 @@ function ban_canLogin()
|
||||||
session_set_cookie_params(0,$cookiedir,$_SERVER['SERVER_NAME']); // 0 means "When browser closes"
|
session_set_cookie_params(0,$cookiedir,$_SERVER['SERVER_NAME']); // 0 means "When browser closes"
|
||||||
session_regenerate_id(true);
|
session_regenerate_id(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Optional redirect after login:
|
// Optional redirect after login:
|
||||||
if (isset($_GET['post'])) {
|
if (isset($_GET['post'])) {
|
||||||
$uri = '?post='. urlencode($_GET['post']);
|
$uri = '?post='. urlencode($_GET['post']);
|
||||||
|
@ -681,6 +681,18 @@ public function renderPage($page)
|
||||||
if ($this->tpl===false) $this->initialize(); // Lazy initialization
|
if ($this->tpl===false) $this->initialize(); // Lazy initialization
|
||||||
$this->tpl->draw($page);
|
$this->tpl->draw($page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render a 404 page (uses the template : tpl/404.tpl)
|
||||||
|
*
|
||||||
|
* usage : $PAGE->render404('The link was deleted')
|
||||||
|
* @param string $message A messate to display what is not found
|
||||||
|
*/
|
||||||
|
public function render404($message='The page you are trying to reach does not exist or has been deleted.') {
|
||||||
|
header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found');
|
||||||
|
$this->tpl->assign('error_message', $message);
|
||||||
|
$this->renderPage('404');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------
|
||||||
|
@ -1883,10 +1895,7 @@ function buildLinkList($PAGE,$LINKSDB)
|
||||||
$linksToDisplay = $LINKSDB->filter($search_type, $search_crits);
|
$linksToDisplay = $LINKSDB->filter($search_type, $search_crits);
|
||||||
|
|
||||||
if (count($linksToDisplay) == 0) {
|
if (count($linksToDisplay) == 0) {
|
||||||
header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found');
|
$PAGE->render404('The link you are trying to reach does not exist or has been deleted.');
|
||||||
echo '<h1>404 Not found.</h1>Oh crap.
|
|
||||||
The link you are trying to reach does not exist or has been deleted.';
|
|
||||||
echo '<br>Would you mind <a href="?">clicking here</a>?';
|
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
17
tpl/404.html
Normal file
17
tpl/404.html
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
{include="includes"}
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="pageheader">
|
||||||
|
{include="page.header"}
|
||||||
|
</div>
|
||||||
|
<div class="error-container">
|
||||||
|
<h1>404 Not found <small>Oh crap!</small></h1>
|
||||||
|
<p>{$error_message}</p>
|
||||||
|
<p>Would you mind <a href="?">clicking here</a> ?</p>
|
||||||
|
</div>
|
||||||
|
{include="page.footer"}
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Reference in a new issue