| @@ 484-491 (lines=8) @@ | ||
| 481 | */ |
|
| 482 | public function subscribe($category, $item_id, $events, $mode = null, $module_id = null, $user_id = null) |
|
| 483 | { |
|
| 484 | if (!isset($user_id)) { |
|
| 485 | global $xoopsUser; |
|
| 486 | if (empty($xoopsUser)) { |
|
| 487 | return false; // anonymous cannot subscribe |
|
| 488 | } else { |
|
| 489 | $user_id = $xoopsUser->getVar('uid'); |
|
| 490 | } |
|
| 491 | } |
|
| 492 | ||
| 493 | if (!isset($module_id)) { |
|
| 494 | global $xoopsModule; |
|
| @@ 664-670 (lines=7) @@ | ||
| 661 | return false; |
|
| 662 | } |
|
| 663 | ||
| 664 | if (!isset($omit_user_id)) { |
|
| 665 | global $xoopsUser; |
|
| 666 | $omit_user_id = 0; |
|
| 667 | if (!empty($xoopsUser)) { |
|
| 668 | $omit_user_id = $xoopsUser->getVar('uid'); |
|
| 669 | } |
|
| 670 | } |
|
| 671 | $criteria = new CriteriaCompo(); |
|
| 672 | $criteria->add(new Criteria('not_modid', (int)$module_id)); |
|
| 673 | $criteria->add(new Criteria('not_category', $this->db->escape($category))); |
|
| @@ 776-783 (lines=8) @@ | ||
| 773 | **/ |
|
| 774 | public function unsubscribe($category, $item_id, $events, $module_id = null, $user_id = null) |
|
| 775 | { |
|
| 776 | if (!isset($user_id)) { |
|
| 777 | global $xoopsUser; |
|
| 778 | if (empty($xoopsUser)) { |
|
| 779 | return false; // anonymous cannot subscribe |
|
| 780 | } else { |
|
| 781 | $user_id = $xoopsUser->getVar('uid'); |
|
| 782 | } |
|
| 783 | } |
|
| 784 | if (!isset($module_id)) { |
|
| 785 | global $xoopsModule; |
|
| 786 | $module_id = $xoopsModule->getVar('mid'); |
|