Issues (380)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  Header Injection
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

polls.php (3 issues)

1
<?php
2
/**
3
 * Newbb module
4
 *
5
 * You may not change or alter any portion of this comment or credits
6
 * of supporting developers from this source code or any supporting source code
7
 * which is considered copyrighted (c) material of the original comment or credit authors.
8
 * This program is distributed in the hope that it will be useful,
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11
 *
12
 * @copyright       XOOPS Project (https://xoops.org)
13
 * @license         GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html)
14
 * @package         newbb
15
 * @since           4.0
16
 * @author          Taiwen Jiang <[email protected]>
17
 */
18
19
use Xmf\Request;
20
use XoopsModules\Newbb;
21
use XoopsModules\Xoopspoll;
22
use XoopsModules\Xoopspoll\Constants;
23
24
// rewrite by irmtfan and zyspec to accept xoopspoll 1.4 and all old xoopspoll and umfrage versions and all clones
25
26
require_once __DIR__ . '/header.php';
27
require_once $GLOBALS['xoops']->path('class/xoopsformloader.php');
28
require_once $GLOBALS['xoops']->path('class/xoopslists.php');
29
require_once $GLOBALS['xoops']->path('class/xoopsblock.php');
30
xoops_load('XoopsLocal');
31
$op      = 'add';
32
$goodOps = [
33
    'add',
34
    'save',
35
    'edit',
36
    'update',
37
    'addmore',
38
    'savemore',
39
    'delete',
40
    'delete_ok',
41
    'restart',
42
    'restart_ok',
43
    'log',
44
];
45
$op      = isset($_REQUEST['op']) ? $_REQUEST['op'] : 'add';
46
$op      = (!in_array($op, $goodOps)) ? 'add' : $op;
47
48
$poll_id  = Request::getInt('poll_id', Request::getInt('poll_id', 0, 'GET'), 'POST');
49
$topic_id = Request::getInt('topic_id', Request::getInt('topic_id', 0, 'GET'), 'POST');
50
51
// deal with permissions
52
/** @var Newbb\TopicHandler $topicHandler */
53
$topicHandler = \XoopsModules\Newbb\Helper::getInstance()->getHandler('Topic');
54
$topicObject  = $topicHandler->get($topic_id);
55
// topic exist
56
if (is_object($topicObject)) {
57
    $forum_id = $topicObject->getVar('forum_id');
58
} else {
59
    redirect_header(XOOPS_URL . '/index.php', 2, _MD_NEWBB_POLLMODULE_ERROR . ': ' . _MD_NEWBB_FORUMNOEXIST);
60
}
61
// forum access permission
62
/** @var Newbb\ForumHandler $forumHandler */
63
$forumHandler = \XoopsModules\Newbb\Helper::getInstance()->getHandler('Forum');
64
$forumObject  = $forumHandler->get($forum_id);
65
if (!$forumHandler->getPermission($forumObject)) {
66
    redirect_header(XOOPS_URL . '/index.php', 2, _MD_NEWBB_NORIGHTTOACCESS);
67
}
68
// topic view permission
69
if (!$topicHandler->getPermission($forumObject, $topicObject->getVar('topic_status'), 'view')) {
70
    redirect_header('viewforum.php?forum=' . $forum_id, 2, _MD_NEWBB_NORIGHTTOVIEW);
71
}
72
// poll module
73
/** @var \XoopsModuleHandler $moduleHandler */
74
$moduleHandler     = xoops_getHandler('module');
75
$pollModuleHandler = $moduleHandler->getByDirname($GLOBALS['xoopsModuleConfig']['poll_module']);
76
if (is_object($pollModuleHandler) && $pollModuleHandler->getVar('isactive')) {
77
    // new xoopspoll module
78
    if ($pollModuleHandler->getVar('version') >= 201) {
79
    } elseif ($pollModuleHandler->getVar('version') >= 140) {
80
        xoops_load('constants', $GLOBALS['xoopsModuleConfig']['poll_module']);
81
        xoops_load('pollUtility', $GLOBALS['xoopsModuleConfig']['poll_module']);
82
        xoops_load('request', $GLOBALS['xoopsModuleConfig']['poll_module']);
83
        xoops_loadLanguage('admin', $GLOBALS['xoopsModuleConfig']['poll_module']);
84
        /** @var \XoopsModules\Xoopspoll\PollHandler $xpPollHandler */
85
        $xpPollHandler = Xoopspoll\Helper::getInstance()->getHandler('Poll');
86
        /** @var \XoopsModules\XoopsPoll $pollObject */
87
        $pollObject = $xpPollHandler->get($poll_id); // will create poll if poll_id = 0 exist
88
        // old xoopspoll or umfrage or any clone from them
89
    } else {
90
        require_once $GLOBALS['xoops']->path('modules/' . $GLOBALS['xoopsModuleConfig']['poll_module'] . '/include/constants.php');
91
        $classPoll  = $topicObject->loadOldPoll();
92
        $pollObject = new $classPoll($poll_id); // will create poll if poll_id = 0 exist
93
    }
94
} else {
95
    // irmtfan - issue with javascript:history.go(-1)
96
    redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 2, _MD_NEWBB_POLLMODULE_ERROR);
97
}
98
// include header
99
require_once $GLOBALS['xoops']->path('header.php');
100
101
// no admin user permission
102
if (is_object($GLOBALS['xoopsUser']) && !newbbIsAdmin($forumObject)) {
103
    $perm = false;
104
    if ($topicHandler->getPermission($forumObject, $topicObject->getVar('topic_status'), 'addpoll')) {
105
        if (('add' === $op || 'save' === $op || 'update' === $op) && !$topicObject->getVar('topic_haspoll')
106
            && ($GLOBALS['xoopsUser']->getVar('uid') == $topicObject->getVar('topic_poster'))) {
107
            $perm = true;
108
        } elseif (!empty($poll_id) && ($GLOBALS['xoopsUser']->getVar('uid') == $pollObject->getVar('user_id'))) {
109
            $perm = true;
110
        }
111
    }
112
    if (!$perm) {
113
        redirect_header("viewtopic.php?topic_id={$topic_id}", 2, _NOPERM);
114
    }
115
}
116
switch ($op) {
117
    case 'add':
118
        // new xoopspoll module
119
        if ($pollModuleHandler->getVar('version') >= 201) {
120
        } elseif ($pollModuleHandler->getVar('version') >= 140) {
121
            echo '<h4>' . _MD_NEWBB_POLL_CREATNEWPOLL . "</h4>\n";
122
            $pollObject->renderForm(Request::getString('SCRIPT_NAME', '', 'SERVER'), 'post', ['topic_id' => $topic_id]);
123
            // old xoopspoll or umfrage or any clone from them
124
        } else {
125
            $classOption  = $classPoll . 'Option';
126
            $poll_form    = new \XoopsThemeForm(_MD_NEWBB_POLL_CREATNEWPOLL, 'poll_form', 'polls.php', 'post', true);
127
            $author_label = new \XoopsFormLabel(
128
                _MD_NEWBB_POLL_AUTHOR,
129
                is_object($GLOBALS['xoopsUser']) ? ("<a href='"
130
                                                    . XOOPS_URL
131
                                                    . '/userinfo.php?uid='
132
                                                    . $GLOBALS['xoopsUser']->getVar('uid')
133
                                                    . "'>"
134
                                                    . newbbGetUnameFromId($GLOBALS['xoopsUser']->getVar('uid'), $GLOBALS['xoopsModuleConfig']['show_realname'])
135
                                                    . '</a>') : $GLOBALS['xoopsConfig']['anonymous']
136
            );
137
            $poll_form->addElement($author_label);
138
            $question_text = new \XoopsFormText(_MD_NEWBB_POLL_POLLQUESTION, 'question', 50, 255);
139
            $poll_form->addElement($question_text);
140
            $desc_tarea = new \XoopsFormTextarea(_MD_NEWBB_POLL_POLLDESC, 'description');
141
            $poll_form->addElement($desc_tarea);
142
            $currenttime = formatTimestamp(time(), 'Y-m-d H:i:s');
143
            $endtime     = formatTimestamp(time() + 604800, 'Y-m-d H:i:s');
144
            $expire_text = new \XoopsFormText(_MD_NEWBB_POLL_EXPIRATION . '<br><small>' . _MD_NEWBB_POLL_FORMAT . '<br>' . sprintf(_MD_NEWBB_POLL_CURRENTTIME, $currenttime) . '</small>', 'end_time', 30, 19, $endtime);
145
            $poll_form->addElement($expire_text);
146
147
            $weight_text = new \XoopsFormText(_MD_NEWBB_POLL_DISPLAYORDER, 'weight', 6, 5, 0);
148
            $poll_form->addElement($weight_text);
149
150
            $multi_yn = new \XoopsFormRadioYN(_MD_NEWBB_POLL_ALLOWMULTI, 'multiple', 0);
151
            $poll_form->addElement($multi_yn);
152
153
            $notify_yn = new \XoopsFormRadioYN(_MD_NEWBB_POLL_NOTIFY, 'notify', 1);
154
            $poll_form->addElement($notify_yn);
155
156
            $option_tray    = new \XoopsFormElementTray(_MD_NEWBB_POLL_POLLOPTIONS, '');
157
            $barcolor_array = \XoopsLists::getImgListAsArray($GLOBALS['xoops']->path('modules/' . $GLOBALS['xoopsModuleConfig']['poll_module'] . '/assets/images/colorbars/'));
158
            for ($i = 0; $i < 10; ++$i) {
159
                $current_bar = ('blank.gif' !== current($barcolor_array)) ? current($barcolor_array) : next($barcolor_array);
160
                $option_text = new \XoopsFormText('', 'option_text[]', 50, 255);
161
                $option_tray->addElement($option_text);
162
                $color_select = new \XoopsFormSelect('', "option_color[{$i}]", $current_bar);
163
                $color_select->addOptionArray($barcolor_array);
164
                $color_select->setExtra("onchange='showImgSelected(\"option_color_image[{$i}]\", \"option_color[{$i}]\", \"modules/" . $GLOBALS['xoopsModuleConfig']['poll_module'] . '/assets/images/colorbars", "", "' . XOOPS_URL . "\")'");
165
                $color_label = new \XoopsFormLabel(
166
                    '', "<img src='" . XOOPS_URL . '/modules/' . $GLOBALS['xoopsModuleConfig']['poll_module'] . '/assets/images/colorbars/' . $current_bar . "' name='option_color_image[{$i}]' id='option_color_image[{$i}]' width='30' align='bottom' height='15' alt='' ><br>"
167
                );
168
                $option_tray->addElement($color_select);
169
                $option_tray->addElement($color_label);
170
                if (!next($barcolor_array)) {
171
                    reset($barcolor_array);
172
                }
173
                unset($color_select, $color_label);
174
            }
175
            $poll_form->addElement($option_tray);
176
177
            $poll_form->addElement(new \XoopsFormHidden('op', 'save'));
178
            $poll_form->addElement(new \XoopsFormHidden('topic_id', $topic_id));
179
            $poll_form->addElement(new \XoopsFormHidden('poll_id', $poll_id));
180
            $poll_form->addElement(new \XoopsFormHidden('user_id', is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('uid') : 0));
181
            $poll_form->addElement(new \XoopsFormButtonTray('poll_submit', _SUBMIT, 'submit'));
182
            echo '<h4>' . _MD_NEWBB_POLL_POLLCONF . '</h4>';
183
            $poll_form->display();
184
        }
185
        break; // op: add
186
    case 'edit':
187
        // new xoopspoll module
188
        if ($pollModuleHandler->getVar('version') >= 201) {
189
        } elseif ($pollModuleHandler->getVar('version') >= 140) {
190
            echo '<h4>' . _MD_NEWBB_POLL_EDITPOLL . "</h4>\n";
191
            $pollObject->renderForm(Request::getString('SCRIPT_NAME', '', 'SERVER'), 'post', ['topic_id' => $topic_id]);
192
            // old xoopspoll or umfrage or any clone from them
193
        } else {
194
            $classOption  = $classPoll . 'Option';
195
            $poll_form    = new \XoopsThemeForm(_MD_NEWBB_POLL_EDITPOLL, 'poll_form', 'polls.php', 'post', true);
196
            $author_label = new \XoopsFormLabel(_MD_NEWBB_POLL_AUTHOR, "<a href='" . XOOPS_URL . '/userinfo.php?uid=' . $pollObject->getVar('user_id') . "'>" . newbbGetUnameFromId($pollObject->getVar('user_id'), $GLOBALS['xoopsModuleConfig']['show_realname']) . '</a>');
197
            $poll_form->addElement($author_label);
198
            $question_text = new \XoopsFormText(_MD_NEWBB_POLL_POLLQUESTION, 'question', 50, 255, $pollObject->getVar('question', 'E'));
199
            $poll_form->addElement($question_text);
200
            $desc_tarea = new \XoopsFormTextarea(_MD_NEWBB_POLL_POLLDESC, 'description', $pollObject->getVar('description', 'E'));
201
            $poll_form->addElement($desc_tarea);
202
            $date = formatTimestamp($pollObject->getVar('end_time'), 'Y-m-d H:i:s'); // important "Y-m-d H:i:s" use in jdf function
203
            if (!$pollObject->hasExpired()) {
204
                $expire_text = new \XoopsFormText(_MD_NEWBB_POLL_EXPIRATION . '<br><small>' . _MD_NEWBB_POLL_FORMAT . '<br>' . sprintf(_MD_NEWBB_POLL_CURRENTTIME, formatTimestamp(time(), 'Y-m-d H:i:s')) . '</small>', 'end_time', 20, 19, $date);
205
                $poll_form->addElement($expire_text);
206
            } else {
207
                // irmtfan full URL - add topic_id
208
                $restart_label = new \XoopsFormLabel(
209
                    _MD_NEWBB_POLL_EXPIRATION, sprintf(_MD_NEWBB_POLL_EXPIREDAT, $date) . "<br><a href='" . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . "/polls.php?op=restart&amp;poll_id={$poll_id}&amp;topic_id={$topic_id}'>" . _MD_NEWBB_POLL_RESTART . '</a>'
210
                );
211
                $poll_form->addElement($restart_label);
212
            }
213
            $weight_text = new \XoopsFormText(_MD_NEWBB_POLL_DISPLAYORDER, 'weight', 6, 5, $pollObject->getVar('weight'));
214
            $poll_form->addElement($weight_text);
215
            $multi_yn = new \XoopsFormRadioYN(_MD_NEWBB_POLL_ALLOWMULTI, 'multiple', $pollObject->getVar('multiple'));
216
            $poll_form->addElement($multi_yn);
217
            $options_arr  = &$classOption::getAllByPollId($poll_id);
218
            $notify_value = 1;
219
            if (0 !== $pollObject->getVar('mail_status')) {
220
                $notify_value = 0;
221
            }
222
            $notify_yn = new \XoopsFormRadioYN(_MD_NEWBB_POLL_NOTIFY, 'notify', $notify_value);
223
            $poll_form->addElement($notify_yn);
224
            $option_tray    = new \XoopsFormElementTray(_MD_NEWBB_POLL_POLLOPTIONS, '');
225
            $barcolor_array = \XoopsLists::getImgListAsArray($GLOBALS['xoops']->path("modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/assets/images/colorbars/"));
226
            $i              = 0;
227
            foreach ($options_arr as $option) {
228
                /** @var \XoopsPoll $option */
229
                $option_tray->addElement(new \XoopsFormText('', 'option_text[]', 50, 255, $option->getVar('option_text')));
230
                $option_tray->addElement(new \XoopsFormHidden('option_id[]', $option->getVar('option_id')));
231
                $color_select = new \XoopsFormSelect('', 'option_color[{$i}]', $option->getVar('option_color'));
232
                $color_select->addOptionArray($barcolor_array);
233
                $color_select->setExtra("onchange='showImgSelected(\"option_color_image[{$i}]\", \"option_color[" . $i . "]\", \"modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/assets/images/colorbars\", \"\", \"" . XOOPS_URL . "\")'");
234
                $color_label = new \XoopsFormLabel(
235
                    '',
236
                    "<img src='"
237
                    . $GLOBALS['xoops']->url("modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/assets/images/colorbars/" . $option->getVar('option_color', 'E'))
238
                    . "' name='option_color_image[{$i}]' id='option_color_image[{$i}]' class='alignbottom' width='30' height='15' alt='' ><br>"
239
                );
240
                $option_tray->addElement($color_select);
241
                $option_tray->addElement($color_label);
242
                unset($color_select, $color_label);
243
                ++$i;
244
            }
245
            // irmtfan full URL
246
            $more_label = new \XoopsFormLabel('', "<br><a href='" . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . "/polls.php?op=addmore&amp;poll_id={$poll_id}&amp;topic_id={$topic_id}'>" . _MD_NEWBB_POLL_ADDMORE . '</a>');
247
            $option_tray->addElement($more_label);
248
            $poll_form->addElement($option_tray);
249
            $poll_form->addElement(new \XoopsFormHidden('op', 'update'));
250
            $poll_form->addElement(new \XoopsFormHidden('topic_id', $topic_id));
251
            $poll_form->addElement(new \XoopsFormHidden('poll_id', $poll_id));
252
            $poll_form->addElement(new \XoopsFormButtonTray('poll_submit', _SUBMIT, 'submit'));
253
254
            echo '<h4>' . _MD_NEWBB_POLL_POLLCONF . "</h4>\n";
255
            $poll_form->display();
256
        }
257
        break; // op: edit
258
    case 'save':
259
        // old xoopspoll or umfrage or any clone from them
260
        if ($pollModuleHandler->getVar('version') < 140) {
261
            // check security token
262
            if (!$GLOBALS['xoopsSecurity']->check()) {
263
                redirect_header(Request::getString('SCRIPT_NAME', '', 'SERVER'), 2, implode('<br>', $GLOBALS['xoopsSecurity']->getErrors()));
264
            }
265
            /*
266
             * The option check should be done before submitting
267
             */
268
            $option_empty = true;
269
            if (!Request::getString('option_text', '', 'POST')) {
270
                // irmtfan - issue with javascript:history.go(-1)
271
                redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 2, _MD_NEWBB_ERROROCCURED . ': ' . _MD_NEWBB_POLL_POLLOPTIONS . ' !');
272
            }
273
            $option_text = Request::getArray('option_text', '', 'POST');
274
            foreach ($option_text as $optxt) {
275
                if ('' !== trim($optxt)) {
276
                    $option_empty = false;
277
                    break;
278
                }
279
            }
280
            if ($option_empty) {
281
                // irmtfan - issue with javascript:history.go(-1)
282
                redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 2, _MD_NEWBB_ERROROCCURED . ': ' . _MD_NEWBB_POLL_POLLOPTIONS . ' !');
283
            }
284
            $pollObject->setVar('question', Request::getString('question', '', 'POST'));
285
            $pollObject->setVar('description', Request::getString('description', '', 'POST'));
286
            $end_time = Request::getString('end_time', '', 'POST'); // (empty($_POST['end_time'])) ? "" : $_POST['end_time'];
287
            if ('' !== $end_time) {
288
                $timezone = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('timezone') : null;
289
                $pollObject->setVar('end_time', userTimeToServerTime(method_exists('XoopsLocal', 'strtotime') ? XoopsLocal::strtotime($end_time) : strtotime($end_time), $timezone));
290
            } else {
291
                // if expiration date is not set, set it to 10 days from now
292
                $pollObject->setVar('end_time', time() + (86400 * 10));
293
            }
294
295
            $pollObject->setVar('display', 0);
296
            $pollObject->setVar('weight', Request::getInt('weight', 0, 'POST'));
297
            $pollObject->setVar('multiple', Request::getInt('multiple', 0, 'POST'));
298
            $pollObject->setVar('user_id', Request::getInt('user_id', 0, 'POST'));
299
            if (Request::getInt('notify', 0, 'POST') && $end_time > time()) {
300
                // if notify, set mail status to "not mailed"
301
                $pollObject->setVar('mail_status', Xoopspoll\Constants::POLL_NOT_MAILED);
302
            } else {
303
                // if not notify, set mail status to already "mailed"
304
                $pollObject->setVar('mail_status', Xoopspoll\Constants::POLL_MAILED);
305
            }
306
            $new_poll_id = $pollObject->store();
307
            if (empty($new_poll_id)) {
308
                xoops_error($pollObject->getHtmlErrors);
309
                break;
310
            }
311
            $i            = 0;
312
            $option_color = Request::getArray('option_color', null, 'POST');
313
            $classOption  = $classPoll . 'Option';
314
            foreach ($option_text as $optxt) {
315
                $optxt = trim($optxt);
316
                /** @var \XoopsModules\Xoopspoll\Option $optionObject */
317
                $optionObject = new $classOption();
318
                if ('' !== $optxt) {
319
                    $optionObject->setVar('option_text', $optxt);
320
                    $optionObject->setVar('option_color', $option_color[$i]);
321
                    $optionObject->setVar('poll_id', $new_poll_id);
322
                    $optionObject->store();
323
                }
324
                ++$i;
325
            }
326
            // clear the template cache so changes take effect immediately
327
            require_once $GLOBALS['xoops']->path('class/template.php');
328
            xoops_template_clear_module_cache($GLOBALS['xoopsModule']->getVar('mid'));
329
            xoops_template_clear_module_cache($pollModuleHandler->getVar('mid'));
330
331
            // update topic to indicate it has a poll
332
            $topicObject->setVar('topic_haspoll', 1);
333
            $topicObject->setVar('poll_id', $new_poll_id);
334
            $success = $topicHandler->insert($topicObject);
335
            if (!$success) {
336
                xoops_error($topicHandler->getHtmlErrors());
337
            } else {
338
                redirect_header("viewtopic.php?topic_id={$topic_id}", 2, _MD_NEWBB_POLL_DBUPDATED);
339
            }
340
            break; // op: save
341
        }
342
    // no break
343
    case 'update':
344
        // check security token
345
        if (!$GLOBALS['xoopsSecurity']->check()) {
346
            redirect_header(Request::getString('SCRIPT_NAME', '', 'SERVER'), 2, implode('<br>', $GLOBALS['xoopsSecurity']->getErrors()));
347
        }
348
        /* make sure there's at least one option */
349
        $option_text   = Request::getString('option_text', '', 'POST');
350
        $option_string = is_array($option_text) ? implode('', $option_text) : $option_text;
0 ignored issues
show
The condition is_array($option_text) is always false.
Loading history...
351
        $option_string = trim($option_string);
352
        if ('' === $option_string) {
353
            redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 2, _MD_NEWBB_ERROROCCURED . ': ' . _MD_NEWBB_POLL_POLLOPTIONS . ' !');
354
        }
355
356
        // new xoopspoll module
357
        if ($pollModuleHandler->getVar('version') >= 201) {
358
        } elseif ($pollModuleHandler->getVar('version') >= 140) {
359
            /** @var \XoopsModules\Xoopspoll\OptionHandler $xpOptHandler */
360
            $xpOptHandler = Xoopspoll\Helper::getInstance()->getHandler('Option');
361
            /** @var \XoopsModules\Xoopspoll\LogHandler $xpLogHandler */
362
            $xpLogHandler = Xoopspoll\Helper::getInstance()->getHandler('Log');
363
            //            $classRequest = ucfirst($GLOBALS['xoopsModuleConfig']["poll_module"]) . "Request";
364
            //            $classConstants   = new XoopsModules\Xoopspoll\Constants();
365
            $notify           = Request::getInt('notify', Constants::NOTIFICATION_ENABLED, 'POST');
366
            $currentTimestamp = time();
367
            //$xuEndTimestamp   = method_exists('XoopsLocal', 'strtotime') ? XoopsLocal::strtotime(Request::getString('xu_end_time', null, 'POST'))
368
            //                                                             : strtotime(Request::getString('xu_end_time', null, 'POST'));
369
            $xuEndTimestamp = strtotime(Request::getString('xu_end_time', null, 'POST'));
370
            $endTimestamp   = (!Request::getString('xu_end_time', null, 'POST')) ? ($currentTimestamp + Constants::DEFAULT_POLL_DURATION) : userTimeToServerTime($xuEndTimestamp);
371
            //$xuStartTimestamp = method_exists('XoopsLocal', 'strtotime') ? XoopsLocal::strtotime(Request::getString('xu_start_time', null, 'POST'))
372
            //                                                             : strtotime(Request::getString('xu_start_time', null, 'POST'));
373
            $xuStartTimestamp = strtotime(Request::getString('xu_start_time', null, 'POST'));
374
            $startTimestamp   = (!Request::getString('xu_start_time', null, 'POST')) ? ($endTimestamp - Constants::DEFAULT_POLL_DURATION) : userTimeToServerTime($xuStartTimestamp);
375
376
            //  don't allow changing start time if there are votes in the log
377
            if (($startTimestamp < $pollObject->getVar('start_time'))
378
                && ($xpLogHandler->getTotalVotesByPollId($poll_id) > 0)) {
379
                $startTimestamp = $pollObject->getVar('start_time'); //don't change start time
380
            }
381
382
            $poll_vars = [
383
                'user_id'     => Request::getInt('user_id', $GLOBALS['xoopsUser']->uid(), 'POST'),
384
                'question'    => Request::getString('question', null, 'POST'),
385
                'description' => Request::getText('description', null, 'POST'),
386
                'mail_status' => (Constants::NOTIFICATION_ENABLED == $notify) ? Constants::POLL_NOT_MAILED : Constants::POLL_MAILED,
387
                'mail_voter'  => Request::getInt('mail_voter', Constants::NOT_MAIL_POLL_TO_VOTER, 'POST'),
388
                'start_time'  => $startTimestamp,
389
                'end_time'    => $endTimestamp,
390
                'display'     => Request::getInt('display', Constants::DO_NOT_DISPLAY_POLL_IN_BLOCK, 'POST'),
391
                'visibility'  => Request::getInt('visibility', Constants::HIDE_NEVER, 'POST'),
392
                'weight'      => Request::getInt('weight', Constants::DEFAULT_WEIGHT, 'POST'),
393
                'multiple'    => Request::getInt('multiple', Constants::NOT_MULTIPLE_SELECT_POLL, 'POST'),
394
                'multilimit'  => Request::getInt('multilimit', Constants::MULTIPLE_SELECT_LIMITLESS, 'POST'),
395
                'anonymous'   => Request::getInt('anonymous', Constants::ANONYMOUS_VOTING_DISALLOWED, 'POST'),
396
            ];
397
            $pollObject->setVars($poll_vars);
398
            $poll_id = $xpPollHandler->insert($pollObject);
399
            if (!$poll_id) {
400
                $err = $pollObject->getHtmlErrors();
401
                exit($err);
402
            }
403
404
            // now get the options
405
            $optionIdArray    = Request::getArray('option_id', [], 'POST');
406
            $optionIdArray    = array_map('\intval', $optionIdArray);
407
            $optionTextArray  = Request::getArray('option_text', [], 'POST');
408
            $optionColorArray = Request::getArray('option_color', [], 'POST');
409
410
            foreach ($optionIdArray as $key => $oId) {
411
                if (!empty($oId) && ($optionObject = $xpOptHandler->get($oId))) {
412
                    // existing option object so need to update it
413
                    $optionTextArray[$key] = trim($optionTextArray[$key]);
414
                    if ('' === $optionTextArray[$key]) {
415
                        // want to delete this option
416
                        if (false !== $xpOptHandler->delete($optionObject)) {
417
                            // now remove it from the log
418
                            $xpLogHandler->deleteByOptionId($optionObject->getVar('option_id'));
419
                            //update vote count in poll
420
                            $xpPollHandler->updateCount($pollObject);
421
                        } else {
422
                            xoops_error($xpLogHandler->getHtmlErrors());
423
                            break;
424
                        }
425
                    } else {
426
                        $optionObject->setVar('option_text', $optionTextArray[$key]);
427
                        $optionObject->setVar('option_color', $optionColorArray[$key]);
428
                        $optionObject->setVar('poll_id', $poll_id);
429
                        $xpOptHandler->insert($optionObject);
430
                    }
431
                } else {
432
                    // new option object
433
                    $optionObject          = $xpOptHandler->create();
434
                    $optionTextArray[$key] = trim($optionTextArray[$key]);
435
                    if ('' !== $optionTextArray[$key]) { // ignore if text is empty
436
                        $optionObject->setVar('option_text', $optionTextArray[$key]);
437
                        $optionObject->setVar('option_color', $optionColorArray[$key]);
438
                        $optionObject->setVar('poll_id', $poll_id);
439
                        $xpOptHandler->insert($optionObject);
440
                    }
441
                    unset($optionObject);
442
                }
443
            }
444
            // old xoopspoll or umfrage or any clone from them
445
        } else {
446
            $pollObject->setVar('question', Request::getString('question', '', 'POST'));
447
            $pollObject->setVar('description', Request::getString('description', '', 'POST'));
448
449
            $end_time = Request::getString('end_time', '', 'POST');
450
            if ('' !== $end_time) {
451
                $timezone = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('timezone') : null;
452
                $pollObject->setVar('end_time', userTimeToServerTime(method_exists('XoopsLocal', 'strtotime') ? XoopsLocal::strtotime($end_time) : strtotime($end_time), $timezone));
453
            }
454
            $pollObject->setVar('display', 0);
455
            $pollObject->setVar('weight', Request::getInt('weight', 0, 'POST'));
456
            $pollObject->setVar('multiple', Request::getInt('multiple', 0, 'POST'));
457
            $pollObject->setVar('user_id', Request::getInt('user_id', 0, 'POST'));
458
            if (Request::getInt('notify', 0, 'POST') && $end_time > time()) {
459
                // if notify, set mail status to "not mailed"
460
                $pollObject->setVar('mail_status', Constants::POLL_NOT_MAILED);
461
            } else {
462
                // if not notify, set mail status to already "mailed"
463
                $pollObject->setVar('mail_status', Constants::POLL_MAILED);
464
            }
465
466
            if (!$pollObject->store()) {
467
                xoops_error($pollObject->getHtmlErrors);
468
                break;
469
            }
470
            $i            = 0;
471
            $option_id    = Request::getArray('option_id', null, 'POST');
472
            $option_color = Request::getArray('option_color', null, 'POST');
473
            $classOption  = $classPoll . 'Option';
474
            $classLog     = $classPoll . 'Log';
475
            foreach ($option_id as $opid) {
476
                $optionObject    = new $classOption($opid);
477
                $option_text[$i] = trim($option_text[$i]);
478
                if ('' !== $option_text[$i]) {
479
                    $optionObject->setVar('option_text', $option_text[$i]);
480
                    $optionObject->setVar('option_color', $option_color[$i]);
481
                    $optionObject->store();
482
                } else {
483
                    if (false !== $optionObject->delete()) {
484
                        $classLog::deleteByOptionId($option->getVar('option_id'));
485
                    }
486
                }
487
                ++$i;
488
            }
489
            $pollObject->updateCount();
490
        }
491
        // clear the template cache so changes take effect immediately
492
        require_once $GLOBALS['xoops']->path('class/template.php');
493
        xoops_template_clear_module_cache($GLOBALS['xoopsModule']->getVar('mid'));
494
        xoops_template_clear_module_cache($pollModuleHandler->getVar('mid'));
495
496
        // update topic to indicate it has a poll
497
        $topicObject->setVar('topic_haspoll', 1);
498
        $topicObject->setVar('poll_id', $pollObject->getVar('poll_id'));
499
        $success = $topicHandler->insert($topicObject);
500
        if (!$success) {
501
            xoops_error($topicHandler->getHtmlErrors());
502
        } else {
503
            redirect_header("viewtopic.php?topic_id={$topic_id}", 2, _MD_NEWBB_POLL_DBUPDATED);
504
        }
505
        break; // op: save | update
506
    case 'addmore':
507
        $question = $pollObject->getVar('question');
508
        unset($pollObject);
509
        $poll_form = new \XoopsThemeForm(_MD_NEWBB_POLL_ADDMORE, 'poll_form', 'polls.php', 'post', true);
510
        $poll_form->addElement(new \XoopsFormLabel(_MD_NEWBB_POLL_POLLQUESTION, $question));
511
        // new xoopspoll module
512
        if ($pollModuleHandler->getVar('version') >= 201) {
513
        } elseif ($pollModuleHandler->getVar('version') >= 140) {
514
            $xpOptHandler = Xoopspoll\Helper::getInstance()->getHandler('Option');
515
            $option_tray  = $xpOptHandler->renderOptionFormTray($poll_id);
516
            // old xoopspoll or umfrage or any clone from them
517
        } else {
518
            $option_tray    = new \XoopsFormElementTray(_MD_NEWBB_POLL_POLLOPTIONS, '');
519
            $barcolor_array = \XoopsLists::getImgListAsArray($GLOBALS['xoops']->path('modules/' . $GLOBALS['xoopsModuleConfig']['poll_module'] . '/assets/images/colorbars/'));
520
            for ($i = 0; $i < 10; ++$i) {
521
                $current_bar = ('blank.gif' !== current($barcolor_array)) ? current($barcolor_array) : next($barcolor_array);
522
                $option_text = new \XoopsFormText('', 'option_text[]', 50, 255);
523
                $option_tray->addElement($option_text);
524
                $color_select = new \XoopsFormSelect('', "option_color[{$i}]", $current_bar);
525
                $color_select->addOptionArray($barcolor_array);
526
                $color_select->setExtra("onchange='showImgSelected(\"option_color_image[{$i}]\", \"option_color[{$i}]\", \"modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/assets/images/colorbars\", \"\", \"" . XOOPS_URL . "\")'");
527
                $color_label = new \XoopsFormLabel(
528
                    '', "<img src='" . $GLOBALS['xoops']->url("modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/assets/images/colorbars/{$current_bar}") . "' name='option_color_image[{$i}]' id='option_color_image[{$i}]' class='alignbottom' width='30' height='15' alt='' ><br>"
529
                );
530
                $option_tray->addElement($color_select);
531
                $option_tray->addElement($color_label);
532
                unset($color_select, $color_label, $option_text);
533
                if (!next($barcolor_array)) {
534
                    reset($barcolor_array);
535
                }
536
            }
537
        }
538
        $poll_form->addElement($option_tray);
539
        $poll_form->addElement(new \XoopsFormButtonTray('poll_submit', _SUBMIT, 'submit'));
540
        $poll_form->addElement(new \XoopsFormHidden('op', 'savemore'));
541
        $poll_form->addElement(new \XoopsFormHidden('topic_id', $topic_id));
542
        $poll_form->addElement(new \XoopsFormHidden('poll_id', $poll_id));
543
544
        echo '<h4>' . _MD_NEWBB_POLL_POLLCONF . "</h4>\n";
545
        $poll_form->display();
546
        break;
547
    case 'savemore':
548
        // check security token
549
        if (!$GLOBALS['xoopsSecurity']->check()) {
550
            redirect_header(Request::getString('SCRIPT_NAME', '', 'SERVER'), 2, implode('<br>', $GLOBALS['xoopsSecurity']->getErrors()));
551
        }
552
553
        $option_text   = Request::getString('option_text', '', 'POST');
554
        $option_string = is_array($option_text) ? implode('', $option_text) : $option_text;
0 ignored issues
show
The condition is_array($option_text) is always false.
Loading history...
555
        $option_string = trim($option_string);
556
        if ('' === $option_string) {
557
            // irmtfan - issue with javascript:history.go(-1)
558
            redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 2, _MD_NEWBB_ERROROCCURED . ': ' . _MD_NEWBB_POLL_POLLOPTIONS . ' !');
559
        }
560
        $i            = 0;
561
        $option_color = Request::getArray('option_color', null, 'POST');
562
        foreach ($option_text as $optxt) {
563
            $optxt = trim($optxt);
564
            if ('' !== $optxt) {
565
                // new xoopspoll module
566
                if ($pollModuleHandler->getVar('version') >= 201) {
567
                } elseif ($pollModuleHandler->getVar('version') >= 140) {
568
                    $xpOptHandler = Xoopspoll\Helper::getInstance()->getHandler('Option');
569
                    $optionObject = $xpOptHandler->create();
570
                    $optionObject->setVar('option_text', $optxt);
571
                    $optionObject->setVar('poll_id', $poll_id);
572
                    $optionObject->setVar('option_color', $option_color[$i]);
573
                    $xpOptHandler->insert($optionObject);
574
                    // old xoopspoll or umfrage or any clone from them
575
                } else {
576
                    $classOption  = $classPoll . 'Option';
577
                    $optionObject = new $classOption();
578
                    $optionObject->setVar('option_text', $optxt);
579
                    $optionObject->setVar('poll_id', $poll_id);
580
                    $optionObject->setVar('option_color', $option_color[$i]);
581
                    $optionObject->store();
582
                }
583
                unset($optionObject);
584
            }
585
            ++$i;
586
        }
587
        require_once $GLOBALS['xoops']->path('class/template.php');
588
        xoops_template_clear_module_cache($GLOBALS['xoopsModule']->getVar('mid'));
589
        xoops_template_clear_module_cache($pollModuleHandler->getVar('mid'));
590
        redirect_header("polls.php?op=edit&amp;poll_id={$poll_id}&amp;topic_id={$topic_id}", 2, _MD_NEWBB_POLL_DBUPDATED);
591
        break;
592
    case 'delete':
593
        echo '<h4>' . _MD_NEWBB_POLL_POLLCONF . "</h4>\n";
594
        xoops_confirm(['op' => 'delete_ok', 'topic_id' => $topic_id, 'poll_id' => $poll_id], 'polls.php', sprintf(_MD_NEWBB_POLL_RUSUREDEL, $pollObject->getVar('question')));
595
        break;
596
    case 'delete_ok':
597
        // check security token
598
        if (!$GLOBALS['xoopsSecurity']->check()) {
599
            redirect_header(Request::getString('SCRIPT_NAME', '', 'SERVER'), 2, implode('<br>', $GLOBALS['xoopsSecurity']->getErrors()));
600
        }
601
        //try and delete the poll
602
        // new xoopspoll module
603
        if ($pollModuleHandler->getVar('version') >= 201) {
604
        } elseif ($pollModuleHandler->getVar('version') >= 140) {
605
            $status = $xpPollHandler->delete($pollObject);
606
            if (false !== $status) {
607
                $xpOptHandler = Xoopspoll\Helper::getInstance()->getHandler('Option');
608
                $xpLogHandler = Xoopspoll\Helper::getInstance()->getHandler('Log');
609
                $xpOptHandler->deleteByPollId($poll_id);
610
                $xpLogHandler->deleteByPollId($poll_id);
611
            } else {
612
                $msg = $xpPollHandler->getHtmlErrors();
613
            }
614
            // old xoopspoll or umfrage or any clone from them
615
        } else {
616
            $status      = $pollObject->delete();
617
            $classOption = $classPoll . 'Option';
618
            $classLog    = $classPoll . 'Log';
619
            if (false !== $status) {
620
                $classOption::deleteByPollId($poll_id);
621
                $classLog::deleteByPollId($poll_id);
622
            } else {
623
                $msg = $pollObject->getHtmlErrors();
624
            }
625
        }
626
        if (false !== $status) {
627
            require_once $GLOBALS['xoops']->path('class/template.php');
628
            xoops_template_clear_module_cache($xoopsModule->getVar('mid'));
629
            xoops_template_clear_module_cache($pollModuleHandler->getVar('mid'));
630
            // delete comments for this poll
631
            xoops_comment_delete($xoopsModule->getVar('mid'), $poll_id);
632
633
            $topicObject->setVar('votes', 0); // not sure why we want to clear votes too... but I left it alone
634
            $topicObject->setVar('topic_haspoll', 0);
635
            $topicObject->setVar('poll_id', 0);
636
            $success = $topicHandler->insert($topicObject);
637
            if (!$success) {
638
                xoops_error($topicHandler->getHtmlErrors());
639
                break;
640
            }
641
        } else {
642
            xoops_error($msg);
643
            break;
644
        }
645
        redirect_header(XOOPS_URL . "/modules/newbb/viewtopic.php?topic_id={$topic_id}", 1, _MD_NEWBB_POLL_DBUPDATED);
646
        break;
647
    case 'restart':
648
        // new xoopspoll module
649
        if ($pollModuleHandler->getVar('version') >= 201) {
650
        } elseif ($pollModuleHandler->getVar('version') >= 140) {
651
            //            $classConstants        = new XoopsModules\Xoopspoll\Constants();
652
            $default_poll_duration = Constants::DEFAULT_POLL_DURATION;
653
            // old xoopspoll or umfrage or any clone from them
654
        } else {
655
            $default_poll_duration = (86400 * 10);
656
        }
657
        $poll_form   = new \XoopsThemeForm(_MD_NEWBB_POLL_RESTARTPOLL, 'poll_form', 'polls.php', 'post', true);
658
        $expire_text = new \XoopsFormText(
659
            _MD_NEWBB_POLL_EXPIRATION . '<br><small>' . _MD_NEWBB_POLL_FORMAT . '<br>' . sprintf(_MD_NEWBB_POLL_CURRENTTIME, formatTimestamp(time(), 'Y-m-d H:i:s')) . '<br>' . sprintf(
660
                _MD_NEWBB_POLL_EXPIREDAT,
661
                formatTimestamp($pollObject->getVar('end_time'), 'Y-m-d H:i:s')
662
            ) . '</small>', 'end_time', 20, 19, formatTimestamp(time() + $default_poll_duration, 'Y-m-d H:i:s')
663
        );
664
        $poll_form->addElement($expire_text);
665
        $poll_form->addElement(new \XoopsFormRadioYN(_MD_NEWBB_POLL_NOTIFY, 'notify', 1));
666
        $poll_form->addElement(new \XoopsFormRadioYN(_MD_NEWBB_POLL_RESET, 'reset', 0));
667
        $poll_form->addElement(new \XoopsFormHidden('op', 'restart_ok'));
668
        $poll_form->addElement(new \XoopsFormHidden('topic_id', $topic_id));
669
        $poll_form->addElement(new \XoopsFormHidden('poll_id', $poll_id));
670
        $poll_form->addElement(new \XoopsFormButton('', 'poll_submit', _MD_NEWBB_POLL_RESTART, 'submit'));
671
672
        echo '<h4>' . _MD_NEWBB_POLL_POLLCONF . "</h4>\n";
673
        $poll_form->display();
674
        break;
675
    case 'restart_ok':
676
        // check security token
677
        if (!$GLOBALS['xoopsSecurity']->check()) {
678
            redirect_header(Request::getString('SCRIPT_NAME', '', 'SERVER'), 2, implode('<br>', $GLOBALS['xoopsSecurity']->getErrors()));
679
        }
680
681
        // new xoopspoll module
682
        if ($pollModuleHandler->getVar('version') >= 201) {
683
        } elseif ($pollModuleHandler->getVar('version') >= 140) {
684
            $classConstants        = new XoopsModules\Xoopspoll\Constants();
685
            $default_poll_duration = Constants::DEFAULT_POLL_DURATION;
686
            $poll_not_mailed       = Constants::POLL_NOT_MAILED;
687
            $poll_mailed           = Constants::POLL_MAILED;
688
            // old xoopspoll or umfrage or any clone from them
689
        } else {
690
            $default_poll_duration = (86400 * 10);
691
            $poll_not_mailed       = Xoopspoll\Constants::POLL_NOT_MAILED;
692
            $poll_mailed           = Xoopspoll\Constants::POLL_MAILED;
693
        }
694
695
        $end_time = !Request::getInt('end_time', 0, 'POST');
696
        if (0 !== $end_time) {
0 ignored issues
show
The condition 0 !== $end_time is always true.
Loading history...
697
            $timezone = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('timezone') : null;
698
            $pollObject->setVar('end_time', userTimeToServerTime(method_exists('XoopsLocal', 'strtotime') ? XoopsLocal::strtotime($end_time) : strtotime($end_time), $timezone));
699
        } else {
700
            $pollObject->setVar('end_time', time() + $default_poll_duration);
701
        }
702
703
        $isNotify = Request::getInt('notify', 0, 'POST');
704
        if (!empty($isNotify) && ($end_time > time())) {
705
            // if notify, set mail status to "not mailed"
706
            $pollObject->setVar('mail_status', $poll_not_mailed);
707
        } else {
708
            // if not notify, set mail status to already "mailed"
709
            $pollObject->setVar('mail_status', $poll_mailed);
710
        }
711
712
        // new xoopspoll module
713
        if ($pollModuleHandler->getVar('version') >= 201) {
714
        } elseif ($pollModuleHandler->getVar('version') >= 140) {
715
            if (!$xpPollHandler->insert($pollObject)) {  // update the poll
716
                xoops_error($pollObject->getHtmlErrors());
717
                exit();
718
            }
719
            if (Request::getInt('reset', 0, 'POST')) { // reset all vote/voter counters
720
                /** @var \XoopsModules\Xoopspoll\OptionHandler $xpOptHandler */
721
                $xpOptHandler = Xoopspoll\Helper::getInstance()->getHandler('Option');
722
                /** @var \XoopsModules\Xoopspoll\LogHandler $xpLogHandler */
723
                $xpLogHandler = Xoopspoll\Helper::getInstance()->getHandler('Log');
724
                $xpLogHandler->deleteByPollId($poll_id);
725
                $xpOptHandler->resetCountByPollId($poll_id);
726
                $xpPollHandler->updateCount($pollObject);
727
            }
728
            // old xoopspoll or umfrage or any clone from them
729
        } else {
730
            if (!$pollObject->store()) { // update the poll
731
                xoops_error($pollObject->getHtmlErrors());
732
                exit();
733
            }
734
            if (Request::getInt('reset', 0, 'POST')) { // reset all logs
735
                $classOption = $classPoll . 'Option';
736
                $classLog    = $classPoll . 'Log';
737
                $classLog::deleteByPollId($poll_id);
738
                $classOption::resetCountByPollId($poll_id);
739
                $pollObject->updateCount();
740
            }
741
        }
742
        require_once $GLOBALS['xoops']->path('class/template.php');
743
        xoops_template_clear_module_cache($xoopsModule->getVar('mid'));
744
        xoops_template_clear_module_cache($pollModuleHandler->getVar('mid'));
745
        redirect_header(XOOPS_URL . "/modules/newbb/viewtopic.php?topic_id={$topic_id}", 1, _MD_NEWBB_POLL_DBUPDATED);
746
        break;
747
    case 'log':
748
        // new xoopspoll module
749
        if ($pollModuleHandler->getVar('version') >= 201) {
750
        } elseif ($pollModuleHandler->getVar('version') >= 140) {
751
            redirect_header($GLOBALS['xoops']->url("modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/admin/main.php?op=log&amp;poll_id={$poll_id}"), 2, _MD_NEWBB_POLL_VIEWLOG);
752
            // old xoopspoll or umfrage or any clone from them
753
        } else {
754
            redirect_header($GLOBALS['xoops']->url("modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/admin/index.php?op=log&amp;poll_id={$poll_id}"), 2, _MD_NEWBB_POLL_VIEWLOG);
755
        }
756
        break;
757
} // switch
758
759
// irmtfan move to footer.php
760
require_once __DIR__ . '/footer.php';
761
require_once $GLOBALS['xoops']->path('footer.php');
762