Project

General

Profile

Feature #23565 » 15746_v1.diff

Administrator Admin, 2010-09-19 20:39

View differences:

t3lib/utility/class.t3lib_utility_debug.php (Arbeitskopie)
public function debug($var = '', $header = '', $group = 'Debug') {
// buffer the output of debug if no buffering started before
// buffer the output of debug if no buffering started before
if (ob_get_level() == 0) {
ob_start();
}
if ($GLOBALS['AJAX_MODE'] === 'ExtDirect') {
t3lib_extjs_ExtDirectDebug::debug($var);
return;
}
$debug = '';
if (is_array($var)) {
$debug .= self::viewArray($var);
} elseif (is_object($var)) {
......
}
if (TYPO3_MODE === 'BE') {
$group = htmlspecialchars($group);
self::debugBE($debug, $header, $group);
} else {
echo $debug;
}
}
if ($header !== '') {
$tabHeader = htmlspecialchars($header);
} else {
$tabHeader = 'Debug';
}
/**
* Prints the necessary javascript code to open the debug information inside
* the debug console.
*
* @param string $debug debug message
* @param string $header debug console tab header
* @param string $group debug console tab group
* @return void
*/
protected static function debugBE($debug, $header, $group) {
$group = htmlspecialchars($group);
if (is_object($var)) {
$debug = str_replace(array (
'"', '/', '<', "\n", "\r"
), array (
'\"', '\/', '\<', '<br />', ''
), $debug);
} else {
$debug = str_replace(array (
'"', '/', '<', "\n", "\r"
), array (
'\"', '\/', '\<', '', ''
), $debug);
}
if ($header !== '') {
$tabHeader = htmlspecialchars($header);
} else {
$tabHeader = 'Debug';
}
$script = '
(function debug() {
var debugMessage = "' . $debug . '";
var header = "' . $tabHeader . '";
var group = "' . $group . '";
if (is_object($var)) {
$debug = str_replace(array (
'"', '/', '<', "\n", "\r"
), array (
'\"', '\/', '\<', '<br />', ''
), $debug);
} else {
$debug = str_replace(array (
'"', '/', '<', "\n", "\r"
), array (
'\"', '\/', '\<', '', ''
), $debug);
}
if (typeof Ext !== "object" && (top && typeof top.Ext !== "object")) {
document.write(debugMessage);
return;
}
$script = '
(function debug() {
var debugMessage = "' . $debug . '";
var header = "' . $tabHeader . '";
var group = "' . $group . '";
if (top && typeof Ext !== "object") {
Ext = top.Ext;
}
if (typeof Ext !== "object" && (top && typeof top.Ext !== "object")) {
document.write(debugMessage);
return;
}
Ext.onReady(function() {
var TYPO3ViewportInstance = null;
if (top && typeof Ext !== "object") {
Ext = top.Ext;
}
if (top && top.TYPO3 && typeof top.TYPO3.Backend === "object") {
TYPO3ViewportInstance = top.TYPO3.Backend;
} else if (typeof TYPO3 === "object" && typeof TYPO3.Backend === "object") {
TYPO3ViewportInstance = TYPO3.Backend;
}
Ext.onReady(function() {
var TYPO3ViewportInstance = null;
if (TYPO3ViewportInstance !== null) {
TYPO3ViewportInstance.DebugConsole.addTab(debugMessage, header, group);
} else {
document.write(debugMessage);
}
});
})();
';
echo t3lib_div::wrapJS($script);
} else {
echo $debug;
}
if (top && top.TYPO3 && typeof top.TYPO3.Backend === "object") {
TYPO3ViewportInstance = top.TYPO3.Backend;
} else if (typeof TYPO3 === "object" && typeof TYPO3.Backend === "object") {
TYPO3ViewportInstance = TYPO3.Backend;
}
if (TYPO3ViewportInstance !== null) {
TYPO3ViewportInstance.DebugConsole.addTab(debugMessage, header, group);
} else {
document.write(debugMessage);
}
});
})();
';
echo t3lib_div::wrapJS($script);
}
/**
t3lib/extjs/class.t3lib_extjs_extdirectrouter.php (Arbeitskopie)
* @return void
*/
public function route($ajaxParams, TYPO3AJAX $ajaxObj) {
$GLOBALS['AJAX_MODE'] = 'ExtDirect';
$isForm = FALSE;
$isUpload = FALSE;
$rawPostData = file_get_contents('php://input');
(1-1/2)