Index: trunk/extensions/auth/SampleAuth.php |
— | — | @@ -11,8 +11,7 @@ |
12 | 12 | } |
13 | 13 | |
14 | 14 | function authenticate( $username, $password ) { |
15 | | - return $this->userExists( $username ) && |
16 | | - ( $password == "password" ); |
| 15 | + return $this->userExists( $username ) && ( $password == "password" ); |
17 | 16 | } |
18 | 17 | |
19 | 18 | function autoCreate() { |
Index: trunk/extensions/Contest/specials/SpecialContest.php |
— | — | @@ -56,13 +56,13 @@ |
57 | 57 | |
58 | 58 | $this->displayNavigation(); |
59 | 59 | $this->showGeneralInfo( $contest ); |
60 | | - |
| 60 | + |
61 | 61 | if ( $this->getUser()->isAllowed( 'contestadmin' ) ) { |
62 | 62 | $this->showMailFunctionality( $contest ); |
63 | 63 | } |
64 | | - |
| 64 | + |
65 | 65 | $out->addHTML( Html::element( 'h3', array(), wfMsg( 'contest-contest-contestants' ) ) ); |
66 | | - |
| 66 | + |
67 | 67 | $this->addFilterOptionsToSession(); |
68 | 68 | $this->showFilterControl( $contest, $challengeTitle ); |
69 | 69 | $this->showContestants( $contest, $challengeTitle ); |
— | — | @@ -150,7 +150,7 @@ |
151 | 151 | 'id' => 'send-reminder', |
152 | 152 | 'data-token' => $this->getUser()->editToken(), |
153 | 153 | 'data-contest-id' => $contest->getId(), |
154 | | - |
| 154 | + |
155 | 155 | // Note: this is a copy of the message in ContestContestant::sendReminderEmail. |
156 | 156 | // If it's changed or modified by a hook, this message might not be accurate. |
157 | 157 | 'data-reminder-subject' => wfMsgExt( 'contest-email-reminder-title', 'parsemag', $contest->getDaysLeft() ) |
— | — | @@ -184,9 +184,9 @@ |
185 | 185 | $conds = array( |
186 | 186 | 'contestant_contest_id' => $contest->getId() |
187 | 187 | ); |
188 | | - |
| 188 | + |
189 | 189 | $this->addRequestConditions( $conds ); |
190 | | - |
| 190 | + |
191 | 191 | $pager = new ContestantPager( $this, $conds ); |
192 | 192 | |
193 | 193 | if ( $pager->getNumRows() ) { |
— | — | @@ -200,12 +200,12 @@ |
201 | 201 | $out->addWikiMsg( 'contest-contest-no-results' ); |
202 | 202 | } |
203 | 203 | } |
204 | | - |
| 204 | + |
205 | 205 | /** |
206 | 206 | * Add the filter options to the session, so they get retained |
207 | 207 | * when the user does navigation such as going to the next |
208 | 208 | * set of results using the pager. |
209 | | - * |
| 209 | + * |
210 | 210 | * @since 0.2 |
211 | 211 | */ |
212 | 212 | protected function addFilterOptionsToSession() { |
— | — | @@ -217,27 +217,27 @@ |
218 | 218 | 'challenge', |
219 | 219 | 'submission' |
220 | 220 | ); |
221 | | - |
| 221 | + |
222 | 222 | $req = $this->getRequest(); |
223 | | - |
| 223 | + |
224 | 224 | foreach ( $fields as $field ) { |
225 | 225 | if ( $req->getCheck( $field ) ) { |
226 | 226 | $req->setSessionData( 'contestant-' . $field, $req->getVal( $field ) ); |
227 | 227 | } |
228 | 228 | } |
229 | 229 | } |
230 | | - |
| 230 | + |
231 | 231 | /** |
232 | 232 | * Add the needed conditions to the provided array depending |
233 | 233 | * on the filter options set. |
234 | | - * |
| 234 | + * |
235 | 235 | * @since 0.2 |
236 | | - * |
| 236 | + * |
237 | 237 | * @param array $conds |
238 | 238 | */ |
239 | 239 | protected function addRequestConditions( &$conds ) { |
240 | 240 | $req = $this->getRequest(); |
241 | | - |
| 241 | + |
242 | 242 | foreach ( array( 'volunteer', 'wmf' ) as $field ) { |
243 | 243 | if ( in_array( $req->getSessionData( 'contestant-' . $field ), array( 'yes', 'no' ) ) ) { |
244 | 244 | $conds['contestant_' . $field] = $req->getSessionData( 'contestant-' . $field ) == 'yes' ? 1 : 0; |
— | — | @@ -254,7 +254,7 @@ |
255 | 255 | } |
256 | 256 | } |
257 | 257 | } |
258 | | - |
| 258 | + |
259 | 259 | if ( $req->getSessionData( 'contestant-challenge' ) ) { |
260 | 260 | $challenge = ContestChallenge::s()->selectRow( 'id', array( 'title' => $req->getSessionData( 'contestant-' . $field ) ) ); |
261 | 261 | |
— | — | @@ -263,7 +263,7 @@ |
264 | 264 | unset( $conds['contestant_contest_id'] ); // Not needed because the challenge implies the context |
265 | 265 | } |
266 | 266 | } |
267 | | - |
| 267 | + |
268 | 268 | if ( in_array( $req->getSessionData( 'contestant-submission' ), array( 'some', 'none' ) ) ) { |
269 | 269 | if ( $req->getSessionData( 'contestant-submission' ) == 'none' ) { |
270 | 270 | $conds['contestant_submission'] = ''; |
— | — | @@ -273,61 +273,60 @@ |
274 | 274 | } |
275 | 275 | } |
276 | 276 | } |
277 | | - |
| 277 | + |
278 | 278 | /** |
279 | 279 | * Create the filter control and add it to the output. |
280 | | - * |
| 280 | + * |
281 | 281 | * @since 0.2 |
282 | | - * |
| 282 | + * |
283 | 283 | * @param Contest $contest |
284 | 284 | */ |
285 | 285 | protected function showFilterControl( Contest $contest ) { |
286 | | - $req = $this->getRequest(); |
287 | 286 | $challenges = array(); |
288 | | - |
| 287 | + |
289 | 288 | foreach ( $contest->getChallenges() as /* ContestChallenge */ $challenge ) { |
290 | 289 | $challenges[$challenge->getField( 'title' )] = $challenge->getField( 'title' ); |
291 | 290 | } |
292 | | - |
| 291 | + |
293 | 292 | $yesNo = array( |
294 | 293 | 'yes' => wfMsg( 'contest-contest-yes' ), |
295 | 294 | 'no' => wfMsg( 'contest-contest-no' ) |
296 | 295 | ); |
297 | | - |
| 296 | + |
298 | 297 | $noneSome = array( |
299 | 298 | 'none' => wfMsg( 'contest-contest-none' ), |
300 | 299 | 'some' => wfMsg( 'contest-contest-some' ), |
301 | 300 | ); |
302 | | - |
| 301 | + |
303 | 302 | $title = $this->getTitle( $this->subPage )->getFullText(); |
304 | | - |
| 303 | + |
305 | 304 | $this->getOutput()->addHTML( |
306 | 305 | '<fieldset>' . |
307 | 306 | '<legend>' . wfMsgHtml( 'contest-contest-showonly' ) . '</legend>' . |
308 | 307 | '<form method="post" action="' . $GLOBALS['wgScript'] . '?title=' . $title . '">' . |
309 | 308 | Html::hidden( 'title', $title ) . |
310 | 309 | $this->getDropdownHTML( |
311 | | - 'challenge', |
| 310 | + 'challenge', |
312 | 311 | $challenges |
313 | 312 | ) . |
314 | 313 | $this->getDropdownHTML( |
315 | | - 'volunteer', |
| 314 | + 'volunteer', |
316 | 315 | $yesNo |
317 | 316 | ) . |
318 | 317 | $this->getDropdownHTML( |
319 | | - 'wmf', |
| 318 | + 'wmf', |
320 | 319 | $yesNo |
321 | 320 | ) . |
322 | 321 | $this->getDropdownHTML( |
323 | | - 'comments', |
| 322 | + 'comments', |
324 | 323 | $noneSome |
325 | 324 | ) . |
326 | 325 | $this->getDropdownHTML( |
327 | | - 'rating_count', |
| 326 | + 'rating_count', |
328 | 327 | $noneSome |
329 | 328 | ) . |
330 | 329 | $this->getDropdownHTML( |
331 | | - 'submission', |
| 330 | + 'submission', |
332 | 331 | $noneSome |
333 | 332 | ) . |
334 | 333 | '<input type="submit" value="' . wfMsgHtml( 'contest-contest-go' ) . '">' . |
— | — | @@ -335,41 +334,41 @@ |
336 | 335 | '</fieldset>' |
337 | 336 | ); |
338 | 337 | } |
339 | | - |
| 338 | + |
340 | 339 | /** |
341 | 340 | * Get the HTML for a filter option dropdown menu. |
342 | | - * |
| 341 | + * |
343 | 342 | * @since 0.2 |
344 | | - * |
| 343 | + * |
345 | 344 | * @param string $name |
346 | 345 | * @param array $options |
347 | 346 | * @param string|null $message |
348 | 347 | * @param mixed $value |
349 | | - * |
| 348 | + * |
350 | 349 | * @return string |
351 | 350 | */ |
352 | 351 | protected function getDropdownHTML( $name, array $options, $message = null, $value = null ) { |
353 | 352 | $opts = array(); |
354 | 353 | $options = array_merge( array( '' => ' ' ), $options ); |
355 | | - |
| 354 | + |
356 | 355 | if ( is_null( $value ) ) { |
357 | 356 | $value = $this->getRequest()->getSessionData( 'contestant-' . $name ); |
358 | 357 | } |
359 | | - |
| 358 | + |
360 | 359 | if ( is_null( $message ) ) { |
361 | 360 | $message = 'contest-contest-filter-' . $name; |
362 | 361 | } |
363 | | - |
| 362 | + |
364 | 363 | foreach ( $options as $val => $label ) { |
365 | 364 | $attribs = array( 'value' => $val ); |
366 | | - |
| 365 | + |
367 | 366 | if ( $val == $value || ( $val === ' ' && !array_key_exists( $val, $options ) ) ) { |
368 | 367 | $attribs['selected'] = 'selected'; |
369 | 368 | } |
370 | | - |
| 369 | + |
371 | 370 | $opts[] = Html::element( 'option', $attribs, $label ); |
372 | 371 | } |
373 | | - |
| 372 | + |
374 | 373 | return Html::element( 'label', array( 'for' => $name ), wfMsg( $message ) ) . ' ' . |
375 | 374 | Html::rawElement( 'select', array( 'name' => $name, 'id' => $name ), implode( "\n", $opts ) ) . ' '; |
376 | 375 | } |
Index: trunk/extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.class.php |
— | — | @@ -102,10 +102,10 @@ |
103 | 103 | $out = str_replace( "\n", '', $out ); |
104 | 104 | } |
105 | 105 | // Register CSS |
106 | | - $parser->mOutput->addHeadItem( self::buildHeadItem( $geshi ), "source-{$lang}" ); |
| 106 | + $parser->getOutput()->addHeadItem( self::buildHeadItem( $geshi ), "source-{$lang}" ); |
107 | 107 | |
108 | 108 | if( $wgUseSiteCss ) { |
109 | | - $parser->mOutput->addModuleStyles( 'ext.geshi.local' ); |
| 109 | + $parser->getOutput()->addModuleStyles( 'ext.geshi.local' ); |
110 | 110 | } |
111 | 111 | |
112 | 112 | $encloseTag = $enclose === GESHI_HEADER_NONE ? 'span' : 'div'; |