PageRenderTime 48ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/include/phpgacl/admin/acl_test3.php

https://github.com/radicaldesigns/amp
PHP | 140 lines | 84 code | 29 blank | 27 comment | 6 complexity | 559e99d9b03dd6115f6f33bedc0a01e1 MD5 | raw file
Possible License(s): LGPL-2.1, GPL-2.0, BSD-3-Clause, LGPL-2.0, CC-BY-SA-3.0, AGPL-1.0
  1. <?php
  2. /*
  3. meinhard_jahn@web.de, 20041102: axo implemented
  4. */
  5. /*
  6. if (!empty($_GET['debug'])) {
  7. $debug = $_GET['debug'];
  8. }
  9. */
  10. @set_time_limit(600);
  11. require_once('../profiler.inc');
  12. $profiler = new Profiler(true,true);
  13. require_once("gacl_admin.inc.php");
  14. /*
  15. $query = '
  16. SELECT a.value AS a_value, a.name AS a_name,
  17. b.value AS b_value, b.name AS b_name,
  18. c.value AS c_value, c.name AS c_name,
  19. d.value AS d_value, d.name AS d_name
  20. FROM '. $gacl_api->_db_table_prefix .'aco_sections a
  21. LEFT JOIN '. $gacl_api->_db_table_prefix .'aco b ON a.value=b.section_value,
  22. '. $gacl_api->_db_table_prefix .'aro_sections c
  23. LEFT JOIN '. $gacl_api->_db_table_prefix .'aro d ON c.value=d.section_value
  24. ORDER BY a.value, b.value, c.value, d.value';
  25. */
  26. $query = '
  27. SELECT a.value AS a_value, a.name AS a_name,
  28. b.value AS b_value, b.name AS b_name,
  29. c.value AS c_value, c.name AS c_name,
  30. d.value AS d_value, d.name AS d_name,
  31. e.value AS e_value, e.name AS e_name,
  32. f.value AS f_value, f.name AS f_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. '. $gacl_api->_db_table_prefix .'axo_sections e
  38. LEFT JOIN '. $gacl_api->_db_table_prefix .'axo f ON e.value=f.section_value
  39. ORDER BY a.value, b.value, c.value, d.value, e.value, f.value';
  40. //$rs = $db->Execute($query);
  41. $rs = $db->pageexecute($query, $gacl_api->_items_per_page, $_GET['page']);
  42. $rows = $rs->GetRows();
  43. /*
  44. echo("<pre>");
  45. print_r($rows);
  46. echo("</pre>");
  47. */
  48. $total_rows = count($rows);
  49. while (list(,$row) = @each(&$rows)) {
  50. list( $aco_section_value,
  51. $aco_section_name,
  52. $aco_value,
  53. $aco_name,
  54. $aro_section_value,
  55. $aro_section_name,
  56. $aro_value,
  57. $aro_name,
  58. $axo_section_value,
  59. $axo_section_name,
  60. $axo_value,
  61. $axo_name
  62. ) = $row;
  63. $acl_check_begin_time = $profiler->getMicroTime();
  64. $acl_result = $gacl->acl_query($aco_section_value, $aco_value, $aro_section_value, $aro_value, $axo_section_value, $axo_value);
  65. $acl_check_end_time = $profiler->getMicroTime();
  66. $access = &$acl_result['allow'];
  67. $return_value = &$acl_result['return_value'];
  68. $acl_check_time = ($acl_check_end_time - $acl_check_begin_time) * 1000;
  69. $total_acl_check_time += $acl_check_time;
  70. if ($aco_section_name != $tmp_aco_section_name OR $aco_name != $tmp_aco_name) {
  71. $display_aco_name = "$aco_section_name > $aco_name";
  72. } else {
  73. $display_aco_name = "<br>";
  74. }
  75. $acls[] = array(
  76. 'aco_section_value' => $aco_section_value,
  77. 'aco_section_name' => $aco_section_name,
  78. 'aco_value' => $aco_value,
  79. 'aco_name' => $aco_name,
  80. 'aro_section_value' => $aro_section_value,
  81. 'aro_section_name' => $aro_section_name,
  82. 'aro_value' => $aro_value,
  83. 'aro_name' => $aro_name,
  84. 'axo_section_value' => $axo_section_value,
  85. 'axo_section_name' => $axo_section_name,
  86. 'axo_value' => $axo_value,
  87. 'axo_name' => $axo_name,
  88. 'access' => $access,
  89. 'return_value' => $return_value,
  90. 'acl_check_time' => number_format($acl_check_time, 2),
  91. 'display_aco_name' => $display_aco_name,
  92. );
  93. $tmp_aco_section_name = $aco_section_name;
  94. $tmp_aco_name = $aco_name;
  95. }
  96. //echo "<br><br>$x ACL_CHECK()'s<br>\n";
  97. $smarty->assign("acls", $acls);
  98. $smarty->assign("total_acl_checks", $total_rows);
  99. $smarty->assign("total_acl_check_time", $total_acl_check_time);
  100. if ($total_rows > 0) {
  101. $avg_acl_check_time = $total_acl_check_time / $total_rows;
  102. }
  103. $smarty->assign("avg_acl_check_time", number_format( ($avg_acl_check_time + 0) ,2));
  104. $smarty->assign("paging_data", $gacl_api->get_paging_data($rs));
  105. $smarty->assign("return_page", $_SERVER['PHP_SELF'] );
  106. $smarty->assign('current','acl_test');
  107. $smarty->assign('page_title', '3-dim. ACL Test');
  108. $smarty->assign("phpgacl_version", $gacl_api->get_version() );
  109. $smarty->assign("phpgacl_schema_version", $gacl_api->get_schema_version() );
  110. $smarty->display('phpgacl/acl_test3.tpl');
  111. ?>