PageRenderTime 41ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 1ms

/upload/includes/page_footer.php

http://torrentpier2.googlecode.com/
PHP | 113 lines | 88 code | 23 blank | 2 comment | 21 complexity | 6ddb9a008ce0fadb452a44dbb212e4ba MD5 | raw file
  1. <?php
  2. if (!defined('BB_ROOT')) die(basename(__FILE__));
  3. global $bb_cfg, $userdata, $template, $DBS, $lang;
  4. if (!empty($template))
  5. {
  6. $template->assign_vars(array(
  7. 'SIMPLE_FOOTER' => !empty($gen_simple_header),
  8. 'POWERED' => base64_decode($lang['POWERED']),
  9. 'SHOW_ADMIN_LINK' => (IS_ADMIN && !defined('IN_ADMIN')),
  10. 'ADMIN_LINK_HREF' => "admin/index.php",
  11. ));
  12. $template->set_filenames(array('page_footer' => 'page_footer.tpl'));
  13. $template->pparse('page_footer');
  14. }
  15. $show_dbg_info = (DBG_USER && IS_ADMIN && !defined('IN_ADMIN'));
  16. if(!$bb_cfg['gzip_compress'])
  17. {
  18. flush();
  19. }
  20. if ($show_dbg_info)
  21. {
  22. $gen_time = utime() - TIMESTART;
  23. $gen_time_txt = sprintf('%.3f', $gen_time);
  24. $gzip_text = (UA_GZIP_SUPPORTED) ? 'GZIP ' : '<s>GZIP</s> ';
  25. $gzip_text .= ($bb_cfg['gzip_compress']) ? $lang['ON'] : $lang['OFF'];
  26. $debug_text = (DEBUG) ? 'Debug ON' : 'Debug OFF';
  27. $stat = '[&nbsp; '. $lang['EXECUTION_TIME'] ." $gen_time_txt ". $lang['SEC'];
  28. if (!empty($DBS))
  29. {
  30. $sql_t = $DBS->sql_timetotal;
  31. $sql_time_txt = ($sql_t) ? sprintf('%.3f '.$lang['SEC'].' (%d%%) &middot; ', $sql_t, round($sql_t*100/$gen_time)) : '';
  32. $num_q = $DBS->num_queries;
  33. $stat .= " &nbsp;|&nbsp; MySQL: {$sql_time_txt}{$num_q} " . $lang['QUERIES'];
  34. }
  35. $stat .= " &nbsp;|&nbsp; $gzip_text";
  36. $stat .= ' &nbsp;|&nbsp; '.$lang['MEMORY'];
  37. $stat .= humn_size($bb_cfg['mem_on_start'], 2) .' / ';
  38. $stat .= humn_size(sys('mem_peak'), 2) .' / ';
  39. $stat .= humn_size(sys('mem'), 2);
  40. if ($l = sys('la'))
  41. {
  42. $l = explode(' ', $l);
  43. for ($i=0; $i < 3; $i++)
  44. {
  45. $l[$i] = round($l[$i], 1);
  46. }
  47. $stat .= " &nbsp;|&nbsp; ". $lang['LIMIT'] ." $l[0] $l[1] $l[2]";
  48. }
  49. $stat .= ' &nbsp;]';
  50. $stat .= '
  51. <label><input type="checkbox" onclick="setCookie(\'sql_log\', this.checked ? 1 : 0); window.location.reload();" '. (!empty($_COOKIE['sql_log']) ? HTML_CHECKED : '') .' />show log </label>
  52. <label title="cut long queries"><input type="checkbox" onclick="setCookie(\'sql_log_full\', this.checked ? 1 : 0); window.location.reload();" '. (!empty($_COOKIE['sql_log_full']) ? HTML_CHECKED : '') .' />cut </label>
  53. <label><input type="checkbox" onclick="setCookie(\'explain\', this.checked ? 1 : 0); window.location.reload();" '. (!empty($_COOKIE['explain']) ? HTML_CHECKED : '') .' />explain </label>
  54. ';
  55. $stat .= !empty($_COOKIE['sql_log']) ? '[ <a href="#" class="med" onclick="$p(\'sqlLog\').className=\'sqlLog sqlLogWrapped\'; return false;">wrap</a> &middot; <a href="#sqlLog" class="med" onclick="$(\'#sqlLog\').css({ height: $(window).height()-50 }); return false;">max</a> ]' : '';
  56. echo '<div style="margin: 6px; font-size:10px; color: #444444; letter-spacing: -1px; text-align: center;">'. $stat .'</div>';
  57. }
  58. echo '
  59. </div><!--/body_container-->
  60. ';
  61. if (DBG_USER && (SQL_DEBUG || PROFILER) && !defined('IN_ADMIN'))
  62. {
  63. require(INC_DIR . 'page_footer_dev.php');
  64. }
  65. ##### LOG #####
  66. global $log_ip_resp;
  67. if (isset($log_ip_resp[USER_IP]) || isset($log_ip_resp[CLIENT_IP]))
  68. {
  69. $str = date('H:i:s') . LOG_SEPR . preg_replace("#\s+#", ' ', $contents) . LOG_LF;
  70. $file = 'sessions/'. date('m-d') .'_{'. USER_IP .'}_'. CLIENT_IP .'_resp';
  71. bb_log($str, $file);
  72. }
  73. ### LOG END ###
  74. if (DBG_USER && !empty($GLOBALS['timer_markers']))
  75. {
  76. $GLOBALS['timer']->stop();
  77. $GLOBALS['timer']->display();
  78. }
  79. echo '
  80. </body>
  81. </html>
  82. ';
  83. if (defined('REQUESTED_PAGE') && !defined('DISABLE_CACHING_OUTPUT'))
  84. {
  85. if (IS_GUEST === true)
  86. {
  87. caching_output(true, 'store', REQUESTED_PAGE .'_guest_'. $bb_cfg['default_lang']);
  88. }
  89. }
  90. bb_exit();