Nicer formatting for phpinfo output

This commit is contained in:
snipe 2017-07-08 00:22:30 -07:00
parent c2927c4a2e
commit 33557f3792
2 changed files with 39 additions and 11 deletions

View file

@ -696,7 +696,11 @@ class SettingsController extends Controller
*/ */
public function getPhpInfo() 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.');
} }

View file

@ -11,21 +11,45 @@
@stop @stop
{{-- Page content --}} {{-- Page content --}}
@section('content') @section('content')
@if (config('app.debug')=== true)
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<?php phpinfo(); ?> <div class="box box-default">
</div> <!-- /.col-md-12--> <div class="box-header">
</div> <!-- /.row--> <h3 class="box-title">{{ trans('admin/settings/general.system') }}</h3>
</div>
<div class="box-body">
@else <?php
<div class="col-md-12"> ob_start();
<div class="alert alert-danger"> phpinfo();
This information is only available when debug is enabled.
</div>
@endif
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 @stop