mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 05:34:06 -08:00
Nicer formatting for phpinfo output
This commit is contained in:
parent
c2927c4a2e
commit
33557f3792
|
@ -696,7 +696,11 @@ class SettingsController extends Controller
|
|||
*/
|
||||
public function getPhpInfo()
|
||||
{
|
||||
return view('settings.phpinfo');
|
||||
if (config('app.debug')=== true) {
|
||||
return view('settings.phpinfo');
|
||||
}
|
||||
return redirect()->route('settings.index')
|
||||
->with('error', 'PHP syetem debugging information is only available when debug is enabled in your .env file.');
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -11,21 +11,45 @@
|
|||
@stop
|
||||
|
||||
|
||||
|
||||
{{-- Page content --}}
|
||||
@section('content')
|
||||
@if (config('app.debug')=== true)
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<?php phpinfo(); ?>
|
||||
</div> <!-- /.col-md-12-->
|
||||
</div> <!-- /.row-->
|
||||
<div class="box box-default">
|
||||
<div class="box-header">
|
||||
<h3 class="box-title">{{ trans('admin/settings/general.system') }}</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
|
||||
@else
|
||||
<div class="col-md-12">
|
||||
<div class="alert alert-danger">
|
||||
This information is only available when debug is enabled.
|
||||
</div>
|
||||
@endif
|
||||
<?php
|
||||
ob_start();
|
||||
phpinfo();
|
||||
|
||||
preg_match ('%<style type="text/css">(.*?)</style>.*?(<body>.*</body>)%s', ob_get_clean(), $matches);
|
||||
|
||||
# $matches [1]; # Style information
|
||||
# $matches [2]; # Body information
|
||||
|
||||
echo "<div class='phpinfodisplay'><style type='text/css'>\n",
|
||||
join( "\n",
|
||||
array_map(
|
||||
create_function(
|
||||
'$i',
|
||||
'return ".phpinfodisplay " . preg_replace( "/,/", ",.phpinfodisplay ", $i );'
|
||||
),
|
||||
preg_split( '/\n/', $matches[1] )
|
||||
)
|
||||
),
|
||||
"</style>\n",
|
||||
$matches[2],
|
||||
"\n</div>\n";
|
||||
?>
|
||||
</div>
|
||||
</div> <!-- /box-body-->
|
||||
</div> <!--/box-default-->
|
||||
|
||||
</div><!--/col-md-8-->
|
||||
</div><!--/row-->
|
||||
@stop
|
||||
|
|
Loading…
Reference in a new issue