-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions.php
55 lines (40 loc) · 1.61 KB
/
functions.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
/*
* @author Carl Wilding
*/
function redirect($url) {
echo "<script language=\"JavaScript\">\n";
echo "<!-- hide from old browser\n\n";
echo "window.location = \"" . $url . "\";\n";
echo "-->\n";
echo "</script>\n";
return true;
}
function set_rights($menus, $menuRights, $topmenu) {
$data = array();
for ($i = 0, $c = count($menus); $i < $c; $i++) {
$row = array();
for ($j = 0, $c2 = count($menuRights); $j < $c2; $j++) {
if ($menuRights[$j]["rr_modulecode"] == $menus[$i]["mod_modulecode"]) {
if (authorize($menuRights[$j]["rr_create"]) || authorize($menuRights[$j]["rr_edit"]) ||
authorize($menuRights[$j]["rr_delete"]) || authorize($menuRights[$j]["rr_view"])
) {
$row["menu"] = $menus[$i]["mod_modulegroupcode"];
$row["menu_name"] = $menus[$i]["mod_modulename"];
$row["page_name"] = $menus[$i]["mod_modulepagename"];
$row["create"] = $menuRights[$j]["rr_create"];
$row["edit"] = $menuRights[$j]["rr_edit"];
$row["delete"] = $menuRights[$j]["rr_delete"];
$row["view"] = $menuRights[$j]["rr_view"];
$data[$menus[$i]["mod_modulegroupcode"]][$menuRights[$j]["rr_modulecode"]] = $row;
$data[$menus[$i]["mod_modulegroupcode"]]["top_menu_name"] = $menus[$i]["mod_modulegroupname"];
}
}
}
}
return $data;
}
function authorize($module) {
return $module == "yes" ? TRUE : FALSE;
}
?>