1
1
<?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 ' ]]);
10
41
}
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 ' ]]);
32
42
33
43
function getJS ($ files )
34
44
{
35
45
$ js = '' ;
36
- foreach ($ files as $ f )
46
+ foreach ($ files as $ f )
37
47
{
38
- $ js .= file_get_contents (WEBPATH . $ f );
48
+ $ js .= file_get_contents (WEBPATH . $ f );
39
49
$ js .= "\n" ;
40
50
}
51
+
41
52
return $ js ;
42
53
}
0 commit comments