]> Softwares of Agnibho - simpleipd.git/blob - lib/access.php
Bugfix
[simpleipd.git] / lib / access.php
1 <?php
2 function checkAccess($target, $type="page"){
3 global $config;
4 $registry=json_decode(file_get_contents(CONFIG_ROOT."access.json"));
5 $access="none";
6 if(!empty($_SESSION["group"])){
7 $group=$_SESSION["group"];
8 if(!empty($registry->$target->$group)){
9 $access=$registry->$target->$group;
10 }
11 }
12 if($type=="form"){
13 if($access=="all"){
14 return "";
15 }
16 else{
17 return "style='display:none'";
18 }
19 }
20 if($type=="dbSet"){
21 if($access=="all"){
22 return true;
23 }
24 else{
25 return false;
26 }
27 }
28 if($type=="dbGet"){
29 if($access=="all" || $access=="view"){
30 return true;
31 }
32 else{
33 return false;
34 }
35 }
36 else{
37 return $access;
38 }
39 }
40 ?>