-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSpecialAllowAnonDiffViewing.php
More file actions
45 lines (36 loc) · 1.11 KB
/
SpecialAllowAnonDiffViewing.php
File metadata and controls
45 lines (36 loc) · 1.11 KB
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
<?php
class SpecialAllowAnonDiffViewing extends SpecialPage {
function __construct() {
parent::__construct('AllowAnonDiffViewing');
}
function getGroupName() {
return '';
}
function showForm() {
$this->getOutput()->addHTML(Html::openElement('form', ['method' => 'post', $this->getPageTitle()->getLocalUrl()]));
$this->getOutput()->addHTML(
Html::rawElement(
'div',
[],
$this->msg('diffblocker-anon-diff-form-content')->parse()
)
);
$this->getOutput()->addHTML(
Html::element('button', ['type' => 'submit'], 'Allow')
);
$this->getOutput()->addHTML(Html::closeElement('form'));
}
function handlePost() {
$this->getRequest()->getSession()->persist();
$this->getRequest()->getSession()->set('anondiffs', 'true');
$this->getOutput()->addHTML($this->msg('diffblocker-anon-diff-success')->parse());
}
function execute($par) {
$this->getOutput()->setPageTitle( $this->msg( "allowanondiffviewing" )->escaped() );
if ($this->getRequest()->wasPosted()) {
$this->handlePost();
} else {
$this->showForm();
}
}
}