Fix to using most recent development translation set on development demo.
[openemr.git] / gacl / admin / acl_test2.php
blobe903a2523b14b797deaf4c20ac24058d8e59910d
1 <?php
2 /*
3 if (!empty($_GET['debug'])) {
4 $debug = $_GET['debug'];
6 */
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');
13 exit;
15 //ensure php is installed
16 if (!isset($phpgacl_location)) {
17 echo xl('php-GACL access controls are turned off');
18 exit;
21 @set_time_limit(600);
23 require_once('../profiler.inc');
24 $profiler = new Profiler(true,true);
26 require_once("gacl_admin.inc.php");
28 $query = '
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();
44 echo("<pre>");
45 print_r($rows);
46 echo("</pre>");
49 $total_rows = count($rows);
51 while (list(,$row) = @each(&$rows)) {
52 list( $aco_section_value,
53 $aco_section_name,
54 $aco_value,
55 $aco_name,
57 $aro_section_value,
58 $aro_section_name,
59 $aro_value,
60 $aro_name
61 ) = $row;
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";
75 } else {
76 $display_aco_name = "<br>";
79 $acls[] = array(
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,
90 'access' => $access,
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');