1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Implements Special:Newimages |
4
|
|
|
* |
5
|
|
|
* This program is free software; you can redistribute it and/or modify |
6
|
|
|
* it under the terms of the GNU General Public License as published by |
7
|
|
|
* the Free Software Foundation; either version 2 of the License, or |
8
|
|
|
* (at your option) any later version. |
9
|
|
|
* |
10
|
|
|
* This program is distributed in the hope that it will be useful, |
11
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
12
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13
|
|
|
* GNU General Public License for more details. |
14
|
|
|
* |
15
|
|
|
* You should have received a copy of the GNU General Public License along |
16
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc., |
17
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
18
|
|
|
* http://www.gnu.org/copyleft/gpl.html |
19
|
|
|
* |
20
|
|
|
* @file |
21
|
|
|
* @ingroup SpecialPage |
22
|
|
|
*/ |
23
|
|
|
|
24
|
|
|
class SpecialNewFiles extends IncludableSpecialPage { |
25
|
|
|
/** @var FormOptions */ |
26
|
|
|
protected $opts; |
27
|
|
|
|
28
|
|
|
public function __construct() { |
29
|
|
|
parent::__construct( 'Newimages' ); |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
public function execute( $par ) { |
33
|
|
|
$this->setHeaders(); |
34
|
|
|
$this->outputHeader(); |
35
|
|
|
|
36
|
|
|
$out = $this->getOutput(); |
37
|
|
|
$this->addHelpLink( 'Help:New images' ); |
38
|
|
|
|
39
|
|
|
$opts = new FormOptions(); |
40
|
|
|
|
41
|
|
|
$opts->add( 'like', '' ); |
42
|
|
|
$opts->add( 'showbots', false ); |
43
|
|
|
$opts->add( 'hidepatrolled', false ); |
44
|
|
|
$opts->add( 'limit', 50 ); |
45
|
|
|
$opts->add( 'offset', '' ); |
46
|
|
|
|
47
|
|
|
$opts->fetchValuesFromRequest( $this->getRequest() ); |
48
|
|
|
|
49
|
|
|
if ( $par !== null ) { |
50
|
|
|
$opts->setValue( is_numeric( $par ) ? 'limit' : 'like', $par ); |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
$opts->validateIntBounds( 'limit', 0, 500 ); |
54
|
|
|
|
55
|
|
|
$this->opts = $opts; |
56
|
|
|
|
57
|
|
|
if ( !$this->including() ) { |
58
|
|
|
$this->setTopText(); |
59
|
|
|
$this->buildForm(); |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
$pager = new NewFilesPager( $this->getContext(), $opts ); |
63
|
|
|
|
64
|
|
|
$out->addHTML( $pager->getBody() ); |
65
|
|
|
if ( !$this->including() ) { |
66
|
|
|
$out->addHTML( $pager->getNavigationBar() ); |
67
|
|
|
} |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
protected function buildForm() { |
71
|
|
|
$formDescriptor = [ |
72
|
|
|
'like' => [ |
73
|
|
|
'type' => 'text', |
74
|
|
|
'label-message' => 'newimages-label', |
75
|
|
|
'name' => 'like', |
76
|
|
|
], |
77
|
|
|
|
78
|
|
|
'showbots' => [ |
79
|
|
|
'type' => 'check', |
80
|
|
|
'label-message' => 'newimages-showbots', |
81
|
|
|
'name' => 'showbots', |
82
|
|
|
], |
83
|
|
|
|
84
|
|
|
'hidepatrolled' => [ |
85
|
|
|
'type' => 'check', |
86
|
|
|
'label-message' => 'newimages-hidepatrolled', |
87
|
|
|
'name' => 'hidepatrolled', |
88
|
|
|
], |
89
|
|
|
|
90
|
|
|
'limit' => [ |
91
|
|
|
'type' => 'hidden', |
92
|
|
|
'default' => $this->opts->getValue( 'limit' ), |
93
|
|
|
'name' => 'limit', |
94
|
|
|
], |
95
|
|
|
|
96
|
|
|
'offset' => [ |
97
|
|
|
'type' => 'hidden', |
98
|
|
|
'default' => $this->opts->getValue( 'offset' ), |
99
|
|
|
'name' => 'offset', |
100
|
|
|
], |
101
|
|
|
]; |
102
|
|
|
|
103
|
|
|
if ( $this->getConfig()->get( 'MiserMode' ) ) { |
104
|
|
|
unset( $formDescriptor['like'] ); |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
if ( !$this->getUser()->useFilePatrol() ) { |
108
|
|
|
unset( $formDescriptor['hidepatrolled'] ); |
109
|
|
|
} |
110
|
|
|
|
111
|
|
|
$form = HTMLForm::factory( 'ooui', $formDescriptor, $this->getContext() ) |
|
|
|
|
112
|
|
|
->setWrapperLegendMsg( 'newimages-legend' ) |
113
|
|
|
->setSubmitTextMsg( 'ilsubmit' ) |
114
|
|
|
->setMethod( 'get' ) |
115
|
|
|
->prepareForm() |
116
|
|
|
->displayForm( false ); |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
protected function getGroupName() { |
120
|
|
|
return 'changes'; |
121
|
|
|
} |
122
|
|
|
|
123
|
|
|
/** |
124
|
|
|
* Send the text to be displayed above the options |
125
|
|
|
*/ |
126
|
|
View Code Duplication |
function setTopText() { |
127
|
|
|
global $wgContLang; |
128
|
|
|
|
129
|
|
|
$message = $this->msg( 'newimagestext' )->inContentLanguage(); |
130
|
|
|
if ( !$message->isDisabled() ) { |
131
|
|
|
$this->getOutput()->addWikiText( |
132
|
|
|
Html::rawElement( 'p', |
133
|
|
|
[ 'lang' => $wgContLang->getHtmlCode(), 'dir' => $wgContLang->getDir() ], |
134
|
|
|
"\n" . $message->plain() . "\n" |
135
|
|
|
), |
136
|
|
|
/* $lineStart */ false, |
137
|
|
|
/* $interface */ false |
138
|
|
|
); |
139
|
|
|
} |
140
|
|
|
} |
141
|
|
|
} |
142
|
|
|
|
This check looks for function or method calls that always return null and whose return value is assigned to a variable.
The method
getObject()
can return nothing but null, so it makes no sense to assign that value to a variable.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.