| 1 |
marcusb-guest |
2 |
<?php
|
| 2 |
|
|
|
| 3 |
|
|
// $Header: /cvsroot/tikiwiki/tiki/tiki-debug_console.php,v 1.5.2.2 2005/01/01 00:11:23 damosoft Exp $
|
| 4 |
|
|
|
| 5 |
|
|
// Copyright (c) 2002-2005, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
|
| 6 |
|
|
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
|
| 7 |
|
|
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
|
| 8 |
|
|
|
| 9 |
|
|
//
|
| 10 |
|
|
// $Header: /cvsroot/tikiwiki/tiki/tiki-debug_console.php,v 1.5.2.2 2005/01/01 00:11:23 damosoft Exp $
|
| 11 |
|
|
//
|
| 12 |
|
|
|
| 13 |
|
|
global $feature_debug_console;
|
| 14 |
|
|
if ($feature_debug_console == 'y') {
|
| 15 |
|
|
global $debugger;
|
| 16 |
|
|
|
| 17 |
|
|
require_once ('lib/debug/debugger.php');
|
| 18 |
|
|
|
| 19 |
|
|
global $smarty;
|
| 20 |
|
|
|
| 21 |
|
|
// Get current URL
|
| 22 |
|
|
$smarty->assign('console_father', $_SERVER["REQUEST_URI"]);
|
| 23 |
|
|
|
| 24 |
|
|
// Set default value
|
| 25 |
|
|
$smarty->assign('result_type', NO_RESULT);
|
| 26 |
|
|
|
| 27 |
|
|
// Exec user command in internal debugger
|
| 28 |
|
|
if (isset($_REQUEST["command"])) {
|
| 29 |
|
|
// Exec command in debugger
|
| 30 |
|
|
$command_result = $debugger->execute($_REQUEST["command"]);
|
| 31 |
|
|
|
| 32 |
|
|
$smarty->assign('command', $_REQUEST["command"]);
|
| 33 |
|
|
$smarty->assign('result_type', $debugger->result_type());
|
| 34 |
|
|
|
| 35 |
|
|
// If result need temlate then we have $command_result array...
|
| 36 |
|
|
if ($debugger->result_type() == TPL_RESULT) {
|
| 37 |
|
|
$smarty->assign('result_tpl', $debugger->result_tpl());
|
| 38 |
|
|
|
| 39 |
|
|
$smarty->assign_by_ref('command_result', $command_result);
|
| 40 |
|
|
} else
|
| 41 |
|
|
$smarty->assign('command_result', $command_result);
|
| 42 |
|
|
} else {
|
| 43 |
|
|
$smarty->assign('command', "");
|
| 44 |
|
|
}
|
| 45 |
|
|
|
| 46 |
|
|
// Draw tabs to array. Note that it MUST be AFTER exec command.
|
| 47 |
|
|
// Bcouse 'exec' can change state of smth so tabs content should be changed...
|
| 48 |
|
|
$tabs_list = $debugger->background_tabs_draw();
|
| 49 |
|
|
// Add results tab which is always exists...
|
| 50 |
|
|
$tabs_list["console"] = $smarty->fetch("debug/tiki-debug_console_tab.tpl");
|
| 51 |
|
|
ksort ($tabs_list);
|
| 52 |
|
|
$tabs = array();
|
| 53 |
|
|
|
| 54 |
|
|
// TODO: Use stupid dbl loop to generate links code and divs,
|
| 55 |
|
|
// but it is quite suitable for
|
| 56 |
|
|
foreach ($tabs_list as $tname => $tcode) {
|
| 57 |
|
|
// Generate href code for current button
|
| 58 |
|
|
$href = 'javascript:';
|
| 59 |
|
|
|
| 60 |
|
|
foreach ($tabs_list as $tn => $t)
|
| 61 |
|
|
$href .= (($tn == $tname) ? 'show' : 'hide') . "('" . md5($tn). "');";
|
| 62 |
|
|
|
| 63 |
|
|
//
|
| 64 |
|
|
$tabs[] = array(
|
| 65 |
|
|
"button_caption" => $tname,
|
| 66 |
|
|
"tab_id" => md5($tname),
|
| 67 |
|
|
"button_href" => $href,
|
| 68 |
|
|
"tab_code" => $tcode
|
| 69 |
|
|
);
|
| 70 |
|
|
}
|
| 71 |
|
|
|
| 72 |
|
|
$smarty->assign_by_ref('tabs', $tabs);
|
| 73 |
|
|
}
|
| 74 |
|
|
|
| 75 |
|
|
?>
|