Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions system/Debug/Toolbar/Views/toolbar.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<script id="toolbar_js">
var ciSiteURL = "<?= rtrim(site_url(), '/') ?>"
<?= file_get_contents(__DIR__ . '/toolbar.js') ?>
<?= file_get_contents(__DIR__ . '/toolbarstandalone.js') ?>
</script>
<div id="debug-icon" class="debug-bar-ndisplay">
<a id="debug-icon-link">
Expand Down
69 changes: 69 additions & 0 deletions system/Debug/Toolbar/Views/toolbarstandalone.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
* Bootstrap for standalone Debug Toolbar pages (?debugbar_time=...).
*/

if (! document.getElementById('debugbar_loader')) {
if (typeof loadDoc !== 'function') {
window.loadDoc = function (time) {
if (isNaN(time)) {
return;
}

window.location.href = ciSiteURL + '?debugbar_time=' + time;
};
}

(function () {
function ensureToolbarContainer(icon, toolbar) {
let toolbarContainer = document.getElementById('toolbarContainer');

if (toolbarContainer) {
return;
}

toolbarContainer = document.createElement('div');
toolbarContainer.setAttribute('id', 'toolbarContainer');

if (icon) {
toolbarContainer.appendChild(icon);
}

if (toolbar) {
toolbarContainer.appendChild(toolbar);
}

document.body.appendChild(toolbarContainer);
}

function initStandaloneToolbar() {
if (typeof ciDebugBar !== 'object') {
return;
}

const icon = document.getElementById('debug-icon');
const toolbar = document.getElementById('debug-bar');

if (! toolbar || ! icon) {
return;
}

const currentTime = new URLSearchParams(window.location.search).get('debugbar_time');

if (currentTime && ! isNaN(currentTime)) {
if (! localStorage.getItem('debugbar-time')) {
localStorage.setItem('debugbar-time', currentTime);
}
localStorage.setItem('debugbar-time-new', currentTime);
}

ensureToolbarContainer(icon, toolbar);
ciDebugBar.init();
}

if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', initStandaloneToolbar, false);
} else {
initStandaloneToolbar();
}
})();
}
1 change: 1 addition & 0 deletions user_guide_src/source/changelogs/v4.7.1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Bugs Fixed

- **ContentSecurityPolicy:** Fixed a bug where ``generateNonces()`` produces corrupted JSON responses by replacing CSP nonce placeholders with unescaped double quotes. The method now automatically JSON-escapes nonce attributes when the response Content-Type is JSON.
- **Session:** Fixed a bug in ``MemcachedHandler`` where the constructor incorrectly threw an exception when ``savePath`` was not empty.
- **Toolbar:** Fixed a bug where the standalone toolbar page loaded from ``?debugbar_time=...`` was not interactive.

See the repo's
`CHANGELOG.md <https://github.com/codeigniter4/CodeIgniter4/blob/develop/CHANGELOG.md>`_
Expand Down
Loading