Index: trunk/phase3/includes/specials/SpecialPreferences.php |
— | — | @@ -4,26 +4,26 @@ |
5 | 5 | function __construct() { |
6 | 6 | parent::__construct( 'Preferences' ); |
7 | 7 | } |
8 | | - |
| 8 | + |
9 | 9 | function execute( $par ) { |
10 | 10 | global $wgOut, $wgUser, $wgRequest; |
11 | | - |
| 11 | + |
12 | 12 | $this->setHeaders(); |
13 | 13 | $this->outputHeader(); |
14 | 14 | |
15 | 15 | $wgOut->addScriptFile( 'prefs.js' ); |
16 | 16 | |
17 | 17 | $wgOut->disallowUserJs(); # Prevent hijacked user scripts from sniffing passwords etc. |
18 | | - |
| 18 | + |
19 | 19 | if ( $wgUser->isAnon() ) { |
20 | | - $wgOut->showErrorPage( 'prefsnologin', 'prefsnologintext', array($this->getTitle()->getPrefixedDBkey()) ); |
| 20 | + $wgOut->showErrorPage( 'prefsnologin', 'prefsnologintext', array( $this->getTitle()->getPrefixedDBkey() ) ); |
21 | 21 | return; |
22 | 22 | } |
23 | 23 | if ( wfReadOnly() ) { |
24 | 24 | $wgOut->readOnlyPage(); |
25 | 25 | return; |
26 | 26 | } |
27 | | - |
| 27 | + |
28 | 28 | if ( $par == 'reset' ) { |
29 | 29 | $this->showResetForm(); |
30 | 30 | return; |
— | — | @@ -35,35 +35,35 @@ |
36 | 36 | 'savedprefs' |
37 | 37 | ); |
38 | 38 | } |
39 | | - |
| 39 | + |
40 | 40 | $htmlForm = Preferences::getFormObject( $wgUser ); |
41 | 41 | |
42 | 42 | $htmlForm->show(); |
43 | 43 | } |
44 | | - |
| 44 | + |
45 | 45 | function showResetForm() { |
46 | 46 | global $wgOut; |
47 | | - |
| 47 | + |
48 | 48 | $wgOut->addWikiMsg( 'prefs-reset-intro' ); |
49 | | - |
| 49 | + |
50 | 50 | $htmlForm = new HTMLForm( array(), 'prefs-restore' ); |
51 | | - |
| 51 | + |
52 | 52 | $htmlForm->setSubmitText( wfMsg( 'restoreprefs' ) ); |
53 | | - $htmlForm->setTitle( $this->getTitle('reset') ); |
| 53 | + $htmlForm->setTitle( $this->getTitle( 'reset' ) ); |
54 | 54 | $htmlForm->setSubmitCallback( array( __CLASS__, 'submitReset' ) ); |
55 | 55 | $htmlForm->suppressReset(); |
56 | | - |
| 56 | + |
57 | 57 | $htmlForm->show(); |
58 | 58 | } |
59 | | - |
| 59 | + |
60 | 60 | static function submitReset( $formData ) { |
61 | 61 | global $wgUser, $wgOut; |
62 | 62 | $wgUser->resetOptions(); |
63 | | - |
| 63 | + |
64 | 64 | $url = SpecialPage::getTitleFor( 'Preferences' )->getFullURL( 'success' ); |
65 | | - |
| 65 | + |
66 | 66 | $wgOut->redirect( $url ); |
67 | | - |
| 67 | + |
68 | 68 | return true; |
69 | 69 | } |
70 | 70 | } |