add rules support

This commit is contained in:
themohooks 2024-07-18 14:24:19 +03:00
parent dc2d080cdb
commit 4aae0ec50e
5 changed files with 54 additions and 1 deletions

View file

@ -21,6 +21,11 @@ class MainController
{ {
Page::set('About'); Page::set('About');
}
public static function rules()
{
Page::set('Rules');
} }
public static function logout() public static function logout()

View file

@ -20,6 +20,7 @@ class Routes
Router::post('/api/login', 'ApiController@login'); Router::post('/api/login', 'ApiController@login');
Router::post('/api/register', 'ApiController@register'); Router::post('/api/register', 'ApiController@register');
Router::get('/about', 'MainController@about'); Router::get('/about', 'MainController@about');
Router::get('/rules', 'MainController@rules');

1
rules.txt Normal file
View file

@ -0,0 +1 @@
Основные правила сайта.

View file

@ -36,6 +36,7 @@ if (Auth::userid() > 0) {
<div style="color:#e00" id="err_password"></div> <div style="color:#e00" id="err_password"></div>
<input type="button" id="regbtn" class="mf-button-wide" style="margin-top:15px" value="Зарегистрироваться"> <input type="button" id="regbtn" class="mf-button-wide" style="margin-top:15px" value="Зарегистрироваться">
<p>Регистрируясь на сервере <?=NGALLERY['root']['title']?>, вы <a href="/rules">принимаете его правила.</a></p>
</form><br><br> </form><br><br>
<br> <br>
@ -90,7 +91,7 @@ if (Auth::userid() > 0) {
</center> </center>
<?php } else { ?> <?php } else { ?>
<center> <center>
<h1>К сожалению, регистрация на сервере <?=$title?> запрещена.</h1> <h1>К сожалению, регистрация на сервере <?=NGALLERY['root']['title']?> запрещена.</h1>
</center? </center?
<?php } ?> <?php } ?>
</td> </td>

45
views/pages/Rules.php Normal file
View file

@ -0,0 +1,45 @@
<?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'); ?>
<td class="main">
<h1>Правила сайта</h1>
<div class="p20" style="padding:20px">
<?php
$myfile = fopen($_SERVER['DOCUMENT_ROOT'].'/rules.txt', "r") or die("Unable to open file!");
echo fread($myfile,filesize($_SERVER['DOCUMENT_ROOT'].'/rules.txt'));
fclose($myfile);
?>
</div>
</td>
</tr>
<tr>
<?php include($_SERVER['DOCUMENT_ROOT'] . '/views/components/Footer.php'); ?>
</tr>
</table>
</body>
</html>