Skip to content

Commit 6d459f0

Browse files
committed
Merge pull request #14 from yangweijie/master
添加环境检测的工具
2 parents dffa51c + c012d06 commit 6d459f0

File tree

14 files changed

+532
-0
lines changed

14 files changed

+532
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
php_value display_errors 'On'
Lines changed: 218 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,218 @@
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+
10+
header('Content-Type: text/html; charset=utf-8');
11+
header('Cache-Control: s-maxage=0, max-age=0, must-revalidate');
12+
header('Expires: Mon, 23 Jan 1978 10:00:00 GMT');
13+
?>
14+
<!DOCTYPE html>
15+
<html>
16+
<head>
17+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
18+
<meta name="robots" content="noindex">
19+
<meta name="generator" content="Nette Framework">
20+
21+
<title>ThinkPHP环境探针</title>
22+
23+
<style type="text/css">
24+
html {
25+
font: 13px/1.5 Verdana, sans-serif;
26+
border-top: 5.3em solid #F4EBDB;
27+
}
28+
29+
body {
30+
border-top: 1px solid #E4DED5;
31+
margin: 0;
32+
background: white;
33+
color: #333;
34+
}
35+
36+
#wrapper {
37+
max-width: 780px;
38+
margin: -88px auto 0;
39+
}
40+
41+
h1 {
42+
font: 2.3em/1.5 sans-serif;
43+
background: url(<?php echo $_SERVER['PHP_SELF'] .
44+
'?=' . php_logo_guid(); ?>) right center no-repeat;
45+
color: #7A7772;
46+
text-shadow: 1px 1px 0 white;
47+
height:70px;
48+
line-height: 70px
49+
}
50+
51+
h2 {
52+
font-size: 2em;
53+
font-weight: normal;
54+
color: #3484D2;
55+
margin: .7em 0;
56+
}
57+
58+
p {
59+
margin: 1.2em 0;
60+
}
61+
62+
.result {
63+
margin: 1.5em 0;
64+
padding: 0 1em;
65+
border: 2px solid white;
66+
}
67+
68+
.passed h2 {
69+
color: #1A7E1E;
70+
}
71+
72+
.failed h2 {
73+
color: white;
74+
}
75+
76+
table {
77+
padding: 0;
78+
margin: 0;
79+
border-collapse: collapse;
80+
width: 100%;
81+
}
82+
83+
table td, table th {
84+
text-align: left;
85+
padding: 10px;
86+
vertical-align: top;
87+
border-style: solid;
88+
border-width: 1px 0 0;
89+
border-color: inherit;
90+
background: white none no-repeat 12px 8px;
91+
background-color: inherit;
92+
}
93+
94+
table th {
95+
font-size: 105%;
96+
font-weight: bold;
97+
padding-left: 50px;
98+
}
99+
100+
.passed, .info {
101+
background-color: #E4F9E3;
102+
border-color: #C6E5C4;
103+
}
104+
105+
.passed th {
106+
background-image: url('assets/passed.gif');
107+
}
108+
109+
.info th {
110+
background-image: url('assets/info.gif');
111+
}
112+
113+
.warning {
114+
background-color: #FEFAD4;
115+
border-color: #EEEE99;
116+
}
117+
118+
.warning th {
119+
background-image: url('assets/warning.gif');
120+
}
121+
122+
.failed {
123+
background-color: #F4D2D2;
124+
border-color: #D2B994;
125+
}
126+
127+
div.failed {
128+
background-color: #CD1818;
129+
border-color: #CD1818;
130+
}
131+
132+
.failed th {
133+
background-image: url('assets/failed.gif');
134+
}
135+
136+
.description td {
137+
border-top: none !important;
138+
padding: 0 10px 10px 50px;
139+
color: #555;
140+
}
141+
142+
.passed.description {
143+
display: none;
144+
}
145+
</style>
146+
147+
<script type="text/javascript">
148+
var displayResult = function(id, passed) {
149+
var tr = document.getElementById('res' + id);
150+
tr.className = passed ? 'passed' : 'warning';
151+
tr.getElementsByTagName('td').item(0).innerHTML = passed ? '支持' : '不支持';
152+
if (tr = document.getElementById('desc' + id)) {
153+
if (passed) {
154+
tr.parentNode.removeChild(tr);
155+
} else {
156+
tr.className = 'warning description';
157+
}
158+
}
159+
}
160+
</script>
161+
</head>
162+
163+
<body>
164+
<div id="wrapper">
165+
<h1>ThinkPHP框架环境探针</h1>
166+
167+
<p>本脚本检测是否你的PHP配置满足运行<a href="http://thinkphp.cn/">ThinkPHP框架</a>.它检测了PHP版本,是否合适的PHP扩展被加载了,还有是否PHP配置设置正确.</p>
168+
169+
<?php if ($errors): ?>
170+
<div class="failed result">
171+
<h2>对不起,你的服务器配置不满足ThinkPHP框架的要求.</h2>
172+
</div>
173+
<?php else: ?>
174+
<div class="passed result">
175+
<h2>祝贺你!服务器配置满足ThinkPHP框架的要求.</h2>
176+
<?php if ($warnings):?><p><strong>请看下面列出的警告项.</strong></p><?php endif ?>
177+
</div>
178+
<?php endif ?>
179+
180+
181+
<h2>详情</h2>
182+
183+
<table>
184+
<?php foreach ($requirements as $id => $requirement):?>
185+
<?php $class = isset($requirement->passed) ? ($requirement->passed ? 'passed' : ($requirement->required ? 'failed' : 'warning')) : 'info' ?>
186+
<tr id="res<?php echo $id ?>" class="<?php echo $class ?>">
187+
<th><?php echo htmlSpecialChars($requirement->title) ?></th>
188+
189+
<?php if (empty($requirement->passed) && isset($requirement->errorMessage)): ?>
190+
<td><?php echo htmlSpecialChars($requirement->errorMessage) ?></td>
191+
<?php elseif (isset($requirement->message)): ?>
192+
<td><?php echo htmlSpecialChars($requirement->message) ?></td>
193+
<?php elseif (isset($requirement->passed)): ?>
194+
<td><?php echo $requirement->passed ? '支持' : '不支持' ?></td>
195+
<?php else: ?>
196+
<td>未测试</td>
197+
<?php endif ?>
198+
</tr>
199+
200+
<?php if (isset($requirement->description)): ?>
201+
<tr id="desc<?php echo $id ?>" class="<?php echo $class ?> description">
202+
<td colspan="2"><?php echo $requirement->description ?></td>
203+
</tr>
204+
<?php endif ?>
205+
206+
<?php if (isset($requirement->script)): ?>
207+
<?php echo $requirement->script ?>
208+
<?php endif ?>
209+
210+
<?php endforeach ?>
211+
</table>
212+
213+
<?php if ($errors): ?><p>请检查错误信息然后再<a href="?">试一次</a>.</p><?php endif ?>
214+
215+
<p><small>探针版本<?php echo CHECKER_VERSION ?></small></p>
216+
</div>
217+
</body>
218+
</html>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Order Allow,Deny
2+
Deny from all
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
fileProtectionChecker = true;
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<configuration>
3+
<system.webServer>
4+
<rewrite>
5+
<rules>
6+
<rule name="Deny Rule 1" patternSyntax="Wildcard" stopProcessing="true">
7+
<match url="*" />
8+
<conditions>
9+
<add input="{URL}" pattern="*" />
10+
</conditions>
11+
<action type="CustomResponse" statusCode="403" statusReason="Forbidden: Access is denied." statusDescription="You do not have permission to view this directory or page using the credentials that you supplied." />
12+
</rule>
13+
</rules>
14+
</rewrite>
15+
</system.webServer>
16+
</configuration>
884 Bytes
Loading
812 Bytes
Loading
1.31 KB
Loading
897 Bytes
Loading
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
RewriteEngine On
2+
RewriteRule .* checker.js [L]

0 commit comments

Comments
 (0)