Index: trunk/extensions/SocialProfile/SystemGifts/SpecialSystemGiftManager.php |
— | — | @@ -50,7 +50,7 @@ |
51 | 51 | if ( $wgRequest->wasPosted() ) { |
52 | 52 | $g = new SystemGifts(); |
53 | 53 | |
54 | | - if ( !( $_POST['id'] ) ) { // @todo FIXME/CHECKME: why $_POST? Why not $wgRequest? |
| 54 | + if ( !$wgRequest->getInt( 'id' ) ) { |
55 | 55 | // Add the new system gift to the database |
56 | 56 | $gift_id = $g->addGift( |
57 | 57 | $wgRequest->getVal( 'gift_name' ), |
— | — | @@ -101,10 +101,12 @@ |
102 | 102 | */ |
103 | 103 | function displayGiftList() { |
104 | 104 | global $wgUser; |
| 105 | + |
105 | 106 | $output = ''; // Prevent E_NOTICE |
106 | 107 | $page = 0; |
107 | 108 | $per_page = 50; |
108 | 109 | $gifts = SystemGifts::getGiftList( $per_page, $page ); |
| 110 | + |
109 | 111 | if ( $gifts ) { |
110 | 112 | foreach ( $gifts as $gift ) { |
111 | 113 | $deleteLink = ''; |
— | — | @@ -122,6 +124,7 @@ |
123 | 125 | $deleteLink . '</div>' . "\n"; |
124 | 126 | } |
125 | 127 | } |
| 128 | + |
126 | 129 | return '<div id="views">' . $output . '</div>'; |
127 | 130 | } |
128 | 131 | |
Index: trunk/extensions/SocialProfile/SystemGifts/SpecialViewSystemGift.php |
— | — | @@ -47,7 +47,7 @@ |
48 | 48 | } |
49 | 49 | } |
50 | 50 | // DB stuff |
51 | | - $dbr = wfGetDB( DB_MASTER ); |
| 51 | + $dbr = wfGetDB( DB_SLAVE ); |
52 | 52 | $res = $dbr->select( |
53 | 53 | 'user_system_gift', |
54 | 54 | array( |
Index: trunk/extensions/SocialProfile/SystemGifts/SpecialSystemGiftManagerLogo.php |
— | — | @@ -10,13 +10,13 @@ |
11 | 11 | |
12 | 12 | class SystemGiftManagerLogo extends UnlistedSpecialPage { |
13 | 13 | |
14 | | - var $mUploadFile, $mUploadDescription, $mIgnoreWarning; |
15 | | - var $mUploadSaveName, $mUploadTempName, $mUploadSize, $mUploadOldVersion; |
16 | | - var $mUploadCopyStatus, $mUploadSource, $mReUpload, $mAction, $mUpload; |
17 | | - var $mOname, $mSessionKey, $mStashed, $mDestFile; |
18 | | - var $avatarUploadDirectory; |
19 | | - var $fileExtensions; |
20 | | - var $gift_id; |
| 14 | + public $mUploadFile, $mUploadDescription, $mIgnoreWarning; |
| 15 | + public $mUploadSaveName, $mUploadTempName, $mUploadSize, $mUploadOldVersion; |
| 16 | + public $mUploadCopyStatus, $mUploadSource, $mReUpload, $mAction, $mUpload; |
| 17 | + public $mOname, $mSessionKey, $mStashed, $mDestFile; |
| 18 | + public $avatarUploadDirectory; |
| 19 | + public $fileExtensions; |
| 20 | + public $gift_id; |
21 | 21 | |
22 | 22 | /** |
23 | 23 | * Constructor -- set up the new special page |
— | — | @@ -412,9 +412,9 @@ |
413 | 413 | } |
414 | 414 | |
415 | 415 | if ( $type < 0 ) { |
416 | | - # FIXME: undefined variable $stash |
417 | | - throw new FatalError( wfMsg( 'filecopyerror', $tempName, $stash ) ); |
| 416 | + throw new FatalError( wfMsg( 'filecopyerror', $tempName, /*$stash*/'' ) ); |
418 | 417 | } |
| 418 | + |
419 | 419 | return $type; |
420 | 420 | } |
421 | 421 | |
Index: trunk/extensions/SocialProfile/SystemGifts/SystemGift.i18n.php |
— | — | @@ -57,6 +57,8 @@ |
58 | 58 | This will also delete it from users who may have received it.', |
59 | 59 | 'ga-remove-success-title' => 'You have successfully removed the gift "$1"', |
60 | 60 | 'ga-remove-success-message' => 'The gift "$1" has been removed.', |
| 61 | + 'ga-user-got-awards' => '$1 got $2', |
| 62 | + 'ga-awards-given-out' => '{{PLURAL:$1|One award|$1 awards}} were given out', |
61 | 63 | 'topawards' => 'Top Awards', |
62 | 64 | 'topawards-edit-title' => 'Top Awards - Edit Milestones', |
63 | 65 | 'topawards-vote-title' => 'Top Awards - Vote Milestones', |
— | — | @@ -1146,6 +1148,8 @@ |
1147 | 1149 | Tämä poistaa sen myös käyttäjiltä, jotka ovat saattaneet saada sen.', |
1148 | 1150 | 'ga-remove-success-title' => 'Olet onnistuneesti poistanut lahjan "$1"', |
1149 | 1151 | 'ga-remove-success-message' => 'Lahja "$1" on poistettu.', |
| 1152 | + 'ga-user-got-awards' => '$1 sai palkinnon $2', |
| 1153 | + 'ga-awards-given-out' => '{{PLURAL:$1|Yksi palkinto|$1 palkintoa}} jaettiin', |
1150 | 1154 | 'system_gift_received_subject' => 'Olet saanut palkinnon $1 {{GRAMMAR:inessive|{{SITENAME}}}}!', |
1151 | 1155 | 'system_gift_received_body' => 'Hei $1: |
1152 | 1156 | |
Index: trunk/extensions/SocialProfile/SystemGifts/UserSystemGiftsClass.php |
— | — | @@ -4,22 +4,13 @@ |
5 | 5 | */ |
6 | 6 | class UserSystemGifts { |
7 | 7 | |
8 | | - /** |
9 | | - * All member variables should be considered private |
10 | | - * Please use the accessor functions |
11 | | - */ |
| 8 | + private $user_id; # Text form (spaces not underscores) of the main part |
| 9 | + private $user_name; # Text form (spaces not underscores) of the main part |
12 | 10 | |
13 | | - /**#@+ |
14 | | - * @private |
15 | | - */ |
16 | | - var $user_id; # Text form (spaces not underscores) of the main part |
17 | | - var $user_name; # Text form (spaces not underscores) of the main part |
18 | | - |
19 | 11 | /** |
20 | 12 | * Constructor |
21 | | - * @private |
22 | 13 | */ |
23 | | - /* private */ function __construct( $username ) { |
| 14 | + public function __construct( $username ) { |
24 | 15 | $title1 = Title::newFromDBkey( $username ); |
25 | 16 | $this->user_name = $title1->getText(); |
26 | 17 | $this->user_id = User::idFromName( $this->user_name ); |
Index: trunk/extensions/SocialProfile/SystemGifts/SystemGiftsClass.php |
— | — | @@ -8,7 +8,7 @@ |
9 | 9 | * All member variables should be considered private |
10 | 10 | * Please use the accessor functions |
11 | 11 | */ |
12 | | - var $categories = array( |
| 12 | + private $categories = array( |
13 | 13 | 'edit' => 1, |
14 | 14 | 'vote' => 2, |
15 | 15 | 'comment' => 3, |
— | — | @@ -26,13 +26,6 @@ |
27 | 27 | ); |
28 | 28 | |
29 | 29 | /** |
30 | | - * Constructor |
31 | | - * @private |
32 | | - */ |
33 | | - /* private */ function __construct() { |
34 | | - } |
35 | | - |
36 | | - /** |
37 | 30 | * Adds awards for all registered users, updates statistics and purges |
38 | 31 | * caches. |
39 | 32 | * Special:PopulateAwards calls this function |
— | — | @@ -86,13 +79,17 @@ |
87 | 80 | // Update counters (bug #27981) |
88 | 81 | UserSystemGifts::incGiftGivenCount( $row->gift_id ); |
89 | 82 | |
90 | | - $wgOut->addHTML( $row2->stats_user_name . ' got ' . $row->gift_name . '<br />' ); |
| 83 | + $wgOut->addHTML( wfMsg( |
| 84 | + 'ga-user-got-awards', |
| 85 | + $row2->stats_user_name, |
| 86 | + $row->gift_name |
| 87 | + ) . '<br />' ); |
91 | 88 | $x++; |
92 | 89 | } |
93 | 90 | } |
94 | 91 | } |
95 | 92 | } |
96 | | - $wgOut->addHTML( "{$x} awards were given out" ); |
| 93 | + $wgOut->addHTML( wfMsgExt( 'ga-awards-given-out', 'parsemag', $x ) ); |
97 | 94 | } |
98 | 95 | |
99 | 96 | /** |
— | — | @@ -170,11 +167,12 @@ |
171 | 168 | |
172 | 169 | public function doesGiftExistForThreshold( $category, $threshold ) { |
173 | 170 | $dbr = wfGetDB( DB_SLAVE ); |
174 | | - wfSuppressWarnings(); |
175 | | - // Can cause notices like "Notice: Undefined index: user_image" after |
176 | | - // a user has uploaded their (first) avatar |
177 | | - $awardCategory = $this->categories[$category]; |
178 | | - wfRestoreWarnings(); |
| 171 | + |
| 172 | + $awardCategory = 0; |
| 173 | + if ( isset( $this->categories[$category] ) ) { |
| 174 | + $awardCategory = $this->categories[$category]; |
| 175 | + } |
| 176 | + |
179 | 177 | $s = $dbr->selectRow( |
180 | 178 | 'system_gift', |
181 | 179 | array( 'gift_id' ), |
— | — | @@ -184,6 +182,7 @@ |
185 | 183 | ), |
186 | 184 | __METHOD__ |
187 | 185 | ); |
| 186 | + |
188 | 187 | if ( $s === false ) { |
189 | 188 | return false; |
190 | 189 | } else { |