Index: trunk/extensions/SocialProfile/UserActivity/UserActivity.i18n.php |
— | — | @@ -14,25 +14,24 @@ |
15 | 15 | */ |
16 | 16 | $messages['en'] = array( |
17 | 17 | 'useractivity' => "Friends' activity", |
18 | | - 'useractivity-award' => 'received an award', // FIXME: message lego |
| 18 | + 'useractivity-award' => '$1 received an award', |
19 | 19 | 'useractivity-all' => 'View all', |
20 | | - 'useractivity-gift' => 'received a gift from', // FIXME: message logo |
21 | | - 'useractivity-group-edit' => 'edits', // CHECKME: message lego (as well as the messages below)? |
22 | | - 'useractivity-group-comment' => 'comments', |
23 | | - 'useractivity-group-user_message' => 'messages', |
24 | | - 'useractivity-group-friend' => 'friends', |
25 | | - 'useractivity-filter' => 'Filter', |
26 | | - 'useractivity-network-thought' => 'has a thought for the $1 network', // FIXME: message lego |
27 | | - 'useractivity-title' => "Friends' activity", |
| 20 | + #'useractivity-comment' => '{{PLURAL:$1|commented on the page|commented on the following pages: }}', |
| 21 | + #'useractivity-commentedpage' => 'commented on the page', |
| 22 | + 'useractivity-edit' => '$1 {{PLURAL:$4|edited the page|edited the following pages:}} $3', |
| 23 | + 'useractivity-foe' => '$1 {{PLURAL:$2|is now foes with|are now foes with}} $3', |
| 24 | + 'useractivity-friend' => '$1 {{PLURAL:$2|is now friends with|are now friends with}} $3', |
| 25 | + 'useractivity-gift' => '$1 received a gift from $2', |
| 26 | + #'useractivity-gift-sent' => 'sent a gift to', |
| 27 | + 'useractivity-group-edit' => '{{PLURAL:$1|one edit|$1 edits}}', |
| 28 | + 'useractivity-group-comment' => '{{PLURAL:$1|one comment|$1 comments}}', |
| 29 | + 'useractivity-group-user_message' => '{{PLURAL:$1|one message|$1 messages}}', |
| 30 | + 'useractivity-group-friend' => '{{PLURAL:$1|one friend|$1 friends}}', |
| 31 | + #'useractivity-filter' => 'Filter', |
28 | 32 | 'useractivity-siteactivity' => 'Site activity', |
29 | | - 'useractivity-edit' => '{{PLURAL:$1|edited the page|edited the following pages: }}', // CHECKME: message lego? |
30 | | - 'useractivity-comment' => '{{PLURAL:$1|commented on the page|commented on the following pages: }}', // CHECKME: message lego? |
31 | | - 'useractivity-user_message' => '{{PLURAL:$1|sent a message to|sent messages to}}', |
32 | | - 'useractivity-votedpage' => 'voted for the page', // FIXME: message lego |
33 | | - 'useractivity-commentedpage' => 'commented on the page', // FIXME: message lego |
34 | | - 'useractivity-giftsent' => 'sent a gift to', // FIXME: message lego |
35 | | - 'useractivity-friend' => '{{PLURAL:$2|is now friends with|are now friends with}}', // FIXME: message lego |
36 | | - 'useractivity-foe' => '{{PLURAL:$2|is now foes with|are now foes with}}', // FIXME: message lego |
| 33 | + 'useractivity-title' => "Friends' activity", |
| 34 | + 'useractivity-user_message' => '$1 {{PLURAL:$4|sent a message to|sent messages to}} $3', |
| 35 | + #'useractivity-votedpage' => 'voted for the page', |
37 | 36 | ); |
38 | 37 | |
39 | 38 | /** Finnish (Suomi) |
— | — | @@ -40,21 +39,21 @@ |
41 | 40 | */ |
42 | 41 | $messages['fi'] = array( |
43 | 42 | 'useractivity' => 'Ystävien aktiivisuus', |
44 | | - 'useractivity-award' => 'sai palkinnon', |
| 43 | + 'useractivity-award' => '$1 sai palkinnon', |
45 | 44 | 'useractivity-all' => 'Katso kaikki', |
46 | | - 'useractivity-gift' => 'sai lahjan käyttäjältä', |
47 | | - 'useractivity-group-edit' => 'muokkausta', |
48 | | - 'useractivity-group-comment' => 'kommenttia', |
49 | | - 'useractivity-group-user_message' => 'viestiä', |
50 | | - 'useractivity-group-friend' => 'ystävät', |
51 | | - 'useractivity-title' => 'Ystävien aktiivisuus', |
| 45 | + #'useractivity-comment' => '{{PLURAL:$1|kommentoi sivua|kommentoi seuraavia sivuja: }}', |
| 46 | + #'useractivity-commentedpage' => 'kommentoi sivua', |
| 47 | + 'useractivity-edit' => '$1 {{PLURAL:$2|muokkasi|muokkasivat}} {{PLURAL:$4|sivua|seuraavia sivuja:}} $3', |
| 48 | + 'useractivity-foe' => '$1 {{PLURAL:$2|on nyt vihollinen käyttäjälle|ovat nyt vihollisia käyttäjille}} $3', |
| 49 | + 'useractivity-friend' => '$1 {{PLURAL:$2|on nyt ystävä käyttäjälle|ovat nyt ystäviä käyttäjille}} $3', |
| 50 | + 'useractivity-gift' => '$1 sai lahjan käyttäjältä $2', |
| 51 | + #'useractivity-gift-sent' => 'lähetti lahjan käyttäjälle', |
| 52 | + 'useractivity-group-edit' => '{{PLURAL:$1|yksi muokkaus|$1 muokkausta}}', |
| 53 | + 'useractivity-group-comment' => '{{PLURAL:$1|yksi kommentti|$1 kommenttia}}', |
| 54 | + 'useractivity-group-user_message' => '{{PLURAL:$1|yksi viesti|$1 viestiä}}', |
| 55 | + 'useractivity-group-friend' => '{{PLURAL:$1|yksi ystävä|$1 ystävät}}', |
52 | 56 | 'useractivity-siteactivity' => 'Sivuston aktiivisuus', |
53 | | - 'useractivity-edit' => '{{PLURAL:$2|muokkasi|muokkasivat}} {{PLURAL:$1|sivua|seuraavia sivuja: }}', |
54 | | - 'useractivity-comment' => '{{PLURAL:$1|kommentoi sivua|kommentoi seuraavia sivuja: }}', |
55 | | - 'useractivity-user_message' => '{{PLURAL:$1|lähetti viestin käyttäjälle|lähetti viestejä käyttäjille}}', |
56 | | - 'useractivity-votedpage' => 'äänesti sivua', |
57 | | - 'useractivity-commentedpage' => 'kommentoi sivua', |
58 | | - 'useractivity-giftsent' => 'lähetti lahjan käyttäjälle', |
59 | | - 'useractivity-friend' => '{{PLURAL:$2|on nyt ystävä käyttäjälle|ovat nyt ystäviä käyttäjille}}', |
60 | | - 'useractivity-foe' => '{{PLURAL:$2|on nyt vihollinen käyttäjälle|ovat nyt vihollisia käyttäjille}}', |
| 57 | + 'useractivity-title' => 'Ystävien aktiivisuus', |
| 58 | + 'useractivity-user_message' => '$1 {{PLURAL:$4|lähetti viestin käyttäjälle|lähetti viestejä käyttäjille}} $3', |
| 59 | + #'useractivity-votedpage' => 'äänesti sivua', |
61 | 60 | ); |
Index: trunk/extensions/SocialProfile/UserActivity/UserActivity.php |
— | — | @@ -4,7 +4,7 @@ |
5 | 5 | * |
6 | 6 | * @file |
7 | 7 | * @ingroup Extensions |
8 | | - * @version 1.0 |
| 8 | + * @version 1.1 |
9 | 9 | * @author Aaron Wright <aaron.wright@gmail.com> |
10 | 10 | * @author David Pean <david.pean@gmail.com> |
11 | 11 | * @author Jack Phoenix <jack@countervandalism.net> |
— | — | @@ -22,9 +22,9 @@ |
23 | 23 | // Extension credits that will show up on Special:Version |
24 | 24 | $wgExtensionCredits['specialpage'][] = array( |
25 | 25 | 'name' => 'UserActivity', |
26 | | - 'version' => '1.0', |
| 26 | + 'version' => '1.1', |
| 27 | + 'author' => array( 'Aaron Wright', 'David Pean', 'Jack Phoenix' ), |
27 | 28 | 'description' => "Shows users' social activity", |
28 | | - 'author' => array( 'Aaron Wright', 'David Pean', 'Jack Phoenix' ), |
29 | 29 | 'url' => 'http://www.mediawiki.org/wiki/Extension:SocialProfile' |
30 | 30 | ); |
31 | 31 | |
Index: trunk/extensions/SocialProfile/UserActivity/UserActivityClass.php |
— | — | @@ -26,13 +26,11 @@ |
27 | 27 | var $show_system_gifts = 1; |
28 | 28 | var $show_system_messages = 1; |
29 | 29 | var $show_messages_sent = 1; |
30 | | - var $show_network_updates = 0; |
31 | 30 | |
32 | 31 | /** |
33 | 32 | * Constructor |
34 | | - * @private |
35 | 33 | */ |
36 | | - /* private */ function __construct( $username, $filter, $item_max ) { |
| 34 | + public function __construct( $username, $filter, $item_max ) { |
37 | 35 | if ( $username ) { |
38 | 36 | $title1 = Title::newFromDBkey( $username ); |
39 | 37 | $this->user_name = $title1->getText(); |
— | — | @@ -46,10 +44,18 @@ |
47 | 45 | } |
48 | 46 | |
49 | 47 | private function setFilter( $filter ) { |
50 | | - if ( strtoupper( $filter ) == 'USER' ) $this->show_current_user = true; |
51 | | - if ( strtoupper( $filter ) == 'FRIENDS' ) $this->rel_type = 1; |
52 | | - if ( strtoupper( $filter ) == 'FOES' ) $this->rel_type = 2; |
53 | | - if ( strtoupper( $filter ) == 'ALL' ) $this->show_all = true; |
| 48 | + if ( strtoupper( $filter ) == 'USER' ) { |
| 49 | + $this->show_current_user = true; |
| 50 | + } |
| 51 | + if ( strtoupper( $filter ) == 'FRIENDS' ) { |
| 52 | + $this->rel_type = 1; |
| 53 | + } |
| 54 | + if ( strtoupper( $filter ) == 'FOES' ) { |
| 55 | + $this->rel_type = 2; |
| 56 | + } |
| 57 | + if ( strtoupper( $filter ) == 'ALL' ) { |
| 58 | + $this->show_all = true; |
| 59 | + } |
54 | 60 | } |
55 | 61 | |
56 | 62 | public function setActivityToggle( $name, $value ) { |
— | — | @@ -69,14 +75,19 @@ |
70 | 76 | $user_sql = " WHERE rc_user = {$this->user_id}"; |
71 | 77 | } |
72 | 78 | |
73 | | - $sql = "SELECT UNIX_TIMESTAMP(rc_timestamp) AS item_date, rc_title, rc_user, rc_user_text, rc_comment, rc_id, rc_minor, rc_new, |
| 79 | + $sql = "SELECT UNIX_TIMESTAMP(rc_timestamp) AS item_date, rc_title, |
| 80 | + rc_user, rc_user_text, rc_comment, rc_id, rc_minor, rc_new, |
74 | 81 | rc_namespace, rc_cur_id, rc_this_oldid, rc_last_oldid |
75 | 82 | FROM {$dbr->tableName( 'recentchanges' )} |
76 | 83 | {$rel_sql} {$user_sql} |
77 | 84 | ORDER BY rc_id DESC LIMIT 0," . $this->item_max; |
78 | | - $res = $dbr->query( $sql ); |
| 85 | + $res = $dbr->query( $sql, __METHOD__ ); |
79 | 86 | |
80 | 87 | while ( $row = $dbr->fetchObject( $res ) ) { |
| 88 | + // Special pages aren't editable, so ignore 'em |
| 89 | + if ( $row->rc_namespace == NS_SPECIAL ) { |
| 90 | + continue; |
| 91 | + } |
81 | 92 | $title = Title::makeTitle( $row->rc_namespace, $row->rc_title ); |
82 | 93 | $this->items_grouped['edit'][$title->getPrefixedText()]['users'][$row->rc_user_text][] = array( |
83 | 94 | 'id' => 0, |
— | — | @@ -93,7 +104,6 @@ |
94 | 105 | |
95 | 106 | // set last timestamp |
96 | 107 | $this->items_grouped['edit'][$title->getPrefixedText()]['timestamp'] = $row->item_date; |
97 | | - // $this->items['edits'][$title->getPrefixedText()]['displayed'] = 0; |
98 | 108 | |
99 | 109 | $this->items[] = array( |
100 | 110 | 'id' => 0, |
— | — | @@ -120,17 +130,21 @@ |
121 | 131 | |
122 | 132 | $rel_sql = ''; |
123 | 133 | $user_sql = ''; |
124 | | - if ( $this->rel_type ) |
| 134 | + if ( $this->rel_type ) { |
125 | 135 | $rel_sql = " AND vote_user_id IN (SELECT r_user_id_relation FROM {$dbr->tableName( 'user_relationship' )} WHERE r_user_id={$this->user_id} AND r_type={$this->rel_type}) "; |
126 | | - if ( $this->show_current_user ) |
| 136 | + } |
| 137 | + if ( $this->show_current_user ) { |
127 | 138 | $user_sql = " AND vote_user_id = {$this->user_id}"; |
| 139 | + } |
128 | 140 | |
129 | | - $sql = "SELECT UNIX_TIMESTAMP(vote_date) AS item_date, username, page_title, vote_count, comment_count, vote_ip, vote_user_id |
| 141 | + $sql = "SELECT UNIX_TIMESTAMP(vote_date) AS item_date, username, |
| 142 | + page_title, vote_count, comment_count, vote_ip, |
| 143 | + vote_user_id |
130 | 144 | FROM {$dbr->tableName( 'Vote' )} v, {$dbr->tableName( 'page' )} p |
131 | 145 | WHERE v.vote_page_id=p.page_id |
132 | 146 | {$rel_sql} {$user_sql} |
133 | 147 | ORDER BY vote_date DESC LIMIT 0," . $this->item_max; |
134 | | - $res = $dbr->query( $sql ); |
| 148 | + $res = $dbr->query( $sql, __METHOD__ ); |
135 | 149 | while ( $row = $dbr->fetchObject( $res ) ) { |
136 | 150 | $username = $row->username; |
137 | 151 | $this->items[] = array( |
— | — | @@ -167,17 +181,19 @@ |
168 | 182 | $user_sql = "AND Comment_user_id = {$this->user_id}"; |
169 | 183 | } |
170 | 184 | |
171 | | - $sql = "SELECT UNIX_TIMESTAMP(comment_date) AS item_date, Comment_Username, Comment_IP, page_title, Comment_Text, Comment_user_id, page_namespace, CommentID |
| 185 | + $sql = "SELECT UNIX_TIMESTAMP(comment_date) AS item_date, |
| 186 | + Comment_Username, Comment_IP, page_title, Comment_Text, |
| 187 | + Comment_user_id, page_namespace, CommentID |
172 | 188 | FROM {$dbr->tableName( 'Comments' )} c, {$dbr->tableName( 'page' )} p |
173 | 189 | WHERE c.comment_page_id=p.page_id |
174 | 190 | {$rel_sql} {$user_sql} |
175 | 191 | ORDER BY comment_date DESC LIMIT 0," . $this->item_max; |
176 | 192 | |
177 | | - $res = $dbr->query( $sql ); |
178 | | - global $wgFilterComments; |
| 193 | + $res = $dbr->query( $sql, __METHOD__ ); |
179 | 194 | while ( $row = $dbr->fetchObject( $res ) ) { |
180 | 195 | $show_comment = true; |
181 | 196 | |
| 197 | + global $wgFilterComments; |
182 | 198 | if ( $wgFilterComments ) { |
183 | 199 | if ( $row->vote_count <= 4 ) { |
184 | 200 | $show_comment = false; |
— | — | @@ -224,16 +240,21 @@ |
225 | 241 | $rel_sql = ''; |
226 | 242 | $user_sql = ''; |
227 | 243 | |
228 | | - if( $this->rel_type ) |
| 244 | + if( $this->rel_type ) { |
229 | 245 | $rel_sql = "WHERE ug_user_id_to IN (SELECT r_user_id_relation FROM {$dbr->tableName( 'user_relationship' )} WHERE r_user_id={$this->user_id} AND r_type={$this->rel_type})"; |
230 | | - if( $this->show_current_user ) |
| 246 | + } |
| 247 | + if( $this->show_current_user ) { |
231 | 248 | $user_sql = "WHERE ug_user_id_from = {$this->user_id}"; |
| 249 | + } |
232 | 250 | |
233 | | - $sql = "SELECT ug_id, ug_user_id_from, ug_user_name_from, ug_user_id_to, ug_user_name_to, UNIX_TIMESTAMP(ug_date) AS item_date,gift_name, gift_id |
234 | | - FROM {$dbr->tableName( 'user_gift' )} INNER JOIN {$dbr->tableName( 'gift' )} ON gift_id = ug_gift_id |
| 251 | + $sql = "SELECT ug_id, ug_user_id_from, ug_user_name_from, |
| 252 | + ug_user_id_to, ug_user_name_to, |
| 253 | + UNIX_TIMESTAMP(ug_date) AS item_date, gift_name, gift_id |
| 254 | + FROM {$dbr->tableName( 'user_gift' )} |
| 255 | + INNER JOIN {$dbr->tableName( 'gift' )} ON gift_id = ug_gift_id |
235 | 256 | {$rel_sql} {$user_sql} |
236 | 257 | ORDER BY ug_id DESC LIMIT 0,{$this->item_max}"; |
237 | | - $res = $dbr->query( $sql ); |
| 258 | + $res = $dbr->query( $sql, __METHOD__ ); |
238 | 259 | while ( $row = $dbr->fetchObject( $res ) ) { |
239 | 260 | $this->items[] = array( |
240 | 261 | 'id' => $row->ug_id, |
— | — | @@ -263,11 +284,14 @@ |
264 | 285 | $user_sql = "WHERE ug_user_id_to = {$this->user_id}"; |
265 | 286 | } |
266 | 287 | |
267 | | - $sql = "SELECT ug_id, ug_user_id_from, ug_user_name_from, ug_user_id_to, ug_user_name_to, UNIX_TIMESTAMP(ug_date) AS item_date,gift_name, gift_id |
268 | | - FROM {$dbr->tableName( 'user_gift' )} INNER JOIN {$dbr->tableName( 'gift' )} ON gift_id = ug_gift_id |
| 288 | + $sql = "SELECT ug_id, ug_user_id_from, ug_user_name_from, |
| 289 | + ug_user_id_to, ug_user_name_to, |
| 290 | + UNIX_TIMESTAMP(ug_date) AS item_date, gift_name, gift_id |
| 291 | + FROM {$dbr->tableName( 'user_gift' )} |
| 292 | + INNER JOIN {$dbr->tableName( 'gift' )} ON gift_id = ug_gift_id |
269 | 293 | {$rel_sql} {$user_sql} |
270 | 294 | ORDER BY ug_id DESC LIMIT 0,{$this->item_max}"; |
271 | | - $res = $dbr->query( $sql ); |
| 295 | + $res = $dbr->query( $sql, __METHOD__ ); |
272 | 296 | while ( $row = $dbr->fetchObject( $res ) ) { |
273 | 297 | global $wgUploadPath; |
274 | 298 | $user_title = Title::makeTitle( NS_USER, $row->ug_user_name_to ); |
— | — | @@ -276,8 +300,11 @@ |
277 | 301 | $gift_image = '<img src="' . $wgUploadPath . '/awards/' . Gifts::getGiftImage( $row->gift_id, 'm' ) . '" border="0" alt="" />'; |
278 | 302 | $view_gift_link = SpecialPage::getTitleFor( 'ViewGift' ); |
279 | 303 | |
280 | | - $html = wfMsg( 'useractivity-gift' ) . ' ' . "<a href=\"{$user_title_from->escapeFullURL()}\" rel=\"nofollow\">{$user_title_from->getText()}</a> |
281 | | - <div class=\"item\"> |
| 304 | + $html = wfMsg( 'useractivity-gift', |
| 305 | + "<b><a href=\"{$user_title->escapeFullURL()}\">{$row->ug_user_name_to}</a></b>", |
| 306 | + "<a href=\"{$user_title_from->escapeFullURL()}\">{$user_title_from->getText()}</a>" |
| 307 | + ) . |
| 308 | + "<div class=\"item\"> |
282 | 309 | <a href=\"" . $view_gift_link->escapeFullURL( 'gift_id=' . $row->ug_id ) . "\" rel=\"nofollow\"> |
283 | 310 | {$gift_image} |
284 | 311 | {$row->gift_name} |
— | — | @@ -287,7 +314,7 @@ |
288 | 315 | $this->activityLines[] = array( |
289 | 316 | 'type' => 'gift-rec', |
290 | 317 | 'timestamp' => $row->item_date, |
291 | | - 'data' => "<b><a href=\"{$user_title->escapeFullURL()}\">{$row->ug_user_name_to}</a></b> {$html}" |
| 318 | + 'data' => ' ' . $html |
292 | 319 | ); |
293 | 320 | |
294 | 321 | $this->items[] = array( |
— | — | @@ -318,20 +345,22 @@ |
319 | 346 | $user_sql = "WHERE sg_user_id = {$this->user_id}"; |
320 | 347 | } |
321 | 348 | |
322 | | - $sql = "SELECT sg_id, sg_user_id, sg_user_name, UNIX_TIMESTAMP(sg_date) AS item_date,gift_name, gift_id |
323 | | - FROM {$dbr->tableName( 'user_system_gift' )} INNER JOIN {$dbr->tableName( 'system_gift' )} ON gift_id = sg_gift_id |
| 349 | + $sql = "SELECT sg_id, sg_user_id, sg_user_name, |
| 350 | + UNIX_TIMESTAMP(sg_date) AS item_date, gift_name, gift_id |
| 351 | + FROM {$dbr->tableName( 'user_system_gift' )} |
| 352 | + INNER JOIN {$dbr->tableName( 'system_gift' )} ON gift_id = sg_gift_id |
324 | 353 | {$rel_sql} {$user_sql} |
325 | 354 | ORDER BY sg_id DESC LIMIT 0,{$this->item_max}"; |
326 | | - $res = $dbr->query( $sql ); |
| 355 | + $res = $dbr->query( $sql, __METHOD__ ); |
327 | 356 | while ( $row = $dbr->fetchObject( $res ) ) { |
328 | 357 | global $wgUploadPath; |
329 | 358 | $user_title = Title::makeTitle( NS_USER, $row->sg_user_name ); |
330 | 359 | $system_gift_image = '<img src="' . $wgUploadPath . '/awards/' . SystemGifts::getGiftImage( $row->gift_id, 'm' ) . '" border="0" alt="" />'; |
331 | 360 | $system_gift_link = SpecialPage::getTitleFor( 'ViewSystemGift' ); |
332 | 361 | |
333 | | - $html = wfMsg( 'useractivity-award' ) . " |
334 | | - <div class=\"item\"> |
335 | | - <a href=\"" . $system_gift_link->escapeFullURL( 'gift_id=' . $row->sg_id ) . "\" rel=\"nofollow\"> |
| 362 | + $html = wfMsg( 'useractivity-award', "<b><a href=\"{$user_title->escapeFullURL()}\">{$row->sg_user_name}</a></b>" ) . |
| 363 | + '<div class="item"> |
| 364 | + <a href="' . $system_gift_link->escapeFullURL( 'gift_id=' . $row->sg_id ) . "\" rel=\"nofollow\"> |
336 | 365 | {$system_gift_image} |
337 | 366 | {$row->gift_name} |
338 | 367 | </a> |
— | — | @@ -340,7 +369,7 @@ |
341 | 370 | $this->activityLines[] = array( |
342 | 371 | 'type' => 'system_gift', |
343 | 372 | 'timestamp' => $row->item_date, |
344 | | - 'data' => "<b><a href=\"{$user_title->escapeFullURL()}\">{$row->sg_user_name}</a></b> {$html}" |
| 373 | + 'data' => ' ' . $html |
345 | 374 | ); |
346 | 375 | |
347 | 376 | $this->items[] = array( |
— | — | @@ -374,7 +403,7 @@ |
375 | 404 | FROM {$dbr->tableName( 'user_relationship' )} |
376 | 405 | {$rel_sql} {$user_sql} |
377 | 406 | ORDER BY r_id DESC LIMIT 0,{$this->item_max}"; |
378 | | - $res = $dbr->query( $sql ); |
| 407 | + $res = $dbr->query( $sql, __METHOD__ ); |
379 | 408 | |
380 | 409 | while ( $row = $dbr->fetchObject( $res ) ) { |
381 | 410 | if ( $row->r_type == 1 ) { |
— | — | @@ -384,10 +413,10 @@ |
385 | 414 | } |
386 | 415 | |
387 | 416 | $user_name_short = substr( $row->r_user_name, 0, 25 ); |
388 | | - if ( $row->r_user_name != $user_name_short ) |
| 417 | + if ( $row->r_user_name != $user_name_short ) { |
389 | 418 | $user_name_short .= '...'; |
| 419 | + } |
390 | 420 | |
391 | | - // $title = Title::makeTitle( $row->page_namespace, $row->page_title ); |
392 | 421 | $this->items_grouped[$r_type][$row->r_user_name_relation]['users'][$row->r_user_name][] = array( |
393 | 422 | 'id' => $row->r_id, |
394 | 423 | 'type' => $r_type, |
— | — | @@ -432,13 +461,20 @@ |
433 | 462 | $user_sql = " ub_user_id_from = {$this->user_id} AND"; |
434 | 463 | } |
435 | 464 | |
436 | | - $sql = "SELECT ub_id, ub_user_id, ub_user_name, ub_user_id_from, ub_user_name_from, UNIX_TIMESTAMP(ub_date) AS item_date, ub_message |
| 465 | + $sql = "SELECT ub_id, ub_user_id, ub_user_name, ub_user_id_from, |
| 466 | + ub_user_name_from, UNIX_TIMESTAMP(ub_date) AS item_date, |
| 467 | + ub_message |
437 | 468 | FROM {$dbr->tableName( 'user_board' )} WHERE |
438 | 469 | {$rel_sql} {$user_sql} ub_type=0 |
439 | 470 | ORDER BY ub_id DESC LIMIT 0,{$this->item_max}"; |
440 | 471 | |
441 | | - $res = $dbr->query( $sql ); |
| 472 | + $res = $dbr->query( $sql, __METHOD__ ); |
442 | 473 | while ( $row = $dbr->fetchObject( $res ) ) { |
| 474 | + // Ignore nonexistent (for example, renamed) users |
| 475 | + $uid = User::idFromName( $row->ub_user_name ); |
| 476 | + if ( !$uid ) { |
| 477 | + continue; |
| 478 | + } |
443 | 479 | |
444 | 480 | $this->items_grouped['user_message'][stripslashes( $row->ub_user_name )]['users'][stripslashes( $row->ub_user_name_from )][] = array( |
445 | 481 | 'id' => $row->ub_id, |
— | — | @@ -488,16 +524,17 @@ |
489 | 525 | FROM {$dbr->tableName( 'user_system_messages' )} |
490 | 526 | {$rel_sql} {$user_sql} |
491 | 527 | ORDER BY um_id DESC LIMIT 0,{$this->item_max}"; |
492 | | - $res = $dbr->query( $sql ); |
| 528 | + $res = $dbr->query( $sql, __METHOD__ ); |
493 | 529 | while ( $row = $dbr->fetchObject( $res ) ) { |
494 | 530 | $user_title = Title::makeTitle( NS_USER, $row->um_user_name ); |
495 | 531 | $user_name_short = substr( $row->um_user_name, 0, 15 ); |
496 | | - if ( $row->um_user_name != $user_name_short ) |
| 532 | + if ( $row->um_user_name != $user_name_short ) { |
497 | 533 | $user_name_short .= '...'; |
| 534 | + } |
498 | 535 | $this->activityLines[] = array( |
499 | 536 | 'type' => 'system_message', |
500 | 537 | 'timestamp' => $row->item_date, |
501 | | - 'data' => "<b><a href=\"{$user_title->escapeFullURL()}\">{$user_name_short}</a></b> {$row->um_message}" |
| 538 | + 'data' => ' ' . "<b><a href=\"{$user_title->escapeFullURL()}\">{$user_name_short}</a></b> {$row->um_message}" |
502 | 539 | ); |
503 | 540 | |
504 | 541 | $this->items[] = array( |
— | — | @@ -515,67 +552,6 @@ |
516 | 553 | } |
517 | 554 | } |
518 | 555 | |
519 | | - /** |
520 | | - * Retrieves sport network updates from the database (for ArmchairGM) |
521 | | - */ |
522 | | - private function setNetworkUpdates() { |
523 | | - $dbr = wfGetDB( DB_SLAVE ); |
524 | | - if ( $this->rel_type ) |
525 | | - $rel_sql = " WHERE us_user_id IN (SELECT r_user_id_relation FROM {$dbr->tableName( 'user_relationship' )} WHERE r_user_id={$this->user_id} AND r_type={$this->rel_type} )"; |
526 | | - if ( $this->show_current_user ) |
527 | | - $user_sql = " WHERE us_user_id = {$this->user_id}"; |
528 | | - $sql = "SELECT us_id, us_user_id, us_user_name, us_text, UNIX_TIMESTAMP(us_date) AS item_date, |
529 | | - us_sport_id, us_team_id |
530 | | - FROM {$dbr->tableName( 'user_status' )} |
531 | | - {$rel_sql} {$user_sql} |
532 | | - ORDER BY us_id DESC LIMIT 0,{$this->item_max}"; |
533 | | - $res = $dbr->query( $sql ); |
534 | | - while ( $row = $dbr->fetchObject( $res ) ) { |
535 | | - if ( $row->us_team_id ) { |
536 | | - $team = SportsTeams::getTeam( $row->us_team_id ); |
537 | | - $network_name = $team['name']; |
538 | | - } else { |
539 | | - $sport = SportsTeams::getSport( $row->us_sport_id ); |
540 | | - $network_name = $sport['name']; |
541 | | - } |
542 | | - $this->items[] = array( |
543 | | - 'id' => $row->us_id, |
544 | | - 'type' => 'network_update', |
545 | | - 'timestamp' => $row->item_date, |
546 | | - 'pagetitle' => '', |
547 | | - 'namespace' => '', |
548 | | - 'username' => $row->us_user_name, |
549 | | - 'userid' => $row->us_user_id, |
550 | | - 'comment' => $row->us_text, |
551 | | - 'sport_id' => $row->us_sport_id, |
552 | | - 'team_id' => $row->us_team_id, |
553 | | - 'network' => $network_name |
554 | | - ); |
555 | | - |
556 | | - $user_title = Title::makeTitle( NS_USER, $row->us_user_name ); |
557 | | - $user_name_short = substr( $row->us_user_name, 0, 15 ); |
558 | | - if ( $row->us_user_name != $user_name_short ) |
559 | | - $user_name_short .= '...'; |
560 | | - $page_link = '<a href="' . SportsTeams::getNetworkURL( $row->us_sport_id, $row->us_team_id ) . "\" rel=\"nofollow\">{$network_name}</a> "; |
561 | | - $network_image = SportsTeams::getLogo( $row->us_sport_id, $row->us_team_id, 's' ); |
562 | | - |
563 | | - $html = wfMsg( 'useractivity-network-thought', $page_link ) . ' |
564 | | - <div class="item"> |
565 | | - <a href="' . SportsTeams::getNetworkURL( $row->us_sport_id, $row->us_team_id ) . "\" rel=\"nofollow\"> |
566 | | - {$network_image} |
567 | | - \"{$row->us_text}\" |
568 | | - </a> |
569 | | - </div>"; |
570 | | - |
571 | | - $this->activityLines[] = array( |
572 | | - 'type' => 'network_update', |
573 | | - 'timestamp' => $row->item_date, |
574 | | - 'data' => "<b><a href=\"{$user_title->escapeFullURL()}\">{$user_name_short}</a></b> {$html}" |
575 | | - ); |
576 | | - |
577 | | - } |
578 | | - } |
579 | | - |
580 | 556 | public function getEdits() { |
581 | 557 | $this->setEdits(); |
582 | 558 | return $this->items; |
— | — | @@ -621,43 +597,66 @@ |
622 | 598 | return $this->items; |
623 | 599 | } |
624 | 600 | |
625 | | - public function getNetworkUpdates() { |
626 | | - $this->setNetworkUpdates(); |
627 | | - return $this->items; |
628 | | - } |
629 | | - |
630 | 601 | public function getActivityList() { |
631 | | - if ( $this->show_edits ) $this->setEdits(); |
632 | | - if ( $this->show_votes ) $this->setVotes(); |
633 | | - if ( $this->show_comments ) $this->setComments(); |
634 | | - if ( $this->show_gifts_sent ) $this->setGiftsSent(); |
635 | | - if ( $this->show_gifts_rec ) $this->setGiftsRec(); |
636 | | - if ( $this->show_relationships ) $this->setRelationships(); |
637 | | - if ( $this->show_system_messages ) $this->getSystemMessages(); |
638 | | - if ( $this->show_system_gifts ) $this->getSystemGiftsRec(); |
639 | | - if ( $this->show_messages_sent ) $this->getMessagesSent(); |
640 | | - if ( $this->show_network_updates ) $this->getNetworkUpdates(); |
| 602 | + if ( $this->show_edits ) { |
| 603 | + $this->setEdits(); |
| 604 | + } |
| 605 | + if ( $this->show_votes ) { |
| 606 | + $this->setVotes(); |
| 607 | + } |
| 608 | + if ( $this->show_comments ) { |
| 609 | + $this->setComments(); |
| 610 | + } |
| 611 | + if ( $this->show_gifts_sent ) { |
| 612 | + $this->setGiftsSent(); |
| 613 | + } |
| 614 | + if ( $this->show_gifts_rec ) { |
| 615 | + $this->setGiftsRec(); |
| 616 | + } |
| 617 | + if ( $this->show_relationships ) { |
| 618 | + $this->setRelationships(); |
| 619 | + } |
| 620 | + if ( $this->show_system_messages ) { |
| 621 | + $this->getSystemMessages(); |
| 622 | + } |
| 623 | + if ( $this->show_system_gifts ) { |
| 624 | + $this->getSystemGiftsRec(); |
| 625 | + } |
| 626 | + if ( $this->show_messages_sent ) { |
| 627 | + $this->getMessagesSent(); |
| 628 | + } |
641 | 629 | |
642 | | - if ( $this->items ) |
| 630 | + if ( $this->items ) { |
643 | 631 | usort( $this->items, array( 'UserActivity', 'sortItems' ) ); |
| 632 | + } |
644 | 633 | return $this->items; |
645 | 634 | } |
646 | 635 | |
647 | 636 | public function getActivityListGrouped() { |
648 | 637 | $this->getActivityList(); |
649 | 638 | |
650 | | - if ( $this->show_edits ) $this->simplifyPageActivity( 'edit' ); |
651 | | - if ( $this->show_comments ) $this->simplifyPageActivity( 'comment' ); |
652 | | - if ( $this->show_relationships ) $this->simplifyPageActivity( 'friend' ); |
653 | | - if ( $this->show_relationships ) $this->simplifyPageActivity( 'foe' ); |
654 | | - if ( $this->show_messages_sent ) $this->simplifyPageActivity( 'user_message' ); |
655 | | - // if( $this->show_system_messages ) $this->simplifyPageActivity( 'system_messages', false ); |
| 639 | + if ( $this->show_edits ) { |
| 640 | + $this->simplifyPageActivity( 'edit' ); |
| 641 | + } |
| 642 | + if ( $this->show_comments ) { |
| 643 | + $this->simplifyPageActivity( 'comment' ); |
| 644 | + } |
| 645 | + if ( $this->show_relationships ) { |
| 646 | + $this->simplifyPageActivity( 'friend' ); |
| 647 | + } |
| 648 | + if ( $this->show_relationships ) { |
| 649 | + $this->simplifyPageActivity( 'foe' ); |
| 650 | + } |
| 651 | + if ( $this->show_messages_sent ) { |
| 652 | + $this->simplifyPageActivity( 'user_message' ); |
| 653 | + } |
656 | 654 | |
657 | 655 | if ( !isset( $this->activityLines ) ) { |
658 | 656 | $this->activityLines = array(); |
659 | 657 | } |
660 | | - if ( isset( $this->activityLines ) && is_array( $this->activityLines ) ) |
| 658 | + if ( isset( $this->activityLines ) && is_array( $this->activityLines ) ) { |
661 | 659 | usort( $this->activityLines, array( 'UserActivity', 'sortItems' ) ); |
| 660 | + } |
662 | 661 | return $this->activityLines; |
663 | 662 | } |
664 | 663 | |
— | — | @@ -689,12 +688,11 @@ |
690 | 689 | $count_actions = count( $action ); |
691 | 690 | |
692 | 691 | if ( $has_page && !isset( $this->displayed[$type][$page_name] ) ) { |
| 692 | + $this->displayed[$type][$page_name] = 1; |
693 | 693 | |
694 | | - $this->displayed[ $type ][ $page_name ] = 1; |
695 | | - |
696 | 694 | $pages .= " <a href=\"{$page_title->escapeFullURL()}\">{$page_name}</a>"; |
697 | 695 | if ( $count_users == 1 && $count_actions > 1 ) { |
698 | | - $pages .= " ($count_actions " . wfMsg( "useractivity-group-{$type}" ) . ")"; |
| 696 | + $pages .= ' (' . wfMsgExt( "useractivity-group-{$type}", 'parsemag', $count_actions ) . ')'; |
699 | 697 | } |
700 | 698 | $pages_count++; |
701 | 699 | } |
— | — | @@ -703,25 +701,31 @@ |
704 | 702 | // see if we can stack any other singles |
705 | 703 | if ( $count_users == 1 ) { |
706 | 704 | foreach ( $this->items_grouped[$type] as $page_name2 => $page_data2 ) { |
707 | | - |
708 | | - if ( !isset( $this->displayed[$type][$page_name2] ) && count( $page_data2['users'] ) == 1 ) { |
709 | | - |
| 705 | + if ( !isset( $this->displayed[$type][$page_name2] ) && |
| 706 | + count( $page_data2['users'] ) == 1 |
| 707 | + ) { |
710 | 708 | foreach ( $page_data2['users'] as $user_name2 => $action2 ) { |
711 | | - |
712 | 709 | if ( $user_name2 == $user_name && $pages_count < 5 ) { |
713 | 710 | $count_actions2 = count( $action2 ); |
714 | 711 | |
715 | | - if ( $type == 'friend' || $type == 'foe' || $type == 'user_message' ) { |
| 712 | + if ( |
| 713 | + $type == 'friend' || |
| 714 | + $type == 'foe' || |
| 715 | + $type == 'user_message' |
| 716 | + ) { |
716 | 717 | $page_title2 = Title::newFromText( 'User:' . $page_name2 ); |
717 | 718 | } else { |
718 | 719 | $page_title2 = Title::newFromText( $page_name2 ); |
719 | 720 | } |
720 | 721 | |
721 | | - if ( $pages ) |
722 | | - $pages .= ", "; |
723 | | - $pages .= ( ( $page_title2 instanceOf Title ) ? " <a href=\"{$page_title2->escapeFullURL()}\">{$page_name2}</a>" : '' ); |
| 722 | + if ( $pages ) { |
| 723 | + $pages .= ', '; |
| 724 | + } |
| 725 | + if ( $page_title2 instanceof Title ) { |
| 726 | + $pages .= " <a href=\"{$page_title2->escapeFullURL()}\">{$page_name2}</a>"; |
| 727 | + } |
724 | 728 | if ( $count_actions2 > 1 ) { |
725 | | - $pages .= " ($count_actions2 " . wfMsg( "useractivity-group-{$type}" ) . ")"; |
| 729 | + $pages .= ' (' . wfMsg( "useractivity-group-{$type}", $count_actions2 ) . ')'; |
726 | 730 | } |
727 | 731 | $pages_count++; |
728 | 732 | |
— | — | @@ -734,15 +738,18 @@ |
735 | 739 | |
736 | 740 | $user_index++; |
737 | 741 | |
738 | | - if ( $users && $count_users > 2 ) |
| 742 | + if ( $users && $count_users > 2 ) { |
739 | 743 | $users .= ', '; |
740 | | - if ( $user_index == $count_users && $count_users > 1 ) |
| 744 | + } |
| 745 | + if ( $user_index == $count_users && $count_users > 1 ) { |
741 | 746 | $users .= wfMsg( 'and' ); |
| 747 | + } |
742 | 748 | |
743 | 749 | $user_title = Title::makeTitle( NS_USER, $user_name ); |
744 | 750 | $user_name_short = substr( $user_name, 0, 15 ); |
745 | | - if ( $user_name != $user_name_short ) |
| 751 | + if ( $user_name != $user_name_short ) { |
746 | 752 | $user_name_short .= '...'; |
| 753 | + } |
747 | 754 | |
748 | 755 | $users .= " <b><a href=\"{$user_title->escapeFullURL()}\">{$user_name_short}</a></b>"; |
749 | 756 | } |
— | — | @@ -750,7 +757,10 @@ |
751 | 758 | $this->activityLines[] = array( |
752 | 759 | 'type' => $type, |
753 | 760 | 'timestamp' => $page_data['timestamp'], |
754 | | - 'data' => $users . ' ' . wfMsgExt( "useractivity-{$type}", 'parsemag', $pages_count, $count_users ) . $pages |
| 761 | + 'data' => wfMsgExt( |
| 762 | + "useractivity-{$type}", 'parsemag', |
| 763 | + $users, $count_users, $pages, $pages_count |
| 764 | + ) |
755 | 765 | ); |
756 | 766 | } |
757 | 767 | } |
— | — | @@ -772,18 +782,12 @@ |
773 | 783 | return 'addedFriendIcon.png'; |
774 | 784 | case 'foe': |
775 | 785 | return 'addedFoeIcon.png'; |
776 | | - case 'challenge_sent': |
777 | | - return 'challengeIcon.png'; |
778 | | - case 'challenge_rec': |
779 | | - return 'challengeIcon.png'; |
780 | 786 | case 'system_message': |
781 | 787 | return 'challengeIcon.png'; |
782 | 788 | case 'system_gift': |
783 | 789 | return 'awardIcon.png'; |
784 | 790 | case 'user_message': |
785 | 791 | return 'emailIcon.gif'; |
786 | | - case 'network_update': |
787 | | - return 'note.gif'; |
788 | 792 | } |
789 | 793 | } |
790 | 794 | |
— | — | @@ -791,10 +795,10 @@ |
792 | 796 | if ( !$comment ) { |
793 | 797 | return ''; |
794 | 798 | } else { |
795 | | - $comment = str_replace( "<", "<", $comment ); |
796 | | - $comment = str_replace( ">", ">", $comment ); |
797 | | - $comment = str_replace( "&", "%26", $comment ); |
798 | | - $comment = str_replace( "%26quot;", "\"", $comment ); |
| 799 | + $comment = str_replace( '<', '<', $comment ); |
| 800 | + $comment = str_replace( '>', '>', $comment ); |
| 801 | + $comment = str_replace( '&', '%26', $comment ); |
| 802 | + $comment = str_replace( '%26quot;', "\"", $comment ); |
799 | 803 | } |
800 | 804 | $preview = substr( $comment, 0, 75 ); |
801 | 805 | if ( $preview != $comment ) { |
— | — | @@ -803,10 +807,10 @@ |
804 | 808 | return stripslashes( $preview ); |
805 | 809 | } |
806 | 810 | |
807 | | - private static function sortItems( $x, $y ){ |
808 | | - if( $x['timestamp'] == $y['timestamp'] ){ |
| 811 | + private static function sortItems( $x, $y ) { |
| 812 | + if( $x['timestamp'] == $y['timestamp'] ) { |
809 | 813 | return 0; |
810 | | - } else if ( $x['timestamp'] > $y['timestamp'] ) { |
| 814 | + } elseif ( $x['timestamp'] > $y['timestamp'] ) { |
811 | 815 | return - 1; |
812 | 816 | } else { |
813 | 817 | return 1; |
Index: trunk/extensions/SocialProfile/UserActivity/SiteActivityHook.php |
— | — | @@ -7,30 +7,36 @@ |
8 | 8 | die( "Not a valid entry point.\n" ); |
9 | 9 | } |
10 | 10 | |
11 | | - |
12 | 11 | $wgHooks['ParserFirstCallInit'][] = 'wfSiteActivity'; |
| 12 | +/** |
| 13 | + * Register <siteactivity> hook with the Parser |
| 14 | + * @param $parser Object: instance of Parser |
| 15 | + * @return true |
| 16 | + */ |
13 | 17 | function wfSiteActivity( &$parser ) { |
14 | 18 | $parser->setHook( 'siteactivity', 'getSiteActivity' ); |
15 | 19 | return true; |
16 | 20 | } |
17 | 21 | |
18 | | -function getSiteActivity( $input, $args, &$parser ) { |
| 22 | +function getSiteActivity( $input, $args, $parser ) { |
19 | 23 | global $wgMemc, $wgScriptPath; |
20 | 24 | |
21 | 25 | $parser->disableCache(); |
22 | 26 | |
23 | 27 | $limit = ( isset( $args['limit'] ) && is_numeric( $args['limit'] ) ) ? $args['limit'] : 10; |
24 | 28 | |
| 29 | + // so that <siteactivity limit=5 /> will return 5 items instead of 4... |
| 30 | + $fixedLimit = $limit + 1; |
| 31 | + |
25 | 32 | wfLoadExtensionMessages( 'UserActivity' ); |
26 | 33 | |
27 | | - $key = wfMemcKey( 'site_activity', 'all', $limit ); |
| 34 | + $key = wfMemcKey( 'site_activity', 'all', $fixedLimit ); |
28 | 35 | $data = $wgMemc->get( $key ); |
29 | 36 | if ( !$data ) { |
30 | 37 | wfDebug( "Got site activity from DB\n" ); |
31 | | - $rel = new UserActivity( '', 'ALL', $limit ); |
| 38 | + $rel = new UserActivity( '', 'ALL', $fixedLimit ); |
32 | 39 | |
33 | 40 | $rel->setActivityToggle( 'show_votes', 0 ); |
34 | | - $rel->setActivityToggle( 'show_network_updates', 0 ); |
35 | 41 | $activity = $rel->getActivityListGrouped(); |
36 | 42 | $wgMemc->set( $key, $activity, 60 * 2 ); |
37 | 43 | } else { |
— | — | @@ -40,15 +46,17 @@ |
41 | 47 | |
42 | 48 | $output = ''; |
43 | 49 | if ( $activity ) { |
| 50 | + $output .= '<div class="mp-site-activity"> |
| 51 | + <h2>' . wfMsg( 'useractivity-siteactivity' ) . '</h2>'; |
44 | 52 | |
45 | | - $output .= '<div class="mp-site-activity"><h2>' . wfMsg( 'useractivity-siteactivity' ) . '</h2>'; |
46 | | - |
47 | 53 | $x = 1; |
48 | 54 | foreach ( $activity as $item ) { |
49 | | - if ( $x < $limit ) { |
50 | | - $output .= '<div class="mp-activity' . ( ( $x == $limit ) ? ' mp-activity-boarder-fix' : '' ) . '"> |
51 | | - <img src="' . $wgScriptPath . '/extensions/SocialProfile/images/' . UserActivity::getTypeIcon( $item['type'] ) . '" alt="' . UserActivity::getTypeIcon( $item['type'] ) . '" border="0" />' |
52 | | - . $item['data'] . '</div>'; |
| 55 | + if ( $x < $fixedLimit ) { |
| 56 | + $typeIcon = UserActivity::getTypeIcon( $item['type'] ); |
| 57 | + $output .= '<div class="mp-activity' . ( ( $x == $fixedLimit ) ? ' mp-activity-boarder-fix' : '' ) . '"> |
| 58 | + <img src="' . $wgScriptPath . '/extensions/SocialProfile/images/' . $typeIcon . '" alt="' . $typeIcon . '" border="0" />' |
| 59 | + . $item['data'] . |
| 60 | + '</div>'; |
53 | 61 | $x++; |
54 | 62 | } |
55 | 63 | } |
Index: trunk/extensions/SocialProfile/UserActivity/UserActivity.body.php |
— | — | @@ -15,7 +15,7 @@ |
16 | 16 | * @param $par Mixed: parameter passed to the page or null |
17 | 17 | */ |
18 | 18 | public function execute( $par ) { |
19 | | - global $wgUser, $wgOut, $wgRequest, $wgSitename, $wgScriptPath; |
| 19 | + global $wgUser, $wgOut, $wgRequest, $wgScriptPath; |
20 | 20 | |
21 | 21 | wfLoadExtensionMessages( 'UserActivity' ); |
22 | 22 | |
— | — | @@ -30,42 +30,60 @@ |
31 | 31 | $rel_type = $wgRequest->getVal( 'rel_type' ); |
32 | 32 | $item_type = $wgRequest->getVal( 'item_type' ); |
33 | 33 | |
34 | | - if ( !$rel_type ) $rel_type = 1; |
35 | | - if ( !$item_type ) $item_type = 'all'; |
| 34 | + if ( !$rel_type ) { |
| 35 | + $rel_type = 1; |
| 36 | + } |
| 37 | + if ( !$item_type ) { |
| 38 | + $item_type = 'all'; |
| 39 | + } |
36 | 40 | |
37 | | - if ( $item_type == 'edits' || $item_type == 'all' ) $edits = 1; |
38 | | - if ( $item_type == 'votes' || $item_type == 'all' ) $votes = 0; |
39 | | - if ( $item_type == 'comments' || $item_type == 'all' ) $comments = 1; |
40 | | - if ( $item_type == 'gifts' || $item_type == 'all' ) $gifts = 1; |
41 | | - if ( $item_type == 'relationships' || $item_type == 'all' ) $relationships = 1; |
42 | | - if ( $item_type == 'advancements' || $item_type == 'all' ) $messages = 1; |
43 | | - if ( $item_type == 'awards' || $item_type == 'all' ) $system_gifts = 1; |
44 | | - if ( $item_type == 'messages' || $item_type == 'all' ) $messages_sent = 1; |
45 | | - if ( $item_type == 'thoughts' || $item_type == 'all' ) $network_updates = 1; |
| 41 | + if ( $item_type == 'edits' || $item_type == 'all' ) { |
| 42 | + $edits = 1; |
| 43 | + } |
| 44 | + if ( $item_type == 'votes' || $item_type == 'all' ) { |
| 45 | + $votes = 0; |
| 46 | + } |
| 47 | + if ( $item_type == 'comments' || $item_type == 'all' ) { |
| 48 | + $comments = 1; |
| 49 | + } |
| 50 | + if ( $item_type == 'gifts' || $item_type == 'all' ) { |
| 51 | + $gifts = 1; |
| 52 | + } |
| 53 | + if ( $item_type == 'relationships' || $item_type == 'all' ) { |
| 54 | + $relationships = 1; |
| 55 | + } |
| 56 | + if ( $item_type == 'advancements' || $item_type == 'all' ) { |
| 57 | + $messages = 1; |
| 58 | + } |
| 59 | + if ( $item_type == 'awards' || $item_type == 'all' ) { |
| 60 | + $system_gifts = 1; |
| 61 | + } |
| 62 | + if ( $item_type == 'messages' || $item_type == 'all' ) { |
| 63 | + $messages_sent = 1; |
| 64 | + } |
46 | 65 | |
47 | 66 | /* |
48 | 67 | $output .= '<div class="user-home-links-container"> |
49 | | - <h2>' . wfMsg('useractivity-filter') . '</h2> |
| 68 | + <h2>' . wfMsg( 'useractivity-filter' ) . '</h2> |
50 | 69 | <div class="user-home-links">'; |
51 | 70 | |
52 | 71 | $lines = explode( "\n", wfMsgForContent( 'useractivity-filter' ) ); |
53 | 72 | foreach( $lines as $line ) { |
54 | | - |
55 | | - if( strpos($line, '*') !== 0 ){ |
| 73 | + if( strpos( $line, '*' ) !== 0 ) { |
56 | 74 | continue; |
57 | 75 | } else { |
58 | | - $line = explode( '|' , trim($line, '* '), 3 ); |
| 76 | + $line = explode( '|' , trim( $line, '* ' ), 3 ); |
59 | 77 | $filter = $line[0]; |
60 | 78 | $link_text = $line[1]; |
61 | 79 | $link_image = $line[2]; |
62 | | - $output .= "<a href=\"" . $this_title->escapeFullURL("item_type={$filter}") . "\"> |
63 | | - <img src=\"{$wgScriptPath}/extensions/SocialProfile/images/" . UserActivity::getTypeIcon($link_image) . "\"/>{$link_text} |
| 80 | + $output .= '<a href="' . $this_title->escapeFullURL( "item_type={$filter}" ) . "\"> |
| 81 | + <img src=\"{$wgScriptPath}/extensions/SocialProfile/images/" . UserActivity::getTypeIcon( $link_image ) . "\"/> |
| 82 | + {$link_text} |
64 | 83 | </a>"; |
65 | 84 | } |
66 | | - |
67 | 85 | } |
68 | 86 | |
69 | | - $output .= '<a href="' . $this_title->escapeFullURL() . '">' . wfMsg( 'useractivity-all' ) . '</a> |
| 87 | + $output .= '<a href="' . $this_title->escapeFullURL() . '">' . wfMsg( 'useractivity-all' ) . '</a> |
70 | 88 | </div> |
71 | 89 | </div> |
72 | 90 | */ |
— | — | @@ -82,11 +100,6 @@ |
83 | 101 | $rel->setActivityToggle( 'show_system_gifts', $system_gifts ); |
84 | 102 | $rel->setActivityToggle( 'show_messages_sent', $messages_sent ); |
85 | 103 | |
86 | | - // An extra toggle for ArmchairGM |
87 | | - if ( $wgSitename == 'ArmchairGM' ) { |
88 | | - $rel->setActivityToggle( 'show_network_updates', $network_updates ); |
89 | | - } |
90 | | - |
91 | 104 | /** |
92 | 105 | * Get all relationship activity |
93 | 106 | */ |
— | — | @@ -97,15 +110,17 @@ |
98 | 111 | $x = 1; |
99 | 112 | |
100 | 113 | foreach ( $activity as $item ) { |
101 | | - |
102 | 114 | if ( $x < 40 ) { |
103 | | - |
104 | | - if ( ( ( count( $activity ) > 40 ) && ( $x == 39 ) ) || ( ( count( $activity ) < 40 ) && ( $x == ( count( $activity ) - 1 ) ) ) ) { |
| 115 | + if ( |
| 116 | + ( ( count( $activity ) > 40 ) && ( $x == 39 ) ) || |
| 117 | + ( ( count( $activity ) < 40 ) && ( $x == ( count( $activity ) - 1 ) ) ) |
| 118 | + ) { |
105 | 119 | $border_fix = ' border-fix'; |
106 | 120 | } |
107 | 121 | |
| 122 | + $typeIcon = UserActivity::getTypeIcon( $item['type'] ); |
108 | 123 | $output .= "<div class=\"user-home-activity{$border_fix}\"> |
109 | | - <img src=\"{$wgScriptPath}/extensions/SocialProfile/images/" . UserActivity::getTypeIcon( $item['type'] ) . "\" alt=\"\" border=\"0\" /> |
| 124 | + <img src=\"{$wgScriptPath}/extensions/SocialProfile/images/" . $typeIcon . "\" alt=\"\" border=\"0\" /> |
110 | 125 | {$item["data"]} |
111 | 126 | </div>"; |
112 | 127 | $x++; |