From 53374906937d65442bf8c46d77c9a88ba5c13df5 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Mon, 10 Oct 2005 21:42:10 +0000 Subject: [PATCH] r529: Added fetch_on_bits() to fetch the product permissions for a specified mask where the bits are set to ON --- includes/functions.php | 43 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/includes/functions.php b/includes/functions.php index 03ec18f..8901632 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -361,6 +361,49 @@ function process_custom_fields($bugid, $inputdata = array()) $bugsys->db->query("REPLACE INTO " . TABLE_PREFIX . "bugvaluefill (bugid, " . implode(', ', $fieldbuild) . ") VALUES ($bugid, " . implode(', ', $fieldvalue) . ")"); } +// ####################### Start fetch_on_bits ####################### +function fetch_on_bits($mask) +{ + global $bugsys, $_PERMISSION; + + $onbits = array(); + + $usergroupid = $bugsys->userinfo['usergroupid']; + + if ($bugsys->datastore['usergroup']["$usergroupid"]['permissions'] & $_PERMISSION["$mask"]) + { + foreach ($bugsys->datastore['product'] AS $id => $product) + { + if (!$product['componentmother']) + { + $onbits["$id"] = $id; + } + } + } + + foreach ($bugsys->datastore['permission']["$usergroupid"] AS $productid => $bit) + { + if ($bit & $_PERMISSION["$mask"]) + { + $onbits["$productid"] = $productid; + } + else + { + if ($onbits["$productid"]) + { + unset($onbits["$productid"]); + } + } + } + + if (count($onbits) < 1) + { + $onbits = array(0); + } + + return implode(',', $onbits); +} + /*=====================================================================*\ || ################################################################### || # $HeadURL$ -- 2.22.5