Skip to content

Commit 9ab3ae0

Browse files
committed
更新首页
1 parent 2510c57 commit 9ab3ae0

File tree

2 files changed

+47
-33
lines changed

2 files changed

+47
-33
lines changed

web/index.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<?php
22
require dirname(__DIR__) . '/server/config.php';
3-
define('MARKDOWN_LIB_DIR', __DIR__ . '/apps/classes');
43
Swoole\Error::$echo_html = true;
5-
$php->runMVC();
4+
if ($_SERVER['HTTP_HOST'] == 'wiki.swoole.com')
5+
{
6+
Swoole::$default_controller['controller'] = 'wiki';
7+
}
8+
Swoole::$php->runMVC();
69

web/static/js.php

Lines changed: 42 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,53 @@
11
<?php
2-
$headers = apache_request_headers();
3-
$client_time = (isset($headers['If-Modified-Since']) ? strtotime($headers['If-Modified-Since']) : 0);
4-
$now=gmmktime();
5-
$now_list=gmmktime()-60*5;
6-
if ($client_time<$now and $client_time >$now_list){
7-
header('Last-Modified: '.gmdate('D, d M Y H:i:s', $client_time).'GMT', true, 304);
8-
}else{
9-
header('Last-Modified: '.gmdate('D, d M Y H:i:s', $now).' GMT', true, 200);
2+
$client_time = (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) : 0);
3+
$now = time();
4+
$now_list = time() - 60 * 5;
5+
if ($client_time < $now and $client_time > $now_list)
6+
{
7+
header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $client_time) . 'GMT', true, 304);
8+
}
9+
else
10+
{
11+
header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $now) . ' GMT', true, 200);
12+
}
13+
$js['sh'] = array(
14+
'/static/scripts/shCore.js',
15+
'/static/scripts/shBrushBash.js',
16+
'/static/scripts/shBrushCpp.js',
17+
'/static/scripts/shBrushCSharp.js',
18+
'/static/scripts/shBrushCss.js',
19+
'/static/scripts/shBrushDelphi.js',
20+
'/static/scripts/shBrushDiff.js',
21+
'/static/scripts/shBrushGroovy.js',
22+
'/static/scripts/shBrushJava.js',
23+
'/static/scripts/shBrushJScript.js',
24+
'/static/scripts/shBrushPhp.js',
25+
'/static/scripts/shBrushPlain.js',
26+
'/static/scripts/shBrushPython.js',
27+
'/static/scripts/shBrushRuby.js',
28+
'/static/scripts/shBrushScala.js',
29+
'/static/scripts/shBrushSql.js',
30+
'/static/scripts/shBrushVb.js',
31+
'/static/scripts/shBrushXml.js'
32+
);
33+
define("WEBPATH", realpath('../'));
34+
if (isset($_GET['file']))
35+
{
36+
echo getJS(explode('|', $_GET['file']));
37+
}
38+
elseif (isset($_GET['g']))
39+
{
40+
echo getJS($js[$_GET['g']]);
1041
}
11-
$js['sh'] = array('/static/scripts/shCore.js',
12-
'/static/scripts/shBrushBash.js',
13-
'/static/scripts/shBrushCpp.js',
14-
'/static/scripts/shBrushCSharp.js',
15-
'/static/scripts/shBrushCss.js',
16-
'/static/scripts/shBrushDelphi.js',
17-
'/static/scripts/shBrushDiff.js',
18-
'/static/scripts/shBrushGroovy.js',
19-
'/static/scripts/shBrushJava.js',
20-
'/static/scripts/shBrushJScript.js',
21-
'/static/scripts/shBrushPhp.js',
22-
'/static/scripts/shBrushPlain.js',
23-
'/static/scripts/shBrushPython.js',
24-
'/static/scripts/shBrushRuby.js',
25-
'/static/scripts/shBrushScala.js',
26-
'/static/scripts/shBrushSql.js',
27-
'/static/scripts/shBrushVb.js',
28-
'/static/scripts/shBrushXml.js');
29-
define("WEBPATH",realpath('../'));
30-
if(isset($_GET['file'])) echo getJS(explode('|',$_GET['file']));
31-
elseif(isset($_GET['g'])) echo getJS($js[$_GET['g']]);
3242

3343
function getJS($files)
3444
{
3545
$js = '';
36-
foreach($files as $f)
46+
foreach ($files as $f)
3747
{
38-
$js .= file_get_contents(WEBPATH.$f);
48+
$js .= file_get_contents(WEBPATH . $f);
3949
$js .= "\n";
4050
}
51+
4152
return $js;
4253
}

0 commit comments

Comments
 (0)