SproutCMS

This is the code documentation for the SproutCMS project

source of /sprout/views/dbtools/php_info.php

  1. <?php
  2. use Sprout\Helpers\Enc;
  3. use Sprout\Helpers\Subsites;
  4. ?>
  5.  
  6. <style>
  7. table.main-list {
  8. margin-bottom: 2em;
  9. }
  10. #phpinfo table {
  11. background-color: white;
  12. border: 1px #B8B7B7 solid;
  13. width: 100%;
  14. margin-bottom: 2em;
  15. }
  16. #phpinfo table tr {
  17. background-color: #F9F9FB;
  18. }
  19. #phpinfo table tr:nth-child(even) {
  20. background-color: white;
  21. }
  22. #phpinfo table td.e,
  23. #phpinfo table th {
  24. text-align: left;
  25. padding: 4px 6px;
  26. font-weight: bold;
  27. }
  28. #phpinfo table td {
  29. padding: 4px 6px;
  30. max-width: 500px;
  31. overflow: hidden;
  32. text-overflow: ellipsis;
  33. }
  34. </style>
  35.  
  36. <?php if (!empty($vals) and count($vals) > 0): ?>
  37. <table class="main-list">
  38. <caption>Basics</caption>
  39. <thead>
  40. <tr>
  41. <th>Key</th>
  42. <th>Value</th>
  43. </tr>
  44. </thead>
  45. <tbody>
  46. <?php foreach ($vals as $key => $val): ?>
  47. <tr>
  48. <td><strong><?php echo Enc::html($key); ?></strong></th>
  49. <td><?php echo Enc::html($val); ?></td>
  50. </tr>
  51. <?php endforeach; ?>
  52. </tbody>
  53. </table>
  54. <?php endif; ?>
  55.  
  56. <?php if (!empty($subsites) and count($subsites)): ?>
  57. <table class="main-list">
  58. <caption>Sub-sites</caption>
  59. <thead>
  60.  
  61. <tr>
  62. <th>ID</th>
  63. <th>Name</th>
  64. <th>Code</th>
  65. <th>Domain</th>
  66. </tr>
  67. </thead>
  68. <tbody>
  69. <?php foreach ($subsites as $subsite): ?>
  70. <tr>
  71. <td><?= Enc::html($subsite['id']); ?></td>
  72. <td><?= Enc::html($subsite['name']); ?></td>
  73. <td><?= Enc::html($subsite['code']); ?></td>
  74. <td><?= Enc::html(Subsites::getAbsRoot($subsite['id'])); ?></td>
  75. </tr>
  76. <?php endforeach; ?>
  77. </tbody>
  78. </table>
  79. <?php endif; ?>
  80.  
  81. <?php
  82. $phpinfo = ob_get_contents();
  83. $phpinfo = preg_replace('%^.*<body>(.*)</body>.*$%ms', '$1', $phpinfo);
  84. echo "<div id='phpinfo'>{$phpinfo}</div>";
  85. ?>
  86.