Index: trunk/extensions/SocialProfile/UserGifts/SpecialRemoveMasterGift.php |
— | — | @@ -16,7 +16,7 @@ |
17 | 17 | */ |
18 | 18 | function deleteImage( $id, $size ) { |
19 | 19 | global $wgUploadDirectory; |
20 | | - $files = glob( $wgUploadDirectory . '/awards/' . $id . "_{$size}*" ); |
| 20 | + $files = glob( $wgUploadDirectory . '/awards/' . $id . "_{$size}*" ); |
21 | 21 | if ( $files && $files[0] ) { |
22 | 22 | $img = basename( $files[0] ); |
23 | 23 | unlink( $wgUploadDirectory . '/awards/' . $img ); |
— | — | @@ -48,11 +48,11 @@ |
49 | 49 | * @param $par Mixed: parameter passed to the page or null |
50 | 50 | */ |
51 | 51 | public function execute( $par ) { |
52 | | - global $wgUser, $wgOut, $wgRequest, $wgUploadPath, $wgUserGiftsScripts; |
| 52 | + global $wgUser, $wgOut, $wgRequest, $wgUserGiftsScripts; |
53 | 53 | wfLoadExtensionMessages( 'UserGifts' ); |
54 | 54 | |
55 | 55 | // Add CSS |
56 | | - $wgOut->addStyle( '../..' . $wgUserGiftsScripts . '/UserGifts.css' ); |
| 56 | + $wgOut->addExtensionStyle( $wgUserGiftsScripts . '/UserGifts.css' ); |
57 | 57 | |
58 | 58 | // Check for permissions |
59 | 59 | if ( $wgUser->isAnon() || !$this->canUserManage() ) { |
— | — | @@ -86,9 +86,9 @@ |
87 | 87 | $out = '<div class="back-links"> |
88 | 88 | <a href="' . SpecialPage::getTitleFor( 'GiftManager' )->escapeFullURL() . '">' . wfMsg( 'g-viewgiftlist' ) . '</a> |
89 | 89 | </div> |
90 | | - <div class="g-container"> |
91 | | - ' . wfMsg( 'g-remove-success-message', $gift['gift_name'] ) . ' |
92 | | - <div class="cleared"></div> |
| 90 | + <div class="g-container">' |
| 91 | + . wfMsg( 'g-remove-success-message', $gift['gift_name'] ) . |
| 92 | + '<div class="cleared"></div> |
93 | 93 | </div>'; |
94 | 94 | |
95 | 95 | $wgOut->addHTML( $out ); |
— | — | @@ -103,7 +103,7 @@ |
104 | 104 | * @return HTML output |
105 | 105 | */ |
106 | 106 | function displayForm() { |
107 | | - global $wgUser, $wgOut, $wgUploadPath; |
| 107 | + global $wgOut, $wgUploadPath; |
108 | 108 | |
109 | 109 | $gift = Gifts::getGift( $this->gift_id ); |
110 | 110 | |
— | — | @@ -114,13 +114,13 @@ |
115 | 115 | <a href="' . SpecialPage::getTitleFor( 'GiftManager' )->escapeFullURL() . '">' . wfMsg( 'g-viewgiftlist' ) . '</a> |
116 | 116 | </div> |
117 | 117 | <form action="" method="post" enctype="multipart/form-data" name="form1"> |
118 | | - <div class="g-remove-message"> |
119 | | - ' . wfMsg( 'g-delete-message', $gift['gift_name'] ) . ' |
| 118 | + <div class="g-remove-message">' |
| 119 | + . wfMsg( 'g-delete-message', $gift['gift_name'] ) . |
| 120 | + '</div> |
| 121 | + <div class="g-container">' |
| 122 | + . $gift_image . |
| 123 | + '<div class="g-name">' . $gift['gift_name'] . '</div> |
120 | 124 | </div> |
121 | | - <div class="g-container"> |
122 | | - ' . $gift_image . ' |
123 | | - <div class="g-name">' . $gift['gift_name'] . '</div> |
124 | | - </div> |
125 | 125 | <div class="cleared"></div> |
126 | 126 | <div class="g-buttons"> |
127 | 127 | <input type="button" class="site-button" value="' . wfMsg( 'g-remove' ) . '" size="20" onclick="document.form1.submit()" /> |
Index: trunk/extensions/SocialProfile/UserGifts/SpecialGiveGift.php |
— | — | @@ -25,7 +25,7 @@ |
26 | 26 | |
27 | 27 | $usertitle = Title::newFromDBkey( $wgRequest->getVal( 'user' ) ); |
28 | 28 | if ( !$usertitle ) { |
29 | | - $wgOut->addHTML( /*$wgOut->addHTML(*/ $this->displayFormNoUser() /*)*/ ); |
| 29 | + $wgOut->addHTML( $this->displayFormNoUser() ); |
30 | 30 | return false; |
31 | 31 | } |
32 | 32 | |
— | — | @@ -38,14 +38,14 @@ |
39 | 39 | $wgOut->setPageTitle( wfMsg( 'g-error-title' ) ); |
40 | 40 | $out .= wfMsg( 'g-error-message-to-yourself' ); |
41 | 41 | $wgOut->addHTML( $out ); |
42 | | - } else if ( $wgUser->isBlocked() ) { |
| 42 | + } elseif ( $wgUser->isBlocked() ) { |
43 | 43 | $wgOut->setPageTitle( wfMsg( 'g-error-title' ) ); |
44 | 44 | $out .= wfMsg( 'g-error-message-blocked' ); |
45 | 45 | $wgOut->addHTML( $out ); |
46 | | - } else if ( $this->user_id_to == 0 ) { |
| 46 | + } elseif ( $this->user_id_to == 0 ) { |
47 | 47 | $wgOut->setPageTitle( wfMsg( 'g-error-title' ) ); |
48 | 48 | $wgOut->addHTML( wfMsg( 'g-error-message-no-user' ) ); |
49 | | - } else if ( $wgUser->getID() == 0 ) { |
| 49 | + } elseif ( $wgUser->getID() == 0 ) { |
50 | 50 | $wgOut->setPageTitle( wfMsg( 'g-error-title' ) ); |
51 | 51 | $out .= wfMsg( 'g-error-message-login' ); |
52 | 52 | $wgOut->addHTML( $out ); |
— | — | @@ -57,7 +57,12 @@ |
58 | 58 | |
59 | 59 | $_SESSION['alreadysubmitted'] = true; |
60 | 60 | |
61 | | - $ug_gift_id = $gift->sendGift( $this->user_name_to, $wgRequest->getVal( 'gift_id' ), 0, $wgRequest->getVal( 'message' ) ); |
| 61 | + $ug_gift_id = $gift->sendGift( |
| 62 | + $this->user_name_to, |
| 63 | + $wgRequest->getVal( 'gift_id' ), |
| 64 | + 0, |
| 65 | + $wgRequest->getVal( 'message' ) |
| 66 | + ); |
62 | 67 | |
63 | 68 | // clear the cache for the user profile gifts for this user |
64 | 69 | $wgMemc->delete( wfMemcKey( 'user', 'profile', 'gifts', $this->user_id_to ) ); |
— | — | @@ -71,7 +76,9 @@ |
72 | 77 | |
73 | 78 | if ( is_array( $last_unique_gifts ) ) { |
74 | 79 | foreach ( $last_unique_gifts as $last_unique_gift ) { |
75 | | - if ( $wgRequest->getVal( 'gift_id' ) == $last_unique_gift['gift_id'] ) $found = 0; |
| 80 | + if ( $wgRequest->getVal( 'gift_id' ) == $last_unique_gift['gift_id'] ) { |
| 81 | + $found = 0; |
| 82 | + } |
76 | 83 | } |
77 | 84 | } |
78 | 85 | |
— | — | @@ -83,7 +90,9 @@ |
84 | 91 | ); |
85 | 92 | |
86 | 93 | // remove oldest value |
87 | | - if ( count( $last_unique_gifts ) > 4 ) array_shift( $last_unique_gifts ); |
| 94 | + if ( count( $last_unique_gifts ) > 4 ) { |
| 95 | + array_shift( $last_unique_gifts ); |
| 96 | + } |
88 | 97 | |
89 | 98 | // reset the cache |
90 | 99 | $wgMemc->set( $key, $last_unique_gifts ); |
— | — | @@ -97,12 +106,12 @@ |
98 | 107 | $output .= '<div class="back-links"> |
99 | 108 | <a href="' . $user_title->escapeFullURL() . '">' . wfMsg( 'g-back-link', $this->user_name_to ) . '</a> |
100 | 109 | </div> |
101 | | - <div class="g-message"> |
102 | | - ' . wfMsg( 'g-sent-message', $this->user_name_to ) . ' |
103 | | - </div> |
104 | | - <div class="g-container"> |
105 | | - ' . $gift_image . ' |
106 | | - <div class="g-title">' . $sent_gift['name'] . '</div>'; |
| 110 | + <div class="g-message">' |
| 111 | + . wfMsg( 'g-sent-message', $this->user_name_to ) . |
| 112 | + '</div> |
| 113 | + <div class="g-container">' |
| 114 | + . $gift_image . |
| 115 | + '<div class="g-title">' . $sent_gift['name'] . '</div>'; |
107 | 116 | if ( $sent_gift['message'] ) { |
108 | 117 | $output .= '<div class="g-user-message">' . $sent_gift['message'] . '</div>'; |
109 | 118 | } |
— | — | @@ -153,15 +162,15 @@ |
154 | 163 | |
155 | 164 | $wgOut->setPageTitle( wfMsg( 'g-give-to-user-title', $gift['gift_name'], $this->user_name_to ) ); |
156 | 165 | |
157 | | - $gift_image = "<img id=\"gift_image_{$gift['gift_id']}\" src=\"{$wgUploadPath}/awards/" . Gifts::getGiftImage( $gift['gift_id'], 'l' ) . "\" border=\"0\" alt=\"\"/>"; |
| 166 | + $gift_image = "<img id=\"gift_image_{$gift['gift_id']}\" src=\"{$wgUploadPath}/awards/" . Gifts::getGiftImage( $gift['gift_id'], 'l' ) . '" border="0" alt="" />'; |
158 | 167 | |
159 | 168 | $output = '<form action="" method="post" enctype="multipart/form-data" name="gift"> |
160 | | - <div class="g-message"> |
161 | | - ' . wfMsg( 'g-give-to-user-message', $this->user_name_to, $give_gift_link->escapeFullURL( 'user=' . $this->user_name_to ) ) . " |
162 | | - </div> |
163 | | - <div id=\"give_gift_{$gift["gift_id"]}\" class=\"g-container\"> |
| 169 | + <div class="g-message">' |
| 170 | + . wfMsg( 'g-give-to-user-message', $this->user_name_to, $give_gift_link->escapeFullURL( 'user=' . $this->user_name_to ) ) . |
| 171 | + "</div> |
| 172 | + <div id=\"give_gift_{$gift['gift_id']}\" class=\"g-container\"> |
164 | 173 | {$gift_image} |
165 | | - <div class=\"g-title\">{$gift["gift_name"]}</div>"; |
| 174 | + <div class=\"g-title\">{$gift['gift_name']}</div>"; |
166 | 175 | if ( $gift['gift_description'] ) { |
167 | 176 | $output .= '<div class="g-describe">' . $gift['gift_description'] . '</div>'; |
168 | 177 | } |
— | — | @@ -186,7 +195,7 @@ |
187 | 196 | $output = $wgOut->setPageTitle( wfMsg( 'g-give-no-user-title' ) ); |
188 | 197 | |
189 | 198 | $output .= '<form action="" method="get" enctype="multipart/form-data" name="gift"> |
190 | | - <input type="hidden" name="title" value="' . $wgRequest->getVal( 'title' ) . '"> |
| 199 | + <input type="hidden" name="title" value="' . $wgRequest->getVal( 'title' ) . '" /> |
191 | 200 | <div class="g-message">' . wfMsg( 'g-give-no-user-message' ) . '</div> |
192 | 201 | <div class="g-give-container">'; |
193 | 202 | |
— | — | @@ -198,7 +207,7 @@ |
199 | 208 | $output .= '<div class="g-give-title">' . wfMsg( 'g-give-list-friends-title' ) . '</div> |
200 | 209 | <div class="g-gift-select"> |
201 | 210 | <select onchange="javascript:chooseFriend(this.value)"> |
202 | | - <option value="#" selected>' . wfMsg( 'g-select-a-friend' ) . '</option>'; |
| 211 | + <option value="#" selected="selected">' . wfMsg( 'g-select-a-friend' ) . '</option>'; |
203 | 212 | foreach ( $friends as $friend ) { |
204 | 213 | $output .= '<option value="' . urlencode( $friend['user_name'] ) . '">' . $friend['user_name'] . '</option>'; |
205 | 214 | } |
— | — | @@ -210,8 +219,8 @@ |
211 | 220 | |
212 | 221 | $output .= '<div class="g-give-title">' . wfMsg( 'g-give-enter-friend-title' ) . '</div> |
213 | 222 | <div class="g-give-textbox"> |
214 | | - <input type="text" width="85" name="user" value=""> |
215 | | - <input class="site-button" type="button" value="' . wfMsg( 'g-give-gift' ) . '" onclick="document.gift.submit()"> |
| 223 | + <input type="text" width="85" name="user" value="" /> |
| 224 | + <input class="site-button" type="button" value="' . wfMsg( 'g-give-gift' ) . '" onclick="document.gift.submit()" /> |
216 | 225 | </div> |
217 | 226 | </div> |
218 | 227 | </form>'; |
— | — | @@ -224,18 +233,21 @@ |
225 | 234 | $user = Title::makeTitle( NS_USER, $this->user_name_to ); |
226 | 235 | |
227 | 236 | $page = $wgRequest->getVal( 'page' ); |
228 | | - if ( !$page || !is_numeric( $page ) ) $page = 1; |
| 237 | + if ( !$page || !is_numeric( $page ) ) { |
| 238 | + $page = 1; |
| 239 | + } |
229 | 240 | |
230 | 241 | $per_page = 24; |
231 | 242 | $per_row = $wgGiveGiftPerRow; |
232 | | - if ( !$per_row ) $per_row = 3; |
| 243 | + if ( !$per_row ) { |
| 244 | + $per_row = 3; |
| 245 | + } |
233 | 246 | |
234 | 247 | $total = Gifts::getGiftCount(); |
235 | 248 | $gifts = Gifts::getGiftList( $per_page, $page, 'gift_name' ); |
236 | 249 | $output = ''; |
237 | 250 | |
238 | 251 | if ( $gifts ) { |
239 | | - |
240 | 252 | $wgOut->setPageTitle( wfMsg( 'g-give-all-title', $this->user_name_to ) ); |
241 | 253 | |
242 | 254 | $output .= '<div class="back-links"> |
— | — | @@ -249,16 +261,19 @@ |
250 | 262 | $x = 1; |
251 | 263 | |
252 | 264 | foreach ( $gifts as $gift ) { |
| 265 | + $gift_image = "<img id=\"gift_image_{$gift['id']}\" src=\"{$wgUploadPath}/awards/" . Gifts::getGiftImage( $gift['id'], 'l' ) . '" border="0" alt="" />'; |
253 | 266 | |
254 | | - $gift_image = "<img id=\"gift_image_{$gift["id"]}\" src=\"{$wgUploadPath}/awards/" . Gifts::getGiftImage( $gift['id'], 'l' ) . "\" border=\"0\" alt=\"\" />"; |
255 | | - |
256 | | - $output .= "<div onclick=\"selectGift({$gift["id"]})\" onmouseover=\"highlightGift({$gift["id"]})\" onmouseout=\"unHighlightGift({$gift["id"]})\" id=\"give_gift_{$gift["id"]}\" class=\"g-give-all\"> |
| 267 | + $output .= "<div onclick=\"selectGift({$gift['id']})\" onmouseover=\"highlightGift({$gift['id']})\" onmouseout=\"unHighlightGift({$gift['id']})\" id=\"give_gift_{$gift['id']}\" class=\"g-give-all\"> |
257 | 268 | {$gift_image} |
258 | | - <div class=\"g-title g-blue\">{$gift["gift_name"]}</div>"; |
259 | | - if ( $gift['gift_description'] ) $output .= "<div class=\"g-describe\">{$gift["gift_description"]}</div>"; |
| 269 | + <div class=\"g-title g-blue\">{$gift['gift_name']}</div>"; |
| 270 | + if ( $gift['gift_description'] ) { |
| 271 | + $output .= "<div class=\"g-describe\">{$gift['gift_description']}</div>"; |
| 272 | + } |
260 | 273 | $output .= '<div class="cleared"></div> |
261 | 274 | </div>'; |
262 | | - if ( $x == count( $gifts ) || $x != 1 && $x % $per_row == 0 ) $output .= '<div class="cleared"></div>'; |
| 275 | + if ( $x == count( $gifts ) || $x != 1 && $x % $per_row == 0 ) { |
| 276 | + $output .= '<div class="cleared"></div>'; |
| 277 | + } |
263 | 278 | $x++; |
264 | 279 | } |
265 | 280 | |
— | — | @@ -275,13 +290,17 @@ |
276 | 291 | $output .= '<a href="' . $give_gift_link->escapeFullURL( 'user=' . $user_safe . '&page=' . ( $page - 1 ) ) . '">' . wfMsg( 'g-previous' ) . '</a> '; |
277 | 292 | } |
278 | 293 | |
279 | | - if ( ( $total % $per_page ) != 0 ) $numofpages++; |
280 | | - if ( $numofpages >= 9 ) $numofpages = 9 + $page; |
| 294 | + if ( ( $total % $per_page ) != 0 ) { |
| 295 | + $numofpages++; |
| 296 | + } |
| 297 | + if ( $numofpages >= 9 ) { |
| 298 | + $numofpages = 9 + $page; |
| 299 | + } |
281 | 300 | for ( $i = 1; $i <= $numofpages; $i++ ) { |
282 | 301 | if ( $i == $page ) { |
283 | | - $output .= ( $i . " " ); |
| 302 | + $output .= ( $i . ' ' ); |
284 | 303 | } else { |
285 | | - $output .= "<a href=\"" . $give_gift_link->escapeFullURL( 'user=' . $user_safe . '&page=' . $i ) . "\">$i</a> "; |
| 304 | + $output .= '<a href="' . $give_gift_link->escapeFullURL( 'user=' . $user_safe . '&page=' . $i ) . "\">$i</a> "; |
286 | 305 | } |
287 | 306 | } |
288 | 307 | |
Index: trunk/extensions/SocialProfile/UserGifts/SpecialViewGift.php |
— | — | @@ -18,7 +18,7 @@ |
19 | 19 | global $wgUser, $wgOut, $wgRequest, $wgUploadPath, $wgUserGiftsScripts; |
20 | 20 | wfLoadExtensionMessages( 'UserGifts' ); |
21 | 21 | |
22 | | - $wgOut->addStyle( '../..' . $wgUserGiftsScripts . '/UserGifts.css' ); |
| 22 | + $wgOut->addExtensionStyle( $wgUserGiftsScripts . '/UserGifts.css' ); |
23 | 23 | |
24 | 24 | $user_name = ''; // Prevent E_NOTICE |
25 | 25 | |
— | — | @@ -41,7 +41,6 @@ |
42 | 42 | $dbr = wfGetDB( DB_SLAVE ); |
43 | 43 | |
44 | 44 | if ( $gift ) { |
45 | | - |
46 | 45 | if ( $gift['status'] == 1 ) { |
47 | 46 | if ( $gift['user_name_to'] == $wgUser->getName() ) { |
48 | 47 | $g = new UserGifts( $gift['user_name_to'] ); |
— | — | @@ -50,11 +49,19 @@ |
51 | 50 | } |
52 | 51 | } |
53 | 52 | |
54 | | - $res = $dbr->select( 'user_gift', |
| 53 | + $res = $dbr->select( |
| 54 | + 'user_gift', |
55 | 55 | array( 'DISTINCT ug_user_name_to', 'ug_user_id_to', 'ug_date' ), |
56 | | - array( 'ug_gift_id' => $gift['gift_id'], "ug_user_name_to<>'" . addslashes( $gift['user_name_to'] ) . "'" ), |
| 56 | + array( |
| 57 | + 'ug_gift_id' => $gift['gift_id'], |
| 58 | + "ug_user_name_to<>'" . addslashes( $gift['user_name_to'] ) . "'" |
| 59 | + ), |
57 | 60 | __METHOD__, |
58 | | - array( 'GROUP BY' => 'ug_user_name_to', 'ORDER BY' => 'ug_date DESC', 'LIMIT' => 6 ) |
| 61 | + array( |
| 62 | + 'GROUP BY' => 'ug_user_name_to', |
| 63 | + 'ORDER BY' => 'ug_date DESC', |
| 64 | + 'LIMIT' => 6 |
| 65 | + ) |
59 | 66 | ); |
60 | 67 | |
61 | 68 | $output = $wgOut->setPageTitle( wfMsgExt( 'g-description-title', 'parsemag', $gift['user_name_to'], $gift['name'] ) ); |
— | — | @@ -78,42 +85,41 @@ |
79 | 86 | |
80 | 87 | $gift_image = '<img src="' . $wgUploadPath . '/awards/' . Gifts::getGiftImage( $gift['gift_id'], 'l' ) . '" border="0" alt="" />'; |
81 | 88 | |
82 | | - $output .= '<div class="g-description">' |
83 | | - . $gift_image . ' |
84 | | - <div class="g-name">' . $gift['name'] . '</div> |
| 89 | + $output .= '<div class="g-description">' |
| 90 | + . $gift_image . |
| 91 | + '<div class="g-name">' . $gift['name'] . '</div> |
85 | 92 | <div class="g-timestamp">(' . $gift['timestamp'] . ')</div> |
86 | 93 | <div class="g-from">' . wfMsg( 'g-from', $user->escapeFullURL(), $gift['user_name_from'] ) . '</div>'; |
87 | | - if ( $message ) { |
88 | | - $output .= '<div class="g-user-message">' . $message . '</div>'; |
89 | | - } |
90 | | - $output .= '<div class="cleared"></div> |
| 94 | + if ( $message ) { |
| 95 | + $output .= '<div class="g-user-message">' . $message . '</div>'; |
| 96 | + } |
| 97 | + $output .= '<div class="cleared"></div> |
91 | 98 | <div class="g-describe">' . $gift['description'] . '</div> |
92 | 99 | <div class="g-actions"> |
93 | 100 | <a href="' . $give_gift_link->escapeFullURL( 'gift_id=' . $gift['gift_id'] ) . '">' . wfMsg( 'g-to-another' ) . '</a>'; |
94 | | - if ( $gift['user_name_to'] == $wgUser->getName() ) { |
95 | | - $output .= ' '; |
96 | | - $output .= wfMsgExt( 'pipe-separator' , 'escapenoentities' ); |
97 | | - $output .= ' '; |
98 | | - $output .= '<a href="' . $remove_gift_link->escapeFullURL( 'gift_id=' . $gift['id'] ) . '">' . wfMsg( 'g-remove-gift' ) . '</a>'; |
99 | | - } |
100 | | - $output .= '</div> |
| 101 | + if ( $gift['user_name_to'] == $wgUser->getName() ) { |
| 102 | + $output .= ' '; |
| 103 | + $output .= wfMsgExt( 'pipe-separator' , 'escapenoentities' ); |
| 104 | + $output .= ' '; |
| 105 | + $output .= '<a href="' . $remove_gift_link->escapeFullURL( 'gift_id=' . $gift['id'] ) . '">' . wfMsg( 'g-remove-gift' ) . '</a>'; |
| 106 | + } |
| 107 | + $output .= '</div> |
101 | 108 | </div>'; |
102 | 109 | |
103 | | - $output .= '<div class="g-recent"> |
| 110 | + $output .= '<div class="g-recent"> |
104 | 111 | <div class="g-recent-title">' . wfMsg( 'g-recent-recipients' ) . '</div> |
105 | 112 | <div class="g-gift-count">' . wfMsgExt( 'g-given', 'parsemag', $gift['gift_count'] ) . '</div>'; |
106 | 113 | |
107 | | - while ( $row = $dbr->fetchObject( $res ) ) { |
| 114 | + foreach ( $res as $row ) { |
| 115 | + $user_to_id = $row->ug_user_id_to; |
| 116 | + $avatar = new wAvatar( $user_to_id, 'ml' ); |
| 117 | + $user_name_link = Title::makeTitle( NS_USER, $row->ug_user_name_to ); |
108 | 118 | |
109 | | - $user_to_id = $row->ug_user_id_to; |
110 | | - $avatar = new wAvatar( $user_to_id, 'ml' ); |
111 | | - $user_name_link = Title::makeTitle( NS_USER, $row->ug_user_name_to ); |
112 | | - |
113 | | - $output .= "<a href=\"" . $user_name_link->escapeFullURL() . "\"> |
114 | | - {$avatar->getAvatarURL()} |
115 | | - </a>"; |
116 | | - } |
117 | | - $output .= '<div class="cleared"></div> |
| 119 | + $output .= '<a href="' . $user_name_link->escapeFullURL() . "\"> |
| 120 | + {$avatar->getAvatarURL()} |
| 121 | + </a>"; |
| 122 | + } |
| 123 | + $output .= '<div class="cleared"></div> |
118 | 124 | </div> |
119 | 125 | </div>'; |
120 | 126 | |
Index: trunk/extensions/SocialProfile/UserGifts/SpecialRemoveGift.php |
— | — | @@ -18,7 +18,7 @@ |
19 | 19 | global $wgUser, $wgOut, $wgRequest, $wgMemc, $wgUploadPath, $wgUserGiftsScripts; |
20 | 20 | wfLoadExtensionMessages( 'UserGifts' ); |
21 | 21 | |
22 | | - $wgOut->addStyle( '../..' . $wgUserGiftsScripts . '/UserGifts.css' ); |
| 22 | + $wgOut->addExtensionStyle( $wgUserGiftsScripts . '/UserGifts.css' ); |
23 | 23 | |
24 | 24 | $this->gift_id = $wgRequest->getVal( 'gift_id' ); |
25 | 25 | $rel = new UserGifts( $wgUser->getName() ); |
— | — | @@ -36,7 +36,6 @@ |
37 | 37 | |
38 | 38 | $gift = $rel->getUserGift( $this->gift_id ); |
39 | 39 | if ( $wgRequest->wasPosted() && $_SESSION['alreadysubmitted'] == false ) { |
40 | | - |
41 | 40 | $_SESSION['alreadysubmitted'] = true; |
42 | 41 | |
43 | 42 | $user_page_link = Title::makeTitle( NS_USER, $wgUser->getName() ); |
— | — | @@ -53,9 +52,9 @@ |
54 | 53 | $out = '<div class="back-links"> |
55 | 54 | <a href="' . $wgUser->getUserPage()->escapeFullURL() . '">' . wfMsg( 'g-back-link', $gift['user_name_to'] ) . '</a> |
56 | 55 | </div> |
57 | | - <div class="g-container"> |
58 | | - ' . $gift_image . wfMsg( 'g-remove-success-message', $gift['name'] ) . ' |
59 | | - <div class="cleared"></div> |
| 56 | + <div class="g-container">' |
| 57 | + . $gift_image . wfMsg( 'g-remove-success-message', $gift['name'] ) . |
| 58 | + '<div class="cleared"></div> |
60 | 59 | </div> |
61 | 60 | <div class="g-buttons"> |
62 | 61 | <input type="button" class="site-button" value="' . wfMsg( 'g-main-page' ) . '" size="20" onclick="window.location=\'index.php?title=' . wfMsgForContent( 'mainpage' ) . '\'" /> |
— | — | @@ -86,17 +85,17 @@ |
87 | 86 | <a href="' . $wgUser->getUserPage()->escapeFullURL() . '">' . wfMsg( 'g-back-link', $gift['user_name_to'] ) . '</a> |
88 | 87 | </div> |
89 | 88 | <form action="" method="post" enctype="multipart/form-data" name="form1"> |
90 | | - <div class="g-remove-message"> |
91 | | - ' . wfMsg( 'g-remove-message', $gift['name'] ) . ' |
92 | | - </div> |
93 | | - <div class="g-container"> |
94 | | - ' . $gift_image . ' |
95 | | - <div class="g-name">' . $gift['name'] . '</div> |
| 89 | + <div class="g-remove-message">' |
| 90 | + . wfMsg( 'g-remove-message', $gift['name'] ) . |
| 91 | + '</div> |
| 92 | + <div class="g-container">' |
| 93 | + . $gift_image . |
| 94 | + '<div class="g-name">' . $gift['name'] . '</div> |
96 | 95 | <div class="g-from">' . wfMsg( 'g-from', $user->escapeFullURL(), $gift['user_name_from'] ) . '</div>'; |
97 | | - if ( $gift['message'] ) { |
98 | | - $output .= '<div class="g-user-message">' . $gift['message'] . '</div>'; |
99 | | - } |
100 | | - $output .= '</div> |
| 96 | + if ( $gift['message'] ) { |
| 97 | + $output .= '<div class="g-user-message">' . $gift['message'] . '</div>'; |
| 98 | + } |
| 99 | + $output .= '</div> |
101 | 100 | <div class="cleared"></div> |
102 | 101 | <div class="g-buttons"> |
103 | 102 | <input type="hidden" name="user" value="' . addslashes( $gift['user_name_from'] ) . '"> |
Index: trunk/extensions/SocialProfile/UserGifts/SpecialViewGifts.php |
— | — | @@ -18,7 +18,7 @@ |
19 | 19 | global $wgUser, $wgOut, $wgRequest, $wgMemc, $wgUploadPath, $wgUserGiftsScripts; |
20 | 20 | wfLoadExtensionMessages( 'UserGifts' ); |
21 | 21 | |
22 | | - $wgOut->addStyle( '../..' . $wgUserGiftsScripts . '/UserGifts.css' ); |
| 22 | + $wgOut->addExtensionStyle( $wgUserGiftsScripts . '/UserGifts.css' ); |
23 | 23 | |
24 | 24 | $user_name = $wgRequest->getVal( 'user' ); |
25 | 25 | $page = $wgRequest->getVal( 'page' ); |
— | — | @@ -28,7 +28,7 @@ |
29 | 29 | * It will automatically return them to the ViewGifts page |
30 | 30 | */ |
31 | 31 | if ( $wgUser->getID() == 0 && $user_name == '' ) { |
32 | | - $login = SpecialPage::getTitleFor( 'UserLogin' ); |
| 32 | + $login = SpecialPage::getTitleFor( 'Userlogin' ); |
33 | 33 | $wgOut->redirect( $login->escapeFullURL( 'returnto=Special:ViewGifts' ) ); |
34 | 34 | return false; |
35 | 35 | } |
— | — | @@ -36,7 +36,9 @@ |
37 | 37 | /** |
38 | 38 | * If no user is set in the URL, we assume its the current user |
39 | 39 | */ |
40 | | - if ( !$user_name ) $user_name = $wgUser->getName(); |
| 40 | + if ( !$user_name ) { |
| 41 | + $user_name = $wgUser->getName(); |
| 42 | + } |
41 | 43 | $user_id = User::idFromName( $user_name ); |
42 | 44 | $user = Title::makeTitle( NS_USER, $user_name ); |
43 | 45 | $user_safe = urlencode( $user_name ); |
— | — | @@ -54,16 +56,18 @@ |
55 | 57 | * Config for the page |
56 | 58 | */ |
57 | 59 | $per_page = 10; |
58 | | - if ( !$page || !is_numeric( $page ) ) $page = 1; |
| 60 | + if ( !$page || !is_numeric( $page ) ) { |
| 61 | + $page = 1; |
| 62 | + } |
59 | 63 | $per_row = 2; |
60 | 64 | |
61 | 65 | /** |
62 | | - * Get all Gifts for this user into the array |
| 66 | + * Get all gifts for this user into the array |
63 | 67 | */ |
64 | 68 | $rel = new UserGifts( $user_name ); |
65 | 69 | |
66 | 70 | $gifts = $rel->getUserGiftList( 0, $per_page, $page ); |
67 | | - $total = $rel->getGiftCountByUsername( $user_name ); // count($relationships); |
| 71 | + $total = $rel->getGiftCountByUsername( $user_name ); |
68 | 72 | |
69 | 73 | $relationship = UserRelationship::getUserRelationshipByID( $user_id, $wgUser->getID() ); |
70 | 74 | |
— | — | @@ -72,15 +76,16 @@ |
73 | 77 | */ |
74 | 78 | $output = $wgOut->setPageTitle( wfMsg( 'g-list-title', $rel->user_name ) ); |
75 | 79 | |
76 | | - $output .= '<div class="back-links"><a href="' . $user->getFullURL() . '"> |
77 | | - ' . wfMsg( 'g-back-link', $rel->user_name ) . '</a> |
| 80 | + $output .= '<div class="back-links"> |
| 81 | + <a href="' . $user->getFullURL() . '">' |
| 82 | + . wfMsg( 'g-back-link', $rel->user_name ) . |
| 83 | + '</a> |
78 | 84 | </div> |
79 | | - <div class="g-count"> |
80 | | - ' . wfMsgExt( 'g-count', 'parsemag', $rel->user_name, $total ) . ' |
81 | | - </div>'; |
| 85 | + <div class="g-count">' |
| 86 | + . wfMsgExt( 'g-count', 'parsemag', $rel->user_name, $total ) . |
| 87 | + '</div>'; |
82 | 88 | |
83 | 89 | if ( $gifts ) { |
84 | | - |
85 | 90 | $x = 1; |
86 | 91 | |
87 | 92 | // Safe links |
— | — | @@ -89,47 +94,48 @@ |
90 | 95 | $remove_gift_link = SpecialPage::getTitleFor( 'RemoveGift' ); |
91 | 96 | |
92 | 97 | foreach ( $gifts as $gift ) { |
93 | | - |
94 | 98 | $giftname_length = strlen( $gift['gift_name'] ); |
95 | 99 | $giftname_space = stripos( $gift['gift_name'], ' ' ); |
96 | 100 | |
97 | 101 | if ( ( $giftname_space == false || $giftname_space >= "30" ) && $giftname_length > 30 ) { |
98 | | - $gift_name_display = substr( $gift['gift_name'], 0, 30 ) . " " . substr( $gift['gift_name'], 30, 50 ); |
| 102 | + $gift_name_display = substr( $gift['gift_name'], 0, 30 ) . ' ' . substr( $gift['gift_name'], 30, 50 ); |
99 | 103 | } else { |
100 | 104 | $gift_name_display = $gift['gift_name']; |
101 | | - } ; |
| 105 | + } |
102 | 106 | |
103 | 107 | $user_from = Title::makeTitle( NS_USER, $gift['user_name_from'] ); |
104 | | - $gift_image = "<img src=\"{$wgUploadPath}/awards/" . Gifts::getGiftImage( $gift['gift_id'], 'l' ) . "\" border=\"0\" alt=\"\"/>"; |
| 108 | + $gift_image = "<img src=\"{$wgUploadPath}/awards/" . Gifts::getGiftImage( $gift['gift_id'], 'l' ) . '" border="0" alt="" />'; |
105 | 109 | |
106 | 110 | $output .= '<div class="g-item"> |
107 | 111 | <a href="' . $view_gift_link->escapeFullURL( 'gift_id=' . $gift['id'] ) . '">' . $gift_image . '</a> |
108 | 112 | <div class="g-title"> |
109 | 113 | <a href="' . $view_gift_link->escapeFullURL( 'gift_id=' . $gift['id'] ) . '">' . $gift_name_display . '</a>'; |
110 | | - if ( $gift['status'] == 1 ) { |
111 | | - if ( $user_name == $wgUser->getName() ) { |
112 | | - $rel->clearUserGiftStatus( $gift['id'] ); |
113 | | - $rel->decNewGiftCount( $wgUser->getID() ); |
114 | | - } |
115 | | - $output .= '<span class="g-new">' . wfMsg( 'g-new' ) . '</span>'; |
116 | | - } |
117 | | - $output .= '</div>'; |
| 114 | + if ( $gift['status'] == 1 ) { |
| 115 | + if ( $user_name == $wgUser->getName() ) { |
| 116 | + $rel->clearUserGiftStatus( $gift['id'] ); |
| 117 | + $rel->decNewGiftCount( $wgUser->getID() ); |
| 118 | + } |
| 119 | + $output .= '<span class="g-new">' . wfMsg( 'g-new' ) . '</span>'; |
| 120 | + } |
| 121 | + $output .= '</div>'; |
118 | 122 | |
119 | | - $output .= '<div class="g-from"> |
120 | | - ' . wfMsg( 'g-from', $user_from->escapeFullURL(), $gift['user_name_from'] ) . ' |
121 | | - </div> |
| 123 | + $output .= '<div class="g-from">' |
| 124 | + . wfMsg( 'g-from', $user_from->escapeFullURL(), $gift['user_name_from'] ) . |
| 125 | + '</div> |
122 | 126 | <div class="g-actions"> |
123 | 127 | <a href="' . $give_gift_link->escapeFullURL( 'gift_id=' . $gift['gift_id'] ) . '">' . wfMsg( 'g-to-another' ) . '</a>'; |
124 | | - if ( $rel->user_name == $wgUser->getName() ) { |
125 | | - $output .= ' '; |
126 | | - $output .= wfMsgExt( 'pipe-separator' , 'escapenoentities' ); |
127 | | - $output .= ' '; |
128 | | - $output .= '<a href="' . $remove_gift_link->escapeFullURL( 'gift_id=' . $gift['id'] ) . '">' . wfMsg( 'g-remove-gift' ) . '</a>'; |
129 | | - } |
| 128 | + if ( $rel->user_name == $wgUser->getName() ) { |
| 129 | + $output .= ' '; |
| 130 | + $output .= wfMsgExt( 'pipe-separator' , 'escapenoentities' ); |
| 131 | + $output .= ' '; |
| 132 | + $output .= '<a href="' . $remove_gift_link->escapeFullURL( 'gift_id=' . $gift['id'] ) . '">' . wfMsg( 'g-remove-gift' ) . '</a>'; |
| 133 | + } |
130 | 134 | $output .= '</div> |
131 | 135 | <div class="cleared"></div>'; |
132 | 136 | $output .= '</div>'; |
133 | | - if ( $x == count( $gifts ) || $x != 1 && $x % $per_row == 0 ) $output .= '<div class="cleared"></div>'; |
| 137 | + if ( $x == count( $gifts ) || $x != 1 && $x % $per_row == 0 ) { |
| 138 | + $output .= '<div class="cleared"></div>'; |
| 139 | + } |
134 | 140 | |
135 | 141 | $x++; |
136 | 142 | } |
— | — | @@ -148,15 +154,21 @@ |
149 | 155 | $output .= '<a href="' . $page_link->escapeFullURL( 'user=' . $user_name . '&rel_type=' . $rel_type . '&page=' . ( $page - 1 ) ) . '">' . wfMsg( 'g-previous' ) . '</a> '; |
150 | 156 | } |
151 | 157 | |
152 | | - if ( ( $total % $per_page ) != 0 ) $numofpages++; |
153 | | - if ( $numofpages >= 9 && $page < $total ) $numofpages = 9 + $page; |
154 | | - if ( $numofpages >= ( $total / $per_page ) ) $numofpages = ( $total / $per_page ) + 1; |
| 158 | + if ( ( $total % $per_page ) != 0 ) { |
| 159 | + $numofpages++; |
| 160 | + } |
| 161 | + if ( $numofpages >= 9 && $page < $total ) { |
| 162 | + $numofpages = 9 + $page; |
| 163 | + } |
| 164 | + if ( $numofpages >= ( $total / $per_page ) ) { |
| 165 | + $numofpages = ( $total / $per_page ) + 1; |
| 166 | + } |
155 | 167 | |
156 | 168 | for ( $i = 1; $i <= $numofpages; $i++ ) { |
157 | 169 | if ( $i == $page ) { |
158 | | - $output .= ( $i . " " ); |
| 170 | + $output .= ( $i . ' ' ); |
159 | 171 | } else { |
160 | | - $output .= "<a href=\"" . $page_link->escapeFullURL( 'user=' . $user_name . '&rel_type=' . $rel_type . '&page=' . $i ) . "\">$i</a> "; |
| 172 | + $output .= '<a href="' . $page_link->escapeFullURL( 'user=' . $user_name . '&rel_type=' . $rel_type . '&page=' . $i ) . "\">$i</a> "; |
161 | 173 | } |
162 | 174 | } |
163 | 175 | |