PHP Debugbar

This commit is contained in:
Matteo Gheza 2021-03-04 09:52:11 +01:00
parent abf7fb1c25
commit 88c02a8f0f
14 changed files with 169 additions and 217 deletions

View File

@ -43,7 +43,6 @@ $baseConfig = [
vendor/nikic/fast-route/test
vendor/twig/twig/src/Node/Expression/Test
vendor/twig/twig/src/Test
vendor/tracy/tracy/tools
vendor
*.lock
*.zip

View File

@ -208,7 +208,7 @@ header("Access-Control-Allow-Headers: *");
header("Access-Control-Allow-Methods: *");
header("Access-Control-Max-Age: *");
header("Content-type: ".$responseFormatType);
init_class(false, false); //initialize classes (and Tracy) after Content-type header
init_class(false, false); //initialize classes after Content-type header
$routeInfo = $dispatcher->dispatch($httpMethod, $uri);

View File

@ -4,15 +4,14 @@
"type": "project",
"require": {
"twig/twig": "^3.2.1",
"tracy/tracy": "^2.8.0",
"delight-im/auth": "^8.2.2",
"ulrichsg/getopt-php": "^3.4.0",
"nikic/fast-route": "^2.0@dev",
"spatie/array-to-xml": "^2.16",
"ezyang/htmlpurifier": "^4.13",
"netpromotion/profiler": "^1.3",
"brick/phonenumber": "^0.2.2",
"sentry/sdk": "^3.1"
"sentry/sdk": "^3.1",
"maximebf/debugbar": "^1.16"
},
"license": "GPL-3.0-or-later",
"authors": [
@ -22,11 +21,6 @@
}
],
"minimum-stability": "stable",
"scripts": {
"test": [
"codecept run --steps"
]
},
"require-dev": {
"pheromone/phpcs-security-audit": "^2.0"
}

265
server/composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "14f566049f2ca7d87fa49fafaa9f4291",
"content-hash": "70f094e636bc55d808d812581dddc0b3",
"packages": [
{
"name": "brick/phonenumber",
@ -761,42 +761,41 @@
"time": "2021-02-22T10:52:38+00:00"
},
{
"name": "netpromotion/profiler",
"version": "v1.3.0",
"name": "maximebf/debugbar",
"version": "v1.16.5",
"source": {
"type": "git",
"url": "https://github.com/netpromotion/profiler.git",
"reference": "a3c0a625c2dba9a03e1c738e51fe05d24909bb7e"
"url": "https://github.com/maximebf/php-debugbar.git",
"reference": "6d51ee9e94cff14412783785e79a4e7ef97b9d62"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/netpromotion/profiler/zipball/a3c0a625c2dba9a03e1c738e51fe05d24909bb7e",
"reference": "a3c0a625c2dba9a03e1c738e51fe05d24909bb7e",
"url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/6d51ee9e94cff14412783785e79a4e7ef97b9d62",
"reference": "6d51ee9e94cff14412783785e79a4e7ef97b9d62",
"shasum": ""
},
"require": {
"petrknap/php-profiler": "^1.1",
"petrknap/php-singleton": "^1.0",
"php": ">=5.4"
},
"conflict": {
"nette/di": "<2.2 || >=3",
"tracy/tracy": "<2.2 || >=3"
"php": "^7.1|^8",
"psr/log": "^1.0",
"symfony/var-dumper": "^2.6|^3|^4|^5"
},
"require-dev": {
"laravel/lumen-framework": "^5.0",
"latte/latte": "^2.3",
"netpromotion/tracy-wrapper": "^1.0",
"nette/application": "^2.3",
"nette/bootstrap": "^2.3",
"nette/di": "*",
"phpunit/phpunit": "^4.8",
"tracy/tracy": "*"
"phpunit/phpunit": "^7.5.20 || ^9.4.2"
},
"suggest": {
"kriswallsmith/assetic": "The best way to manage assets",
"monolog/monolog": "Log using Monolog",
"predis/predis": "Redis storage"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.16-dev"
}
},
"autoload": {
"psr-4": {
"Netpromotion\\Profiler\\": "src/Profiler"
"DebugBar\\": "src/DebugBar/"
}
},
"notification-url": "https://packagist.org/downloads/",
@ -805,16 +804,26 @@
],
"authors": [
{
"name": "Petr Knap",
"email": "knap@netpromotion.cz"
"name": "Maxime Bouroumeau-Fuseau",
"email": "maxime.bouroumeau@gmail.com",
"homepage": "http://maximebf.com"
},
{
"name": "Barry vd. Heuvel",
"email": "barryvdh@gmail.com"
}
],
"description": "Profiler with adapter for Tracy",
"description": "Debug bar in the browser for php application",
"homepage": "https://github.com/maximebf/php-debugbar",
"keywords": [
"debug",
"debugbar"
],
"support": {
"issues": "https://github.com/netpromotion/profiler/issues",
"source": "https://github.com/netpromotion/profiler/tree/master"
"issues": "https://github.com/maximebf/php-debugbar/issues",
"source": "https://github.com/maximebf/php-debugbar/tree/v1.16.5"
},
"time": "2016-10-05T09:25:18+00:00"
"time": "2020-12-07T11:07:24+00:00"
},
{
"name": "nikic/fast-route",
@ -879,96 +888,6 @@
},
"time": "2020-09-28T10:21:28+00:00"
},
{
"name": "petrknap/php-profiler",
"version": "v1.3.0",
"source": {
"type": "git",
"url": "https://github.com/petrknap/php-profiler.git",
"reference": "39fb47fb0fbdbc678128a046fd1c5e8d71064595"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/petrknap/php-profiler/zipball/39fb47fb0fbdbc678128a046fd1c5e8d71064595",
"reference": "39fb47fb0fbdbc678128a046fd1c5e8d71064595",
"shasum": ""
},
"require": {
"php": ">=5.5"
},
"require-dev": {
"phpunit/phpunit": "^4.8"
},
"type": "library",
"autoload": {
"psr-4": {
"PetrKnap\\Php\\Profiler\\": "src"
},
"files": []
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Petr Knap",
"email": "dev@petrknap.cz"
}
],
"description": "PHP profiler",
"homepage": "https://petrknap.github.io/docs/php-profiler.html",
"support": {
"issues": "https://github.com/petrknap/php-profiler/issues",
"source": "https://github.com/petrknap/php-profiler/tree/master"
},
"time": "2017-05-29T10:14:28+00:00"
},
{
"name": "petrknap/php-singleton",
"version": "v1.0.0",
"source": {
"type": "git",
"url": "https://github.com/petrknap/php-singleton.git",
"reference": "dec131d0d6c72dd76b5a5c7940f04f14f5df7a20"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/petrknap/php-singleton/zipball/dec131d0d6c72dd76b5a5c7940f04f14f5df7a20",
"reference": "dec131d0d6c72dd76b5a5c7940f04f14f5df7a20",
"shasum": ""
},
"require": {
"php": ">=5.4"
},
"require-dev": {
"phpunit/phpunit": "4.*"
},
"type": "library",
"autoload": {
"psr-4": {
"PetrKnap\\Php\\Singleton\\": "src/Singleton"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Petr Knap",
"email": "dev@petrknap.cz",
"homepage": "http://petrknap.cz"
}
],
"description": "Singleton pattern for PHP",
"homepage": "https://github.com/petrknap/php-singleton",
"support": {
"issues": "https://github.com/petrknap/php-singleton/issues",
"source": "https://github.com/petrknap/php-singleton/tree/master"
},
"time": "2016-09-22T07:59:18+00:00"
},
{
"name": "php-http/client-common",
"version": "2.3.0",
@ -1725,16 +1644,16 @@
},
{
"name": "sentry/sentry",
"version": "3.1.5",
"version": "3.2.0",
"source": {
"type": "git",
"url": "https://github.com/getsentry/sentry-php.git",
"reference": "62f6897e1e577de39b366b5c84e19a453da36016"
"reference": "899b0de58c1e01feb54829b3094af74252aff385"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/getsentry/sentry-php/zipball/62f6897e1e577de39b366b5c84e19a453da36016",
"reference": "62f6897e1e577de39b366b5c84e19a453da36016",
"url": "https://api.github.com/repos/getsentry/sentry-php/zipball/899b0de58c1e01feb54829b3094af74252aff385",
"reference": "899b0de58c1e01feb54829b3094af74252aff385",
"shasum": ""
},
"require": {
@ -1779,7 +1698,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.1.x-dev"
"dev-master": "3.2.x-dev"
}
},
"autoload": {
@ -1813,7 +1732,7 @@
],
"support": {
"issues": "https://github.com/getsentry/sentry-php/issues",
"source": "https://github.com/getsentry/sentry-php/tree/3.1.5"
"source": "https://github.com/getsentry/sentry-php/tree/3.2.0"
},
"funding": [
{
@ -1825,7 +1744,7 @@
"type": "custom"
}
],
"time": "2021-02-18T13:34:31+00:00"
"time": "2021-03-03T11:54:34+00:00"
},
{
"name": "spatie/array-to-xml",
@ -2672,78 +2591,92 @@
"time": "2020-09-07T11:33:47+00:00"
},
{
"name": "tracy/tracy",
"version": "v2.8.3",
"name": "symfony/var-dumper",
"version": "v5.2.3",
"source": {
"type": "git",
"url": "https://github.com/nette/tracy.git",
"reference": "342674bbf72365e8456de9855a8cd839ca695933"
"url": "https://github.com/symfony/var-dumper.git",
"reference": "72ca213014a92223a5d18651ce79ef441c12b694"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nette/tracy/zipball/342674bbf72365e8456de9855a8cd839ca695933",
"reference": "342674bbf72365e8456de9855a8cd839ca695933",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/72ca213014a92223a5d18651ce79ef441c12b694",
"reference": "72ca213014a92223a5d18651ce79ef441c12b694",
"shasum": ""
},
"require": {
"ext-json": "*",
"ext-session": "*",
"php": ">=7.2 <8.1"
"php": ">=7.2.5",
"symfony/polyfill-mbstring": "~1.0",
"symfony/polyfill-php80": "^1.15"
},
"conflict": {
"nette/di": "<3.0"
"phpunit/phpunit": "<5.4.3",
"symfony/console": "<4.4"
},
"require-dev": {
"latte/latte": "^2.5",
"nette/di": "^3.0",
"nette/mail": "^3.0",
"nette/tester": "^2.2",
"nette/utils": "^3.0",
"phpstan/phpstan": "^0.12",
"psr/log": "^1.0"
"ext-iconv": "*",
"symfony/console": "^4.4|^5.0",
"symfony/process": "^4.4|^5.0",
"twig/twig": "^2.13|^3.0.4"
},
"suggest": {
"ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).",
"ext-intl": "To show region name in time zone dump",
"symfony/console": "To use the ServerDumpCommand and/or the bin/var-dump-server script"
},
"bin": [
"Resources/bin/var-dump-server"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.8-dev"
}
},
"autoload": {
"classmap": [
"src"
],
"files": [
"src/Tracy/functions.php"
"Resources/functions/dump.php"
],
"psr-4": {
"Symfony\\Component\\VarDumper\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
"MIT"
],
"authors": [
{
"name": "David Grudl",
"homepage": "https://davidgrudl.com"
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Nette Community",
"homepage": "https://nette.org/contributors"
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "😎 Tracy: the addictive tool to ease debugging PHP code for cool developers. Friendly design, logging, profiler, advanced features like debugging AJAX calls or CLI support. You will love it.",
"homepage": "https://tracy.nette.org",
"description": "Provides mechanisms for walking through any arbitrary PHP variable",
"homepage": "https://symfony.com",
"keywords": [
"Xdebug",
"debug",
"debugger",
"nette",
"profiler"
"dump"
],
"support": {
"issues": "https://github.com/nette/tracy/issues",
"source": "https://github.com/nette/tracy/tree/v2.8.3"
"source": "https://github.com/symfony/var-dumper/tree/v5.2.3"
},
"time": "2021-01-31T23:07:09+00:00"
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2021-01-27T10:15:41+00:00"
},
{
"name": "twig/twig",

View File

@ -1,7 +1,6 @@
<?php
require_once 'vendor/autoload.php';
use Tracy\Debugger;
use Netpromotion\Profiler\Profiler;
use DebugBar\StandardDebugBar;
if(!file_exists("config.php") && !file_exists("../../config.php")) {
header('Location: install/install.php');
@ -81,6 +80,8 @@ class tools
public function redirect($url)
{
global $debugbar;
if(!is_null($debugbar)) $debugbar->stackData();
if (!headers_sent()) {
header('Location: '.$url);
exit;
@ -143,25 +144,28 @@ class tools
public function profiler_start($name=null)
{
if($this->profiler_enabled) {
global $debugbar;
if($this->profiler_enabled && !is_null($debugbar)) {
if(is_null($name)) {
$name = $this->profiler_last_name;
}
Profiler::start($name);
if($name !== "") $debugbar['time']->startMeasure($name);
}
}
public function profiler_stop($name=null)
{
if($this->profiler_enabled) {
if(is_null($name)) {
global $debugbar;
if($this->profiler_enabled && !is_null($debugbar)) {
if(is_null($name) || $name == "") {
$name = $this->profiler_last_name;
}
Profiler::finish($name);
if($name !== "") $debugbar['time']->stopMeasure($name);
}
}
public function ajax_page_response($response){
global $debugbar;
$json_response = json_encode($response);
$response_data = substr(crc32($json_response), 0, 10);
header("data: ".$response_data);
@ -171,6 +175,7 @@ class tools
} else {
print("{}");
}
if(!is_null($debugbar)) $debugbar->sendDataInHeaders();
}
}
@ -190,7 +195,7 @@ class database
public function connect()
{
try {
$this->connection = new PDO("mysql:host=" . $this->db_host . ";dbname=" . $this->db_dbname, $this->db_username, $this->db_password);
$this->connection = new DebugBar\DataCollector\PDO\TraceablePDO(new PDO("mysql:host=" . $this->db_host . ";dbname=" . $this->db_dbname, $this->db_username, $this->db_password));
$this->connection->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
$this->connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
@ -754,7 +759,7 @@ class translations
function init_class($enableDebugger=true, $headers=true)
{
global $tools, $database, $user, $translations;
global $tools, $database, $user, $translations, $debugbar;
if(!isset($tools) && !isset($database) && !isset($translations)) {
$database = new database();
$tools = new tools($database->getOption("check_cf_ip"), $enableDebugger);
@ -778,7 +783,6 @@ function init_class($enableDebugger=true, $headers=true)
//var_dump($user);
//exit();
//TODO: remove Tracy and replace with Monolog
if(SENTRY_ENABLED){
Sentry\configureScope(function (Sentry\State\Scope $scope): void {
global $user, $translations;
@ -794,30 +798,26 @@ function init_class($enableDebugger=true, $headers=true)
}
$scope->setTag('page.locale', $translations->client_languages[0]);
});
//If Sentry is enabled -> no Tracy bluescreen -> custom tmp bluescreen function
function customErrorPage() {
$error = error_get_last();
if ($error) {
echo 'Errore critico. Torna alla pagina precedente.';
}
}
register_shutdown_function('customErrorPage');
} else {
if($user->requireRole(Role::DEVELOPER)) {
Debugger::enable(Debugger::DEVELOPMENT, __DIR__ . '/error-log');
if($enableDebugger) Profiler::enable();
Debugger::getBar()->addPanel(new Netpromotion\Profiler\Adapter\TracyBarAdapter());
} else {
Debugger::enable(Debugger::PRODUCTION, __DIR__ . '/error-log');
}
if(!$enableDebugger) {
Debugger::$showBar = false;
}
bdump(get_included_files());
bdump($translations->loaded_translations);
//TODO: add Monolog here
}
if($enableDebugger && $user->requireRole(Role::DEVELOPER)) {
$debugbar = new StandardDebugBar();
$debugbar->addCollector(new DebugBar\DataCollector\PDO\PDOCollector($database->connection));
$debugbar->addCollector(new DebugBar\DataCollector\ConfigCollector($database->options));
} else {
$debugbar = null;
}
function customErrorPage() {
$error = error_get_last();
if ($error) {
echo 'Errore critico. Torna alla pagina precedente.'; //TODO: render a translated html page
}
}
register_shutdown_function('customErrorPage');
if(isset($_GET["disableSW"])){
setcookie("disableServiceWorkerInstallation", true);
$tools->redirect("?");
@ -832,6 +832,13 @@ function init_class($enableDebugger=true, $headers=true)
}
}
function bdump($message){
global $debugbar;
if(!is_null($debugbar)){
$debugbar["messages"]->addMessage($message);
}
}
function t($string, $echo=true)
{
global $translations;

View File

@ -47,8 +47,8 @@ if($tools->validate_form("mod", "add")) {
if(isset($_GET["add"])||isset($_GET["edit"])||isset($_GET["delete"])||isset($_GET["mod"])) {
$_SESSION["token"] = bin2hex(random_bytes(64));
}
$crew = $database->exec("SELECT * FROM `%PREFIX%_profiles` ORDER BY name ASC;", true); // Pesco i dati della table e li ordino in base al name
$types = $database->exec("SELECT `name` FROM `%PREFIX%_type` ORDER BY name ASC", true); // Pesco le tipologie della table
$crew = $database->exec("SELECT * FROM `%PREFIX%_profiles` ORDER BY name ASC;", true);
$types = $database->exec("SELECT `name` FROM `%PREFIX%_type` ORDER BY name ASC", true);
$modalità = (isset($_GET["add"])) ? "add" : ((isset($_GET["edit"])) ? "edit" : ((isset($_GET["delete"])) ? "delete" : "add"));
bdump($modalità, "modalità");
bdump($types, "types");
@ -57,7 +57,7 @@ if($tools->validate_form("mod", "add")) {
if(isset($_GET["id"])) {
$id = $_GET["id"];
bdump($database->exists("services", $id));
$values = $database->exec("SELECT * FROM `%PREFIX%_services` WHERE `id` = :id", true, [":id" => $id])[0]; // Pesco le tipologie della table
$values = $database->exec("SELECT * FROM `%PREFIX%_services` WHERE `id` = :id", true, [":id" => $id])[0];
bdump($values);
} else {
$values = [];

View File

@ -45,7 +45,7 @@ if($tools->validate_form("mod", "add")) {
if(isset($_GET["add"])||isset($_GET["edit"])||isset($_GET["delete"])||isset($_GET["mod"])) {
$_SESSION["token"] = bin2hex(random_bytes(64));
}
$crew = $database->exec("SELECT * FROM `%PREFIX%_profiles` ORDER BY name ASC;", true); // Pesco i dati della table e li ordino in base al name
$crew = $database->exec("SELECT * FROM `%PREFIX%_profiles` ORDER BY name ASC;", true);
$modalità = (isset($_GET["add"])) ? "add" : ((isset($_GET["edit"])) ? "edit" : ((isset($_GET["delete"])) ? "delete" : "add"));
bdump($modalità, "modalità");
bdump($crew, "crew");
@ -53,7 +53,7 @@ if($tools->validate_form("mod", "add")) {
if(isset($_GET["id"])) {
$id = $_GET["id"];
bdump($database->exists("trainings", $id));
$values = $database->exec("SELECT * FROM `%PREFIX%_trainings` WHERE `id` = :id", true, [":id" => $id])[0]; // Pesco le types della table
$values = $database->exec("SELECT * FROM `%PREFIX%_trainings` WHERE `id` = :id", true, [":id" => $id])[0];
bdump($values);
} else {
$values = [];

View File

@ -70,7 +70,7 @@ if($tools->validate_form("mod", "add")) {
if(isset($_GET["id"])) {
$id = $_GET["id"];
bdump($database->exists("profiles", $id));
$values = $database->exec("SELECT * FROM `%PREFIX%_profiles` WHERE `id` = :id", true, [":id" => $id])[0]; // Pesco le types della table
$values = $database->exec("SELECT * FROM `%PREFIX%_profiles` WHERE `id` = :id", true, [":id" => $id])[0];
bdump($values);
} else {
$values = [];

View File

@ -1,7 +1,5 @@
<?php
require_once 'ui.php';
if(!isset($_GET["_tracy_bar"])) {
$_SESSION["token_list"] = bin2hex(random_bytes(64));
}
$_SESSION["token_list"] = bin2hex(random_bytes(64));
loadtemplate('list.html', ['title' => t("Availability List", false), 'token_list' => $_SESSION['token_list']]);
bdump($_SESSION);

View File

@ -87,6 +87,7 @@
</script>
{% endif %}
{% endblock %}
{% if enable_debug_bar %}{{ debug_bar_head|raw }}{% endif %}
</head>
<body>
{% block menu %}
@ -116,6 +117,7 @@
{% endblock %}
</div>
<!-- /Content -->
{% if enable_debug_bar %}{{ debug_bar|raw }}{% endif %}
{% block footer %}
<!-- Footer -->
<div class="text-center p-3" style="background-color: rgba(0, 0, 0, 0.2);">

View File

@ -3,6 +3,7 @@
<head>
<link href="favicon.ico" rel="shortcut icon" type="image/vnd.microsoft.icon">
<script src="{{ urlsoftware }}/resources/dist/{{ resource('main.js') }}"></script>
{% if enable_debug_bar %}{{ debug_bar_head|raw }}{% endif %}
</head>
<body>
{% if service.modalità == "edit" or service.modalità == "add" %}
@ -154,5 +155,6 @@
</script>
</div>
{% endif %}
{% if enable_debug_bar %}{{ debug_bar|raw }}{% endif %}
</body>
</html>

View File

@ -3,6 +3,7 @@
<head>
<link href="favicon.ico" rel="shortcut icon" type="image/vnd.microsoft.icon">
<script src="{{ urlsoftware }}/resources/dist/{{ resource('main.js') }}"></script>
{% if enable_debug_bar %}{{ debug_bar_head|raw }}{% endif %}
</head>
<body>
{% if training.modalità == "edit" or training.modalità == "add" %}
@ -104,5 +105,6 @@
</script>
</div>
{% endif %}
{% if enable_debug_bar %}{{ debug_bar|raw }}{% endif %}
</body>
</html>

View File

@ -3,6 +3,7 @@
<head>
<link href="favicon.ico" rel="shortcut icon" type="image/vnd.microsoft.icon">
<script src="{{ urlsoftware }}/resources/dist/{{ resource('main.js') }}"></script>
{% if enable_debug_bar %}{{ debug_bar_head|raw }}{% endif %}
</head>
<body>
{% if modalità == "edit" or modalità == "add" %}
@ -81,5 +82,6 @@
</script>
</div>
{% endif %}
{% if enable_debug_bar %}{{ debug_bar|raw }}{% endif %}
</body>
</html>

View File

@ -2,6 +2,16 @@
require_once 'core.php';
init_class();
if(!is_null($debugbar)){
$enable_debugbar = true;
$debugbarRenderer = $debugbar->getJavascriptRenderer("./vendor/maximebf/debugbar/src/DebugBar/Resources");
$debugbarRenderer->disableVendor("jquery");
$debugbarRenderer->disableVendor("fontawesome");
$debugbarRenderer->setEnableJqueryNoConflict(false);
} else {
$enable_debugbar = false;
}
p_start("Load Twig");
$webpack_manifest = json_decode(
file_get_contents(realpath("resources/dist/manifest.json")),
@ -50,7 +60,7 @@ p_stop();
$template = null;
function loadtemplate($templatename, $data, $requirelogin=true)
{
global $database, $user, $twig, $template;
global $database, $user, $twig, $template, $enable_debugbar, $debugbarRenderer;
p_start("Render Twig template");
if($requirelogin) {
$user->requirelogin();
@ -58,6 +68,9 @@ function loadtemplate($templatename, $data, $requirelogin=true)
$data['delete_caches'] = isset($_GET["deleteCache"]) || isset($_GET["unregisterSW"]) || isset($_GET["unregisterSWandDisable"]);
$data['delete_service_workers'] = isset($_GET["unregisterSW"]) || isset($_GET["unregisterSWandDisable"]);
$data['delete_service_workers_and_disable'] = isset($_GET["unregisterSWandDisable"]);
$data['enable_debug_bar'] = $enable_debugbar;
$data['debug_bar_head'] = $enable_debugbar ? $debugbarRenderer->renderHead() : "";
$data['debug_bar'] = $enable_debugbar ? $debugbarRenderer->render() : "";
$data['owner'] = $database->getOption("owner");
$data['urlsoftware'] = $database->getOption("web_url");
$data['user'] = $user->info();