static function displayDebugInfos($with_session = true, $ajax = false)
{
global $CFG_GLPI, $DEBUG_SQL, $SQL_TOTAL_REQUEST, $SQL_TOTAL_TIMER, $DEBUG_AUTOLOAD;
// Only for debug mode so not need to be translated
if ($_SESSION['glpi_use_mode'] == Session::DEBUG_MODE) {
// mode debug
$rand = mt_rand();
echo "<div class='debug " . ($ajax ? "debug_ajax" : "") . "'>";
echo "<h1 id='see_debug{$rand}' class='see_debug'><a name='see_debug'>See GLPI DEBUG</a></h1>";
echo "<div id='debugtabs{$rand}'><ul>";
if ($CFG_GLPI["debug_sql"]) {
echo "<li><a href='#debugsql{$rand}'>SQL REQUEST</a></li>";
}
if ($CFG_GLPI["debug_vars"]) {
echo "<li><a href='#debugautoload{$rand}'>AUTOLOAD</a></li>";
echo "<li><a href='#debugpost{$rand}'>POST VARIABLE</a></li>";
echo "<li><a href='#debugget{$rand}'>GET VARIABLE</a></li>";
if ($with_session) {
echo "<li><a href='#debugsession{$rand}'>SESSION VARIABLE</a></li>";
}
echo "<li><a href='#debugserver{$rand}'>SERVER VARIABLE</a></li>";
}
echo "</ul>";
if ($CFG_GLPI["debug_sql"]) {
echo "<div id='debugsql{$rand}'>";
echo "<div class='b'>" . $SQL_TOTAL_REQUEST . " Queries ";
echo "took " . array_sum($DEBUG_SQL['times']) . "s</div>";
echo "<table class='tab_cadre'><tr><th>N° </th><th>Queries</th><th>Time</th>";
echo "<th>Errors</th></tr>";
foreach ($DEBUG_SQL['queries'] as $num => $query) {
echo "<tr class='tab_bg_" . ($num % 2 + 1) . "'><td>{$num}</td><td>";
echo self::cleanSQLDisplay($query);
echo "</td><td>";
echo $DEBUG_SQL['times'][$num];
echo "</td><td>";
if (isset($DEBUG_SQL['errors'][$num])) {
echo $DEBUG_SQL['errors'][$num];
} else {
echo " ";
}
echo "</td></tr>";
}
echo "</table>";
echo "</div>";
}
if ($CFG_GLPI["debug_vars"]) {
echo "<div id='debugautoload{$rand}'>" . implode(', ', $DEBUG_AUTOLOAD) . "</div>";
echo "<div id='debugpost{$rand}'>";
self::printCleanArray($_POST, 0, true);
echo "</div>";
echo "<div id='debugget{$rand}'>";
self::printCleanArray($_GET, 0, true);
echo "</div>";
if ($with_session) {
echo "<div id='debugsession{$rand}'>";
self::printCleanArray($_SESSION, 0, true);
echo "</div>";
}
echo "<div id='debugserver{$rand}'>";
self::printCleanArray($_SERVER, 0, true);
echo "</div>";
}
echo Html::scriptBlock("\n \$('#debugtabs{$rand}').tabs({\n collapsible: true\n }).addClass( 'ui-tabs-vertical ui-helper-clearfix' );\n\n \$('<li class=\"close\"><button id= \"close_debug{$rand}\">close debug</button></li>')\n .appendTo('#debugtabs{$rand} ul');\n\n \$('#close_debug{$rand}').button({\n icons: {\n primary: 'ui-icon-close'\n },\n text: false\n }).click(function() {\n \$('#debugtabs{$rand}').css('display', 'none');\n });\n\n \$('#see_debug{$rand}').click(function() {\n console.log('see_debug #debugtabs{$rand}');\n \$('#debugtabs{$rand}').css('display', 'block');\n });\n ");
echo "</div></div>";
}
}