add some pages

This commit is contained in:
themohooks 2024-07-08 21:31:59 +03:00
parent 390362831e
commit bc57f6b97c
9 changed files with 70 additions and 47 deletions

View file

@ -98,7 +98,7 @@ class Register
)
);
DB::query('INSERT INTO users VALUES (\'0\', :username, :email, :password, :photourl, 5, :online, :content)', array(':username' => ltrim($username), ':password' => password_hash(ltrim($password), PASSWORD_BCRYPT), ':photourl'=>'/static/img/avatar.png', ':email' => $email, ':content' => $content, ':online'=>time()));
DB::query('INSERT INTO users VALUES (\'0\', :username, :email, :password, :photourl, 5, 0, :online, :content)', array(':username' => ltrim($username), ':password' => password_hash(ltrim($password), PASSWORD_BCRYPT), ':photourl'=>'/static/img/avatar.png', ':email' => $email, ':content' => $content, ':online'=>time()));
$cstrong = True;
$token = GenerateRandomStr::gen_uuid();
$user_id = DB::query('SELECT id FROM users WHERE username=:username', array(':username' => $username))[0]['id'];

View file

@ -16,6 +16,11 @@ class MainController
{
Page::set('Main');
}
public static function about()
{
Page::set('About');
}
public static function logout()

View file

@ -19,6 +19,7 @@ class Routes
Router::get('/author/$id', 'ProfileController@i');
Router::post('/api/login', 'ApiController@login');
Router::post('/api/register', 'ApiController@register');
Router::get('/about', 'MainController@about');
@ -34,6 +35,7 @@ class Routes
Router::post('/api/photo/getcomments/$id', 'ApiController@photocommentload');
Router::get('/api/photo/vote', 'ApiController@photovote');
Router::get('/api/photo/comment/rate', 'ApiController@photocommentvote');
Router::get('/logout', 'MainController@logout');
Router::get('/404', 'ExceptionRegister@notfound');
} else {
Router::redirect('/login?return='.$_SERVER['HTTP_REFERER']);

View file

@ -26,11 +26,10 @@ class App
Page::set('Errors/ServerDown');
}
} catch (PDOException $ex) {
echo $ex;
Page::set('Errors/DB_42000');
echo '<details><summary class="p20 s5" style="border:none; margin:0 -20px"><b>Произошла ошибка MySQL</b></summary>'.nl2br($ex).'</details>';
} catch (Exception $ex) {
echo $ex;
Page::set('Errors/DB_42000');
echo '<details><summary class="p20 s5" style="border:none; margin:0 -20px"><b>Произошла скриптовая ошибка PHP</b></summary>'.nl2br($ex).'</details>';
}
} else {
Page::set('Errors/Problems');

BIN
static/img/220.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
static/img/go-home.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

56
views/pages/About.php Normal file
View file

@ -0,0 +1,56 @@
<?php
use \App\Services\{Auth, DB, Date};
use \App\Models\User;
?>
<!DOCTYPE html>
<html lang="ru">
<head>
<?php include($_SERVER['DOCUMENT_ROOT'] . '/views/components/LoadHead.php'); ?>
</head>
<body>
<div id="backgr"></div>
<table class="tmain">
<?php include($_SERVER['DOCUMENT_ROOT'] . '/views/components/Navbar.php'); ?>
<tr>
<td class="main">
<h1>О сервере <b><?= NGALLERY['root']['title'] ?></b></h1>
<p><?=NGALLERY['root']['description']?></p>
<table width="100%">
<div class="p20">
<h4><img src="/static/img/go-home.png">Общая информация</h4>
<ul class="straight">
<li>Зарегистрировано пользователей: <b><?=DB::query('SELECT COUNT(*) FROM users')[0]['COUNT(*)'];?></b></li>
<li>Опубликовано фотографий: <b><?=DB::query('SELECT COUNT(*) FROM photos')[0]['COUNT(*)'];?></b></li>
</ul>
</div>
<div class="p20">
<h4><img src="/static/img/220.ico">Администраторы</h4>
<ul style="list-style: none; margin: 0; padding: 0;">
<?php
$admins = DB::query('SELECT * FROM users WHERE admin=1');
foreach ($admins as $a) {
echo '<li><b><a href="/author/'.$a['id'].'/"><img src="'.$a['photourl'].'" width="32" style="border-radius: 3px; margin-right: 5px;">'.$a['username'].'</a></b></li>';
}
?>
</ul>
</div>
</table>
</td>
</tr>
<tr>
<?php include($_SERVER['DOCUMENT_ROOT'] . '/views/components/Footer.php'); ?>
</tr>
</table>
</body>
</html>

File diff suppressed because one or more lines are too long

View file

@ -293,7 +293,7 @@ marker.bindPopup("<b>Выбранная точка</b>").openPopup();
</div>
</div>
</td>
</tr>
</tr></tbody></table>
<?php } else { ?>
<center>
<h1>Изображение не найдено</h1>
@ -303,9 +303,11 @@ marker.bindPopup("<b>Выбранная точка</b>").openPopup();
</div>
</center>
<?php } ?>
<table width="100%" style="margin-top: 30px;"><tbody>
<tr>
<?php include($_SERVER['DOCUMENT_ROOT'] . '/views/components/Footer.php'); ?>
</tr>
</tbody>
</table>
<script>
$(document).ready(function() {