@@ -111,213 +111,377 @@ discard block |
||
| 111 | 111 | } |
| 112 | 112 | } |
| 113 | 113 | switch ($op) { |
| 114 | - case 'add': |
|
| 115 | - // new xoopspoll module |
|
| 116 | - if ($pollModuleHandler->getVar('version') >= 140) { |
|
| 117 | - echo '<h4>' . _MD_NEWBB_POLL_CREATNEWPOLL . "</h4>\n"; |
|
| 118 | - $pollObject->renderForm(Request::getString('PHP_SELF', '', 'SERVER'), 'post', ['topic_id' => $topic_id]); |
|
| 119 | - // old xoopspoll or umfrage or any clone from them |
|
| 120 | - } else { |
|
| 121 | - $classOption = $classPoll . 'Option'; |
|
| 122 | - $poll_form = new \XoopsThemeForm(_MD_NEWBB_POLL_CREATNEWPOLL, 'poll_form', 'polls.php', 'post', true); |
|
| 123 | - $author_label = new \XoopsFormLabel(_MD_NEWBB_POLL_AUTHOR, is_object($GLOBALS['xoopsUser']) ? ("<a href='" |
|
| 124 | - . XOOPS_URL |
|
| 125 | - . '/userinfo.php?uid=' |
|
| 126 | - . $GLOBALS['xoopsUser']->getVar('uid') |
|
| 127 | - . "'>" |
|
| 128 | - . newbbGetUnameFromId($GLOBALS['xoopsUser']->getVar('uid'), $GLOBALS['xoopsModuleConfig']['show_realname']) |
|
| 129 | - . '</a>') : $GLOBALS['xoopsConfig']['anonymous']); |
|
| 130 | - $poll_form->addElement($author_label); |
|
| 131 | - $question_text = new \XoopsFormText(_MD_NEWBB_POLL_POLLQUESTION, 'question', 50, 255); |
|
| 132 | - $poll_form->addElement($question_text); |
|
| 133 | - $desc_tarea = new \XoopsFormTextarea(_MD_NEWBB_POLL_POLLDESC, 'description'); |
|
| 134 | - $poll_form->addElement($desc_tarea); |
|
| 135 | - $currenttime = formatTimestamp(time(), 'Y-m-d H:i:s'); |
|
| 136 | - $endtime = formatTimestamp(time() + 604800, 'Y-m-d H:i:s'); |
|
| 137 | - $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); |
|
| 138 | - $poll_form->addElement($expire_text); |
|
| 114 | + case 'add': |
|
| 115 | + // new xoopspoll module |
|
| 116 | + if ($pollModuleHandler->getVar('version') >= 140) { |
|
| 117 | + echo '<h4>' . _MD_NEWBB_POLL_CREATNEWPOLL . "</h4>\n"; |
|
| 118 | + $pollObject->renderForm(Request::getString('PHP_SELF', '', 'SERVER'), 'post', ['topic_id' => $topic_id]); |
|
| 119 | + // old xoopspoll or umfrage or any clone from them |
|
| 120 | + } else { |
|
| 121 | + $classOption = $classPoll . 'Option'; |
|
| 122 | + $poll_form = new \XoopsThemeForm(_MD_NEWBB_POLL_CREATNEWPOLL, 'poll_form', 'polls.php', 'post', true); |
|
| 123 | + $author_label = new \XoopsFormLabel(_MD_NEWBB_POLL_AUTHOR, is_object($GLOBALS['xoopsUser']) ? ("<a href='" |
|
| 124 | + . XOOPS_URL |
|
| 125 | + . '/userinfo.php?uid=' |
|
| 126 | + . $GLOBALS['xoopsUser']->getVar('uid') |
|
| 127 | + . "'>" |
|
| 128 | + . newbbGetUnameFromId($GLOBALS['xoopsUser']->getVar('uid'), $GLOBALS['xoopsModuleConfig']['show_realname']) |
|
| 129 | + . '</a>') : $GLOBALS['xoopsConfig']['anonymous']); |
|
| 130 | + $poll_form->addElement($author_label); |
|
| 131 | + $question_text = new \XoopsFormText(_MD_NEWBB_POLL_POLLQUESTION, 'question', 50, 255); |
|
| 132 | + $poll_form->addElement($question_text); |
|
| 133 | + $desc_tarea = new \XoopsFormTextarea(_MD_NEWBB_POLL_POLLDESC, 'description'); |
|
| 134 | + $poll_form->addElement($desc_tarea); |
|
| 135 | + $currenttime = formatTimestamp(time(), 'Y-m-d H:i:s'); |
|
| 136 | + $endtime = formatTimestamp(time() + 604800, 'Y-m-d H:i:s'); |
|
| 137 | + $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); |
|
| 138 | + $poll_form->addElement($expire_text); |
|
| 139 | 139 | |
| 140 | - $weight_text = new \XoopsFormText(_MD_NEWBB_POLL_DISPLAYORDER, 'weight', 6, 5, 0); |
|
| 141 | - $poll_form->addElement($weight_text); |
|
| 142 | - |
|
| 143 | - $multi_yn = new \XoopsFormRadioYN(_MD_NEWBB_POLL_ALLOWMULTI, 'multiple', 0); |
|
| 144 | - $poll_form->addElement($multi_yn); |
|
| 145 | - |
|
| 146 | - $notify_yn = new \XoopsFormRadioYN(_MD_NEWBB_POLL_NOTIFY, 'notify', 1); |
|
| 147 | - $poll_form->addElement($notify_yn); |
|
| 148 | - |
|
| 149 | - $option_tray = new \XoopsFormElementTray(_MD_NEWBB_POLL_POLLOPTIONS, ''); |
|
| 150 | - $barcolor_array = \XoopsLists::getImgListAsArray($GLOBALS['xoops']->path('modules/' . $GLOBALS['xoopsModuleConfig']['poll_module'] . '/assets/images/colorbars/')); |
|
| 151 | - for ($i = 0; $i < 10; ++$i) { |
|
| 152 | - $current_bar = ('blank.gif' !== current($barcolor_array)) ? current($barcolor_array) : next($barcolor_array); |
|
| 153 | - $option_text = new \XoopsFormText('', 'option_text[]', 50, 255); |
|
| 154 | - $option_tray->addElement($option_text); |
|
| 155 | - $color_select = new \XoopsFormSelect('', "option_color[{$i}]", $current_bar); |
|
| 156 | - $color_select->addOptionArray($barcolor_array); |
|
| 157 | - $color_select->setExtra("onchange='showImgSelected(\"option_color_image[{$i}]\", \"option_color[{$i}]\", \"modules/" . $GLOBALS['xoopsModuleConfig']['poll_module'] . '/assets/images/colorbars", "", "' . XOOPS_URL . "\")'"); |
|
| 158 | - $color_label = new \XoopsFormLabel('', "<img src='" |
|
| 159 | - . XOOPS_URL |
|
| 160 | - . '/modules/' |
|
| 161 | - . $GLOBALS['xoopsModuleConfig']['poll_module'] |
|
| 162 | - . '/assets/images/colorbars/' |
|
| 163 | - . $current_bar |
|
| 164 | - . "' name='option_color_image[{$i}]' id='option_color_image[{$i}]' width='30' align='bottom' height='15' alt='' /><br>"); |
|
| 165 | - $option_tray->addElement($color_select); |
|
| 166 | - $option_tray->addElement($color_label); |
|
| 167 | - if (!next($barcolor_array)) { |
|
| 168 | - reset($barcolor_array); |
|
| 140 | + $weight_text = new \XoopsFormText(_MD_NEWBB_POLL_DISPLAYORDER, 'weight', 6, 5, 0); |
|
| 141 | + $poll_form->addElement($weight_text); |
|
| 142 | + |
|
| 143 | + $multi_yn = new \XoopsFormRadioYN(_MD_NEWBB_POLL_ALLOWMULTI, 'multiple', 0); |
|
| 144 | + $poll_form->addElement($multi_yn); |
|
| 145 | + |
|
| 146 | + $notify_yn = new \XoopsFormRadioYN(_MD_NEWBB_POLL_NOTIFY, 'notify', 1); |
|
| 147 | + $poll_form->addElement($notify_yn); |
|
| 148 | + |
|
| 149 | + $option_tray = new \XoopsFormElementTray(_MD_NEWBB_POLL_POLLOPTIONS, ''); |
|
| 150 | + $barcolor_array = \XoopsLists::getImgListAsArray($GLOBALS['xoops']->path('modules/' . $GLOBALS['xoopsModuleConfig']['poll_module'] . '/assets/images/colorbars/')); |
|
| 151 | + for ($i = 0; $i < 10; ++$i) { |
|
| 152 | + $current_bar = ('blank.gif' !== current($barcolor_array)) ? current($barcolor_array) : next($barcolor_array); |
|
| 153 | + $option_text = new \XoopsFormText('', 'option_text[]', 50, 255); |
|
| 154 | + $option_tray->addElement($option_text); |
|
| 155 | + $color_select = new \XoopsFormSelect('', "option_color[{$i}]", $current_bar); |
|
| 156 | + $color_select->addOptionArray($barcolor_array); |
|
| 157 | + $color_select->setExtra("onchange='showImgSelected(\"option_color_image[{$i}]\", \"option_color[{$i}]\", \"modules/" . $GLOBALS['xoopsModuleConfig']['poll_module'] . '/assets/images/colorbars", "", "' . XOOPS_URL . "\")'"); |
|
| 158 | + $color_label = new \XoopsFormLabel('', "<img src='" |
|
| 159 | + . XOOPS_URL |
|
| 160 | + . '/modules/' |
|
| 161 | + . $GLOBALS['xoopsModuleConfig']['poll_module'] |
|
| 162 | + . '/assets/images/colorbars/' |
|
| 163 | + . $current_bar |
|
| 164 | + . "' name='option_color_image[{$i}]' id='option_color_image[{$i}]' width='30' align='bottom' height='15' alt='' /><br>"); |
|
| 165 | + $option_tray->addElement($color_select); |
|
| 166 | + $option_tray->addElement($color_label); |
|
| 167 | + if (!next($barcolor_array)) { |
|
| 168 | + reset($barcolor_array); |
|
| 169 | + } |
|
| 170 | + unset($color_select, $color_label); |
|
| 169 | 171 | } |
| 170 | - unset($color_select, $color_label); |
|
| 172 | + $poll_form->addElement($option_tray); |
|
| 173 | + |
|
| 174 | + $poll_form->addElement(new \XoopsFormHidden('op', 'save')); |
|
| 175 | + $poll_form->addElement(new \XoopsFormHidden('topic_id', $topic_id)); |
|
| 176 | + $poll_form->addElement(new \XoopsFormHidden('poll_id', $poll_id)); |
|
| 177 | + $poll_form->addElement(new \XoopsFormHidden('user_id', is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('uid') : 0)); |
|
| 178 | + $poll_form->addElement(new \XoopsFormButtonTray('poll_submit', _SUBMIT, 'submit')); |
|
| 179 | + echo '<h4>' . _MD_NEWBB_POLL_POLLCONF . '</h4>'; |
|
| 180 | + $poll_form->display(); |
|
| 171 | 181 | } |
| 172 | - $poll_form->addElement($option_tray); |
|
| 173 | - |
|
| 174 | - $poll_form->addElement(new \XoopsFormHidden('op', 'save')); |
|
| 175 | - $poll_form->addElement(new \XoopsFormHidden('topic_id', $topic_id)); |
|
| 176 | - $poll_form->addElement(new \XoopsFormHidden('poll_id', $poll_id)); |
|
| 177 | - $poll_form->addElement(new \XoopsFormHidden('user_id', is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('uid') : 0)); |
|
| 178 | - $poll_form->addElement(new \XoopsFormButtonTray('poll_submit', _SUBMIT, 'submit')); |
|
| 179 | - echo '<h4>' . _MD_NEWBB_POLL_POLLCONF . '</h4>'; |
|
| 180 | - $poll_form->display(); |
|
| 181 | - } |
|
| 182 | - break; // op: add |
|
| 182 | + break; // op: add |
|
| 183 | 183 | |
| 184 | - case 'edit': |
|
| 185 | - // new xoopspoll module |
|
| 186 | - if ($pollModuleHandler->getVar('version') >= 140) { |
|
| 187 | - echo '<h4>' . _MD_NEWBB_POLL_EDITPOLL . "</h4>\n"; |
|
| 188 | - $pollObject->renderForm(Request::getString('PHP_SELF', '', 'SERVER'), 'post', ['topic_id' => $topic_id]); |
|
| 189 | - // old xoopspoll or umfrage or any clone from them |
|
| 190 | - } else { |
|
| 191 | - $classOption = $classPoll . 'Option'; |
|
| 192 | - $poll_form = new \XoopsThemeForm(_MD_NEWBB_POLL_EDITPOLL, 'poll_form', 'polls.php', 'post', true); |
|
| 193 | - $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>'); |
|
| 194 | - $poll_form->addElement($author_label); |
|
| 195 | - $question_text = new \XoopsFormText(_MD_NEWBB_POLL_POLLQUESTION, 'question', 50, 255, $pollObject->getVar('question', 'E')); |
|
| 196 | - $poll_form->addElement($question_text); |
|
| 197 | - $desc_tarea = new \XoopsFormTextarea(_MD_NEWBB_POLL_POLLDESC, 'description', $pollObject->getVar('description', 'E')); |
|
| 198 | - $poll_form->addElement($desc_tarea); |
|
| 199 | - $date = formatTimestamp($pollObject->getVar('end_time'), 'Y-m-d H:i:s'); // important "Y-m-d H:i:s" use in jdf function |
|
| 200 | - if (!$pollObject->hasExpired()) { |
|
| 201 | - $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); |
|
| 202 | - $poll_form->addElement($expire_text); |
|
| 184 | + case 'edit': |
|
| 185 | + // new xoopspoll module |
|
| 186 | + if ($pollModuleHandler->getVar('version') >= 140) { |
|
| 187 | + echo '<h4>' . _MD_NEWBB_POLL_EDITPOLL . "</h4>\n"; |
|
| 188 | + $pollObject->renderForm(Request::getString('PHP_SELF', '', 'SERVER'), 'post', ['topic_id' => $topic_id]); |
|
| 189 | + // old xoopspoll or umfrage or any clone from them |
|
| 203 | 190 | } else { |
| 204 | - // irmtfan full URL - add topic_id |
|
| 205 | - $restart_label = new \XoopsFormLabel( |
|
| 206 | - _MD_NEWBB_POLL_EXPIRATION, |
|
| 207 | - sprintf(_MD_NEWBB_POLL_EXPIREDAT, $date) . "<br><a href='" . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . "/polls.php?op=restart&poll_id={$poll_id}&topic_id={$topic_id}'>" . _MD_NEWBB_POLL_RESTART . '</a>' |
|
| 208 | - ); |
|
| 209 | - $poll_form->addElement($restart_label); |
|
| 210 | - } |
|
| 211 | - $weight_text = new \XoopsFormText(_MD_NEWBB_POLL_DISPLAYORDER, 'weight', 6, 5, $pollObject->getVar('weight')); |
|
| 212 | - $poll_form->addElement($weight_text); |
|
| 213 | - $multi_yn = new \XoopsFormRadioYN(_MD_NEWBB_POLL_ALLOWMULTI, 'multiple', $pollObject->getVar('multiple')); |
|
| 214 | - $poll_form->addElement($multi_yn); |
|
| 215 | - $options_arr =& $classOption::getAllByPollId($poll_id); |
|
| 216 | - $notify_value = 1; |
|
| 217 | - if (0 !== $pollObject->getVar('mail_status')) { |
|
| 218 | - $notify_value = 0; |
|
| 219 | - } |
|
| 220 | - $notify_yn = new \XoopsFormRadioYN(_MD_NEWBB_POLL_NOTIFY, 'notify', $notify_value); |
|
| 221 | - $poll_form->addElement($notify_yn); |
|
| 222 | - $option_tray = new \XoopsFormElementTray(_MD_NEWBB_POLL_POLLOPTIONS, ''); |
|
| 223 | - $barcolor_array = \XoopsLists::getImgListAsArray($GLOBALS['xoops']->path("modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/assets/images/colorbars/")); |
|
| 224 | - $i = 0; |
|
| 225 | - foreach ($options_arr as $option) { |
|
| 226 | - /** @var \XoopsPoll $option */ |
|
| 227 | - $option_tray->addElement(new \XoopsFormText('', 'option_text[]', 50, 255, $option->getVar('option_text'))); |
|
| 228 | - $option_tray->addElement(new \XoopsFormHidden('option_id[]', $option->getVar('option_id'))); |
|
| 229 | - $color_select = new \XoopsFormSelect('', 'option_color[{$i}]', $option->getVar('option_color')); |
|
| 230 | - $color_select->addOptionArray($barcolor_array); |
|
| 231 | - $color_select->setExtra("onchange='showImgSelected(\"option_color_image[{$i}]\", \"option_color[" . $i . "]\", \"modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/assets/images/colorbars\", \"\", \"" . XOOPS_URL . "\")'"); |
|
| 232 | - $color_label = new \XoopsFormLabel('', "<img src='" |
|
| 233 | - . $GLOBALS['xoops']->url("modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/assets/images/colorbars/" . $option->getVar('option_color', 'E')) |
|
| 234 | - . "' name='option_color_image[{$i}]' id='option_color_image[{$i}]' class='alignbottom' width='30' height='15' alt='' /><br>"); |
|
| 235 | - $option_tray->addElement($color_select); |
|
| 236 | - $option_tray->addElement($color_label); |
|
| 237 | - unset($color_select, $color_label); |
|
| 238 | - ++$i; |
|
| 191 | + $classOption = $classPoll . 'Option'; |
|
| 192 | + $poll_form = new \XoopsThemeForm(_MD_NEWBB_POLL_EDITPOLL, 'poll_form', 'polls.php', 'post', true); |
|
| 193 | + $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>'); |
|
| 194 | + $poll_form->addElement($author_label); |
|
| 195 | + $question_text = new \XoopsFormText(_MD_NEWBB_POLL_POLLQUESTION, 'question', 50, 255, $pollObject->getVar('question', 'E')); |
|
| 196 | + $poll_form->addElement($question_text); |
|
| 197 | + $desc_tarea = new \XoopsFormTextarea(_MD_NEWBB_POLL_POLLDESC, 'description', $pollObject->getVar('description', 'E')); |
|
| 198 | + $poll_form->addElement($desc_tarea); |
|
| 199 | + $date = formatTimestamp($pollObject->getVar('end_time'), 'Y-m-d H:i:s'); // important "Y-m-d H:i:s" use in jdf function |
|
| 200 | + if (!$pollObject->hasExpired()) { |
|
| 201 | + $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); |
|
| 202 | + $poll_form->addElement($expire_text); |
|
| 203 | + } else { |
|
| 204 | + // irmtfan full URL - add topic_id |
|
| 205 | + $restart_label = new \XoopsFormLabel( |
|
| 206 | + _MD_NEWBB_POLL_EXPIRATION, |
|
| 207 | + sprintf(_MD_NEWBB_POLL_EXPIREDAT, $date) . "<br><a href='" . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . "/polls.php?op=restart&poll_id={$poll_id}&topic_id={$topic_id}'>" . _MD_NEWBB_POLL_RESTART . '</a>' |
|
| 208 | + ); |
|
| 209 | + $poll_form->addElement($restart_label); |
|
| 210 | + } |
|
| 211 | + $weight_text = new \XoopsFormText(_MD_NEWBB_POLL_DISPLAYORDER, 'weight', 6, 5, $pollObject->getVar('weight')); |
|
| 212 | + $poll_form->addElement($weight_text); |
|
| 213 | + $multi_yn = new \XoopsFormRadioYN(_MD_NEWBB_POLL_ALLOWMULTI, 'multiple', $pollObject->getVar('multiple')); |
|
| 214 | + $poll_form->addElement($multi_yn); |
|
| 215 | + $options_arr =& $classOption::getAllByPollId($poll_id); |
|
| 216 | + $notify_value = 1; |
|
| 217 | + if (0 !== $pollObject->getVar('mail_status')) { |
|
| 218 | + $notify_value = 0; |
|
| 219 | + } |
|
| 220 | + $notify_yn = new \XoopsFormRadioYN(_MD_NEWBB_POLL_NOTIFY, 'notify', $notify_value); |
|
| 221 | + $poll_form->addElement($notify_yn); |
|
| 222 | + $option_tray = new \XoopsFormElementTray(_MD_NEWBB_POLL_POLLOPTIONS, ''); |
|
| 223 | + $barcolor_array = \XoopsLists::getImgListAsArray($GLOBALS['xoops']->path("modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/assets/images/colorbars/")); |
|
| 224 | + $i = 0; |
|
| 225 | + foreach ($options_arr as $option) { |
|
| 226 | + /** @var \XoopsPoll $option */ |
|
| 227 | + $option_tray->addElement(new \XoopsFormText('', 'option_text[]', 50, 255, $option->getVar('option_text'))); |
|
| 228 | + $option_tray->addElement(new \XoopsFormHidden('option_id[]', $option->getVar('option_id'))); |
|
| 229 | + $color_select = new \XoopsFormSelect('', 'option_color[{$i}]', $option->getVar('option_color')); |
|
| 230 | + $color_select->addOptionArray($barcolor_array); |
|
| 231 | + $color_select->setExtra("onchange='showImgSelected(\"option_color_image[{$i}]\", \"option_color[" . $i . "]\", \"modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/assets/images/colorbars\", \"\", \"" . XOOPS_URL . "\")'"); |
|
| 232 | + $color_label = new \XoopsFormLabel('', "<img src='" |
|
| 233 | + . $GLOBALS['xoops']->url("modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/assets/images/colorbars/" . $option->getVar('option_color', 'E')) |
|
| 234 | + . "' name='option_color_image[{$i}]' id='option_color_image[{$i}]' class='alignbottom' width='30' height='15' alt='' /><br>"); |
|
| 235 | + $option_tray->addElement($color_select); |
|
| 236 | + $option_tray->addElement($color_label); |
|
| 237 | + unset($color_select, $color_label); |
|
| 238 | + ++$i; |
|
| 239 | + } |
|
| 240 | + // irmtfan full URL |
|
| 241 | + $more_label = new \XoopsFormLabel('', "<br><a href='" . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . "/polls.php?op=addmore&poll_id={$poll_id}&topic_id={$topic_id}'>" . _MD_NEWBB_POLL_ADDMORE . '</a>'); |
|
| 242 | + $option_tray->addElement($more_label); |
|
| 243 | + $poll_form->addElement($option_tray); |
|
| 244 | + $poll_form->addElement(new \XoopsFormHidden('op', 'update')); |
|
| 245 | + $poll_form->addElement(new \XoopsFormHidden('topic_id', $topic_id)); |
|
| 246 | + $poll_form->addElement(new \XoopsFormHidden('poll_id', $poll_id)); |
|
| 247 | + $poll_form->addElement(new \XoopsFormButtonTray('poll_submit', _SUBMIT, 'submit')); |
|
| 248 | + |
|
| 249 | + echo '<h4>' . _MD_NEWBB_POLL_POLLCONF . "</h4>\n"; |
|
| 250 | + $poll_form->display(); |
|
| 239 | 251 | } |
| 240 | - // irmtfan full URL |
|
| 241 | - $more_label = new \XoopsFormLabel('', "<br><a href='" . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . "/polls.php?op=addmore&poll_id={$poll_id}&topic_id={$topic_id}'>" . _MD_NEWBB_POLL_ADDMORE . '</a>'); |
|
| 242 | - $option_tray->addElement($more_label); |
|
| 243 | - $poll_form->addElement($option_tray); |
|
| 244 | - $poll_form->addElement(new \XoopsFormHidden('op', 'update')); |
|
| 245 | - $poll_form->addElement(new \XoopsFormHidden('topic_id', $topic_id)); |
|
| 246 | - $poll_form->addElement(new \XoopsFormHidden('poll_id', $poll_id)); |
|
| 247 | - $poll_form->addElement(new \XoopsFormButtonTray('poll_submit', _SUBMIT, 'submit')); |
|
| 252 | + break; // op: edit |
|
| 248 | 253 | |
| 249 | - echo '<h4>' . _MD_NEWBB_POLL_POLLCONF . "</h4>\n"; |
|
| 250 | - $poll_form->display(); |
|
| 251 | - } |
|
| 252 | - break; // op: edit |
|
| 254 | + case 'save': |
|
| 255 | + // old xoopspoll or umfrage or any clone from them |
|
| 256 | + if ($pollModuleHandler->getVar('version') < 140) { |
|
| 257 | + // check security token |
|
| 258 | + if (!$GLOBALS['xoopsSecurity']->check()) { |
|
| 259 | + redirect_header(Request::getString('PHP_SELF', '', 'SERVER'), 2, implode('<br>', $GLOBALS['xoopsSecurity']->getErrors())); |
|
| 260 | + } |
|
| 261 | + /* |
|
| 262 | + * The option check should be done before submitting |
|
| 263 | + */ |
|
| 264 | + $option_empty = true; |
|
| 265 | + if (!Request::getString('option_text', '', 'POST')) { |
|
| 266 | + // irmtfan - issue with javascript:history.go(-1) |
|
| 267 | + redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 2, _MD_NEWBB_ERROROCCURED . ': ' . _MD_NEWBB_POLL_POLLOPTIONS . ' !'); |
|
| 268 | + } |
|
| 269 | + $option_text = Request::getArray('option_text', '', 'POST'); |
|
| 270 | + foreach ($option_text as $optxt) { |
|
| 271 | + if ('' !== trim($optxt)) { |
|
| 272 | + $option_empty = false; |
|
| 273 | + break; |
|
| 274 | + } |
|
| 275 | + } |
|
| 276 | + if ($option_empty) { |
|
| 277 | + // irmtfan - issue with javascript:history.go(-1) |
|
| 278 | + redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 2, _MD_NEWBB_ERROROCCURED . ': ' . _MD_NEWBB_POLL_POLLOPTIONS . ' !'); |
|
| 279 | + } |
|
| 280 | + $pollObject->setVar('question', Request::getString('question', '', 'POST')); |
|
| 281 | + $pollObject->setVar('description', Request::getString('description', '', 'POST')); |
|
| 282 | + $end_time = Request::getString('end_time', '', 'POST'); // (empty($_POST['end_time'])) ? "" : $_POST['end_time']; |
|
| 283 | + if ('' !== $end_time) { |
|
| 284 | + $timezone = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('timezone') : null; |
|
| 285 | + $pollObject->setVar('end_time', userTimeToServerTime(method_exists('XoopsLocal', 'strtotime') ? XoopsLocal::strtotime($end_time) : strtotime($end_time), $timezone)); |
|
| 286 | + } else { |
|
| 287 | + // if expiration date is not set, set it to 10 days from now |
|
| 288 | + $pollObject->setVar('end_time', time() + (86400 * 10)); |
|
| 289 | + } |
|
| 253 | 290 | |
| 254 | - case 'save': |
|
| 255 | - // old xoopspoll or umfrage or any clone from them |
|
| 256 | - if ($pollModuleHandler->getVar('version') < 140) { |
|
| 291 | + $pollObject->setVar('display', 0); |
|
| 292 | + $pollObject->setVar('weight', Request::getInt('weight', 0, 'POST')); |
|
| 293 | + $pollObject->setVar('multiple', Request::getInt('multiple', 0, 'POST')); |
|
| 294 | + $pollObject->setVar('user_id', Request::getInt('user_id', 0, 'POST')); |
|
| 295 | + if (Request::getInt('notify', 0, 'POST') && $end_time > time()) { |
|
| 296 | + // if notify, set mail status to "not mailed" |
|
| 297 | + $pollObject->setVar('mail_status', Xoopspoll\Constants::POLL_NOT_MAILED); |
|
| 298 | + } else { |
|
| 299 | + // if not notify, set mail status to already "mailed" |
|
| 300 | + $pollObject->setVar('mail_status', Xoopspoll\Constants::POLL_MAILED); |
|
| 301 | + } |
|
| 302 | + $new_poll_id = $pollObject->store(); |
|
| 303 | + if (empty($new_poll_id)) { |
|
| 304 | + xoops_error($pollObject->getHtmlErrors); |
|
| 305 | + break; |
|
| 306 | + } |
|
| 307 | + $i = 0; |
|
| 308 | + $option_color = Request::getArray('option_color', null, 'POST'); |
|
| 309 | + $classOption = $classPoll . 'Option'; |
|
| 310 | + foreach ($option_text as $optxt) { |
|
| 311 | + $optxt = trim($optxt); |
|
| 312 | + /** @var Xoopspoll\Option $optionObject */ |
|
| 313 | + $optionObject = new $classOption(); |
|
| 314 | + if ('' !== $optxt) { |
|
| 315 | + $optionObject->setVar('option_text', $optxt); |
|
| 316 | + $optionObject->setVar('option_color', $option_color[$i]); |
|
| 317 | + $optionObject->setVar('poll_id', $new_poll_id); |
|
| 318 | + $optionObject->store(); |
|
| 319 | + } |
|
| 320 | + ++$i; |
|
| 321 | + } |
|
| 322 | + // clear the template cache so changes take effect immediately |
|
| 323 | + require_once $GLOBALS['xoops']->path('class/template.php'); |
|
| 324 | + xoops_template_clear_module_cache($GLOBALS['xoopsModule']->getVar('mid')); |
|
| 325 | + xoops_template_clear_module_cache($pollModuleHandler->getVar('mid')); |
|
| 326 | + |
|
| 327 | + // update topic to indicate it has a poll |
|
| 328 | + $topicObject->setVar('topic_haspoll', 1); |
|
| 329 | + $topicObject->setVar('poll_id', $new_poll_id); |
|
| 330 | + $success = $topicHandler->insert($topicObject); |
|
| 331 | + if (!$success) { |
|
| 332 | + xoops_error($topicHandler->getHtmlErrors()); |
|
| 333 | + } else { |
|
| 334 | + redirect_header("viewtopic.php?topic_id={$topic_id}", 2, _MD_NEWBB_POLL_DBUPDATED); |
|
| 335 | + } |
|
| 336 | + break;// op: save |
|
| 337 | + } |
|
| 338 | + // no break |
|
| 339 | + case 'update': |
|
| 257 | 340 | // check security token |
| 258 | 341 | if (!$GLOBALS['xoopsSecurity']->check()) { |
| 259 | 342 | redirect_header(Request::getString('PHP_SELF', '', 'SERVER'), 2, implode('<br>', $GLOBALS['xoopsSecurity']->getErrors())); |
| 260 | 343 | } |
| 261 | - /* |
|
| 262 | - * The option check should be done before submitting |
|
| 263 | - */ |
|
| 264 | - $option_empty = true; |
|
| 265 | - if (!Request::getString('option_text', '', 'POST')) { |
|
| 266 | - // irmtfan - issue with javascript:history.go(-1) |
|
| 344 | + /* make sure there's at least one option */ |
|
| 345 | + $option_text = Request::getString('option_text', '', 'POST'); |
|
| 346 | + $option_string = is_array($option_text) ? implode('', $option_text) : $option_text; |
|
| 347 | + $option_string = trim($option_string); |
|
| 348 | + if ('' === $option_string) { |
|
| 267 | 349 | redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 2, _MD_NEWBB_ERROROCCURED . ': ' . _MD_NEWBB_POLL_POLLOPTIONS . ' !'); |
| 268 | 350 | } |
| 269 | - $option_text = Request::getArray('option_text', '', 'POST'); |
|
| 270 | - foreach ($option_text as $optxt) { |
|
| 271 | - if ('' !== trim($optxt)) { |
|
| 272 | - $option_empty = false; |
|
| 273 | - break; |
|
| 351 | + |
|
| 352 | + // new xoopspoll module |
|
| 353 | + if ($pollModuleHandler->getVar('version') >= 140) { |
|
| 354 | + /** @var Xoopspoll\OptionHandler $xpOptHandler */ |
|
| 355 | + $xpOptHandler = Xoopspoll\Helper::getInstance()->getHandler('Option'); |
|
| 356 | + /** @var Xoopspoll\LogHandler $xpLogHandler */ |
|
| 357 | + $xpLogHandler = Xoopspoll\Helper::getInstance()->getHandler('Log'); |
|
| 358 | + // $classRequest = ucfirst($GLOBALS['xoopsModuleConfig']["poll_module"]) . "Request"; |
|
| 359 | + $classConstants = new XoopsModules\Xoopspoll\Constants(); |
|
| 360 | + $notify = Request::getInt('notify', $classConstants::NOTIFICATION_ENABLED, 'POST'); |
|
| 361 | + $currentTimestamp = time(); |
|
| 362 | + //$xuEndTimestamp = method_exists('XoopsLocal', 'strtotime') ? XoopsLocal::strtotime(Request::getString('xu_end_time', null, 'POST')) |
|
| 363 | + // : strtotime(Request::getString('xu_end_time', null, 'POST')); |
|
| 364 | + $xuEndTimestamp = strtotime(Request::getString('xu_end_time', null, 'POST')); |
|
| 365 | + $endTimestamp = (!Request::getString('xu_end_time', null, 'POST')) ? ($currentTimestamp + $classConstants::DEFAULT_POLL_DURATION) : userTimeToServerTime($xuEndTimestamp); |
|
| 366 | + //$xuStartTimestamp = method_exists('XoopsLocal', 'strtotime') ? XoopsLocal::strtotime(Request::getString('xu_start_time', null, 'POST')) |
|
| 367 | + // : strtotime(Request::getString('xu_start_time', null, 'POST')); |
|
| 368 | + $xuStartTimestamp = strtotime(Request::getString('xu_start_time', null, 'POST')); |
|
| 369 | + $startTimestamp = (!Request::getString('xu_start_time', null, 'POST')) ? ($endTimestamp - $classConstants::DEFAULT_POLL_DURATION) : userTimeToServerTime($xuStartTimestamp); |
|
| 370 | + |
|
| 371 | + // don't allow changing start time if there are votes in the log |
|
| 372 | + if (($startTimestamp < $pollObject->getVar('start_time')) |
|
| 373 | + && ($xpLogHandler->getTotalVotesByPollId($poll_id) > 0)) { |
|
| 374 | + $startTimestamp = $pollObject->getVar('start_time'); //don't change start time |
|
| 274 | 375 | } |
| 275 | - } |
|
| 276 | - if ($option_empty) { |
|
| 277 | - // irmtfan - issue with javascript:history.go(-1) |
|
| 278 | - redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 2, _MD_NEWBB_ERROROCCURED . ': ' . _MD_NEWBB_POLL_POLLOPTIONS . ' !'); |
|
| 279 | - } |
|
| 280 | - $pollObject->setVar('question', Request::getString('question', '', 'POST')); |
|
| 281 | - $pollObject->setVar('description', Request::getString('description', '', 'POST')); |
|
| 282 | - $end_time = Request::getString('end_time', '', 'POST'); // (empty($_POST['end_time'])) ? "" : $_POST['end_time']; |
|
| 283 | - if ('' !== $end_time) { |
|
| 284 | - $timezone = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('timezone') : null; |
|
| 285 | - $pollObject->setVar('end_time', userTimeToServerTime(method_exists('XoopsLocal', 'strtotime') ? XoopsLocal::strtotime($end_time) : strtotime($end_time), $timezone)); |
|
| 286 | - } else { |
|
| 287 | - // if expiration date is not set, set it to 10 days from now |
|
| 288 | - $pollObject->setVar('end_time', time() + (86400 * 10)); |
|
| 289 | - } |
|
| 290 | 376 | |
| 291 | - $pollObject->setVar('display', 0); |
|
| 292 | - $pollObject->setVar('weight', Request::getInt('weight', 0, 'POST')); |
|
| 293 | - $pollObject->setVar('multiple', Request::getInt('multiple', 0, 'POST')); |
|
| 294 | - $pollObject->setVar('user_id', Request::getInt('user_id', 0, 'POST')); |
|
| 295 | - if (Request::getInt('notify', 0, 'POST') && $end_time > time()) { |
|
| 296 | - // if notify, set mail status to "not mailed" |
|
| 297 | - $pollObject->setVar('mail_status', Xoopspoll\Constants::POLL_NOT_MAILED); |
|
| 377 | + $poll_vars = [ |
|
| 378 | + 'user_id' => Request::getInt('user_id', $GLOBALS['xoopsUser']->uid(), 'POST'), |
|
| 379 | + 'question' => Request::getString('question', null, 'POST'), |
|
| 380 | + 'description' => Request::getText('description', null, 'POST'), |
|
| 381 | + 'mail_status' => ($classConstants::NOTIFICATION_ENABLED == $notify) ? $classConstants::POLL_NOT_MAILED : $classConstants::POLL_MAILED, |
|
| 382 | + 'mail_voter' => Request::getInt('mail_voter', $classConstants::NOT_MAIL_POLL_TO_VOTER, 'POST'), |
|
| 383 | + 'start_time' => $startTimestamp, |
|
| 384 | + 'end_time' => $endTimestamp, |
|
| 385 | + 'display' => Request::getInt('display', $classConstants::DO_NOT_DISPLAY_POLL_IN_BLOCK, 'POST'), |
|
| 386 | + 'visibility' => Request::getInt('visibility', $classConstants::HIDE_NEVER, 'POST'), |
|
| 387 | + 'weight' => Request::getInt('weight', $classConstants::DEFAULT_WEIGHT, 'POST'), |
|
| 388 | + 'multiple' => Request::getInt('multiple', $classConstants::NOT_MULTIPLE_SELECT_POLL, 'POST'), |
|
| 389 | + 'multilimit' => Request::getInt('multilimit', $classConstants::MULTIPLE_SELECT_LIMITLESS, 'POST'), |
|
| 390 | + 'anonymous' => Request::getInt('anonymous', $classConstants::ANONYMOUS_VOTING_DISALLOWED, 'POST') |
|
| 391 | + ]; |
|
| 392 | + $pollObject->setVars($poll_vars); |
|
| 393 | + $poll_id = $xpPollHandler->insert($pollObject); |
|
| 394 | + if (!$poll_id) { |
|
| 395 | + $err = $pollObject->getHtmlErrors(); |
|
| 396 | + exit($err); |
|
| 397 | + } |
|
| 398 | + |
|
| 399 | + // now get the options |
|
| 400 | + $optionIdArray = Request::getArray('option_id', [], 'POST'); |
|
| 401 | + $optionIdArray = array_map('intval', $optionIdArray); |
|
| 402 | + $optionTextArray = Request::getArray('option_text', [], 'POST'); |
|
| 403 | + $optionColorArray = Request::getArray('option_color', [], 'POST'); |
|
| 404 | + |
|
| 405 | + foreach ($optionIdArray as $key => $oId) { |
|
| 406 | + if (!empty($oId) && ($optionObject = $xpOptHandler->get($oId))) { |
|
| 407 | + // existing option object so need to update it |
|
| 408 | + $optionTextArray[$key] = trim($optionTextArray[$key]); |
|
| 409 | + if ('' === $optionTextArray[$key]) { |
|
| 410 | + // want to delete this option |
|
| 411 | + if (false !== $xpOptHandler->delete($optionObject)) { |
|
| 412 | + // now remove it from the log |
|
| 413 | + $xpLogHandler->deleteByOptionId($optionObject->getVar('option_id')); |
|
| 414 | + //update vote count in poll |
|
| 415 | + $xpPollHandler->updateCount($pollObject); |
|
| 416 | + } else { |
|
| 417 | + xoops_error($xpLogHandler->getHtmlErrors()); |
|
| 418 | + break; |
|
| 419 | + } |
|
| 420 | + } else { |
|
| 421 | + $optionObject->setVar('option_text', $optionTextArray[$key]); |
|
| 422 | + $optionObject->setVar('option_color', $optionColorArray[$key]); |
|
| 423 | + $optionObject->setVar('poll_id', $poll_id); |
|
| 424 | + $xpOptHandler->insert($optionObject); |
|
| 425 | + } |
|
| 426 | + } else { |
|
| 427 | + // new option object |
|
| 428 | + $optionObject = $xpOptHandler->create(); |
|
| 429 | + $optionTextArray[$key] = trim($optionTextArray[$key]); |
|
| 430 | + if ('' !== $optionTextArray[$key]) { // ignore if text is empty |
|
| 431 | + $optionObject->setVar('option_text', $optionTextArray[$key]); |
|
| 432 | + $optionObject->setVar('option_color', $optionColorArray[$key]); |
|
| 433 | + $optionObject->setVar('poll_id', $poll_id); |
|
| 434 | + $xpOptHandler->insert($optionObject); |
|
| 435 | + } |
|
| 436 | + unset($optionObject); |
|
| 437 | + } |
|
| 438 | + } |
|
| 439 | + // old xoopspoll or umfrage or any clone from them |
|
| 298 | 440 | } else { |
| 299 | - // if not notify, set mail status to already "mailed" |
|
| 300 | - $pollObject->setVar('mail_status', Xoopspoll\Constants::POLL_MAILED); |
|
| 301 | - } |
|
| 302 | - $new_poll_id = $pollObject->store(); |
|
| 303 | - if (empty($new_poll_id)) { |
|
| 304 | - xoops_error($pollObject->getHtmlErrors); |
|
| 305 | - break; |
|
| 306 | - } |
|
| 307 | - $i = 0; |
|
| 308 | - $option_color = Request::getArray('option_color', null, 'POST'); |
|
| 309 | - $classOption = $classPoll . 'Option'; |
|
| 310 | - foreach ($option_text as $optxt) { |
|
| 311 | - $optxt = trim($optxt); |
|
| 312 | - /** @var Xoopspoll\Option $optionObject */ |
|
| 313 | - $optionObject = new $classOption(); |
|
| 314 | - if ('' !== $optxt) { |
|
| 315 | - $optionObject->setVar('option_text', $optxt); |
|
| 316 | - $optionObject->setVar('option_color', $option_color[$i]); |
|
| 317 | - $optionObject->setVar('poll_id', $new_poll_id); |
|
| 318 | - $optionObject->store(); |
|
| 441 | + $pollObject->setVar('question', Request::getString('question', '', 'POST')); |
|
| 442 | + $pollObject->setVar('description', Request::getString('description', '', 'POST')); |
|
| 443 | + |
|
| 444 | + $end_time = Request::getString('end_time', '', 'POST'); |
|
| 445 | + if ('' !== $end_time) { |
|
| 446 | + $timezone = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('timezone') : null; |
|
| 447 | + $pollObject->setVar('end_time', userTimeToServerTime(method_exists('XoopsLocal', 'strtotime') ? XoopsLocal::strtotime($end_time) : strtotime($end_time), $timezone)); |
|
| 319 | 448 | } |
| 320 | - ++$i; |
|
| 449 | + $pollObject->setVar('display', 0); |
|
| 450 | + $pollObject->setVar('weight', Request::getInt('weight', 0, 'POST')); |
|
| 451 | + $pollObject->setVar('multiple', Request::getInt('multiple', 0, 'POST')); |
|
| 452 | + $pollObject->setVar('user_id', Request::getInt('user_id', 0, 'POST')); |
|
| 453 | + if (Request::getInt('notify', 0, 'POST') && $end_time > time()) { |
|
| 454 | + // if notify, set mail status to "not mailed" |
|
| 455 | + $pollObject->setVar('mail_status', $classConstants::POLL_NOT_MAILED); |
|
| 456 | + } else { |
|
| 457 | + // if not notify, set mail status to already "mailed" |
|
| 458 | + $pollObject->setVar('mail_status', $classConstants::POLL_MAILED); |
|
| 459 | + } |
|
| 460 | + |
|
| 461 | + if (!$pollObject->store()) { |
|
| 462 | + xoops_error($pollObject->getHtmlErrors); |
|
| 463 | + break; |
|
| 464 | + } |
|
| 465 | + $i = 0; |
|
| 466 | + $option_id = Request::getArray('option_id', null, 'POST'); |
|
| 467 | + $option_color = Request::getArray('option_color', null, 'POST'); |
|
| 468 | + $classOption = $classPoll . 'Option'; |
|
| 469 | + $classLog = $classPoll . 'Log'; |
|
| 470 | + foreach ($option_id as $opid) { |
|
| 471 | + $optionObject = new $classOption($opid); |
|
| 472 | + $option_text[$i] = trim($option_text[$i]); |
|
| 473 | + if ('' !== $option_text[$i]) { |
|
| 474 | + $optionObject->setVar('option_text', $option_text[$i]); |
|
| 475 | + $optionObject->setVar('option_color', $option_color[$i]); |
|
| 476 | + $optionObject->store(); |
|
| 477 | + } else { |
|
| 478 | + if (false !== $optionObject->delete()) { |
|
| 479 | + $classLog::deleteByOptionId($option->getVar('option_id')); |
|
| 480 | + } |
|
| 481 | + } |
|
| 482 | + ++$i; |
|
| 483 | + } |
|
| 484 | + $pollObject->updateCount(); |
|
| 321 | 485 | } |
| 322 | 486 | // clear the template cache so changes take effect immediately |
| 323 | 487 | require_once $GLOBALS['xoops']->path('class/template.php'); |
@@ -326,433 +490,269 @@ discard block |
||
| 326 | 490 | |
| 327 | 491 | // update topic to indicate it has a poll |
| 328 | 492 | $topicObject->setVar('topic_haspoll', 1); |
| 329 | - $topicObject->setVar('poll_id', $new_poll_id); |
|
| 493 | + $topicObject->setVar('poll_id', $pollObject->getVar('poll_id')); |
|
| 330 | 494 | $success = $topicHandler->insert($topicObject); |
| 331 | 495 | if (!$success) { |
| 332 | 496 | xoops_error($topicHandler->getHtmlErrors()); |
| 333 | 497 | } else { |
| 334 | 498 | redirect_header("viewtopic.php?topic_id={$topic_id}", 2, _MD_NEWBB_POLL_DBUPDATED); |
| 335 | 499 | } |
| 336 | - break;// op: save |
|
| 337 | - } |
|
| 338 | - // no break |
|
| 339 | - case 'update': |
|
| 340 | - // check security token |
|
| 341 | - if (!$GLOBALS['xoopsSecurity']->check()) { |
|
| 342 | - redirect_header(Request::getString('PHP_SELF', '', 'SERVER'), 2, implode('<br>', $GLOBALS['xoopsSecurity']->getErrors())); |
|
| 343 | - } |
|
| 344 | - /* make sure there's at least one option */ |
|
| 345 | - $option_text = Request::getString('option_text', '', 'POST'); |
|
| 346 | - $option_string = is_array($option_text) ? implode('', $option_text) : $option_text; |
|
| 347 | - $option_string = trim($option_string); |
|
| 348 | - if ('' === $option_string) { |
|
| 349 | - redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 2, _MD_NEWBB_ERROROCCURED . ': ' . _MD_NEWBB_POLL_POLLOPTIONS . ' !'); |
|
| 350 | - } |
|
| 351 | - |
|
| 352 | - // new xoopspoll module |
|
| 353 | - if ($pollModuleHandler->getVar('version') >= 140) { |
|
| 354 | - /** @var Xoopspoll\OptionHandler $xpOptHandler */ |
|
| 355 | - $xpOptHandler = Xoopspoll\Helper::getInstance()->getHandler('Option'); |
|
| 356 | - /** @var Xoopspoll\LogHandler $xpLogHandler */ |
|
| 357 | - $xpLogHandler = Xoopspoll\Helper::getInstance()->getHandler('Log'); |
|
| 358 | - // $classRequest = ucfirst($GLOBALS['xoopsModuleConfig']["poll_module"]) . "Request"; |
|
| 359 | - $classConstants = new XoopsModules\Xoopspoll\Constants(); |
|
| 360 | - $notify = Request::getInt('notify', $classConstants::NOTIFICATION_ENABLED, 'POST'); |
|
| 361 | - $currentTimestamp = time(); |
|
| 362 | - //$xuEndTimestamp = method_exists('XoopsLocal', 'strtotime') ? XoopsLocal::strtotime(Request::getString('xu_end_time', null, 'POST')) |
|
| 363 | - // : strtotime(Request::getString('xu_end_time', null, 'POST')); |
|
| 364 | - $xuEndTimestamp = strtotime(Request::getString('xu_end_time', null, 'POST')); |
|
| 365 | - $endTimestamp = (!Request::getString('xu_end_time', null, 'POST')) ? ($currentTimestamp + $classConstants::DEFAULT_POLL_DURATION) : userTimeToServerTime($xuEndTimestamp); |
|
| 366 | - //$xuStartTimestamp = method_exists('XoopsLocal', 'strtotime') ? XoopsLocal::strtotime(Request::getString('xu_start_time', null, 'POST')) |
|
| 367 | - // : strtotime(Request::getString('xu_start_time', null, 'POST')); |
|
| 368 | - $xuStartTimestamp = strtotime(Request::getString('xu_start_time', null, 'POST')); |
|
| 369 | - $startTimestamp = (!Request::getString('xu_start_time', null, 'POST')) ? ($endTimestamp - $classConstants::DEFAULT_POLL_DURATION) : userTimeToServerTime($xuStartTimestamp); |
|
| 370 | - |
|
| 371 | - // don't allow changing start time if there are votes in the log |
|
| 372 | - if (($startTimestamp < $pollObject->getVar('start_time')) |
|
| 373 | - && ($xpLogHandler->getTotalVotesByPollId($poll_id) > 0)) { |
|
| 374 | - $startTimestamp = $pollObject->getVar('start_time'); //don't change start time |
|
| 500 | + break;// op: save | update |
|
| 501 | + |
|
| 502 | + case 'addmore': |
|
| 503 | + $question = $pollObject->getVar('question'); |
|
| 504 | + unset($pollObject); |
|
| 505 | + $poll_form = new \XoopsThemeForm(_MD_NEWBB_POLL_ADDMORE, 'poll_form', 'polls.php', 'post', true); |
|
| 506 | + $poll_form->addElement(new \XoopsFormLabel(_MD_NEWBB_POLL_POLLQUESTION, $question)); |
|
| 507 | + // new xoopspoll module |
|
| 508 | + if ($pollModuleHandler->getVar('version') >= 140) { |
|
| 509 | + $xpOptHandler = Xoopspoll\Helper::getInstance()->getHandler('Option'); |
|
| 510 | + $option_tray = $xpOptHandler->renderOptionFormTray($poll_id); |
|
| 511 | + // old xoopspoll or umfrage or any clone from them |
|
| 512 | + } else { |
|
| 513 | + $option_tray = new \XoopsFormElementTray(_MD_NEWBB_POLL_POLLOPTIONS, ''); |
|
| 514 | + $barcolor_array = \XoopsLists::getImgListAsArray($GLOBALS['xoops']->path('modules/' . $GLOBALS['xoopsModuleConfig']['poll_module'] . '/assets/images/colorbars/')); |
|
| 515 | + for ($i = 0; $i < 10; ++$i) { |
|
| 516 | + $current_bar = ('blank.gif' !== current($barcolor_array)) ? current($barcolor_array) : next($barcolor_array); |
|
| 517 | + $option_text = new \XoopsFormText('', 'option_text[]', 50, 255); |
|
| 518 | + $option_tray->addElement($option_text); |
|
| 519 | + $color_select = new \XoopsFormSelect('', "option_color[{$i}]", $current_bar); |
|
| 520 | + $color_select->addOptionArray($barcolor_array); |
|
| 521 | + $color_select->setExtra("onchange='showImgSelected(\"option_color_image[{$i}]\", \"option_color[{$i}]\", \"modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/assets/images/colorbars\", \"\", \"" . XOOPS_URL . "\")'"); |
|
| 522 | + $color_label = new \XoopsFormLabel('', "<img src='" |
|
| 523 | + . $GLOBALS['xoops']->url("modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/assets/images/colorbars/{$current_bar}") |
|
| 524 | + . "' name='option_color_image[{$i}]' id='option_color_image[{$i}]' class='alignbottom' width='30' height='15' alt='' /><br>"); |
|
| 525 | + $option_tray->addElement($color_select); |
|
| 526 | + $option_tray->addElement($color_label); |
|
| 527 | + unset($color_select, $color_label, $option_text); |
|
| 528 | + if (!next($barcolor_array)) { |
|
| 529 | + reset($barcolor_array); |
|
| 530 | + } |
|
| 531 | + } |
|
| 375 | 532 | } |
| 533 | + $poll_form->addElement($option_tray); |
|
| 534 | + $poll_form->addElement(new \XoopsFormButtonTray('poll_submit', _SUBMIT, 'submit')); |
|
| 535 | + $poll_form->addElement(new \XoopsFormHidden('op', 'savemore')); |
|
| 536 | + $poll_form->addElement(new \XoopsFormHidden('topic_id', $topic_id)); |
|
| 537 | + $poll_form->addElement(new \XoopsFormHidden('poll_id', $poll_id)); |
|
| 376 | 538 | |
| 377 | - $poll_vars = [ |
|
| 378 | - 'user_id' => Request::getInt('user_id', $GLOBALS['xoopsUser']->uid(), 'POST'), |
|
| 379 | - 'question' => Request::getString('question', null, 'POST'), |
|
| 380 | - 'description' => Request::getText('description', null, 'POST'), |
|
| 381 | - 'mail_status' => ($classConstants::NOTIFICATION_ENABLED == $notify) ? $classConstants::POLL_NOT_MAILED : $classConstants::POLL_MAILED, |
|
| 382 | - 'mail_voter' => Request::getInt('mail_voter', $classConstants::NOT_MAIL_POLL_TO_VOTER, 'POST'), |
|
| 383 | - 'start_time' => $startTimestamp, |
|
| 384 | - 'end_time' => $endTimestamp, |
|
| 385 | - 'display' => Request::getInt('display', $classConstants::DO_NOT_DISPLAY_POLL_IN_BLOCK, 'POST'), |
|
| 386 | - 'visibility' => Request::getInt('visibility', $classConstants::HIDE_NEVER, 'POST'), |
|
| 387 | - 'weight' => Request::getInt('weight', $classConstants::DEFAULT_WEIGHT, 'POST'), |
|
| 388 | - 'multiple' => Request::getInt('multiple', $classConstants::NOT_MULTIPLE_SELECT_POLL, 'POST'), |
|
| 389 | - 'multilimit' => Request::getInt('multilimit', $classConstants::MULTIPLE_SELECT_LIMITLESS, 'POST'), |
|
| 390 | - 'anonymous' => Request::getInt('anonymous', $classConstants::ANONYMOUS_VOTING_DISALLOWED, 'POST') |
|
| 391 | - ]; |
|
| 392 | - $pollObject->setVars($poll_vars); |
|
| 393 | - $poll_id = $xpPollHandler->insert($pollObject); |
|
| 394 | - if (!$poll_id) { |
|
| 395 | - $err = $pollObject->getHtmlErrors(); |
|
| 396 | - exit($err); |
|
| 539 | + echo '<h4>' . _MD_NEWBB_POLL_POLLCONF . "</h4>\n"; |
|
| 540 | + $poll_form->display(); |
|
| 541 | + break; |
|
| 542 | + |
|
| 543 | + case 'savemore': |
|
| 544 | + // check security token |
|
| 545 | + if (!$GLOBALS['xoopsSecurity']->check()) { |
|
| 546 | + redirect_header(Request::getString('PHP_SELF', '', 'SERVER'), 2, implode('<br>', $GLOBALS['xoopsSecurity']->getErrors())); |
|
| 397 | 547 | } |
| 398 | 548 | |
| 399 | - // now get the options |
|
| 400 | - $optionIdArray = Request::getArray('option_id', [], 'POST'); |
|
| 401 | - $optionIdArray = array_map('intval', $optionIdArray); |
|
| 402 | - $optionTextArray = Request::getArray('option_text', [], 'POST'); |
|
| 403 | - $optionColorArray = Request::getArray('option_color', [], 'POST'); |
|
| 404 | - |
|
| 405 | - foreach ($optionIdArray as $key => $oId) { |
|
| 406 | - if (!empty($oId) && ($optionObject = $xpOptHandler->get($oId))) { |
|
| 407 | - // existing option object so need to update it |
|
| 408 | - $optionTextArray[$key] = trim($optionTextArray[$key]); |
|
| 409 | - if ('' === $optionTextArray[$key]) { |
|
| 410 | - // want to delete this option |
|
| 411 | - if (false !== $xpOptHandler->delete($optionObject)) { |
|
| 412 | - // now remove it from the log |
|
| 413 | - $xpLogHandler->deleteByOptionId($optionObject->getVar('option_id')); |
|
| 414 | - //update vote count in poll |
|
| 415 | - $xpPollHandler->updateCount($pollObject); |
|
| 416 | - } else { |
|
| 417 | - xoops_error($xpLogHandler->getHtmlErrors()); |
|
| 418 | - break; |
|
| 419 | - } |
|
| 420 | - } else { |
|
| 421 | - $optionObject->setVar('option_text', $optionTextArray[$key]); |
|
| 422 | - $optionObject->setVar('option_color', $optionColorArray[$key]); |
|
| 549 | + $option_text = Request::getString('option_text', '', 'POST'); |
|
| 550 | + $option_string = is_array($option_text) ? implode('', $option_text) : $option_text; |
|
| 551 | + $option_string = trim($option_string); |
|
| 552 | + if ('' === $option_string) { |
|
| 553 | + // irmtfan - issue with javascript:history.go(-1) |
|
| 554 | + redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 2, _MD_NEWBB_ERROROCCURED . ': ' . _MD_NEWBB_POLL_POLLOPTIONS . ' !'); |
|
| 555 | + } |
|
| 556 | + $i = 0; |
|
| 557 | + $option_color = Request::getArray('option_color', null, 'POST'); |
|
| 558 | + foreach ($option_text as $optxt) { |
|
| 559 | + $optxt = trim($optxt); |
|
| 560 | + if ('' !== $optxt) { |
|
| 561 | + // new xoopspoll module |
|
| 562 | + if ($pollModuleHandler->getVar('version') >= 140) { |
|
| 563 | + $xpOptHandler = Xoopspoll\Helper::getInstance()->getHandler('Option'); |
|
| 564 | + $optionObject = $xpOptHandler->create(); |
|
| 565 | + $optionObject->setVar('option_text', $optxt); |
|
| 423 | 566 | $optionObject->setVar('poll_id', $poll_id); |
| 567 | + $optionObject->setVar('option_color', $option_color[$i]); |
|
| 424 | 568 | $xpOptHandler->insert($optionObject); |
| 425 | - } |
|
| 426 | - } else { |
|
| 427 | - // new option object |
|
| 428 | - $optionObject = $xpOptHandler->create(); |
|
| 429 | - $optionTextArray[$key] = trim($optionTextArray[$key]); |
|
| 430 | - if ('' !== $optionTextArray[$key]) { // ignore if text is empty |
|
| 431 | - $optionObject->setVar('option_text', $optionTextArray[$key]); |
|
| 432 | - $optionObject->setVar('option_color', $optionColorArray[$key]); |
|
| 569 | + // old xoopspoll or umfrage or any clone from them |
|
| 570 | + } else { |
|
| 571 | + $classOption = $classPoll . 'Option'; |
|
| 572 | + $optionObject = new $classOption(); |
|
| 573 | + $optionObject->setVar('option_text', $optxt); |
|
| 433 | 574 | $optionObject->setVar('poll_id', $poll_id); |
| 434 | - $xpOptHandler->insert($optionObject); |
|
| 575 | + $optionObject->setVar('option_color', $option_color[$i]); |
|
| 576 | + $optionObject->store(); |
|
| 435 | 577 | } |
| 436 | 578 | unset($optionObject); |
| 437 | 579 | } |
| 580 | + ++$i; |
|
| 438 | 581 | } |
| 439 | - // old xoopspoll or umfrage or any clone from them |
|
| 440 | - } else { |
|
| 441 | - $pollObject->setVar('question', Request::getString('question', '', 'POST')); |
|
| 442 | - $pollObject->setVar('description', Request::getString('description', '', 'POST')); |
|
| 582 | + require_once $GLOBALS['xoops']->path('class/template.php'); |
|
| 583 | + xoops_template_clear_module_cache($GLOBALS['xoopsModule']->getVar('mid')); |
|
| 584 | + xoops_template_clear_module_cache($pollModuleHandler->getVar('mid')); |
|
| 585 | + redirect_header("polls.php?op=edit&poll_id={$poll_id}&topic_id={$topic_id}", 2, _MD_NEWBB_POLL_DBUPDATED); |
|
| 586 | + break; |
|
| 443 | 587 | |
| 444 | - $end_time = Request::getString('end_time', '', 'POST'); |
|
| 445 | - if ('' !== $end_time) { |
|
| 446 | - $timezone = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('timezone') : null; |
|
| 447 | - $pollObject->setVar('end_time', userTimeToServerTime(method_exists('XoopsLocal', 'strtotime') ? XoopsLocal::strtotime($end_time) : strtotime($end_time), $timezone)); |
|
| 448 | - } |
|
| 449 | - $pollObject->setVar('display', 0); |
|
| 450 | - $pollObject->setVar('weight', Request::getInt('weight', 0, 'POST')); |
|
| 451 | - $pollObject->setVar('multiple', Request::getInt('multiple', 0, 'POST')); |
|
| 452 | - $pollObject->setVar('user_id', Request::getInt('user_id', 0, 'POST')); |
|
| 453 | - if (Request::getInt('notify', 0, 'POST') && $end_time > time()) { |
|
| 454 | - // if notify, set mail status to "not mailed" |
|
| 455 | - $pollObject->setVar('mail_status', $classConstants::POLL_NOT_MAILED); |
|
| 456 | - } else { |
|
| 457 | - // if not notify, set mail status to already "mailed" |
|
| 458 | - $pollObject->setVar('mail_status', $classConstants::POLL_MAILED); |
|
| 459 | - } |
|
| 588 | + case 'delete': |
|
| 589 | + echo '<h4>' . _MD_NEWBB_POLL_POLLCONF . "</h4>\n"; |
|
| 590 | + xoops_confirm(['op' => 'delete_ok', 'topic_id' => $topic_id, 'poll_id' => $poll_id], 'polls.php', sprintf(_MD_NEWBB_POLL_RUSUREDEL, $pollObject->getVar('question'))); |
|
| 591 | + break; |
|
| 460 | 592 | |
| 461 | - if (!$pollObject->store()) { |
|
| 462 | - xoops_error($pollObject->getHtmlErrors); |
|
| 463 | - break; |
|
| 593 | + case 'delete_ok': |
|
| 594 | + // check security token |
|
| 595 | + if (!$GLOBALS['xoopsSecurity']->check()) { |
|
| 596 | + redirect_header(Request::getString('PHP_SELF', '', 'SERVER'), 2, implode('<br>', $GLOBALS['xoopsSecurity']->getErrors())); |
|
| 464 | 597 | } |
| 465 | - $i = 0; |
|
| 466 | - $option_id = Request::getArray('option_id', null, 'POST'); |
|
| 467 | - $option_color = Request::getArray('option_color', null, 'POST'); |
|
| 468 | - $classOption = $classPoll . 'Option'; |
|
| 469 | - $classLog = $classPoll . 'Log'; |
|
| 470 | - foreach ($option_id as $opid) { |
|
| 471 | - $optionObject = new $classOption($opid); |
|
| 472 | - $option_text[$i] = trim($option_text[$i]); |
|
| 473 | - if ('' !== $option_text[$i]) { |
|
| 474 | - $optionObject->setVar('option_text', $option_text[$i]); |
|
| 475 | - $optionObject->setVar('option_color', $option_color[$i]); |
|
| 476 | - $optionObject->store(); |
|
| 598 | + //try and delete the poll |
|
| 599 | + // new xoopspoll module |
|
| 600 | + if ($pollModuleHandler->getVar('version') >= 140) { |
|
| 601 | + $status = $xpPollHandler->delete($pollObject); |
|
| 602 | + if (false !== $status) { |
|
| 603 | + $xpOptHandler = Xoopspoll\Helper::getInstance()->getHandler('Option'); |
|
| 604 | + $xpLogHandler = Xoopspoll\Helper::getInstance()->getHandler('Log'); |
|
| 605 | + $xpOptHandler->deleteByPollId($poll_id); |
|
| 606 | + $xpLogHandler->deleteByPollId($poll_id); |
|
| 477 | 607 | } else { |
| 478 | - if (false !== $optionObject->delete()) { |
|
| 479 | - $classLog::deleteByOptionId($option->getVar('option_id')); |
|
| 480 | - } |
|
| 481 | - } |
|
| 482 | - ++$i; |
|
| 483 | - } |
|
| 484 | - $pollObject->updateCount(); |
|
| 485 | - } |
|
| 486 | - // clear the template cache so changes take effect immediately |
|
| 487 | - require_once $GLOBALS['xoops']->path('class/template.php'); |
|
| 488 | - xoops_template_clear_module_cache($GLOBALS['xoopsModule']->getVar('mid')); |
|
| 489 | - xoops_template_clear_module_cache($pollModuleHandler->getVar('mid')); |
|
| 490 | - |
|
| 491 | - // update topic to indicate it has a poll |
|
| 492 | - $topicObject->setVar('topic_haspoll', 1); |
|
| 493 | - $topicObject->setVar('poll_id', $pollObject->getVar('poll_id')); |
|
| 494 | - $success = $topicHandler->insert($topicObject); |
|
| 495 | - if (!$success) { |
|
| 496 | - xoops_error($topicHandler->getHtmlErrors()); |
|
| 497 | - } else { |
|
| 498 | - redirect_header("viewtopic.php?topic_id={$topic_id}", 2, _MD_NEWBB_POLL_DBUPDATED); |
|
| 499 | - } |
|
| 500 | - break;// op: save | update |
|
| 501 | - |
|
| 502 | - case 'addmore': |
|
| 503 | - $question = $pollObject->getVar('question'); |
|
| 504 | - unset($pollObject); |
|
| 505 | - $poll_form = new \XoopsThemeForm(_MD_NEWBB_POLL_ADDMORE, 'poll_form', 'polls.php', 'post', true); |
|
| 506 | - $poll_form->addElement(new \XoopsFormLabel(_MD_NEWBB_POLL_POLLQUESTION, $question)); |
|
| 507 | - // new xoopspoll module |
|
| 508 | - if ($pollModuleHandler->getVar('version') >= 140) { |
|
| 509 | - $xpOptHandler = Xoopspoll\Helper::getInstance()->getHandler('Option'); |
|
| 510 | - $option_tray = $xpOptHandler->renderOptionFormTray($poll_id); |
|
| 511 | - // old xoopspoll or umfrage or any clone from them |
|
| 512 | - } else { |
|
| 513 | - $option_tray = new \XoopsFormElementTray(_MD_NEWBB_POLL_POLLOPTIONS, ''); |
|
| 514 | - $barcolor_array = \XoopsLists::getImgListAsArray($GLOBALS['xoops']->path('modules/' . $GLOBALS['xoopsModuleConfig']['poll_module'] . '/assets/images/colorbars/')); |
|
| 515 | - for ($i = 0; $i < 10; ++$i) { |
|
| 516 | - $current_bar = ('blank.gif' !== current($barcolor_array)) ? current($barcolor_array) : next($barcolor_array); |
|
| 517 | - $option_text = new \XoopsFormText('', 'option_text[]', 50, 255); |
|
| 518 | - $option_tray->addElement($option_text); |
|
| 519 | - $color_select = new \XoopsFormSelect('', "option_color[{$i}]", $current_bar); |
|
| 520 | - $color_select->addOptionArray($barcolor_array); |
|
| 521 | - $color_select->setExtra("onchange='showImgSelected(\"option_color_image[{$i}]\", \"option_color[{$i}]\", \"modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/assets/images/colorbars\", \"\", \"" . XOOPS_URL . "\")'"); |
|
| 522 | - $color_label = new \XoopsFormLabel('', "<img src='" |
|
| 523 | - . $GLOBALS['xoops']->url("modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/assets/images/colorbars/{$current_bar}") |
|
| 524 | - . "' name='option_color_image[{$i}]' id='option_color_image[{$i}]' class='alignbottom' width='30' height='15' alt='' /><br>"); |
|
| 525 | - $option_tray->addElement($color_select); |
|
| 526 | - $option_tray->addElement($color_label); |
|
| 527 | - unset($color_select, $color_label, $option_text); |
|
| 528 | - if (!next($barcolor_array)) { |
|
| 529 | - reset($barcolor_array); |
|
| 608 | + $msg = $xpPollHandler->getHtmlErrors(); |
|
| 530 | 609 | } |
| 531 | - } |
|
| 532 | - } |
|
| 533 | - $poll_form->addElement($option_tray); |
|
| 534 | - $poll_form->addElement(new \XoopsFormButtonTray('poll_submit', _SUBMIT, 'submit')); |
|
| 535 | - $poll_form->addElement(new \XoopsFormHidden('op', 'savemore')); |
|
| 536 | - $poll_form->addElement(new \XoopsFormHidden('topic_id', $topic_id)); |
|
| 537 | - $poll_form->addElement(new \XoopsFormHidden('poll_id', $poll_id)); |
|
| 538 | - |
|
| 539 | - echo '<h4>' . _MD_NEWBB_POLL_POLLCONF . "</h4>\n"; |
|
| 540 | - $poll_form->display(); |
|
| 541 | - break; |
|
| 542 | - |
|
| 543 | - case 'savemore': |
|
| 544 | - // check security token |
|
| 545 | - if (!$GLOBALS['xoopsSecurity']->check()) { |
|
| 546 | - redirect_header(Request::getString('PHP_SELF', '', 'SERVER'), 2, implode('<br>', $GLOBALS['xoopsSecurity']->getErrors())); |
|
| 547 | - } |
|
| 548 | - |
|
| 549 | - $option_text = Request::getString('option_text', '', 'POST'); |
|
| 550 | - $option_string = is_array($option_text) ? implode('', $option_text) : $option_text; |
|
| 551 | - $option_string = trim($option_string); |
|
| 552 | - if ('' === $option_string) { |
|
| 553 | - // irmtfan - issue with javascript:history.go(-1) |
|
| 554 | - redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 2, _MD_NEWBB_ERROROCCURED . ': ' . _MD_NEWBB_POLL_POLLOPTIONS . ' !'); |
|
| 555 | - } |
|
| 556 | - $i = 0; |
|
| 557 | - $option_color = Request::getArray('option_color', null, 'POST'); |
|
| 558 | - foreach ($option_text as $optxt) { |
|
| 559 | - $optxt = trim($optxt); |
|
| 560 | - if ('' !== $optxt) { |
|
| 561 | - // new xoopspoll module |
|
| 562 | - if ($pollModuleHandler->getVar('version') >= 140) { |
|
| 563 | - $xpOptHandler = Xoopspoll\Helper::getInstance()->getHandler('Option'); |
|
| 564 | - $optionObject = $xpOptHandler->create(); |
|
| 565 | - $optionObject->setVar('option_text', $optxt); |
|
| 566 | - $optionObject->setVar('poll_id', $poll_id); |
|
| 567 | - $optionObject->setVar('option_color', $option_color[$i]); |
|
| 568 | - $xpOptHandler->insert($optionObject); |
|
| 569 | 610 | // old xoopspoll or umfrage or any clone from them |
| 611 | + } else { |
|
| 612 | + $status = $pollObject->delete(); |
|
| 613 | + $classOption = $classPoll . 'Option'; |
|
| 614 | + $classLog = $classPoll . 'Log'; |
|
| 615 | + if (false !== $status) { |
|
| 616 | + $classOption::deleteByPollId($poll_id); |
|
| 617 | + $classLog::deleteByPollId($poll_id); |
|
| 570 | 618 | } else { |
| 571 | - $classOption = $classPoll . 'Option'; |
|
| 572 | - $optionObject = new $classOption(); |
|
| 573 | - $optionObject->setVar('option_text', $optxt); |
|
| 574 | - $optionObject->setVar('poll_id', $poll_id); |
|
| 575 | - $optionObject->setVar('option_color', $option_color[$i]); |
|
| 576 | - $optionObject->store(); |
|
| 619 | + $msg = $pollObject->getHtmlErrors(); |
|
| 577 | 620 | } |
| 578 | - unset($optionObject); |
|
| 579 | 621 | } |
| 580 | - ++$i; |
|
| 581 | - } |
|
| 582 | - require_once $GLOBALS['xoops']->path('class/template.php'); |
|
| 583 | - xoops_template_clear_module_cache($GLOBALS['xoopsModule']->getVar('mid')); |
|
| 584 | - xoops_template_clear_module_cache($pollModuleHandler->getVar('mid')); |
|
| 585 | - redirect_header("polls.php?op=edit&poll_id={$poll_id}&topic_id={$topic_id}", 2, _MD_NEWBB_POLL_DBUPDATED); |
|
| 586 | - break; |
|
| 587 | - |
|
| 588 | - case 'delete': |
|
| 589 | - echo '<h4>' . _MD_NEWBB_POLL_POLLCONF . "</h4>\n"; |
|
| 590 | - xoops_confirm(['op' => 'delete_ok', 'topic_id' => $topic_id, 'poll_id' => $poll_id], 'polls.php', sprintf(_MD_NEWBB_POLL_RUSUREDEL, $pollObject->getVar('question'))); |
|
| 591 | - break; |
|
| 592 | - |
|
| 593 | - case 'delete_ok': |
|
| 594 | - // check security token |
|
| 595 | - if (!$GLOBALS['xoopsSecurity']->check()) { |
|
| 596 | - redirect_header(Request::getString('PHP_SELF', '', 'SERVER'), 2, implode('<br>', $GLOBALS['xoopsSecurity']->getErrors())); |
|
| 597 | - } |
|
| 598 | - //try and delete the poll |
|
| 599 | - // new xoopspoll module |
|
| 600 | - if ($pollModuleHandler->getVar('version') >= 140) { |
|
| 601 | - $status = $xpPollHandler->delete($pollObject); |
|
| 602 | 622 | if (false !== $status) { |
| 603 | - $xpOptHandler = Xoopspoll\Helper::getInstance()->getHandler('Option'); |
|
| 604 | - $xpLogHandler = Xoopspoll\Helper::getInstance()->getHandler('Log'); |
|
| 605 | - $xpOptHandler->deleteByPollId($poll_id); |
|
| 606 | - $xpLogHandler->deleteByPollId($poll_id); |
|
| 623 | + require_once $GLOBALS['xoops']->path('class/template.php'); |
|
| 624 | + xoops_template_clear_module_cache($xoopsModule->getVar('mid')); |
|
| 625 | + xoops_template_clear_module_cache($pollModuleHandler->getVar('mid')); |
|
| 626 | + // delete comments for this poll |
|
| 627 | + xoops_comment_delete($xoopsModule->getVar('mid'), $poll_id); |
|
| 628 | + |
|
| 629 | + $topicObject->setVar('votes', 0); // not sure why we want to clear votes too... but I left it alone |
|
| 630 | + $topicObject->setVar('topic_haspoll', 0); |
|
| 631 | + $topicObject->setVar('poll_id', 0); |
|
| 632 | + $success = $topicHandler->insert($topicObject); |
|
| 633 | + if (!$success) { |
|
| 634 | + xoops_error($topicHandler->getHtmlErrors()); |
|
| 635 | + break; |
|
| 636 | + } |
|
| 607 | 637 | } else { |
| 608 | - $msg = $xpPollHandler->getHtmlErrors(); |
|
| 638 | + xoops_error($msg); |
|
| 639 | + break; |
|
| 609 | 640 | } |
| 641 | + redirect_header(XOOPS_URL . "/modules/newbb/viewtopic.php?topic_id={$topic_id}", 1, _MD_NEWBB_POLL_DBUPDATED); |
|
| 642 | + break; |
|
| 643 | + |
|
| 644 | + case 'restart': |
|
| 645 | + // new xoopspoll module |
|
| 646 | + if ($pollModuleHandler->getVar('version') >= 140) { |
|
| 647 | + $classConstants = new XoopsModules\Xoopspoll\Constants(); |
|
| 648 | + $default_poll_duration = $classConstants::DEFAULT_POLL_DURATION; |
|
| 610 | 649 | // old xoopspoll or umfrage or any clone from them |
| 611 | - } else { |
|
| 612 | - $status = $pollObject->delete(); |
|
| 613 | - $classOption = $classPoll . 'Option'; |
|
| 614 | - $classLog = $classPoll . 'Log'; |
|
| 615 | - if (false !== $status) { |
|
| 616 | - $classOption::deleteByPollId($poll_id); |
|
| 617 | - $classLog::deleteByPollId($poll_id); |
|
| 618 | 650 | } else { |
| 619 | - $msg = $pollObject->getHtmlErrors(); |
|
| 651 | + $default_poll_duration = (86400 * 10); |
|
| 620 | 652 | } |
| 621 | - } |
|
| 622 | - if (false !== $status) { |
|
| 623 | - require_once $GLOBALS['xoops']->path('class/template.php'); |
|
| 624 | - xoops_template_clear_module_cache($xoopsModule->getVar('mid')); |
|
| 625 | - xoops_template_clear_module_cache($pollModuleHandler->getVar('mid')); |
|
| 626 | - // delete comments for this poll |
|
| 627 | - xoops_comment_delete($xoopsModule->getVar('mid'), $poll_id); |
|
| 653 | + $poll_form = new \XoopsThemeForm(_MD_NEWBB_POLL_RESTARTPOLL, 'poll_form', 'polls.php', 'post', true); |
|
| 654 | + $expire_text = new \XoopsFormText( |
|
| 655 | + _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( |
|
| 656 | + _MD_NEWBB_POLL_EXPIREDAT, |
|
| 657 | + formatTimestamp($pollObject->getVar('end_time'), 'Y-m-d H:i:s') |
|
| 658 | + ) . '</small>', |
|
| 659 | + 'end_time', |
|
| 660 | + 20, |
|
| 661 | + 19, |
|
| 662 | + 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')); |
|
| 628 | 671 | |
| 629 | - $topicObject->setVar('votes', 0); // not sure why we want to clear votes too... but I left it alone |
|
| 630 | - $topicObject->setVar('topic_haspoll', 0); |
|
| 631 | - $topicObject->setVar('poll_id', 0); |
|
| 632 | - $success = $topicHandler->insert($topicObject); |
|
| 633 | - if (!$success) { |
|
| 634 | - xoops_error($topicHandler->getHtmlErrors()); |
|
| 635 | - break; |
|
| 636 | - } |
|
| 637 | - } else { |
|
| 638 | - xoops_error($msg); |
|
| 672 | + echo '<h4>' . _MD_NEWBB_POLL_POLLCONF . "</h4>\n"; |
|
| 673 | + $poll_form->display(); |
|
| 639 | 674 | break; |
| 640 | - } |
|
| 641 | - redirect_header(XOOPS_URL . "/modules/newbb/viewtopic.php?topic_id={$topic_id}", 1, _MD_NEWBB_POLL_DBUPDATED); |
|
| 642 | - break; |
|
| 643 | - |
|
| 644 | - case 'restart': |
|
| 645 | - // new xoopspoll module |
|
| 646 | - if ($pollModuleHandler->getVar('version') >= 140) { |
|
| 647 | - $classConstants = new XoopsModules\Xoopspoll\Constants(); |
|
| 648 | - $default_poll_duration = $classConstants::DEFAULT_POLL_DURATION; |
|
| 649 | - // old xoopspoll or umfrage or any clone from them |
|
| 650 | - } else { |
|
| 651 | - $default_poll_duration = (86400 * 10); |
|
| 652 | - } |
|
| 653 | - $poll_form = new \XoopsThemeForm(_MD_NEWBB_POLL_RESTARTPOLL, 'poll_form', 'polls.php', 'post', true); |
|
| 654 | - $expire_text = new \XoopsFormText( |
|
| 655 | - _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( |
|
| 656 | - _MD_NEWBB_POLL_EXPIREDAT, |
|
| 657 | - formatTimestamp($pollObject->getVar('end_time'), 'Y-m-d H:i:s') |
|
| 658 | - ) . '</small>', |
|
| 659 | - 'end_time', |
|
| 660 | - 20, |
|
| 661 | - 19, |
|
| 662 | - 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 | - |
|
| 676 | - case 'restart_ok': |
|
| 677 | - // check security token |
|
| 678 | - if (!$GLOBALS['xoopsSecurity']->check()) { |
|
| 679 | - redirect_header(Request::getString('PHP_SELF', '', 'SERVER'), 2, implode('<br>', $GLOBALS['xoopsSecurity']->getErrors())); |
|
| 680 | - } |
|
| 681 | 675 | |
| 682 | - // new xoopspoll module |
|
| 683 | - if ($pollModuleHandler->getVar('version') >= 140) { |
|
| 684 | - $classConstants = new XoopsModules\Xoopspoll\Constants(); |
|
| 685 | - $default_poll_duration = $classConstants::DEFAULT_POLL_DURATION; |
|
| 686 | - $poll_not_mailed = $classConstants::POLL_NOT_MAILED; |
|
| 687 | - $poll_mailed = $classConstants::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 | - } |
|
| 676 | + case 'restart_ok': |
|
| 677 | + // check security token |
|
| 678 | + if (!$GLOBALS['xoopsSecurity']->check()) { |
|
| 679 | + redirect_header(Request::getString('PHP_SELF', '', 'SERVER'), 2, implode('<br>', $GLOBALS['xoopsSecurity']->getErrors())); |
|
| 680 | + } |
|
| 694 | 681 | |
| 695 | - $end_time = !Request::getInt('end_time', 0, 'POST'); |
|
| 696 | - if (0 !== $end_time) { |
|
| 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 | - } |
|
| 682 | + // new xoopspoll module |
|
| 683 | + if ($pollModuleHandler->getVar('version') >= 140) { |
|
| 684 | + $classConstants = new XoopsModules\Xoopspoll\Constants(); |
|
| 685 | + $default_poll_duration = $classConstants::DEFAULT_POLL_DURATION; |
|
| 686 | + $poll_not_mailed = $classConstants::POLL_NOT_MAILED; |
|
| 687 | + $poll_mailed = $classConstants::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 | + } |
|
| 702 | 694 | |
| 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 | - } |
|
| 695 | + $end_time = !Request::getInt('end_time', 0, 'POST'); |
|
| 696 | + if (0 !== $end_time) { |
|
| 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 | + } |
|
| 711 | 702 | |
| 712 | - // new xoopspoll module |
|
| 713 | - if ($pollModuleHandler->getVar('version') >= 140) { |
|
| 714 | - if (!$xpPollHandler->insert($pollObject)) { // update the poll |
|
| 715 | - xoops_error($pollObject->getHtmlErrors()); |
|
| 716 | - exit(); |
|
| 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); |
|
| 717 | 710 | } |
| 718 | - if (Request::getInt('reset', 0, 'POST')) { // reset all vote/voter counters |
|
| 719 | - /** @var Xoopspoll\OptionHandler $xpOptHandler */ |
|
| 720 | - $xpOptHandler = Xoopspoll\Helper::getInstance()->getHandler('Option'); |
|
| 721 | - /** @var Xoopspoll\LogHandler $xpLogHandler */ |
|
| 722 | - $xpLogHandler = Xoopspoll\Helper::getInstance()->getHandler('Log'); |
|
| 723 | - $xpLogHandler->deleteByPollId($poll_id); |
|
| 724 | - $xpOptHandler->resetCountByPollId($poll_id); |
|
| 725 | - $xpPollHandler->updateCount($pollObject); |
|
| 711 | + |
|
| 712 | + // new xoopspoll module |
|
| 713 | + if ($pollModuleHandler->getVar('version') >= 140) { |
|
| 714 | + if (!$xpPollHandler->insert($pollObject)) { // update the poll |
|
| 715 | + xoops_error($pollObject->getHtmlErrors()); |
|
| 716 | + exit(); |
|
| 717 | + } |
|
| 718 | + if (Request::getInt('reset', 0, 'POST')) { // reset all vote/voter counters |
|
| 719 | + /** @var Xoopspoll\OptionHandler $xpOptHandler */ |
|
| 720 | + $xpOptHandler = Xoopspoll\Helper::getInstance()->getHandler('Option'); |
|
| 721 | + /** @var Xoopspoll\LogHandler $xpLogHandler */ |
|
| 722 | + $xpLogHandler = Xoopspoll\Helper::getInstance()->getHandler('Log'); |
|
| 723 | + $xpLogHandler->deleteByPollId($poll_id); |
|
| 724 | + $xpOptHandler->resetCountByPollId($poll_id); |
|
| 725 | + $xpPollHandler->updateCount($pollObject); |
|
| 726 | + } |
|
| 727 | + // old xoopspoll or umfrage or any clone from them |
|
| 728 | + } else { |
|
| 729 | + if (!$pollObject->store()) { // update the poll |
|
| 730 | + xoops_error($pollObject->getHtmlErrors()); |
|
| 731 | + exit(); |
|
| 732 | + } |
|
| 733 | + if (Request::getInt('reset', 0, 'POST')) { // reset all logs |
|
| 734 | + $classOption = $classPoll . 'Option'; |
|
| 735 | + $classLog = $classPoll . 'Log'; |
|
| 736 | + $classLog::deleteByPollId($poll_id); |
|
| 737 | + $classOption::resetCountByPollId($poll_id); |
|
| 738 | + $pollObject->updateCount(); |
|
| 739 | + } |
|
| 726 | 740 | } |
| 741 | + require_once $GLOBALS['xoops']->path('class/template.php'); |
|
| 742 | + xoops_template_clear_module_cache($xoopsModule->getVar('mid')); |
|
| 743 | + xoops_template_clear_module_cache($pollModuleHandler->getVar('mid')); |
|
| 744 | + redirect_header(XOOPS_URL . "/modules/newbb/viewtopic.php?topic_id={$topic_id}", 1, _MD_NEWBB_POLL_DBUPDATED); |
|
| 745 | + break; |
|
| 746 | + |
|
| 747 | + case 'log': |
|
| 748 | + // new xoopspoll module |
|
| 749 | + if ($pollModuleHandler->getVar('version') >= 140) { |
|
| 750 | + redirect_header($GLOBALS['xoops']->url("modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/admin/main.php?op=log&poll_id={$poll_id}"), 2, _MD_NEWBB_POLL_VIEWLOG); |
|
| 727 | 751 | // old xoopspoll or umfrage or any clone from them |
| 728 | - } else { |
|
| 729 | - if (!$pollObject->store()) { // update the poll |
|
| 730 | - xoops_error($pollObject->getHtmlErrors()); |
|
| 731 | - exit(); |
|
| 732 | - } |
|
| 733 | - if (Request::getInt('reset', 0, 'POST')) { // reset all logs |
|
| 734 | - $classOption = $classPoll . 'Option'; |
|
| 735 | - $classLog = $classPoll . 'Log'; |
|
| 736 | - $classLog::deleteByPollId($poll_id); |
|
| 737 | - $classOption::resetCountByPollId($poll_id); |
|
| 738 | - $pollObject->updateCount(); |
|
| 752 | + } else { |
|
| 753 | + redirect_header($GLOBALS['xoops']->url("modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/admin/index.php?op=log&poll_id={$poll_id}"), 2, _MD_NEWBB_POLL_VIEWLOG); |
|
| 739 | 754 | } |
| 740 | - } |
|
| 741 | - require_once $GLOBALS['xoops']->path('class/template.php'); |
|
| 742 | - xoops_template_clear_module_cache($xoopsModule->getVar('mid')); |
|
| 743 | - xoops_template_clear_module_cache($pollModuleHandler->getVar('mid')); |
|
| 744 | - redirect_header(XOOPS_URL . "/modules/newbb/viewtopic.php?topic_id={$topic_id}", 1, _MD_NEWBB_POLL_DBUPDATED); |
|
| 745 | - break; |
|
| 746 | - |
|
| 747 | - case 'log': |
|
| 748 | - // new xoopspoll module |
|
| 749 | - if ($pollModuleHandler->getVar('version') >= 140) { |
|
| 750 | - redirect_header($GLOBALS['xoops']->url("modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/admin/main.php?op=log&poll_id={$poll_id}"), 2, _MD_NEWBB_POLL_VIEWLOG); |
|
| 751 | - // old xoopspoll or umfrage or any clone from them |
|
| 752 | - } else { |
|
| 753 | - redirect_header($GLOBALS['xoops']->url("modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/admin/index.php?op=log&poll_id={$poll_id}"), 2, _MD_NEWBB_POLL_VIEWLOG); |
|
| 754 | - } |
|
| 755 | - break; |
|
| 755 | + break; |
|
| 756 | 756 | } // switch |
| 757 | 757 | |
| 758 | 758 | // irmtfan move to footer.php |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | // rewrite by irmtfan and zyspec to accept xoopspoll 1.4 and all old xoopspoll and umfrage versions and all clones |
| 25 | 25 | |
| 26 | -require_once __DIR__ . '/header.php'; |
|
| 26 | +require_once __DIR__.'/header.php'; |
|
| 27 | 27 | require_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); |
| 28 | 28 | require_once $GLOBALS['xoops']->path('class/xoopslists.php'); |
| 29 | 29 | require_once $GLOBALS['xoops']->path('class/xoopsblock.php'); |
@@ -56,18 +56,18 @@ discard block |
||
| 56 | 56 | if (is_object($topicObject)) { |
| 57 | 57 | $forum_id = $topicObject->getVar('forum_id'); |
| 58 | 58 | } else { |
| 59 | - redirect_header(XOOPS_URL . '/index.php', 2, _MD_NEWBB_POLLMODULE_ERROR . ': ' . _MD_NEWBB_FORUMNOEXIST); |
|
| 59 | + redirect_header(XOOPS_URL.'/index.php', 2, _MD_NEWBB_POLLMODULE_ERROR.': '._MD_NEWBB_FORUMNOEXIST); |
|
| 60 | 60 | } |
| 61 | 61 | // forum access permission |
| 62 | 62 | /** @var Newbb\ForumHandler $forumHandler */ |
| 63 | 63 | $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); |
| 64 | 64 | $forumObject = $forumHandler->get($forum_id); |
| 65 | 65 | if (!$forumHandler->getPermission($forumObject)) { |
| 66 | - redirect_header(XOOPS_URL . '/index.php', 2, _MD_NEWBB_NORIGHTTOACCESS); |
|
| 66 | + redirect_header(XOOPS_URL.'/index.php', 2, _MD_NEWBB_NORIGHTTOACCESS); |
|
| 67 | 67 | } |
| 68 | 68 | // topic view permission |
| 69 | 69 | if (!$topicHandler->getPermission($forumObject, $topicObject->getVar('topic_status'), 'view')) { |
| 70 | - redirect_header('viewforum.php?forum=' . $forum_id, 2, _MD_NEWBB_NORIGHTTOVIEW); |
|
| 70 | + redirect_header('viewforum.php?forum='.$forum_id, 2, _MD_NEWBB_NORIGHTTOVIEW); |
|
| 71 | 71 | } |
| 72 | 72 | // poll module |
| 73 | 73 | $pollModuleHandler = $moduleHandler->getByDirname($GLOBALS['xoopsModuleConfig']['poll_module']); |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | $pollObject = $xpPollHandler->get($poll_id); // will create poll if poll_id = 0 exist |
| 85 | 85 | // old xoopspoll or umfrage or any clone from them |
| 86 | 86 | } else { |
| 87 | - include $GLOBALS['xoops']->path('modules/' . $GLOBALS['xoopsModuleConfig']['poll_module'] . '/include/constants.php'); |
|
| 87 | + include $GLOBALS['xoops']->path('modules/'.$GLOBALS['xoopsModuleConfig']['poll_module'].'/include/constants.php'); |
|
| 88 | 88 | $classPoll = $topicObject->loadOldPoll(); |
| 89 | 89 | $pollObject = new $classPoll($poll_id); // will create poll if poll_id = 0 exist |
| 90 | 90 | } |
@@ -114,11 +114,11 @@ discard block |
||
| 114 | 114 | case 'add': |
| 115 | 115 | // new xoopspoll module |
| 116 | 116 | if ($pollModuleHandler->getVar('version') >= 140) { |
| 117 | - echo '<h4>' . _MD_NEWBB_POLL_CREATNEWPOLL . "</h4>\n"; |
|
| 117 | + echo '<h4>'._MD_NEWBB_POLL_CREATNEWPOLL."</h4>\n"; |
|
| 118 | 118 | $pollObject->renderForm(Request::getString('PHP_SELF', '', 'SERVER'), 'post', ['topic_id' => $topic_id]); |
| 119 | 119 | // old xoopspoll or umfrage or any clone from them |
| 120 | 120 | } else { |
| 121 | - $classOption = $classPoll . 'Option'; |
|
| 121 | + $classOption = $classPoll.'Option'; |
|
| 122 | 122 | $poll_form = new \XoopsThemeForm(_MD_NEWBB_POLL_CREATNEWPOLL, 'poll_form', 'polls.php', 'post', true); |
| 123 | 123 | $author_label = new \XoopsFormLabel(_MD_NEWBB_POLL_AUTHOR, is_object($GLOBALS['xoopsUser']) ? ("<a href='" |
| 124 | 124 | . XOOPS_URL |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | $poll_form->addElement($desc_tarea); |
| 135 | 135 | $currenttime = formatTimestamp(time(), 'Y-m-d H:i:s'); |
| 136 | 136 | $endtime = formatTimestamp(time() + 604800, 'Y-m-d H:i:s'); |
| 137 | - $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); |
|
| 137 | + $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); |
|
| 138 | 138 | $poll_form->addElement($expire_text); |
| 139 | 139 | |
| 140 | 140 | $weight_text = new \XoopsFormText(_MD_NEWBB_POLL_DISPLAYORDER, 'weight', 6, 5, 0); |
@@ -147,14 +147,14 @@ discard block |
||
| 147 | 147 | $poll_form->addElement($notify_yn); |
| 148 | 148 | |
| 149 | 149 | $option_tray = new \XoopsFormElementTray(_MD_NEWBB_POLL_POLLOPTIONS, ''); |
| 150 | - $barcolor_array = \XoopsLists::getImgListAsArray($GLOBALS['xoops']->path('modules/' . $GLOBALS['xoopsModuleConfig']['poll_module'] . '/assets/images/colorbars/')); |
|
| 150 | + $barcolor_array = \XoopsLists::getImgListAsArray($GLOBALS['xoops']->path('modules/'.$GLOBALS['xoopsModuleConfig']['poll_module'].'/assets/images/colorbars/')); |
|
| 151 | 151 | for ($i = 0; $i < 10; ++$i) { |
| 152 | 152 | $current_bar = ('blank.gif' !== current($barcolor_array)) ? current($barcolor_array) : next($barcolor_array); |
| 153 | 153 | $option_text = new \XoopsFormText('', 'option_text[]', 50, 255); |
| 154 | 154 | $option_tray->addElement($option_text); |
| 155 | 155 | $color_select = new \XoopsFormSelect('', "option_color[{$i}]", $current_bar); |
| 156 | 156 | $color_select->addOptionArray($barcolor_array); |
| 157 | - $color_select->setExtra("onchange='showImgSelected(\"option_color_image[{$i}]\", \"option_color[{$i}]\", \"modules/" . $GLOBALS['xoopsModuleConfig']['poll_module'] . '/assets/images/colorbars", "", "' . XOOPS_URL . "\")'"); |
|
| 157 | + $color_select->setExtra("onchange='showImgSelected(\"option_color_image[{$i}]\", \"option_color[{$i}]\", \"modules/".$GLOBALS['xoopsModuleConfig']['poll_module'].'/assets/images/colorbars", "", "'.XOOPS_URL."\")'"); |
|
| 158 | 158 | $color_label = new \XoopsFormLabel('', "<img src='" |
| 159 | 159 | . XOOPS_URL |
| 160 | 160 | . '/modules/' |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | $poll_form->addElement(new \XoopsFormHidden('poll_id', $poll_id)); |
| 177 | 177 | $poll_form->addElement(new \XoopsFormHidden('user_id', is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('uid') : 0)); |
| 178 | 178 | $poll_form->addElement(new \XoopsFormButtonTray('poll_submit', _SUBMIT, 'submit')); |
| 179 | - echo '<h4>' . _MD_NEWBB_POLL_POLLCONF . '</h4>'; |
|
| 179 | + echo '<h4>'._MD_NEWBB_POLL_POLLCONF.'</h4>'; |
|
| 180 | 180 | $poll_form->display(); |
| 181 | 181 | } |
| 182 | 182 | break; // op: add |
@@ -184,13 +184,13 @@ discard block |
||
| 184 | 184 | case 'edit': |
| 185 | 185 | // new xoopspoll module |
| 186 | 186 | if ($pollModuleHandler->getVar('version') >= 140) { |
| 187 | - echo '<h4>' . _MD_NEWBB_POLL_EDITPOLL . "</h4>\n"; |
|
| 187 | + echo '<h4>'._MD_NEWBB_POLL_EDITPOLL."</h4>\n"; |
|
| 188 | 188 | $pollObject->renderForm(Request::getString('PHP_SELF', '', 'SERVER'), 'post', ['topic_id' => $topic_id]); |
| 189 | 189 | // old xoopspoll or umfrage or any clone from them |
| 190 | 190 | } else { |
| 191 | - $classOption = $classPoll . 'Option'; |
|
| 191 | + $classOption = $classPoll.'Option'; |
|
| 192 | 192 | $poll_form = new \XoopsThemeForm(_MD_NEWBB_POLL_EDITPOLL, 'poll_form', 'polls.php', 'post', true); |
| 193 | - $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>'); |
|
| 193 | + $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>'); |
|
| 194 | 194 | $poll_form->addElement($author_label); |
| 195 | 195 | $question_text = new \XoopsFormText(_MD_NEWBB_POLL_POLLQUESTION, 'question', 50, 255, $pollObject->getVar('question', 'E')); |
| 196 | 196 | $poll_form->addElement($question_text); |
@@ -198,13 +198,13 @@ discard block |
||
| 198 | 198 | $poll_form->addElement($desc_tarea); |
| 199 | 199 | $date = formatTimestamp($pollObject->getVar('end_time'), 'Y-m-d H:i:s'); // important "Y-m-d H:i:s" use in jdf function |
| 200 | 200 | if (!$pollObject->hasExpired()) { |
| 201 | - $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); |
|
| 201 | + $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); |
|
| 202 | 202 | $poll_form->addElement($expire_text); |
| 203 | 203 | } else { |
| 204 | 204 | // irmtfan full URL - add topic_id |
| 205 | 205 | $restart_label = new \XoopsFormLabel( |
| 206 | 206 | _MD_NEWBB_POLL_EXPIRATION, |
| 207 | - sprintf(_MD_NEWBB_POLL_EXPIREDAT, $date) . "<br><a href='" . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . "/polls.php?op=restart&poll_id={$poll_id}&topic_id={$topic_id}'>" . _MD_NEWBB_POLL_RESTART . '</a>' |
|
| 207 | + sprintf(_MD_NEWBB_POLL_EXPIREDAT, $date)."<br><a href='".XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname')."/polls.php?op=restart&poll_id={$poll_id}&topic_id={$topic_id}'>"._MD_NEWBB_POLL_RESTART.'</a>' |
|
| 208 | 208 | ); |
| 209 | 209 | $poll_form->addElement($restart_label); |
| 210 | 210 | } |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | $poll_form->addElement($weight_text); |
| 213 | 213 | $multi_yn = new \XoopsFormRadioYN(_MD_NEWBB_POLL_ALLOWMULTI, 'multiple', $pollObject->getVar('multiple')); |
| 214 | 214 | $poll_form->addElement($multi_yn); |
| 215 | - $options_arr =& $classOption::getAllByPollId($poll_id); |
|
| 215 | + $options_arr = & $classOption::getAllByPollId($poll_id); |
|
| 216 | 216 | $notify_value = 1; |
| 217 | 217 | if (0 !== $pollObject->getVar('mail_status')) { |
| 218 | 218 | $notify_value = 0; |
@@ -228,9 +228,9 @@ discard block |
||
| 228 | 228 | $option_tray->addElement(new \XoopsFormHidden('option_id[]', $option->getVar('option_id'))); |
| 229 | 229 | $color_select = new \XoopsFormSelect('', 'option_color[{$i}]', $option->getVar('option_color')); |
| 230 | 230 | $color_select->addOptionArray($barcolor_array); |
| 231 | - $color_select->setExtra("onchange='showImgSelected(\"option_color_image[{$i}]\", \"option_color[" . $i . "]\", \"modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/assets/images/colorbars\", \"\", \"" . XOOPS_URL . "\")'"); |
|
| 231 | + $color_select->setExtra("onchange='showImgSelected(\"option_color_image[{$i}]\", \"option_color[".$i."]\", \"modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/assets/images/colorbars\", \"\", \"".XOOPS_URL."\")'"); |
|
| 232 | 232 | $color_label = new \XoopsFormLabel('', "<img src='" |
| 233 | - . $GLOBALS['xoops']->url("modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/assets/images/colorbars/" . $option->getVar('option_color', 'E')) |
|
| 233 | + . $GLOBALS['xoops']->url("modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/assets/images/colorbars/".$option->getVar('option_color', 'E')) |
|
| 234 | 234 | . "' name='option_color_image[{$i}]' id='option_color_image[{$i}]' class='alignbottom' width='30' height='15' alt='' /><br>"); |
| 235 | 235 | $option_tray->addElement($color_select); |
| 236 | 236 | $option_tray->addElement($color_label); |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | ++$i; |
| 239 | 239 | } |
| 240 | 240 | // irmtfan full URL |
| 241 | - $more_label = new \XoopsFormLabel('', "<br><a href='" . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . "/polls.php?op=addmore&poll_id={$poll_id}&topic_id={$topic_id}'>" . _MD_NEWBB_POLL_ADDMORE . '</a>'); |
|
| 241 | + $more_label = new \XoopsFormLabel('', "<br><a href='".XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname')."/polls.php?op=addmore&poll_id={$poll_id}&topic_id={$topic_id}'>"._MD_NEWBB_POLL_ADDMORE.'</a>'); |
|
| 242 | 242 | $option_tray->addElement($more_label); |
| 243 | 243 | $poll_form->addElement($option_tray); |
| 244 | 244 | $poll_form->addElement(new \XoopsFormHidden('op', 'update')); |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | $poll_form->addElement(new \XoopsFormHidden('poll_id', $poll_id)); |
| 247 | 247 | $poll_form->addElement(new \XoopsFormButtonTray('poll_submit', _SUBMIT, 'submit')); |
| 248 | 248 | |
| 249 | - echo '<h4>' . _MD_NEWBB_POLL_POLLCONF . "</h4>\n"; |
|
| 249 | + echo '<h4>'._MD_NEWBB_POLL_POLLCONF."</h4>\n"; |
|
| 250 | 250 | $poll_form->display(); |
| 251 | 251 | } |
| 252 | 252 | break; // op: edit |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | $option_empty = true; |
| 265 | 265 | if (!Request::getString('option_text', '', 'POST')) { |
| 266 | 266 | // irmtfan - issue with javascript:history.go(-1) |
| 267 | - redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 2, _MD_NEWBB_ERROROCCURED . ': ' . _MD_NEWBB_POLL_POLLOPTIONS . ' !'); |
|
| 267 | + redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 2, _MD_NEWBB_ERROROCCURED.': '._MD_NEWBB_POLL_POLLOPTIONS.' !'); |
|
| 268 | 268 | } |
| 269 | 269 | $option_text = Request::getArray('option_text', '', 'POST'); |
| 270 | 270 | foreach ($option_text as $optxt) { |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | } |
| 276 | 276 | if ($option_empty) { |
| 277 | 277 | // irmtfan - issue with javascript:history.go(-1) |
| 278 | - redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 2, _MD_NEWBB_ERROROCCURED . ': ' . _MD_NEWBB_POLL_POLLOPTIONS . ' !'); |
|
| 278 | + redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 2, _MD_NEWBB_ERROROCCURED.': '._MD_NEWBB_POLL_POLLOPTIONS.' !'); |
|
| 279 | 279 | } |
| 280 | 280 | $pollObject->setVar('question', Request::getString('question', '', 'POST')); |
| 281 | 281 | $pollObject->setVar('description', Request::getString('description', '', 'POST')); |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | } |
| 307 | 307 | $i = 0; |
| 308 | 308 | $option_color = Request::getArray('option_color', null, 'POST'); |
| 309 | - $classOption = $classPoll . 'Option'; |
|
| 309 | + $classOption = $classPoll.'Option'; |
|
| 310 | 310 | foreach ($option_text as $optxt) { |
| 311 | 311 | $optxt = trim($optxt); |
| 312 | 312 | /** @var Xoopspoll\Option $optionObject */ |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | } else { |
| 334 | 334 | redirect_header("viewtopic.php?topic_id={$topic_id}", 2, _MD_NEWBB_POLL_DBUPDATED); |
| 335 | 335 | } |
| 336 | - break;// op: save |
|
| 336 | + break; // op: save |
|
| 337 | 337 | } |
| 338 | 338 | // no break |
| 339 | 339 | case 'update': |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | $option_string = is_array($option_text) ? implode('', $option_text) : $option_text; |
| 347 | 347 | $option_string = trim($option_string); |
| 348 | 348 | if ('' === $option_string) { |
| 349 | - redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 2, _MD_NEWBB_ERROROCCURED . ': ' . _MD_NEWBB_POLL_POLLOPTIONS . ' !'); |
|
| 349 | + redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 2, _MD_NEWBB_ERROROCCURED.': '._MD_NEWBB_POLL_POLLOPTIONS.' !'); |
|
| 350 | 350 | } |
| 351 | 351 | |
| 352 | 352 | // new xoopspoll module |
@@ -465,8 +465,8 @@ discard block |
||
| 465 | 465 | $i = 0; |
| 466 | 466 | $option_id = Request::getArray('option_id', null, 'POST'); |
| 467 | 467 | $option_color = Request::getArray('option_color', null, 'POST'); |
| 468 | - $classOption = $classPoll . 'Option'; |
|
| 469 | - $classLog = $classPoll . 'Log'; |
|
| 468 | + $classOption = $classPoll.'Option'; |
|
| 469 | + $classLog = $classPoll.'Log'; |
|
| 470 | 470 | foreach ($option_id as $opid) { |
| 471 | 471 | $optionObject = new $classOption($opid); |
| 472 | 472 | $option_text[$i] = trim($option_text[$i]); |
@@ -497,7 +497,7 @@ discard block |
||
| 497 | 497 | } else { |
| 498 | 498 | redirect_header("viewtopic.php?topic_id={$topic_id}", 2, _MD_NEWBB_POLL_DBUPDATED); |
| 499 | 499 | } |
| 500 | - break;// op: save | update |
|
| 500 | + break; // op: save | update |
|
| 501 | 501 | |
| 502 | 502 | case 'addmore': |
| 503 | 503 | $question = $pollObject->getVar('question'); |
@@ -511,14 +511,14 @@ discard block |
||
| 511 | 511 | // old xoopspoll or umfrage or any clone from them |
| 512 | 512 | } else { |
| 513 | 513 | $option_tray = new \XoopsFormElementTray(_MD_NEWBB_POLL_POLLOPTIONS, ''); |
| 514 | - $barcolor_array = \XoopsLists::getImgListAsArray($GLOBALS['xoops']->path('modules/' . $GLOBALS['xoopsModuleConfig']['poll_module'] . '/assets/images/colorbars/')); |
|
| 514 | + $barcolor_array = \XoopsLists::getImgListAsArray($GLOBALS['xoops']->path('modules/'.$GLOBALS['xoopsModuleConfig']['poll_module'].'/assets/images/colorbars/')); |
|
| 515 | 515 | for ($i = 0; $i < 10; ++$i) { |
| 516 | 516 | $current_bar = ('blank.gif' !== current($barcolor_array)) ? current($barcolor_array) : next($barcolor_array); |
| 517 | 517 | $option_text = new \XoopsFormText('', 'option_text[]', 50, 255); |
| 518 | 518 | $option_tray->addElement($option_text); |
| 519 | 519 | $color_select = new \XoopsFormSelect('', "option_color[{$i}]", $current_bar); |
| 520 | 520 | $color_select->addOptionArray($barcolor_array); |
| 521 | - $color_select->setExtra("onchange='showImgSelected(\"option_color_image[{$i}]\", \"option_color[{$i}]\", \"modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/assets/images/colorbars\", \"\", \"" . XOOPS_URL . "\")'"); |
|
| 521 | + $color_select->setExtra("onchange='showImgSelected(\"option_color_image[{$i}]\", \"option_color[{$i}]\", \"modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/assets/images/colorbars\", \"\", \"".XOOPS_URL."\")'"); |
|
| 522 | 522 | $color_label = new \XoopsFormLabel('', "<img src='" |
| 523 | 523 | . $GLOBALS['xoops']->url("modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/assets/images/colorbars/{$current_bar}") |
| 524 | 524 | . "' name='option_color_image[{$i}]' id='option_color_image[{$i}]' class='alignbottom' width='30' height='15' alt='' /><br>"); |
@@ -536,7 +536,7 @@ discard block |
||
| 536 | 536 | $poll_form->addElement(new \XoopsFormHidden('topic_id', $topic_id)); |
| 537 | 537 | $poll_form->addElement(new \XoopsFormHidden('poll_id', $poll_id)); |
| 538 | 538 | |
| 539 | - echo '<h4>' . _MD_NEWBB_POLL_POLLCONF . "</h4>\n"; |
|
| 539 | + echo '<h4>'._MD_NEWBB_POLL_POLLCONF."</h4>\n"; |
|
| 540 | 540 | $poll_form->display(); |
| 541 | 541 | break; |
| 542 | 542 | |
@@ -551,7 +551,7 @@ discard block |
||
| 551 | 551 | $option_string = trim($option_string); |
| 552 | 552 | if ('' === $option_string) { |
| 553 | 553 | // irmtfan - issue with javascript:history.go(-1) |
| 554 | - redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 2, _MD_NEWBB_ERROROCCURED . ': ' . _MD_NEWBB_POLL_POLLOPTIONS . ' !'); |
|
| 554 | + redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 2, _MD_NEWBB_ERROROCCURED.': '._MD_NEWBB_POLL_POLLOPTIONS.' !'); |
|
| 555 | 555 | } |
| 556 | 556 | $i = 0; |
| 557 | 557 | $option_color = Request::getArray('option_color', null, 'POST'); |
@@ -568,7 +568,7 @@ discard block |
||
| 568 | 568 | $xpOptHandler->insert($optionObject); |
| 569 | 569 | // old xoopspoll or umfrage or any clone from them |
| 570 | 570 | } else { |
| 571 | - $classOption = $classPoll . 'Option'; |
|
| 571 | + $classOption = $classPoll.'Option'; |
|
| 572 | 572 | $optionObject = new $classOption(); |
| 573 | 573 | $optionObject->setVar('option_text', $optxt); |
| 574 | 574 | $optionObject->setVar('poll_id', $poll_id); |
@@ -586,7 +586,7 @@ discard block |
||
| 586 | 586 | break; |
| 587 | 587 | |
| 588 | 588 | case 'delete': |
| 589 | - echo '<h4>' . _MD_NEWBB_POLL_POLLCONF . "</h4>\n"; |
|
| 589 | + echo '<h4>'._MD_NEWBB_POLL_POLLCONF."</h4>\n"; |
|
| 590 | 590 | xoops_confirm(['op' => 'delete_ok', 'topic_id' => $topic_id, 'poll_id' => $poll_id], 'polls.php', sprintf(_MD_NEWBB_POLL_RUSUREDEL, $pollObject->getVar('question'))); |
| 591 | 591 | break; |
| 592 | 592 | |
@@ -610,8 +610,8 @@ discard block |
||
| 610 | 610 | // old xoopspoll or umfrage or any clone from them |
| 611 | 611 | } else { |
| 612 | 612 | $status = $pollObject->delete(); |
| 613 | - $classOption = $classPoll . 'Option'; |
|
| 614 | - $classLog = $classPoll . 'Log'; |
|
| 613 | + $classOption = $classPoll.'Option'; |
|
| 614 | + $classLog = $classPoll.'Log'; |
|
| 615 | 615 | if (false !== $status) { |
| 616 | 616 | $classOption::deleteByPollId($poll_id); |
| 617 | 617 | $classLog::deleteByPollId($poll_id); |
@@ -638,13 +638,13 @@ discard block |
||
| 638 | 638 | xoops_error($msg); |
| 639 | 639 | break; |
| 640 | 640 | } |
| 641 | - redirect_header(XOOPS_URL . "/modules/newbb/viewtopic.php?topic_id={$topic_id}", 1, _MD_NEWBB_POLL_DBUPDATED); |
|
| 641 | + redirect_header(XOOPS_URL."/modules/newbb/viewtopic.php?topic_id={$topic_id}", 1, _MD_NEWBB_POLL_DBUPDATED); |
|
| 642 | 642 | break; |
| 643 | 643 | |
| 644 | 644 | case 'restart': |
| 645 | 645 | // new xoopspoll module |
| 646 | 646 | if ($pollModuleHandler->getVar('version') >= 140) { |
| 647 | - $classConstants = new XoopsModules\Xoopspoll\Constants(); |
|
| 647 | + $classConstants = new XoopsModules\Xoopspoll\Constants(); |
|
| 648 | 648 | $default_poll_duration = $classConstants::DEFAULT_POLL_DURATION; |
| 649 | 649 | // old xoopspoll or umfrage or any clone from them |
| 650 | 650 | } else { |
@@ -652,10 +652,10 @@ discard block |
||
| 652 | 652 | } |
| 653 | 653 | $poll_form = new \XoopsThemeForm(_MD_NEWBB_POLL_RESTARTPOLL, 'poll_form', 'polls.php', 'post', true); |
| 654 | 654 | $expire_text = new \XoopsFormText( |
| 655 | - _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( |
|
| 655 | + _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( |
|
| 656 | 656 | _MD_NEWBB_POLL_EXPIREDAT, |
| 657 | 657 | formatTimestamp($pollObject->getVar('end_time'), 'Y-m-d H:i:s') |
| 658 | - ) . '</small>', |
|
| 658 | + ).'</small>', |
|
| 659 | 659 | 'end_time', |
| 660 | 660 | 20, |
| 661 | 661 | 19, |
@@ -669,7 +669,7 @@ discard block |
||
| 669 | 669 | $poll_form->addElement(new \XoopsFormHidden('poll_id', $poll_id)); |
| 670 | 670 | $poll_form->addElement(new \XoopsFormButton('', 'poll_submit', _MD_NEWBB_POLL_RESTART, 'submit')); |
| 671 | 671 | |
| 672 | - echo '<h4>' . _MD_NEWBB_POLL_POLLCONF . "</h4>\n"; |
|
| 672 | + echo '<h4>'._MD_NEWBB_POLL_POLLCONF."</h4>\n"; |
|
| 673 | 673 | $poll_form->display(); |
| 674 | 674 | break; |
| 675 | 675 | |
@@ -681,7 +681,7 @@ discard block |
||
| 681 | 681 | |
| 682 | 682 | // new xoopspoll module |
| 683 | 683 | if ($pollModuleHandler->getVar('version') >= 140) { |
| 684 | - $classConstants = new XoopsModules\Xoopspoll\Constants(); |
|
| 684 | + $classConstants = new XoopsModules\Xoopspoll\Constants(); |
|
| 685 | 685 | $default_poll_duration = $classConstants::DEFAULT_POLL_DURATION; |
| 686 | 686 | $poll_not_mailed = $classConstants::POLL_NOT_MAILED; |
| 687 | 687 | $poll_mailed = $classConstants::POLL_MAILED; |
@@ -731,8 +731,8 @@ discard block |
||
| 731 | 731 | exit(); |
| 732 | 732 | } |
| 733 | 733 | if (Request::getInt('reset', 0, 'POST')) { // reset all logs |
| 734 | - $classOption = $classPoll . 'Option'; |
|
| 735 | - $classLog = $classPoll . 'Log'; |
|
| 734 | + $classOption = $classPoll.'Option'; |
|
| 735 | + $classLog = $classPoll.'Log'; |
|
| 736 | 736 | $classLog::deleteByPollId($poll_id); |
| 737 | 737 | $classOption::resetCountByPollId($poll_id); |
| 738 | 738 | $pollObject->updateCount(); |
@@ -741,7 +741,7 @@ discard block |
||
| 741 | 741 | require_once $GLOBALS['xoops']->path('class/template.php'); |
| 742 | 742 | xoops_template_clear_module_cache($xoopsModule->getVar('mid')); |
| 743 | 743 | xoops_template_clear_module_cache($pollModuleHandler->getVar('mid')); |
| 744 | - redirect_header(XOOPS_URL . "/modules/newbb/viewtopic.php?topic_id={$topic_id}", 1, _MD_NEWBB_POLL_DBUPDATED); |
|
| 744 | + redirect_header(XOOPS_URL."/modules/newbb/viewtopic.php?topic_id={$topic_id}", 1, _MD_NEWBB_POLL_DBUPDATED); |
|
| 745 | 745 | break; |
| 746 | 746 | |
| 747 | 747 | case 'log': |
@@ -756,5 +756,5 @@ discard block |
||
| 756 | 756 | } // switch |
| 757 | 757 | |
| 758 | 758 | // irmtfan move to footer.php |
| 759 | -require_once __DIR__ . '/footer.php'; |
|
| 759 | +require_once __DIR__.'/footer.php'; |
|
| 760 | 760 | include $GLOBALS['xoops']->path('footer.php'); |
@@ -11,12 +11,12 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | use Xmf\Request; |
| 13 | 13 | |
| 14 | -require_once __DIR__ . '/header.php'; |
|
| 14 | +require_once __DIR__.'/header.php'; |
|
| 15 | 15 | |
| 16 | 16 | if (!Request::getInt('forum', 0, 'GET')) { |
| 17 | - redirect_header(XOOPS_URL . '/index.php', 2, _MD_NEWBB_ERRORFORUM); |
|
| 17 | + redirect_header(XOOPS_URL.'/index.php', 2, _MD_NEWBB_ERRORFORUM); |
|
| 18 | 18 | } |
| 19 | -require_once __DIR__ . '/include/functions.read.php'; |
|
| 19 | +require_once __DIR__.'/include/functions.read.php'; |
|
| 20 | 20 | |
| 21 | 21 | /* |
| 22 | 22 | * Build the page query |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | $query_array = []; |
| 26 | 26 | foreach ($query_vars as $var) { |
| 27 | 27 | if (Request::getString($var, '', 'GET')) { |
| 28 | - $query_array[$var] = "{$var}=" . Request::getString($var, '', 'GET'); |
|
| 28 | + $query_array[$var] = "{$var}=".Request::getString($var, '', 'GET'); |
|
| 29 | 29 | } |
| 30 | 30 | } |
| 31 | 31 | $page_query = implode('&', array_values($query_array)); |
@@ -39,8 +39,8 @@ discard block |
||
| 39 | 39 | $markresult = _MD_NEWBB_MARK_UNREAD; |
| 40 | 40 | } |
| 41 | 41 | newbbSetReadTopic($markvalue, Request::getInt('forum', 0, 'GET')); |
| 42 | - $url = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewforum.php?' . $page_query; |
|
| 43 | - redirect_header($url, 2, _MD_NEWBB_ALL_TOPIC_MARKED . ' ' . $markresult); |
|
| 42 | + $url = XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname').'/viewforum.php?'.$page_query; |
|
| 43 | + redirect_header($url, 2, _MD_NEWBB_ALL_TOPIC_MARKED.' '.$markresult); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | $forum_id = Request::getInt('forum', 0, 'GET'); |
@@ -67,25 +67,25 @@ discard block |
||
| 67 | 67 | $forumObject = $forumHandler->get($forum_id); |
| 68 | 68 | |
| 69 | 69 | if (!$forumObject) { |
| 70 | - redirect_header(XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/index.php', 2, _MD_NEWBB_ERRORFORUM); |
|
| 70 | + redirect_header(XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname').'/index.php', 2, _MD_NEWBB_ERRORFORUM); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | if (!$forumHandler->getPermission($forumObject)) { |
| 74 | - redirect_header(XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/index.php', 2, _NOPERM); |
|
| 74 | + redirect_header(XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname').'/index.php', 2, _NOPERM); |
|
| 75 | 75 | } |
| 76 | 76 | newbbSetRead('forum', $forum_id, $forumObject->getVar('forum_last_post_id')); |
| 77 | 77 | |
| 78 | -$xoops_pagetitle = $forumObject->getVar('forum_name') . ' [' . $xoopsModule->getVar('name') . ']'; |
|
| 78 | +$xoops_pagetitle = $forumObject->getVar('forum_name').' ['.$xoopsModule->getVar('name').']'; |
|
| 79 | 79 | |
| 80 | 80 | $xoopsOption['template_main'] = 'newbb_viewforum.tpl'; |
| 81 | 81 | $xoopsOption['xoops_pagetitle'] = $xoops_pagetitle; |
| 82 | 82 | |
| 83 | 83 | require_once $GLOBALS['xoops']->path('header.php'); |
| 84 | -require_once __DIR__ . '/include/functions.render.php'; |
|
| 84 | +require_once __DIR__.'/include/functions.render.php'; |
|
| 85 | 85 | |
| 86 | 86 | if (!empty($GLOBALS['xoopsModuleConfig']['rss_enable'])) { |
| 87 | 87 | $xoopsTpl->assign('xoops_module_header', ' |
| 88 | - <link rel="alternate" type="application/xml+rss" title="' . $xoopsModule->getVar('name') . '-' . $forumObject->getVar('forum_name') . '" href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/rss.php?f=' . $forum_id . '" /> |
|
| 88 | + <link rel="alternate" type="application/xml+rss" title="' . $xoopsModule->getVar('name').'-'.$forumObject->getVar('forum_name').'" href="'.XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname').'/rss.php?f='.$forum_id.'" /> |
|
| 89 | 89 | ' . @$xoopsTpl->get_template_vars('xoops_module_header')); |
| 90 | 90 | } |
| 91 | 91 | $forumDescription = $forumObject->getVar('forum_desc'); |
@@ -119,16 +119,16 @@ discard block |
||
| 119 | 119 | |
| 120 | 120 | if ($forumHandler->getPermission($forumObject, 'post')) { |
| 121 | 121 | $xoopsTpl->assign('viewer_level', $isAdmin ? 2 : 1); |
| 122 | - $xoopsTpl->assign('forum_post_or_register', '<a href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . "/newtopic.php?forum={$forum_id}\">" . newbbDisplayImage('t_new', _MD_NEWBB_POSTNEW) . '</a>'); |
|
| 122 | + $xoopsTpl->assign('forum_post_or_register', '<a href="'.XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname')."/newtopic.php?forum={$forum_id}\">".newbbDisplayImage('t_new', _MD_NEWBB_POSTNEW).'</a>'); |
|
| 123 | 123 | if ($pollmodules && $forumHandler->getPermission($forumObject, 'addpoll')) { |
| 124 | 124 | $t_poll = newbbDisplayImage('t_poll', _MD_NEWBB_ADDPOLL); |
| 125 | - $xoopsTpl->assign('forum_addpoll', '<a href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . "/polls.php?op=add&forum={$forum_id}\">{$t_poll}</a>"); |
|
| 125 | + $xoopsTpl->assign('forum_addpoll', '<a href="'.XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname')."/polls.php?op=add&forum={$forum_id}\">{$t_poll}</a>"); |
|
| 126 | 126 | } |
| 127 | 127 | } else { |
| 128 | 128 | $xoopsTpl->assign('viewer_level', 0); |
| 129 | 129 | if (!is_object($GLOBALS['xoopsUser']) && !empty($GLOBALS['xoopsModuleConfig']['show_reg'])) { |
| 130 | - $redirect = preg_replace("|(.*)\/modules\/Newbb\/(.*)|", "\\1/modules/newbb/newtopic.php?forum=" . $forum_id, htmlspecialchars($xoopsRequestUri, ENT_QUOTES | ENT_HTML5)); |
|
| 131 | - $xoopsTpl->assign('forum_post_or_register', "<a href='" . XOOPS_URL . "/user.php?xoops_redirect={$redirect}'>" . _MD_NEWBB_REGTOPOST . '</a>'); |
|
| 130 | + $redirect = preg_replace("|(.*)\/modules\/Newbb\/(.*)|", "\\1/modules/newbb/newtopic.php?forum=".$forum_id, htmlspecialchars($xoopsRequestUri, ENT_QUOTES | ENT_HTML5)); |
|
| 131 | + $xoopsTpl->assign('forum_post_or_register', "<a href='".XOOPS_URL."/user.php?xoops_redirect={$redirect}'>"._MD_NEWBB_REGTOPOST.'</a>'); |
|
| 132 | 132 | $xoopsTpl->assign('forum_addpoll', ''); |
| 133 | 133 | } else { |
| 134 | 134 | $xoopsTpl->assign('forum_post_or_register', ''); |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | $xoopsTpl->assign_by_ref('parentforum', $parentforum); |
| 140 | 140 | |
| 141 | 141 | $criteria = new \CriteriaCompo(new \Criteria('parent_forum', $forum_id)); |
| 142 | -$criteria->add(new \Criteria('forum_id', '(' . implode(', ', $forumHandler->getIdsByPermission('access')) . ')', 'IN')); |
|
| 142 | +$criteria->add(new \Criteria('forum_id', '('.implode(', ', $forumHandler->getIdsByPermission('access')).')', 'IN')); |
|
| 143 | 143 | $criteria->setSort('forum_order'); |
| 144 | 144 | |
| 145 | 145 | if ($forums = $forumHandler->getAll($criteria, null, false)) { |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | |
| 176 | 176 | $forum_selection_sort = '<select name="sort">'; |
| 177 | 177 | foreach ($sel_sort_array as $sort_k => $sort_v) { |
| 178 | - $forum_selection_sort .= '<option value="' . $sort_k . '"' . (($sort == $sort_k) ? ' selected="selected"' : '') . '>' . $sort_v . '</option>'; |
|
| 178 | + $forum_selection_sort .= '<option value="'.$sort_k.'"'.(($sort == $sort_k) ? ' selected="selected"' : '').'>'.$sort_v.'</option>'; |
|
| 179 | 179 | } |
| 180 | 180 | $forum_selection_sort .= '</select>'; |
| 181 | 181 | |
@@ -184,14 +184,14 @@ discard block |
||
| 184 | 184 | $order = (!Request::getString('order', '', 'GET') |
| 185 | 185 | || 'ASC' !== Request::getString('order', '', 'GET')) ? 'DESC' : 'ASC'; |
| 186 | 186 | $forum_selection_order = '<select name="order">'; |
| 187 | -$forum_selection_order .= '<option value="ASC"' . (('ASC' === $order) ? ' selected' : '') . '>' . _MD_NEWBB_ASCENDING . '</option>'; |
|
| 188 | -$forum_selection_order .= '<option value="DESC"' . (('DESC' === $order) ? ' selected' : '') . '>' . _MD_NEWBB_DESCENDING . '</option>'; |
|
| 187 | +$forum_selection_order .= '<option value="ASC"'.(('ASC' === $order) ? ' selected' : '').'>'._MD_NEWBB_ASCENDING.'</option>'; |
|
| 188 | +$forum_selection_order .= '<option value="DESC"'.(('DESC' === $order) ? ' selected' : '').'>'._MD_NEWBB_DESCENDING.'</option>'; |
|
| 189 | 189 | $forum_selection_order .= '</select>'; |
| 190 | 190 | |
| 191 | 191 | $xoopsTpl->assign_by_ref('forum_selection_order', $forum_selection_order); |
| 192 | 192 | |
| 193 | 193 | $since = Request::getInt('since', $GLOBALS['xoopsModuleConfig']['since_default'], 'GET'); |
| 194 | -require_once __DIR__ . '/include/functions.time.php'; |
|
| 194 | +require_once __DIR__.'/include/functions.time.php'; |
|
| 195 | 195 | $forum_selection_since = newbbSinceSelectBox($since); |
| 196 | 196 | $xoopsTpl->assign_by_ref('forum_selection_since', $forum_selection_since); |
| 197 | 197 | |
@@ -200,14 +200,14 @@ discard block |
||
| 200 | 200 | $page_query_sort = implode('&', array_values($query_sort)); |
| 201 | 201 | unset($query_sort); |
| 202 | 202 | // irmtfan - edit: u.uname => t.topic_poster | t.topic_time => t.topic_id | p.post_time => t.topic_last_post_id |
| 203 | -$xoopsTpl->assign('h_topic_link', XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_sort}&sort=t.topic_title&order=" . (('t.topic_title' === $sort && 'DESC' === $order) ? 'ASC' : 'DESC')); |
|
| 204 | -$xoopsTpl->assign('h_reply_link', XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_sort}&sort=t.topic_replies&order=" . (('t.topic_replies' === $sort && 'DESC' === $order) ? 'ASC' : 'DESC')); |
|
| 205 | -$xoopsTpl->assign('h_poster_link', XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_sort}&sort=t.topic_poster&order=" . (('t.topic_poster' === $sort && 'DESC' === $order) ? 'ASC' : 'DESC')); |
|
| 206 | -$xoopsTpl->assign('h_views_link', XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_sort}&sort=t.topic_views&order=" . (('t.topic_views' === $sort && 'DESC' === $order) ? 'ASC' : 'DESC')); |
|
| 207 | -$xoopsTpl->assign('h_rating_link', XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_sort}&sort=t.rating&order=" . (('t.rating' === $sort |
|
| 203 | +$xoopsTpl->assign('h_topic_link', XOOPS_URL."/modules/newbb/viewforum.php?{$page_query_sort}&sort=t.topic_title&order=".(('t.topic_title' === $sort && 'DESC' === $order) ? 'ASC' : 'DESC')); |
|
| 204 | +$xoopsTpl->assign('h_reply_link', XOOPS_URL."/modules/newbb/viewforum.php?{$page_query_sort}&sort=t.topic_replies&order=".(('t.topic_replies' === $sort && 'DESC' === $order) ? 'ASC' : 'DESC')); |
|
| 205 | +$xoopsTpl->assign('h_poster_link', XOOPS_URL."/modules/newbb/viewforum.php?{$page_query_sort}&sort=t.topic_poster&order=".(('t.topic_poster' === $sort && 'DESC' === $order) ? 'ASC' : 'DESC')); |
|
| 206 | +$xoopsTpl->assign('h_views_link', XOOPS_URL."/modules/newbb/viewforum.php?{$page_query_sort}&sort=t.topic_views&order=".(('t.topic_views' === $sort && 'DESC' === $order) ? 'ASC' : 'DESC')); |
|
| 207 | +$xoopsTpl->assign('h_rating_link', XOOPS_URL."/modules/newbb/viewforum.php?{$page_query_sort}&sort=t.rating&order=".(('t.rating' === $sort |
|
| 208 | 208 | && 'DESC' === $order) ? 'ASC' : 'DESC')); // irmtfan t.topic_ratings to t.rating |
| 209 | -$xoopsTpl->assign('h_date_link', XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_sort}&sort=t.topic_last_post_id&order=" . (('t.topic_last_post_id' === $sort && 'DESC' === $order) ? 'ASC' : 'DESC')); |
|
| 210 | -$xoopsTpl->assign('h_publish_link', XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_sort}&sort=t.topic_id&order=" . (('t.topic_id' === $sort |
|
| 209 | +$xoopsTpl->assign('h_date_link', XOOPS_URL."/modules/newbb/viewforum.php?{$page_query_sort}&sort=t.topic_last_post_id&order=".(('t.topic_last_post_id' === $sort && 'DESC' === $order) ? 'ASC' : 'DESC')); |
|
| 210 | +$xoopsTpl->assign('h_publish_link', XOOPS_URL."/modules/newbb/viewforum.php?{$page_query_sort}&sort=t.topic_id&order=".(('t.topic_id' === $sort |
|
| 211 | 211 | && 'DESC' === $order) ? 'ASC' : 'DESC')); |
| 212 | 212 | $xoopsTpl->assign('forum_since', $since); // For $since in search.php |
| 213 | 213 | |
@@ -237,11 +237,11 @@ discard block |
||
| 237 | 237 | $xoopsTpl->assign('img_digest', newbbDisplayImage('topic_digest', _MD_NEWBB_TOPICDIGEST)); |
| 238 | 238 | $xoopsTpl->assign('img_poll', newbbDisplayImage('poll', _MD_NEWBB_TOPICHASPOLL)); |
| 239 | 239 | |
| 240 | -$xoopsTpl->assign('mark_read', XOOPS_URL . "/modules/newbb/viewforum.php?mark=1&{$page_query}"); |
|
| 241 | -$xoopsTpl->assign('mark_unread', XOOPS_URL . "/modules/newbb/viewforum.php?mark=2&{$page_query}"); |
|
| 240 | +$xoopsTpl->assign('mark_read', XOOPS_URL."/modules/newbb/viewforum.php?mark=1&{$page_query}"); |
|
| 241 | +$xoopsTpl->assign('mark_unread', XOOPS_URL."/modules/newbb/viewforum.php?mark=2&{$page_query}"); |
|
| 242 | 242 | |
| 243 | -$xoopsTpl->assign('post_link', XOOPS_URL . '/modules/newbb/viewpost.php?forum=' . $forum_id); |
|
| 244 | -$xoopsTpl->assign('newpost_link', XOOPS_URL . '/modules/newbb/viewpost.php?status=new&forum=' . $forum_id); |
|
| 243 | +$xoopsTpl->assign('post_link', XOOPS_URL.'/modules/newbb/viewpost.php?forum='.$forum_id); |
|
| 244 | +$xoopsTpl->assign('newpost_link', XOOPS_URL.'/modules/newbb/viewpost.php?status=new&forum='.$forum_id); |
|
| 245 | 245 | |
| 246 | 246 | $query_type = $query_array; |
| 247 | 247 | unset($query_type['type']); |
@@ -252,16 +252,16 @@ discard block |
||
| 252 | 252 | $typeOptions = null; |
| 253 | 253 | $types = []; |
| 254 | 254 | if ($types = $typeHandler->getByForum($forum_id)) { |
| 255 | - $typeOptions[] = ['title' => _ALL, 'link' => XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_type}"]; |
|
| 255 | + $typeOptions[] = ['title' => _ALL, 'link' => XOOPS_URL."/modules/newbb/viewforum.php?{$page_query_type}"]; |
|
| 256 | 256 | foreach ($types as $key => $item) { |
| 257 | 257 | $typeOptions[] = [ |
| 258 | 258 | 'title' => $item['type_name'], |
| 259 | - 'link' => XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_type}&type={$key}" |
|
| 259 | + 'link' => XOOPS_URL."/modules/newbb/viewforum.php?{$page_query_type}&type={$key}" |
|
| 260 | 260 | ]; |
| 261 | 261 | } |
| 262 | 262 | } |
| 263 | 263 | if ($type > 0) { |
| 264 | - require_once __DIR__ . '/include/functions.topic.php'; |
|
| 264 | + require_once __DIR__.'/include/functions.topic.php'; |
|
| 265 | 265 | $xoopsTpl->assign('forum_topictype', getTopicTitle('', $types[$type]['type_name'], $types[$type]['type_color'])); |
| 266 | 266 | } |
| 267 | 267 | $xoopsTpl->assign_by_ref('typeOptions', $typeOptions); |
@@ -270,11 +270,11 @@ discard block |
||
| 270 | 270 | unset($query_status['status']); |
| 271 | 271 | $page_query_status = implode('&', array_values($query_status)); |
| 272 | 272 | unset($query_status); |
| 273 | -$xoopsTpl->assign('newpost_link', XOOPS_URL . '/modules/newbb/viewpost.php?status=new&forum=' . $forumObject->getVar('forum_id')); |
|
| 274 | -$xoopsTpl->assign('all_link', XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_status}"); |
|
| 275 | -$xoopsTpl->assign('digest_link', XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_status}&status=digest"); |
|
| 276 | -$xoopsTpl->assign('unreplied_link', XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_status}&status=unreplied"); |
|
| 277 | -$xoopsTpl->assign('unread_link', XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_status}&status=unread"); |
|
| 273 | +$xoopsTpl->assign('newpost_link', XOOPS_URL.'/modules/newbb/viewpost.php?status=new&forum='.$forumObject->getVar('forum_id')); |
|
| 274 | +$xoopsTpl->assign('all_link', XOOPS_URL."/modules/newbb/viewforum.php?{$page_query_status}"); |
|
| 275 | +$xoopsTpl->assign('digest_link', XOOPS_URL."/modules/newbb/viewforum.php?{$page_query_status}&status=digest"); |
|
| 276 | +$xoopsTpl->assign('unreplied_link', XOOPS_URL."/modules/newbb/viewforum.php?{$page_query_status}&status=unreplied"); |
|
| 277 | +$xoopsTpl->assign('unread_link', XOOPS_URL."/modules/newbb/viewforum.php?{$page_query_status}&status=unread"); |
|
| 278 | 278 | switch ($status) { |
| 279 | 279 | case 'digest': |
| 280 | 280 | $current_status = _MD_NEWBB_DIGEST; |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | } |
| 323 | 323 | |
| 324 | 324 | if (!empty($GLOBALS['xoopsModuleConfig']['show_jump'])) { |
| 325 | - require_once __DIR__ . '/include/functions.forum.php'; |
|
| 325 | + require_once __DIR__.'/include/functions.forum.php'; |
|
| 326 | 326 | $xoopsTpl->assign('forum_jumpbox', newbbMakeJumpbox($forum_id)); |
| 327 | 327 | } |
| 328 | 328 | |
@@ -335,8 +335,8 @@ discard block |
||
| 335 | 335 | } |
| 336 | 336 | |
| 337 | 337 | if (1 == $GLOBALS['xoopsModuleConfig']['rss_enable']) { |
| 338 | - $xoopsTpl->assign('rss_button', "<div align='right'><a href='" . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/rss.php?f=' . $forum_id . "' title='RSS feed' target='_blank'>" . newbbDisplayImage('rss', 'RSS feed') . '</a></div>'); |
|
| 338 | + $xoopsTpl->assign('rss_button', "<div align='right'><a href='".XOOPS_URL.'/modules/'.$xoopsModule->dirname().'/rss.php?f='.$forum_id."' title='RSS feed' target='_blank'>".newbbDisplayImage('rss', 'RSS feed').'</a></div>'); |
|
| 339 | 339 | } |
| 340 | 340 | // irmtfan move to footer.php |
| 341 | -require_once __DIR__ . '/footer.php'; |
|
| 341 | +require_once __DIR__.'/footer.php'; |
|
| 342 | 342 | include $GLOBALS['xoops']->path('footer.php'); |
@@ -56,8 +56,8 @@ discard block |
||
| 56 | 56 | global $accessForums; |
| 57 | 57 | global $xoopsLogger; |
| 58 | 58 | |
| 59 | - require_once __DIR__ . '/../include/functions.config.php'; |
|
| 60 | - require_once __DIR__ . '/../include/functions.time.php'; |
|
| 59 | + require_once __DIR__.'/../include/functions.config.php'; |
|
| 60 | + require_once __DIR__.'/../include/functions.time.php'; |
|
| 61 | 61 | |
| 62 | 62 | $myts = \MyTextSanitizer::getInstance(); |
| 63 | 63 | $block = []; |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | $extraCriteria = ''; |
| 67 | 67 | if (!empty($options[2])) { |
| 68 | 68 | //require_once __DIR__ . '/../include/functions.time.php'; |
| 69 | - $extraCriteria .= ' AND p.post_time>' . (time() - newbbGetSinceTime($options[2])); |
|
| 69 | + $extraCriteria .= ' AND p.post_time>'.(time() - newbbGetSinceTime($options[2])); |
|
| 70 | 70 | } |
| 71 | 71 | switch ($options[0]) { |
| 72 | 72 | case 'time': |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | return $block; |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - $forumCriteria = ' AND t.forum_id IN (' . implode(',', $allowedForums) . ')'; |
|
| 95 | + $forumCriteria = ' AND t.forum_id IN ('.implode(',', $allowedForums).')'; |
|
| 96 | 96 | $approveCriteria = ' AND t.approved = 1'; |
| 97 | 97 | |
| 98 | 98 | $newbbConfig = newbbLoadConfig(); |
@@ -148,13 +148,13 @@ discard block |
||
| 148 | 148 | return $block; |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | - require_once __DIR__ . '/../include/functions.user.php'; |
|
| 151 | + require_once __DIR__.'/../include/functions.user.php'; |
|
| 152 | 152 | $author_name = newbbGetUnameFromIds(array_keys($author), $newbbConfig['show_realname'], true); |
| 153 | 153 | |
| 154 | 154 | if (count($types) > 0) { |
| 155 | 155 | /** @var Newbb\TypeHandler $typeHandler */ |
| 156 | 156 | $typeHandler = Newbb\Helper::getInstance()->getHandler('Type'); |
| 157 | - $type_list = $typeHandler->getList(new \Criteria('type_id', '(' . implode(', ', array_keys($types)) . ')', 'IN')); |
|
| 157 | + $type_list = $typeHandler->getList(new \Criteria('type_id', '('.implode(', ', array_keys($types)).')', 'IN')); |
|
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | foreach ($rows as $arr) { |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | xoops_loadLanguage('main', 'newbb'); |
| 163 | 163 | $topic = []; |
| 164 | 164 | $topic_page_jump = newbbDisplayImage('lastposticon', _MD_NEWBB_GOTOLASTPOST); |
| 165 | - $topic['topic_subject'] = empty($type_list[$arr['type_id']]) ? '' : '[' . $type_list[$arr['type_id']] . ']'; |
|
| 165 | + $topic['topic_subject'] = empty($type_list[$arr['type_id']]) ? '' : '['.$type_list[$arr['type_id']].']'; |
|
| 166 | 166 | |
| 167 | 167 | $topic['post_id'] = $arr['post_id']; |
| 168 | 168 | $topic['topic_status'] = $arr['topic_status']; |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | if (!empty($options[5])) { |
| 175 | 175 | $title = xoops_substr($title, 0, $options[5]); |
| 176 | 176 | } |
| 177 | - $topic['title'] = $topic['topic_subject'] . ' ' . $title; |
|
| 177 | + $topic['title'] = $topic['topic_subject'].' '.$title; |
|
| 178 | 178 | $topic['replies'] = $arr['topic_replies']; |
| 179 | 179 | $topic['views'] = $arr['topic_views']; |
| 180 | 180 | $topic['time'] = newbbFormatTimestamp($arr['post_time']); |
@@ -186,9 +186,9 @@ discard block |
||
| 186 | 186 | $topic['topic_poster'] = $topic_poster; |
| 187 | 187 | $topic['topic_page_jump'] = $topic_page_jump; |
| 188 | 188 | // START irmtfan remove hardcoded html in URLs - add $seo_topic_url |
| 189 | - $seo_url = XOOPS_URL . '/' . SEO_MODULE_NAME . '/viewtopic.php?post_id=' . $topic['post_id']; |
|
| 190 | - $seo_topic_url = XOOPS_URL . '/' . SEO_MODULE_NAME . '/viewtopic.php?topic_id=' . $topic['id']; |
|
| 191 | - $seo_forum_url = XOOPS_URL . '/' . SEO_MODULE_NAME . '/viewforum.php?forum=' . $topic['forum_id']; |
|
| 189 | + $seo_url = XOOPS_URL.'/'.SEO_MODULE_NAME.'/viewtopic.php?post_id='.$topic['post_id']; |
|
| 190 | + $seo_topic_url = XOOPS_URL.'/'.SEO_MODULE_NAME.'/viewtopic.php?topic_id='.$topic['id']; |
|
| 191 | + $seo_forum_url = XOOPS_URL.'/'.SEO_MODULE_NAME.'/viewforum.php?forum='.$topic['forum_id']; |
|
| 192 | 192 | if (!empty($newbbConfig['do_rewrite'])) { |
| 193 | 193 | $topic['seo_url'] = seo_urls($seo_url); |
| 194 | 194 | $topic['seo_topic_url'] = seo_urls($seo_topic_url); |
@@ -203,11 +203,11 @@ discard block |
||
| 203 | 203 | unset($topic); |
| 204 | 204 | } |
| 205 | 205 | // START irmtfan remove hardcoded html in URLs |
| 206 | - $seo_top_allforums = XOOPS_URL . '/' . SEO_MODULE_NAME; |
|
| 206 | + $seo_top_allforums = XOOPS_URL.'/'.SEO_MODULE_NAME; |
|
| 207 | 207 | $block['seo_top_allforums'] = !empty($newbbConfig['do_rewrite']) ? seo_urls($seo_top_allforums) : $seo_top_allforums; |
| 208 | - $seo_top_allforums = XOOPS_URL . '/' . SEO_MODULE_NAME . '/list.topic.php'; |
|
| 208 | + $seo_top_allforums = XOOPS_URL.'/'.SEO_MODULE_NAME.'/list.topic.php'; |
|
| 209 | 209 | $block['seo_top_alltopics'] = !empty($newbbConfig['do_rewrite']) ? seo_urls($seo_top_allforums) : $seo_top_allforums; |
| 210 | - $seo_top_allforums = XOOPS_URL . '/' . SEO_MODULE_NAME . '/viewpost.php'; |
|
| 210 | + $seo_top_allforums = XOOPS_URL.'/'.SEO_MODULE_NAME.'/viewpost.php'; |
|
| 211 | 211 | $block['seo_top_allposts'] = !empty($newbbConfig['do_rewrite']) ? seo_urls($seo_top_allforums) : $seo_top_allforums; |
| 212 | 212 | // END irmtfan remove hardcoded html in URLs |
| 213 | 213 | $block['indexNav'] = (int)$options[4]; |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | function b_newbb_topic_show($options) |
| 231 | 231 | { |
| 232 | 232 | global $accessForums; |
| 233 | - require_once __DIR__ . '/../include/functions.time.php'; |
|
| 233 | + require_once __DIR__.'/../include/functions.time.php'; |
|
| 234 | 234 | $myts = \MyTextSanitizer::getInstance(); |
| 235 | 235 | $block = []; |
| 236 | 236 | $i = 0; |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | $time_criteria = null; |
| 240 | 240 | if (!empty($options[2])) { |
| 241 | 241 | $time_criteria = time() - newbbGetSinceTime($options[2]); |
| 242 | - $extraCriteria = ' AND t.topic_time>' . $time_criteria; |
|
| 242 | + $extraCriteria = ' AND t.topic_time>'.$time_criteria; |
|
| 243 | 243 | } |
| 244 | 244 | switch ($options[0]) { |
| 245 | 245 | case 'views': |
@@ -252,11 +252,11 @@ discard block |
||
| 252 | 252 | $order = 't.digest_time'; |
| 253 | 253 | $extraCriteria = ' AND t.topic_digest=1'; |
| 254 | 254 | if (null !== $time_criteria) { |
| 255 | - $extraCriteria .= ' AND t.digest_time>' . $time_criteria; |
|
| 255 | + $extraCriteria .= ' AND t.digest_time>'.$time_criteria; |
|
| 256 | 256 | } |
| 257 | 257 | break; |
| 258 | 258 | case 'sticky': |
| 259 | - $order = 't.topic_id'; |
|
| 259 | + $order = 't.topic_id'; |
|
| 260 | 260 | $extraCriteria .= ' AND t.topic_sticky=1'; |
| 261 | 261 | break; |
| 262 | 262 | case 'time': |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | return false; |
| 293 | 293 | } |
| 294 | 294 | |
| 295 | - $forumCriteria = ' AND t.forum_id IN (' . implode(',', $allowedForums) . ')'; |
|
| 295 | + $forumCriteria = ' AND t.forum_id IN ('.implode(',', $allowedForums).')'; |
|
| 296 | 296 | $approveCriteria = ' AND t.approved = 1'; |
| 297 | 297 | |
| 298 | 298 | $query = 'SELECT' |
@@ -332,19 +332,19 @@ discard block |
||
| 332 | 332 | if (count($rows) < 1) { |
| 333 | 333 | return $block; |
| 334 | 334 | } |
| 335 | - require_once __DIR__ . '/../include/functions.user.php'; |
|
| 335 | + require_once __DIR__.'/../include/functions.user.php'; |
|
| 336 | 336 | $author_name = newbbGetUnameFromIds(array_keys($author), $newbbConfig['show_realname'], true); |
| 337 | 337 | if (count($types) > 0) { |
| 338 | 338 | /** @var Newbb\TypeHandler $typeHandler */ |
| 339 | 339 | $typeHandler = Newbb\Helper::getInstance()->getHandler('Type'); |
| 340 | - $type_list = $typeHandler->getList(new \Criteria('type_id', '(' . implode(', ', array_keys($types)) . ')', 'IN')); |
|
| 340 | + $type_list = $typeHandler->getList(new \Criteria('type_id', '('.implode(', ', array_keys($types)).')', 'IN')); |
|
| 341 | 341 | } |
| 342 | 342 | |
| 343 | 343 | foreach ($rows as $arr) { |
| 344 | 344 | // irmtfan remove $topic_page_jump because there is no last post |
| 345 | 345 | //$topic_page_jump = ''; |
| 346 | 346 | $topic = []; |
| 347 | - $topic['topic_subject'] = empty($type_list[$arr['type_id']]) ? '' : '[' . $type_list[$arr['type_id']] . '] '; |
|
| 347 | + $topic['topic_subject'] = empty($type_list[$arr['type_id']]) ? '' : '['.$type_list[$arr['type_id']].'] '; |
|
| 348 | 348 | $topic['forum_id'] = $arr['forum_id']; |
| 349 | 349 | $topic['forum_name'] = $myts->htmlSpecialChars($arr['forum_name']); |
| 350 | 350 | $topic['id'] = $arr['topic_id']; |
@@ -353,7 +353,7 @@ discard block |
||
| 353 | 353 | if (!empty($options[5])) { |
| 354 | 354 | $title = xoops_substr($title, 0, $options[5]); |
| 355 | 355 | } |
| 356 | - $topic['title'] = $topic['topic_subject'] . $title; |
|
| 356 | + $topic['title'] = $topic['topic_subject'].$title; |
|
| 357 | 357 | $topic['replies'] = $arr['topic_replies']; |
| 358 | 358 | $topic['views'] = $arr['topic_views']; |
| 359 | 359 | $topic['time'] = newbbFormatTimestamp($arr['topic_time']); |
@@ -366,8 +366,8 @@ discard block |
||
| 366 | 366 | // irmtfan remove $topic_page_jump because there is no last post |
| 367 | 367 | //$topic['topic_page_jump'] = $topic_page_jump; |
| 368 | 368 | // START irmtfan remove hardcoded html in URLs - add $seo_topic_url |
| 369 | - $seo_topic_url = XOOPS_URL . '/' . SEO_MODULE_NAME . '/viewtopic.php?topic_id=' . $topic['id']; |
|
| 370 | - $seo_forum_url = XOOPS_URL . '/' . SEO_MODULE_NAME . '/viewforum.php?forum=' . $topic['forum_id']; |
|
| 369 | + $seo_topic_url = XOOPS_URL.'/'.SEO_MODULE_NAME.'/viewtopic.php?topic_id='.$topic['id']; |
|
| 370 | + $seo_forum_url = XOOPS_URL.'/'.SEO_MODULE_NAME.'/viewforum.php?forum='.$topic['forum_id']; |
|
| 371 | 371 | |
| 372 | 372 | if (!empty($newbbConfig['do_rewrite'])) { |
| 373 | 373 | $topic['seo_topic_url'] = seo_urls($seo_topic_url); |
@@ -381,11 +381,11 @@ discard block |
||
| 381 | 381 | unset($topic); |
| 382 | 382 | } |
| 383 | 383 | // START irmtfan remove hardcoded html in URLs |
| 384 | - $seo_top_allforums = XOOPS_URL . '/' . SEO_MODULE_NAME; |
|
| 384 | + $seo_top_allforums = XOOPS_URL.'/'.SEO_MODULE_NAME; |
|
| 385 | 385 | $block['seo_top_allforums'] = !empty($newbbConfig['do_rewrite']) ? seo_urls($seo_top_allforums) : $seo_top_allforums; |
| 386 | - $seo_top_allforums = XOOPS_URL . '/' . SEO_MODULE_NAME . '/list.topic.php'; |
|
| 386 | + $seo_top_allforums = XOOPS_URL.'/'.SEO_MODULE_NAME.'/list.topic.php'; |
|
| 387 | 387 | $block['seo_top_alltopics'] = !empty($newbbConfig['do_rewrite']) ? seo_urls($seo_top_allforums) : $seo_top_allforums; |
| 388 | - $seo_top_allforums = XOOPS_URL . '/' . SEO_MODULE_NAME . '/viewpost.php'; |
|
| 388 | + $seo_top_allforums = XOOPS_URL.'/'.SEO_MODULE_NAME.'/viewpost.php'; |
|
| 389 | 389 | $block['seo_top_allposts'] = !empty($newbbConfig['do_rewrite']) ? seo_urls($seo_top_allforums) : $seo_top_allforums; |
| 390 | 390 | // END irmtfan remove hardcoded html in URLs |
| 391 | 391 | $block['indexNav'] = (int)$options[4]; |
@@ -410,7 +410,7 @@ discard block |
||
| 410 | 410 | global $accessForums; |
| 411 | 411 | global $newbbConfig; |
| 412 | 412 | |
| 413 | - require_once __DIR__ . '/../include/functions.time.php'; |
|
| 413 | + require_once __DIR__.'/../include/functions.time.php'; |
|
| 414 | 414 | $myts = \MyTextSanitizer::getInstance(); |
| 415 | 415 | $block = []; |
| 416 | 416 | $i = 0; |
@@ -419,7 +419,7 @@ discard block |
||
| 419 | 419 | $time_criteria = null; |
| 420 | 420 | if (!empty($options[2])) { |
| 421 | 421 | $time_criteria = time() - newbbGetSinceTime($options[2]); |
| 422 | - $extraCriteria = ' AND p.post_time>' . $time_criteria; |
|
| 422 | + $extraCriteria = ' AND p.post_time>'.$time_criteria; |
|
| 423 | 423 | } |
| 424 | 424 | |
| 425 | 425 | switch ($options[0]) { |
@@ -463,7 +463,7 @@ discard block |
||
| 463 | 463 | return $block; |
| 464 | 464 | } |
| 465 | 465 | |
| 466 | - $forumCriteria = ' AND p.forum_id IN (' . implode(',', $allowedForums) . ')'; |
|
| 466 | + $forumCriteria = ' AND p.forum_id IN ('.implode(',', $allowedForums).')'; |
|
| 467 | 467 | $approveCriteria = ' AND p.approved = 1'; |
| 468 | 468 | |
| 469 | 469 | $query = 'SELECT'; |
@@ -471,11 +471,11 @@ discard block |
||
| 471 | 471 | if ('text' === $options[0]) { |
| 472 | 472 | $query .= ' pt.dohtml, pt.dosmiley, pt.doxcode, pt.dobr, pt.post_text,'; |
| 473 | 473 | } |
| 474 | - $query .= ' f.forum_id, f.forum_name' . ' FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . ' AS p ' . ' LEFT JOIN ' . $GLOBALS['xoopsDB']->prefix('newbb_forums') . ' AS f ON f.forum_id=p.forum_id'; |
|
| 474 | + $query .= ' f.forum_id, f.forum_name'.' FROM '.$GLOBALS['xoopsDB']->prefix('newbb_posts').' AS p '.' LEFT JOIN '.$GLOBALS['xoopsDB']->prefix('newbb_forums').' AS f ON f.forum_id=p.forum_id'; |
|
| 475 | 475 | if ('text' === $options[0]) { |
| 476 | - $query .= ' LEFT JOIN ' . $GLOBALS['xoopsDB']->prefix('newbb_posts_text') . ' AS pt ON pt.post_id=p.post_id'; |
|
| 476 | + $query .= ' LEFT JOIN '.$GLOBALS['xoopsDB']->prefix('newbb_posts_text').' AS pt ON pt.post_id=p.post_id'; |
|
| 477 | 477 | } |
| 478 | - $query .= ' WHERE 1=1 ' . $forumCriteria . $approveCriteria . $extraCriteria . ' ORDER BY ' . $order . ' DESC'; |
|
| 478 | + $query .= ' WHERE 1=1 '.$forumCriteria.$approveCriteria.$extraCriteria.' ORDER BY '.$order.' DESC'; |
|
| 479 | 479 | |
| 480 | 480 | $result = $GLOBALS['xoopsDB']->query($query, $options[1], 0); |
| 481 | 481 | if (!$result) { |
@@ -492,15 +492,15 @@ discard block |
||
| 492 | 492 | if (count($rows) < 1) { |
| 493 | 493 | return $block; |
| 494 | 494 | } |
| 495 | - require_once __DIR__ . '/../include/functions.user.php'; |
|
| 495 | + require_once __DIR__.'/../include/functions.user.php'; |
|
| 496 | 496 | $author_name = newbbGetUnameFromIds(array_keys($author), $newbbConfig['show_realname'], true); |
| 497 | 497 | |
| 498 | 498 | foreach ($rows as $arr) { |
| 499 | 499 | //if ($arr['icon'] && is_file($GLOBALS['xoops']->path('images/subject/' . $arr['icon']))) { |
| 500 | 500 | if (!empty($arr['icon'])) { |
| 501 | - $last_post_icon = '<img src="' . XOOPS_URL . '/images/subject/' . htmlspecialchars($arr['icon'], ENT_QUOTES | ENT_HTML5) . '" alt="" />'; |
|
| 501 | + $last_post_icon = '<img src="'.XOOPS_URL.'/images/subject/'.htmlspecialchars($arr['icon'], ENT_QUOTES | ENT_HTML5).'" alt="" />'; |
|
| 502 | 502 | } else { |
| 503 | - $last_post_icon = '<img src="' . XOOPS_URL . '/images/subject/icon1.gif" alt="" />'; |
|
| 503 | + $last_post_icon = '<img src="'.XOOPS_URL.'/images/subject/icon1.gif" alt="" />'; |
|
| 504 | 504 | } |
| 505 | 505 | //$topic['jump_post'] = "<a href='" . XOOPS_URL . "/modules/newbb/viewtopic.php?post_id=" . $arr['post_id'] ."#forumpost" . $arr['post_id'] . "'>" . $last_post_icon . '</a>'; |
| 506 | 506 | $topic = []; |
@@ -530,8 +530,8 @@ discard block |
||
| 530 | 530 | $topic['post_text'] = $post_text; |
| 531 | 531 | } |
| 532 | 532 | // START irmtfan remove hardcoded html in URLs |
| 533 | - $seo_url = XOOPS_URL . '/' . SEO_MODULE_NAME . '/viewtopic.php?post_id=' . $topic['post_id']; |
|
| 534 | - $seo_forum_url = XOOPS_URL . '/' . SEO_MODULE_NAME . '/viewforum.php?forum=' . $topic['forum_id']; |
|
| 533 | + $seo_url = XOOPS_URL.'/'.SEO_MODULE_NAME.'/viewtopic.php?post_id='.$topic['post_id']; |
|
| 534 | + $seo_forum_url = XOOPS_URL.'/'.SEO_MODULE_NAME.'/viewforum.php?forum='.$topic['forum_id']; |
|
| 535 | 535 | // END irmtfan remove hardcoded html in URLs |
| 536 | 536 | if (!empty($newbbConfig['do_rewrite'])) { |
| 537 | 537 | $topic['seo_url'] = seo_urls($seo_url); |
@@ -545,11 +545,11 @@ discard block |
||
| 545 | 545 | unset($topic); |
| 546 | 546 | } |
| 547 | 547 | // START irmtfan remove hardcoded html in URLs |
| 548 | - $seo_top_allforums = XOOPS_URL . '/' . SEO_MODULE_NAME; |
|
| 548 | + $seo_top_allforums = XOOPS_URL.'/'.SEO_MODULE_NAME; |
|
| 549 | 549 | $block['seo_top_allforums'] = !empty($newbbConfig['do_rewrite']) ? seo_urls($seo_top_allforums) : $seo_top_allforums; |
| 550 | - $seo_top_allforums = XOOPS_URL . '/' . SEO_MODULE_NAME . '/list.topic.php'; |
|
| 550 | + $seo_top_allforums = XOOPS_URL.'/'.SEO_MODULE_NAME.'/list.topic.php'; |
|
| 551 | 551 | $block['seo_top_alltopics'] = !empty($newbbConfig['do_rewrite']) ? seo_urls($seo_top_allforums) : $seo_top_allforums; |
| 552 | - $seo_top_allforums = XOOPS_URL . '/' . SEO_MODULE_NAME . '/viewpost.php'; |
|
| 552 | + $seo_top_allforums = XOOPS_URL.'/'.SEO_MODULE_NAME.'/viewpost.php'; |
|
| 553 | 553 | $block['seo_top_allposts'] = !empty($newbbConfig['do_rewrite']) ? seo_urls($seo_top_allforums) : $seo_top_allforums; |
| 554 | 554 | // END irmtfan remove hardcoded html in URLs |
| 555 | 555 | |
@@ -582,9 +582,9 @@ discard block |
||
| 582 | 582 | $extraCriteria = ''; |
| 583 | 583 | $time_criteria = null; |
| 584 | 584 | if (!empty($options[2])) { |
| 585 | - require_once __DIR__ . '/../include/functions.time.php'; |
|
| 585 | + require_once __DIR__.'/../include/functions.time.php'; |
|
| 586 | 586 | $time_criteria = time() - newbbGetSinceTime($options[2]); |
| 587 | - $extraCriteria = ' AND topic_time > ' . $time_criteria; |
|
| 587 | + $extraCriteria = ' AND topic_time > '.$time_criteria; |
|
| 588 | 588 | } |
| 589 | 589 | switch ($options[0]) { |
| 590 | 590 | case 'topic': |
@@ -592,7 +592,7 @@ discard block |
||
| 592 | 592 | case 'digest': |
| 593 | 593 | $extraCriteria = ' AND topic_digest = 1'; |
| 594 | 594 | if (null !== $time_criteria) { |
| 595 | - $extraCriteria .= ' AND digest_time > ' . $time_criteria; |
|
| 595 | + $extraCriteria .= ' AND digest_time > '.$time_criteria; |
|
| 596 | 596 | } |
| 597 | 597 | break; |
| 598 | 598 | case 'sticky': |
@@ -602,7 +602,7 @@ discard block |
||
| 602 | 602 | default: |
| 603 | 603 | $type = 'post'; |
| 604 | 604 | if (null !== $time_criteria) { |
| 605 | - $extraCriteria = ' AND post_time > ' . $time_criteria; |
|
| 605 | + $extraCriteria = ' AND post_time > '.$time_criteria; |
|
| 606 | 606 | } |
| 607 | 607 | break; |
| 608 | 608 | } |
@@ -626,17 +626,17 @@ discard block |
||
| 626 | 626 | } |
| 627 | 627 | |
| 628 | 628 | if ('topic' === $type) { |
| 629 | - $forumCriteria = ' AND forum_id IN (' . implode(',', $allowedForums) . ')'; |
|
| 629 | + $forumCriteria = ' AND forum_id IN ('.implode(',', $allowedForums).')'; |
|
| 630 | 630 | $approveCriteria = ' AND approved = 1'; |
| 631 | 631 | $query = 'SELECT DISTINCT topic_poster AS author, COUNT(*) AS count |
| 632 | - FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . ' |
|
| 633 | - WHERE topic_poster>0 ' . $forumCriteria . $approveCriteria . $extraCriteria . ' GROUP BY topic_poster ORDER BY ' . $order . ' DESC'; |
|
| 632 | + FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics').' |
|
| 633 | + WHERE topic_poster>0 ' . $forumCriteria.$approveCriteria.$extraCriteria.' GROUP BY topic_poster ORDER BY '.$order.' DESC'; |
|
| 634 | 634 | } else { |
| 635 | - $forumCriteria = ' AND forum_id IN (' . implode(',', $allowedForums) . ')'; |
|
| 635 | + $forumCriteria = ' AND forum_id IN ('.implode(',', $allowedForums).')'; |
|
| 636 | 636 | $approveCriteria = ' AND approved = 1'; |
| 637 | 637 | $query = 'SELECT DISTINCT uid AS author, COUNT(*) AS count |
| 638 | - FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . ' |
|
| 639 | - WHERE uid > 0 ' . $forumCriteria . $approveCriteria . $extraCriteria . ' GROUP BY uid ORDER BY ' . $order . ' DESC'; |
|
| 638 | + FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_posts').' |
|
| 639 | + WHERE uid > 0 ' . $forumCriteria.$approveCriteria.$extraCriteria.' GROUP BY uid ORDER BY '.$order.' DESC'; |
|
| 640 | 640 | } |
| 641 | 641 | |
| 642 | 642 | $result = $GLOBALS['xoopsDB']->query($query, $options[1], 0); |
@@ -651,12 +651,12 @@ discard block |
||
| 651 | 651 | if (count($author) < 1) { |
| 652 | 652 | return $block; |
| 653 | 653 | } |
| 654 | - require_once __DIR__ . '/../include/functions.user.php'; |
|
| 654 | + require_once __DIR__.'/../include/functions.user.php'; |
|
| 655 | 655 | $author_name = newbbGetUnameFromIds(array_keys($author), $newbbConfig['show_realname']); |
| 656 | 656 | foreach (array_keys($author) as $uid) { |
| 657 | 657 | $author[$uid]['name'] = $myts->htmlSpecialChars($author_name[$uid]); |
| 658 | 658 | } |
| 659 | - $block['authors'] =& $author; |
|
| 659 | + $block['authors'] = & $author; |
|
| 660 | 660 | $block['disp_mode'] = $options[3]; // 0 - full view; 1 - lite view; |
| 661 | 661 | $block['indexNav'] = (int)$options[4]; |
| 662 | 662 | |
@@ -669,45 +669,45 @@ discard block |
||
| 669 | 669 | */ |
| 670 | 670 | function b_newbb_edit($options) |
| 671 | 671 | { |
| 672 | - require_once __DIR__ . '/../include/functions.forum.php'; |
|
| 672 | + require_once __DIR__.'/../include/functions.forum.php'; |
|
| 673 | 673 | |
| 674 | - $form = _MB_NEWBB_CRITERIA . "<select name='options[0]'>"; |
|
| 674 | + $form = _MB_NEWBB_CRITERIA."<select name='options[0]'>"; |
|
| 675 | 675 | $form .= "<option value='time'"; |
| 676 | 676 | if ('time' === $options[0]) { |
| 677 | 677 | $form .= " selected='selected' "; |
| 678 | 678 | } |
| 679 | - $form .= '>' . _MB_NEWBB_CRITERIA_TIME . '</option>'; |
|
| 679 | + $form .= '>'._MB_NEWBB_CRITERIA_TIME.'</option>'; |
|
| 680 | 680 | $form .= '</select>'; |
| 681 | - $form .= '<br>' . _MB_NEWBB_DISPLAY . "<input type='text' name='options[1]' value='" . $options[1] . "' />"; |
|
| 682 | - $form .= '<br>' . _MB_NEWBB_TIME . "<input type='text' name='options[2]' value='" . $options[2] . "' />"; |
|
| 683 | - $form .= '<br> <small>' . _MB_NEWBB_TIME_DESC . '</small>'; |
|
| 684 | - $form .= '<br>' . _MB_NEWBB_DISPLAYMODE . "<input type='radio' name='options[3]' value='0'"; |
|
| 681 | + $form .= '<br>'._MB_NEWBB_DISPLAY."<input type='text' name='options[1]' value='".$options[1]."' />"; |
|
| 682 | + $form .= '<br>'._MB_NEWBB_TIME."<input type='text' name='options[2]' value='".$options[2]."' />"; |
|
| 683 | + $form .= '<br> <small>'._MB_NEWBB_TIME_DESC.'</small>'; |
|
| 684 | + $form .= '<br>'._MB_NEWBB_DISPLAYMODE."<input type='radio' name='options[3]' value='0'"; |
|
| 685 | 685 | if (0 == $options[3]) { |
| 686 | 686 | $form .= ' checked'; |
| 687 | 687 | } |
| 688 | - $form .= ' /> ' . _MB_NEWBB_DISPLAYMODE_FULL . "<input type='radio' name='options[3]' value='1'"; |
|
| 688 | + $form .= ' /> '._MB_NEWBB_DISPLAYMODE_FULL."<input type='radio' name='options[3]' value='1'"; |
|
| 689 | 689 | if (1 == $options[3]) { |
| 690 | 690 | $form .= ' checked'; |
| 691 | 691 | } |
| 692 | - $form .= ' /> ' . _MB_NEWBB_DISPLAYMODE_COMPACT . "<input type='radio' name='options[3]' value='2'"; |
|
| 692 | + $form .= ' /> '._MB_NEWBB_DISPLAYMODE_COMPACT."<input type='radio' name='options[3]' value='2'"; |
|
| 693 | 693 | if (2 == $options[3]) { |
| 694 | 694 | $form .= ' checked'; |
| 695 | 695 | } |
| 696 | - $form .= ' /> ' . _MB_NEWBB_DISPLAYMODE_LITE; |
|
| 696 | + $form .= ' /> '._MB_NEWBB_DISPLAYMODE_LITE; |
|
| 697 | 697 | |
| 698 | - $form .= '<br>' . _MB_NEWBB_INDEXNAV . '<input type="radio" name="options[4]" value="1"'; |
|
| 698 | + $form .= '<br>'._MB_NEWBB_INDEXNAV.'<input type="radio" name="options[4]" value="1"'; |
|
| 699 | 699 | if (1 == $options[4]) { |
| 700 | 700 | $form .= ' checked'; |
| 701 | 701 | } |
| 702 | - $form .= ' />' . _YES . '<input type="radio" name="options[4]" value="0"'; |
|
| 702 | + $form .= ' />'._YES.'<input type="radio" name="options[4]" value="0"'; |
|
| 703 | 703 | if (0 == $options[4]) { |
| 704 | 704 | $form .= ' checked'; |
| 705 | 705 | } |
| 706 | - $form .= ' />' . _NO; |
|
| 706 | + $form .= ' />'._NO; |
|
| 707 | 707 | |
| 708 | - $form .= '<br>' . _MB_NEWBB_TITLE_LENGTH . "<input type='text' name='options[5]' value='" . $options[5] . "' />"; |
|
| 708 | + $form .= '<br>'._MB_NEWBB_TITLE_LENGTH."<input type='text' name='options[5]' value='".$options[5]."' />"; |
|
| 709 | 709 | |
| 710 | - $form .= '<br><br>' . _MB_NEWBB_FORUMLIST; |
|
| 710 | + $form .= '<br><br>'._MB_NEWBB_FORUMLIST; |
|
| 711 | 711 | |
| 712 | 712 | $optionsForum = array_filter(array_slice($options, 6), 'b_newbb_array_filter'); // get allowed forums |
| 713 | 713 | $isAll = (0 === count($optionsForum) || empty($optionsForum[0])); |
@@ -716,7 +716,7 @@ discard block |
||
| 716 | 716 | if ($isAll) { |
| 717 | 717 | $form .= ' selected'; |
| 718 | 718 | } |
| 719 | - $form .= '>' . _ALL . '</option>'; |
|
| 719 | + $form .= '>'._ALL.'</option>'; |
|
| 720 | 720 | $form .= newbbForumSelectBox($optionsForum); |
| 721 | 721 | $form .= '</select><br>'; |
| 722 | 722 | |
@@ -729,64 +729,64 @@ discard block |
||
| 729 | 729 | */ |
| 730 | 730 | function b_newbb_topic_edit($options) |
| 731 | 731 | { |
| 732 | - require_once __DIR__ . '/../include/functions.forum.php'; |
|
| 733 | - $form = _MB_NEWBB_CRITERIA . "<select name='options[0]'>"; |
|
| 732 | + require_once __DIR__.'/../include/functions.forum.php'; |
|
| 733 | + $form = _MB_NEWBB_CRITERIA."<select name='options[0]'>"; |
|
| 734 | 734 | $form .= "<option value='time'"; |
| 735 | 735 | if ('time' === $options[0]) { |
| 736 | 736 | $form .= " selected='selected' "; |
| 737 | 737 | } |
| 738 | - $form .= '>' . _MB_NEWBB_CRITERIA_TIME . '</option>'; |
|
| 738 | + $form .= '>'._MB_NEWBB_CRITERIA_TIME.'</option>'; |
|
| 739 | 739 | $form .= "<option value='views'"; |
| 740 | 740 | if ('views' === $options[0]) { |
| 741 | 741 | $form .= " selected='selected' "; |
| 742 | 742 | } |
| 743 | - $form .= '>' . _MB_NEWBB_CRITERIA_VIEWS . '</option>'; |
|
| 743 | + $form .= '>'._MB_NEWBB_CRITERIA_VIEWS.'</option>'; |
|
| 744 | 744 | $form .= "<option value='replies'"; |
| 745 | 745 | if ('replies' === $options[0]) { |
| 746 | 746 | $form .= " selected='selected' "; |
| 747 | 747 | } |
| 748 | - $form .= '>' . _MB_NEWBB_CRITERIA_REPLIES . '</option>'; |
|
| 748 | + $form .= '>'._MB_NEWBB_CRITERIA_REPLIES.'</option>'; |
|
| 749 | 749 | $form .= "<option value='digest'"; |
| 750 | 750 | if ('digest' === $options[0]) { |
| 751 | 751 | $form .= " selected='selected' "; |
| 752 | 752 | } |
| 753 | - $form .= '>' . _MB_NEWBB_CRITERIA_DIGEST . '</option>'; |
|
| 753 | + $form .= '>'._MB_NEWBB_CRITERIA_DIGEST.'</option>'; |
|
| 754 | 754 | $form .= "<option value='sticky'"; |
| 755 | 755 | if ('sticky' === $options[0]) { |
| 756 | 756 | $form .= " selected='selected' "; |
| 757 | 757 | } |
| 758 | - $form .= '>' . _MB_NEWBB_CRITERIA_STICKY . '</option>'; |
|
| 758 | + $form .= '>'._MB_NEWBB_CRITERIA_STICKY.'</option>'; |
|
| 759 | 759 | $form .= '</select>'; |
| 760 | - $form .= '<br>' . _MB_NEWBB_DISPLAY . "<input type='text' name='options[1]' value='" . $options[1] . "' />"; |
|
| 761 | - $form .= '<br>' . _MB_NEWBB_TIME . "<input type='text' name='options[2]' value='" . $options[2] . "' />"; |
|
| 762 | - $form .= '<br> <small>' . _MB_NEWBB_TIME_DESC . '</small>'; |
|
| 763 | - $form .= '<br>' . _MB_NEWBB_DISPLAYMODE . "<input type='radio' name='options[3]' value='0'"; |
|
| 760 | + $form .= '<br>'._MB_NEWBB_DISPLAY."<input type='text' name='options[1]' value='".$options[1]."' />"; |
|
| 761 | + $form .= '<br>'._MB_NEWBB_TIME."<input type='text' name='options[2]' value='".$options[2]."' />"; |
|
| 762 | + $form .= '<br> <small>'._MB_NEWBB_TIME_DESC.'</small>'; |
|
| 763 | + $form .= '<br>'._MB_NEWBB_DISPLAYMODE."<input type='radio' name='options[3]' value='0'"; |
|
| 764 | 764 | if (0 == $options[3]) { |
| 765 | 765 | $form .= ' checked'; |
| 766 | 766 | } |
| 767 | - $form .= ' /> ' . _MB_NEWBB_DISPLAYMODE_FULL . "<input type='radio' name='options[3]' value='1'"; |
|
| 767 | + $form .= ' /> '._MB_NEWBB_DISPLAYMODE_FULL."<input type='radio' name='options[3]' value='1'"; |
|
| 768 | 768 | if (1 == $options[3]) { |
| 769 | 769 | $form .= ' checked'; |
| 770 | 770 | } |
| 771 | - $form .= ' /> ' . _MB_NEWBB_DISPLAYMODE_COMPACT . "<input type='radio' name='options[3]' value='2'"; |
|
| 771 | + $form .= ' /> '._MB_NEWBB_DISPLAYMODE_COMPACT."<input type='radio' name='options[3]' value='2'"; |
|
| 772 | 772 | if (2 == $options[3]) { |
| 773 | 773 | $form .= ' checked'; |
| 774 | 774 | } |
| 775 | - $form .= ' /> ' . _MB_NEWBB_DISPLAYMODE_LITE; |
|
| 775 | + $form .= ' /> '._MB_NEWBB_DISPLAYMODE_LITE; |
|
| 776 | 776 | |
| 777 | - $form .= '<br>' . _MB_NEWBB_INDEXNAV . '<input type="radio" name="options[4]" value="1"'; |
|
| 777 | + $form .= '<br>'._MB_NEWBB_INDEXNAV.'<input type="radio" name="options[4]" value="1"'; |
|
| 778 | 778 | if (1 == $options[4]) { |
| 779 | 779 | $form .= ' checked'; |
| 780 | 780 | } |
| 781 | - $form .= ' />' . _YES . '<input type="radio" name="options[4]" value="0"'; |
|
| 781 | + $form .= ' />'._YES.'<input type="radio" name="options[4]" value="0"'; |
|
| 782 | 782 | if (0 == $options[4]) { |
| 783 | 783 | $form .= ' checked'; |
| 784 | 784 | } |
| 785 | - $form .= ' />' . _NO; |
|
| 785 | + $form .= ' />'._NO; |
|
| 786 | 786 | |
| 787 | - $form .= '<br>' . _MB_NEWBB_TITLE_LENGTH . "<input type='text' name='options[5]' value='" . $options[5] . "' />"; |
|
| 787 | + $form .= '<br>'._MB_NEWBB_TITLE_LENGTH."<input type='text' name='options[5]' value='".$options[5]."' />"; |
|
| 788 | 788 | |
| 789 | - $form .= '<br><br>' . _MB_NEWBB_FORUMLIST; |
|
| 789 | + $form .= '<br><br>'._MB_NEWBB_FORUMLIST; |
|
| 790 | 790 | |
| 791 | 791 | $optionsForum = array_filter(array_slice($options, 6), 'b_newbb_array_filter'); // get allowed forums |
| 792 | 792 | |
@@ -796,7 +796,7 @@ discard block |
||
| 796 | 796 | if ($isAll) { |
| 797 | 797 | $form .= ' selected="selected"'; |
| 798 | 798 | } |
| 799 | - $form .= '>' . _ALL . '</option>'; |
|
| 799 | + $form .= '>'._ALL.'</option>'; |
|
| 800 | 800 | $form .= newbbForumSelectBox($optionsForum); |
| 801 | 801 | $form .= '</select><br>'; |
| 802 | 802 | |
@@ -809,49 +809,49 @@ discard block |
||
| 809 | 809 | */ |
| 810 | 810 | function b_newbb_post_edit($options) |
| 811 | 811 | { |
| 812 | - require_once __DIR__ . '/../include/functions.forum.php'; |
|
| 813 | - $form = _MB_NEWBB_CRITERIA . "<select name='options[0]'>"; |
|
| 812 | + require_once __DIR__.'/../include/functions.forum.php'; |
|
| 813 | + $form = _MB_NEWBB_CRITERIA."<select name='options[0]'>"; |
|
| 814 | 814 | $form .= "<option value='title'"; |
| 815 | 815 | if ('title' === $options[0]) { |
| 816 | 816 | $form .= " selected='selected' "; |
| 817 | 817 | } |
| 818 | - $form .= '>' . _MB_NEWBB_CRITERIA_TITLE . '</option>'; |
|
| 818 | + $form .= '>'._MB_NEWBB_CRITERIA_TITLE.'</option>'; |
|
| 819 | 819 | $form .= "<option value='text'"; |
| 820 | 820 | if ('text' === $options[0]) { |
| 821 | 821 | $form .= " selected='selected' "; |
| 822 | 822 | } |
| 823 | - $form .= '>' . _MB_NEWBB_CRITERIA_TEXT . '</option>'; |
|
| 823 | + $form .= '>'._MB_NEWBB_CRITERIA_TEXT.'</option>'; |
|
| 824 | 824 | $form .= '</select>'; |
| 825 | - $form .= '<br>' . _MB_NEWBB_DISPLAY . "<input type='text' name='options[1]' value='" . $options[1] . "' />"; |
|
| 826 | - $form .= '<br>' . _MB_NEWBB_TIME . "<input type='text' name='options[2]' value='" . $options[2] . "' />"; |
|
| 827 | - $form .= '<br> <small>' . _MB_NEWBB_TIME_DESC . '</small>'; |
|
| 828 | - $form .= '<br>' . _MB_NEWBB_DISPLAYMODE . "<input type='radio' name='options[3]' value='0'"; |
|
| 825 | + $form .= '<br>'._MB_NEWBB_DISPLAY."<input type='text' name='options[1]' value='".$options[1]."' />"; |
|
| 826 | + $form .= '<br>'._MB_NEWBB_TIME."<input type='text' name='options[2]' value='".$options[2]."' />"; |
|
| 827 | + $form .= '<br> <small>'._MB_NEWBB_TIME_DESC.'</small>'; |
|
| 828 | + $form .= '<br>'._MB_NEWBB_DISPLAYMODE."<input type='radio' name='options[3]' value='0'"; |
|
| 829 | 829 | if (0 == $options[3]) { |
| 830 | 830 | $form .= ' checked'; |
| 831 | 831 | } |
| 832 | - $form .= ' /> ' . _MB_NEWBB_DISPLAYMODE_FULL . "<input type='radio' name='options[3]' value='1'"; |
|
| 832 | + $form .= ' /> '._MB_NEWBB_DISPLAYMODE_FULL."<input type='radio' name='options[3]' value='1'"; |
|
| 833 | 833 | if (1 == $options[3]) { |
| 834 | 834 | $form .= ' checked'; |
| 835 | 835 | } |
| 836 | - $form .= ' /> ' . _MB_NEWBB_DISPLAYMODE_COMPACT . "<input type='radio' name='options[3]' value='2'"; |
|
| 836 | + $form .= ' /> '._MB_NEWBB_DISPLAYMODE_COMPACT."<input type='radio' name='options[3]' value='2'"; |
|
| 837 | 837 | if (2 == $options[3]) { |
| 838 | 838 | $form .= ' checked'; |
| 839 | 839 | } |
| 840 | - $form .= ' /> ' . _MB_NEWBB_DISPLAYMODE_LITE; |
|
| 840 | + $form .= ' /> '._MB_NEWBB_DISPLAYMODE_LITE; |
|
| 841 | 841 | |
| 842 | - $form .= '<br>' . _MB_NEWBB_INDEXNAV . '<input type="radio" name="options[4]" value="1"'; |
|
| 842 | + $form .= '<br>'._MB_NEWBB_INDEXNAV.'<input type="radio" name="options[4]" value="1"'; |
|
| 843 | 843 | if (1 == $options[4]) { |
| 844 | 844 | $form .= ' checked'; |
| 845 | 845 | } |
| 846 | - $form .= ' />' . _YES . '<input type="radio" name="options[4]" value="0"'; |
|
| 846 | + $form .= ' />'._YES.'<input type="radio" name="options[4]" value="0"'; |
|
| 847 | 847 | if (0 == $options[4]) { |
| 848 | 848 | $form .= ' checked'; |
| 849 | 849 | } |
| 850 | - $form .= ' />' . _NO; |
|
| 850 | + $form .= ' />'._NO; |
|
| 851 | 851 | |
| 852 | - $form .= '<br>' . _MB_NEWBB_TITLE_LENGTH . "<input type='text' name='options[5]' value='" . $options[5] . "' />"; |
|
| 852 | + $form .= '<br>'._MB_NEWBB_TITLE_LENGTH."<input type='text' name='options[5]' value='".$options[5]."' />"; |
|
| 853 | 853 | |
| 854 | - $form .= '<br><br>' . _MB_NEWBB_FORUMLIST; |
|
| 854 | + $form .= '<br><br>'._MB_NEWBB_FORUMLIST; |
|
| 855 | 855 | |
| 856 | 856 | $optionsForum = array_filter(array_slice($options, 6), 'b_newbb_array_filter'); // get allowed forums |
| 857 | 857 | $isAll = (0 === count($optionsForum) || empty($optionsForum[0])); |
@@ -860,7 +860,7 @@ discard block |
||
| 860 | 860 | if ($isAll) { |
| 861 | 861 | $form .= ' selected="selected"'; |
| 862 | 862 | } |
| 863 | - $form .= '>' . _ALL . '</option>'; |
|
| 863 | + $form .= '>'._ALL.'</option>'; |
|
| 864 | 864 | $form .= newbbForumSelectBox($optionsForum); |
| 865 | 865 | $form .= '</select><br>'; |
| 866 | 866 | |
@@ -873,53 +873,53 @@ discard block |
||
| 873 | 873 | */ |
| 874 | 874 | function b_newbb_author_edit($options) |
| 875 | 875 | { |
| 876 | - require_once __DIR__ . '/../include/functions.forum.php'; |
|
| 877 | - $form = _MB_NEWBB_CRITERIA . "<select name='options[0]'>"; |
|
| 876 | + require_once __DIR__.'/../include/functions.forum.php'; |
|
| 877 | + $form = _MB_NEWBB_CRITERIA."<select name='options[0]'>"; |
|
| 878 | 878 | $form .= "<option value='post'"; |
| 879 | 879 | if ('post' === $options[0]) { |
| 880 | 880 | $form .= " selected='selected' "; |
| 881 | 881 | } |
| 882 | - $form .= '>' . _MB_NEWBB_CRITERIA_POST . '</option>'; |
|
| 882 | + $form .= '>'._MB_NEWBB_CRITERIA_POST.'</option>'; |
|
| 883 | 883 | $form .= "<option value='topic'"; |
| 884 | 884 | if ('topic' === $options[0]) { |
| 885 | 885 | $form .= " selected='selected' "; |
| 886 | 886 | } |
| 887 | - $form .= '>' . _MB_NEWBB_CRITERIA_TOPIC . '</option>'; |
|
| 887 | + $form .= '>'._MB_NEWBB_CRITERIA_TOPIC.'</option>'; |
|
| 888 | 888 | $form .= "<option value='digest'"; |
| 889 | 889 | if ('digest' === $options[0]) { |
| 890 | 890 | $form .= " selected='selected' "; |
| 891 | 891 | } |
| 892 | - $form .= '>' . _MB_NEWBB_CRITERIA_DIGESTS . '</option>'; |
|
| 892 | + $form .= '>'._MB_NEWBB_CRITERIA_DIGESTS.'</option>'; |
|
| 893 | 893 | $form .= "<option value='sticky'"; |
| 894 | 894 | if ('sticky' === $options[0]) { |
| 895 | 895 | $form .= " selected='selected' "; |
| 896 | 896 | } |
| 897 | - $form .= '>' . _MB_NEWBB_CRITERIA_STICKYS . '</option>'; |
|
| 897 | + $form .= '>'._MB_NEWBB_CRITERIA_STICKYS.'</option>'; |
|
| 898 | 898 | $form .= '</select>'; |
| 899 | - $form .= '<br>' . _MB_NEWBB_DISPLAY . "<input type='text' name='options[1]' value='" . $options[1] . "' />"; |
|
| 900 | - $form .= '<br>' . _MB_NEWBB_TIME . "<input type='text' name='options[2]' value='" . $options[2] . "' />"; |
|
| 901 | - $form .= '<br> <small>' . _MB_NEWBB_TIME_DESC . '</small>'; |
|
| 902 | - $form .= '<br>' . _MB_NEWBB_DISPLAYMODE . "<input type='radio' name='options[3]' value='0'"; |
|
| 899 | + $form .= '<br>'._MB_NEWBB_DISPLAY."<input type='text' name='options[1]' value='".$options[1]."' />"; |
|
| 900 | + $form .= '<br>'._MB_NEWBB_TIME."<input type='text' name='options[2]' value='".$options[2]."' />"; |
|
| 901 | + $form .= '<br> <small>'._MB_NEWBB_TIME_DESC.'</small>'; |
|
| 902 | + $form .= '<br>'._MB_NEWBB_DISPLAYMODE."<input type='radio' name='options[3]' value='0'"; |
|
| 903 | 903 | if (0 == $options[3]) { |
| 904 | 904 | $form .= ' checked'; |
| 905 | 905 | } |
| 906 | - $form .= ' /> ' . _MB_NEWBB_DISPLAYMODE_COMPACT . "<input type='radio' name='options[3]' value='1'"; |
|
| 906 | + $form .= ' /> '._MB_NEWBB_DISPLAYMODE_COMPACT."<input type='radio' name='options[3]' value='1'"; |
|
| 907 | 907 | if (1 == $options[3]) { |
| 908 | 908 | $form .= ' checked'; |
| 909 | 909 | } |
| 910 | - $form .= ' /> ' . _MB_NEWBB_DISPLAYMODE_LITE; |
|
| 910 | + $form .= ' /> '._MB_NEWBB_DISPLAYMODE_LITE; |
|
| 911 | 911 | |
| 912 | - $form .= '<br>' . _MB_NEWBB_INDEXNAV . '<input type="radio" name="options[4]" value="1"'; |
|
| 912 | + $form .= '<br>'._MB_NEWBB_INDEXNAV.'<input type="radio" name="options[4]" value="1"'; |
|
| 913 | 913 | if (1 == $options[4]) { |
| 914 | 914 | $form .= ' checked'; |
| 915 | 915 | } |
| 916 | - $form .= ' />' . _YES . '<input type="radio" name="options[4]" value="0"'; |
|
| 916 | + $form .= ' />'._YES.'<input type="radio" name="options[4]" value="0"'; |
|
| 917 | 917 | if (0 == $options[4]) { |
| 918 | 918 | $form .= ' checked'; |
| 919 | 919 | } |
| 920 | - $form .= ' />' . _NO; |
|
| 920 | + $form .= ' />'._NO; |
|
| 921 | 921 | |
| 922 | - $form .= '<br><br>' . _MB_NEWBB_FORUMLIST; |
|
| 922 | + $form .= '<br><br>'._MB_NEWBB_FORUMLIST; |
|
| 923 | 923 | |
| 924 | 924 | $optionsForum = array_filter(array_slice($options, 5), 'b_newbb_array_filter'); // get allowed forums |
| 925 | 925 | $isAll = (0 === count($optionsForum) || empty($optionsForum[0])); |
@@ -928,7 +928,7 @@ discard block |
||
| 928 | 928 | if ($isAll) { |
| 929 | 929 | $form .= ' selected="selected"'; |
| 930 | 930 | } |
| 931 | - $form .= '>' . _ALL . '</option>'; |
|
| 931 | + $form .= '>'._ALL.'</option>'; |
|
| 932 | 932 | $form .= newbbForumSelectBox($optionsForum); |
| 933 | 933 | $form .= '</select><br>'; |
| 934 | 934 | |
@@ -942,8 +942,8 @@ discard block |
||
| 942 | 942 | function b_newbb_custom($options) |
| 943 | 943 | { |
| 944 | 944 | // if no newbb module block set, we have to include the language file |
| 945 | - if (is_readable($GLOBALS['xoops']->path('modules/newbb/language/' . $GLOBALS['xoopsConfig']['language'] . '/blocks.php'))) { |
|
| 946 | - require_once $GLOBALS['xoops']->path('modules/newbb/language/' . $GLOBALS['xoopsConfig']['language'] . '/blocks.php'); |
|
| 945 | + if (is_readable($GLOBALS['xoops']->path('modules/newbb/language/'.$GLOBALS['xoopsConfig']['language'].'/blocks.php'))) { |
|
| 946 | + require_once $GLOBALS['xoops']->path('modules/newbb/language/'.$GLOBALS['xoopsConfig']['language'].'/blocks.php'); |
|
| 947 | 947 | } else { |
| 948 | 948 | require_once $GLOBALS['xoops']->path('modules/newbb/language/english/blocks.php'); |
| 949 | 949 | } |
@@ -967,8 +967,8 @@ discard block |
||
| 967 | 967 | { |
| 968 | 968 | |
| 969 | 969 | // if no newbb module block set, we have to include the language file |
| 970 | - if (is_readable($GLOBALS['xoops']->path('modules/newbb/language/' . $GLOBALS['xoopsConfig']['language'] . '/blocks.php'))) { |
|
| 971 | - require_once $GLOBALS['xoops']->path('modules/newbb/language/' . $GLOBALS['xoopsConfig']['language'] . '/blocks.php'); |
|
| 970 | + if (is_readable($GLOBALS['xoops']->path('modules/newbb/language/'.$GLOBALS['xoopsConfig']['language'].'/blocks.php'))) { |
|
| 971 | + require_once $GLOBALS['xoops']->path('modules/newbb/language/'.$GLOBALS['xoopsConfig']['language'].'/blocks.php'); |
|
| 972 | 972 | } else { |
| 973 | 973 | require_once $GLOBALS['xoops']->path('modules/newbb/language/english/blocks.php'); |
| 974 | 974 | } |
@@ -992,8 +992,8 @@ discard block |
||
| 992 | 992 | { |
| 993 | 993 | |
| 994 | 994 | // if no newbb module block set, we have to include the language file |
| 995 | - if (is_readable($GLOBALS['xoops']->path('modules/newbb/language/' . $GLOBALS['xoopsConfig']['language'] . '/blocks.php'))) { |
|
| 996 | - require_once $GLOBALS['xoops']->path('modules/newbb/language/' . $GLOBALS['xoopsConfig']['language'] . '/blocks.php'); |
|
| 995 | + if (is_readable($GLOBALS['xoops']->path('modules/newbb/language/'.$GLOBALS['xoopsConfig']['language'].'/blocks.php'))) { |
|
| 996 | + require_once $GLOBALS['xoops']->path('modules/newbb/language/'.$GLOBALS['xoopsConfig']['language'].'/blocks.php'); |
|
| 997 | 997 | } else { |
| 998 | 998 | require_once $GLOBALS['xoops']->path('modules/newbb/language/english/blocks.php'); |
| 999 | 999 | } |
@@ -1016,8 +1016,8 @@ discard block |
||
| 1016 | 1016 | function b_newbb_custom_author($options) |
| 1017 | 1017 | { |
| 1018 | 1018 | // if no newbb module block set, we have to include the language file |
| 1019 | - if (is_readable($GLOBALS['xoops']->path('modules/newbb/language/' . $GLOBALS['xoopsConfig']['language'] . '/blocks.php'))) { |
|
| 1020 | - require_once $GLOBALS['xoops']->path('modules/newbb/language/' . $GLOBALS['xoopsConfig']['language'] . '/blocks.php'); |
|
| 1019 | + if (is_readable($GLOBALS['xoops']->path('modules/newbb/language/'.$GLOBALS['xoopsConfig']['language'].'/blocks.php'))) { |
|
| 1020 | + require_once $GLOBALS['xoops']->path('modules/newbb/language/'.$GLOBALS['xoopsConfig']['language'].'/blocks.php'); |
|
| 1021 | 1021 | } else { |
| 1022 | 1022 | require_once $GLOBALS['xoops']->path('modules/newbb/language/english/blocks.php'); |
| 1023 | 1023 | } |
@@ -21,15 +21,15 @@ discard block |
||
| 21 | 21 | |
| 22 | 22 | //require_once dirname(__DIR__) . '/include/functions.ini.php'; |
| 23 | 23 | //require_once dirname(__DIR__) . '/class/TopicRenderer.php'; |
| 24 | -require_once dirname(__DIR__) . '/footer.php'; // to include js/style files like validate function |
|
| 24 | +require_once dirname(__DIR__).'/footer.php'; // to include js/style files like validate function |
|
| 25 | 25 | |
| 26 | 26 | xoops_loadLanguage('main', 'newbb'); |
| 27 | 27 | |
| 28 | -require_once __DIR__ . '/../include/functions.config.php'; |
|
| 29 | -require_once __DIR__ . '/../include/functions.time.php'; |
|
| 30 | -require_once __DIR__ . '/../include/functions.session.php'; |
|
| 31 | -require_once __DIR__ . '/../include/functions.render.php'; |
|
| 32 | -require_once __DIR__ . '/../include/functions.user.php'; |
|
| 28 | +require_once __DIR__.'/../include/functions.config.php'; |
|
| 29 | +require_once __DIR__.'/../include/functions.time.php'; |
|
| 30 | +require_once __DIR__.'/../include/functions.session.php'; |
|
| 31 | +require_once __DIR__.'/../include/functions.render.php'; |
|
| 32 | +require_once __DIR__.'/../include/functions.user.php'; |
|
| 33 | 33 | |
| 34 | 34 | // options[0] - Status in WHERE claus: all(by default), sticky, digest,lock, poll, voted, viewed, replied, read, (UN_) , active, pending, deleted (admin) (It is multi-select) |
| 35 | 35 | // options[1] - Uid in WHERE claus: uid of the topic poster : -1 - all users (by default) |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | $topicRenderer->force = true; // force against static vars for parse |
| 60 | 60 | |
| 61 | 61 | $topicRenderer->is_multiple = true; // is it for multiple forums |
| 62 | - $topicRenderer->config =& $newbbConfig; // get all configs |
|
| 62 | + $topicRenderer->config = & $newbbConfig; // get all configs |
|
| 63 | 63 | if (!empty($options[6])) { |
| 64 | 64 | $topicRenderer->config['topics_per_page'] = (int)$options[6]; // number of topics (items) to display |
| 65 | 65 | } |
@@ -121,16 +121,16 @@ discard block |
||
| 121 | 121 | $topicPosterRadioEle->addOption(-1, _MD_NEWBB_TOTALUSER); |
| 122 | 122 | $topicPosterRadioEle->addOption((-1 !== $options[1]) ? $options[1] : 0, _SELECT); // if no user in selection box it select uid=0 anon users |
| 123 | 123 | $topicPosterRadioEle->setExtra("onchange=\"var el=document.getElementById('options[1]'); el.disabled=(this.id == 'options[1]1'); if (!el.value) {el.value= this.value}\""); // if user dont select any option it select "all" |
| 124 | - $topicPosterSelectEle = new \XoopsFormSelectUser(_MB_NEWBB_AUTHOR, 'options[1]', true, explode(',', $options[1]), 5, true);// show $limit = 200 users when no user is selected; |
|
| 125 | - $topicPosterEle = new \XoopsFormLabel(_MB_NEWBB_AUTHOR, $topicPosterRadioEle->render() . $topicPosterSelectEle->render()); |
|
| 124 | + $topicPosterSelectEle = new \XoopsFormSelectUser(_MB_NEWBB_AUTHOR, 'options[1]', true, explode(',', $options[1]), 5, true); // show $limit = 200 users when no user is selected; |
|
| 125 | + $topicPosterEle = new \XoopsFormLabel(_MB_NEWBB_AUTHOR, $topicPosterRadioEle->render().$topicPosterSelectEle->render()); |
|
| 126 | 126 | |
| 127 | 127 | // lastposter element |
| 128 | 128 | $lastPosterRadioEle = new \XoopsFormRadio(_MD_NEWBB_POSTER, 'options[2]', $options[2]); |
| 129 | 129 | $lastPosterRadioEle->addOption(-1, _MD_NEWBB_TOTALUSER); |
| 130 | 130 | $lastPosterRadioEle->addOption((-1 !== $options[2]) ? $options[2] : 0, _SELECT); // if no user in selection box it select uid=1 |
| 131 | 131 | $lastPosterRadioEle->setExtra("onchange=\"var el=document.getElementById('options[2]'); el.disabled=(this.id == 'options[2]1'); if (!el.value) {el.value= this.value}\""); // if user dont select any option it select "all" |
| 132 | - $lastPosterSelectEle = new \XoopsFormSelectUser(_MD_NEWBB_POSTER, 'options[2]', true, explode(',', $options[2]), 5, true);// show $limit = 200 users when no user is selected; |
|
| 133 | - $lastPosterEle = new \XoopsFormLabel(_MD_NEWBB_POSTER, $lastPosterRadioEle->render() . $lastPosterSelectEle->render()); |
|
| 132 | + $lastPosterSelectEle = new \XoopsFormSelectUser(_MD_NEWBB_POSTER, 'options[2]', true, explode(',', $options[2]), 5, true); // show $limit = 200 users when no user is selected; |
|
| 133 | + $lastPosterEle = new \XoopsFormLabel(_MD_NEWBB_POSTER, $lastPosterRadioEle->render().$lastPosterSelectEle->render()); |
|
| 134 | 134 | |
| 135 | 135 | // type element |
| 136 | 136 | $types = $topicRenderer->getTypes(); // get all available types in all forums |
@@ -180,20 +180,20 @@ discard block |
||
| 180 | 180 | |
| 181 | 181 | // forum element |
| 182 | 182 | $optionsForum = explode(',', $options[12]); |
| 183 | - require_once __DIR__ . '/../include/functions.forum.php'; |
|
| 183 | + require_once __DIR__.'/../include/functions.forum.php'; |
|
| 184 | 184 | /** @var Newbb\ForumHandler $forumHandler */ |
| 185 | 185 | $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); |
| 186 | 186 | //get forum Ids by values. parse positive values to forum IDs and negative values to category IDs. value=0 => all valid forums |
| 187 | 187 | // Get accessible forums |
| 188 | 188 | $accessForums = $forumHandler->getIdsByValues(array_map('intval', $optionsForum)); |
| 189 | 189 | $isAll = (0 === count($optionsForum) || empty($optionsForum[0])); |
| 190 | - $forumSel = "<select name=\"options[12][]\" multiple=\"multiple\" onchange = \"validate('options[12][]','select', true)\">";// if user dont select any it select "0" |
|
| 191 | - $forumSel .= '<option value="0" '; |
|
| 190 | + $forumSel = "<select name=\"options[12][]\" multiple=\"multiple\" onchange = \"validate('options[12][]','select', true)\">"; // if user dont select any it select "0" |
|
| 191 | + $forumSel .= '<option value="0" '; |
|
| 192 | 192 | if ($isAll) { |
| 193 | - $forumSel .= ' selected'; |
|
| 193 | + $forumSel .= ' selected'; |
|
| 194 | 194 | $accessForums = null; // just select _ALL option |
| 195 | 195 | } |
| 196 | - $forumSel .= '>' . _ALL . '</option>'; |
|
| 196 | + $forumSel .= '>'._ALL.'</option>'; |
|
| 197 | 197 | $forumSel .= newbbForumSelectBox($accessForums, 'access', false); //$accessForums, $permission = "access", $delimitorCategory = false |
| 198 | 198 | $forumSel .= '</select>'; |
| 199 | 199 | $forumEle = new \XoopsFormLabel(_MB_NEWBB_FORUMLIST, $forumSel); |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | use Xmf\Request; |
| 33 | 33 | use XoopsModules\Newbb; |
| 34 | 34 | |
| 35 | -require_once __DIR__ . '/header.php'; |
|
| 35 | +require_once __DIR__.'/header.php'; |
|
| 36 | 36 | |
| 37 | 37 | $forum = Request::getInt('forum', 0, 'GET'); |
| 38 | 38 | $topic_id = Request::getInt('topic_id', 0, 'GET'); |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | $forumObject = $forumHandler->get($forum); |
| 67 | 67 | if (!$forumHandler->getPermission($forumObject)) { |
| 68 | - redirect_header(XOOPS_URL . '/index.php', 2, _MD_NEWBB_NORIGHTTOACCESS); |
|
| 68 | + redirect_header(XOOPS_URL.'/index.php', 2, _MD_NEWBB_NORIGHTTOACCESS); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | $topicObject = $topicHandler->get($topic_id); |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | $query_array = []; |
| 79 | 79 | foreach ($query_vars as $var) { |
| 80 | 80 | if (Request::getString($var, '', 'GET')) { |
| 81 | - $query_array[$var] = "{$var}=" . Request::getString($var, '', 'GET'); |
|
| 81 | + $query_array[$var] = "{$var}=".Request::getString($var, '', 'GET'); |
|
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | $page_query = htmlspecialchars(implode('&', array_values($query_array)), ENT_QUOTES | ENT_HTML5); |
@@ -133,8 +133,8 @@ discard block |
||
| 133 | 133 | $r_subject = $postParentObject->getVar('subject', 'E'); |
| 134 | 134 | |
| 135 | 135 | $subject = $r_subject; |
| 136 | -if (!preg_match('/^(Re|' . _MD_NEWBB_RE . '):/i', $r_subject)) { |
|
| 137 | - $subject = _MD_NEWBB_RE . ': ' . $r_subject; |
|
| 136 | +if (!preg_match('/^(Re|'._MD_NEWBB_RE.'):/i', $r_subject)) { |
|
| 137 | + $subject = _MD_NEWBB_RE.': '.$r_subject; |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | $q_message = $postParentObject->getVar('post_text', 'e'); |
@@ -143,12 +143,12 @@ discard block |
||
| 143 | 143 | if (1 === Request::getInt('quotedac', 0, 'GET')) { |
| 144 | 144 | $message = "[quote]\n"; |
| 145 | 145 | $message .= sprintf(_MD_NEWBB_USERWROTE, $r_name); |
| 146 | - $message .= "\n" . $q_message . '[/quote]'; |
|
| 146 | + $message .= "\n".$q_message.'[/quote]'; |
|
| 147 | 147 | $hidden = ''; |
| 148 | 148 | } else { |
| 149 | 149 | $hidden = "[quote]\n"; |
| 150 | 150 | $hidden .= sprintf(_MD_NEWBB_USERWROTE, $r_name); |
| 151 | - $hidden .= "\n" . $q_message . '[/quote]'; |
|
| 151 | + $hidden .= "\n".$q_message.'[/quote]'; |
|
| 152 | 152 | $message = ''; |
| 153 | 153 | } |
| 154 | 154 | } else { |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | $post_karma = 0; |
| 168 | 168 | $require_reply = 0; |
| 169 | 169 | |
| 170 | -include __DIR__ . '/include/form.post.php'; |
|
| 170 | +include __DIR__.'/include/form.post.php'; |
|
| 171 | 171 | |
| 172 | 172 | ///** @var Newbb\KarmaHandler $karmaHandler */ |
| 173 | 173 | //$karmaHandler = Newbb\Helper::getInstance()->getHandler('Karma'); |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | foreach ($posts_contextObject as $post_contextObject) { |
| 181 | 181 | // Sorry, in order to save queries, we have to hide the non-open post_text even if you have replied or have adequate karma, even an admin. |
| 182 | 182 | if ($GLOBALS['xoopsModuleConfig']['enable_karma'] && $post_contextObject->getVar('post_karma') > 0) { |
| 183 | - $p_message = sprintf(_MD_NEWBB_KARMA_REQUIREMENT, '***', $post_contextObject->getVar('post_karma')) . '</div>'; |
|
| 183 | + $p_message = sprintf(_MD_NEWBB_KARMA_REQUIREMENT, '***', $post_contextObject->getVar('post_karma')).'</div>'; |
|
| 184 | 184 | } elseif ($GLOBALS['xoopsModuleConfig']['allow_require_reply'] && $post_contextObject->getVar('require_reply')) { |
| 185 | 185 | $p_message = _MD_NEWBB_REPLY_REQUIREMENT; |
| 186 | 186 | } else { |
@@ -198,11 +198,11 @@ discard block |
||
| 198 | 198 | |
| 199 | 199 | $posts_context[] = [ |
| 200 | 200 | 'subject' => $p_subject, |
| 201 | - 'meta' => _MD_NEWBB_BY . ' ' . $p_name . ' ' . _MD_NEWBB_ON . ' ' . $p_date, |
|
| 201 | + 'meta' => _MD_NEWBB_BY.' '.$p_name.' '._MD_NEWBB_ON.' '.$p_date, |
|
| 202 | 202 | 'content' => $p_message |
| 203 | 203 | ]; |
| 204 | 204 | } |
| 205 | 205 | $xoopsTpl->assign_by_ref('posts_context', $posts_context); |
| 206 | 206 | // irmtfan move to footer.php |
| 207 | -require_once __DIR__ . '/footer.php'; |
|
| 207 | +require_once __DIR__.'/footer.php'; |
|
| 208 | 208 | include $GLOBALS['xoops']->path('footer.php'); |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | use Xmf\Request; |
| 13 | 13 | use XoopsModules\Newbb; |
| 14 | 14 | |
| 15 | -require_once __DIR__ . '/header.php'; |
|
| 15 | +require_once __DIR__.'/header.php'; |
|
| 16 | 16 | |
| 17 | 17 | //$xoopsOption['xoops_module_header']= $xoops_module_header; |
| 18 | 18 | $GLOBALS['xoopsOption']['template_main'] = 'newbb_viewall.tpl'; |
@@ -21,13 +21,13 @@ discard block |
||
| 21 | 21 | // irmtfan new method |
| 22 | 22 | if (!empty($GLOBALS['xoopsModuleConfig']['rss_enable'])) { |
| 23 | 23 | $xoopsTpl->assign('xoops_module_header', ' |
| 24 | - <link rel="alternate" type="application/xml+rss" title="' . $xoopsModule->getVar('name') . '" href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/rss.php" /> |
|
| 24 | + <link rel="alternate" type="application/xml+rss" title="' . $xoopsModule->getVar('name').'" href="'.XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname', 'n').'/rss.php" /> |
|
| 25 | 25 | ' . @$xoopsTpl->get_template_vars('xoops_module_header')); |
| 26 | 26 | } |
| 27 | 27 | //$xoopsTpl->assign('xoops_module_header', $xoops_module_header); |
| 28 | 28 | |
| 29 | -require_once __DIR__ . '/include/functions.time.php'; |
|
| 30 | -require_once __DIR__ . '/include/functions.render.php'; |
|
| 29 | +require_once __DIR__.'/include/functions.time.php'; |
|
| 30 | +require_once __DIR__.'/include/functions.render.php'; |
|
| 31 | 31 | |
| 32 | 32 | // irmtfan use require_once because it will redeclared in newbb/blocks/list_topic.php |
| 33 | 33 | //require_once __DIR__ . '/./class/TopicRenderer.php'; |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | $xoopsTpl->assign('newpost_link', 'viewpost.php?status=new'); |
| 88 | 88 | |
| 89 | 89 | if (!empty($GLOBALS['xoopsModuleConfig']['show_jump'])) { |
| 90 | - require_once __DIR__ . '/include/functions.forum.php'; |
|
| 90 | + require_once __DIR__.'/include/functions.forum.php'; |
|
| 91 | 91 | $xoopsTpl->assign('forum_jumpbox', newbbMakeJumpbox()); |
| 92 | 92 | } |
| 93 | 93 | $xoopsTpl->assign('menumode', $menumode); |
@@ -95,12 +95,12 @@ discard block |
||
| 95 | 95 | |
| 96 | 96 | $xoopsTpl->assign('mode', $mode); |
| 97 | 97 | $xoopsTpl->assign('status', $status); |
| 98 | -$xoopsTpl->assign('viewer_level', $topic_renderer->userlevel);// irmtfan use userlevel |
|
| 98 | +$xoopsTpl->assign('viewer_level', $topic_renderer->userlevel); // irmtfan use userlevel |
|
| 99 | 99 | |
| 100 | 100 | $pagetitle = sprintf(_MD_NEWBB_FORUMINDEX, htmlspecialchars($GLOBALS['xoopsConfig']['sitename'], ENT_QUOTES)); |
| 101 | 101 | $xoopsTpl->assign('forum_index_title', $pagetitle); |
| 102 | 102 | $xoopsTpl->assign('xoops_pagetitle', $pagetitle); |
| 103 | 103 | |
| 104 | 104 | // irmtfan move to footer.php |
| 105 | -require_once __DIR__ . '/footer.php'; |
|
| 105 | +require_once __DIR__.'/footer.php'; |
|
| 106 | 106 | include $GLOBALS['xoops']->path('footer.php'); |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | use Xmf\Request; |
| 13 | 13 | use XoopsModules\Newbb; |
| 14 | 14 | |
| 15 | -require_once __DIR__ . '/header.php'; |
|
| 15 | +require_once __DIR__.'/header.php'; |
|
| 16 | 16 | |
| 17 | 17 | foreach (['forum', 'topic_id', 'post_id', 'order'] as $getint) { |
| 18 | 18 | ${$getint} = Request::getInt($getint, 0, 'GET'); |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | $query_array = []; |
| 65 | 65 | foreach ($query_vars as $var) { |
| 66 | 66 | if (Request::getString($var, '', 'GET')) { |
| 67 | - $query_array[$var] = "{$var}=" . Request::getString($var, '', 'GET'); |
|
| 67 | + $query_array[$var] = "{$var}=".Request::getString($var, '', 'GET'); |
|
| 68 | 68 | } |
| 69 | 69 | } |
| 70 | 70 | $page_query = htmlspecialchars(implode('&', array_values($query_array)), ENT_QUOTES | ENT_HTML5); |
@@ -115,8 +115,8 @@ discard block |
||
| 115 | 115 | $post_karma = $postObject->getVar('post_karma'); |
| 116 | 116 | $require_reply = $postObject->getVar('require_reply'); |
| 117 | 117 | |
| 118 | -$xoopsTpl->assign('error_message', _MD_NEWBB_EDITEDBY . ' ' . $GLOBALS['xoopsUser']->uname()); |
|
| 119 | -include __DIR__ . '/include/form.post.php'; |
|
| 118 | +$xoopsTpl->assign('error_message', _MD_NEWBB_EDITEDBY.' '.$GLOBALS['xoopsUser']->uname()); |
|
| 119 | +include __DIR__.'/include/form.post.php'; |
|
| 120 | 120 | |
| 121 | 121 | ///** @var Newbb\KarmaHandler $karmaHandler */ |
| 122 | 122 | //$karmaHandler = Newbb\Helper::getInstance()->getHandler('Karma'); |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | $posts_contextObject = $istopic ? [] : [$postHandler->get($postObject->getVar('pid'))]; |
| 127 | 127 | foreach ($posts_contextObject as $post_contextObject) { |
| 128 | 128 | if ($GLOBALS['xoopsModuleConfig']['enable_karma'] && $post_contextObject->getVar('post_karma') > 0) { |
| 129 | - $p_message = sprintf(_MD_NEWBB_KARMA_REQUIREMENT, '***', $post_contextObject->getVar('post_karma')) . '</div>'; |
|
| 129 | + $p_message = sprintf(_MD_NEWBB_KARMA_REQUIREMENT, '***', $post_contextObject->getVar('post_karma')).'</div>'; |
|
| 130 | 130 | } elseif ($GLOBALS['xoopsModuleConfig']['allow_require_reply'] && $post_contextObject->getVar('require_reply')) { |
| 131 | 131 | $p_message = _MD_NEWBB_REPLY_REQUIREMENT; |
| 132 | 132 | } else { |
@@ -144,11 +144,11 @@ discard block |
||
| 144 | 144 | |
| 145 | 145 | $posts_context[] = [ |
| 146 | 146 | 'subject' => $p_subject, |
| 147 | - 'meta' => _MD_NEWBB_BY . ' ' . $p_name . ' ' . _MD_NEWBB_ON . ' ' . $p_date, |
|
| 147 | + 'meta' => _MD_NEWBB_BY.' '.$p_name.' '._MD_NEWBB_ON.' '.$p_date, |
|
| 148 | 148 | 'content' => $p_message |
| 149 | 149 | ]; |
| 150 | 150 | } |
| 151 | 151 | $xoopsTpl->assign_by_ref('posts_context', $posts_context); |
| 152 | 152 | // irmtfan move to footer.php |
| 153 | -require_once __DIR__ . '/footer.php'; |
|
| 153 | +require_once __DIR__.'/footer.php'; |
|
| 154 | 154 | include $GLOBALS['xoops']->path('footer.php'); |
@@ -34,22 +34,22 @@ discard block |
||
| 34 | 34 | // Project: Article Project // |
| 35 | 35 | // ------------------------------------------------------------------------ // |
| 36 | 36 | |
| 37 | -require_once __DIR__ . '/header.php'; |
|
| 37 | +require_once __DIR__.'/header.php'; |
|
| 38 | 38 | xoops_loadLanguage('search'); |
| 39 | 39 | /** @var \XoopsConfigHandler $configHandler */ |
| 40 | 40 | $configHandler = xoops_getHandler('config'); |
| 41 | 41 | $xoopsConfigSearch = $configHandler->getConfigsByCat(XOOPS_CONF_SEARCH); |
| 42 | 42 | if (1 !== $xoopsConfigSearch['enable_search']) { |
| 43 | - redirect_header(XOOPS_URL . '/modules/newbb/index.php', 2, _MD_NEWBB_SEARCHDISABLED); |
|
| 43 | + redirect_header(XOOPS_URL.'/modules/newbb/index.php', 2, _MD_NEWBB_SEARCHDISABLED); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | $GLOBALS['xoopsConfig']['module_cache'][$xoopsModule->getVar('mid')] = 0; |
| 47 | 47 | $xoopsOption['template_main'] = 'newbb_search.tpl'; |
| 48 | 48 | require_once $GLOBALS['xoops']->path('header.php'); |
| 49 | 49 | |
| 50 | -require_once __DIR__ . '/include/functions.render.php'; |
|
| 51 | -require_once __DIR__ . '/include/functions.forum.php'; |
|
| 52 | -require_once __DIR__ . '/include/functions.time.php'; |
|
| 50 | +require_once __DIR__.'/include/functions.render.php'; |
|
| 51 | +require_once __DIR__.'/include/functions.forum.php'; |
|
| 52 | +require_once __DIR__.'/include/functions.time.php'; |
|
| 53 | 53 | |
| 54 | 54 | require_once $GLOBALS['xoops']->path('modules/newbb/include/search.inc.php'); |
| 55 | 55 | $limit = $GLOBALS['xoopsModuleConfig']['topics_per_page']; |
@@ -118,8 +118,8 @@ discard block |
||
| 118 | 118 | if (!empty($search_username)) { |
| 119 | 119 | $uname_required = true; |
| 120 | 120 | $search_username = $GLOBALS['xoopsDB']->escape($search_username); |
| 121 | - if (!$result = $GLOBALS['xoopsDB']->query('SELECT uid FROM ' . $GLOBALS['xoopsDB']->prefix('users') . " WHERE uname LIKE '%$search_username%'")) { |
|
| 122 | - redirect_header(XOOPS_URL . '/search.php', 1, _MD_NEWBB_ERROROCCURED); |
|
| 121 | + if (!$result = $GLOBALS['xoopsDB']->query('SELECT uid FROM '.$GLOBALS['xoopsDB']->prefix('users')." WHERE uname LIKE '%$search_username%'")) { |
|
| 122 | + redirect_header(XOOPS_URL.'/search.php', 1, _MD_NEWBB_ERROROCCURED); |
|
| 123 | 123 | } |
| 124 | 124 | $uid = []; |
| 125 | 125 | while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) { |
@@ -144,12 +144,12 @@ discard block |
||
| 144 | 144 | } |
| 145 | 145 | } |
| 146 | 146 | if (!$uname_required && 0 === count($queries)) { |
| 147 | - redirect_header(XOOPS_URL . '/search.php', 2, sprintf(_SR_KEYTOOSHORT, $xoopsConfigSearch['keyword_min'])); |
|
| 147 | + redirect_header(XOOPS_URL.'/search.php', 2, sprintf(_SR_KEYTOOSHORT, $xoopsConfigSearch['keyword_min'])); |
|
| 148 | 148 | } |
| 149 | 149 | } else { |
| 150 | 150 | //$query = trim($query); |
| 151 | 151 | if (!$uname_required && (strlen($query) < $xoopsConfigSearch['keyword_min'])) { |
| 152 | - redirect_header(XOOPS_URL . '/search.php', 2, sprintf(_SR_KEYTOOSHORT, $xoopsConfigSearch['keyword_min'])); |
|
| 152 | + redirect_header(XOOPS_URL.'/search.php', 2, sprintf(_SR_KEYTOOSHORT, $xoopsConfigSearch['keyword_min'])); |
|
| 153 | 153 | } |
| 154 | 154 | $queries = [$query]; |
| 155 | 155 | } |
@@ -212,14 +212,14 @@ discard block |
||
| 212 | 212 | if (count($next_search) > 0) { |
| 213 | 213 | $items = []; |
| 214 | 214 | foreach ($next_search as $para => $val) { |
| 215 | - $items[] = "{$para}=" . urlencode($val); |
|
| 215 | + $items[] = "{$para}=".urlencode($val); |
|
| 216 | 216 | } |
| 217 | 217 | if (count($items) > 0) { |
| 218 | 218 | $paras = implode('&', $items); |
| 219 | 219 | } |
| 220 | 220 | unset($next_search, $items); |
| 221 | 221 | } |
| 222 | - $search_url = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/search.php?' . $paras; |
|
| 222 | + $search_url = XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname').'/search.php?'.$paras; |
|
| 223 | 223 | // irmtfan remove to have just one query and appropriate next and prev links |
| 224 | 224 | //$next_results = newbb_search($queries, $andor, 1, $start + $limit, $uid, $forum, $sortby, $searchin, $subquery); |
| 225 | 225 | //$next_count = count($next_results); |
@@ -231,15 +231,15 @@ discard block |
||
| 231 | 231 | if ($num_results == $limit) { |
| 232 | 232 | $next = $start + $limit; |
| 233 | 233 | $queries = implode(',', $queries); |
| 234 | - $search_url_next = htmlspecialchars($search_url . "&direction=next&start={$next}", ENT_QUOTES | ENT_HTML5); |
|
| 235 | - $search_next = '<a href="' . $search_url_next . '">' . _SR_NEXT . '</a>'; |
|
| 234 | + $search_url_next = htmlspecialchars($search_url."&direction=next&start={$next}", ENT_QUOTES | ENT_HTML5); |
|
| 235 | + $search_next = '<a href="'.$search_url_next.'">'._SR_NEXT.'</a>'; |
|
| 236 | 236 | $xoopsTpl->assign('search_next', $search_next); |
| 237 | 237 | $xoopsTpl->assign('search_next_url', $search_url_next); |
| 238 | 238 | } |
| 239 | 239 | if ($start > 0) { |
| 240 | 240 | $prev = $start - $limit; |
| 241 | - $search_url_prev = htmlspecialchars($search_url . "&direction=previous&start={$prev}", ENT_QUOTES | ENT_HTML5); |
|
| 242 | - $search_prev = '<a href="' . $search_url_prev . '">' . _SR_PREVIOUS . '</a>'; |
|
| 241 | + $search_url_prev = htmlspecialchars($search_url."&direction=previous&start={$prev}", ENT_QUOTES | ENT_HTML5); |
|
| 242 | + $search_prev = '<a href="'.$search_url_prev.'">'._SR_PREVIOUS.'</a>'; |
|
| 243 | 243 | $xoopsTpl->assign('search_prev', $search_prev); |
| 244 | 244 | $xoopsTpl->assign('search_prev_url', $search_url_prev); |
| 245 | 245 | } |
@@ -250,18 +250,18 @@ discard block |
||
| 250 | 250 | redirect_header($search_url_redirect, 1, constant(strtoupper("_SR_{$direction}"))); |
| 251 | 251 | } |
| 252 | 252 | } |
| 253 | - $search_info = _SR_KEYWORDS . ': ' . $search_info_keywords; |
|
| 253 | + $search_info = _SR_KEYWORDS.': '.$search_info_keywords; |
|
| 254 | 254 | if ($uname_required) { |
| 255 | 255 | if ($search_info) { |
| 256 | 256 | $search_info .= '<br>'; |
| 257 | 257 | } |
| 258 | - $search_info .= _MD_NEWBB_USERNAME . ': ' . $myts->htmlSpecialChars($search_username); |
|
| 258 | + $search_info .= _MD_NEWBB_USERNAME.': '.$myts->htmlSpecialChars($search_username); |
|
| 259 | 259 | } |
| 260 | 260 | // add num_results |
| 261 | - $search_info .= '<br>' . sprintf(_SR_SHOWING, $start + 1, $start + $num_results); |
|
| 261 | + $search_info .= '<br>'.sprintf(_SR_SHOWING, $start + 1, $start + $num_results); |
|
| 262 | 262 | // if any result skip show the counter |
| 263 | 263 | if (!empty($skipresults)) { |
| 264 | - $search_info .= ' - ' . sprintf(_SR_FOUND, $num_results - $skipresults); |
|
| 264 | + $search_info .= ' - '.sprintf(_SR_FOUND, $num_results - $skipresults); |
|
| 265 | 265 | } |
| 266 | 266 | $xoopsTpl->assign('search_info', $search_info); |
| 267 | 267 | } |
@@ -275,18 +275,18 @@ discard block |
||
| 275 | 275 | if ('OR' === $andor) { |
| 276 | 276 | $andor_select .= ' selected="selected"'; |
| 277 | 277 | } |
| 278 | -$andor_select .= '>' . _SR_ANY . '</option>'; |
|
| 278 | +$andor_select .= '>'._SR_ANY.'</option>'; |
|
| 279 | 279 | $andor_select .= '<option value="AND"'; |
| 280 | 280 | if ('AND' === $andor || empty($andor)) { |
| 281 | 281 | $andor_select .= ' selected="selected"'; |
| 282 | 282 | } |
| 283 | -$andor_select .= '>' . _SR_ALL . '</option>'; |
|
| 283 | +$andor_select .= '>'._SR_ALL.'</option>'; |
|
| 284 | 284 | $andor_select .= '</select>'; |
| 285 | 285 | $xoopsTpl->assign('andor_selection_box', $andor_select); |
| 286 | 286 | |
| 287 | 287 | /* forum */ |
| 288 | 288 | $select_forum = '<select class="form-control" name="forum[]" id="forum" size="5" multiple="multiple">'; |
| 289 | -$select_forum .= '<option value="all">' . _MD_NEWBB_SEARCHALLFORUMS . '</option>'; |
|
| 289 | +$select_forum .= '<option value="all">'._MD_NEWBB_SEARCHALLFORUMS.'</option>'; |
|
| 290 | 290 | $select_forum .= newbbForumSelectBox($forum); |
| 291 | 291 | $select_forum .= '</select>'; |
| 292 | 292 | $xoopsTpl->assign_by_ref('forum_selection_box', $select_forum); |
@@ -297,17 +297,17 @@ discard block |
||
| 297 | 297 | if ('title' === $searchin) { |
| 298 | 298 | $searchin_select .= ' checked'; |
| 299 | 299 | } |
| 300 | -$searchin_select .= ' />' . _MD_NEWBB_SUBJECT . ' </label>'; |
|
| 300 | +$searchin_select .= ' />'._MD_NEWBB_SUBJECT.' </label>'; |
|
| 301 | 301 | $searchin_select .= '<label class="radio-inline"><input type="radio" name="searchin" value="text"'; |
| 302 | 302 | if ('text' === $searchin) { |
| 303 | 303 | $searchin_select .= ' checked'; |
| 304 | 304 | } |
| 305 | -$searchin_select .= ' />' . _MD_NEWBB_BODY . ' </label>'; |
|
| 305 | +$searchin_select .= ' />'._MD_NEWBB_BODY.' </label>'; |
|
| 306 | 306 | $searchin_select .= '<label class="radio-inline"><input type="radio" name="searchin" value="both"'; |
| 307 | 307 | if ('both' === $searchin || empty($searchin)) { |
| 308 | 308 | $searchin_select .= ' checked'; |
| 309 | 309 | } |
| 310 | -$searchin_select .= ' />' . _MD_NEWBB_SUBJECT . ' & ' . _MD_NEWBB_BODY . ' </label>'; |
|
| 310 | +$searchin_select .= ' />'._MD_NEWBB_SUBJECT.' & '._MD_NEWBB_BODY.' </label>'; |
|
| 311 | 311 | $xoopsTpl->assign('searchin_radio', $searchin_select); |
| 312 | 312 | |
| 313 | 313 | /* show_search */ |
@@ -316,12 +316,12 @@ discard block |
||
| 316 | 316 | if ('post' === $show_search) { |
| 317 | 317 | $show_search_select .= ' checked'; |
| 318 | 318 | } |
| 319 | -$show_search_select .= ' />' . _MD_NEWBB_POSTS . ' </label>'; |
|
| 319 | +$show_search_select .= ' />'._MD_NEWBB_POSTS.' </label>'; |
|
| 320 | 320 | $show_search_select .= '<label class="radio-inline"><input type="radio" name="show_search" value="post_text"'; |
| 321 | 321 | if ('post_text' === $show_search || empty($show_search)) { |
| 322 | 322 | $show_search_select .= ' checked'; |
| 323 | 323 | } |
| 324 | -$show_search_select .= ' />' . _MD_NEWBB_SEARCHPOSTTEXT . ' </label>'; |
|
| 324 | +$show_search_select .= ' />'._MD_NEWBB_SEARCHPOSTTEXT.' </label>'; |
|
| 325 | 325 | $xoopsTpl->assign('show_search_radio', $show_search_select); |
| 326 | 326 | |
| 327 | 327 | /* author */ |
@@ -333,12 +333,12 @@ discard block |
||
| 333 | 333 | if ('p.post_time' === $sortby || empty($sortby)) { |
| 334 | 334 | $sortby_select .= ' selected=\'selected\''; |
| 335 | 335 | } |
| 336 | -$sortby_select .= '>' . _MD_NEWBB_DATE . '</option>'; |
|
| 336 | +$sortby_select .= '>'._MD_NEWBB_DATE.'</option>'; |
|
| 337 | 337 | $sortby_select .= '<option value=\'p.subject\''; |
| 338 | 338 | if ('p.subject' === $sortby) { |
| 339 | 339 | $sortby_select .= ' selected="selected"'; |
| 340 | 340 | } |
| 341 | -$sortby_select .= '>' . _MD_NEWBB_TOPIC . '</option>'; |
|
| 341 | +$sortby_select .= '>'._MD_NEWBB_TOPIC.'</option>'; |
|
| 342 | 342 | $sortby_select .= '</select>'; |
| 343 | 343 | $xoopsTpl->assign('sortby_selection_box', $sortby_select); |
| 344 | 344 | |
@@ -354,5 +354,5 @@ discard block |
||
| 354 | 354 | $xoopsTpl->assign('search_rule', sprintf(_SR_KEYIGNORE, $xoopsConfigSearch['keyword_min'])); |
| 355 | 355 | } |
| 356 | 356 | // irmtfan move to footer.php |
| 357 | -require_once __DIR__ . '/footer.php'; |
|
| 357 | +require_once __DIR__.'/footer.php'; |
|
| 358 | 358 | include $GLOBALS['xoops']->path('footer.php'); |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | use Xmf\Request; |
| 20 | 20 | use XoopsModules\Newbb; |
| 21 | 21 | |
| 22 | -require_once __DIR__ . '/header.php'; |
|
| 22 | +require_once __DIR__.'/header.php'; |
|
| 23 | 23 | |
| 24 | 24 | foreach ([ |
| 25 | 25 | 'forum', |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | || ($postObject->checkTimelimit('edit_timelimit') |
| 148 | 148 | && $postObject->checkIdentity()))) { |
| 149 | 149 | } else { |
| 150 | - redirect_header(XOOPS_URL . "/modules/newbb/viewtopic.php?forum={$forum_id}&topic_id={$topic_id}&post_id={$post_id}&order={$order}&viewmode={$viewmode}", 2, _MD_NEWBB_NORIGHTTOEDIT); |
|
| 150 | + redirect_header(XOOPS_URL."/modules/newbb/viewtopic.php?forum={$forum_id}&topic_id={$topic_id}&post_id={$post_id}&order={$order}&viewmode={$viewmode}", 2, _MD_NEWBB_NORIGHTTOEDIT); |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | $delete_attach = Request::getArray('delete_attach', [], 'POST'); |
@@ -158,12 +158,12 @@ discard block |
||
| 158 | 158 | if ($topic_id) { |
| 159 | 159 | $topic_status = $topicObject->getVar('topic_status'); |
| 160 | 160 | if (!$topicHandler->getPermission($forumObject, $topic_status, 'reply')) { |
| 161 | - redirect_header(XOOPS_URL . "/modules/newbb/viewtopic.php?forum={$forum_id}&topic_id={$topic_id}&post_id={$post_id}&order={$order}&viewmode={$viewmode}", 2, _MD_NEWBB_NORIGHTTOREPLY); |
|
| 161 | + redirect_header(XOOPS_URL."/modules/newbb/viewtopic.php?forum={$forum_id}&topic_id={$topic_id}&post_id={$post_id}&order={$order}&viewmode={$viewmode}", 2, _MD_NEWBB_NORIGHTTOREPLY); |
|
| 162 | 162 | } |
| 163 | 163 | } else { |
| 164 | 164 | $topic_status = 0; |
| 165 | 165 | if (!$topicHandler->getPermission($forumObject, $topic_status, 'post')) { |
| 166 | - redirect_header(XOOPS_URL . "/modules/newbb/viewtopic.php?forum={$forum_id}", 2, _MD_NEWBB_NORIGHTTOPOST); |
|
| 166 | + redirect_header(XOOPS_URL."/modules/newbb/viewtopic.php?forum={$forum_id}", 2, _MD_NEWBB_NORIGHTTOPOST); |
|
| 167 | 167 | } |
| 168 | 168 | } |
| 169 | 169 | |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | $doxcode = Request::getInt('doxcode', 0, 'POST') ? 1 : 0; |
| 203 | 203 | $dobr = Request::getInt('dobr', 0, 'POST') ? 1 : 0; |
| 204 | 204 | $icon = (Request::getString('icon', '', 'POST') |
| 205 | - && is_file($GLOBALS['xoops']->path('images/subject/' . Request::getString('icon', '', 'POST'))) ? Request::getString('icon', '', 'POST') : ''); |
|
| 205 | + && is_file($GLOBALS['xoops']->path('images/subject/'.Request::getString('icon', '', 'POST'))) ? Request::getString('icon', '', 'POST') : ''); |
|
| 206 | 206 | $attachsig = Request::getBool('attachsig', false, 'POST') |
| 207 | 207 | && $topicHandler->getPermission($forumObject, $topic_status, 'signature'); |
| 208 | 208 | $view_require = Request::getString('view_require', '', 'POST'); |
@@ -235,14 +235,14 @@ discard block |
||
| 235 | 235 | $attachments_tmp = unserialize(base64_decode(Request::getString('attachments_tmp', '', 'POST'))); |
| 236 | 236 | if (Request::getArray('delete_tmp', null, 'POST') && count(Request::getArray('delete_tmp', null, 'POST')) > 1) { |
| 237 | 237 | foreach (Request::getArray('delete_tmp', null, 'POST') as $key) { |
| 238 | - unlink($GLOBALS['xoops']->path($GLOBALS['xoopsModuleConfig']['dir_attachments'] . '/' . $attachments_tmp[$key][0])); |
|
| 238 | + unlink($GLOBALS['xoops']->path($GLOBALS['xoopsModuleConfig']['dir_attachments'].'/'.$attachments_tmp[$key][0])); |
|
| 239 | 239 | unset($attachments_tmp[$key]); |
| 240 | 240 | } |
| 241 | 241 | } |
| 242 | 242 | } |
| 243 | 243 | if (isset($attachments_tmp) && count($attachments_tmp)) { |
| 244 | 244 | foreach ($attachments_tmp as $key => $attach) { |
| 245 | - if (rename(XOOPS_CACHE_PATH . '/' . $attachments_tmp[$key][0], $GLOBALS['xoops']->path($GLOBALS['xoopsModuleConfig']['dir_attachments'] . '/' . $attachments_tmp[$key][0]))) { |
|
| 245 | + if (rename(XOOPS_CACHE_PATH.'/'.$attachments_tmp[$key][0], $GLOBALS['xoops']->path($GLOBALS['xoopsModuleConfig']['dir_attachments'].'/'.$attachments_tmp[$key][0]))) { |
|
| 246 | 246 | $postObject->setAttachment($attach[0], $attach[1], $attach[2]); |
| 247 | 247 | } |
| 248 | 248 | } |
@@ -273,13 +273,13 @@ discard block |
||
| 273 | 273 | $uploader->setCheckMediaTypeByExt(); |
| 274 | 274 | $temp = Request::getArray('xoops_upload_file', [], 'POST'); |
| 275 | 275 | if ($uploader->fetchMedia($temp[0])) { |
| 276 | - $prefix = is_object($GLOBALS['xoopsUser']) ? (string)$GLOBALS['xoopsUser']->uid() . '_' : 'newbb_'; |
|
| 276 | + $prefix = is_object($GLOBALS['xoopsUser']) ? (string)$GLOBALS['xoopsUser']->uid().'_' : 'newbb_'; |
|
| 277 | 277 | $uploader->setPrefix($prefix); |
| 278 | 278 | if (!$uploader->upload()) { |
| 279 | 279 | $error_message[] = $error_upload = $uploader->getErrors(); |
| 280 | 280 | } else { |
| 281 | 281 | if (is_file($uploader->getSavedDestination())) { |
| 282 | - if (rename(XOOPS_CACHE_PATH . '/' . $uploader->getSavedFileName(), $GLOBALS['xoops']->path($GLOBALS['xoopsModuleConfig']['dir_attachments'] . '/' . $uploader->getSavedFileName()))) { |
|
| 282 | + if (rename(XOOPS_CACHE_PATH.'/'.$uploader->getSavedFileName(), $GLOBALS['xoops']->path($GLOBALS['xoopsModuleConfig']['dir_attachments'].'/'.$uploader->getSavedFileName()))) { |
|
| 283 | 283 | $postObject->setAttachment($uploader->getSavedFileName(), $uploader->getMediaName(), $uploader->getMediaType()); |
| 284 | 284 | } |
| 285 | 285 | } |
@@ -327,9 +327,9 @@ discard block |
||
| 327 | 327 | if (!empty($isnew) && $approved && !empty($GLOBALS['xoopsModuleConfig']['notification_enabled'])) { |
| 328 | 328 | $tags = []; |
| 329 | 329 | $tags['THREAD_NAME'] = Request::getString('subject', '', 'POST'); |
| 330 | - $tags['THREAD_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/viewtopic.php?post_id=' . $postid; |
|
| 330 | + $tags['THREAD_URL'] = XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname', 'n').'/viewtopic.php?post_id='.$postid; |
|
| 331 | 331 | $tags['POST_URL'] = $tags['THREAD_URL']; // . '#forumpost' . $postid; |
| 332 | - require_once __DIR__ . '/include/notification.inc.php'; |
|
| 332 | + require_once __DIR__.'/include/notification.inc.php'; |
|
| 333 | 333 | $forum_info = newbb_notify_iteminfo('forum', $forumObject->getVar('forum_id')); |
| 334 | 334 | $tags['FORUM_NAME'] = $forum_info['name']; |
| 335 | 335 | $tags['FORUM_URL'] = $forum_info['url']; |
@@ -368,34 +368,34 @@ discard block |
||
| 368 | 368 | |
| 369 | 369 | if ($approved) { |
| 370 | 370 | if (!empty($GLOBALS['xoopsModuleConfig']['cache_enabled'])) { |
| 371 | - newbbSetSession('t' . $postObject->getVar('topic_id'), null); |
|
| 371 | + newbbSetSession('t'.$postObject->getVar('topic_id'), null); |
|
| 372 | 372 | } |
| 373 | 373 | // Update user |
| 374 | 374 | if ($uid > 0) { |
| 375 | - $sql = 'SELECT count(*)' . ' FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . ' WHERE approved=1 AND topic_poster =' . $uid; |
|
| 375 | + $sql = 'SELECT count(*)'.' FROM '.$GLOBALS['xoopsDB']->prefix('newbb_topics').' WHERE approved=1 AND topic_poster ='.$uid; |
|
| 376 | 376 | $ret = $GLOBALS['xoopsDB']->query($sql); |
| 377 | 377 | list($topics) = $GLOBALS['xoopsDB']->fetchRow($ret); |
| 378 | 378 | |
| 379 | - $sql = ' SELECT count(*)' . ' FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . ' WHERE approved=1 AND topic_digest > 0 AND topic_poster =' . $uid; |
|
| 379 | + $sql = ' SELECT count(*)'.' FROM '.$GLOBALS['xoopsDB']->prefix('newbb_topics').' WHERE approved=1 AND topic_digest > 0 AND topic_poster ='.$uid; |
|
| 380 | 380 | $ret = $GLOBALS['xoopsDB']->query($sql); |
| 381 | 381 | list($digests) = $GLOBALS['xoopsDB']->fetchRow($ret); |
| 382 | 382 | |
| 383 | - $sql = ' SELECT count(*), MAX(post_time)' . ' FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . ' WHERE approved=1 AND uid =' . $uid; |
|
| 383 | + $sql = ' SELECT count(*), MAX(post_time)'.' FROM '.$GLOBALS['xoopsDB']->prefix('newbb_posts').' WHERE approved=1 AND uid ='.$uid; |
|
| 384 | 384 | $ret = $GLOBALS['xoopsDB']->query($sql); |
| 385 | 385 | list($posts, $lastpost) = $GLOBALS['xoopsDB']->fetchRow($ret); |
| 386 | 386 | |
| 387 | - $GLOBALS['xoopsDB']->queryF(' REPLACE INTO ' . $GLOBALS['xoopsDB']->prefix('newbb_user_stats') . " SET uid = '{$uid}', user_topics = '{$topics}', user_posts = '{$posts}', user_digests = '{$digests}', user_lastpost = '{$lastpost}'"); |
|
| 387 | + $GLOBALS['xoopsDB']->queryF(' REPLACE INTO '.$GLOBALS['xoopsDB']->prefix('newbb_user_stats')." SET uid = '{$uid}', user_topics = '{$topics}', user_posts = '{$posts}', user_digests = '{$digests}', user_lastpost = '{$lastpost}'"); |
|
| 388 | 388 | } |
| 389 | 389 | |
| 390 | - $redirect = XOOPS_URL . '/modules/newbb/viewtopic.php?post_id=' . $postid; |
|
| 391 | - $message = _MD_NEWBB_THANKSSUBMIT . '<br>' . $error_upload; |
|
| 390 | + $redirect = XOOPS_URL.'/modules/newbb/viewtopic.php?post_id='.$postid; |
|
| 391 | + $message = _MD_NEWBB_THANKSSUBMIT.'<br>'.$error_upload; |
|
| 392 | 392 | } else { |
| 393 | - $redirect = XOOPS_URL . '/modules/newbb/viewforum.php?forum=' . $postObject->getVar('forum_id'); |
|
| 394 | - $message = _MD_NEWBB_THANKSSUBMIT . '<br>' . _MD_NEWBB_WAITFORAPPROVAL . '<br>' . $error_upload; |
|
| 393 | + $redirect = XOOPS_URL.'/modules/newbb/viewforum.php?forum='.$postObject->getVar('forum_id'); |
|
| 394 | + $message = _MD_NEWBB_THANKSSUBMIT.'<br>'._MD_NEWBB_WAITFORAPPROVAL.'<br>'.$error_upload; |
|
| 395 | 395 | } |
| 396 | 396 | |
| 397 | 397 | if ('add' === $op) { |
| 398 | - redirect_header(XOOPS_URL . '/modules/newbb/polls.php?op=add&forum=' . $postObject->getVar('forum_id') . '&topic_id=' . $postObject->getVar('topic_id'), 1, _MD_NEWBB_ADDPOLL); |
|
| 398 | + redirect_header(XOOPS_URL.'/modules/newbb/polls.php?op=add&forum='.$postObject->getVar('forum_id').'&topic_id='.$postObject->getVar('topic_id'), 1, _MD_NEWBB_ADDPOLL); |
|
| 399 | 399 | } else { |
| 400 | 400 | redirect_header($redirect, 2, $message); |
| 401 | 401 | } |
@@ -415,7 +415,7 @@ discard block |
||
| 415 | 415 | $attachments_tmp = unserialize(base64_decode(Request::getArray('attachments_tmp', [], 'POST'))); |
| 416 | 416 | if (Request::getArray('delete_tmp', null, 'POST') && count(Request::getArray('delete_tmp', null, 'POST'))) { |
| 417 | 417 | foreach (Request::getArray('delete_tmp', '', 'POST') as $key) { |
| 418 | - unlink($uploaddir = $GLOBALS['xoops']->path($GLOBALS['xoopsModuleConfig']['dir_attachments'] . '/' . $attachments_tmp[$key][0])); |
|
| 418 | + unlink($uploaddir = $GLOBALS['xoops']->path($GLOBALS['xoopsModuleConfig']['dir_attachments'].'/'.$attachments_tmp[$key][0])); |
|
| 419 | 419 | unset($attachments_tmp[$key]); |
| 420 | 420 | } |
| 421 | 421 | } |
@@ -444,7 +444,7 @@ discard block |
||
| 444 | 444 | $uploader->setCheckMediaTypeByExt(); |
| 445 | 445 | $temp = Request::getArray('xoops_upload_file', [], 'POST'); |
| 446 | 446 | if ($uploader->fetchMedia($temp[0])) { |
| 447 | - $prefix = is_object($GLOBALS['xoopsUser']) ? (string)$GLOBALS['xoopsUser']->uid() . '_' : 'newbb_'; |
|
| 447 | + $prefix = is_object($GLOBALS['xoopsUser']) ? (string)$GLOBALS['xoopsUser']->uid().'_' : 'newbb_'; |
|
| 448 | 448 | $uploader->setPrefix($prefix); |
| 449 | 449 | if (!$uploader->upload()) { |
| 450 | 450 | $error_message[] = $error_upload = $uploader->getErrors(); |
@@ -493,7 +493,7 @@ discard block |
||
| 493 | 493 | |
| 494 | 494 | $post_preview = [ |
| 495 | 495 | 'subject' => $p_subject, |
| 496 | - 'meta' => _MD_NEWBB_BY . ' ' . $p_name . ' ' . _MD_NEWBB_ON . ' ' . $p_date, |
|
| 496 | + 'meta' => _MD_NEWBB_BY.' '.$p_name.' '._MD_NEWBB_ON.' '.$p_date, |
|
| 497 | 497 | 'content' => $p_message |
| 498 | 498 | ]; |
| 499 | 499 | $xoopsTpl->assign_by_ref('post_preview', $post_preview); |
@@ -512,11 +512,11 @@ discard block |
||
| 512 | 512 | $poster_name = Request::getString('poster_name', '', 'POST'); |
| 513 | 513 | $hidden = Request::getString('hidden', '', 'POST'); |
| 514 | 514 | $notify = Request::getInt('notify', 0, 'POST'); |
| 515 | - $attachsig = Request::getInt('attachsig', 0, 'POST');//!empty($_POST['attachsig']) ? 1 : 0; |
|
| 515 | + $attachsig = Request::getInt('attachsig', 0, 'POST'); //!empty($_POST['attachsig']) ? 1 : 0; |
|
| 516 | 516 | $isreply = Request::getInt('isreply', 0, 'POST'); //!empty($_POST['isreply']) ? 1 : 0; |
| 517 | 517 | $isedit = Request::getInt('isedit', 0, 'POST'); //!empty($_POST['isedit']) ? 1 : 0; |
| 518 | 518 | $icon = (Request::getString('icon', '', 'POST') |
| 519 | - && is_file($GLOBALS['xoops']->path('images/subject/' . Request::getString('icon', '', 'POST'))) ? Request::getString('icon', '', 'POST') : ''); |
|
| 519 | + && is_file($GLOBALS['xoops']->path('images/subject/'.Request::getString('icon', '', 'POST'))) ? Request::getString('icon', '', 'POST') : ''); |
|
| 520 | 520 | $view_require = Request::getString('view_require', '', 'POST'); |
| 521 | 521 | $post_karma = (('require_karma' === $view_require) |
| 522 | 522 | && !Request::getInt('post_karma', 0, 'POST')) ? Request::getInt('post_karma', 0, 'POST') : 0; |
@@ -528,8 +528,8 @@ discard block |
||
| 528 | 528 | $attachments = $postObject->getAttachment(); |
| 529 | 529 | $xoopsTpl->assign('error_message', implode('<br>', $error_message)); |
| 530 | 530 | |
| 531 | - include __DIR__ . '/include/form.post.php'; |
|
| 531 | + include __DIR__.'/include/form.post.php'; |
|
| 532 | 532 | } |
| 533 | 533 | // irmtfan move to footer.php |
| 534 | -require_once __DIR__ . '/footer.php'; |
|
| 534 | +require_once __DIR__.'/footer.php'; |
|
| 535 | 535 | include $GLOBALS['xoops']->path('footer.php'); |