From f344a9ec6dea3c7b483361ce4c681c191038adc1 Mon Sep 17 00:00:00 2001 From: niekt0 Date: Wed, 28 Sep 2011 02:21:56 +0200 Subject: [PATCH] get_node_commanders goes to backend --- wwwroot/backend/mysql/backend.inc | 20 ++++++++++++++++++- .../function.get_node_commanders.php | 9 +++------ .../function.get_node_commanders2.php | 4 ++++ 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/wwwroot/backend/mysql/backend.inc b/wwwroot/backend/mysql/backend.inc index 0171736..a9b4915 100644 --- a/wwwroot/backend/mysql/backend.inc +++ b/wwwroot/backend/mysql/backend.inc @@ -505,7 +505,25 @@ public static function getNodeUserlist($node_id) { return $userlist; } +// getNodeCommanders + +// Get logins of all node commanders (used in configure) +// Secure. +// Returns list of (node_permission, login) -} +public static function getNodeCommanders($node_id) { + global $db; + $set=$db->query("select node_permission,users.login from node_access + left join users on node_access.user_id=users.user_id where + node_id='$node_id' and node_permission!='' order by node_permission"); + + while ($set->next()) { + $commanders[$set->getString('node_permission')].=$set->getString('login').";"; + } + + return $commanders; +} + +} ?> diff --git a/wwwroot/inc/smarty/node_methodz/function.get_node_commanders.php b/wwwroot/inc/smarty/node_methodz/function.get_node_commanders.php index 5cdb902..437c4cc 100644 --- a/wwwroot/inc/smarty/node_methodz/function.get_node_commanders.php +++ b/wwwroot/inc/smarty/node_methodz/function.get_node_commanders.php @@ -1,12 +1,9 @@ query("select node_permission,users.login from node_access left join users on node_access.user_id=users.user_id where node_id='$node_id' and node_permission!='' order by node_permission"); - - while ($set->next()) { - $commanders[$set->getString('node_permission')].=$set->getString('login').";"; - } + + $commanders=nodes::getNodeCommanders($node_id); $smarty->assign('get_node_commanders',empty($commanders) ? "" : $commanders); $smarty->assign('masters',empty($commanders['master']) ? "" : $commanders['master']); diff --git a/wwwroot/inc/smarty/node_methodz/function.get_node_commanders2.php b/wwwroot/inc/smarty/node_methodz/function.get_node_commanders2.php index 63ef82e..2f8faea 100644 --- a/wwwroot/inc/smarty/node_methodz/function.get_node_commanders2.php +++ b/wwwroot/inc/smarty/node_methodz/function.get_node_commanders2.php @@ -1,4 +1,8 @@