Index: trunk/extensions/SocialProfile/UserProfile/UserProfilePage.php |
— | — | @@ -41,7 +41,7 @@ |
42 | 42 | |
43 | 43 | $wgOut->setPageTitle( $this->mTitle->getPrefixedText() ); |
44 | 44 | |
45 | | - # No need to display noarticletext, we use our own message |
| 45 | + // No need to display noarticletext, we use our own message |
46 | 46 | if ( !$this->user_id ) { |
47 | 47 | parent::view(); |
48 | 48 | return ''; |
— | — | @@ -51,8 +51,14 @@ |
52 | 52 | $wgOut->addHTML( $this->getProfileTop( $this->user_id, $this->user_name ) ); |
53 | 53 | $wgOut->addHTML( '<div class="cleared"></div></div>' ); |
54 | 54 | |
55 | | - // User does not want social profile for User:user_name, so we just show header + page content |
56 | | - if ( $wgTitle->getNamespace() == NS_USER && $this->profile_data['user_id'] && $this->profile_data['user_page_type'] == 0 ) { |
| 55 | + // User does not want social profile for User:user_name, so we just |
| 56 | + // show header + page content |
| 57 | + if ( |
| 58 | + $wgTitle->getNamespace() == NS_USER && |
| 59 | + $this->profile_data['user_id'] && |
| 60 | + $this->profile_data['user_page_type'] == 0 |
| 61 | + ) |
| 62 | + { |
57 | 63 | parent::view(); |
58 | 64 | return ''; |
59 | 65 | } |
— | — | @@ -211,6 +217,7 @@ |
212 | 218 | |
213 | 219 | $defaultCountry = wfMsgForContent( 'user-profile-default-country' ); |
214 | 220 | |
| 221 | + // Current location |
215 | 222 | $location = $profile_data['location_city'] . ', ' . $profile_data['location_state']; |
216 | 223 | if ( $profile_data['location_country'] != $defaultCountry ) { |
217 | 224 | if ( $profile_data['location_city'] && $profile_data['location_state'] ) { // city AND state |
— | — | @@ -231,6 +238,7 @@ |
232 | 239 | $location = ''; |
233 | 240 | } |
234 | 241 | |
| 242 | + // Hometown |
235 | 243 | $hometown = $profile_data['hometown_city'] . ', ' . $profile_data['hometown_state']; |
236 | 244 | if ( $profile_data['hometown_country'] != $defaultCountry ) { |
237 | 245 | if ( $profile_data['hometown_city'] && $profile_data['hometown_state'] ) { // city AND state |
— | — | @@ -265,10 +273,11 @@ |
266 | 274 | '</div> |
267 | 275 | <div class="user-section-actions"> |
268 | 276 | <div class="action-right">'; |
269 | | - if ( $wgUser->getName() == $user_name ) { |
270 | | - $output .= '<a href="' . $edit_info_link->escapeFullURL() . '">' . wfMsg( 'user-edit-this' ) . '</a>'; |
271 | | - } |
272 | | - $output .= '</div> |
| 277 | + if ( $wgUser->getName() == $user_name ) { |
| 278 | + $output .= '<a href="' . $edit_info_link->escapeFullURL() . '">' . |
| 279 | + wfMsg( 'user-edit-this' ) . '</a>'; |
| 280 | + } |
| 281 | + $output .= '</div> |
273 | 282 | <div class="cleared"></div> |
274 | 283 | </div> |
275 | 284 | </div> |
— | — | @@ -307,6 +316,12 @@ |
308 | 317 | return $output; |
309 | 318 | } |
310 | 319 | |
| 320 | + /** |
| 321 | + * Get the custom info (site-specific stuff) for a given user. |
| 322 | + * |
| 323 | + * @param $user_name String: user name whose custom info we should fetch |
| 324 | + * @return String: HTML |
| 325 | + */ |
311 | 326 | function getCustomInfo( $user_name ) { |
312 | 327 | global $wgUser, $wgUserProfileDisplay; |
313 | 328 | |
— | — | @@ -318,6 +333,7 @@ |
319 | 334 | $profile = new UserProfile( $user_name ); |
320 | 335 | $this->profile_data = $profile->getProfile(); |
321 | 336 | } |
| 337 | + |
322 | 338 | $profile_data = $this->profile_data; |
323 | 339 | |
324 | 340 | $joined_data = $profile_data['custom_1'] . $profile_data['custom_2'] . |
— | — | @@ -332,10 +348,11 @@ |
333 | 349 | '</div> |
334 | 350 | <div class="user-section-actions"> |
335 | 351 | <div class="action-right">'; |
336 | | - if ( $wgUser->getName() == $user_name ) { |
337 | | - $output .= '<a href="' . $edit_info_link->escapeFullURL() . '/custom">' . wfMsg( 'user-edit-this' ) . '</a>'; |
338 | | - } |
339 | | - $output .= '</div> |
| 352 | + if ( $wgUser->getName() == $user_name ) { |
| 353 | + $output .= '<a href="' . $edit_info_link->escapeFullURL() . '/custom">' . |
| 354 | + wfMsg( 'user-edit-this' ) . '</a>'; |
| 355 | + } |
| 356 | + $output .= '</div> |
340 | 357 | <div class="cleared"></div> |
341 | 358 | </div> |
342 | 359 | </div> |
— | — | @@ -369,6 +386,13 @@ |
370 | 387 | return $output; |
371 | 388 | } |
372 | 389 | |
| 390 | + /** |
| 391 | + * Get the interests (favorite movies, TV shows, music, etc.) for a given |
| 392 | + * user. |
| 393 | + * |
| 394 | + * @param $user_name String: user name whose interests we should fetch |
| 395 | + * @return String: HTML |
| 396 | + */ |
373 | 397 | function getInterests( $user_name ) { |
374 | 398 | global $wgUser, $wgUserProfileDisplay; |
375 | 399 | |
— | — | @@ -380,6 +404,7 @@ |
381 | 405 | $profile = new UserProfile( $user_name ); |
382 | 406 | $this->profile_data = $profile->getProfile(); |
383 | 407 | } |
| 408 | + |
384 | 409 | $profile_data = $this->profile_data; |
385 | 410 | $joined_data = $profile_data['movies'] . $profile_data['tv'] . |
386 | 411 | $profile_data['music'] . $profile_data['books'] . |
— | — | @@ -390,17 +415,17 @@ |
391 | 416 | |
392 | 417 | $output = ''; |
393 | 418 | if ( $joined_data ) { |
394 | | - |
395 | 419 | $output .= '<div class="user-section-heading"> |
396 | 420 | <div class="user-section-title">' |
397 | 421 | . wfMsg( 'other-info-title' ) . |
398 | 422 | '</div> |
399 | 423 | <div class="user-section-actions"> |
400 | 424 | <div class="action-right">'; |
401 | | - if ( $wgUser->getName() == $user_name ) { |
402 | | - $output .= '<a href="' . $edit_info_link->escapeFullURL() . '/personal">' . wfMsg( 'user-edit-this' ) . '</a>'; |
403 | | - } |
404 | | - $output .= '</div> |
| 425 | + if ( $wgUser->getName() == $user_name ) { |
| 426 | + $output .= '<a href="' . $edit_info_link->escapeFullURL() . '/personal">' . |
| 427 | + wfMsg( 'user-edit-this' ) . '</a>'; |
| 428 | + } |
| 429 | + $output .= '</div> |
405 | 430 | <div class="cleared"></div> |
406 | 431 | </div> |
407 | 432 | </div> |
— | — | @@ -415,7 +440,6 @@ |
416 | 441 | $this->getProfileSection( wfMsg( 'other-info-snacks' ), $profile_data['snacks'], false ) . |
417 | 442 | $this->getProfileSection( wfMsg( 'other-info-drinks' ), $profile_data['drinks'], false ) . |
418 | 443 | '</div>'; |
419 | | - |
420 | 444 | } elseif ( $wgUser->getName() == $user_name ) { |
421 | 445 | $output .= '<div class="user-section-heading"> |
422 | 446 | <div class="user-section-title">' |
— | — | @@ -436,8 +460,17 @@ |
437 | 461 | return $output; |
438 | 462 | } |
439 | 463 | |
| 464 | + /** |
| 465 | + * Get the header for the social profile page, which includes the user's |
| 466 | + * points and user level (if enabled in the site configuration) and lots |
| 467 | + * more. |
| 468 | + * |
| 469 | + * @param $user_id Integer: user ID |
| 470 | + * @param $user_name String: user name |
| 471 | + */ |
440 | 472 | function getProfileTop( $user_id, $user_name ) { |
441 | 473 | global $wgTitle, $wgUser, $wgUploadPath, $wgLang; |
| 474 | + global $wgUserLevels; |
442 | 475 | |
443 | 476 | $stats = new UserStats( $user_id, $user_name ); |
444 | 477 | $stats_data = $stats->getUserStats(); |
— | — | @@ -476,14 +509,19 @@ |
477 | 510 | } |
478 | 511 | $avatar = new wAvatar( $this->user_id, 'l' ); |
479 | 512 | |
480 | | - wfDebug( "profile type" . $profile_data['user_page_type'] . "\n" ); |
| 513 | + wfDebug( 'profile type: ' . $profile_data['user_page_type'] . "\n" ); |
481 | 514 | $output = ''; |
| 515 | + |
482 | 516 | if ( $this->isOwner() ) { |
483 | 517 | $toggle_title = SpecialPage::getTitleFor( 'ToggleUserPage' ); |
| 518 | + if ( $this->profile_data['user_page_type'] == 1 ) { |
| 519 | + $toggleMessage = wfMsg( 'user-type-toggle-old' ); |
| 520 | + } else { |
| 521 | + $toggleMessage = wfMsg( 'user-type-toggle-new' ); |
| 522 | + } |
484 | 523 | $output .= '<div id="profile-toggle-button"> |
485 | | - <a href="' . $toggle_title->escapeFullURL() . '" rel="nofollow">' |
486 | | - . ( ( $this->profile_data['user_page_type'] == 1 ) ? wfMsg( 'user-type-toggle-old' ) : wfMsg( 'user-type-toggle-new' ) ) . |
487 | | - '</a> |
| 524 | + <a href="' . $toggle_title->escapeFullURL() . '" rel="nofollow">' . |
| 525 | + $toggleMessage . '</a> |
488 | 526 | </div>'; |
489 | 527 | } |
490 | 528 | |
— | — | @@ -493,20 +531,21 @@ |
494 | 532 | |
495 | 533 | $output .= '<div id="profile-right">'; |
496 | 534 | |
497 | | - $output .= '<div id="profile-title-container"> |
498 | | - <div id="profile-title"> |
499 | | - ' . $user_name . ' |
500 | | - </div>'; |
501 | | - global $wgUserLevels; |
502 | | - if ( $wgUserLevels ) { |
503 | | - $output .= '<div id="points-level"> |
504 | | - <a href="' . $level_link->escapeFullURL() . '">' . wfMsgExt( 'user-profile-points', 'parsemag', $stats_data['points'] ) . '</a> |
| 535 | + $output .= '<div id="profile-title-container"> |
| 536 | + <div id="profile-title">' . |
| 537 | + $user_name . |
| 538 | + '</div>'; |
| 539 | + if ( $wgUserLevels ) { |
| 540 | + $output .= '<div id="points-level"> |
| 541 | + <a href="' . $level_link->escapeFullURL() . '">' . |
| 542 | + wfMsgExt( 'user-profile-points', 'parsemag', $stats_data['points'] ) . |
| 543 | + '</a> |
505 | 544 | </div> |
506 | 545 | <div id="honorific-level"> |
507 | 546 | <a href="' . $level_link->escapeFullURL() . '" rel="nofollow">(' . $user_level->getLevelName() . ')</a> |
508 | 547 | </div>'; |
509 | | - } |
510 | | - $output .= '<div class="cleared"></div> |
| 548 | + } |
| 549 | + $output .= '<div class="cleared"></div> |
511 | 550 | </div> |
512 | 551 | <div class="profile-actions">'; |
513 | 552 | |
— | — | @@ -575,22 +614,37 @@ |
576 | 615 | global $wgUser, $wgUploadPath; |
577 | 616 | |
578 | 617 | $avatar = new wAvatar( $this->user_id, 'l' ); |
579 | | - $avatar_title = SpecialPage::getTitleFor( 'UploadAvatar' ); |
| 618 | + $avatarTitle = SpecialPage::getTitleFor( 'UploadAvatar' ); |
580 | 619 | |
581 | 620 | $output .= '<div class="profile-image">'; |
582 | | - if ( $wgUser->getName() == $this->user_name ) { |
583 | | - $output .= '<a href="' . $avatar->escapeFullURL() . '" rel="nofollow"> |
584 | | - <img src="' . $wgUploadPath . '/avatars/' . $avatar->getAvatarImage() . '" alt="" border="0" /><br /> |
585 | | - (' . ( ( strpos( $avatar->getAvatarImage(), 'default_' ) != false ) ? 'upload image' : 'new image' ) . ') |
586 | | - </a>'; |
| 621 | + if ( $wgUser->getName() == $this->user_name ) { |
| 622 | + if ( strpos( $avatar->getAvatarImage(), 'default_' ) != false ) { |
| 623 | + $caption = 'upload image'; |
587 | 624 | } else { |
588 | | - $output .= '<img src="' . $wgUploadPath . '/avatars/' . $avatar->getAvatarImage() . '" alt="" border="0" />'; |
| 625 | + $caption = 'new image'; |
589 | 626 | } |
| 627 | + $output .= '<a href="' . $avatarTitle->escapeFullURL() . '" rel="nofollow"> |
| 628 | + <img src="' . $wgUploadPath . '/avatars/' . |
| 629 | + $avatar->getAvatarImage() . '" alt="" border="0" /><br /> |
| 630 | + (' . $caption . ') |
| 631 | + </a>'; |
| 632 | + } else { |
| 633 | + $output .= '<img src="' . $wgUploadPath . '/avatars/' . |
| 634 | + $avatar->getAvatarImage() . '" alt="" border="0" />'; |
| 635 | + } |
590 | 636 | $output .= '</div>'; |
591 | 637 | |
592 | 638 | return $output; |
593 | 639 | } |
594 | 640 | |
| 641 | + /** |
| 642 | + * Get the relationships for a given user. |
| 643 | + * |
| 644 | + * @param $user_name String: name of the user whose relationships we want |
| 645 | + * to fetch |
| 646 | + * @param $rel_type Integer: 1 for friends, 2 (or anything else than 1) for |
| 647 | + * foes |
| 648 | + */ |
595 | 649 | function getRelationships( $user_name, $rel_type ) { |
596 | 650 | global $wgMemc, $wgUser, $wgUserProfileDisplay, $wgUploadPath; |
597 | 651 | |
— | — | @@ -623,7 +677,6 @@ |
624 | 678 | |
625 | 679 | $stats = new UserStats( $rel->user_id, $user_name ); |
626 | 680 | $stats_data = $stats->getUserStats(); |
627 | | - $user_safe = urlencode( $user_name ); |
628 | 681 | $view_all_title = SpecialPage::getTitleFor( 'ViewRelationships' ); |
629 | 682 | |
630 | 683 | if ( $rel_type == 1 ) { |
— | — | @@ -642,51 +695,57 @@ |
643 | 696 | <div class="user-section-title">' . $relationship_title . '</div> |
644 | 697 | <div class="user-section-actions"> |
645 | 698 | <div class="action-right">'; |
646 | | - if ( intval( str_replace( ',', '', $relationship_count ) ) > 4 ) { |
647 | | - $output .= '<a href="' . $view_all_title->escapeFullURL( 'user=' . $user_name . '&rel_type=' . $rel_type ) . '" rel="nofollow">' . wfMsg( 'user-view-all' ) . '</a>'; |
648 | | - } |
649 | | - $output .= '</div> |
| 699 | + if ( intval( str_replace( ',', '', $relationship_count ) ) > 4 ) { |
| 700 | + $output .= '<a href="' . $view_all_title->escapeFullURL( 'user=' . $user_name . '&rel_type=' . $rel_type ) . |
| 701 | + '" rel="nofollow">' . wfMsg( 'user-view-all' ) . '</a>'; |
| 702 | + } |
| 703 | + $output .= '</div> |
650 | 704 | <div class="action-left">'; |
651 | | - if ( intval( str_replace( ',', '', $relationship_count ) ) > 4 ) { |
652 | | - $output .= wfMsg( 'user-count-separator', $per_row, $relationship_count ); |
653 | | - } else { |
654 | | - $output .= wfMsg( 'user-count-separator', $relationship_count, $relationship_count ); |
655 | | - } |
656 | | - $output .= '</div> |
| 705 | + if ( intval( str_replace( ',', '', $relationship_count ) ) > 4 ) { |
| 706 | + $output .= wfMsg( 'user-count-separator', $per_row, $relationship_count ); |
| 707 | + } else { |
| 708 | + $output .= wfMsg( 'user-count-separator', $relationship_count, $relationship_count ); |
| 709 | + } |
| 710 | + $output .= '</div> |
657 | 711 | </div> |
658 | 712 | <div class="cleared"></div> |
659 | 713 | </div> |
660 | 714 | <div class="cleared"></div> |
661 | 715 | <div class="user-relationship-container">'; |
662 | 716 | |
663 | | - foreach ( $friends as $friend ) { |
664 | | - $user = Title::makeTitle( NS_USER, $friend['user_name'] ); |
665 | | - $avatar = new wAvatar( $friend['user_id'], 'ml' ); |
666 | | - $avatar_img = '<img src="' . $wgUploadPath . '/avatars/' . $avatar->getAvatarImage() . '" alt="" border="0" />'; |
| 717 | + foreach ( $friends as $friend ) { |
| 718 | + $user = Title::makeTitle( NS_USER, $friend['user_name'] ); |
| 719 | + $avatar = new wAvatar( $friend['user_id'], 'ml' ); |
| 720 | + $avatar_img = '<img src="' . $wgUploadPath . '/avatars/' . $avatar->getAvatarImage() . '" alt="" border="0" />'; |
667 | 721 | |
668 | | - // Chop down username that gets displayed |
669 | | - $user_name = mb_substr( $friend['user_name'], 0, 9 ); |
670 | | - if ( $user_name != $friend['user_name'] ) { |
671 | | - $user_name .= '..'; |
672 | | - } |
| 722 | + // Chop down username that gets displayed |
| 723 | + $user_name = mb_substr( $friend['user_name'], 0, 9 ); |
| 724 | + if ( $user_name != $friend['user_name'] ) { |
| 725 | + $user_name .= '..'; |
| 726 | + } |
673 | 727 | |
674 | | - $output .= "<a href=\"" . $user->escapeFullURL() . "\" title=\"{$friend["user_name"]}\" rel=\"nofollow\"> |
675 | | - {$avatar_img}<br /> |
676 | | - {$user_name} |
677 | | - </a>"; |
678 | | - if ( $x == count( $friends ) || $x != 1 && $x % $per_row == 0 ) { |
679 | | - $output .= '<div class="cleared"></div>'; |
680 | | - } |
681 | | - $x++; |
| 728 | + $output .= "<a href=\"" . $user->escapeFullURL() . "\" title=\"{$friend['user_name']}\" rel=\"nofollow\"> |
| 729 | + {$avatar_img}<br /> |
| 730 | + {$user_name} |
| 731 | + </a>"; |
| 732 | + |
| 733 | + if ( $x == count( $friends ) || $x != 1 && $x % $per_row == 0 ) { |
| 734 | + $output .= '<div class="cleared"></div>'; |
682 | 735 | } |
| 736 | + |
| 737 | + $x++; |
| 738 | + } |
| 739 | + |
683 | 740 | $output .= '</div>'; |
684 | 741 | } |
| 742 | + |
685 | 743 | return $output; |
686 | 744 | } |
687 | 745 | |
688 | 746 | /** |
689 | | - * Gets the recent social activity related to the current user |
690 | | - * @param $user_name Mixed: name of the user whose activity we want to fetch |
| 747 | + * Gets the recent social activity for a given user. |
| 748 | + * |
| 749 | + * @param $user_name String: name of the user whose activity we want to fetch |
691 | 750 | */ |
692 | 751 | function getActivity( $user_name ) { |
693 | 752 | global $wgUser, $wgUserProfileDisplay, $wgScriptPath, $wgUploadPath; |
— | — | @@ -736,33 +795,40 @@ |
737 | 796 | $user_title_2 = Title::makeTitle( NS_USER, $item['comment'] ); |
738 | 797 | |
739 | 798 | if ( $user_title_2 ) { |
740 | | - $user_link_2 = '<a href="' . $user_title_2->escapeFullURL() . '" rel="nofollow">' . $item['comment'] . '</a>'; |
| 799 | + $user_link_2 = '<a href="' . $user_title_2->escapeFullURL() . |
| 800 | + '" rel="nofollow">' . $item['comment'] . '</a>'; |
741 | 801 | } |
742 | 802 | |
743 | 803 | $comment_url = ''; |
744 | 804 | if ( $item['type'] == 'comment' ) { |
745 | | - $comment_url = "#comment-{$item["id"]}"; |
| 805 | + $comment_url = "#comment-{$item['id']}"; |
746 | 806 | } |
747 | 807 | |
748 | | - $page_link = '<b><a href="' . $title->escapeFullURL() . "{$comment_url}\">" . $title->getPrefixedText() . '</a></b> '; |
| 808 | + $page_link = '<b><a href="' . $title->escapeFullURL() . |
| 809 | + "{$comment_url}\">" . $title->getPrefixedText() . '</a></b> '; |
749 | 810 | $b = new UserBoard(); // Easier than porting the time-related functions here |
750 | | - $item_time = '<span class="item-small">' . wfMsg( 'user-time-ago', $b->getTimeAgo( $item['timestamp'] ) ) . '</span>'; |
| 811 | + $item_time = '<span class="item-small">' . |
| 812 | + wfMsg( 'user-time-ago', $b->getTimeAgo( $item['timestamp'] ) ) . |
| 813 | + '</span>'; |
751 | 814 | |
752 | 815 | if ( $x < $style_limit ) { |
753 | 816 | $item_html .= '<div class="activity-item"> |
754 | | - <img src="' . $wgScriptPath . '/extensions/SocialProfile/images/' . UserActivity::getTypeIcon( $item['type'] ) . '" alt="" border="0" />'; |
| 817 | + <img src="' . $wgScriptPath . '/extensions/SocialProfile/images/' . |
| 818 | + UserActivity::getTypeIcon( $item['type'] ) . '" alt="" border="0" />'; |
755 | 819 | } else { |
756 | 820 | $item_html .= '<div class="activity-item-bottom"> |
757 | | - <img src="' . $wgScriptPath . '/extensions/SocialProfile/images/' . UserActivity::getTypeIcon( $item['type'] ) . '" alt="" border="0" />'; |
| 821 | + <img src="' . $wgScriptPath . '/extensions/SocialProfile/images/' . |
| 822 | + UserActivity::getTypeIcon( $item['type'] ) . '" alt="" border="0" />'; |
758 | 823 | } |
759 | 824 | |
760 | 825 | switch( $item['type'] ) { |
761 | 826 | case 'edit': |
762 | 827 | $item_html .= wfMsg( 'user-recent-activity-edit' ) . " {$page_link} {$item_time} |
763 | 828 | <div class=\"item\">"; |
764 | | - if ( $item['comment'] ) |
765 | | - $item_html .= "\"{$item["comment"]}\""; |
766 | | - $item_html .= '</div>'; |
| 829 | + if ( $item['comment'] ) { |
| 830 | + $item_html .= "\"{$item['comment']}\""; |
| 831 | + } |
| 832 | + $item_html .= '</div>'; |
767 | 833 | break; |
768 | 834 | case 'vote': |
769 | 835 | $item_html .= wfMsg( 'user-recent-activity-vote' ) . " {$page_link} {$item_time}"; |
— | — | @@ -770,36 +836,42 @@ |
771 | 837 | case 'comment': |
772 | 838 | $item_html .= wfMsg( 'user-recent-activity-comment' ) . " {$page_link} {$item_time} |
773 | 839 | <div class=\"item\"> |
774 | | - \"{$item["comment"]}\" |
| 840 | + \"{$item['comment']}\" |
775 | 841 | </div>"; |
776 | 842 | break; |
777 | 843 | case 'gift-sent': |
778 | | - $gift_image = "<img src=\"{$wgUploadPath}/awards/" . Gifts::getGiftImage( $item['namespace'], 'm' ) . "\" border=\"0\" alt=\"\" />"; |
| 844 | + $gift_image = "<img src=\"{$wgUploadPath}/awards/" . |
| 845 | + Gifts::getGiftImage( $item['namespace'], 'm' ) . |
| 846 | + "\" border=\"0\" alt=\"\" />"; |
779 | 847 | $item_html .= wfMsg( 'user-recent-activity-gift-sent' ) . " {$user_link_2} {$item_time} |
780 | 848 | <div class=\"item\"> |
781 | | - <a href=\"" . $wgScriptPath . "/index.php?title=Special:ViewGift&gift_id={$item["id"]}\" rel=\"nofollow\"> |
| 849 | + <a href=\"" . $wgScriptPath . "/index.php?title=Special:ViewGift&gift_id={$item['id']}\" rel=\"nofollow\"> |
782 | 850 | {$gift_image} |
783 | | - {$item["pagetitle"]} |
| 851 | + {$item['pagetitle']} |
784 | 852 | </a> |
785 | 853 | </div>"; |
786 | 854 | break; |
787 | 855 | case 'gift-rec': |
788 | | - $gift_image = "<img src=\"{$wgUploadPath}/awards/" . Gifts::getGiftImage( $item['namespace'], 'm' ) . "\" border=\"0\" alt=\"\" />"; |
| 856 | + $gift_image = "<img src=\"{$wgUploadPath}/awards/" . |
| 857 | + Gifts::getGiftImage( $item['namespace'], 'm' ) . |
| 858 | + "\" border=\"0\" alt=\"\" />"; |
789 | 859 | $item_html .= wfMsg( 'user-recent-activity-gift-rec' ) . " {$user_link_2} {$item_time}</span> |
790 | 860 | <div class=\"item\"> |
791 | | - <a href=\"" . $wgScriptPath . "/index.php?title=Special:ViewGift&gift_id={$item["id"]}\" rel=\"nofollow\"> |
| 861 | + <a href=\"" . $wgScriptPath . "/index.php?title=Special:ViewGift&gift_id={$item['id']}\" rel=\"nofollow\"> |
792 | 862 | {$gift_image} |
793 | 863 | {$item["pagetitle"]} |
794 | 864 | </a> |
795 | 865 | </div>"; |
796 | 866 | break; |
797 | 867 | case 'system_gift': |
798 | | - $gift_image = "<img src=\"{$wgUploadPath}/awards/" . SystemGifts::getGiftImage( $item['namespace'], 'm' ) . "\" border=\"0\" alt=\"\" />"; |
| 868 | + $gift_image = "<img src=\"{$wgUploadPath}/awards/" . |
| 869 | + SystemGifts::getGiftImage( $item['namespace'], 'm' ) . |
| 870 | + "\" border=\"0\" alt=\"\" />"; |
799 | 871 | $item_html .= wfMsg( 'user-recent-system-gift' ) . " {$item_time} |
800 | 872 | <div class=\"user-home-item-gift\"> |
801 | | - <a href=\"" . $wgScriptPath . "/index.php?title=Special:ViewSystemGift&gift_id={$item["id"]}\" rel=\"nofollow\"> |
| 873 | + <a href=\"" . $wgScriptPath . "/index.php?title=Special:ViewSystemGift&gift_id={$item['id']}\" rel=\"nofollow\"> |
802 | 874 | {$gift_image} |
803 | | - {$item["pagetitle"]} |
| 875 | + {$item['pagetitle']} |
804 | 876 | </a> |
805 | 877 | </div>"; |
806 | 878 | break; |
— | — | @@ -810,12 +882,14 @@ |
811 | 883 | $item_html .= wfMsg( 'user-recent-activity-foe' ) . " <b>{$user_link_2}</b> {$item_time}"; |
812 | 884 | break; |
813 | 885 | case 'system_message': |
814 | | - $item_html .= "{$item["comment"]} {$item_time}"; |
| 886 | + $item_html .= "{$item['comment']} {$item_time}"; |
815 | 887 | break; |
816 | 888 | case 'user_message': |
817 | | - $item_html .= wfMsg( 'user-recent-activity-user-message' ) . " <b><a href=\"" . UserBoard::getUserBoardURL( $user_title_2->getText() ) . "\" rel=\"nofollow\">{$item["comment"]}</a></b> {$item_time} |
| 889 | + $item_html .= wfMsg( 'user-recent-activity-user-message' ) . |
| 890 | + " <b><a href=\"" . UserBoard::getUserBoardURL( $user_title_2->getText() ) . |
| 891 | + "\" rel=\"nofollow\">{$item['comment']}</a></b> {$item_time} |
818 | 892 | <div class=\"item\"> |
819 | | - \"{$item["namespace"]}\" |
| 893 | + \"{$item['namespace']}\" |
820 | 894 | </div>"; |
821 | 895 | break; |
822 | 896 | } |
— | — | @@ -930,48 +1004,56 @@ |
931 | 1005 | |
932 | 1006 | if ( $gifts ) { |
933 | 1007 | $output .= '<div class="user-section-heading"> |
934 | | - <div class="user-section-title"> |
935 | | - ' . wfMsg( 'user-gifts-title' ) . ' |
936 | | - </div> |
| 1008 | + <div class="user-section-title">' . |
| 1009 | + wfMsg( 'user-gifts-title' ) . |
| 1010 | + '</div> |
937 | 1011 | <div class="user-section-actions"> |
938 | 1012 | <div class="action-right">'; |
939 | | - if ( $gift_count > 4 ) { |
940 | | - $output .= '<a href="' . $gift_link->escapeFullURL( 'user=' . $user_safe ) . '" rel="nofollow">' . wfMsg( 'user-view-all' ) . '</a>'; |
941 | | - } |
942 | | - $output .= '</div> |
| 1013 | + if ( $gift_count > 4 ) { |
| 1014 | + $output .= '<a href="' . $gift_link->escapeFullURL( 'user=' . $user_safe ) . '" rel="nofollow">' . |
| 1015 | + wfMsg( 'user-view-all' ) . '</a>'; |
| 1016 | + } |
| 1017 | + $output .= '</div> |
943 | 1018 | <div class="action-left">'; |
944 | | - if ( $gift_count > 4 ) { |
945 | | - $output .= wfMsg( 'user-count-separator', '4', $gift_count ); |
946 | | - } else { |
947 | | - $output .= wfMsg( 'user-count-separator', $gift_count, $gift_count ); |
948 | | - } |
949 | | - $output .= '</div> |
| 1019 | + if ( $gift_count > 4 ) { |
| 1020 | + $output .= wfMsg( 'user-count-separator', '4', $gift_count ); |
| 1021 | + } else { |
| 1022 | + $output .= wfMsg( 'user-count-separator', $gift_count, $gift_count ); |
| 1023 | + } |
| 1024 | + $output .= '</div> |
950 | 1025 | <div class="cleared"></div> |
951 | 1026 | </div> |
952 | 1027 | </div> |
953 | 1028 | <div class="cleared"></div> |
954 | 1029 | <div class="user-gift-container">'; |
955 | 1030 | |
956 | | - $x = 1; |
| 1031 | + $x = 1; |
957 | 1032 | |
958 | | - foreach ( $gifts as $gift ) { |
959 | | - if ( $gift['status'] == 1 && $user_name == $wgUser->getName() ) { |
960 | | - $g->clearUserGiftStatus( $gift['id'] ); |
961 | | - $wgMemc->delete( $key ); |
962 | | - $g->decNewGiftCount( $wgUser->getID() ); |
963 | | - } |
| 1033 | + foreach ( $gifts as $gift ) { |
| 1034 | + if ( $gift['status'] == 1 && $user_name == $wgUser->getName() ) { |
| 1035 | + $g->clearUserGiftStatus( $gift['id'] ); |
| 1036 | + $wgMemc->delete( $key ); |
| 1037 | + $g->decNewGiftCount( $wgUser->getID() ); |
| 1038 | + } |
964 | 1039 | |
965 | | - $user = Title::makeTitle( NS_USER, $gift['user_name_from'] ); |
966 | | - $gift_image = '<img src="' . $wgUploadPath . '/awards/' . Gifts::getGiftImage( $gift['gift_id'], 'ml' ) . '" border="0" alt="" />'; |
967 | | - $gift_link = $user = SpecialPage::getTitleFor( 'ViewGift' ); |
968 | | - $output .= '<a href="' . $gift_link->escapeFullURL( 'gift_id=' . $gift['id'] ) . '" ' . ( ( $gift['status'] == 1 ) ? 'class="user-page-new"' : '' ) . " rel=\"nofollow\">{$gift_image}</a>"; |
969 | | - if ( $x == count( $gifts ) || $x != 1 && $x % $per_row == 0 ) { |
970 | | - $output .= '<div class="cleared"></div>'; |
971 | | - } |
972 | | - $x++; |
973 | | - |
| 1040 | + $user = Title::makeTitle( NS_USER, $gift['user_name_from'] ); |
| 1041 | + $gift_image = '<img src="' . $wgUploadPath . '/awards/' . |
| 1042 | + Gifts::getGiftImage( $gift['gift_id'], 'ml' ) . |
| 1043 | + '" border="0" alt="" />'; |
| 1044 | + $gift_link = $user = SpecialPage::getTitleFor( 'ViewGift' ); |
| 1045 | + $class = ''; |
| 1046 | + if ( $gift['status'] == 1 ) { |
| 1047 | + $class = 'class="user-page-new"'; |
974 | 1048 | } |
| 1049 | + $output .= '<a href="' . $gift_link->escapeFullURL( 'gift_id=' . $gift['id'] ) . '" ' . |
| 1050 | + $class . " rel=\"nofollow\">{$gift_image}</a>"; |
| 1051 | + if ( $x == count( $gifts ) || $x != 1 && $x % $per_row == 0 ) { |
| 1052 | + $output .= '<div class="cleared"></div>'; |
| 1053 | + } |
975 | 1054 | |
| 1055 | + $x++; |
| 1056 | + } |
| 1057 | + |
976 | 1058 | $output .= '</div>'; |
977 | 1059 | } |
978 | 1060 | |
— | — | @@ -1016,42 +1098,50 @@ |
1017 | 1099 | '</div> |
1018 | 1100 | <div class="user-section-actions"> |
1019 | 1101 | <div class="action-right">'; |
1020 | | - if ( $system_gift_count > 4 ) { |
1021 | | - $output .= '<a href="' . $system_gift_link->escapeFullURL( 'user=' . $user_name ) . '" rel="nofollow">' . wfMsg( 'user-view-all' ) . '</a>'; |
1022 | | - } |
1023 | | - $output .= '</div> |
| 1102 | + if ( $system_gift_count > 4 ) { |
| 1103 | + $output .= '<a href="' . $system_gift_link->escapeFullURL( 'user=' . $user_name ) . '" rel="nofollow">' . |
| 1104 | + wfMsg( 'user-view-all' ) . '</a>'; |
| 1105 | + } |
| 1106 | + $output .= '</div> |
1024 | 1107 | <div class="action-left">'; |
1025 | | - if ( $system_gift_count > 4 ) { |
1026 | | - $output .= wfMsg( 'user-count-separator', '4', $system_gift_count ); |
1027 | | - } else { |
1028 | | - $output .= wfMsg( 'user-count-separator', $system_gift_count, $system_gift_count ); |
1029 | | - } |
1030 | | - $output .= '</div> |
| 1108 | + if ( $system_gift_count > 4 ) { |
| 1109 | + $output .= wfMsg( 'user-count-separator', '4', $system_gift_count ); |
| 1110 | + } else { |
| 1111 | + $output .= wfMsg( 'user-count-separator', $system_gift_count, $system_gift_count ); |
| 1112 | + } |
| 1113 | + $output .= '</div> |
1031 | 1114 | <div class="cleared"></div> |
1032 | 1115 | </div> |
1033 | 1116 | </div> |
1034 | 1117 | <div class="cleared"></div> |
1035 | 1118 | <div class="user-gift-container">'; |
1036 | 1119 | |
1037 | | - foreach ( $system_gifts as $gift ) { |
1038 | | - if ( $gift['status'] == 1 && $user_name == $wgUser->getName() ) { |
1039 | | - $sg->clearUserGiftStatus( $gift['id'] ); |
1040 | | - $wgMemc->delete( $sg_key ); |
1041 | | - $sg->decNewSystemGiftCount( $wgUser->getID() ); |
1042 | | - } |
| 1120 | + foreach ( $system_gifts as $gift ) { |
| 1121 | + if ( $gift['status'] == 1 && $user_name == $wgUser->getName() ) { |
| 1122 | + $sg->clearUserGiftStatus( $gift['id'] ); |
| 1123 | + $wgMemc->delete( $sg_key ); |
| 1124 | + $sg->decNewSystemGiftCount( $wgUser->getID() ); |
| 1125 | + } |
1043 | 1126 | |
1044 | | - $gift_image = '<img src="' . $wgUploadPath . '/awards/' . SystemGifts::getGiftImage( $gift['gift_id'], 'ml' ) . '" border="0" alt="" />'; |
1045 | | - $gift_link = $user = SpecialPage::getTitleFor( 'ViewSystemGift' ); |
| 1127 | + $gift_image = '<img src="' . $wgUploadPath . '/awards/' . |
| 1128 | + SystemGifts::getGiftImage( $gift['gift_id'], 'ml' ) . |
| 1129 | + '" border="0" alt="" />'; |
| 1130 | + $gift_link = $user = SpecialPage::getTitleFor( 'ViewSystemGift' ); |
1046 | 1131 | |
1047 | | - $output .= '<a href="' . $gift_link->escapeFullURL( 'gift_id=' . $gift['id'] ) . '" ' . ( ( $gift['status'] == 1 ) ? 'class="user-page-new"' : '' ) . " rel=\"nofollow\"> |
1048 | | - {$gift_image} |
1049 | | - </a>"; |
| 1132 | + $class = ''; |
| 1133 | + if ( $gift['status'] == 1 ) { |
| 1134 | + $class = 'class="user-page-new"'; |
| 1135 | + } |
| 1136 | + $output .= '<a href="' . $gift_link->escapeFullURL( 'gift_id=' . $gift['id'] ) . |
| 1137 | + '" ' . $class . " rel=\"nofollow\"> |
| 1138 | + {$gift_image} |
| 1139 | + </a>"; |
1050 | 1140 | |
1051 | | - if ( $x == count( $system_gifts ) || $x != 1 && $x % $per_row == 0 ) { |
1052 | | - $output .= '<div class="cleared"></div>'; |
1053 | | - } |
1054 | | - $x++; |
| 1141 | + if ( $x == count( $system_gifts ) || $x != 1 && $x % $per_row == 0 ) { |
| 1142 | + $output .= '<div class="cleared"></div>'; |
1055 | 1143 | } |
| 1144 | + $x++; |
| 1145 | + } |
1056 | 1146 | |
1057 | 1147 | $output .= '</div>'; |
1058 | 1148 | } |
— | — | @@ -1059,13 +1149,22 @@ |
1060 | 1150 | return $output; |
1061 | 1151 | } |
1062 | 1152 | |
| 1153 | + /** |
| 1154 | + * Get the user board for a given user. |
| 1155 | + * |
| 1156 | + * @param $user_id Integer: user's ID number |
| 1157 | + * @param $user_name String: user name |
| 1158 | + */ |
1063 | 1159 | function getUserBoard( $user_id, $user_name ) { |
1064 | 1160 | global $wgUser, $wgOut, $wgUserProfileDisplay, $wgUserProfileScripts; |
1065 | 1161 | |
| 1162 | + // Anonymous users cannot have user boards |
1066 | 1163 | if ( $user_id == 0 ) { |
1067 | 1164 | return ''; |
1068 | 1165 | } |
1069 | 1166 | |
| 1167 | + // Don't display anything if user board on social profiles isn't |
| 1168 | + // enabled in site configuration |
1070 | 1169 | if ( $wgUserProfileDisplay['board'] == false ) { |
1071 | 1170 | return ''; |
1072 | 1171 | } |
— | — | @@ -1077,7 +1176,6 @@ |
1078 | 1177 | $rel = new UserRelationship( $user_name ); |
1079 | 1178 | $friends = $rel->getRelationshipList( 1, 4 ); |
1080 | 1179 | |
1081 | | - $user_safe = str_replace( '&', '%26', $user_name ); |
1082 | 1180 | $stats = new UserStats( $user_id, $user_name ); |
1083 | 1181 | $stats_data = $stats->getUserStats(); |
1084 | 1182 | $total = $stats_data['user_board']; |
— | — | @@ -1095,25 +1193,27 @@ |
1096 | 1194 | '</div> |
1097 | 1195 | <div class="user-section-actions"> |
1098 | 1196 | <div class="action-right">'; |
1099 | | - if ( $wgUser->getName() == $user_name ) { |
1100 | | - if ( $friends ) { |
1101 | | - $output .= '<a href="' . UserBoard::getBoardBlastURL() . '">' . wfMsg( 'user-send-board-blast' ) . '</a>'; |
1102 | | - } |
1103 | | - if ( $total > 10 ) { |
1104 | | - $output .= wfMsgExt( 'pipe-separator', 'escapenoentities' ); |
1105 | | - } |
1106 | | - } |
1107 | | - if ( $total > 10 ) { |
1108 | | - $output .= '<a href="' . UserBoard::getUserBoardURL( $user_name ) . '">' . wfMsg( 'user-view-all' ) . '</a>'; |
1109 | | - } |
1110 | | - $output .= '</div> |
| 1197 | + if ( $wgUser->getName() == $user_name ) { |
| 1198 | + if ( $friends ) { |
| 1199 | + $output .= '<a href="' . UserBoard::getBoardBlastURL() . '">' . |
| 1200 | + wfMsg( 'user-send-board-blast' ) . '</a>'; |
| 1201 | + } |
| 1202 | + if ( $total > 10 ) { |
| 1203 | + $output .= wfMsgExt( 'pipe-separator', 'escapenoentities' ); |
| 1204 | + } |
| 1205 | + } |
| 1206 | + if ( $total > 10 ) { |
| 1207 | + $output .= '<a href="' . UserBoard::getUserBoardURL( $user_name ) . '">' . |
| 1208 | + wfMsg( 'user-view-all' ) . '</a>'; |
| 1209 | + } |
| 1210 | + $output .= '</div> |
1111 | 1211 | <div class="action-left">'; |
1112 | | - if ( $total > 10 ) { |
1113 | | - $output .= wfMsg( 'user-count-separator', '10', $total ); |
1114 | | - } elseif ( $total > 0 ) { |
1115 | | - $output .= wfMsg( 'user-count-separator', $total, $total ); |
1116 | | - } |
1117 | | - $output .= '</div> |
| 1212 | + if ( $total > 10 ) { |
| 1213 | + $output .= wfMsg( 'user-count-separator', '10', $total ); |
| 1214 | + } elseif ( $total > 0 ) { |
| 1215 | + $output .= wfMsg( 'user-count-separator', $total, $total ); |
| 1216 | + } |
| 1217 | + $output .= '</div> |
1118 | 1218 | <div class="cleared"></div> |
1119 | 1219 | </div> |
1120 | 1220 | </div> |
— | — | @@ -1140,6 +1240,7 @@ |
1141 | 1241 | '</div>'; |
1142 | 1242 | } |
1143 | 1243 | } |
| 1244 | + |
1144 | 1245 | $output .= '<div id="user-page-board">'; |
1145 | 1246 | $b = new UserBoard(); |
1146 | 1247 | $output .= $b->displayMessages( $user_id, 0, 10 ); |
— | — | @@ -1150,8 +1251,12 @@ |
1151 | 1252 | } |
1152 | 1253 | |
1153 | 1254 | /** |
1154 | | - * Gets the user's fanboxes if $wgEnableUserBoxes = true; and $wgUserProfileDisplay['userboxes'] = true; |
1155 | | - * and FanBoxes extension is installed. |
| 1255 | + * Gets the user's fanboxes if $wgEnableUserBoxes = true; and |
| 1256 | + * $wgUserProfileDisplay['userboxes'] = true; and the FanBoxes extension is |
| 1257 | + * installed. |
| 1258 | + * |
| 1259 | + * @param $user_name String: user name |
| 1260 | + * @return String: HTML |
1156 | 1261 | */ |
1157 | 1262 | function getFanBoxes( $user_name ) { |
1158 | 1263 | global $wgOut, $wgUser, $wgTitle, $wgMemc, $wgUserProfileDisplay, $wgFanBoxScripts, $wgEnableUserBoxes; |
— | — | @@ -1168,17 +1273,19 @@ |
1169 | 1274 | $user_safe = ( $user_name ); |
1170 | 1275 | |
1171 | 1276 | // Try cache |
1172 | | - // $key = wfMemcKey( 'user', 'profile', 'fanboxes', "{$f->user_id}" ); |
1173 | | - // $data = $wgMemc->get( $key ); |
| 1277 | + /* |
| 1278 | + $key = wfMemcKey( 'user', 'profile', 'fanboxes', "{$f->user_id}" ); |
| 1279 | + $data = $wgMemc->get( $key ); |
1174 | 1280 | |
1175 | | - // if( !$data ){ |
1176 | | - // wfDebug( "Got profile fanboxes for user {$user_name} from db\n" ); |
1177 | | - // $fanboxes = $f->getUserFanboxes( 0, 10 ); |
1178 | | - // $wgMemc->set( $key, $fanboxes ); |
1179 | | - // } else { |
1180 | | - // wfDebug( "Got profile fanboxes for user {$user_name} from cache\n" ); |
1181 | | - // $fanboxes = $data; |
1182 | | - // } |
| 1281 | + if( !$data ) { |
| 1282 | + wfDebug( "Got profile fanboxes for user {$user_name} from DB\n" ); |
| 1283 | + $fanboxes = $f->getUserFanboxes( 0, 10 ); |
| 1284 | + $wgMemc->set( $key, $fanboxes ); |
| 1285 | + } else { |
| 1286 | + wfDebug( "Got profile fanboxes for user {$user_name} from cache\n" ); |
| 1287 | + $fanboxes = $data; |
| 1288 | + } |
| 1289 | + */ |
1183 | 1290 | |
1184 | 1291 | $fanboxes = $f->getUserFanboxes( 0, 10 ); |
1185 | 1292 | |
— | — | @@ -1193,17 +1300,20 @@ |
1194 | 1301 | '</div> |
1195 | 1302 | <div class="user-section-actions"> |
1196 | 1303 | <div class="action-right">'; |
1197 | | - if ( $fanbox_count > 10 ) { |
1198 | | - $output .= '<a href="' . $fanbox_link->escapeFullURL( 'user=' . $user_safe ) . '" rel="nofollow">' . wfMsg( 'user-view-all' ) . '</a>'; |
1199 | | - } |
1200 | | - $output .= '</div> |
| 1304 | + // If there are more than ten fanboxes, display a "View all" link |
| 1305 | + // instead of listing them all on the profile page |
| 1306 | + if ( $fanbox_count > 10 ) { |
| 1307 | + $output .= '<a href="' . $fanbox_link->escapeFullURL( 'user=' . $user_safe ) . '" rel="nofollow">' . |
| 1308 | + wfMsg( 'user-view-all' ) . '</a>'; |
| 1309 | + } |
| 1310 | + $output .= '</div> |
1201 | 1311 | <div class="action-left">'; |
1202 | | - if ( $fanbox_count > 10 ) { |
1203 | | - $output .= wfMsg( 'user-count-separator', '10', $fanbox_count ); |
1204 | | - } else { |
1205 | | - $output .= wfMsg( 'user-count-separator', $fanbox_count, $fanbox_count ); |
1206 | | - } |
1207 | | - $output .= '</div> |
| 1312 | + if ( $fanbox_count > 10 ) { |
| 1313 | + $output .= wfMsg( 'user-count-separator', '10', $fanbox_count ); |
| 1314 | + } else { |
| 1315 | + $output .= wfMsg( 'user-count-separator', $fanbox_count, $fanbox_count ); |
| 1316 | + } |
| 1317 | + $output .= '</div> |
1208 | 1318 | <div class="cleared"></div> |
1209 | 1319 | |
1210 | 1320 | </div> |
— | — | @@ -1212,113 +1322,115 @@ |
1213 | 1323 | |
1214 | 1324 | <div class="user-fanbox-container clearfix">'; |
1215 | 1325 | |
1216 | | - $x = 1; |
1217 | | - $tagParser = new Parser(); |
1218 | | - foreach ( $fanboxes as $fanbox ) { |
| 1326 | + $x = 1; |
| 1327 | + $tagParser = new Parser(); |
| 1328 | + foreach ( $fanboxes as $fanbox ) { |
| 1329 | + $check_user_fanbox = $f->checkIfUserHasFanbox( $fanbox['fantag_id'] ); |
1219 | 1330 | |
1220 | | - $check_user_fanbox = $f->checkIfUserHasFanbox( $fanbox['fantag_id'] ); |
| 1331 | + if ( $fanbox['fantag_image_name'] ) { |
| 1332 | + $fantag_image_width = 45; |
| 1333 | + $fantag_image_height = 53; |
| 1334 | + $fantag_image = wfFindFile( $fanbox['fantag_image_name'] ); |
| 1335 | + $fantag_image_url = $fantag_image->createThumb( $fantag_image_width, $fantag_image_height ); |
| 1336 | + $fantag_image_tag = '<img alt="" src="' . $fantag_image_url . '" />'; |
| 1337 | + } |
1221 | 1338 | |
1222 | | - if ( $fanbox['fantag_image_name'] ) { |
1223 | | - $fantag_image_width = 45; |
1224 | | - $fantag_image_height = 53; |
1225 | | - $fantag_image = wfFindFile( $fanbox['fantag_image_name'] ); |
1226 | | - $fantag_image_url = $fantag_image->createThumb( $fantag_image_width, $fantag_image_height ); |
1227 | | - $fantag_image_tag = '<img alt="" src="' . $fantag_image_url . '" />'; |
1228 | | - } |
| 1339 | + if ( $fanbox['fantag_left_text'] == '' ) { |
| 1340 | + $fantag_leftside = $fantag_image_tag; |
| 1341 | + } else { |
| 1342 | + $fantag_leftside = $fanbox['fantag_left_text']; |
| 1343 | + $fantag_leftside = $tagParser->parse( $fantag_leftside, $wgTitle, $wgOut->parserOptions(), false ); |
| 1344 | + $fantag_leftside = $fantag_leftside->getText(); |
| 1345 | + } |
1229 | 1346 | |
1230 | | - if ( $fanbox['fantag_left_text'] == '' ) { |
1231 | | - $fantag_leftside = $fantag_image_tag; |
1232 | | - } else { |
1233 | | - $fantag_leftside = $fanbox['fantag_left_text']; |
1234 | | - $fantag_leftside = $tagParser->parse( $fantag_leftside, $wgTitle, $wgOut->parserOptions(), false ); |
1235 | | - $fantag_leftside = $fantag_leftside->getText(); |
1236 | | - } |
| 1347 | + $leftfontsize = '10px'; |
| 1348 | + if ( $fanbox['fantag_left_textsize'] == 'mediumfont' ) { |
| 1349 | + $leftfontsize = '11px'; |
| 1350 | + } |
1237 | 1351 | |
1238 | | - $leftfontsize = '10px'; |
1239 | | - if ( $fanbox['fantag_left_textsize'] == 'mediumfont' ) { |
1240 | | - $leftfontsize = '11px'; |
1241 | | - } |
| 1352 | + if ( $fanbox['fantag_left_textsize'] == 'bigfont' ) { |
| 1353 | + $leftfontsize = '15px'; |
| 1354 | + } |
1242 | 1355 | |
1243 | | - if ( $fanbox['fantag_left_textsize'] == 'bigfont' ) { |
1244 | | - $leftfontsize = '15px'; |
1245 | | - } |
| 1356 | + if ( $fanbox['fantag_right_textsize'] == 'smallfont' ) { |
| 1357 | + $rightfontsize = '10px'; |
| 1358 | + } |
1246 | 1359 | |
1247 | | - if ( $fanbox['fantag_right_textsize'] == 'smallfont' ) { |
1248 | | - $rightfontsize = '10px'; |
1249 | | - } |
| 1360 | + if ( $fanbox['fantag_right_textsize'] == 'mediumfont' ) { |
| 1361 | + $rightfontsize = '11px'; |
| 1362 | + } |
1250 | 1363 | |
1251 | | - if ( $fanbox['fantag_right_textsize'] == 'mediumfont' ) { |
1252 | | - $rightfontsize = '11px'; |
1253 | | - } |
| 1364 | + // Get permalink |
| 1365 | + $fantag_title = Title::makeTitle( NS_FANTAG, $fanbox['fantag_title'] ); |
| 1366 | + $right_text = $fanbox['fantag_right_text']; |
| 1367 | + $right_text = $tagParser->parse( $right_text, $wgTitle, $wgOut->parserOptions(), false ); |
| 1368 | + $right_text = $right_text->getText(); |
1254 | 1369 | |
1255 | | - // Get permalink |
1256 | | - $fantag_title = Title::makeTitle( NS_FANTAG, $fanbox['fantag_title'] ); |
1257 | | - $right_text = $fanbox['fantag_right_text']; |
1258 | | - $right_text = $tagParser->parse( $right_text, $wgTitle, $wgOut->parserOptions(), false ); |
1259 | | - $right_text = $right_text->getText(); |
| 1370 | + // Output fanboxes |
| 1371 | + $output .= "<div class=\"fanbox-item\"> |
| 1372 | + <div class=\"individual-fanbox\" id=\"individualFanbox" . $fanbox['fantag_id'] . "\"> |
| 1373 | + <div class=\"show-message-container-profile\" id=\"show-message-container" . $fanbox['fantag_id'] . "\"> |
| 1374 | + <a class=\"perma\" style=\"font-size:8px; color:" . $fanbox['fantag_right_textcolor'] . "\" href=\"" . $fantag_title->escapeFullURL() . "\" title=\"{$fanbox['fantag_title']}\">" . wfMsg( 'fanbox-perma' ) . "</a> |
| 1375 | + <table class=\"fanBoxTableProfile\" onclick=\"javascript:openFanBoxPopup('fanboxPopUpBox{$fanbox['fantag_id']}', 'individualFanbox{$fanbox['fantag_id']}')\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"> |
| 1376 | + <tr> |
| 1377 | + <td id=\"fanBoxLeftSideOutputProfile\" style=\"color:" . $fanbox['fantag_left_textcolor'] . "; font-size:$leftfontsize\" bgcolor=\"" . $fanbox['fantag_left_bgcolor'] . "\">" . $fantag_leftside . "</td> |
| 1378 | + <td id=\"fanBoxRightSideOutputProfile\" style=\"color:" . $fanbox['fantag_right_textcolor'] . "; font-size:$rightfontsize\" bgcolor=\"" . $fanbox['fantag_right_bgcolor'] . "\">" . $right_text . "</td> |
| 1379 | + </tr> |
| 1380 | + </table> |
| 1381 | + </div> |
| 1382 | + </div>"; |
1260 | 1383 | |
1261 | | - // Output fanboxes |
1262 | | - $output .= "<div class=\"fanbox-item\"> |
1263 | | - <div class=\"individual-fanbox\" id=\"individualFanbox" . $fanbox['fantag_id'] . "\"> |
1264 | | - <div class=\"show-message-container-profile\" id=\"show-message-container" . $fanbox['fantag_id'] . "\"> |
1265 | | - <a class=\"perma\" style=\"font-size:8px; color:" . $fanbox['fantag_right_textcolor'] . "\" href=\"" . $fantag_title->escapeFullURL() . "\" title=\"{$fanbox["fantag_title"]}\">" . wfMsg( 'fanbox-perma' ) . "</a> |
1266 | | - <table class=\"fanBoxTableProfile\" onclick=\"javascript:openFanBoxPopup('fanboxPopUpBox{$fanbox["fantag_id"]}', 'individualFanbox{$fanbox["fantag_id"]}')\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"> |
1267 | | - <tr> |
1268 | | - <td id=\"fanBoxLeftSideOutputProfile\" style=\"color:" . $fanbox['fantag_left_textcolor'] . "; font-size:$leftfontsize\" bgcolor=\"" . $fanbox['fantag_left_bgcolor'] . "\">" . $fantag_leftside . "</td> |
1269 | | - <td id=\"fanBoxRightSideOutputProfile\" style=\"color:" . $fanbox['fantag_right_textcolor'] . "; font-size:$rightfontsize\" bgcolor=\"" . $fanbox['fantag_right_bgcolor'] . "\">" . $right_text . "</td> |
1270 | | - </tr> |
1271 | | - </table> |
1272 | | - </div> |
| 1384 | + if ( $wgUser->isLoggedIn() ) { |
| 1385 | + if ( $check_user_fanbox == 0 ) { |
| 1386 | + $output .= "<div class=\"fanbox-pop-up-box-profile\" id=\"fanboxPopUpBox" . $fanbox['fantag_id'] . "\"> |
| 1387 | + <table cellpadding=\"0\" cellspacing=\"0\" align=\"center\"> |
| 1388 | + <tr> |
| 1389 | + <td style=\"font-size:10px\">" . wfMsg( 'fanbox-add-fanbox' ) . "</td> |
| 1390 | + </tr> |
| 1391 | + <tr> |
| 1392 | + <td align=\"center\"> |
| 1393 | + <input type=\"button\" value=\"" . wfMsg( 'fanbox-add' ) . "\" size=\"10\" onclick=\"closeFanboxAdd('fanboxPopUpBox{$fanbox['fantag_id']}', 'individualFanbox{$fanbox['fantag_id']}'); showAddRemoveMessageUserPage(1, {$fanbox['fantag_id']}, 'show-addremove-message-half')\" /> |
| 1394 | + <input type=\"button\" value=\"" . wfMsg( 'cancel' ) . "\" size=\"10\" onclick=\"closeFanboxAdd('fanboxPopUpBox{$fanbox['fantag_id']}', 'individualFanbox{$fanbox['fantag_id']}')\" /> |
| 1395 | + </td> |
| 1396 | + </tr> |
| 1397 | + </table> |
1273 | 1398 | </div>"; |
1274 | | - |
1275 | | - if ( $wgUser->isLoggedIn() ) { |
1276 | | - if ( $check_user_fanbox == 0 ) { |
1277 | | - $output .= "<div class=\"fanbox-pop-up-box-profile\" id=\"fanboxPopUpBox" . $fanbox['fantag_id'] . "\"> |
1278 | | - <table cellpadding=\"0\" cellspacing=\"0\" align=\"center\"> |
1279 | | - <tr> |
1280 | | - <td style=\"font-size:10px\">" . wfMsg( 'fanbox-add-fanbox' ) . "</td> |
1281 | | - </tr> |
1282 | | - <tr> |
1283 | | - <td align=\"center\"> |
1284 | | - <input type=\"button\" value=\"" . wfMsg( 'fanbox-add' ) . "\" size=\"10\" onclick=\"closeFanboxAdd('fanboxPopUpBox{$fanbox["fantag_id"]}', 'individualFanbox{$fanbox["fantag_id"]}'); showAddRemoveMessageUserPage(1, {$fanbox["fantag_id"]}, 'show-addremove-message-half')\" /> |
1285 | | - <input type=\"button\" value=\"" . wfMsg( 'cancel' ) . "\" size=\"10\" onclick=\"closeFanboxAdd('fanboxPopUpBox{$fanbox["fantag_id"]}', 'individualFanbox{$fanbox["fantag_id"]}')\" /> |
1286 | | - </td> |
1287 | | - </tr> |
1288 | | - </table> |
1289 | | - </div>"; |
1290 | | - } else { |
1291 | | - $output .= "<div class=\"fanbox-pop-up-box-profile\" id=\"fanboxPopUpBox" . $fanbox['fantag_id'] . "\"> |
1292 | | - <table cellpadding=\"0\" cellspacing=\"0\" align=\"center\"> |
1293 | | - <tr> |
1294 | | - <td style=\"font-size:10px\">" . wfMsg( 'fanbox-remove-fanbox' ) . "</td> |
1295 | | - </tr> |
1296 | | - <tr> |
1297 | | - <td align=\"center\"> |
1298 | | - <input type=\"button\" value=\"" . wfMsg( 'fanbox-remove' ) . "\" size=\"10\" onclick=\"closeFanboxAdd('fanboxPopUpBox{$fanbox["fantag_id"]}', 'individualFanbox{$fanbox["fantag_id"]}'); showAddRemoveMessageUserPage(2, {$fanbox["fantag_id"]}, 'show-addremove-message-half')\" /> |
1299 | | - <input type=\"button\" value=\"" . wfMsg( 'cancel' ) . "\" size=\"10\" onclick=\"closeFanboxAdd('fanboxPopUpBox{$fanbox["fantag_id"]}', 'individualFanbox{$fanbox["fantag_id"]}')\" /> |
1300 | | - </td> |
1301 | | - </tr> |
1302 | | - </table> |
1303 | | - </div>"; |
1304 | | - } |
1305 | | - } |
1306 | | - |
1307 | | - if ( $wgUser->getID() == 0 ) { |
1308 | | - $login = SpecialPage::getTitleFor( 'Userlogin' ); |
| 1399 | + } else { |
1309 | 1400 | $output .= "<div class=\"fanbox-pop-up-box-profile\" id=\"fanboxPopUpBox" . $fanbox['fantag_id'] . "\"> |
1310 | 1401 | <table cellpadding=\"0\" cellspacing=\"0\" align=\"center\"> |
1311 | 1402 | <tr> |
1312 | | - <td style=\"font-size:10px\">" . wfMsg( 'fanbox-add-fanbox-login' ) . "<a href=\"{$login->getFullURL()}\">" . wfMsg( 'fanbox-login' ) . "</a></td> |
| 1403 | + <td style=\"font-size:10px\">" . wfMsg( 'fanbox-remove-fanbox' ) . "</td> |
1313 | 1404 | </tr> |
1314 | 1405 | <tr> |
1315 | 1406 | <td align=\"center\"> |
1316 | | - <input type=\"button\" value=\"" . wfMsg( 'cancel' ) . "\" size=\"10\" onclick=\"closeFanboxAdd('fanboxPopUpBox{$fanbox["fantag_id"]}', 'individualFanbox{$fanbox["fantag_id"]}')\" /> |
| 1407 | + <input type=\"button\" value=\"" . wfMsg( 'fanbox-remove' ) . "\" size=\"10\" onclick=\"closeFanboxAdd('fanboxPopUpBox{$fanbox['fantag_id']}', 'individualFanbox{$fanbox['fantag_id']}'); showAddRemoveMessageUserPage(2, {$fanbox['fantag_id']}, 'show-addremove-message-half')\" /> |
| 1408 | + <input type=\"button\" value=\"" . wfMsg( 'cancel' ) . "\" size=\"10\" onclick=\"closeFanboxAdd('fanboxPopUpBox{$fanbox['fantag_id']}', 'individualFanbox{$fanbox['fantag_id']}')\" /> |
1317 | 1409 | </td> |
1318 | 1410 | </tr> |
1319 | 1411 | </table> |
1320 | 1412 | </div>"; |
1321 | 1413 | } |
| 1414 | + } |
1322 | 1415 | |
| 1416 | + if ( $wgUser->getID() == 0 ) { |
| 1417 | + $login = SpecialPage::getTitleFor( 'Userlogin' ); |
| 1418 | + $output .= "<div class=\"fanbox-pop-up-box-profile\" id=\"fanboxPopUpBox" . $fanbox['fantag_id'] . "\"> |
| 1419 | + <table cellpadding=\"0\" cellspacing=\"0\" align=\"center\"> |
| 1420 | + <tr> |
| 1421 | + <td style=\"font-size:10px\">" . |
| 1422 | + wfMsg( 'fanbox-add-fanbox-login' ) . |
| 1423 | + "<a href=\"{$login->getFullURL()}\">" . |
| 1424 | + wfMsg( 'fanbox-login' ) . "</a></td> |
| 1425 | + </tr> |
| 1426 | + <tr> |
| 1427 | + <td align=\"center\"> |
| 1428 | + <input type=\"button\" value=\"" . wfMsg( 'cancel' ) . "\" size=\"10\" onclick=\"closeFanboxAdd('fanboxPopUpBox{$fanbox['fantag_id']}', 'individualFanbox{$fanbox['fantag_id']}')\" /> |
| 1429 | + </td> |
| 1430 | + </tr> |
| 1431 | + </table> |
| 1432 | + </div>"; |
| 1433 | + } |
| 1434 | + |
1323 | 1435 | $output .= '</div>'; |
1324 | 1436 | |
1325 | 1437 | $x++; |
— | — | @@ -1328,4 +1440,5 @@ |
1329 | 1441 | |
1330 | 1442 | return $output; |
1331 | 1443 | } |
| 1444 | + |
1332 | 1445 | } |