XoopsModules25x /
xoopspoll
| 1 | <?php |
||
| 2 | /* |
||
| 3 | XOOPS - PHP Content Management System |
||
| 4 | Copyright (c) 2000-2020 XOOPS.org |
||
| 5 | <https://xoops.org> |
||
| 6 | This program is free software; you can redistribute it and/or modify |
||
| 7 | it under the terms of the GNU General Public License as published by |
||
| 8 | the Free Software Foundation; either version 2 of the License, or |
||
| 9 | (at your option) any later version. |
||
| 10 | |||
| 11 | You may not change or alter any portion of this comment or credits |
||
| 12 | of supporting developers from this source code or any supporting |
||
| 13 | source code which is considered copyrighted (c) material of the |
||
| 14 | original comment or credit authors. |
||
| 15 | |||
| 16 | This program is distributed in the hope that it will be useful, |
||
| 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
| 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
| 19 | GNU General Public License for more details. |
||
| 20 | |||
| 21 | You should have received a copy of the GNU General Public License |
||
| 22 | along with this program; if not, write to the Free Software |
||
| 23 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
||
| 24 | */ |
||
| 25 | |||
| 26 | /** |
||
| 27 | * Poll Results page for the XoopsPoll Module |
||
| 28 | * |
||
| 29 | * @copyright :: {@link https://xoops.org/ XOOPS Project} |
||
| 30 | * @license :: {@link http://www.fsf.org/copyleft/gpl.html GNU public license} |
||
| 31 | * @package :: xoopspoll |
||
| 32 | * @subpackage:: admin |
||
| 33 | * @since :: 1.0 |
||
| 34 | * @author :: {@link http://www.myweb.ne.jp/ Kazumi Ono (AKA onokazu)} |
||
| 35 | **/ |
||
| 36 | |||
| 37 | use Xmf\Request; |
||
| 38 | use XoopsModules\Newbb; |
||
| 39 | use XoopsModules\Xoopspoll\{ |
||
| 40 | Constants, |
||
| 41 | Helper, |
||
| 42 | Poll, |
||
| 43 | Renderer |
||
| 44 | }; |
||
| 45 | |||
| 46 | /** |
||
| 47 | * @uses xoops_load() method used to load classes |
||
| 48 | * @uses redirect_header() function used to send user to another location after completing task(s) |
||
| 49 | * @uses $GLOBALS['xoops']::path gets XOOPS directory information |
||
| 50 | * @uses xoops_getModuleHandler() to load handler for this module's class(es) |
||
| 51 | */ |
||
| 52 | require_once dirname(__DIR__, 2) . '/mainfile.php'; |
||
| 53 | |||
| 54 | $pollId = Request::getInt('poll_id', 0); |
||
| 55 | $helper = Helper::getInstance(); |
||
| 56 | /* |
||
| 57 | * check to see if we want to show polls created by the forum (newbb) module |
||
| 58 | */ |
||
| 59 | if ($GLOBALS['xoopsModuleConfig']['hide_forum_polls']) { |
||
| 60 | /** @var \XoopsModuleHandler $moduleHandler */ |
||
| 61 | $moduleHandler = xoops_getHandler('module'); |
||
| 62 | $newbbModule = $moduleHandler->getByDirname('newbb'); |
||
| 63 | if ($newbbModule instanceof \XoopsModule && $newbbModule->isactive()) { |
||
| 64 | /** @var Newbb\TopicHandler $topicHandler */ |
||
| 65 | $topicHandler = Newbb\Helper::getInstance()->getHandler('Topic'); |
||
|
0 ignored issues
–
show
|
|||
| 66 | $tCount = $topicHandler->getCount(new \Criteria('poll_id', $pollId, '=')); |
||
| 67 | if (!empty($tCount)) { |
||
| 68 | $pollId = 0; // treat it as if no poll requested |
||
| 69 | } |
||
| 70 | } |
||
| 71 | } |
||
| 72 | |||
| 73 | if (empty($pollId)) { |
||
| 74 | redirect_header('index.php', Constants::REDIRECT_DELAY_NONE); |
||
| 75 | } |
||
| 76 | $GLOBALS['xoopsOption']['template_main'] = 'xoopspoll_results.tpl'; |
||
| 77 | require $GLOBALS['xoops']->path('header.php'); |
||
| 78 | |||
| 79 | $pollHandler = $helper->getHandler('Poll'); |
||
| 80 | $pollObj = $pollHandler->get($pollId); |
||
| 81 | if (!empty($pollObj) && ($pollObj instanceof Poll)) { |
||
| 82 | /* make sure the poll has started */ |
||
| 83 | if ($pollObj->getVar('start_time') > time()) { |
||
| 84 | redirect_header('index.php', Constants::REDIRECT_DELAY_NONE); |
||
| 85 | } |
||
| 86 | |||
| 87 | /* assign variables to template */ |
||
| 88 | $renderer = new Renderer($pollObj, $helper); |
||
| 89 | $renderer->assignResults($GLOBALS['xoopsTpl']); |
||
| 90 | |||
| 91 | $visReturn = $pollObj->isResultVisible(); |
||
| 92 | $isVisible = true === $visReturn; |
||
| 93 | $visibleMsg = $isVisible ? '' : $visReturn; |
||
| 94 | |||
| 95 | $GLOBALS['xoopsTpl']->assign( |
||
| 96 | [ |
||
| 97 | 'visible_msg' => $visibleMsg, |
||
| 98 | 'disp_votes' => $GLOBALS['xoopsModuleConfig']['disp_vote_nums'], |
||
| 99 | 'back_link_icon' => \Xmf\Module\Admin::iconUrl('', 16) . '/back.png', |
||
| 100 | 'back_link' => $GLOBALS['xoops']->url('modules/xoopspoll/index.php'), |
||
| 101 | 'back_text' => _BACK, |
||
| 102 | ] |
||
| 103 | ); |
||
| 104 | } else { |
||
| 105 | redirect_header('index.php', Constants::REDIRECT_DELAY_MEDIUM, _MD_XOOPSPOLL_ERROR_INVALID_POLLID); |
||
| 106 | } |
||
| 107 | require $GLOBALS['xoops']->path('include/comment_view.php'); |
||
| 108 | require_once $GLOBALS['xoops']->path('footer.php'); |
||
| 109 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths