checker.phtml 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. <?php
  2. /**
  3. * ThinkPHP框架探针 改自 Nette Framework Requirements Checker template.
  4. *
  5. * @param array $requirements
  6. * @param bool $errors
  7. * @param bool $warnings
  8. */
  9. header('Content-Type: text/html; charset=utf-8');
  10. header('Cache-Control: s-maxage=0, max-age=0, must-revalidate');
  11. header('Expires: Mon, 23 Jan 1978 10:00:00 GMT');
  12. ?>
  13. <!DOCTYPE html>
  14. <html>
  15. <head>
  16. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  17. <meta name="robots" content="noindex">
  18. <meta name="generator" content="Nette Framework">
  19. <title>ThinkPHP环境探针</title>
  20. <style type="text/css">
  21. html {
  22. font: 13px/1.5 Verdana, sans-serif;
  23. border-top: 5.3em solid #F4EBDB;
  24. }
  25. body {
  26. border-top: 1px solid #E4DED5;
  27. margin: 0;
  28. background: white;
  29. color: #333;
  30. }
  31. #wrapper {
  32. max-width: 780px;
  33. margin: -88px auto 0;
  34. }
  35. h1 {
  36. font: 2.3em/1.5 sans-serif;
  37. background: url(<?php echo $_SERVER['PHP_SELF'] .
  38. '?=' . php_logo_guid(); ?>) right center no-repeat;
  39. color: #7A7772;
  40. text-shadow: 1px 1px 0 white;
  41. height:70px;
  42. line-height: 70px
  43. }
  44. h2 {
  45. font-size: 2em;
  46. font-weight: normal;
  47. color: #3484D2;
  48. margin: .7em 0;
  49. }
  50. p {
  51. margin: 1.2em 0;
  52. }
  53. .result {
  54. margin: 1.5em 0;
  55. padding: 0 1em;
  56. border: 2px solid white;
  57. }
  58. .passed h2 {
  59. color: #1A7E1E;
  60. }
  61. .failed h2 {
  62. color: white;
  63. }
  64. table {
  65. padding: 0;
  66. margin: 0;
  67. border-collapse: collapse;
  68. width: 100%;
  69. }
  70. table td, table th {
  71. text-align: left;
  72. padding: 10px;
  73. vertical-align: top;
  74. border-style: solid;
  75. border-width: 1px 0 0;
  76. border-color: inherit;
  77. background: white none no-repeat 12px 8px;
  78. background-color: inherit;
  79. }
  80. table th {
  81. font-size: 105%;
  82. font-weight: bold;
  83. padding-left: 50px;
  84. }
  85. .passed, .info {
  86. background-color: #E4F9E3;
  87. border-color: #C6E5C4;
  88. }
  89. .passed th {
  90. background-image: url('assets/passed.gif');
  91. }
  92. .info th {
  93. background-image: url('assets/info.gif');
  94. }
  95. .warning {
  96. background-color: #FEFAD4;
  97. border-color: #EEEE99;
  98. }
  99. .warning th {
  100. background-image: url('assets/warning.gif');
  101. }
  102. .failed {
  103. background-color: #F4D2D2;
  104. border-color: #D2B994;
  105. }
  106. div.failed {
  107. background-color: #CD1818;
  108. border-color: #CD1818;
  109. }
  110. .failed th {
  111. background-image: url('assets/failed.gif');
  112. }
  113. .description td {
  114. border-top: none !important;
  115. padding: 0 10px 10px 50px;
  116. color: #555;
  117. }
  118. .passed.description {
  119. display: none;
  120. }
  121. </style>
  122. <script type="text/javascript">
  123. var displayResult = function(id, passed) {
  124. var tr = document.getElementById('res' + id);
  125. tr.className = passed ? 'passed' : 'warning';
  126. tr.getElementsByTagName('td').item(0).innerHTML = passed ? '支持' : '不支持';
  127. if (tr = document.getElementById('desc' + id)) {
  128. if (passed) {
  129. tr.parentNode.removeChild(tr);
  130. } else {
  131. tr.className = 'warning description';
  132. }
  133. }
  134. }
  135. </script>
  136. </head>
  137. <body>
  138. <div id="wrapper">
  139. <h1>ThinkPHP框架环境探针</h1>
  140. <p>本脚本检测是否你的PHP配置满足运行<a href="http://thinkphp.cn/">ThinkPHP框架</a>.它检测了PHP版本,是否合适的PHP扩展被加载了,还有是否PHP配置设置正确.</p>
  141. <?php if ($errors): ?>
  142. <div class="failed result">
  143. <h2>对不起,你的服务器配置不满足ThinkPHP框架的要求.</h2>
  144. </div>
  145. <?php else: ?>
  146. <div class="passed result">
  147. <h2>祝贺你!服务器配置满足ThinkPHP框架的要求.</h2>
  148. <?php if ($warnings):?><p><strong>请看下面列出的警告项.</strong></p><?php endif ?>
  149. </div>
  150. <?php endif ?>
  151. <h2>详情</h2>
  152. <table>
  153. <?php foreach ($requirements as $id => $requirement):?>
  154. <?php $class = isset($requirement->passed) ? ($requirement->passed ? 'passed' : ($requirement->required ? 'failed' : 'warning')) : 'info' ?>
  155. <tr id="res<?php echo $id ?>" class="<?php echo $class ?>">
  156. <th><?php echo htmlSpecialChars($requirement->title) ?></th>
  157. <?php if (empty($requirement->passed) && isset($requirement->errorMessage)): ?>
  158. <td><?php echo htmlSpecialChars($requirement->errorMessage) ?></td>
  159. <?php elseif (isset($requirement->message)): ?>
  160. <td><?php echo htmlSpecialChars($requirement->message) ?></td>
  161. <?php elseif (isset($requirement->passed)): ?>
  162. <td><?php echo $requirement->passed ? '支持' : '不支持' ?></td>
  163. <?php else: ?>
  164. <td>未测试</td>
  165. <?php endif ?>
  166. </tr>
  167. <?php if (isset($requirement->description)): ?>
  168. <tr id="desc<?php echo $id ?>" class="<?php echo $class ?> description">
  169. <td colspan="2"><?php echo $requirement->description ?></td>
  170. </tr>
  171. <?php endif ?>
  172. <?php if (isset($requirement->script)): ?>
  173. <?php echo $requirement->script ?>
  174. <?php endif ?>
  175. <?php endforeach ?>
  176. </table>
  177. <?php if ($errors): ?><p>请检查错误信息然后再<a href="?">试一次</a>.</p><?php endif ?>
  178. <p><small>探针版本<?php echo CHECKER_VERSION ?></small></p>
  179. </div>
  180. </body>
  181. </html>