Index: trunk/extensions/SocialProfile/SystemGifts/SpecialViewSystemGift.php |
— | — | @@ -26,25 +26,18 @@ |
27 | 27 | $wgOut->addExtensionStyle( $wgSystemGiftsScripts . '/SystemGift.css' ); |
28 | 28 | |
29 | 29 | $output = ''; // Prevent E_NOTICE |
30 | | - $user_name = ''; // Prevent E_NOTICE |
31 | 30 | |
32 | 31 | // If gift ID wasn't passed in the URL parameters or if it's not |
33 | 32 | // numeric, display an error message |
34 | | - $gift_id = $wgRequest->getVal( 'gift_id' ); |
35 | | - if ( !$gift_id || !is_numeric( $gift_id ) ) { |
| 33 | + $giftId = $wgRequest->getInt( 'gift_id' ); |
| 34 | + if ( !$giftId || !is_numeric( $giftId ) ) { |
36 | 35 | $wgOut->setPageTitle( wfMsg( 'ga-error-title' ) ); |
37 | 36 | $wgOut->addHTML( wfMsg( 'ga-error-message-invalid-link' ) ); |
38 | 37 | return false; |
39 | 38 | } |
40 | 39 | |
41 | | - // We assume the current user by default |
42 | | - if ( !$user_name ) { |
43 | | - $user_name = $wgUser->getName(); |
44 | | - } |
| 40 | + $gift = UserSystemGifts::getUserGift( $giftId ); |
45 | 41 | |
46 | | - $gift = UserSystemGifts::getUserGift( $gift_id ); |
47 | | - $id = User::idFromName( $user_name ); |
48 | | - |
49 | 42 | if ( $gift ) { |
50 | 43 | if ( $gift['status'] == 1 ) { |
51 | 44 | if ( $gift['user_name'] == $wgUser->getName() ) { |
— | — | @@ -74,22 +67,22 @@ |
75 | 68 | ) |
76 | 69 | ); |
77 | 70 | |
78 | | - $output .= $wgOut->setPageTitle( wfMsg( 'ga-gift-title', $gift['user_name'], $gift['name'] ) ); |
| 71 | + $wgOut->setPageTitle( wfMsg( 'ga-gift-title', $gift['user_name'], $gift['name'] ) ); |
79 | 72 | |
80 | 73 | $profileURL = Title::makeTitle( NS_USER, $gift['user_name'] )->escapeFullURL(); |
81 | | - $output .= '<div class="back-links">' |
82 | | - . wfMsg( 'ga-back-link', $profileURL, $gift['user_name'] ) . |
| 74 | + $output .= '<div class="back-links">' . |
| 75 | + wfMsg( 'ga-back-link', $profileURL, $gift['user_name'] ) . |
83 | 76 | '</div>'; |
84 | 77 | |
85 | 78 | $message = $wgOut->parse( trim( $gift['description'] ), false ); |
86 | 79 | $output .= '<div class="ga-description-container">'; |
87 | 80 | |
88 | | - $gift_image = "<img src=\"{$wgUploadPath}/awards/" . |
| 81 | + $giftImage = "<img src=\"{$wgUploadPath}/awards/" . |
89 | 82 | SystemGifts::getGiftImage( $gift['gift_id'], 'l' ) . |
90 | 83 | '" border="0" alt=""/>'; |
91 | 84 | |
92 | 85 | $output .= "<div class=\"ga-description\"> |
93 | | - {$gift_image} |
| 86 | + {$giftImage} |
94 | 87 | <div class=\"ga-name\">{$gift['name']}</div> |
95 | 88 | <div class=\"ga-timestamp\">({$gift['timestamp']})</div> |
96 | 89 | <div class=\"ga-description-message\">\"{$message}\"</div>"; |
— | — | @@ -97,19 +90,23 @@ |
98 | 91 | </div>'; |
99 | 92 | |
100 | 93 | $output .= '<div class="ga-recent"> |
101 | | - <div class="ga-recent-title">' |
102 | | - . wfMsg( 'ga-recent-recipients-award' ) . |
| 94 | + <div class="ga-recent-title">' . |
| 95 | + wfMsg( 'ga-recent-recipients-award' ) . |
103 | 96 | '</div> |
104 | | - <div class="ga-gift-count">' |
105 | | - . wfMsgExt( 'ga-gift-given-count', 'parsemag', $gift['gift_count'] ) . |
| 97 | + <div class="ga-gift-count">' . |
| 98 | + wfMsgExt( |
| 99 | + 'ga-gift-given-count', |
| 100 | + 'parsemag', |
| 101 | + $gift['gift_count'] |
| 102 | + ) . |
106 | 103 | '</div>'; |
107 | 104 | |
108 | 105 | foreach ( $res as $row ) { |
109 | | - $user_to_id = $row->sg_user_id; |
110 | | - $avatar = new wAvatar( $user_to_id, 'ml' ); |
111 | | - $user_name_link = Title::makeTitle( NS_USER, $row->sg_user_name ); |
| 106 | + $userToId = $row->sg_user_id; |
| 107 | + $avatar = new wAvatar( $userToId, 'ml' ); |
| 108 | + $userNameLink = Title::makeTitle( NS_USER, $row->sg_user_name ); |
112 | 109 | |
113 | | - $output .= '<a href="' . $user_name_link->escapeFullURL() . "\"> |
| 110 | + $output .= '<a href="' . $userNameLink->escapeFullURL() . "\"> |
114 | 111 | {$avatar->getAvatarURL()} |
115 | 112 | </a>"; |
116 | 113 | } |
— | — | @@ -119,7 +116,6 @@ |
120 | 117 | </div>'; |
121 | 118 | |
122 | 119 | $wgOut->addHTML( $output ); |
123 | | - |
124 | 120 | } else { |
125 | 121 | $wgOut->setPageTitle( wfMsg( 'ga-error-title' ) ); |
126 | 122 | $wgOut->addHTML( wfMsg( 'ga-error-message-invalid-link' ) ); |
Index: trunk/extensions/SocialProfile/SystemGifts/SpecialViewSystemGifts.php |
— | — | @@ -21,7 +21,7 @@ |
22 | 22 | * @param $par Mixed: parameter passed to the page or null |
23 | 23 | */ |
24 | 24 | public function execute( $par ) { |
25 | | - global $wgUser, $wgOut, $wgRequest, $wgMemc, $wgUploadPath, $wgSystemGiftsScripts; |
| 25 | + global $wgUser, $wgOut, $wgRequest, $wgUploadPath, $wgSystemGiftsScripts; |
26 | 26 | |
27 | 27 | $wgOut->addExtensionStyle( $wgSystemGiftsScripts . '/SystemGift.css' ); |
28 | 28 | |
— | — | @@ -41,14 +41,12 @@ |
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
45 | | - * If no user is set in the URL, we assume its the current user |
| 45 | + * If no user is set in the URL, we assume it's the current user |
46 | 46 | */ |
47 | 47 | if ( !$user_name ) { |
48 | 48 | $user_name = $wgUser->getName(); |
49 | 49 | } |
50 | 50 | $user_id = User::idFromName( $user_name ); |
51 | | - $user = Title::makeTitle( NS_USER, $user_name ); |
52 | | - $user_safe = urlencode( $user_name ); |
53 | 51 | |
54 | 52 | /** |
55 | 53 | * Error message for username that does not exist (from URL) |
— | — | @@ -76,19 +74,20 @@ |
77 | 75 | $gifts = $rel->getUserGiftList( 0, $per_page, $page ); |
78 | 76 | $total = $rel->getGiftCountByUsername( $user_name ); |
79 | 77 | |
80 | | - $relationship = UserRelationship::getUserRelationshipByID( $user_id, $wgUser->getID() ); |
81 | | - |
82 | 78 | /** |
83 | 79 | * Show gift count for user |
84 | 80 | */ |
85 | | - $output .= $wgOut->setPageTitle( wfMsg( 'ga-title', $rel->user_name ) ); |
| 81 | + $wgOut->setPageTitle( wfMsg( 'ga-title', $rel->user_name ) ); |
86 | 82 | |
87 | | - $output .= '<div class="back-links">' |
88 | | - . wfMsg( 'ga-back-link', $wgUser->getUserPage()->escapeFullURL(), $rel->user_name ) . |
89 | | - '</div>'; |
| 83 | + $output .= '<div class="back-links">' . |
| 84 | + wfMsg( |
| 85 | + 'ga-back-link', |
| 86 | + $wgUser->getUserPage()->escapeFullURL(), |
| 87 | + $rel->user_name |
| 88 | + ) . '</div>'; |
90 | 89 | |
91 | | - $output .= '<div class="ga-count">' |
92 | | - . wfMsgExt( 'ga-count', 'parsemag', $rel->user_name, $total ) . |
| 90 | + $output .= '<div class="ga-count">' . |
| 91 | + wfMsgExt( 'ga-count', 'parsemag', $rel->user_name, $total ) . |
93 | 92 | '</div>'; |
94 | 93 | |
95 | 94 | // Safelinks |
— | — | @@ -137,8 +136,7 @@ |
138 | 137 | $output .= '<div class="page-nav">'; |
139 | 138 | if ( $page > 1 ) { |
140 | 139 | $output .= '<a href="' . $page_link->escapeFullURL( |
141 | | - 'user=' . $user_name . '&rel_type=' . $rel_type . |
142 | | - '&page=' . ( $page - 1 ) ) . '">' . |
| 140 | + 'user=' . $user_name . '&page=' . ( $page - 1 ) ) . '">' . |
143 | 141 | wfMsg( 'ga-previous' ) . '</a> '; |
144 | 142 | } |
145 | 143 | |
— | — | @@ -157,15 +155,14 @@ |
158 | 156 | $output .= ( $i . ' ' ); |
159 | 157 | } else { |
160 | 158 | $output .= '<a href="' . $page_link->escapeFullURL( |
161 | | - 'user=' . $user_name . '&rel_type=' . $rel_type . |
162 | | - '&page=' . $i ) . "\">$i</a> "; |
| 159 | + 'user=' . $user_name . '&page=' . $i ) . "\">$i</a> "; |
163 | 160 | } |
164 | 161 | } |
165 | 162 | |
166 | 163 | if ( ( $total - ( $per_page * $page ) ) > 0 ) { |
167 | 164 | $output .= ' <a href="' . $page_link->escapeFullURL( |
168 | | - 'user=' . $user_name . '&rel_type=' . $rel_type . |
169 | | - '&page=' . ( $page + 1 ) ) . '">' . wfMsg( 'ga-next' ) . |
| 165 | + 'user=' . $user_name . '&page=' . ( $page + 1 ) ) . '">' . |
| 166 | + wfMsg( 'ga-next' ) . |
170 | 167 | '</a>'; |
171 | 168 | } |
172 | 169 | $output .= '</div>'; |