Don't mix data model and UI: move debug javascript to js module, also use jquery because raw javascript without validation is dangerous
[gitphp.git] / include / DebugLog.class.php
blob:a/include/DebugLog.class.php -> blob:b/include/DebugLog.class.php
--- a/include/DebugLog.class.php
+++ b/include/DebugLog.class.php
@@ -237,7 +237,6 @@
 		if (!$this->enabled) return;
 
 		foreach ($this->entries as $i => $e) {
-			$bt_id = 'bt_' . $i;
 			if (strlen($e['value']) > 512) {
 				$contents  = htmlspecialchars(substr($e['value'], 0, 512) . "...");
 				$contents .= "\n\n<i>" . (strlen($e['value']) - 512) . " bytes more in output</i>";
@@ -248,8 +247,8 @@
 				<td class='debug_key'>$e[name]</td>
 				<td class='debug_value'>
 					" . nl2br($contents) . ($contents != "" ? "<br§ />" : "") . "
-					<span class='debug_toggle' onclick='bt_toggle(\"$bt_id\");'>trace</span>&nbsp;
-					<div style='display: none;' class='debug_bt' id='$bt_id'>$e[bt]</div>
+					<span class='debug_toggle'>trace</span>&nbsp;
+					<div class='debug_bt'>$e[bt]</div>
 				</td>
 				<td class='debug_time'>
 					" . ($e['time'] ? sprintf("%.1f", $e['time'] * 1000) : '') . "
@@ -265,12 +264,6 @@
 
 		echo
 <<<HEREDOC
-		<script type="text/javascript">
-			function bt_toggle(id) {
-				var el = document.getElementById(id);
-				el.style.display = ((el.style.display == 'none') ? 'block' : 'none');
-			}
-		</script>
 		<table class="debug"><tbody>
 HEREDOC;
 	}

comments