initial commit

This commit is contained in:
2026-06-25 13:03:45 +06:00
commit 4589f4a8d0
3229 changed files with 941958 additions and 0 deletions

View File

@@ -0,0 +1,59 @@
<?php
/**
* Debug Toolbar Element
*
* Renders all of the other panel elements.
*
* PHP 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @since DebugKit 0.1
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
?>
<div id="debug-kit-toolbar">
<?php if (empty($debugToolbarPanels)) :?>
<p class="warning"><?php echo __d('debug_kit', 'There are no active panels. You must enable a panel to see its output.'); ?></p>
<?php else: ?>
<ul id="panel-tabs">
<li class="panel-tab icon">
<a href="#hide" id="hide-toolbar">
<?php echo $this->Html->image('/debug_kit/img/cake.icon.png', array('alt' => 'CakePHP')); ?>
</a>
</li>
<?php foreach ($debugToolbarPanels as $panelName => $panelInfo): ?>
<?php $panelUnderscore = Inflector::underscore($panelName);?>
<li class="panel-tab">
<?php
$title = (empty($panelInfo['title'])) ? Inflector::humanize($panelUnderscore) : $panelInfo['title'];
echo $this->Toolbar->panelStart($title, $panelUnderscore);
?>
<div class="panel-content" id="<?php echo $panelUnderscore ?>-tab">
<a href="#" class="panel-toggle ui-control ui-button">+</a>
<div class="panel-resize-region">
<div class="panel-content-data">
<?php
echo $this->element($panelInfo['elementName'], $panelInfo, array(
'plugin' => (empty($panelInfo['plugin'])) ? null : Inflector::camelize($panelInfo['plugin'])
));
?>
</div>
<div class="panel-content-data panel-history" id="<?php echo $panelUnderscore; ?>-history">
<!-- content here -->
</div>
</div>
<div class="panel-resize-handle ui-control">====</div>
</div>
<?php $this->Toolbar->panelEnd(); ?>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</div>

View File

@@ -0,0 +1,84 @@
<?php
/**
* Environment Panel Element
*
* Shows information about the current app environment
*
* PHP 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
?>
<h2><?php echo __d('debug_kit', 'App Constants'); ?></h2>
<?php
if (!empty($content['app'])) {
$cakeRows = array();
foreach ($content['app'] as $key => $val) {
$cakeRows[] = array(
$key,
$val
);
}
$headers = array('Constant', 'Value');
echo $this->Toolbar->table($cakeRows, $headers, array('title' => 'Application Environment Vars'));
} else {
echo "No application environment available.";
} ?>
<h2><?php echo __d('debug_kit', 'CakePHP Constants'); ?></h2>
<?php
if (!empty($content['cake'])) {
$cakeRows = array();
foreach ($content['cake'] as $key => $val) {
$cakeRows[] = array(
h($key),
h($val)
);
}
$headers = array('Constant', 'Value');
echo $this->Toolbar->table($cakeRows, $headers, array('title' => 'CakePHP Environment Vars'));
} else {
echo "CakePHP environment unavailable.";
} ?>
<h2><?php echo __d('debug_kit', 'PHP Environment');?></h2>
<?php
$headers = array('Environment Variable', 'Value');
if (!empty($content['php'])) {
$phpRows = array();
foreach ($content['php'] as $key => $val) {
$phpRows[] = array(
h(Inflector::humanize(strtolower($key))),
h($val)
);
}
echo $this->Toolbar->table($phpRows, $headers, array('title' => 'CakePHP Environment Vars'));
} else {
echo "PHP environment unavailable.";
}
if (isset($content['hidef'])) {
echo '<h2>' . __d('debug_kit', 'Hidef Environment') . '</h2>';
if (!empty($content['hidef'])) {
$cakeRows = array();
foreach ($content['hidef'] as $key => $val) {
$cakeRows[] = array(
h($key),
h($val)
);
}
$headers = array('Constant', 'Value');
echo $this->Toolbar->table($cakeRows, $headers, array('title' => 'Hidef Environment Vars'));
} else {
echo "No Hidef environment available.";
}
}

View File

@@ -0,0 +1,32 @@
<?php
/**
* View Variables Panel Element
*
* PHP 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @since DebugKit 1.1
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
?>
<h2> <?php echo __d('debug_kit', 'Request History'); ?></h2>
<?php if (empty($content)): ?>
<p class="warning"><?php echo __d('debug_kit', 'No previous requests logged.'); ?></p>
<?php else: ?>
<?php echo count($content); ?> <?php echo __d('debug_kit', 'previous requests available') ?>
<ul class="history-list">
<li><?php echo $this->Html->link(__d('debug_kit', 'Restore to current request'),
'#', array('class' => 'history-link', 'id' => 'history-restore-current')); ?>
</li>
<?php foreach ($content as $previous): ?>
<li><?php echo $this->Html->link($previous['title'], $previous['url'], array('class' => 'history-link')); ?></li>
<?php endforeach; ?>
</ul>
<?php endif;

View File

@@ -0,0 +1,34 @@
<?php
/**
* Included Files Element
*
* PHP 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @since DebugKit 2.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License
**/
?>
<h2> <?php echo __d('debug_kit', 'Included Files'); ?></h2>
<h4>Include Paths</h4>
<?php
foreach ($content['paths'] as $i => $path) {
if (strstr($path, CAKE)) {
$content['paths'][$i] = '-> ' . $path;
break;
}
}
echo $this->Toolbar->makeNeatArray(array_filter($content['paths']));
unset($content['paths']);
?>
<h4>Included Files</h4>
<?php echo $this->Toolbar->makeNeatArray($content);

View File

@@ -0,0 +1,41 @@
<?php
/**
* Log Panel Element
*
* PHP 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @since DebugKit 0.1
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
?>
<h2><?php echo __d('debug_kit', 'Logs') ?></h2>
<div class="code-table">
<?php if ($content instanceof DebugKitLog): ?>
<?php foreach ($content->logs as $logName => $logs): ?>
<h3><?php echo $logName ?></h3>
<?php
$len = count($logs);
if ($len > 0):
$headers = array(__d('debug_kit', 'Time'), __d('debug_kit', 'Message'));
$rows = array();
for ($i = 0; $i < $len; $i++):
$rows[] = array(
$logs[$i][0], h($logs[$i][1])
);
endfor;
echo $this->Toolbar->table($rows, $headers, array('title' => $logName));
endif; ?>
<?php endforeach; ?>
<?php if (empty($content->logs)): ?>
<p class="info"><?php echo __d('debug_kit', 'There were no log entries made this request'); ?></p>
<?php endif; ?>
<?php endif; ?>
</div>

View File

@@ -0,0 +1,50 @@
<?php
/**
* Request Panel Element
*
* PHP 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @since DebugKit 0.1
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
?>
<h2> <?php echo __d('debug_kit', 'Request'); ?></h2>
<h4>Cake Params</h4>
<?php echo $this->Toolbar->makeNeatArray($content['params']); ?>
<h4>Post data</h4>
<?php
if (empty($content['data'])):
echo '<p class="info">' . __d('debug_kit', 'No post data.') . '</p>';
else:
echo $this->Toolbar->makeNeatArray($content['data']);
endif;
?>
<h4>Query string</h4>
<?php
if (empty($content['query'])):
echo '<p class="info">' . __d('debug_kit', 'No querystring data.') . '</p>';
else:
echo $this->Toolbar->makeNeatArray($content['query']);
endif;
?>
<h4>Cookie</h4>
<?php if (isset($content['cookie'])): ?>
<?php echo $this->Toolbar->makeNeatArray($content['cookie']); ?>
<?php else: ?>
<p class="info">To view Cookies, add CookieComponent to Controller</p>
<?php endif; ?>
<h4><?php echo __d('debug_kit', 'Current Route') ?></h4>
<?php echo $this->Toolbar->makeNeatArray($content['currentRoute']);

View File

@@ -0,0 +1,20 @@
<?php
/**
* Session Panel Element
*
* PHP 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @since DebugKit 1.1
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
?>
<h2><?php echo __d('debug_kit', 'Session'); ?></h2>
<?php echo $this->Toolbar->makeNeatArray($content);

View File

@@ -0,0 +1,80 @@
<?php
/**
* SQL Log Panel Element
*
* PHP 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @since DebugKit 0.1
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
$headers = array('Query', 'Affected', 'Num. rows', 'Took (ms)', 'Actions');
if (isset($debugKitInHistoryMode)) {
$content = $this->Toolbar->readCache('sql_log', $this->request->params['pass'][0]);
}
?>
<h2><?php echo __d('debug_kit', 'Sql Logs')?></h2>
<?php if (!empty($content)) : ?>
<?php foreach ($content['connections'] as $dbName => $explain): ?>
<div class="sql-log-panel-query-log">
<h4><?php echo $dbName ?></h4>
<?php
if (!isset($debugKitInHistoryMode)):
$queryLog = $this->Toolbar->getQueryLogs($dbName, array(
'explain' => $explain, 'threshold' => $content['threshold']
));
else:
$queryLog = $content[$dbName];
endif;
if (empty($queryLog['queries'])):
if (Configure::read('debug') < 2):
echo ' ' . __d('debug_kit', 'No query logs when debug < 2.');
else:
echo ' ' . __d('debug_kit', 'No query logs.');
endif;
else:
$hashes = array();
$duplicate = 0;
foreach ($queryLog['queries'] as $key => $val) {
$hash = sha1($val['query']);
if (!isset($hashes[$hash]) || $hashes[$hash] !== $val['affected']) {
$hashes[$hash] = $val['affected'];
continue;
}
$duplicate++;
$queryLog['queries'][$key]['query'] = '<span class="alert-duplicate">' . $val['query'] . '</span>';
}
echo '<h5>';
echo __d(
'debug_kit',
'Total Time: %s ms <br />Total Queries: %s queries',
$queryLog['time'],
$queryLog['count']
);
echo '</h5>';
echo $this->Toolbar->table($queryLog['queries'], $headers, array('title' => 'SQL Log ' . $dbName));
if ($duplicate) {
echo '<p class="alert alert-warning">' . __d('debug_kit', '%s duplicate queries run.', $duplicate) . '</p>';
}
?>
<h4><?php echo __d('debug_kit', 'Query Explain:'); ?></h4>
<div id="sql-log-explain-<?php echo $dbName ?>">
<a id="debug-kit-explain-<?php echo $dbName ?>"> </a>
<p><?php echo __d('debug_kit', 'Click an "Explain" link above, to see the query explanation.'); ?></p>
</div>
<?php endif; ?>
</div>
<?php endforeach; ?>
<?php else:
echo $this->Toolbar->message('Warning', __d('debug_kit', 'No active database connections'));
endif;

View File

@@ -0,0 +1,110 @@
<?php
/**
* Timer Panel Element
*
* PHP 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @since DebugKit 0.1
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
$this->Number = $this->Helpers->load('Number');
$this->SimpleGraph = $this->Helpers->load('DebugKit.SimpleGraph');
if (!isset($debugKitInHistoryMode)):
$timers = DebugTimer::getAll(true);
$currentMemory = DebugKitDebugger::getMemoryUse();
$peakMemory = DebugKitDebugger::getPeakMemoryUse();
$requestTime = DebugTimer::requestTime();
else:
$content = $this->Toolbar->readCache('timer', $this->request->params['pass'][0]);
if (is_array($content)):
extract($content);
endif;
endif;
?>
<div class="debug-info">
<h2><?php echo __d('debug_kit', 'Memory'); ?></h2>
<div class="peak-mem-use">
<?php
echo $this->Toolbar->message(__d('debug_kit', 'Peak Memory Use'), $this->Number->toReadableSize($peakMemory)); ?>
</div>
<?php
$headers = array(__d('debug_kit', 'Message'), __d('debug_kit', 'Memory use'));
$memoryPoints = DebugKitDebugger::getMemoryPoints();
$rows = array();
foreach ($memoryPoints as $key => $value):
$rows[] = array($key, $this->Number->toReadableSize($value));
endforeach;
echo $this->Toolbar->table($rows, $headers);
?>
</div>
<div class="debug-info debug-timers">
<h2><?php echo __d('debug_kit', 'Timers'); ?></h2>
<div class="request-time">
<?php $totalTime = __d('debug_kit', '%s (ms)', $this->Number->precision($requestTime * 1000, 0)); ?>
<?php echo $this->Toolbar->message(__d('debug_kit', 'Total Request Time:'), $totalTime)?>
</div>
<?php
$rows = array();
$end = end($timers);
$maxTime = $end['end'];
$headers = array(
__d('debug_kit', 'Message'),
__d('debug_kit', 'Time in ms'),
__d('debug_kit', 'Graph')
);
$i = 0;
$values = array_values($timers);
foreach ($timers as $timerName => $timeInfo):
$indent = 0;
for ($j = 0; $j < $i; $j++) {
if (($values[$j]['end'] > $timeInfo['start']) && ($values[$j]['end']) > ($timeInfo['end'])) {
$indent++;
}
}
$indent = str_repeat(' &raquo; ', $indent);
$rows[] = array(
$indent . $timeInfo['message'],
$this->Number->precision($timeInfo['time'] * 1000, 2),
$this->SimpleGraph->bar(
$this->Number->precision($timeInfo['time'] * 1000, 2),
$this->Number->precision($timeInfo['start'] * 1000, 2),
array(
'max' => $maxTime * 1000,
'requestTime' => $requestTime * 1000,
)
)
);
$i++;
endforeach;
if (strtolower($this->Toolbar->getName()) === 'firephptoolbar'):
for ($i = 0, $len = count($rows); $i < $len; $i++):
unset($rows[$i][2]);
endfor;
unset($headers[2]);
endif;
echo $this->Toolbar->table($rows, $headers, array('title' => 'Timers'));
if (!isset($debugKitInHistoryMode)):
$this->Toolbar->writeCache('timer', compact('timers', 'currentMemory', 'peakMemory', 'requestTime'));
endif;
?>
</div>

View File

@@ -0,0 +1,23 @@
<?php
/**
* View Variables Panel Element
*
* PHP 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @since DebugKit 0.1
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
?>
<h2> <?php echo __d('debug_kit', 'View Variables'); ?></h2>
<?php
$content['$this->validationErrors'] = $this->validationErrors;
$content['Loaded Helpers'] = $this->Helpers->attached();
echo $this->Toolbar->makeNeatArray($content);