Index: trunk/extensions/SocialProfile/UserActivity/UserActivityClass.php |
— | — | @@ -9,22 +9,19 @@ |
10 | 10 | * Please use the accessor functions |
11 | 11 | */ |
12 | 12 | |
13 | | - /**#@+ |
14 | | - * @private |
15 | | - */ |
16 | | - var $user_id; # Text form (spaces not underscores) of the main part |
17 | | - var $user_name; # Text form (spaces not underscores) of the main part |
18 | | - var $items; # Text form (spaces not underscores) of the main part |
19 | | - var $rel_type; |
20 | | - var $show_edits = 1; |
21 | | - var $show_votes = 0; |
22 | | - var $show_comments = 1; |
23 | | - var $show_relationships = 1; |
24 | | - var $show_gifts_sent = 0; |
25 | | - var $show_gifts_rec = 1; |
26 | | - var $show_system_gifts = 1; |
27 | | - var $show_system_messages = 1; |
28 | | - var $show_messages_sent = 1; |
| 13 | + private $user_id; # Text form (spaces not underscores) of the main part |
| 14 | + private $user_name; # Text form (spaces not underscores) of the main part |
| 15 | + private $items; # Text form (spaces not underscores) of the main part |
| 16 | + private $rel_type; |
| 17 | + private $show_edits = 1; |
| 18 | + private $show_votes = 0; |
| 19 | + private $show_comments = 1; |
| 20 | + private $show_relationships = 1; |
| 21 | + private $show_gifts_sent = 0; |
| 22 | + private $show_gifts_rec = 1; |
| 23 | + private $show_system_gifts = 1; |
| 24 | + private $show_system_messages = 1; |
| 25 | + private $show_messages_sent = 1; |
29 | 26 | |
30 | 27 | /** |
31 | 28 | * Constructor |
— | — | @@ -94,7 +91,9 @@ |
95 | 92 | $userArray[] = $user; |
96 | 93 | } |
97 | 94 | $userIDs = implode( ',', $userArray ); |
98 | | - $where[] = "rc_user IN ($userIDs)"; |
| 95 | + if ( !empty( $userIDs ) ) { |
| 96 | + $where[] = "rc_user IN ($userIDs)"; |
| 97 | + } |
99 | 98 | } |
100 | 99 | |
101 | 100 | if ( !empty( $this->show_current_user ) ) { |
— | — | @@ -187,7 +186,9 @@ |
188 | 187 | $userArray[] = $user; |
189 | 188 | } |
190 | 189 | $userIDs = implode( ',', $userArray ); |
191 | | - $where[] = "vote_user_id IN ($userIDs)"; |
| 190 | + if ( !empty( $userIDs ) ) { |
| 191 | + $where[] = "vote_user_id IN ($userIDs)"; |
| 192 | + } |
192 | 193 | } |
193 | 194 | if ( $this->show_current_user ) { |
194 | 195 | $where['vote_user_id'] = $this->user_id; |
— | — | @@ -256,7 +257,9 @@ |
257 | 258 | $userArray[] = $user; |
258 | 259 | } |
259 | 260 | $userIDs = implode( ',', $userArray ); |
260 | | - $where[] = "Comment_user_id IN ($userIDs)"; |
| 261 | + if ( !empty( $userIDs ) ) { |
| 262 | + $where[] = "Comment_user_id IN ($userIDs)"; |
| 263 | + } |
261 | 264 | } |
262 | 265 | |
263 | 266 | if ( !empty( $this->show_current_user ) ) { |
— | — | @@ -348,7 +351,9 @@ |
349 | 352 | $userArray[] = $user; |
350 | 353 | } |
351 | 354 | $userIDs = implode( ',', $userArray ); |
352 | | - $where[] = "ug_user_id_to IN ($userIDs)"; |
| 355 | + if ( !empty( $userIDs ) ) { |
| 356 | + $where[] = "ug_user_id_to IN ($userIDs)"; |
| 357 | + } |
353 | 358 | } |
354 | 359 | |
355 | 360 | if( $this->show_current_user ) { |
— | — | @@ -412,7 +417,9 @@ |
413 | 418 | $userArray[] = $user; |
414 | 419 | } |
415 | 420 | $userIDs = implode( ',', $userArray ); |
416 | | - $where[] = "ug_user_id_to IN ($userIDs)"; |
| 421 | + if ( !empty( $userIDs ) ) { |
| 422 | + $where[] = "ug_user_id_to IN ($userIDs)"; |
| 423 | + } |
417 | 424 | } |
418 | 425 | |
419 | 426 | if ( !empty( $this->show_current_user ) ) { |
— | — | @@ -484,6 +491,8 @@ |
485 | 492 | * variables. |
486 | 493 | */ |
487 | 494 | private function setSystemGiftsRec() { |
| 495 | + global $wgUploadPath; |
| 496 | + |
488 | 497 | $dbr = wfGetDB( DB_SLAVE ); |
489 | 498 | |
490 | 499 | $where = array(); |
— | — | @@ -503,7 +512,9 @@ |
504 | 513 | $userArray[] = $user; |
505 | 514 | } |
506 | 515 | $userIDs = implode( ',', $userArray ); |
507 | | - $where[] = "sg_user_id IN ($userIDs)"; |
| 516 | + if ( !empty( $userIDs ) ) { |
| 517 | + $where[] = "sg_user_id IN ($userIDs)"; |
| 518 | + } |
508 | 519 | } |
509 | 520 | |
510 | 521 | if ( !empty( $this->show_current_user ) ) { |
— | — | @@ -527,7 +538,6 @@ |
528 | 539 | ); |
529 | 540 | |
530 | 541 | foreach ( $res as $row ) { |
531 | | - global $wgUploadPath; |
532 | 542 | $user_title = Title::makeTitle( NS_USER, $row->sg_user_name ); |
533 | 543 | $system_gift_image = '<img src="' . $wgUploadPath . '/awards/' . |
534 | 544 | SystemGifts::getGiftImage( $row->gift_id, 'm' ) . |
— | — | @@ -589,7 +599,9 @@ |
590 | 600 | $userArray[] = $user; |
591 | 601 | } |
592 | 602 | $userIDs = implode( ',', $userArray ); |
593 | | - $where[] = "r_user_id IN ($userIDs)"; |
| 603 | + if ( !empty( $userIDs ) ) { |
| 604 | + $where[] = "r_user_id IN ($userIDs)"; |
| 605 | + } |
594 | 606 | } |
595 | 607 | |
596 | 608 | if ( !empty( $this->show_current_user ) ) { |
— | — | @@ -678,7 +690,9 @@ |
679 | 691 | $userArray[] = $user; |
680 | 692 | } |
681 | 693 | $userIDs = implode( ',', $userArray ); |
682 | | - $where[] = "ub_user_id_from IN ($userIDs)"; |
| 694 | + if ( !empty( $userIDs ) ) { |
| 695 | + $where[] = "ub_user_id_from IN ($userIDs)"; |
| 696 | + } |
683 | 697 | } |
684 | 698 | |
685 | 699 | if ( !empty( $this->show_current_user ) ) { |
— | — | @@ -768,7 +782,9 @@ |
769 | 783 | $userArray[] = $user; |
770 | 784 | } |
771 | 785 | $userIDs = implode( ',', $userArray ); |
772 | | - $where[] = "um_user_id IN ($userIDs)"; |
| 786 | + if ( !empty( $userIDs ) ) { |
| 787 | + $where[] = "um_user_id IN ($userIDs)"; |
| 788 | + } |
773 | 789 | } |
774 | 790 | |
775 | 791 | if ( !empty( $this->show_current_user ) ) { |