3 if (!empty($_GET['debug'])) {
4 $debug = $_GET['debug'];
7 //First make sure user has access
8 include_once("../../interface/globals.php");
9 include_once("$srcdir/acl.inc");
10 //ensure user has proper access
11 if (!acl_check('admin', 'acl')) {
12 echo xl('ACL Administration Not Authorized');
15 //ensure php is installed
16 if (!isset($phpgacl_location)) {
17 echo xl('php-GACL access controls are turned off');
23 require_once('../profiler.inc');
24 $profiler = new Profiler(true,true);
26 require_once("gacl_admin.inc.php");
29 SELECT a.value AS a_value, a.name AS a_name,
30 b.value AS b_value, b.name AS b_name,
31 c.value AS c_value, c.name AS c_name,
32 d.value AS d_value, d.name AS d_name
33 FROM '. $gacl_api->_db_table_prefix
.'aco_sections a
34 LEFT JOIN '. $gacl_api->_db_table_prefix
.'aco b ON a.value=b.section_value,
35 '. $gacl_api->_db_table_prefix
.'aro_sections c
36 LEFT JOIN '. $gacl_api->_db_table_prefix
.'aro d ON c.value=d.section_value
37 ORDER BY a.value, b.value, c.value, d.value';
39 //$rs = $db->Execute($query);
40 $rs = $db->pageexecute($query, $gacl_api->_items_per_page
, $_GET['page']);
41 $rows = $rs->GetRows();
49 $total_rows = count($rows);
51 while (list(,$row) = @each
(&$rows)) {
52 list( $aco_section_value,
63 $acl_check_begin_time = $profiler->getMicroTime();
64 $acl_result = $gacl->acl_query($aco_section_value, $aco_value, $aro_section_value, $aro_value);
65 $acl_check_end_time = $profiler->getMicroTime();
67 $access = &$acl_result['allow'];
68 $return_value = &$acl_result['return_value'];
70 $acl_check_time = ($acl_check_end_time - $acl_check_begin_time) * 1000;
71 $total_acl_check_time +
= $acl_check_time;
73 if ($aco_section_name != $tmp_aco_section_name OR $aco_name != $tmp_aco_name) {
74 $display_aco_name = "$aco_section_name > $aco_name";
76 $display_aco_name = "<br>";
80 'aco_section_value' => $aco_section_value,
81 'aco_section_name' => $aco_section_name,
82 'aco_value' => $aco_value,
83 'aco_name' => $aco_name,
85 'aro_section_value' => $aro_section_value,
86 'aro_section_name' => $aro_section_name,
87 'aro_value' => $aro_value,
88 'aro_name' => $aro_name,
91 'return_value' => $return_value,
92 'acl_check_time' => number_format($acl_check_time, 2),
94 'display_aco_name' => $display_aco_name,
97 $tmp_aco_section_name = $aco_section_name;
98 $tmp_aco_name = $aco_name;
101 //echo "<br><br>$x ACL_CHECK()'s<br>\n";
103 $smarty->assign("acls", $acls);
105 $smarty->assign("total_acl_checks", $total_rows);
106 $smarty->assign("total_acl_check_time", $total_acl_check_time);
108 if ($total_rows > 0) {
109 $avg_acl_check_time = $total_acl_check_time / $total_rows;
111 $smarty->assign("avg_acl_check_time", number_format( ($avg_acl_check_time +
0) ,2));
113 $smarty->assign("paging_data", $gacl_api->get_paging_data($rs));
115 $smarty->assign("return_page", $_SERVER['PHP_SELF'] );
117 $smarty->assign('current','acl_test');
118 $smarty->assign('page_title', '2-dim. ACL Test');
120 $smarty->assign("phpgacl_version", $gacl_api->get_version() );
121 $smarty->assign("phpgacl_schema_version", $gacl_api->get_schema_version() );
123 $smarty->display('phpgacl/acl_test2.tpl');