From bf17b193094c24dd1e4e422387415abfd8b3d536 Mon Sep 17 00:00:00 2001 From: Ivor Barhansky Date: Fri, 8 Dec 2023 18:14:29 +0200 Subject: [PATCH] Cleaned up the code in main.php and _mod.php to simplify the handling of user roles and permissions. The previous alignment-based role assignments have been streamlined into a single "moderation" action. --- main.php | 6 +----- modules_data/_mod.php | 47 +++++++++++++++++-------------------------- 2 files changed, 19 insertions(+), 34 deletions(-) diff --git a/main.php b/main.php index 19ba37b5..f87dd3f4 100644 --- a/main.php +++ b/main.php @@ -381,11 +381,7 @@ if (isset($_GET['security']) && !isset($u->tfer['id']) && $trololo == 1) { require_once('modules_data/_friends.php'); } elseif (($u->info['admin'] > 0 || $u->info['level'] > 7 || $u->info['align'] == 50) && isset($_GET['notepad']) && !isset($u->tfer['id'])) { require_once('modules_data/notepad.php'); -} elseif ((($u->info['align'] > 1 && $u->info['align'] < 2) || $u->info['admin'] > 0) && isset($_GET['light']) && !isset($u->tfer['id'])) { - require_once('modules_data/_mod.php'); -} elseif ((($u->info['align'] > 3 && $u->info['align'] < 4) || $u->info['admin'] > 0) && isset($_GET['dark']) && !isset($u->tfer['id'])) { - require_once('modules_data/_mod.php'); -} elseif (isset($_GET['admin']) && $u->info['admin'] > 0) { +} elseif (isset($_GET['moderation'])) { require_once('modules_data/_mod.php'); } elseif (isset($_GET['vip']) && !isset($u->tfer['id'])) { require_once('modules_data/vip.php'); diff --git a/modules_data/_mod.php b/modules_data/_mod.php index c4b57196..a7b6fb5f 100644 --- a/modules_data/_mod.php +++ b/modules_data/_mod.php @@ -11,6 +11,10 @@ if (!defined('GAME')) { $m = new Moderator($u->info['id']); +if (!$m->isModerator) { + return; +} + $rang = 'Модератор'; if (isset($_GET['remod'])) { @@ -21,8 +25,6 @@ if (isset($_GET['remod'])) { } } -$zv = [1 => 'light', 2 => 'admin', 3 => 'dark']; - $merror = ''; $uer = ''; @@ -86,20 +88,6 @@ if (!empty($_POST['marrypartner1']) && !empty($_POST['marrypartner2'])) { echo ''; -$p = mysql_fetch_array(mysql_query('SELECT align FROM `moder` WHERE `align` = "' . $u->info['align'] . '" LIMIT 1')); - -if (!$m->isModerator && $u->info['align'] != 1 && $u->info['align'] != 3) { - return; ######################### -} - -$a = floor($p['align']); -if ($u->info['admin'] > 0) { - $zv = $zv[2]; -} else { - $zv = $zv[$a]; -} - - $go = 0; if (isset($_GET['go'])) { $go = round($_GET['go']); @@ -111,8 +99,8 @@ if ($go == 3 && $u->info['admin'] > 0) {

Редактирование обучающих квестов

- - + + @@ -167,7 +155,7 @@ if ($go == 3 && $u->info['admin'] > 0) { $pl = Db::getRow('select * from an_quest where id = ?', [(int)$_GET['eq']]); } ?> -
+ #id: