| @@ 44-57 (lines=14) @@ | ||
| 41 | $perms = ''; |
|
| 42 | $xt = new NewsTopic(); |
|
| 43 | $restricted = news_getmoduleoption('restrictindex'); |
|
| 44 | if ($restricted) { |
|
| 45 | global $xoopsUser; |
|
| 46 | /** @var XoopsModuleHandler $moduleHandler */ |
|
| 47 | $moduleHandler = xoops_getHandler('module'); |
|
| 48 | $newsModule = $moduleHandler->getByDirname('news'); |
|
| 49 | $groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS; |
|
| 50 | $gperm_handler = xoops_getHandler('groupperm'); |
|
| 51 | $topics = $gperm_handler->getItemIds('news_view', $groups, $newsModule->getVar('mid')); |
|
| 52 | if (count($topics) > 0) { |
|
| 53 | $topics = implode(',', $topics); |
|
| 54 | $perms = ' AND topic_id IN (' . $topics . ') '; |
|
| 55 | } else { |
|
| 56 | return ''; |
|
| 57 | } |
|
| 58 | } |
|
| 59 | $topics_arr = $xt->getChildTreeArray(0, 'topic_title', $perms); |
|
| 60 | if ($options[0] == 1) { |
|
| @@ 50-63 (lines=14) @@ | ||
| 47 | $perms = ''; |
|
| 48 | $xt = new NewsTopic(); |
|
| 49 | $restricted = news_getmoduleoption('restrictindex'); |
|
| 50 | if ($restricted) { |
|
| 51 | global $xoopsUser; |
|
| 52 | /** @var XoopsModuleHandler $moduleHandler */ |
|
| 53 | $moduleHandler = xoops_getHandler('module'); |
|
| 54 | $newsModule = $moduleHandler->getByDirname('news'); |
|
| 55 | $groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS; |
|
| 56 | $gperm_handler = xoops_getHandler('groupperm'); |
|
| 57 | $topics = $gperm_handler->getItemIds('news_view', $groups, $newsModule->getVar('mid')); |
|
| 58 | if (count($topics) > 0) { |
|
| 59 | $topics = implode(',', $topics); |
|
| 60 | $perms = ' AND topic_id IN (' . $topics . ') '; |
|
| 61 | } else { |
|
| 62 | return ''; |
|
| 63 | } |
|
| 64 | } |
|
| 65 | $topics_arr = $xt->getChildTreeArray(0, 'topic_title', $perms); |
|
| 66 | $newscountbytopic = $xt->getNewsCountByTopic(); |
|
| @@ 80-93 (lines=14) @@ | ||
| 77 | $perm_type = 'news_view' |
|
| 78 | ) { |
|
| 79 | $perms = ''; |
|
| 80 | if ($checkRight) { |
|
| 81 | global $xoopsUser; |
|
| 82 | /** @var XoopsModuleHandler $moduleHandler */ |
|
| 83 | $moduleHandler = xoops_getHandler('module'); |
|
| 84 | $newsModule = $moduleHandler->getByDirname('news'); |
|
| 85 | $groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS; |
|
| 86 | $gperm_handler = xoops_getHandler('groupperm'); |
|
| 87 | $topics = $gperm_handler->getItemIds($perm_type, $groups, $newsModule->getVar('mid')); |
|
| 88 | if (count($topics) > 0) { |
|
| 89 | $topics = implode(',', $topics); |
|
| 90 | $perms = ' AND topic_id IN (' . $topics . ') '; |
|
| 91 | } else { |
|
| 92 | return null; |
|
| 93 | } |
|
| 94 | } |
|
| 95 | ||
| 96 | if ($seltopic != -1) { |
|
| @@ 219-232 (lines=14) @@ | ||
| 216 | public function getAllTopicsCount($checkRight = true) |
|
| 217 | { |
|
| 218 | $perms = ''; |
|
| 219 | if ($checkRight) { |
|
| 220 | global $xoopsUser; |
|
| 221 | /** @var XoopsModuleHandler $moduleHandler */ |
|
| 222 | $moduleHandler = xoops_getHandler('module'); |
|
| 223 | $newsModule = $moduleHandler->getByDirname('news'); |
|
| 224 | $groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS; |
|
| 225 | $gperm_handler = xoops_getHandler('groupperm'); |
|
| 226 | $topics = $gperm_handler->getItemIds('news_submit', $groups, $newsModule->getVar('mid')); |
|
| 227 | if (count($topics) > 0) { |
|
| 228 | $topics = implode(',', $topics); |
|
| 229 | $perms = ' WHERE topic_id IN (' . $topics . ') '; |
|
| 230 | } else { |
|
| 231 | return null; |
|
| 232 | } |
|
| 233 | } |
|
| 234 | ||
| 235 | $sql = 'SELECT count(topic_id) as cpt FROM ' . $this->table . $perms; |
|