This commit is contained in:
themohooks 2024-07-18 16:13:50 +03:00
parent dd23f9f0e2
commit 2efc146a7e
7 changed files with 43 additions and 7 deletions

1
.gitignore vendored
View file

@ -11,3 +11,4 @@ ngallery.yaml
/views/pages/t.php /views/pages/t.php
views/pages/t.php views/pages/t.php
rules.txt rules.txt
rules.txt

View file

@ -12,7 +12,7 @@ class SetVisibility
{ {
public function __construct() public function __construct()
{ {
DB::query('UPDATE photos SET moderated=:mod WHERE id=:id', array(':id'=>$_GET['id'], ':mod'=>$_GET['mod'])); DB::query('UPDATE photos SET moderated=:mod, timeupload=:time WHERE id=:id', array(':id'=>$_GET['id'], ':mod'=>$_GET['mod'], ':time'=>time()));
header('Location: ' . $_SERVER['HTTP_REFERER']); header('Location: ' . $_SERVER['HTTP_REFERER']);
} }
} }

View file

@ -42,7 +42,7 @@ class Routes
Router::get('/api/photo/comment/rate', 'ApiController@photocommentvote'); Router::get('/api/photo/comment/rate', 'ApiController@photocommentvote');
if ($user->i('admin') > 0) { if ($user->i('admin') > 0) {
Router::any('/admin', 'AdminController@index'); Router::any('/admin', 'AdminController@index');
Router::any('/api/admin/images/setvisibility', 'AdminController@adminsetvis'); Router::any('/api/admin/images/setvisibility', 'ApiController@adminsetvis');
} }
Router::get('/logout', 'MainController@logout'); Router::get('/logout', 'MainController@logout');
Router::get('/404', 'ExceptionRegister@notfound'); Router::get('/404', 'ExceptionRegister@notfound');

View file

@ -5,12 +5,12 @@ use \App\Core\Page;
<ul class="list-unstyled fw-normal pb-1 small"> <ul class="list-unstyled fw-normal pb-1 small">
<li><a style="font-size: 17.2px; margin-bottom: 15px; color: <?php if (!Page::exists('Settings/' . $_GET['type']) || !isset($_GET['type'])) { ?> #3862eb <?php } else { ?> #aca8a9 <?php } ?> !important; font-weight: 500;" href="/settings" class="d-inline-flex align-items-center rounded active text-black" aria-current="page"> <li><a style="font-size: 17.2px; margin-bottom: 15px; color: <?php if (!Page::exists('Admin/' . $_GET['type']) || !isset($_GET['type'])) { ?> #3862eb <?php } else { ?> #aca8a9 <?php } ?> !important; font-weight: 500;" href="/admin" class="d-inline-flex align-items-center rounded active text-black" aria-current="page">
<div style="border-left:3px solid #ffffff00; margin-left: -25px; margin-right: 20px; height:20px; border-radius: 500px;"></div> <div style="border-left:3px solid #ffffff00; margin-left: -25px; margin-right: 20px; height:20px; border-radius: 500px;"></div>
<svg style="margin-right: 10px; margin-left: -12px; margin-bottom: -5px;" xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px" fill="<?php if (!Page::exists('Settings/' . $_GET['type']) || !isset($_GET['type'])) { ?> #3862eb <?php } else { ?> #aca8a9 <?php } ?>"> <svg style="margin-right: 10px; margin-left: -12px; margin-bottom: -5px;" xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px" fill="<?php if (!Page::exists('Admin/' . $_GET['type']) || !isset($_GET['type'])) { ?> #3862eb <?php } else { ?> #aca8a9 <?php } ?>">
<g> <g>
<path d="M0,0h24v24H0V0z" fill="none" /> <path d="M0,0h24v24H0V0z" fill="none" />
</g> </g>

View file

@ -1,5 +1,14 @@
<?php <?php
use App\Services\{Router, Auth}; use App\Services\{Router, Auth};
$user = new \App\Models\User(Auth::userid());
if (!isset($_GET['type']) || $_GET['type'] != 'Photo') {
if ($user->i('admin') === 2) {
header('Location: ?type=Photo');
}
}
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<html lang="ru"> <html lang="ru">

View file

@ -8,6 +8,32 @@ use \App\Models\User;
<tr> <tr>
<style>
#sbmt {
display: inline-block;
box-sizing: border-box;
vertical-align: middle;
cursor: pointer;
position: relative;
padding: 2px 15px 3px;
height: auto;
text-align: center;
font-family: var(--narrow-font);
font-size: 17px;
font-weight: bold;
color: var(--theme-fg-color);
background-color: #777;
background-color: var(--theme-bg-color);
transition: none;
border: none;
user-select: none;
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
border-radius: 0;
-webkit-border-radius: 0;
}
</style>
<td class="main"> <td class="main">
<h1>Журнал</h1> <h1>Журнал</h1>
<script src="/js/diff.js"></script> <script src="/js/diff.js"></script>
@ -57,7 +83,7 @@ use \App\Models\User;
<td class="c"> <td class="c">
'; ';
if ($p['moderated'] === 0) { if ($p['moderated'] === 0) {
echo ' <div class="cmt-submit"><input type="submit" value="Принять" id="sbmt"></div><div style="font-size: 11px;"><input style="background-color:red !important; margin-top: 15px;" type="submit" value="Отклонить" id="sbmt"></div>'; echo ' <div class="cmt-submit"><a href="/api/admin/images/setvisibility?id='.$p['id'].'&mod=1" id="sbmt">Принять</a></div><div style="font-size: 11px;"><a href="/api/admin/images/setvisibility?id='.$p['id'].'&mod=1" style="background-color:red !important; margin-top: 15px;" type="submit" id="sbmt">Отклонить</a></div>';
} }
echo ' echo '
</td>'; </td>';

View file

@ -25,7 +25,7 @@ use \App\Models\User;
<?php <?php
$myfile = fopen($_SERVER['DOCUMENT_ROOT'].'/rules.txt', "r") or die("Unable to open file!"); $myfile = fopen($_SERVER['DOCUMENT_ROOT'].'/rules.txt', "r") or die("Unable to open file!");
echo fread($myfile,filesize($_SERVER['DOCUMENT_ROOT'].'/rules.txt')); echo nl2br(fread($myfile,filesize($_SERVER['DOCUMENT_ROOT'].'/rules.txt')));
fclose($myfile); fclose($myfile);
?> ?>
</div> </div>