Added phpinfo debugger
Added PHPinfo section to the config editor to display information about the current state of PHP. This new section can be found on the Admin Panel under 'Admin>Config>PHP Info'. For this, a new route and section in the admin controller have been added. The page is loaded as phpinfo.blade.php with the route .../panel/phpinfo if the user is authenticated as an admin. I added the usual dark mode detection to the page, with an extra section that changes the background color according to the preferred theme setting. The page itself can be downloaded and saved as an HTML, for this JavaScript is used.
This commit is contained in:
parent
89d54492fd
commit
6f0bf16587
|
@ -177,4 +177,11 @@ class AdminController extends Controller
|
|||
|
||||
return view('pages', ['data' => $data, 'name' => $name]);
|
||||
}
|
||||
|
||||
//Statistics of the number of clicks and links
|
||||
public function phpinfo()
|
||||
{
|
||||
return view('panel/phpinfo');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,98 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
@if(auth()->user()->role == 'admin')
|
||||
<head>
|
||||
<!-- begin dark mode detection -->
|
||||
<script src="{{ asset('littlelink/js/js.cookie.min.js') }}"></script>
|
||||
<script>
|
||||
// code to set the `color_scheme` cookie
|
||||
var $color_scheme = Cookies.get("color_scheme");
|
||||
function get_color_scheme() {
|
||||
return (window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches) ? "dark" : "light";
|
||||
}
|
||||
function update_color_scheme() {
|
||||
Cookies.set("color_scheme", get_color_scheme());
|
||||
}
|
||||
// read & compare cookie `color-scheme`
|
||||
if ((typeof $color_scheme === "undefined") || (get_color_scheme() != $color_scheme))
|
||||
update_color_scheme();
|
||||
// detect changes and change the cookie
|
||||
if (window.matchMedia)
|
||||
window.matchMedia("(prefers-color-scheme: dark)").addListener( update_color_scheme );
|
||||
// reloads page to apply the dark mode cookie
|
||||
window.onload = function() {
|
||||
if(!window.location.hash && get_color_scheme() == "dark" && (get_color_scheme() != $color_scheme)) {
|
||||
window.location = window.location + '#dark';
|
||||
window.location.reload();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<?php // loads dark mode CSS if dark mode detected
|
||||
$color_scheme = isset($_COOKIE["color_scheme"]) ? $_COOKIE["color_scheme"] : false; ?>
|
||||
@if ($color_scheme == 'dark')
|
||||
<!-- switch the two <link> Tags below to default to dark mode if cookie detection fails -->
|
||||
<link rel="stylesheet" href="{{ asset('/studio/css/bootstrap.min-dark.css') }}">
|
||||
<link rel="stylesheet" href="{{ asset('/studio/css/style-dashboard-dark.css') }}">
|
||||
@else
|
||||
<link rel="stylesheet" href="{{ asset('/studio/css/bootstrap.min.css') }}">
|
||||
<link rel="stylesheet" href="{{ asset('/studio/css/style-dashboard.css') }}">
|
||||
@endif
|
||||
|
||||
<style>
|
||||
@if($color_scheme == 'dark')
|
||||
body { background-color: #31363b; margin: 0 0 0 0;}
|
||||
|
||||
#zPHP { background-color: #31363b; }
|
||||
|
||||
#presentation
|
||||
{
|
||||
width:500px;
|
||||
height: 140px;
|
||||
text-align: center;
|
||||
color: lightGray;
|
||||
margin: auto;
|
||||
margin-top: -20px;
|
||||
padding-top: 40px;
|
||||
}
|
||||
@else
|
||||
body { background-color: #fafafa; margin: 0 0 0 0;}
|
||||
|
||||
#zPHP { background-color: #fafafa; }
|
||||
|
||||
#presentation
|
||||
{
|
||||
width:500px;
|
||||
height: 140px;
|
||||
text-align: center;
|
||||
color: lightGray;
|
||||
margin: auto;
|
||||
margin-top: -20px;
|
||||
padding-top: 40px;
|
||||
}
|
||||
@endif
|
||||
</style>
|
||||
<!-- end dark mode detection -->
|
||||
|
||||
<title>Info PHP</title>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="shortcut icon" href="https://www.php.net/favicon.ico">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div id='zPHP'>
|
||||
<div style="position: relative; top: 50px; z-index: 2;"><a href="{{ url('/env-editor') }}" style="font-size: 40px;" > Back</a></div>
|
||||
<div style="position: relative; bottom: 60px; right: 15px; z-index: 1;" align="right"><a onclick="this.href='data:text/html;charset=UTF-8,'+encodeURIComponent(document.documentElement.outerHTML)" href="#" download="phpinfo.html"><button class="btn btn-primary">Download</button></a></div>
|
||||
<div id='presentation'>
|
||||
<h1>Information about PHP's configuration</h1>
|
||||
<h2>Outputs information about the current state of PHP</h2>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
phpinfo();
|
||||
phpinfo(INFO_MODULES);
|
||||
|
||||
?>
|
||||
</div>
|
||||
</body>
|
||||
@endif
|
||||
</html>
|
|
@ -22,6 +22,9 @@
|
|||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#upload-env" role="tab">{{__($translatePrefix.'views.tabTitles.upload')}}</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ url('/panel/phpinfo') }}" role="tab">PHP Info</a>
|
||||
</li>
|
||||
<li class="nav-item ml-auto">
|
||||
<env-editor-config-actions></env-editor-config-actions>
|
||||
</li>
|
||||
|
|
|
@ -71,6 +71,7 @@ Route::get('/panel/pages', [AdminController::class, 'showSitePage'])->name('show
|
|||
Route::post('/panel/pages', [AdminController::class, 'editSitePage'])->name('editSitePage');
|
||||
Route::get('/panel/site', [AdminController::class, 'showSite'])->name('showSite');
|
||||
Route::post('/panel/site', [AdminController::class, 'editSite'])->name('editSite');
|
||||
Route::get('/panel/phpinfo', [AdminController::class, 'phpinfo'])->name('phpinfo');
|
||||
});
|
||||
|
||||
require __DIR__.'/auth.php';
|
||||
|
|
Loading…
Reference in New Issue