mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-29 16:55:05 +02:00
Add new functions from acl enterprise menu
This commit is contained in:
parent
009ae5c92a
commit
256da3bc3d
@ -12,7 +12,9 @@
|
|||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
$get_sec_pages = get_parameter('get_sec_pages');
|
$get_sec_pages = get_parameter('get_sec_pages');
|
||||||
|
$get_sec_pages2 = get_parameter('get_sec_pages2');
|
||||||
include_once("include/functions_menu.php");
|
include_once("include/functions_menu.php");
|
||||||
|
include_once("include/functions_html.php");
|
||||||
|
|
||||||
if ($get_sec_pages) {
|
if ($get_sec_pages) {
|
||||||
$sec = get_parameter('sec');
|
$sec = get_parameter('sec');
|
||||||
@ -46,4 +48,15 @@ if ($get_sec_pages) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($get_sec_pages2) {
|
||||||
|
$sec2 = get_parameter('sec2');
|
||||||
|
$sec = get_parameter('sec');
|
||||||
|
$menu_hash = get_parameter('menu_hash');
|
||||||
|
|
||||||
|
$pages = menu_get_sec2_pages($sec, $sec2, $menu_hash);
|
||||||
|
|
||||||
|
echo json_encode($pages);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@ -305,6 +305,11 @@ function menu_print_menu (&$menu) {
|
|||||||
|
|
||||||
$count_sub2 = 0;
|
$count_sub2 = 0;
|
||||||
foreach ($sub['sub2'] as $key => $sub2) {
|
foreach ($sub['sub2'] as $key => $sub2) {
|
||||||
|
|
||||||
|
if (enterprise_hook ('enterprise_acl', array ($config['id_user'], $mainsec, $subsec2, true,$key)) == false) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$count_sub2++;
|
$count_sub2++;
|
||||||
|
|
||||||
$link = "index.php?sec=".$subsec2."&sec2=".$key;
|
$link = "index.php?sec=".$subsec2."&sec2=".$key;
|
||||||
@ -536,10 +541,29 @@ function menu_get_sec($with_categories = false) {
|
|||||||
$sec_array[$k] = $v['text'];
|
$sec_array[$k] = $v['text'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $sec_array;
|
return $sec_array;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the sec list built in menu
|
||||||
|
*
|
||||||
|
* @param bool If true, the array returned will have the structure
|
||||||
|
* to combo categories (optgroup)
|
||||||
|
*
|
||||||
|
* @return array Sections list
|
||||||
|
*/
|
||||||
|
function get_sec($sec = false) {
|
||||||
|
$menu = menu_get_full_sec();
|
||||||
|
unset($menu['class']);
|
||||||
|
|
||||||
|
$in_godmode = false;
|
||||||
|
foreach ($menu as $k => $v) {
|
||||||
|
if (isset($v["sub"][$sec]))
|
||||||
|
return $k;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the pages in a section
|
* Get the pages in a section
|
||||||
*
|
*
|
||||||
@ -552,7 +576,7 @@ function menu_get_sec($with_categories = false) {
|
|||||||
* @return array Sections list
|
* @return array Sections list
|
||||||
*/
|
*/
|
||||||
function menu_get_sec_pages($sec, $menu_hash = false) {
|
function menu_get_sec_pages($sec, $menu_hash = false) {
|
||||||
if ($menu_hash === false) {
|
if (!$menu_hash) {
|
||||||
$menu = menu_get_full_sec();
|
$menu = menu_get_full_sec();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -564,7 +588,7 @@ function menu_get_sec_pages($sec, $menu_hash = false) {
|
|||||||
if (isset($sec)) {
|
if (isset($sec)) {
|
||||||
|
|
||||||
// Get the sec2 of the main section
|
// Get the sec2 of the main section
|
||||||
$sec2_array[$menu[$sec]['sec2']] = $menu[$sec]['text'];
|
//$sec2_array[$menu[$sec]['sec2']] = $menu[$sec]['text'];
|
||||||
|
|
||||||
|
|
||||||
// Get the sec2 of the subsections
|
// Get the sec2 of the subsections
|
||||||
@ -588,6 +612,37 @@ function menu_get_sec_pages($sec, $menu_hash = false) {
|
|||||||
return $sec2_array;
|
return $sec2_array;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the pages in a section2
|
||||||
|
*
|
||||||
|
* @param string sec code
|
||||||
|
* @param string menu hash. All the menu structure (For example
|
||||||
|
* returned by menu_get_full_sec(), json encoded and after that
|
||||||
|
* base64 encoded. If this value is false this data is obtained from
|
||||||
|
* menu_get_full_sec();
|
||||||
|
*
|
||||||
|
* @return array Sections list
|
||||||
|
*/
|
||||||
|
function menu_get_sec2_pages($sec, $sec2, $menu_hash = false) {
|
||||||
|
if ($menu_hash === false) {
|
||||||
|
$menu = menu_get_full_sec();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$menu = json_decode(base64_decode($menu_hash),true);
|
||||||
|
}
|
||||||
|
|
||||||
|
$sec3_array = array();
|
||||||
|
|
||||||
|
if (isset($sec2)) {
|
||||||
|
// Get the sec2 of the subsections
|
||||||
|
foreach ($menu[$sec]['sub'][$sec2]['sub2'] as $k => $v) {
|
||||||
|
$sec3_array[$k] = $v['text'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $sec3_array;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if a page (sec2) is in a section (sec)
|
* Check if a page (sec2) is in a section (sec)
|
||||||
*
|
*
|
||||||
|
@ -628,10 +628,21 @@ if ($searchPage) {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ($page != "") {
|
if ($page != "") {
|
||||||
|
|
||||||
|
$main_sec = get_sec($sec);
|
||||||
|
if ($main_sec == false) {
|
||||||
|
if ($sec == 'extensions')
|
||||||
|
$main_sec = get_parameter('extension_in_menu');
|
||||||
|
else
|
||||||
|
$main_sec = $sec;
|
||||||
|
$sec = $sec2;
|
||||||
|
$sec2 = '';
|
||||||
|
}
|
||||||
$page .= '.php';
|
$page .= '.php';
|
||||||
|
|
||||||
// Enterprise ACL check
|
// Enterprise ACL check
|
||||||
if (enterprise_hook ('enterprise_acl',
|
if (enterprise_hook ('enterprise_acl',
|
||||||
array ($config['id_user'], $sec, $sec2, true)) == false) {
|
array ($config['id_user'], $main_sec, $sec, true,$sec2)) == false) {
|
||||||
|
|
||||||
require ("general/noaccess.php");
|
require ("general/noaccess.php");
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user