From: niekt0 Date: Tue, 17 Jan 2012 21:36:24 +0000 (+0100) Subject: isHierarch function restored X-Git-Url: https://git.harvie.cz/?a=commitdiff_plain;h=57dd552c75ca1484ab8f1a8ce349a66e632427cd;p=mirrors%2FKyberia-bloodline.git isHierarch function restored --- diff --git a/wwwroot/backend/mysql/permissions.inc b/wwwroot/backend/mysql/permissions.inc index 6ef9596..ace0e60 100644 --- a/wwwroot/backend/mysql/permissions.inc +++ b/wwwroot/backend/mysql/permissions.inc @@ -2,6 +2,36 @@ class permissions { +// XXX not checked + +function isHierarch($node) { + + global $db; + if (IsSet($_SESSION['user_id'])) { + $user_id=$_SESSION['user_id']; + } else { + $user_id=0; + } + if (!$user_id) return false; + + $node_vector=chunk_split($node['node_vector'],VECTOR_CHARS,';'); + $hierarchy=explode(';',$node_vector); + foreach ($hierarchy as $hierarch) { + $hierarch=ltrim($hierarch,0); + $q="select nodes.node_creator,node_access.node_permission from nodes left join node_access on nodes.node_id=node_access.node_id and node_access.user_id='".$user_id."' where nodes.node_id='$hierarch'"; + $result=$db->query($q); + $result->next(); + if ($result->getString('node_creator')==$user_id) + return true; + if ($result->getString('node_permission')=='master') + return true; + if ($result->getString('node_creator')=='operator') + return true; + } + return false; + +} + //trillion lights to Hierarchy! //$node input parameter can be a numeric node_id of a node-to-be-checked or a hash containing node_id,node_vector public static function checkPerms($node) { diff --git a/wwwroot/inc/senate.inc b/wwwroot/inc/senate.inc index de5c4dc..a5f3025 100644 --- a/wwwroot/inc/senate.inc +++ b/wwwroot/inc/senate.inc @@ -3,7 +3,7 @@ define('DAILY_K',30); define('REGISTRATION_VOTES',2); //too small so far // logout after one hour -define('LOGOUT_IDLE_SEC', 3600); +define('LOGOUT_IDLE_SEC', 7200); // An attempt to remove hard-code constants from code define('MAIL_NODE',24);