/upload/includes/page_footer_dev.php

http://torrentpier2.googlecode.com/ · PHP · 164 lines · 150 code · 12 blank · 2 comment · 12 complexity · a4d243ee17b91885aa6f023fb2191af8 MD5 · raw file

  1. <?php
  2. if (!defined('BB_ROOT')) die(basename(__FILE__));
  3. ?>
  4. <style type="text/css">
  5. .sqlLog {
  6. clear: both;
  7. font-family: Courier, monospace;
  8. font-size: 12px;
  9. white-space: nowrap;
  10. background: #F5F5F5;
  11. border: 1px solid #BBC0C8;
  12. overflow: auto;
  13. width: 98%;
  14. margin: 0 auto;
  15. padding: 2px 4px;
  16. }
  17. .sqlLogTitle {
  18. font-weight: bold;
  19. color: #444444;
  20. font-size: 11px;
  21. font-family: Verdana, Arial, Helvetica, sans-serif;
  22. padding-bottom: 2px;
  23. }
  24. .sqlLogRow {
  25. background-color: #F5F5F5;
  26. padding-bottom: 1px;
  27. border: solid #F5F5F5;
  28. border-width: 0px 0px 1px 0px;
  29. cursor: pointer;
  30. }
  31. .sqlLogHead {
  32. text-align: right;
  33. float: right;
  34. width: 100%;
  35. }
  36. .sqlLogHead fieldset {
  37. float: right;
  38. margin-right: 4px;
  39. }
  40. .sqlLogWrapped {
  41. white-space: normal;
  42. overflow: visible;
  43. }
  44. .sqlExplain {
  45. color: #B50000;
  46. font-size: 13px;
  47. cursor: default;
  48. }
  49. .sqlHover {
  50. border-color: #8B0000;
  51. }
  52. .sqlHighlight {
  53. background: #FFE4E1;
  54. }
  55. </style>
  56. <?php
  57. if (!empty($_COOKIE['explain']))
  58. {
  59. foreach ($DBS->srv as $srv_name => $db_obj)
  60. {
  61. if (!empty($db_obj->do_explain))
  62. {
  63. $db_obj->explain('display');
  64. }
  65. }
  66. }
  67. $sql_log = !empty($_COOKIE['sql_log']) ? get_sql_log() : '';
  68. echo '
  69. <script type="text/javascript">
  70. function fixSqlLog() {
  71. if ($("#sqlLog").height() > 400) {
  72. $("#sqlLog").height(400);
  73. }
  74. $("#sqlLog div.sqlLogRow")
  75. .hover(
  76. function(){ $(this).addClass("sqlHover"); },
  77. function(){ $(this).removeClass("sqlHover"); }
  78. )
  79. .click(
  80. function(){ $(this).toggleClass("sqlHighlight"); }
  81. )
  82. ;
  83. }
  84. </script>
  85. <div class="sqlLogHead">
  86. ';
  87. if (PROFILER) {
  88. echo '
  89. <fieldset class="med" style="padding: 2px 4px 4px;">
  90. <legend>Profiling</legend>
  91. min time:
  92. <input style="width: 60px;" id="prof_min_time" type="text" value="'. (!empty($_COOKIE['prof_min_time']) ? $_COOKIE['prof_min_time'] : '0.1%') .'" />
  93. <input type="button" value="go" onclick="setProfMinTime(); window.location.reload();" />
  94. <label><input type="checkbox" onclick="setCookie(\'prof_enabled\', this.checked ? 1 : 0, \'SESSION\'); setProfMinTime(); setProfCookie(this.checked ? 1 : 0); window.location.reload();" '. (!empty($_COOKIE['prof_enabled']) ? HTML_CHECKED : '') .' />enable </label>
  95. </fieldset>
  96. ';
  97. }
  98. if (DEBUG) {
  99. echo '
  100. <fieldset class="med" style="padding: 2px 4px 4px;">
  101. <legend>Debug</legend>
  102. <label><input type="checkbox" onclick="setCookie(\'debug_enabled\', this.checked ? 1 : 0, \'SESSION\'); setDebugCookie(this.checked ? 1 : 0); window.location.reload();" '. (!empty($_COOKIE['debug_enabled']) ? HTML_CHECKED : '') .' />enable </label>
  103. </fieldset>
  104. ';
  105. }
  106. echo '</div><!-- / sqlLogHead -->';
  107. if ($sql_log)
  108. {
  109. echo '<div class="sqlLog" id="sqlLog">
  110. '. ($sql_log ? $sql_log : '') .'
  111. '. (UA_IE ? '<br />' : '') .'
  112. </div><!-- / sqlLog -->
  113. <br clear="all" />
  114. ';
  115. }
  116. if (PROFILER && !empty($_COOKIE['prof_enabled']))
  117. {
  118. require(DEV_DIR .'profiler/profiler.php');
  119. $profiler = profiler::init(PROFILER);
  120. $min_time = !empty($_COOKIE['prof_min_time']) ? $_COOKIE['prof_min_time'] : '0.1%';
  121. $profiler->print_profile_data($min_time);
  122. }
  123. ?>
  124. <script type="text/javascript">
  125. $(document).ready(fixSqlLog);
  126. function setProfMinTime ()
  127. {
  128. var minTime = $p('prof_min_time').value;
  129. setCookie('prof_min_time', (minTime ? minTime : '0.1%'));
  130. }
  131. function setProfCookie (val)
  132. {
  133. // http://support.nusphere.com/viewtopic.php?t=586
  134. if (!val) {
  135. deleteCookie('DBGSESSID', '/');
  136. }
  137. else {
  138. // ???????!! ????????? ???????? ?????? ?? ??????? ?????? ?? ??????? phpEd, ????? ???? ???? ????????????
  139. setCookie('DBGSESSID', '1@clienthost:7869;d=1,p=1', 'SESSION', '/');
  140. }
  141. }
  142. function setDebugCookie (val)
  143. {
  144. if (!val) {
  145. deleteCookie('DBGSESSID', '/');
  146. }
  147. else {
  148. setCookie('DBGSESSID', '1@clienthost:7869;d=1,p=0,c=1', 'SESSION', '/');
  149. }
  150. }
  151. </script>