Index: trunk/extensions/SocialProfile/SystemGifts/SpecialSystemGiftManagerLogo.php |
— | — | @@ -204,7 +204,7 @@ |
205 | 205 | if ( ( $this->mUploadSize > 102400 ) ) { |
206 | 206 | # TODO: Format $wgUploadSizeWarning to something that looks better than the raw byte |
207 | 207 | # value, perhaps add GB,MB and KB suffixes? |
208 | | - $warning .= '<li>' . wfMsg( 'largefile', 102400, $this->mUploadSize ) . '</li>'; |
| 208 | + $warning .= '<li>' . wfMsg( 'largefile', 102400, $this->mUploadSize ) . '</li>'; |
209 | 209 | } |
210 | 210 | if ( $this->mUploadSize == 0 ) { |
211 | 211 | $warning .= '<li>' . wfMsg( 'emptyfile' ) . '</li>'; |
Index: trunk/extensions/SocialProfile/SystemGifts/SpecialViewSystemGifts.php |
— | — | @@ -78,13 +78,13 @@ |
79 | 79 | */ |
80 | 80 | $output .= $wgOut->setPageTitle( wfMsg( 'ga-title', $rel->user_name ) ); |
81 | 81 | |
82 | | - $output .= '<div class="back-links"> |
83 | | - ' . wfMsg( 'ga-back-link', $wgUser->getUserPage()->escapeFullURL(), $rel->user_name ) . ' |
84 | | - </div>'; |
| 82 | + $output .= '<div class="back-links">' |
| 83 | + . wfMsg( 'ga-back-link', $wgUser->getUserPage()->escapeFullURL(), $rel->user_name ) . |
| 84 | + '</div>'; |
85 | 85 | |
86 | | - $output .= '<div class="ga-count"> |
87 | | - ' . wfMsgExt( 'ga-count', 'parsemag', $rel->user_name, $total ) . ' |
88 | | - </div>'; |
| 86 | + $output .= '<div class="ga-count">' |
| 87 | + . wfMsgExt( 'ga-count', 'parsemag', $rel->user_name, $total ) . |
| 88 | + '</div>'; |
89 | 89 | |
90 | 90 | // Safelinks |
91 | 91 | $view_system_gift_link = SpecialPage::getTitleFor( 'ViewSystemGift' ); |
Index: trunk/extensions/SocialProfile/UserStats/TopFansRecent.php |
— | — | @@ -25,7 +25,9 @@ |
26 | 26 | $wgOut->addExtensionStyle( $wgScriptPath . '/extensions/SocialProfile/UserStats/TopList.css' ); |
27 | 27 | $period = $wgRequest->getVal( 'period' ); |
28 | 28 | |
29 | | - if ( !$period ) $period = 'weekly'; |
| 29 | + if ( !$period ) { |
| 30 | + $period = 'weekly'; |
| 31 | + } |
30 | 32 | |
31 | 33 | if ( $period == 'weekly' ) { |
32 | 34 | $wgOut->setPageTitle( wfMsg( 'user-stats-weekly-title' ) ); |
— | — | @@ -56,7 +58,7 @@ |
57 | 59 | __METHOD__, |
58 | 60 | $params |
59 | 61 | ); |
60 | | - while ( $row = $dbr->fetchObject( $res ) ) { |
| 62 | + foreach ( $res as $row ) { |
61 | 63 | $user_list[] = array( |
62 | 64 | 'user_id' => $row->up_user_id, |
63 | 65 | 'user_name' => $row->up_user_name, |
— | — | @@ -67,8 +69,8 @@ |
68 | 70 | } |
69 | 71 | |
70 | 72 | // Top nav bar |
71 | | - $top_title = Title::makeTitle( NS_SPECIAL, 'TopUsers' ); |
72 | | - $recent_title = Title::makeTitle( NS_SPECIAL, 'TopUsersRecent' ); |
| 73 | + $top_title = SpecialPage::getTitleFor( 'TopUsers' ); |
| 74 | + $recent_title = SpecialPage::getTitleFor( 'TopUsersRecent' ); |
73 | 75 | |
74 | 76 | $out .= '<div class="top-fan-nav"> |
75 | 77 | <h1>' . wfMsg( 'top-fans-by-points-nav-header' ) . '</h1> |
— | — | @@ -114,8 +116,8 @@ |
115 | 117 | $out .= '<div class="top-fan-row"> |
116 | 118 | <span class="top-fan-num">' . $x . '.</span> |
117 | 119 | <span class="top-fan"> |
118 | | - <img src="' . $wgUploadPath . '/avatars/' . $commentIcon . '" alt="" border="" /> |
119 | | - <a href="' . $user_title->escapeFullURL() . '" >' . $user['user_name'] . '</a> |
| 120 | + <img src="' . $wgUploadPath . '/avatars/' . $commentIcon . '" alt="" border="" /> |
| 121 | + <a href="' . $user_title->escapeFullURL() . '" >' . $user['user_name'] . '</a> |
120 | 122 | </span>'; |
121 | 123 | |
122 | 124 | $out .= '<span class="top-fan-points"><b>' . number_format( $user['points'] ) . '</b> ' . wfMsg( 'top-fans-points' ) . '</span>'; |
Index: trunk/extensions/SocialProfile/UserStats/UserStats.i18n.php |
— | — | @@ -9,7 +9,8 @@ |
10 | 10 | $messages = array(); |
11 | 11 | |
12 | 12 | /** English |
13 | | - * @author Wikia, Inc. |
| 13 | + * @author Aaron Wright |
| 14 | + * @author David Pean |
14 | 15 | */ |
15 | 16 | $messages['en'] = array( |
16 | 17 | 'user-stats-alltime-title' => 'All-time most points', |
Index: trunk/extensions/SocialProfile/UserStats/EditCount.php |
— | — | @@ -35,13 +35,14 @@ |
36 | 36 | in_array( $wgTitle->getNamespace(), $wgNamespacesForEditPoints ) |
37 | 37 | ) { |
38 | 38 | $dbr = wfGetDB( DB_MASTER ); |
39 | | - $res = $dbr->select( 'revision', |
| 39 | + $res = $dbr->select( |
| 40 | + 'revision', |
40 | 41 | array( 'rev_user_text', 'rev_user', 'COUNT(*) AS the_count' ), |
41 | 42 | array( 'rev_page' => $article->getID(), 'rev_user <> 0' ), |
42 | 43 | __METHOD__, |
43 | 44 | array( 'GROUP BY' => 'rev_user_text' ) |
44 | 45 | ); |
45 | | - while ( $row = $dbr->fetchObject( $res ) ) { |
| 46 | + foreach ( $res as $row ) { |
46 | 47 | $stats = new UserStatsTrack( $row->rev_user, $row->rev_user_text ); |
47 | 48 | $stats->decStatField( 'edit', $row->the_count ); |
48 | 49 | } |
— | — | @@ -61,13 +62,14 @@ |
62 | 63 | in_array( $title->getNamespace(), $wgNamespacesForEditPoints ) |
63 | 64 | ) { |
64 | 65 | $dbr = wfGetDB( DB_MASTER ); |
65 | | - $res = $dbr->select( 'revision', |
| 66 | + $res = $dbr->select( |
| 67 | + 'revision', |
66 | 68 | array( 'rev_user_text', 'rev_user', 'COUNT(*) AS the_count' ), |
67 | 69 | array( 'rev_page' => $title->getArticleID(), 'rev_user <> 0' ), |
68 | 70 | __METHOD__, |
69 | 71 | array( 'GROUP BY' => 'rev_user_text' ) |
70 | 72 | ); |
71 | | - while ( $row = $dbr->fetchObject( $res ) ) { |
| 73 | + foreach ( $res as $row ) { |
72 | 74 | $stats = new UserStatsTrack( $row->rev_user, $row->rev_user_text ); |
73 | 75 | $stats->incStatField( 'edit', $row->the_count ); |
74 | 76 | } |
Index: trunk/extensions/SocialProfile/UserStats/TopFansByStat.php |
— | — | @@ -64,7 +64,7 @@ |
65 | 65 | __METHOD__, |
66 | 66 | $params |
67 | 67 | ); |
68 | | - while ( $row = $dbr->fetchObject( $res ) ) { |
| 68 | + foreach ( $res as $row ) { |
69 | 69 | $user_list[] = array( |
70 | 70 | 'user_id' => $row->stats_user_id, |
71 | 71 | 'user_name' => $row->stats_user_name, |
— | — | @@ -130,12 +130,12 @@ |
131 | 131 | $out .= '<div class="top-fan-row"> |
132 | 132 | <span class="top-fan-num">' . $x . '.</span> |
133 | 133 | <span class="top-fan"> |
134 | | - <img src="' . $wgUploadPath . '/avatars/' . $commentIcon . '" alt="" border="" /> |
135 | | - <a href="' . $user_title->escapeFullURL() . '">' . $user_name . '</a> |
| 134 | + <img src="' . $wgUploadPath . '/avatars/' . $commentIcon . '" alt="" border="" /> |
| 135 | + <a href="' . $user_title->escapeFullURL() . '">' . $user_name . '</a> |
136 | 136 | </span> |
137 | | - <span class="top-fan-points"><b>' . $statistics_row . '</b> ' . $lowercase_statistics_name . '</span>'; |
138 | | - $out .= '<div class="cleared"></div>'; |
139 | | - $out .= '</div>'; |
| 137 | + <span class="top-fan-points"><b>' . $statistics_row . '</b> ' . $lowercase_statistics_name . '</span> |
| 138 | + <div class="cleared"></div> |
| 139 | + </div>'; |
140 | 140 | $x++; |
141 | 141 | } |
142 | 142 | $out .= '</div><div class="cleared"></div>'; |
Index: trunk/extensions/SocialProfile/UserStats/UserStatsClass.php |
— | — | @@ -1,6 +1,7 @@ |
2 | 2 | <?php |
3 | | -if ( !defined( 'MEDIAWIKI' ) ) |
| 3 | +if ( !defined( 'MEDIAWIKI' ) ) { |
4 | 4 | die(); |
| 5 | +} |
5 | 6 | /** |
6 | 7 | * Four classes for tracking users' social activity |
7 | 8 | * UserStatsTrack: main class, used by most other SocialProfile components |
— | — | @@ -119,13 +120,15 @@ |
120 | 121 | */ |
121 | 122 | function addStatRecord() { |
122 | 123 | $dbw = wfGetDB( DB_MASTER ); |
123 | | - $dbw->insert( 'user_stats', |
| 124 | + $dbw->insert( |
| 125 | + 'user_stats', |
124 | 126 | array( |
125 | 127 | 'stats_year_id' => 0, |
126 | 128 | 'stats_user_id' => $this->user_id, |
127 | 129 | 'stats_user_name' => $this->user_name, |
128 | 130 | 'stats_total_points' => 1000 |
129 | | - ), __METHOD__ |
| 131 | + ), |
| 132 | + __METHOD__ |
130 | 133 | ); |
131 | 134 | } |
132 | 135 | |
— | — | @@ -144,7 +147,8 @@ |
145 | 148 | global $wgUser, $wgMemc, $wgSystemGifts, $wgUserStatsTrackWeekly, $wgUserStatsTrackMonthly, $wgUserStatsPointValues; |
146 | 149 | if ( !$wgUser->isAllowed( 'bot' ) && !$wgUser->isAnon() && $this->stats_fields[$field] ) { |
147 | 150 | $dbw = wfGetDB( DB_MASTER ); |
148 | | - $dbw->update( 'user_stats', |
| 151 | + $dbw->update( |
| 152 | + 'user_stats', |
149 | 153 | array( $this->stats_fields[$field] . '=' . $this->stats_fields[$field] . "+{$val}" ), |
150 | 154 | array( 'stats_user_id' => $this->user_id ), |
151 | 155 | __METHOD__ |
— | — | @@ -164,7 +168,12 @@ |
165 | 169 | } |
166 | 170 | |
167 | 171 | if ( $wgSystemGifts ) { |
168 | | - $s = $dbw->selectRow( 'user_stats', array( $this->stats_fields[$field] ), array( 'stats_user_id' => $this->user_id ), __METHOD__ ); |
| 172 | + $s = $dbw->selectRow( |
| 173 | + 'user_stats', |
| 174 | + array( $this->stats_fields[$field] ), |
| 175 | + array( 'stats_user_id' => $this->user_id ), |
| 176 | + __METHOD__ |
| 177 | + ); |
169 | 178 | $stat_field = $this->stats_fields[$field]; |
170 | 179 | $field_count = $s->$stat_field; |
171 | 180 | |
— | — | @@ -194,7 +203,8 @@ |
195 | 204 | global $wgUser, $wgUserStatsTrackWeekly, $wgUserStatsTrackMonthly; |
196 | 205 | if ( !$wgUser->isAllowed( 'bot' ) && !$wgUser->isAnon() && $this->stats_fields[$field] ) { |
197 | 206 | $dbw = wfGetDB( DB_MASTER ); |
198 | | - $dbw->update( 'user_stats', |
| 207 | + $dbw->update( |
| 208 | + 'user_stats', |
199 | 209 | array( $this->stats_fields[$field] . '=' . $this->stats_fields[$field] . "-{$val}" ), |
200 | 210 | array( 'stats_user_id' => $this->user_id ), |
201 | 211 | __METHOD__ |
— | — | @@ -307,9 +317,11 @@ |
308 | 318 | $ctgTitle = $ctgTitle->getDBkey(); |
309 | 319 | $dbw = wfGetDB( DB_MASTER ); |
310 | 320 | $sql = "UPDATE {$dbw->tableName( 'user_stats' )} SET stats_opinions_created="; |
311 | | - $sql .= "(SELECT count(*) AS CreatedOpinions FROM {$dbw->tableName( 'page' )} INNER JOIN {$dbw->tableName( 'categorylinks' )} ON page_id = cl_from WHERE (cl_to) = " . $dbw->addQuotes( $ctgTitle ) . " "; |
312 | | - $sql .= ")"; |
313 | | - $sql .= " WHERE stats_user_id = " . $this->user_id; |
| 321 | + $sql .= "(SELECT count(*) AS CreatedOpinions FROM {$dbw->tableName( 'page' )} |
| 322 | + INNER JOIN {$dbw->tableName( 'categorylinks' )} ON page_id = cl_from |
| 323 | + WHERE (cl_to) = " . $dbw->addQuotes( $ctgTitle ) . ' '; |
| 324 | + $sql .= ')'; |
| 325 | + $sql .= ' WHERE stats_user_id = ' . $this->user_id; |
314 | 326 | |
315 | 327 | $res = $dbw->query( $sql, __METHOD__ ); |
316 | 328 | |
— | — | @@ -327,9 +339,9 @@ |
328 | 340 | $sql = "UPDATE {$dbw->tableName( 'user_stats' )} SET stats_opinions_published = "; |
329 | 341 | $sql .= "(SELECT count(*) AS PromotedOpinions FROM {$dbw->tableName( 'page' )} INNER JOIN {$dbw->tableName( 'categorylinks' )} ON page_id = cl_from |
330 | 342 | INNER JOIN published_page ON page_id=published_page_id |
331 | | - WHERE (cl_to) = " . $dbw->addQuotes( $ctgTitle ) . " AND published_type=1 " . " " . $timeSQL; |
332 | | - $sql .= ")"; |
333 | | - $sql .= " WHERE stats_user_id = " . $this->user_id; |
| 343 | + WHERE (cl_to) = " . $dbw->addQuotes( $ctgTitle ) . ' AND published_type=1'; |
| 344 | + $sql .= ')'; |
| 345 | + $sql .= ' WHERE stats_user_id = ' . $this->user_id; |
334 | 346 | $res = $dbw->query( $sql, __METHOD__ ); |
335 | 347 | |
336 | 348 | $this->clearCache(); |
— | — | @@ -397,7 +409,7 @@ |
398 | 410 | $dbw = wfGetDB( DB_MASTER ); |
399 | 411 | $sql = "UPDATE LOW_PRIORITY {$dbw->tableName( 'user_stats' )} SET stats_referrals_completed= |
400 | 412 | (SELECT COUNT(*) AS thecount FROM {$dbw->tableName( 'user_register_track' )} WHERE |
401 | | - ur_user_id_referral = {$this->user_id} AND ur_user_name_referral<>'DNL' |
| 413 | + ur_user_id_referral = {$this->user_id} |
402 | 414 | ) |
403 | 415 | WHERE stats_user_id = {$this->user_id} "; |
404 | 416 | |
— | — | @@ -407,7 +419,8 @@ |
408 | 420 | |
409 | 421 | public function updateWeeklyPoints( $points ) { |
410 | 422 | $dbw = wfGetDB( DB_MASTER ); |
411 | | - $res = $dbw->select( 'user_points_weekly', |
| 423 | + $res = $dbw->select( |
| 424 | + 'user_points_weekly', |
412 | 425 | 'up_user_id', |
413 | 426 | array( "up_user_id = {$this->user_id}" ), |
414 | 427 | __METHOD__ |
— | — | @@ -417,7 +430,8 @@ |
418 | 431 | if ( !$row ) { |
419 | 432 | $this->addWeekly(); |
420 | 433 | } |
421 | | - $dbw->update( 'user_points_weekly', |
| 434 | + $dbw->update( |
| 435 | + 'user_points_weekly', |
422 | 436 | array( 'up_points=up_points+' . $points ), |
423 | 437 | array( 'up_user_id' => $this->user_id ), |
424 | 438 | __METHOD__ |
— | — | @@ -426,17 +440,20 @@ |
427 | 441 | |
428 | 442 | public function addWeekly() { |
429 | 443 | $dbw = wfGetDB( DB_MASTER ); |
430 | | - $dbw->insert( 'user_points_weekly', |
| 444 | + $dbw->insert( |
| 445 | + 'user_points_weekly', |
431 | 446 | array( |
432 | 447 | 'up_user_id' => $this->user_id, |
433 | 448 | 'up_user_name' => $this->user_name |
434 | | - ), __METHOD__ |
| 449 | + ), |
| 450 | + __METHOD__ |
435 | 451 | ); |
436 | 452 | } |
437 | 453 | |
438 | 454 | public function updateMonthlyPoints( $points ) { |
439 | 455 | $dbw = wfGetDB( DB_MASTER ); |
440 | | - $res = $dbw->select( 'user_points_monthly', |
| 456 | + $res = $dbw->select( |
| 457 | + 'user_points_monthly', |
441 | 458 | 'up_user_id', |
442 | 459 | array( "up_user_id = {$this->user_id}" ), |
443 | 460 | __METHOD__ |
— | — | @@ -446,7 +463,8 @@ |
447 | 464 | $this->addMonthly(); |
448 | 465 | } |
449 | 466 | |
450 | | - $dbw->update( 'user_points_monthly', |
| 467 | + $dbw->update( |
| 468 | + 'user_points_monthly', |
451 | 469 | array( 'up_points=up_points+' . $points ), |
452 | 470 | array( 'up_user_id' => $this->user_id ), |
453 | 471 | __METHOD__ |
— | — | @@ -455,11 +473,13 @@ |
456 | 474 | |
457 | 475 | public function addMonthly() { |
458 | 476 | $dbw = wfGetDB( DB_MASTER ); |
459 | | - $dbw->insert( 'user_points_monthly', |
| 477 | + $dbw->insert( |
| 478 | + 'user_points_monthly', |
460 | 479 | array( |
461 | 480 | 'up_user_id' => $this->user_id, |
462 | 481 | 'up_user_name' => $this->user_name |
463 | | - ), __METHOD__ |
| 482 | + ), |
| 483 | + __METHOD__ |
464 | 484 | ); |
465 | 485 | } |
466 | 486 | |
— | — | @@ -483,7 +503,8 @@ |
484 | 504 | } |
485 | 505 | |
486 | 506 | $dbw = wfGetDB( DB_MASTER ); |
487 | | - $res = $dbw->select( 'user_stats', |
| 507 | + $res = $dbw->select( |
| 508 | + 'user_stats', |
488 | 509 | '*', |
489 | 510 | array( "stats_user_id = {$this->user_id}" ), |
490 | 511 | __METHOD__ |
— | — | @@ -511,7 +532,8 @@ |
512 | 533 | } |
513 | 534 | } |
514 | 535 | |
515 | | - $dbw->update( 'user_stats', |
| 536 | + $dbw->update( |
| 537 | + 'user_stats', |
516 | 538 | array( 'stats_total_points' => $new_total_points ), |
517 | 539 | array( 'stats_user_id' => $this->user_id ), |
518 | 540 | __METHOD__ |
— | — | @@ -779,8 +801,14 @@ |
780 | 802 | public function getLevelName() { return $this->level_name; } |
781 | 803 | public function getLevelNumber() { return $this->level_number; } |
782 | 804 | public function getNextLevelName() { return $this->next_level_name; } |
783 | | - public function getPointsNeededToAdvance() { return number_format( $this->next_level_points_needed ); } |
784 | | - public function getLevelMinimum() { return $this->levels[$this->level_name]; } |
| 805 | + |
| 806 | + public function getPointsNeededToAdvance() { |
| 807 | + return number_format( $this->next_level_points_needed ); |
| 808 | + } |
| 809 | + |
| 810 | + public function getLevelMinimum() { |
| 811 | + return $this->levels[$this->level_name]; |
| 812 | + } |
785 | 813 | } |
786 | 814 | |
787 | 815 | /** |
— | — | @@ -819,7 +847,8 @@ |
820 | 848 | public function track_email( $type, $count, $page_title = '' ) { |
821 | 849 | if ( $this->user_id > 0 ) { |
822 | 850 | $dbw = wfGetDB( DB_MASTER ); |
823 | | - $dbw->insert( 'user_email_track', |
| 851 | + $dbw->insert( |
| 852 | + 'user_email_track', |
824 | 853 | array( |
825 | 854 | 'ue_user_id' => $this->user_id, |
826 | 855 | 'ue_user_name' => $this->user_name, |
— | — | @@ -827,7 +856,8 @@ |
828 | 857 | 'ue_count' => $count, |
829 | 858 | 'ue_page_title' => $page_title, |
830 | 859 | 'ue_date' => date( 'Y-m-d H:i:s' ), |
831 | | - ), __METHOD__ |
| 860 | + ), |
| 861 | + __METHOD__ |
832 | 862 | ); |
833 | 863 | } |
834 | 864 | } |
Index: trunk/extensions/SocialProfile/UserStats/TopUsers.php |
— | — | @@ -50,7 +50,7 @@ |
51 | 51 | $params |
52 | 52 | ); |
53 | 53 | $loop = 0; |
54 | | - while ( $row = $dbr->fetchObject( $res ) ) { |
| 54 | + foreach ( $res as $row ) { |
55 | 55 | $user = User::newFromId( $row->stats_user_id ); |
56 | 56 | if ( !$user->isBlocked() ) { |
57 | 57 | $user_list[] = array( |
— | — | @@ -60,12 +60,14 @@ |
61 | 61 | ); |
62 | 62 | $loop++; |
63 | 63 | } |
64 | | - if ( $loop >= 50 ) break; |
| 64 | + if ( $loop >= 50 ) { |
| 65 | + break; |
| 66 | + } |
65 | 67 | } |
66 | 68 | $wgMemc->set( $key, $user_list, 60 * 5 ); |
67 | 69 | } |
68 | 70 | |
69 | | - $recent_title = Title::makeTitle( NS_SPECIAL, 'TopUsersRecent' ); |
| 71 | + $recent_title = SpecialPage::getTitleFor( 'TopUsersRecent' ); |
70 | 72 | |
71 | 73 | $out = '<div class="top-fan-nav"> |
72 | 74 | <h1>' . wfMsg( 'top-fans-by-points-nav-header' ) . '</h1> |
— | — | @@ -80,7 +82,7 @@ |
81 | 83 | } |
82 | 84 | |
83 | 85 | // Build nav of stats by category based on MediaWiki:Topfans-by-category |
84 | | - $by_category_title = Title::makeTitle( NS_SPECIAL, 'TopFansByStatistic' ); |
| 86 | + $by_category_title = SpecialPage::getTitleFor( 'TopFansByStatistic' ); |
85 | 87 | |
86 | 88 | $lines = explode( "\n", wfMsgForContent( 'topfans-by-category' ) ); |
87 | 89 | |
— | — | @@ -95,7 +97,7 @@ |
96 | 98 | $line = explode( '|' , trim( $line, '* ' ), 2 ); |
97 | 99 | $stat = $line[0]; |
98 | 100 | $link_text = $line[1]; |
99 | | - $out .= "<p> <a href=\"" . $by_category_title->escapeFullURL( "stat={$stat}" ) . "\">{$link_text}</a></p>"; |
| 101 | + $out .= '<p> <a href="' . $by_category_title->escapeFullURL( "stat={$stat}" ) . "\">{$link_text}</a></p>"; |
100 | 102 | } |
101 | 103 | } |
102 | 104 | |
— | — | @@ -121,8 +123,9 @@ |
122 | 124 | } |
123 | 125 | |
124 | 126 | $out .= "<div class=\"top-fan-row\"> |
125 | | - <span class=\"top-fan-num\">{$x}.</span><span class=\"top-fan\"> |
126 | | - <img src='{$wgUploadPath}/avatars/" . $commentIcon . "' alt='' border='' /> <a href='" . $user_title->escapeFullURL() . "' >" . $user['user_name'] . '</a> |
| 127 | + <span class=\"top-fan-num\">{$x}.</span> |
| 128 | + <span class=\"top-fan\"> |
| 129 | + <img src='{$wgUploadPath}/avatars/" . $commentIcon . "' alt='' border='' /> <a href='" . $user_title->escapeFullURL() . "'>" . $user['user_name'] . '</a> |
127 | 130 | </span>'; |
128 | 131 | |
129 | 132 | $out .= '<span class="top-fan-points"><b>' . number_format( $user['points'] ) . '</b> ' . wfMsg( 'top-fans-points' ) . '</span>'; |
Index: trunk/extensions/SocialProfile/UserStats/SpecialUpdateEditCounts.php |
— | — | @@ -41,8 +41,8 @@ |
42 | 42 | array( 'GROUP BY' => 'rev_user_text' ), |
43 | 43 | array( 'page' => array( 'INNER JOIN', 'page_id = rev_page' ) ) |
44 | 44 | ); |
45 | | - while ( $row = $dbw->fetchObject( $res ) ) { |
46 | 45 | |
| 46 | + foreach ( $res as $row ) { |
47 | 47 | $user = User::newFromId( $row->rev_user ); |
48 | 48 | $user->loadFromId(); |
49 | 49 | |
— | — | @@ -59,18 +59,21 @@ |
60 | 60 | __METHOD__ |
61 | 61 | ); |
62 | 62 | if ( !$s->stats_user_id ) { |
63 | | - $dbw->insert( 'user_stats', |
| 63 | + $dbw->insert( |
| 64 | + 'user_stats', |
64 | 65 | array( |
65 | 66 | 'stats_year_id' => 0, |
66 | 67 | 'stats_user_id' => $row->rev_user, |
67 | 68 | 'stats_user_name' => $row->rev_user_text, |
68 | 69 | 'stats_total_points' => 1000 |
69 | | - ), __METHOD__ |
| 70 | + ), |
| 71 | + __METHOD__ |
70 | 72 | ); |
71 | 73 | } |
72 | 74 | $wgOut->addHTML( "<p>Updating {$row->rev_user_text} with {$edit_count} edits</p>" ); |
73 | 75 | |
74 | | - $dbw->update( 'user_stats', |
| 76 | + $dbw->update( |
| 77 | + 'user_stats', |
75 | 78 | array( 'stats_edit_count = ' . $edit_count ), |
76 | 79 | array( 'stats_user_id' => $row->rev_user ), |
77 | 80 | __METHOD__ |
— | — | @@ -80,7 +83,6 @@ |
81 | 84 | // clear stats cache for current user |
82 | 85 | $key = wfMemcKey( 'user', 'stats', $row->rev_user ); |
83 | 86 | $wgMemc->delete( $key ); |
84 | | - |
85 | 87 | } |
86 | 88 | } |
87 | 89 | |
— | — | @@ -97,14 +99,15 @@ |
98 | 100 | global $wgUserLevels; |
99 | 101 | $wgUserLevels = ''; |
100 | 102 | |
101 | | - $res = $dbr->select( 'user_stats', |
| 103 | + $res = $dbr->select( |
| 104 | + 'user_stats', |
102 | 105 | array( 'stats_user_id', 'stats_user_name', 'stats_total_points' ), |
103 | 106 | array(), |
104 | 107 | __METHOD__, |
105 | 108 | array( 'ORDER BY' => 'stats_user_name' ) |
106 | 109 | ); |
107 | 110 | $out = ''; |
108 | | - while ( $row = $dbr->fetchObject( $res ) ) { |
| 111 | + foreach ( $res as $row ) { |
109 | 112 | $x++; |
110 | 113 | $stats = new UserStatsTrack( $row->stats_user_id, $row->stats_user_name ); |
111 | 114 | $stats->updateTotalPoints(); |
Index: trunk/extensions/SocialProfile/UserRelationship/SpecialAddRelationship.php |
— | — | @@ -47,13 +47,15 @@ |
48 | 48 | $this->user_name_to = $usertitle->getText(); |
49 | 49 | $this->user_id_to = User::idFromName( $this->user_name_to ); |
50 | 50 | $this->relationship_type = $wgRequest->getVal( 'rel_type' ); |
51 | | - if ( !$this->relationship_type || !is_numeric( $this->relationship_type ) ) $this->relationship_type = 1; |
| 51 | + if ( !$this->relationship_type || !is_numeric( $this->relationship_type ) ) { |
| 52 | + $this->relationship_type = 1; |
| 53 | + } |
52 | 54 | |
53 | 55 | if ( ( $wgUser->getID() == $this->user_id_to ) && ( $wgUser->getID() != 0 ) ) { |
54 | 56 | $wgOut->setPageTitle( wfMsg( 'ur-error-title' ) ); |
55 | | - $out .= '<div class="relationship-error-message"> |
56 | | - ' . wfMsg( 'ur-add-error-message-yourself' ) . ' |
57 | | - </div> |
| 57 | + $out .= '<div class="relationship-error-message">' |
| 58 | + . wfMsg( 'ur-add-error-message-yourself' ) . |
| 59 | + '</div> |
58 | 60 | <div> |
59 | 61 | <input type="button" class="site-button" value="' . wfMsg( 'ur-main-page' ) . '" size="20" onclick=\'window.location="index.php?title="' . wfMsgForContent( 'mainpage' ) . '"\' />'; |
60 | 62 | if ( $wgUser->isLoggedIn() ) { |
— | — | @@ -65,9 +67,9 @@ |
66 | 68 | |
67 | 69 | } elseif ( $wgUser->isBlocked() ) { |
68 | 70 | $wgOut->setPageTitle( wfMsg( 'ur-error-title' ) ); |
69 | | - $out .= '<div class="relationship-error-message"> |
70 | | - ' . wfMsg( 'ur-add-error-message-blocked' ) . ' |
71 | | - </div> |
| 71 | + $out .= '<div class="relationship-error-message">' |
| 72 | + . wfMsg( 'ur-add-error-message-blocked' ) . |
| 73 | + '</div> |
72 | 74 | <div> |
73 | 75 | <input type="button" class="site-button" value="' . wfMsg( 'ur-main-page' ) . '" size="20" onclick=\'window.location="index.php?title="' . wfMsgForContent( 'mainpage' ) . '"\' />'; |
74 | 76 | if ( $wgUser->isLoggedIn() ) { |
— | — | @@ -79,9 +81,9 @@ |
80 | 82 | |
81 | 83 | } elseif ( $this->user_id_to == 0 ) { |
82 | 84 | $wgOut->setPageTitle( wfMsg( 'ur-error-title' ) ); |
83 | | - $out .= '<div class="relationship-error-message"> |
84 | | - ' . wfMsg( 'ur-add-error-message-no-user' ) . ' |
85 | | - </div> |
| 85 | + $out .= '<div class="relationship-error-message">' |
| 86 | + . wfMsg( 'ur-add-error-message-no-user' ) . |
| 87 | + '</div> |
86 | 88 | <div> |
87 | 89 | <input type="button" class="site-button" value="' . wfMsg( 'ur-main-page' ) . '" size="20" onclick=\'window.location="index.php?title="' . wfMsgForContent( 'mainpage' ) . '"\' />'; |
88 | 90 | if ( $wgUser->isLoggedIn() ) { |
— | — | @@ -155,9 +157,9 @@ |
156 | 158 | |
157 | 159 | $out = ''; |
158 | 160 | $wgOut->setPageTitle( wfMsg( 'ur-error-title' ) ); |
159 | | - $out .= '<div class="relationship-error-message"> |
160 | | - ' . $error . ' |
161 | | - </div> |
| 161 | + $out .= '<div class="relationship-error-message">' |
| 162 | + . $error . |
| 163 | + '</div> |
162 | 164 | <div> |
163 | 165 | <input type="button" class="site-button" value="' . wfMsg( 'ur-main-page' ) . '" size="20" onclick=\'window.location="index.php?title="' . wfMsgForContent( 'mainpage' ) . '"\' /> |
164 | 166 | <input type="button" class="site-button" value="' . wfMsg( 'ur-login' ) . '" size="20" onclick="window.location=\'' . $login_link->escapeFullURL() . '\'" />'; |
— | — | @@ -230,12 +232,12 @@ |
231 | 233 | $form .= "<form action=\"\" method=\"post\" enctype=\"multipart/form-data\" name=\"form1\"> |
232 | 234 | <div class=\"relationship-action\"> |
233 | 235 | {$avatar_img} |
234 | | - " . $add . ' |
235 | | - <div class="cleared"></div> |
| 236 | + " . $add . |
| 237 | + '<div class="cleared"></div> |
236 | 238 | </div> |
237 | | - <div class="relationship-textbox-title"> |
238 | | - ' . wfMsg( 'ur-add-personal-message' ) . ' |
239 | | - </div> |
| 239 | + <div class="relationship-textbox-title">' |
| 240 | + . wfMsg( 'ur-add-personal-message' ) . |
| 241 | + '</div> |
240 | 242 | <textarea name="message" id="message" rows="3" cols="50"></textarea> |
241 | 243 | <div class="relationship-buttons"> |
242 | 244 | <input type="button" class="site-button" value="' . $button . '" size="20" onclick="document.form1.submit()" /> |
Index: trunk/extensions/SocialProfile/UserRelationship/SpecialRemoveRelationship.php |
— | — | @@ -59,9 +59,9 @@ |
60 | 60 | $out = ''; |
61 | 61 | if ( $wgUser->getID() == $this->user_id_to ) { |
62 | 62 | $wgOut->setPageTitle( wfMsg( 'ur-error-title' ) ); |
63 | | - $out .= '<div class="relationship-error-message"> |
64 | | - ' . wfMsg( 'ur-remove-error-message-remove-yourself' ) . ' |
65 | | - </div> |
| 63 | + $out .= '<div class="relationship-error-message">' |
| 64 | + . wfMsg( 'ur-remove-error-message-remove-yourself' ) . |
| 65 | + '</div> |
66 | 66 | <div> |
67 | 67 | <input type="button" class="site-button" value="' . wfMsg( 'ur-main-page' ) . '" size="20" onclick=\'window.location="index.php?title=' . wfMsgForContent( 'mainpage' ) . '"\' />'; |
68 | 68 | if ( $wgUser->isLoggedIn() ) { |
— | — | @@ -72,9 +72,9 @@ |
73 | 73 | $wgOut->addHTML( $out ); |
74 | 74 | } elseif ( $this->relationship_type == false ) { |
75 | 75 | $wgOut->setPageTitle( wfMsg( 'ur-error-title' ) ); |
76 | | - $out .= '<div class="relationship-error-message"> |
77 | | - ' . wfMsg( 'ur-remove-error-message-no-relationship', $this->user_name_to ) . ' |
78 | | - </div> |
| 76 | + $out .= '<div class="relationship-error-message">' |
| 77 | + . wfMsg( 'ur-remove-error-message-no-relationship', $this->user_name_to ) . |
| 78 | + '</div> |
79 | 79 | <div> |
80 | 80 | <input type="button" class="site-button" value="' . wfMsg( 'ur-main-page' ) . '" size="20" onclick=\'window.location="index.php?title="' . wfMsgForContent( 'mainpage' ) . '"\' />'; |
81 | 81 | if ( $wgUser->isLoggedIn() ) { |
— | — | @@ -98,9 +98,9 @@ |
99 | 99 | $wgOut->addHTML( $out ); |
100 | 100 | } elseif ( $wgUser->getID() == 0 ) { |
101 | 101 | $wgOut->setPageTitle( wfMsg( 'ur-error-title' ) ); |
102 | | - $out .= '<div class="relationship-error-message"> |
103 | | - ' . $error . ' |
104 | | - </div> |
| 102 | + $out .= '<div class="relationship-error-message">' |
| 103 | + . $error . |
| 104 | + '</div> |
105 | 105 | <div> |
106 | 106 | <input type="button" class="site-button" value="' . wfMsg( 'ur-main-page' ) . '" size="20" onclick=\'window.location="index.php?title="' . wfMsgForContent( 'mainpage' ) . '"\' />'; |
107 | 107 | if ( $wgUser->isLoggedIn() ) { |
— | — | @@ -162,8 +162,8 @@ |
163 | 163 | $form .= "<form action=\"\" method=\"post\" enctype=\"multipart/form-data\" name=\"form1\"> |
164 | 164 | <div class=\"relationship-action\"> |
165 | 165 | {$avatar_img} |
166 | | - " . $remove . ' |
167 | | - <div class="relationship-buttons"> |
| 166 | + " . $remove . |
| 167 | + '<div class="relationship-buttons"> |
168 | 168 | <input type="hidden" name="user" value="' . addslashes( $this->user_name_to ) . '" /> |
169 | 169 | <input type="button" class="site-button" value="' . wfMsg( 'ur-remove' ) . '" size="20" onclick="document.form1.submit()" /> |
170 | 170 | <input type="button" class="site-button" value="' . wfMsg( 'ur-cancel' ) . '" size="20" onclick="history.go(-1)" /> |
Index: trunk/extensions/SocialProfile/UserRelationship/SpecialViewRelationships.php |
— | — | @@ -78,9 +78,9 @@ |
79 | 79 | */ |
80 | 80 | if ( $user_id == 0 ) { |
81 | 81 | $wgOut->setPageTitle( wfMsg( 'ur-error-title' ) ); |
82 | | - $out .= '<div class="relationship-error-message"> |
83 | | - ' . wfMsg( 'ur-error-message-no-user' ) . ' |
84 | | - </div> |
| 82 | + $out .= '<div class="relationship-error-message">' |
| 83 | + . wfMsg( 'ur-error-message-no-user' ) . |
| 84 | + '</div> |
85 | 85 | <div class="relationship-request-buttons"> |
86 | 86 | <input type="button" class="site-button" value="' . wfMsg( 'ur-main-page' ) . '" onclick=\'window.location="index.php?title=' . wfMsgForContent( 'mainpage' ) . '"\' />'; |
87 | 87 | if ( $wgUser->isLoggedIn() ) { |
— | — | @@ -169,7 +169,7 @@ |
170 | 170 | '<a href="' . $add_relationship_link->escapeFullURL( 'user=' . $user_safe . '&rel_type=2' ) . '">' . wfMsg( 'ur-add-foe' ) . '</a>', |
171 | 171 | '' |
172 | 172 | ) ); |
173 | | - } else if ( $user_name == $wgUser->getName() ) { |
| 173 | + } elseif ( $user_name == $wgUser->getName() ) { |
174 | 174 | $output .= '<a href="' . $remove_relationship_link->escapeFullURL( 'user=' . $user_safe ) . '">' . $rem . '</a>'; |
175 | 175 | $output .= wfMsgExt( 'pipe-separator', 'escapenoentities' ); |
176 | 176 | } |
— | — | @@ -201,9 +201,15 @@ |
202 | 202 | $output .= '<a href="' . $page_link->escapeFullURL( 'user=' . $user_name . '&rel_type=' . $rel_type . '&page=' . ( $page - 1 ) ) . '">' . wfMsg( 'ur-previous' ) . '</a> '; |
203 | 203 | } |
204 | 204 | |
205 | | - if ( ( $total % $per_page ) != 0 ) $numofpages++; |
206 | | - if ( $numofpages >= 9 && $page < $total ) $numofpages = 9 + $page; |
207 | | - if ( $numofpages >= ( $total / $per_page ) ) $numofpages = ( $total / $per_page ) + 1; |
| 205 | + if ( ( $total % $per_page ) != 0 ) { |
| 206 | + $numofpages++; |
| 207 | + } |
| 208 | + if ( $numofpages >= 9 && $page < $total ) { |
| 209 | + $numofpages = 9 + $page; |
| 210 | + } |
| 211 | + if ( $numofpages >= ( $total / $per_page ) ) { |
| 212 | + $numofpages = ( $total / $per_page ) + 1; |
| 213 | + } |
208 | 214 | |
209 | 215 | for ( $i = 1; $i <= $numofpages; $i++ ) { |
210 | 216 | if ( $i == $page ) { |