-
Notifications
You must be signed in to change notification settings - Fork 1
/
NoticePage.php
46 lines (38 loc) · 985 Bytes
/
NoticePage.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
class NoticePage extends UnlistedSpecialPage {
function execute( $par ) {
global $wgOut;
$wgOut->disable();
$this->sendHeaders();
$js = $this->getJsOutput( $par );
if( strlen( $js ) == 0 ) {
/* Hack for IE/Mac 0-length keepalive problem, see RawPage.php */
echo "/* Empty */";
} else {
echo $js;
}
}
protected function sharedMaxAge() {
return 600;
}
protected function maxAge() {
return 600;
}
private function sendHeaders() {
$smaxage = $this->sharedMaxAge();
$maxage = $this->maxAge();
$epoch = wfTimestamp( TS_RFC2822, efCentralNoticeEpoch() );
// Paranoia
$public = (session_id() == '');
header( "Content-type: text/javascript; charset=utf-8" );
if( $public ) {
header( "Cache-Control: public, s-maxage=$smaxage, max-age=$maxage" );
} else {
header( "Cache-Control: private, s-maxage=0, max-age=$maxage" );
}
header( "Last-modified: $epoch" );
}
function getJsOutput( $par ) {
return "";
}
}