mirror of
https://github.com/claradex/nativegallery.git
synced 2024-11-15 03:31:10 +03:00
add 404 page
This commit is contained in:
parent
2517f33542
commit
390362831e
4 changed files with 37 additions and 2 deletions
20
app/Controllers/ExceptionRegister.php
Normal file
20
app/Controllers/ExceptionRegister.php
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
<?php
|
||||||
|
namespace App\Controllers;
|
||||||
|
use \App\Services\{DB, Json};
|
||||||
|
use \App\Core\Router;
|
||||||
|
use \App\Core\Page;
|
||||||
|
|
||||||
|
class ExceptionRegister
|
||||||
|
{
|
||||||
|
public static function resolve($httpcode, $corecode) {
|
||||||
|
return Page::set('Errors/'.$corecode);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function notfound() {
|
||||||
|
Page::set('Errors/404');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -34,7 +34,7 @@ class Routes
|
||||||
Router::post('/api/photo/getcomments/$id', 'ApiController@photocommentload');
|
Router::post('/api/photo/getcomments/$id', 'ApiController@photocommentload');
|
||||||
Router::get('/api/photo/vote', 'ApiController@photovote');
|
Router::get('/api/photo/vote', 'ApiController@photovote');
|
||||||
Router::get('/api/photo/comment/rate', 'ApiController@photocommentvote');
|
Router::get('/api/photo/comment/rate', 'ApiController@photocommentvote');
|
||||||
|
Router::get('/404', 'ExceptionRegister@notfound');
|
||||||
} else {
|
} else {
|
||||||
Router::redirect('/login?return='.$_SERVER['HTTP_REFERER']);
|
Router::redirect('/login?return='.$_SERVER['HTTP_REFERER']);
|
||||||
}
|
}
|
||||||
|
|
BIN
static/img/pnp.jpg
Normal file
BIN
static/img/pnp.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 22 KiB |
|
@ -5,7 +5,10 @@ use App\Models\{User, Vote, Comment};
|
||||||
|
|
||||||
$id = explode('/', $_SERVER['REQUEST_URI'])[2];
|
$id = explode('/', $_SERVER['REQUEST_URI'])[2];
|
||||||
$photo = new \App\Models\Photo($id);
|
$photo = new \App\Models\Photo($id);
|
||||||
|
if ($photo->i('id') !== null) {
|
||||||
$photouser = new \App\Models\User($photo->i('user_id'));
|
$photouser = new \App\Models\User($photo->i('user_id'));
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
|
@ -54,6 +57,9 @@ $photouser = new \App\Models\User($photo->i('user_id'));
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<td class="main">
|
<td class="main">
|
||||||
|
<?php
|
||||||
|
if ($photo->i('id') !== null) {
|
||||||
|
?>
|
||||||
<center>
|
<center>
|
||||||
|
|
||||||
|
|
||||||
|
@ -288,6 +294,15 @@ marker.bindPopup("<b>Выбранная точка</b>").openPopup();
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<?php } else { ?>
|
||||||
|
<center>
|
||||||
|
<h1>Изображение не найдено</h1>
|
||||||
|
<div class="p20w" style="margin-bottom:20px; padding:10px 30px">
|
||||||
|
<img src="/static/img/pnp.jpg" alt="Пусто" width="400" height="205" border="0">
|
||||||
|
<p>Изображения с таким номером нет на сайте.<br />Может быть, его здесь никогда и не было.<br />Если Вы уверены, что что-то здесь всё-таки было, значит, администратор по каким-то причинам это удалил.</p>
|
||||||
|
</div>
|
||||||
|
</center>
|
||||||
|
<?php } ?>
|
||||||
<tr>
|
<tr>
|
||||||
<?php include($_SERVER['DOCUMENT_ROOT'] . '/views/components/Footer.php'); ?>
|
<?php include($_SERVER['DOCUMENT_ROOT'] . '/views/components/Footer.php'); ?>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
Loading…
Reference in a new issue