These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /* |
||
3 | XOOPS - PHP Content Management System |
||
4 | Copyright (c) 2000-2016 XOOPS.org |
||
5 | <http://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 | * Poll Results page for the XoopsPoll Module |
||
27 | * |
||
28 | * @copyright :: {@link http://xoops.org/ XOOPS Project} |
||
29 | * @license :: {@link http://www.fsf.org/copyleft/gpl.html GNU public license} |
||
30 | * @package :: xoopspoll |
||
31 | * @subpackage:: admin |
||
32 | * @since :: 1.0 |
||
33 | * @author :: {@link http://www.myweb.ne.jp/ Kazumi Ono (AKA onokazu)} |
||
34 | **/ |
||
35 | |||
36 | /** |
||
37 | * @uses xoops_load() method used to load classes |
||
38 | * @uses redirect_header() function used to send user to another location after completing task(s) |
||
39 | * @uses $GLOBALS['xoops']::path gets XOOPS directory information |
||
40 | * @uses xoops_getModuleHandler() to load handler for this module's class(es) |
||
41 | */ |
||
42 | include_once dirname(dirname(__DIR__)) . '/mainfile.php'; |
||
43 | |||
44 | xoops_load('constants', 'xoopspoll'); |
||
45 | xoops_load('renderer', 'xoopspoll'); |
||
46 | xoops_load('XoopsRequest'); |
||
47 | |||
48 | $pollId = XoopsRequest::getInt('poll_id', 0); |
||
49 | /* |
||
50 | * check to see if we want to show polls created by the forum (newbb) module |
||
51 | */ |
||
52 | if ($GLOBALS['xoopsModuleConfig']['hide_forum_polls']) { |
||
53 | /** @var XoopsModuleHandler $moduleHandler */ |
||
54 | $moduleHandler = xoops_getHandler('module'); |
||
55 | $newbbModule = $moduleHandler->getByDirname('newbb'); |
||
56 | if ($newbbModule instanceof XoopsModule && $newbbModule->isactive()) { |
||
0 ignored issues
–
show
|
|||
57 | /** @var NewbbTopicHandler $topicHandler */ |
||
58 | $topicHandler = xoops_getModuleHandler('topic', 'newbb'); |
||
59 | $tCount = $topicHandler->getCount(new Criteria('poll_id', $pollId, '=')); |
||
60 | if (!empty($tCount)) { |
||
61 | $pollId = 0; // treat it as if no poll requested |
||
62 | } |
||
63 | } |
||
64 | } |
||
65 | |||
66 | if (empty($pollId)) { |
||
67 | redirect_header('index.php', XoopspollConstants::REDIRECT_DELAY_NONE); |
||
68 | } |
||
69 | $GLOBALS['xoopsOption']['template_main'] = 'xoopspoll_results.tpl'; |
||
70 | include $GLOBALS['xoops']->path('header.php'); |
||
71 | |||
72 | $pollHandler = xoops_getModuleHandler('poll', 'xoopspoll'); |
||
73 | $pollObj = $pollHandler->get($pollId); |
||
74 | if ((!empty($pollObj)) && ($pollObj instanceof XoopspollPoll)) { |
||
75 | /* make sure the poll has started */ |
||
76 | if ($pollObj->getVar('start_time') > time()) { |
||
77 | redirect_header('index.php', XoopspollConstants::REDIRECT_DELAY_NONE); |
||
78 | } |
||
79 | |||
80 | /* assign variables to template */ |
||
81 | $renderer = new XoopspollRenderer($pollObj); |
||
82 | $renderer->assignResults($GLOBALS['xoopsTpl']); |
||
83 | |||
84 | $visReturn = $pollObj->isResultVisible(); |
||
85 | $isVisible = (true === $visReturn) ? true : false; |
||
86 | $visibleMsg = $isVisible ? '' : $visReturn; |
||
87 | |||
88 | $GLOBALS['xoopsTpl']->assign(array( |
||
89 | 'visible_msg' => $visibleMsg, |
||
90 | 'disp_votes' => $GLOBALS['xoopsModuleConfig']['disp_vote_nums'], |
||
91 | 'back_link_icon' => $GLOBALS['xoopsModule']->getInfo('icons16') . '/back.png', |
||
92 | 'back_link' => $GLOBALS['xoops']->url('modules/xoopspoll/index.php'), |
||
93 | 'back_text' => _BACK |
||
94 | )); |
||
95 | } else { |
||
96 | redirect_header('index.php', XoopspollConstants::REDIRECT_DELAY_MEDIUM, _MD_XOOPSPOLL_ERROR_INVALID_POLLID); |
||
97 | } |
||
98 | include $GLOBALS['xoops']->path('include/comment_view.php'); |
||
99 | include $GLOBALS['xoops']->path('footer.php'); |
||
100 |
This error could be the result of:
1. Missing dependencies
PHP Analyzer uses your
composer.json
file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects thecomposer.json
to be in the root folder of your repository.Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the
require
orrequire-dev
section?2. Missing use statement
PHP does not complain about undefined classes in
ìnstanceof
checks. For example, the following PHP code will work perfectly fine:If you have not tested against this specific condition, such errors might go unnoticed.