@@ -253,7 +251,7 @@
- +

.

From 542a95d43772c6f5cc918e5d43a86d2468299324 Mon Sep 17 00:00:00 2001 From: paintballrefjosh Date: Sat, 1 Apr 2017 13:52:47 -0500 Subject: [PATCH 08/11] Fixed issue with TrinityCore server commands page Commands were not displayed properly. Updated the logic to pull the allowed commands based on user's current gmlevel. --- inc/server/server.commands.php | 21 ++++++++++++------- .../blizzlike/server/server.commands.php | 3 ++- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/inc/server/server.commands.php b/inc/server/server.commands.php index 0978100..5ebc3ef 100644 --- a/inc/server/server.commands.php +++ b/inc/server/server.commands.php @@ -35,12 +35,19 @@ { $userlevel = 0; } - - $permissions = $RDB->select("SELECT `rbac_linked_permissions`.`linkedId` FROM `rbac_linked_permissions` - LEFT JOIN `rbac_default_permissions` ON (`rbac_linked_permissions`.`id` = `rbac_default_permissions`.`permissionId`) - WHERE `rbac_default_permissions`.`secId` = <= $userlevel" - ); - $permissions = join(",", $permissions); - $alltopics = $WDB->select("SELECT * FROM `command` WHERE `permission` IN ($permissions) ORDER BY `name` ASC"); + $sql = "SELECT `rbac_linked_permissions`.`linkedId` FROM `rbac_linked_permissions` + LEFT JOIN `rbac_default_permissions` ON (`rbac_linked_permissions`.`id` BETWEEN `rbac_default_permissions`.`permissionId` + 4 AND 199) + WHERE `rbac_default_permissions`.`secId` <= $userlevel"; + $permissions = $RDB->select($sql); + + $permission_id = ""; + foreach($permissions as $row) + { + $permission_id .= $row['linkedId'].","; + } + $permission_id = substr($permission_id, 0, -1); + + $sql = "SELECT * FROM `command` WHERE `permission` IN ($permission_id) ORDER BY `name` ASC"; + $alltopics = $WDB->select($sql); } ?> \ No newline at end of file diff --git a/templates/blizzlike/server/server.commands.php b/templates/blizzlike/server/server.commands.php index b0476f7..3dca3a4 100644 --- a/templates/blizzlike/server/server.commands.php +++ b/templates/blizzlike/server/server.commands.php @@ -14,6 +14,7 @@ { $postnum++; if($hl=='alt')$hl=''; else $hl='alt'; + $topic_permission = $RDB->selectCell("SELECT `name` FROM `rbac_permissions` WHERE id IN (SELECT `id` FROM `rbac_linked_permissions` WHERE linkedId = ".$topic['permission'].")"); ?>