Skip to content

A free open source IT asset/license management system

Nicer formatting for phpinfo output

snipe33557f37921b
diff --git a/app/Http/Controllers/SettingsController.php b/app/Http/Controllers/SettingsController.php
index f930457edb..d1ed933ce1 100755
--- a/app/Http/Controllers/SettingsController.php
+++ b/app/Http/Controllers/SettingsController.php
@@ -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.');
}
diff --git a/resources/views/settings/phpinfo.blade.php b/resources/views/settings/phpinfo.blade.php
index 4513d2626c..9b43b08c2a 100644
--- a/resources/views/settings/phpinfo.blade.php
+++ b/resources/views/settings/phpinfo.blade.php
@@ -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