PageRenderTime 22ms CodeModel.GetById 16ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

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