From 1ee6cd53872e6fb1ce8c183db556b44a4fc4cbf9 Mon Sep 17 00:00:00 2001 From: botanic Date: Mon, 8 Sep 2014 04:55:05 -0700 Subject: [PATCH] properly display permissions --- code/web/private_php/ams/autoload/helpers.php | 2 +- .../Domain_Management/Domain_Management.php | 8 ++- .../Domain_Management/templates/index.tpl | 50 ++++++++++++------- 3 files changed, 38 insertions(+), 22 deletions(-) diff --git a/code/web/private_php/ams/autoload/helpers.php b/code/web/private_php/ams/autoload/helpers.php index a66511820..07d2adf57 100644 --- a/code/web/private_php/ams/autoload/helpers.php +++ b/code/web/private_php/ams/autoload/helpers.php @@ -34,7 +34,7 @@ class Helpers { $smarty -> setCacheDir( $AMS_CACHEDIR ); $smarty -> setConfigDir( $SITEBASE . '/configs/' ); // turn smarty debugging on/off - $smarty -> debugging = false; + $smarty -> debugging = true; // caching must be disabled for multi-language support $smarty -> caching = false; $smarty -> cache_lifetime = 300; diff --git a/code/web/private_php/ams/plugins/Domain_Management/Domain_Management.php b/code/web/private_php/ams/plugins/Domain_Management/Domain_Management.php index 9b03b441c..6fb933b68 100644 --- a/code/web/private_php/ams/plugins/Domain_Management/Domain_Management.php +++ b/code/web/private_php/ams/plugins/Domain_Management/Domain_Management.php @@ -76,10 +76,14 @@ function domain_management_hook_get_db() if (isset($_GET['edit_domain'])){ //get permissions - $statement = $db->executeWithoutParams("SELECT * FROM `permission` WHERE `DomainId` = '".$rows[$_GET['edit_domain']-1]['domain_name']."'"); + $statement = $db->executeWithoutParams("SELECT * FROM `domain` WHERE `domain_id` = '".$_GET['edit_domain']."'"); + $rows = $statement->fetchAll(); + $domain_management_return_set['domains'] = $rows; + + $statement = $db->executeWithoutParams("SELECT * FROM `permission` WHERE `DomainId` = '".$_GET['edit_domain']."'"); $rows = $statement->fetchAll(); $domain_management_return_set['permissions'] = $rows; - + //get all users $pagination = new Pagination(WebUsers::getAllUsersQuery(),"web",10,"WebUsers"); $domain_management_return_set['userlist'] = Gui_Elements::make_table($pagination->getElements() , Array("getUId","getUsername","getEmail"), Array("id","username","email")); diff --git a/code/web/private_php/ams/plugins/Domain_Management/templates/index.tpl b/code/web/private_php/ams/plugins/Domain_Management/templates/index.tpl index 174ee0639..de30d54c8 100644 --- a/code/web/private_php/ams/plugins/Domain_Management/templates/index.tpl +++ b/code/web/private_php/ams/plugins/Domain_Management/templates/index.tpl @@ -6,7 +6,7 @@
-

{$hook_info['Domain_Management']['domains'][$smarty.get.edit_domain-1]['domain_name']}

+

{$hook_info['Domain_Management']['domains']['0']['domain_name']}

@@ -21,11 +21,23 @@ - {foreach from=$hook_info['Domain_Management']['userlist'] item=element} + {assign var=val value=0} + {foreach from=$hook_info['Domain_Management']['userlist'] item=element name=loop} {$element.id} {$element.username} - {$hook_info['Domain_Management']['permissions'][{$element.id}-1]['AccessPrivilege']} + + {if isset($hook_info['Domain_Management']['permissions'][{$val}]['UId']) and $smarty.foreach.loop.iteration eq $hook_info['Domain_Management']['permissions'][{$val}]['UId']} + {if $hook_info['Domain_Management']['permissions'][{$val}]['AccessPrivilege'] eq ''} + BANNED! + {else} + {$hook_info['Domain_Management']['permissions'][{$val}]['AccessPrivilege']} + {/if} + {assign var=val value=$val+1} + {else} + NO PERMISSIONS + {/if} +
Edit User Permissions @@ -50,13 +62,13 @@
- Domain Settings of '{$hook_info['Domain_Management']['domains'][$smarty.get.edit_domain-1]['domain_name']}' + Domain Settings of '{$hook_info['Domain_Management']['domains']['0']['domain_name']}'
- +
@@ -65,7 +77,7 @@
- +
@@ -74,10 +86,10 @@
@@ -86,7 +98,7 @@
- +
@@ -95,7 +107,7 @@
- +
@@ -104,7 +116,7 @@
- +
@@ -113,7 +125,7 @@
- +
@@ -122,7 +134,7 @@
- +
@@ -131,7 +143,7 @@
- +
@@ -140,7 +152,7 @@
- +
@@ -149,7 +161,7 @@
- +
@@ -158,7 +170,7 @@
- +