Index: trunk/extensions/SocialProfile/UserProfile/SpecialPopulateExistingUsersProfiles.php |
— | — | @@ -14,7 +14,7 @@ |
15 | 15 | class SpecialPopulateUserProfiles extends SpecialPage { |
16 | 16 | |
17 | 17 | /** |
18 | | - * Constructor |
| 18 | + * Constructor -- set up the new special page |
19 | 19 | */ |
20 | 20 | public function __construct() { |
21 | 21 | parent::__construct( 'PopulateUserProfiles' ); |
— | — | @@ -26,13 +26,26 @@ |
27 | 27 | * @param $params Mixed: parameter(s) passed to the page or null |
28 | 28 | */ |
29 | 29 | public function execute( $params ) { |
30 | | - global $wgRequest, $wgOut, $wgUser; |
| 30 | + global $wgOut, $wgUser; |
31 | 31 | |
| 32 | + // Check permissions |
32 | 33 | if ( !in_array( 'staff', $wgUser->getEffectiveGroups() ) ) { |
33 | 34 | throw new ErrorPageError( 'error', 'badaccess' ); |
34 | 35 | return ''; |
35 | 36 | } |
36 | 37 | |
| 38 | + // Show a message if the database is in read-only mode |
| 39 | + if ( wfReadOnly() ) { |
| 40 | + $wgOut->readOnlyPage(); |
| 41 | + return; |
| 42 | + } |
| 43 | + |
| 44 | + // If user is blocked, they don't need to access this page |
| 45 | + if ( $wgUser->isBlocked() ) { |
| 46 | + $wgOut->blockedPage(); |
| 47 | + return; |
| 48 | + } |
| 49 | + |
37 | 50 | $dbw = wfGetDB( DB_MASTER ); |
38 | 51 | $res = $dbw->select( |
39 | 52 | 'page', |
— | — | @@ -43,7 +56,7 @@ |
44 | 57 | |
45 | 58 | $count = 0; // To avoid an annoying PHP notice |
46 | 59 | |
47 | | - while ( $row = $dbw->fetchObject( $res ) ) { |
| 60 | + foreach( $res as $row ) { |
48 | 61 | $user_name_title = Title::newFromDBkey( $row->page_title ); |
49 | 62 | $user_name = $user_name_title->getText(); |
50 | 63 | $user_id = User::idFromName( $user_name ); |
Index: trunk/extensions/SocialProfile/UserProfile/UserProfilePage.php |
— | — | @@ -35,10 +35,8 @@ |
36 | 36 | } |
37 | 37 | |
38 | 38 | function view() { |
39 | | - global $wgOut, $wgUser, $wgTitle; |
| 39 | + global $wgOut, $wgTitle; |
40 | 40 | |
41 | | - $sk = $wgUser->getSkin(); |
42 | | - |
43 | 41 | $wgOut->setPageTitle( $this->mTitle->getPrefixedText() ); |
44 | 42 | |
45 | 43 | // No need to display noarticletext, we use our own message |
— | — | @@ -138,8 +136,8 @@ |
139 | 137 | |
140 | 138 | if ( $total_value != 0 ) { |
141 | 139 | $output .= '<div class="user-section-heading"> |
142 | | - <div class="user-section-title">' |
143 | | - . wfMsg( 'user-stats-title' ) . |
| 140 | + <div class="user-section-title">' . |
| 141 | + wfMsg( 'user-stats-title' ) . |
144 | 142 | '</div> |
145 | 143 | <div class="user-section-actions"> |
146 | 144 | <div class="action-right"> |
— | — | @@ -151,16 +149,39 @@ |
152 | 150 | </div> |
153 | 151 | <div class="cleared"></div> |
154 | 152 | <div class="profile-info-container bold-fix">' . |
155 | | - $this->getUserStatsRow( wfMsgExt( 'user-stats-edits', 'parsemag', $stats_data['edits'] ), $stats_data['edits'] ) . |
156 | | - $this->getUserStatsRow( wfMsgExt( 'user-stats-votes', 'parsemag', $stats_data['votes'] ), $stats_data['votes'] ) . |
157 | | - $this->getUserStatsRow( wfMsgExt( 'user-stats-comments', 'parsemag', $stats_data['comments'] ), $stats_data['comments'] ) . |
158 | | - $this->getUserStatsRow( wfMsgExt( 'user-stats-recruits', 'parsemag', $stats_data['recruits'] ), $stats_data['recruits'] ) . |
159 | | - $this->getUserStatsRow( wfMsgExt( 'user-stats-poll-votes', 'parsemag', $stats_data['poll_votes'] ), $stats_data['poll_votes'] ) . |
160 | | - $this->getUserStatsRow( wfMsgExt( 'user-stats-picture-game-votes', 'parsemag', $stats_data['picture_game_votes'] ), $stats_data['picture_game_votes'] ) . |
161 | | - $this->getUserStatsRow( wfMsgExt( 'user-stats-quiz-points', 'parsemag', $stats_data['quiz_points'] ), $stats_data['quiz_points'] ); |
162 | | - if ( $stats_data['currency'] != '10,000' ) { |
163 | | - $output .= $this->getUserStatsRow( wfMsgExt( 'user-stats-pick-points', 'parsemag', $stats_data['currency'] ), $stats_data['currency'] ); |
164 | | - } |
| 153 | + $this->getUserStatsRow( |
| 154 | + wfMsgExt( 'user-stats-edits', 'parsemag', $stats_data['edits'] ), |
| 155 | + $stats_data['edits'] |
| 156 | + ) . |
| 157 | + $this->getUserStatsRow( |
| 158 | + wfMsgExt( 'user-stats-votes', 'parsemag', $stats_data['votes'] ), |
| 159 | + $stats_data['votes'] |
| 160 | + ) . |
| 161 | + $this->getUserStatsRow( |
| 162 | + wfMsgExt( 'user-stats-comments', 'parsemag', $stats_data['comments'] ), |
| 163 | + $stats_data['comments'] ) . |
| 164 | + $this->getUserStatsRow( |
| 165 | + wfMsgExt( 'user-stats-recruits', 'parsemag', $stats_data['recruits'] ), |
| 166 | + $stats_data['recruits'] |
| 167 | + ) . |
| 168 | + $this->getUserStatsRow( |
| 169 | + wfMsgExt( 'user-stats-poll-votes', 'parsemag', $stats_data['poll_votes'] ), |
| 170 | + $stats_data['poll_votes'] |
| 171 | + ) . |
| 172 | + $this->getUserStatsRow( |
| 173 | + wfMsgExt( 'user-stats-picture-game-votes', 'parsemag', $stats_data['picture_game_votes'] ), |
| 174 | + $stats_data['picture_game_votes'] |
| 175 | + ) . |
| 176 | + $this->getUserStatsRow( |
| 177 | + wfMsgExt( 'user-stats-quiz-points', 'parsemag', $stats_data['quiz_points'] ), |
| 178 | + $stats_data['quiz_points'] |
| 179 | + ); |
| 180 | + if ( $stats_data['currency'] != '10,000' ) { |
| 181 | + $output .= $this->getUserStatsRow( |
| 182 | + wfMsgExt( 'user-stats-pick-points', 'parsemag', $stats_data['currency'] ), |
| 183 | + $stats_data['currency'] |
| 184 | + ); |
| 185 | + } |
165 | 186 | $output .= '</div>'; |
166 | 187 | } |
167 | 188 | |
— | — | @@ -268,8 +289,8 @@ |
269 | 290 | $output = ''; |
270 | 291 | if ( $joined_data ) { |
271 | 292 | $output .= '<div class="user-section-heading"> |
272 | | - <div class="user-section-title">' |
273 | | - . wfMsg( 'user-personal-info-title' ) . |
| 293 | + <div class="user-section-title">' . |
| 294 | + wfMsg( 'user-personal-info-title' ) . |
274 | 295 | '</div> |
275 | 296 | <div class="user-section-actions"> |
276 | 297 | <div class="action-right">'; |
— | — | @@ -295,21 +316,21 @@ |
296 | 317 | '</div>'; |
297 | 318 | } elseif ( $wgUser->getName() == $user_name ) { |
298 | 319 | $output .= '<div class="user-section-heading"> |
299 | | - <div class="user-section-title">' |
300 | | - . wfMsg( 'user-personal-info-title' ) . |
| 320 | + <div class="user-section-title">' . |
| 321 | + wfMsg( 'user-personal-info-title' ) . |
301 | 322 | '</div> |
302 | 323 | <div class="user-section-actions"> |
303 | 324 | <div class="action-right"> |
304 | | - <a href="' . $edit_info_link->escapeFullURL() . '">' |
305 | | - . wfMsg( 'user-edit-this' ) . |
| 325 | + <a href="' . $edit_info_link->escapeFullURL() . '">' . |
| 326 | + wfMsg( 'user-edit-this' ) . |
306 | 327 | '</a> |
307 | 328 | </div> |
308 | 329 | <div class="cleared"></div> |
309 | 330 | </div> |
310 | 331 | </div> |
311 | 332 | <div class="cleared"></div> |
312 | | - <div class="no-info-container">' |
313 | | - . wfMsg( 'user-no-personal-info' ) . |
| 333 | + <div class="no-info-container">' . |
| 334 | + wfMsg( 'user-no-personal-info' ) . |
314 | 335 | '</div>'; |
315 | 336 | } |
316 | 337 | |
— | — | @@ -343,8 +364,8 @@ |
344 | 365 | $output = ''; |
345 | 366 | if ( $joined_data ) { |
346 | 367 | $output .= '<div class="user-section-heading"> |
347 | | - <div class="user-section-title">' |
348 | | - . wfMsg( 'custom-info-title' ) . |
| 368 | + <div class="user-section-title">' . |
| 369 | + wfMsg( 'custom-info-title' ) . |
349 | 370 | '</div> |
350 | 371 | <div class="user-section-actions"> |
351 | 372 | <div class="action-right">'; |
— | — | @@ -365,21 +386,21 @@ |
366 | 387 | '</div>'; |
367 | 388 | } elseif ( $wgUser->getName() == $user_name ) { |
368 | 389 | $output .= '<div class="user-section-heading"> |
369 | | - <div class="user-section-title">' |
370 | | - . wfMsg( 'custom-info-title' ) . |
| 390 | + <div class="user-section-title">' . |
| 391 | + wfMsg( 'custom-info-title' ) . |
371 | 392 | '</div> |
372 | 393 | <div class="user-section-actions"> |
373 | 394 | <div class="action-right"> |
374 | | - <a href="' . $edit_info_link->escapeFullURL() . '/custom">' |
375 | | - . wfMsg( 'user-edit-this' ) . |
| 395 | + <a href="' . $edit_info_link->escapeFullURL() . '/custom">' . |
| 396 | + wfMsg( 'user-edit-this' ) . |
376 | 397 | '</a> |
377 | 398 | </div> |
378 | 399 | <div class="cleared"></div> |
379 | 400 | </div> |
380 | 401 | </div> |
381 | 402 | <div class="cleared"></div> |
382 | | - <div class="no-info-container">' |
383 | | - . wfMsg( 'custom-no-info' ) . |
| 403 | + <div class="no-info-container">' . |
| 404 | + wfMsg( 'custom-no-info' ) . |
384 | 405 | '</div>'; |
385 | 406 | } |
386 | 407 | |
— | — | @@ -416,8 +437,8 @@ |
417 | 438 | $output = ''; |
418 | 439 | if ( $joined_data ) { |
419 | 440 | $output .= '<div class="user-section-heading"> |
420 | | - <div class="user-section-title">' |
421 | | - . wfMsg( 'other-info-title' ) . |
| 441 | + <div class="user-section-title">' . |
| 442 | + wfMsg( 'other-info-title' ) . |
422 | 443 | '</div> |
423 | 444 | <div class="user-section-actions"> |
424 | 445 | <div class="action-right">'; |
— | — | @@ -442,19 +463,21 @@ |
443 | 464 | '</div>'; |
444 | 465 | } elseif ( $wgUser->getName() == $user_name ) { |
445 | 466 | $output .= '<div class="user-section-heading"> |
446 | | - <div class="user-section-title">' |
447 | | - . wfMsg( 'other-info-title' ) . |
| 467 | + <div class="user-section-title">' . |
| 468 | + wfMsg( 'other-info-title' ) . |
448 | 469 | '</div> |
449 | 470 | <div class="user-section-actions"> |
450 | 471 | <div class="action-right"> |
451 | | - <a href="' . $edit_info_link->escapeFullURL() . '/personal">' . wfMsg( 'user-edit-this' ) . '</a> |
| 472 | + <a href="' . $edit_info_link->escapeFullURL() . '/personal">' . |
| 473 | + wfMsg( 'user-edit-this' ) . |
| 474 | + '</a> |
452 | 475 | </div> |
453 | 476 | <div class="cleared"></div> |
454 | 477 | </div> |
455 | 478 | </div> |
456 | 479 | <div class="cleared"></div> |
457 | | - <div class="no-info-container">' |
458 | | - . wfMsg( 'other-no-info' ) . |
| 480 | + <div class="no-info-container">' . |
| 481 | + wfMsg( 'other-no-info' ) . |
459 | 482 | '</div>'; |
460 | 483 | } |
461 | 484 | return $output; |
— | — | @@ -526,7 +549,8 @@ |
527 | 550 | } |
528 | 551 | |
529 | 552 | $output .= '<div id="profile-image"> |
530 | | - <img src="' . $wgUploadPath . '/avatars/' . $avatar->getAvatarImage() . '" alt="" border="0" /> |
| 553 | + <img src="' . $wgUploadPath . '/avatars/' . |
| 554 | + $avatar->getAvatarImage() . '" alt="" border="0" /> |
531 | 555 | </div>'; |
532 | 556 | |
533 | 557 | $output .= '<div id="profile-right">'; |
— | — | @@ -580,10 +604,12 @@ |
581 | 605 | |
582 | 606 | global $wgUserBoard; |
583 | 607 | if ( $wgUserBoard ) { |
584 | | - $output .= '<a href="' . $send_message->escapeFullURL( 'user=' . $wgUser->getName() . '&conv=' . $user_safe ) . '" rel="nofollow">' . wfMsg( 'user-send-message' ) . '</a>'; |
| 608 | + $output .= '<a href="' . $send_message->escapeFullURL( 'user=' . $wgUser->getName() . '&conv=' . $user_safe ) . '" rel="nofollow">' . |
| 609 | + wfMsg( 'user-send-message' ) . '</a>'; |
585 | 610 | $output .= wfMsgExt( 'pipe-separator', 'escapenoentities' ); |
586 | 611 | } |
587 | | - $output .= '<a href="' . $give_gift->escapeFullURL( 'user=' . $user_safe ) . '" rel="nofollow">' . wfMsg( 'user-send-gift' ) . '</a>'; |
| 612 | + $output .= '<a href="' . $give_gift->escapeFullURL( 'user=' . $user_safe ) . '" rel="nofollow">' . |
| 613 | + wfMsg( 'user-send-gift' ) . '</a>'; |
588 | 614 | $output .= wfMsgExt( 'pipe-separator', 'escapenoentities' ); |
589 | 615 | } |
590 | 616 | |
— | — | @@ -591,16 +617,19 @@ |
592 | 618 | |
593 | 619 | // Links to User:user_name from User_profile: |
594 | 620 | if ( $wgTitle->getNamespace() == NS_USER_PROFILE && $this->profile_data['user_id'] && $this->profile_data['user_page_type'] == 0 ) { |
595 | | - $output .= '| <a href="' . $user_page->escapeFullURL() . '" rel="nofollow">' . wfMsg( 'user-page-link' ) . '</a> '; |
| 621 | + $output .= '| <a href="' . $user_page->escapeFullURL() . '" rel="nofollow">' . |
| 622 | + wfMsg( 'user-page-link' ) . '</a> '; |
596 | 623 | } |
597 | 624 | |
598 | 625 | // Links to User:user_name from User_profile: |
599 | 626 | if ( $wgTitle->getNamespace() == NS_USER && $this->profile_data['user_id'] && $this->profile_data['user_page_type'] == 0 ) { |
600 | | - $output .= '| <a href="' . $user_social_profile->escapeFullURL() . '" rel="nofollow">' . wfMsg( 'user-social-profile-link' ) . '</a> '; |
| 627 | + $output .= '| <a href="' . $user_social_profile->escapeFullURL() . '" rel="nofollow">' . |
| 628 | + wfMsg( 'user-social-profile-link' ) . '</a> '; |
601 | 629 | } |
602 | 630 | |
603 | 631 | if ( $wgTitle->getNamespace() == NS_USER && ( !$this->profile_data['user_id'] || $this->profile_data['user_page_type'] == 1 ) ) { |
604 | | - $output .= '| <a href="' . $user_wiki->escapeFullURL() . '" rel="nofollow">' . wfMsg( 'user-wiki-link' ) . '</a>'; |
| 632 | + $output .= '| <a href="' . $user_wiki->escapeFullURL() . '" rel="nofollow">' . |
| 633 | + wfMsg( 'user-wiki-link' ) . '</a>'; |
605 | 634 | } |
606 | 635 | |
607 | 636 | $output .= '</div> |
— | — | @@ -610,6 +639,13 @@ |
611 | 640 | return $output; |
612 | 641 | } |
613 | 642 | |
| 643 | + /** |
| 644 | + * This is currently unused, seems to be a leftover from the ArmchairGM |
| 645 | + * days. |
| 646 | + * |
| 647 | + * @param $user_name String: user name |
| 648 | + * @return String: HTML |
| 649 | + */ |
614 | 650 | function getProfileImage( $user_name ) { |
615 | 651 | global $wgUser, $wgUploadPath; |
616 | 652 | |
— | — | @@ -716,7 +752,8 @@ |
717 | 753 | foreach ( $friends as $friend ) { |
718 | 754 | $user = Title::makeTitle( NS_USER, $friend['user_name'] ); |
719 | 755 | $avatar = new wAvatar( $friend['user_id'], 'ml' ); |
720 | | - $avatar_img = '<img src="' . $wgUploadPath . '/avatars/' . $avatar->getAvatarImage() . '" alt="" border="0" />'; |
| 756 | + $avatar_img = '<img src="' . $wgUploadPath . '/avatars/' . |
| 757 | + $avatar->getAvatarImage() . '" alt="" border="0" />'; |
721 | 758 | |
722 | 759 | // Chop down username that gets displayed |
723 | 760 | $user_name = mb_substr( $friend['user_name'], 0, 9 ); |
— | — | @@ -769,8 +806,8 @@ |
770 | 807 | |
771 | 808 | if ( $activity ) { |
772 | 809 | $output .= '<div class="user-section-heading"> |
773 | | - <div class="user-section-title">' |
774 | | - . wfMsg( 'user-recent-activity-title' ) . |
| 810 | + <div class="user-section-title">' . |
| 811 | + wfMsg( 'user-recent-activity-title' ) . |
775 | 812 | '</div> |
776 | 813 | <div class="user-section-actions"> |
777 | 814 | <div class="action-right"> |
— | — | @@ -842,7 +879,7 @@ |
843 | 880 | case 'gift-sent': |
844 | 881 | $gift_image = "<img src=\"{$wgUploadPath}/awards/" . |
845 | 882 | Gifts::getGiftImage( $item['namespace'], 'm' ) . |
846 | | - "\" border=\"0\" alt=\"\" />"; |
| 883 | + '" border="0" alt="" />'; |
847 | 884 | $item_html .= wfMsg( 'user-recent-activity-gift-sent' ) . " {$user_link_2} {$item_time} |
848 | 885 | <div class=\"item\"> |
849 | 886 | <a href=\"" . $wgScriptPath . "/index.php?title=Special:ViewGift&gift_id={$item['id']}\" rel=\"nofollow\"> |
— | — | @@ -854,7 +891,7 @@ |
855 | 892 | case 'gift-rec': |
856 | 893 | $gift_image = "<img src=\"{$wgUploadPath}/awards/" . |
857 | 894 | Gifts::getGiftImage( $item['namespace'], 'm' ) . |
858 | | - "\" border=\"0\" alt=\"\" />"; |
| 895 | + '" border="0" alt="" />'; |
859 | 896 | $item_html .= wfMsg( 'user-recent-activity-gift-rec' ) . " {$user_link_2} {$item_time}</span> |
860 | 897 | <div class=\"item\"> |
861 | 898 | <a href=\"" . $wgScriptPath . "/index.php?title=Special:ViewGift&gift_id={$item['id']}\" rel=\"nofollow\"> |
— | — | @@ -866,7 +903,7 @@ |
867 | 904 | case 'system_gift': |
868 | 905 | $gift_image = "<img src=\"{$wgUploadPath}/awards/" . |
869 | 906 | SystemGifts::getGiftImage( $item['namespace'], 'm' ) . |
870 | | - "\" border=\"0\" alt=\"\" />"; |
| 907 | + '" border="0" alt="" />'; |
871 | 908 | $item_html .= wfMsg( 'user-recent-system-gift' ) . " {$item_time} |
872 | 909 | <div class=\"user-home-item-gift\"> |
873 | 910 | <a href=\"" . $wgScriptPath . "/index.php?title=Special:ViewSystemGift&gift_id={$item['id']}\" rel=\"nofollow\"> |
— | — | @@ -876,10 +913,12 @@ |
877 | 914 | </div>"; |
878 | 915 | break; |
879 | 916 | case 'friend': |
880 | | - $item_html .= wfMsg( 'user-recent-activity-friend' ) . " <b>{$user_link_2}</b> {$item_time}"; |
| 917 | + $item_html .= wfMsg( 'user-recent-activity-friend' ) . |
| 918 | + " <b>{$user_link_2}</b> {$item_time}"; |
881 | 919 | break; |
882 | 920 | case 'foe': |
883 | | - $item_html .= wfMsg( 'user-recent-activity-foe' ) . " <b>{$user_link_2}</b> {$item_time}"; |
| 921 | + $item_html .= wfMsg( 'user-recent-activity-foe' ) . |
| 922 | + " <b>{$user_link_2}</b> {$item_time}"; |
884 | 923 | break; |
885 | 924 | case 'system_message': |
886 | 925 | $item_html .= "{$item['comment']} {$item_time}"; |
— | — | @@ -1093,8 +1132,8 @@ |
1094 | 1133 | $x = 1; |
1095 | 1134 | |
1096 | 1135 | $output .= '<div class="user-section-heading"> |
1097 | | - <div class="user-section-title">' |
1098 | | - . wfMsg( 'user-awards-title' ) . |
| 1136 | + <div class="user-section-title">' . |
| 1137 | + wfMsg( 'user-awards-title' ) . |
1099 | 1138 | '</div> |
1100 | 1139 | <div class="user-section-actions"> |
1101 | 1140 | <div class="action-right">'; |
— | — | @@ -1188,8 +1227,8 @@ |
1189 | 1228 | } |
1190 | 1229 | |
1191 | 1230 | $output .= '<div class="user-section-heading"> |
1192 | | - <div class="user-section-title">' |
1193 | | - . wfMsg( 'user-board-title' ) . |
| 1231 | + <div class="user-section-title">' . |
| 1232 | + wfMsg( 'user-board-title' ) . |
1194 | 1233 | '</div> |
1195 | 1234 | <div class="user-section-actions"> |
1196 | 1235 | <div class="action-right">'; |
— | — | @@ -1223,10 +1262,16 @@ |
1224 | 1263 | if ( $wgUser->isLoggedIn() && !$wgUser->isBlocked() ) { |
1225 | 1264 | $output .= '<div class="user-page-message-form"> |
1226 | 1265 | <input type="hidden" id="user_name_to" name="user_name_to" value="' . addslashes( $user_name ) . '" /> |
1227 | | - <span style="color:#797979;">' . wfMsgHtml( 'userboard_messagetype' ) . '</span> |
| 1266 | + <span style="color:#797979;">' . |
| 1267 | + wfMsgHtml( 'userboard_messagetype' ) . |
| 1268 | + '</span> |
1228 | 1269 | <select id="message_type"> |
1229 | | - <option value="0">' . wfMsgHtml( 'userboard_public' ) . '</option> |
1230 | | - <option value="1">' . wfMsgHtml( 'userboard_private' ) . '</option> |
| 1270 | + <option value="0">' . |
| 1271 | + wfMsgHtml( 'userboard_public' ) . |
| 1272 | + '</option> |
| 1273 | + <option value="1">' . |
| 1274 | + wfMsgHtml( 'userboard_private' ) . |
| 1275 | + '</option> |
1231 | 1276 | </select><p> |
1232 | 1277 | <textarea name="message" id="message" cols="43" rows="4"/></textarea> |
1233 | 1278 | <div class="user-page-message-box-button"> |
— | — | @@ -1235,8 +1280,8 @@ |
1236 | 1281 | </div>'; |
1237 | 1282 | } else { |
1238 | 1283 | $login_link = SpecialPage::getTitleFor( 'Userlogin' ); |
1239 | | - $output .= '<div class="user-page-message-form">' |
1240 | | - . wfMsg( 'user-board-login-message', $login_link->escapeFullURL() ) . |
| 1284 | + $output .= '<div class="user-page-message-form">' . |
| 1285 | + wfMsg( 'user-board-login-message', $login_link->escapeFullURL() ) . |
1241 | 1286 | '</div>'; |
1242 | 1287 | } |
1243 | 1288 | } |
— | — | @@ -1244,7 +1289,6 @@ |
1245 | 1290 | $output .= '<div id="user-page-board">'; |
1246 | 1291 | $b = new UserBoard(); |
1247 | 1292 | $output .= $b->displayMessages( $user_id, 0, 10 ); |
1248 | | - |
1249 | 1293 | $output .= '</div>'; |
1250 | 1294 | |
1251 | 1295 | return $output; |
Index: trunk/extensions/SocialProfile/UserProfile/SpecialRemoveAvatar.php |
— | — | @@ -56,7 +56,7 @@ |
57 | 57 | |
58 | 58 | // If the request was POSTed, then delete the avatar |
59 | 59 | if ( $wgRequest->wasPosted() ) { |
60 | | - $user_id = $wgRequest->getVal( 'user_id' ); |
| 60 | + $user_id = $wgRequest->getInt( 'user_id' ); |
61 | 61 | $user_deleted = User::newFromId( $user_id ); |
62 | 62 | $user_deleted->loadFromDatabase(); |
63 | 63 | |
— | — | @@ -74,8 +74,13 @@ |
75 | 75 | $wgUser->getUserPage(), |
76 | 76 | wfMsg( 'user-profile-picture-log-delete-entry', $user_deleted->getName() ) |
77 | 77 | ); |
78 | | - $wgOut->addHTML( '<div>' . wfMsg( 'avatarupload-removesuccess' ) . '</div>' ); |
79 | | - $wgOut->addHTML( '<div><a href="' . $this->title->escapeFullURL() . '">' . wfMsg( 'avatarupload-removeanother' ) . '</a></div>' ); |
| 78 | + $wgOut->addHTML( |
| 79 | + '<div>' . wfMsg( 'avatarupload-removesuccess' ) . '</div>' |
| 80 | + ); |
| 81 | + $wgOut->addHTML( |
| 82 | + '<div><a href="' . $this->title->escapeFullURL() . '">' . |
| 83 | + wfMsg( 'avatarupload-removeanother' ) . '</a></div>' |
| 84 | + ); |
80 | 85 | } else { |
81 | 86 | if ( $user ) { |
82 | 87 | $wgOut->addHTML( $this->showUserAvatar( $user ) ); |
— | — | @@ -129,6 +134,7 @@ |
130 | 135 | */ |
131 | 136 | private function deleteImage( $id, $size ) { |
132 | 137 | global $wgUploadDirectory, $wgDBname, $wgMemc; |
| 138 | + |
133 | 139 | $avatar = new wAvatar( $id, $size ); |
134 | 140 | $files = glob( $wgUploadDirectory . '/avatars/' . $wgDBname . '_' . $id . '_' . $size . "*" ); |
135 | 141 | wfSuppressWarnings(); |
Index: trunk/extensions/SocialProfile/UserProfile/SpecialToggleUserPageType.php |
— | — | @@ -13,7 +13,7 @@ |
14 | 14 | class SpecialToggleUserPage extends UnlistedSpecialPage { |
15 | 15 | |
16 | 16 | /** |
17 | | - * Constructor |
| 17 | + * Constructor -- set up the new special page |
18 | 18 | */ |
19 | 19 | public function __construct() { |
20 | 20 | parent::__construct( 'ToggleUserPage' ); |
— | — | @@ -25,15 +25,26 @@ |
26 | 26 | * @param $params Mixed: parameter(s) passed to the page or null |
27 | 27 | */ |
28 | 28 | public function execute( $params ) { |
29 | | - global $wgRequest, $wgOut, $wgUser, $wgMemc; |
| 29 | + global $wgOut, $wgUser, $wgMemc; |
30 | 30 | |
31 | 31 | // This feature is only available to logged-in users. |
32 | 32 | if ( !$wgUser->isLoggedIn() ) { |
33 | 33 | throw new ErrorPageError( 'error', 'badaccess' ); |
34 | 34 | } |
35 | 35 | |
| 36 | + // Show a message if the database is in read-only mode |
| 37 | + if ( wfReadOnly() ) { |
| 38 | + $wgOut->readOnlyPage(); |
| 39 | + return; |
| 40 | + } |
| 41 | + |
36 | 42 | $dbr = wfGetDB( DB_MASTER ); |
37 | | - $s = $dbr->selectRow( 'user_profile', array( 'up_user_id' ), array( 'up_user_id' => $wgUser->getID() ), __METHOD__ ); |
| 43 | + $s = $dbr->selectRow( |
| 44 | + 'user_profile', |
| 45 | + array( 'up_user_id' ), |
| 46 | + array( 'up_user_id' => $wgUser->getID() ), |
| 47 | + __METHOD__ |
| 48 | + ); |
38 | 49 | if ( $s === false ) { |
39 | 50 | $dbw = wfGetDB( DB_MASTER ); |
40 | 51 | $dbw->insert( 'user_profile', |