mirror of
https://github.com/ad-aures/castopod.git
synced 2026-04-11 18:56:42 +02:00
feat: add analytics and unknown useragents
This commit is contained in:
parent
4651d01a84
commit
ec92e65aa4
44 changed files with 3333 additions and 1987 deletions
|
|
@ -8,7 +8,11 @@
|
|||
|
||||
<title><?= htmlspecialchars($title, ENT_SUBSTITUTE, 'UTF-8') ?></title>
|
||||
<style type="text/css">
|
||||
<?= preg_replace('#[\r\n\t ]+#', ' ', file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . 'debug.css')) ?>
|
||||
<?= preg_replace(
|
||||
'#[\r\n\t ]+#',
|
||||
' ',
|
||||
file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . 'debug.css')
|
||||
) ?>
|
||||
</style>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
|
@ -21,10 +25,15 @@
|
|||
<!-- Header -->
|
||||
<div class="header">
|
||||
<div class="container">
|
||||
<h1><?= htmlspecialchars($title, ENT_SUBSTITUTE, 'UTF-8'), ($exception->getCode() ? ' #' . $exception->getCode() : '') ?></h1>
|
||||
<h1><?= htmlspecialchars($title, ENT_SUBSTITUTE, 'UTF-8'),
|
||||
$exception->getCode() ? ' #' . $exception->getCode() : '' ?></h1>
|
||||
<p>
|
||||
<?= $exception->getMessage() ?>
|
||||
<a href="https://www.google.com/search?q=<?= urlencode($title . ' ' . preg_replace('#\'.*\'|".*"#Us', '', $exception->getMessage())) ?>" rel="noreferrer" target="_blank">search →</a>
|
||||
<a href="https://www.google.com/search?q=<?= urlencode(
|
||||
$title .
|
||||
' ' .
|
||||
preg_replace('#\'.*\'|".*"#Us', '', $exception->getMessage())
|
||||
) ?>" rel="noreferrer" target="_blank">search →</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -33,9 +42,9 @@
|
|||
<div class="container">
|
||||
<p><b><?= static::cleanPath($file, $line) ?></b> at line <b><?= $line ?></b></p>
|
||||
|
||||
<?php if (is_file($file)) : ?>
|
||||
<?php if (is_file($file)): ?>
|
||||
<div class="source">
|
||||
<?= static::highlightFile($file, $line, 15); ?>
|
||||
<?= static::highlightFile($file, $line, 15) ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
|
@ -58,62 +67,81 @@
|
|||
<div class="content" id="backtrace">
|
||||
|
||||
<ol class="trace">
|
||||
<?php foreach ($trace as $index => $row) : ?>
|
||||
<?php foreach ($trace as $index => $row): ?>
|
||||
|
||||
<li>
|
||||
<p>
|
||||
<!-- Trace info -->
|
||||
<?php if (isset($row['file']) && is_file($row['file'])) : ?>
|
||||
<?php
|
||||
if (isset($row['function']) && in_array($row['function'], ['include', 'include_once', 'require', 'require_once'])) {
|
||||
echo $row['function'] . ' ' . static::cleanPath($row['file']);
|
||||
} else {
|
||||
echo static::cleanPath($row['file']) . ' : ' . $row['line'];
|
||||
}
|
||||
?>
|
||||
<?php else : ?>
|
||||
<?php if (isset($row['file']) && is_file($row['file'])): ?>
|
||||
<?php if (
|
||||
isset($row['function']) &&
|
||||
in_array($row['function'], [
|
||||
'include',
|
||||
'include_once',
|
||||
'require',
|
||||
'require_once',
|
||||
])
|
||||
) {
|
||||
echo $row['function'] . ' ' . static::cleanPath($row['file']);
|
||||
} else {
|
||||
echo static::cleanPath($row['file']) . ' : ' . $row['line'];
|
||||
} ?>
|
||||
<?php else: ?>
|
||||
{PHP internal code}
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- Class/Method -->
|
||||
<?php if (isset($row['class'])) : ?>
|
||||
— <?= $row['class'] . $row['type'] . $row['function'] ?>
|
||||
<?php if (!empty($row['args'])) : ?>
|
||||
<?php $args_id = $error_id . 'args' . $index ?>
|
||||
<?php if (isset($row['class'])): ?>
|
||||
— <?= $row['class'] .
|
||||
$row['type'] .
|
||||
$row['function'] ?>
|
||||
<?php if (!empty($row['args'])): ?>
|
||||
<?php $args_id = $error_id . 'args' . $index; ?>
|
||||
( <a href="#" onclick="return toggle('<?= $args_id ?>');">arguments</a> )
|
||||
<div class="args" id="<?= $args_id ?>">
|
||||
<table cellspacing="0">
|
||||
|
||||
<?php
|
||||
$params = null;
|
||||
// Reflection by name is not available for closure function
|
||||
if (substr($row['function'], -1) !== '}') {
|
||||
$mirror = isset($row['class']) ? new \ReflectionMethod($row['class'], $row['function']) : new \ReflectionFunction($row['function']);
|
||||
$params = $mirror->getParameters();
|
||||
}
|
||||
foreach ($row['args'] as $key => $value) : ?>
|
||||
$params = null;
|
||||
// Reflection by name is not available for closure function
|
||||
if (substr($row['function'], -1) !== '}') {
|
||||
$mirror = isset($row['class'])
|
||||
? new \ReflectionMethod($row['class'], $row['function'])
|
||||
: new \ReflectionFunction($row['function']);
|
||||
$params = $mirror->getParameters();
|
||||
}
|
||||
foreach ($row['args'] as $key => $value): ?>
|
||||
<tr>
|
||||
<td><code><?= htmlspecialchars(isset($params[$key]) ? '$' . $params[$key]->name : "#$key", ENT_SUBSTITUTE, 'UTF-8') ?></code></td>
|
||||
<td><code><?= htmlspecialchars(
|
||||
isset($params[$key]) ? '$' . $params[$key]->name : "#$key",
|
||||
ENT_SUBSTITUTE,
|
||||
'UTF-8'
|
||||
) ?></code></td>
|
||||
<td>
|
||||
<pre><?= print_r($value, true) ?></pre>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach ?>
|
||||
<?php endforeach;
|
||||
?>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
<?php else : ?>
|
||||
<?php else: ?>
|
||||
()
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!isset($row['class']) && isset($row['function'])) : ?>
|
||||
<?php if (!isset($row['class']) && isset($row['function'])): ?>
|
||||
— <?= $row['function'] ?>()
|
||||
<?php endif; ?>
|
||||
</p>
|
||||
|
||||
<!-- Source? -->
|
||||
<?php if (isset($row['file']) && is_file($row['file']) && isset($row['class'])) : ?>
|
||||
<?php if (
|
||||
isset($row['file']) &&
|
||||
is_file($row['file']) &&
|
||||
isset($row['class'])
|
||||
): ?>
|
||||
<div class="source">
|
||||
<?= static::highlightFile($row['file'], $row['line']) ?>
|
||||
</div>
|
||||
|
|
@ -127,10 +155,10 @@
|
|||
|
||||
<!-- Server -->
|
||||
<div class="content" id="server">
|
||||
<?php foreach (['_SERVER', '_SESSION'] as $var) : ?>
|
||||
<?php foreach (['_SERVER', '_SESSION'] as $var): ?>
|
||||
<?php if (empty($GLOBALS[$var]) || !is_array($GLOBALS[$var])) {
|
||||
continue;
|
||||
} ?>
|
||||
continue;
|
||||
} ?>
|
||||
|
||||
<h3>$<?= $var ?></h3>
|
||||
|
||||
|
|
@ -142,13 +170,13 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($GLOBALS[$var] as $key => $value) : ?>
|
||||
<?php foreach ($GLOBALS[$var] as $key => $value): ?>
|
||||
<tr>
|
||||
<td><?= htmlspecialchars($key, ENT_IGNORE, 'UTF-8') ?></td>
|
||||
<td>
|
||||
<?php if (is_string($value)) : ?>
|
||||
<?php if (is_string($value)): ?>
|
||||
<?= htmlspecialchars($value, ENT_SUBSTITUTE, 'UTF-8') ?>
|
||||
<?php else : ?>
|
||||
<?php else: ?>
|
||||
<?= '<pre>' . print_r($value, true) ?>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
|
|
@ -157,11 +185,11 @@
|
|||
</tbody>
|
||||
</table>
|
||||
|
||||
<?php endforeach ?>
|
||||
<?php endforeach; ?>
|
||||
|
||||
<!-- Constants -->
|
||||
<?php $constants = get_defined_constants(true); ?>
|
||||
<?php if (!empty($constants['user'])) : ?>
|
||||
<?php if (!empty($constants['user'])): ?>
|
||||
<h3>Constants</h3>
|
||||
|
||||
<table>
|
||||
|
|
@ -172,13 +200,13 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($constants['user'] as $key => $value) : ?>
|
||||
<?php foreach ($constants['user'] as $key => $value): ?>
|
||||
<tr>
|
||||
<td><?= htmlspecialchars($key, ENT_IGNORE, 'UTF-8') ?></td>
|
||||
<td>
|
||||
<?php if (!is_array($value) && !is_object($value)) : ?>
|
||||
<?php if (!is_array($value) && !is_object($value)): ?>
|
||||
<?= htmlspecialchars($value, ENT_SUBSTITUTE, 'UTF-8') ?>
|
||||
<?php else : ?>
|
||||
<?php else: ?>
|
||||
<?= '<pre>' . print_r($value, true) ?>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
|
|
@ -229,10 +257,10 @@
|
|||
|
||||
|
||||
<?php $empty = true; ?>
|
||||
<?php foreach (['_GET', '_POST', '_COOKIE'] as $var) : ?>
|
||||
<?php foreach (['_GET', '_POST', '_COOKIE'] as $var): ?>
|
||||
<?php if (empty($GLOBALS[$var]) || !is_array($GLOBALS[$var])) {
|
||||
continue;
|
||||
} ?>
|
||||
continue;
|
||||
} ?>
|
||||
|
||||
<?php $empty = false; ?>
|
||||
|
||||
|
|
@ -246,13 +274,13 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($GLOBALS[$var] as $key => $value) : ?>
|
||||
<?php foreach ($GLOBALS[$var] as $key => $value): ?>
|
||||
<tr>
|
||||
<td><?= htmlspecialchars($key, ENT_IGNORE, 'UTF-8') ?></td>
|
||||
<td>
|
||||
<?php if (!is_array($value) && !is_object($value)) : ?>
|
||||
<?php if (!is_array($value) && !is_object($value)): ?>
|
||||
<?= htmlspecialchars($value, ENT_SUBSTITUTE, 'UTF-8') ?>
|
||||
<?php else : ?>
|
||||
<?php else: ?>
|
||||
<?= '<pre>' . print_r($value, true) ?>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
|
|
@ -261,9 +289,9 @@
|
|||
</tbody>
|
||||
</table>
|
||||
|
||||
<?php endforeach ?>
|
||||
<?php endforeach; ?>
|
||||
|
||||
<?php if ($empty) : ?>
|
||||
<?php if ($empty): ?>
|
||||
|
||||
<div class="alert">
|
||||
No $_GET, $_POST, or $_COOKIE Information to show.
|
||||
|
|
@ -272,7 +300,7 @@
|
|||
<?php endif; ?>
|
||||
|
||||
<?php $headers = $request->getHeaders(); ?>
|
||||
<?php if (!empty($headers)) : ?>
|
||||
<?php if (!empty($headers)): ?>
|
||||
|
||||
<h3>Headers</h3>
|
||||
|
||||
|
|
@ -284,14 +312,14 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($headers as $value) : ?>
|
||||
<?php foreach ($headers as $value): ?>
|
||||
<?php if (empty($value)) {
|
||||
continue;
|
||||
} ?>
|
||||
continue;
|
||||
} ?>
|
||||
<?php if (!is_array($value)) {
|
||||
$value = [$value];
|
||||
} ?>
|
||||
<?php foreach ($value as $h) : ?>
|
||||
$value = [$value];
|
||||
} ?>
|
||||
<?php foreach ($value as $h): ?>
|
||||
<tr>
|
||||
<td><?= esc($h->getName(), 'html') ?></td>
|
||||
<td><?= esc($h->getValueLine(), 'html') ?></td>
|
||||
|
|
@ -306,9 +334,9 @@
|
|||
|
||||
<!-- Response -->
|
||||
<?php
|
||||
$response = \Config\Services::response();
|
||||
$response->setStatusCode(http_response_code());
|
||||
?>
|
||||
$response = \Config\Services::response();
|
||||
$response->setStatusCode(http_response_code());
|
||||
?>
|
||||
<div class="content" id="response">
|
||||
<table>
|
||||
<tr>
|
||||
|
|
@ -318,8 +346,8 @@
|
|||
</table>
|
||||
|
||||
<?php $headers = $response->getHeaders(); ?>
|
||||
<?php if (!empty($headers)) : ?>
|
||||
<?php natsort($headers) ?>
|
||||
<?php if (!empty($headers)): ?>
|
||||
<?php natsort($headers); ?>
|
||||
|
||||
<h3>Headers</h3>
|
||||
|
||||
|
|
@ -331,7 +359,7 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($headers as $name => $value) : ?>
|
||||
<?php foreach ($headers as $name => $value): ?>
|
||||
<tr>
|
||||
<td><?= esc($name, 'html') ?></td>
|
||||
<td><?= esc($response->getHeaderLine($name), 'html') ?></td>
|
||||
|
|
@ -348,9 +376,13 @@
|
|||
<?php $files = get_included_files(); ?>
|
||||
|
||||
<ol>
|
||||
<?php foreach ($files as $file) : ?>
|
||||
<li><?= htmlspecialchars(static::cleanPath($file), ENT_SUBSTITUTE, 'UTF-8') ?></li>
|
||||
<?php endforeach ?>
|
||||
<?php foreach ($files as $file): ?>
|
||||
<li><?= htmlspecialchars(
|
||||
static::cleanPath($file),
|
||||
ENT_SUBSTITUTE,
|
||||
'UTF-8'
|
||||
) ?></li>
|
||||
<?php endforeach; ?>
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue