@@ -119,12 +119,12 @@ discard block |
||
| 119 | 119 | $classOption = $classPoll . 'Option'; |
| 120 | 120 | $poll_form = new \XoopsThemeForm(_MD_NEWBB_POLL_CREATNEWPOLL, 'poll_form', 'polls.php', 'post', true); |
| 121 | 121 | $author_label = new \XoopsFormLabel(_MD_NEWBB_POLL_AUTHOR, is_object($GLOBALS['xoopsUser']) ? ("<a href='" |
| 122 | - . XOOPS_URL |
|
| 123 | - . '/userinfo.php?uid=' |
|
| 124 | - . $GLOBALS['xoopsUser']->getVar('uid') |
|
| 125 | - . "'>" |
|
| 126 | - . newbbGetUnameFromId($GLOBALS['xoopsUser']->getVar('uid'), $GLOBALS['xoopsModuleConfig']['show_realname']) |
|
| 127 | - . '</a>') : $GLOBALS['xoopsConfig']['anonymous']); |
|
| 122 | + . XOOPS_URL |
|
| 123 | + . '/userinfo.php?uid=' |
|
| 124 | + . $GLOBALS['xoopsUser']->getVar('uid') |
|
| 125 | + . "'>" |
|
| 126 | + . newbbGetUnameFromId($GLOBALS['xoopsUser']->getVar('uid'), $GLOBALS['xoopsModuleConfig']['show_realname']) |
|
| 127 | + . '</a>') : $GLOBALS['xoopsConfig']['anonymous']); |
|
| 128 | 128 | $poll_form->addElement($author_label); |
| 129 | 129 | $question_text = new \XoopsFormText(_MD_NEWBB_POLL_POLLQUESTION, 'question', 50, 255); |
| 130 | 130 | $poll_form->addElement($question_text); |
@@ -154,12 +154,12 @@ discard block |
||
| 154 | 154 | $color_select->addOptionArray($barcolor_array); |
| 155 | 155 | $color_select->setExtra("onchange='showImgSelected(\"option_color_image[{$i}]\", \"option_color[{$i}]\", \"modules/" . $GLOBALS['xoopsModuleConfig']['poll_module'] . '/assets/images/colorbars", "", "' . XOOPS_URL . "\")'"); |
| 156 | 156 | $color_label = new \XoopsFormLabel('', "<img src='" |
| 157 | - . XOOPS_URL |
|
| 158 | - . '/modules/' |
|
| 159 | - . $GLOBALS['xoopsModuleConfig']['poll_module'] |
|
| 160 | - . '/assets/images/colorbars/' |
|
| 161 | - . $current_bar |
|
| 162 | - . "' name='option_color_image[{$i}]' id='option_color_image[{$i}]' width='30' align='bottom' height='15' alt='' /><br>"); |
|
| 157 | + . XOOPS_URL |
|
| 158 | + . '/modules/' |
|
| 159 | + . $GLOBALS['xoopsModuleConfig']['poll_module'] |
|
| 160 | + . '/assets/images/colorbars/' |
|
| 161 | + . $current_bar |
|
| 162 | + . "' name='option_color_image[{$i}]' id='option_color_image[{$i}]' width='30' align='bottom' height='15' alt='' /><br>"); |
|
| 163 | 163 | $option_tray->addElement($color_select); |
| 164 | 164 | $option_tray->addElement($color_label); |
| 165 | 165 | if (!next($barcolor_array)) { |
@@ -228,8 +228,8 @@ discard block |
||
| 228 | 228 | $color_select->addOptionArray($barcolor_array); |
| 229 | 229 | $color_select->setExtra("onchange='showImgSelected(\"option_color_image[{$i}]\", \"option_color[" . $i . "]\", \"modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/assets/images/colorbars\", \"\", \"" . XOOPS_URL . "\")'"); |
| 230 | 230 | $color_label = new \XoopsFormLabel('', "<img src='" |
| 231 | - . $GLOBALS['xoops']->url("modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/assets/images/colorbars/" . $option->getVar('option_color', 'E')) |
|
| 232 | - . "' name='option_color_image[{$i}]' id='option_color_image[{$i}]' class='alignbottom' width='30' height='15' alt='' /><br>"); |
|
| 231 | + . $GLOBALS['xoops']->url("modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/assets/images/colorbars/" . $option->getVar('option_color', 'E')) |
|
| 232 | + . "' name='option_color_image[{$i}]' id='option_color_image[{$i}]' class='alignbottom' width='30' height='15' alt='' /><br>"); |
|
| 233 | 233 | $option_tray->addElement($color_select); |
| 234 | 234 | $option_tray->addElement($color_label); |
| 235 | 235 | unset($color_select, $color_label); |
@@ -518,8 +518,8 @@ discard block |
||
| 518 | 518 | $color_select->addOptionArray($barcolor_array); |
| 519 | 519 | $color_select->setExtra("onchange='showImgSelected(\"option_color_image[{$i}]\", \"option_color[{$i}]\", \"modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/assets/images/colorbars\", \"\", \"" . XOOPS_URL . "\")'"); |
| 520 | 520 | $color_label = new \XoopsFormLabel('', "<img src='" |
| 521 | - . $GLOBALS['xoops']->url("modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/assets/images/colorbars/{$current_bar}") |
|
| 522 | - . "' name='option_color_image[{$i}]' id='option_color_image[{$i}]' class='alignbottom' width='30' height='15' alt='' /><br>"); |
|
| 521 | + . $GLOBALS['xoops']->url("modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/assets/images/colorbars/{$current_bar}") |
|
| 522 | + . "' name='option_color_image[{$i}]' id='option_color_image[{$i}]' class='alignbottom' width='30' height='15' alt='' /><br>"); |
|
| 523 | 523 | $option_tray->addElement($color_select); |
| 524 | 524 | $option_tray->addElement($color_label); |
| 525 | 525 | unset($color_select, $color_label, $option_text); |
@@ -652,9 +652,9 @@ discard block |
||
| 652 | 652 | $expire_text = new \XoopsFormText( |
| 653 | 653 | _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( |
| 654 | 654 | _MD_NEWBB_POLL_EXPIREDAT, |
| 655 | - formatTimestamp($pollObject->getVar('end_time'), 'Y-m-d H:i:s') |
|
| 655 | + formatTimestamp($pollObject->getVar('end_time'), 'Y-m-d H:i:s') |
|
| 656 | 656 | ) . '</small>', |
| 657 | - 'end_time', |
|
| 657 | + 'end_time', |
|
| 658 | 658 | 20, |
| 659 | 659 | 19, |
| 660 | 660 | formatTimestamp(time() + $default_poll_duration, 'Y-m-d H:i:s') |
@@ -109,213 +109,377 @@ discard block |
||
| 109 | 109 | } |
| 110 | 110 | } |
| 111 | 111 | switch ($op) { |
| 112 | - case 'add': |
|
| 113 | - // new xoopspoll module |
|
| 114 | - if ($pollModuleHandler->getVar('version') >= 140) { |
|
| 115 | - echo '<h4>' . _MD_NEWBB_POLL_CREATNEWPOLL . "</h4>\n"; |
|
| 116 | - $pollObject->renderForm(Request::getString('PHP_SELF', '', 'SERVER'), 'post', ['topic_id' => $topic_id]); |
|
| 117 | - // old xoopspoll or umfrage or any clone from them |
|
| 118 | - } else { |
|
| 119 | - $classOption = $classPoll . 'Option'; |
|
| 120 | - $poll_form = new \XoopsThemeForm(_MD_NEWBB_POLL_CREATNEWPOLL, 'poll_form', 'polls.php', 'post', true); |
|
| 121 | - $author_label = new \XoopsFormLabel(_MD_NEWBB_POLL_AUTHOR, is_object($GLOBALS['xoopsUser']) ? ("<a href='" |
|
| 122 | - . XOOPS_URL |
|
| 123 | - . '/userinfo.php?uid=' |
|
| 124 | - . $GLOBALS['xoopsUser']->getVar('uid') |
|
| 125 | - . "'>" |
|
| 126 | - . newbbGetUnameFromId($GLOBALS['xoopsUser']->getVar('uid'), $GLOBALS['xoopsModuleConfig']['show_realname']) |
|
| 127 | - . '</a>') : $GLOBALS['xoopsConfig']['anonymous']); |
|
| 128 | - $poll_form->addElement($author_label); |
|
| 129 | - $question_text = new \XoopsFormText(_MD_NEWBB_POLL_POLLQUESTION, 'question', 50, 255); |
|
| 130 | - $poll_form->addElement($question_text); |
|
| 131 | - $desc_tarea = new \XoopsFormTextarea(_MD_NEWBB_POLL_POLLDESC, 'description'); |
|
| 132 | - $poll_form->addElement($desc_tarea); |
|
| 133 | - $currenttime = formatTimestamp(time(), 'Y-m-d H:i:s'); |
|
| 134 | - $endtime = formatTimestamp(time() + 604800, 'Y-m-d H:i:s'); |
|
| 135 | - $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); |
|
| 136 | - $poll_form->addElement($expire_text); |
|
| 112 | + case 'add': |
|
| 113 | + // new xoopspoll module |
|
| 114 | + if ($pollModuleHandler->getVar('version') >= 140) { |
|
| 115 | + echo '<h4>' . _MD_NEWBB_POLL_CREATNEWPOLL . "</h4>\n"; |
|
| 116 | + $pollObject->renderForm(Request::getString('PHP_SELF', '', 'SERVER'), 'post', ['topic_id' => $topic_id]); |
|
| 117 | + // old xoopspoll or umfrage or any clone from them |
|
| 118 | + } else { |
|
| 119 | + $classOption = $classPoll . 'Option'; |
|
| 120 | + $poll_form = new \XoopsThemeForm(_MD_NEWBB_POLL_CREATNEWPOLL, 'poll_form', 'polls.php', 'post', true); |
|
| 121 | + $author_label = new \XoopsFormLabel(_MD_NEWBB_POLL_AUTHOR, is_object($GLOBALS['xoopsUser']) ? ("<a href='" |
|
| 122 | + . XOOPS_URL |
|
| 123 | + . '/userinfo.php?uid=' |
|
| 124 | + . $GLOBALS['xoopsUser']->getVar('uid') |
|
| 125 | + . "'>" |
|
| 126 | + . newbbGetUnameFromId($GLOBALS['xoopsUser']->getVar('uid'), $GLOBALS['xoopsModuleConfig']['show_realname']) |
|
| 127 | + . '</a>') : $GLOBALS['xoopsConfig']['anonymous']); |
|
| 128 | + $poll_form->addElement($author_label); |
|
| 129 | + $question_text = new \XoopsFormText(_MD_NEWBB_POLL_POLLQUESTION, 'question', 50, 255); |
|
| 130 | + $poll_form->addElement($question_text); |
|
| 131 | + $desc_tarea = new \XoopsFormTextarea(_MD_NEWBB_POLL_POLLDESC, 'description'); |
|
| 132 | + $poll_form->addElement($desc_tarea); |
|
| 133 | + $currenttime = formatTimestamp(time(), 'Y-m-d H:i:s'); |
|
| 134 | + $endtime = formatTimestamp(time() + 604800, 'Y-m-d H:i:s'); |
|
| 135 | + $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); |
|
| 136 | + $poll_form->addElement($expire_text); |
|
| 137 | 137 | |
| 138 | - $weight_text = new \XoopsFormText(_MD_NEWBB_POLL_DISPLAYORDER, 'weight', 6, 5, 0); |
|
| 139 | - $poll_form->addElement($weight_text); |
|
| 140 | - |
|
| 141 | - $multi_yn = new \XoopsFormRadioYN(_MD_NEWBB_POLL_ALLOWMULTI, 'multiple', 0); |
|
| 142 | - $poll_form->addElement($multi_yn); |
|
| 143 | - |
|
| 144 | - $notify_yn = new \XoopsFormRadioYN(_MD_NEWBB_POLL_NOTIFY, 'notify', 1); |
|
| 145 | - $poll_form->addElement($notify_yn); |
|
| 146 | - |
|
| 147 | - $option_tray = new \XoopsFormElementTray(_MD_NEWBB_POLL_POLLOPTIONS, ''); |
|
| 148 | - $barcolor_array = \XoopsLists::getImgListAsArray($GLOBALS['xoops']->path('modules/' . $GLOBALS['xoopsModuleConfig']['poll_module'] . '/assets/images/colorbars/')); |
|
| 149 | - for ($i = 0; $i < 10; ++$i) { |
|
| 150 | - $current_bar = ('blank.gif' !== current($barcolor_array)) ? current($barcolor_array) : next($barcolor_array); |
|
| 151 | - $option_text = new \XoopsFormText('', 'option_text[]', 50, 255); |
|
| 152 | - $option_tray->addElement($option_text); |
|
| 153 | - $color_select = new \XoopsFormSelect('', "option_color[{$i}]", $current_bar); |
|
| 154 | - $color_select->addOptionArray($barcolor_array); |
|
| 155 | - $color_select->setExtra("onchange='showImgSelected(\"option_color_image[{$i}]\", \"option_color[{$i}]\", \"modules/" . $GLOBALS['xoopsModuleConfig']['poll_module'] . '/assets/images/colorbars", "", "' . XOOPS_URL . "\")'"); |
|
| 156 | - $color_label = new \XoopsFormLabel('', "<img src='" |
|
| 157 | - . XOOPS_URL |
|
| 158 | - . '/modules/' |
|
| 159 | - . $GLOBALS['xoopsModuleConfig']['poll_module'] |
|
| 160 | - . '/assets/images/colorbars/' |
|
| 161 | - . $current_bar |
|
| 162 | - . "' name='option_color_image[{$i}]' id='option_color_image[{$i}]' width='30' align='bottom' height='15' alt='' /><br>"); |
|
| 163 | - $option_tray->addElement($color_select); |
|
| 164 | - $option_tray->addElement($color_label); |
|
| 165 | - if (!next($barcolor_array)) { |
|
| 166 | - reset($barcolor_array); |
|
| 138 | + $weight_text = new \XoopsFormText(_MD_NEWBB_POLL_DISPLAYORDER, 'weight', 6, 5, 0); |
|
| 139 | + $poll_form->addElement($weight_text); |
|
| 140 | + |
|
| 141 | + $multi_yn = new \XoopsFormRadioYN(_MD_NEWBB_POLL_ALLOWMULTI, 'multiple', 0); |
|
| 142 | + $poll_form->addElement($multi_yn); |
|
| 143 | + |
|
| 144 | + $notify_yn = new \XoopsFormRadioYN(_MD_NEWBB_POLL_NOTIFY, 'notify', 1); |
|
| 145 | + $poll_form->addElement($notify_yn); |
|
| 146 | + |
|
| 147 | + $option_tray = new \XoopsFormElementTray(_MD_NEWBB_POLL_POLLOPTIONS, ''); |
|
| 148 | + $barcolor_array = \XoopsLists::getImgListAsArray($GLOBALS['xoops']->path('modules/' . $GLOBALS['xoopsModuleConfig']['poll_module'] . '/assets/images/colorbars/')); |
|
| 149 | + for ($i = 0; $i < 10; ++$i) { |
|
| 150 | + $current_bar = ('blank.gif' !== current($barcolor_array)) ? current($barcolor_array) : next($barcolor_array); |
|
| 151 | + $option_text = new \XoopsFormText('', 'option_text[]', 50, 255); |
|
| 152 | + $option_tray->addElement($option_text); |
|
| 153 | + $color_select = new \XoopsFormSelect('', "option_color[{$i}]", $current_bar); |
|
| 154 | + $color_select->addOptionArray($barcolor_array); |
|
| 155 | + $color_select->setExtra("onchange='showImgSelected(\"option_color_image[{$i}]\", \"option_color[{$i}]\", \"modules/" . $GLOBALS['xoopsModuleConfig']['poll_module'] . '/assets/images/colorbars", "", "' . XOOPS_URL . "\")'"); |
|
| 156 | + $color_label = new \XoopsFormLabel('', "<img src='" |
|
| 157 | + . XOOPS_URL |
|
| 158 | + . '/modules/' |
|
| 159 | + . $GLOBALS['xoopsModuleConfig']['poll_module'] |
|
| 160 | + . '/assets/images/colorbars/' |
|
| 161 | + . $current_bar |
|
| 162 | + . "' name='option_color_image[{$i}]' id='option_color_image[{$i}]' width='30' align='bottom' height='15' alt='' /><br>"); |
|
| 163 | + $option_tray->addElement($color_select); |
|
| 164 | + $option_tray->addElement($color_label); |
|
| 165 | + if (!next($barcolor_array)) { |
|
| 166 | + reset($barcolor_array); |
|
| 167 | + } |
|
| 168 | + unset($color_select, $color_label); |
|
| 167 | 169 | } |
| 168 | - unset($color_select, $color_label); |
|
| 170 | + $poll_form->addElement($option_tray); |
|
| 171 | + |
|
| 172 | + $poll_form->addElement(new \XoopsFormHidden('op', 'save')); |
|
| 173 | + $poll_form->addElement(new \XoopsFormHidden('topic_id', $topic_id)); |
|
| 174 | + $poll_form->addElement(new \XoopsFormHidden('poll_id', $poll_id)); |
|
| 175 | + $poll_form->addElement(new \XoopsFormHidden('user_id', is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('uid') : 0)); |
|
| 176 | + $poll_form->addElement(new \XoopsFormButtonTray('poll_submit', _SUBMIT, 'submit')); |
|
| 177 | + echo '<h4>' . _MD_NEWBB_POLL_POLLCONF . '</h4>'; |
|
| 178 | + $poll_form->display(); |
|
| 169 | 179 | } |
| 170 | - $poll_form->addElement($option_tray); |
|
| 171 | - |
|
| 172 | - $poll_form->addElement(new \XoopsFormHidden('op', 'save')); |
|
| 173 | - $poll_form->addElement(new \XoopsFormHidden('topic_id', $topic_id)); |
|
| 174 | - $poll_form->addElement(new \XoopsFormHidden('poll_id', $poll_id)); |
|
| 175 | - $poll_form->addElement(new \XoopsFormHidden('user_id', is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('uid') : 0)); |
|
| 176 | - $poll_form->addElement(new \XoopsFormButtonTray('poll_submit', _SUBMIT, 'submit')); |
|
| 177 | - echo '<h4>' . _MD_NEWBB_POLL_POLLCONF . '</h4>'; |
|
| 178 | - $poll_form->display(); |
|
| 179 | - } |
|
| 180 | - break; // op: add |
|
| 180 | + break; // op: add |
|
| 181 | 181 | |
| 182 | - case 'edit': |
|
| 183 | - // new xoopspoll module |
|
| 184 | - if ($pollModuleHandler->getVar('version') >= 140) { |
|
| 185 | - echo '<h4>' . _MD_NEWBB_POLL_EDITPOLL . "</h4>\n"; |
|
| 186 | - $pollObject->renderForm(Request::getString('PHP_SELF', '', 'SERVER'), 'post', ['topic_id' => $topic_id]); |
|
| 187 | - // old xoopspoll or umfrage or any clone from them |
|
| 188 | - } else { |
|
| 189 | - $classOption = $classPoll . 'Option'; |
|
| 190 | - $poll_form = new \XoopsThemeForm(_MD_NEWBB_POLL_EDITPOLL, 'poll_form', 'polls.php', 'post', true); |
|
| 191 | - $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>'); |
|
| 192 | - $poll_form->addElement($author_label); |
|
| 193 | - $question_text = new \XoopsFormText(_MD_NEWBB_POLL_POLLQUESTION, 'question', 50, 255, $pollObject->getVar('question', 'E')); |
|
| 194 | - $poll_form->addElement($question_text); |
|
| 195 | - $desc_tarea = new \XoopsFormTextarea(_MD_NEWBB_POLL_POLLDESC, 'description', $pollObject->getVar('description', 'E')); |
|
| 196 | - $poll_form->addElement($desc_tarea); |
|
| 197 | - $date = formatTimestamp($pollObject->getVar('end_time'), 'Y-m-d H:i:s'); // important "Y-m-d H:i:s" use in jdf function |
|
| 198 | - if (!$pollObject->hasExpired()) { |
|
| 199 | - $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); |
|
| 200 | - $poll_form->addElement($expire_text); |
|
| 182 | + case 'edit': |
|
| 183 | + // new xoopspoll module |
|
| 184 | + if ($pollModuleHandler->getVar('version') >= 140) { |
|
| 185 | + echo '<h4>' . _MD_NEWBB_POLL_EDITPOLL . "</h4>\n"; |
|
| 186 | + $pollObject->renderForm(Request::getString('PHP_SELF', '', 'SERVER'), 'post', ['topic_id' => $topic_id]); |
|
| 187 | + // old xoopspoll or umfrage or any clone from them |
|
| 201 | 188 | } else { |
| 202 | - // irmtfan full URL - add topic_id |
|
| 203 | - $restart_label = new \XoopsFormLabel( |
|
| 204 | - _MD_NEWBB_POLL_EXPIRATION, |
|
| 205 | - 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>' |
|
| 206 | - ); |
|
| 207 | - $poll_form->addElement($restart_label); |
|
| 208 | - } |
|
| 209 | - $weight_text = new \XoopsFormText(_MD_NEWBB_POLL_DISPLAYORDER, 'weight', 6, 5, $pollObject->getVar('weight')); |
|
| 210 | - $poll_form->addElement($weight_text); |
|
| 211 | - $multi_yn = new \XoopsFormRadioYN(_MD_NEWBB_POLL_ALLOWMULTI, 'multiple', $pollObject->getVar('multiple')); |
|
| 212 | - $poll_form->addElement($multi_yn); |
|
| 213 | - $options_arr =& $classOption::getAllByPollId($poll_id); |
|
| 214 | - $notify_value = 1; |
|
| 215 | - if (0 !== $pollObject->getVar('mail_status')) { |
|
| 216 | - $notify_value = 0; |
|
| 217 | - } |
|
| 218 | - $notify_yn = new \XoopsFormRadioYN(_MD_NEWBB_POLL_NOTIFY, 'notify', $notify_value); |
|
| 219 | - $poll_form->addElement($notify_yn); |
|
| 220 | - $option_tray = new \XoopsFormElementTray(_MD_NEWBB_POLL_POLLOPTIONS, ''); |
|
| 221 | - $barcolor_array = \XoopsLists::getImgListAsArray($GLOBALS['xoops']->path("modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/assets/images/colorbars/")); |
|
| 222 | - $i = 0; |
|
| 223 | - foreach ($options_arr as $option) { |
|
| 224 | - /** @var \XoopsPoll $option */ |
|
| 225 | - $option_tray->addElement(new \XoopsFormText('', 'option_text[]', 50, 255, $option->getVar('option_text'))); |
|
| 226 | - $option_tray->addElement(new \XoopsFormHidden('option_id[]', $option->getVar('option_id'))); |
|
| 227 | - $color_select = new \XoopsFormSelect('', 'option_color[{$i}]', $option->getVar('option_color')); |
|
| 228 | - $color_select->addOptionArray($barcolor_array); |
|
| 229 | - $color_select->setExtra("onchange='showImgSelected(\"option_color_image[{$i}]\", \"option_color[" . $i . "]\", \"modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/assets/images/colorbars\", \"\", \"" . XOOPS_URL . "\")'"); |
|
| 230 | - $color_label = new \XoopsFormLabel('', "<img src='" |
|
| 231 | - . $GLOBALS['xoops']->url("modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/assets/images/colorbars/" . $option->getVar('option_color', 'E')) |
|
| 232 | - . "' name='option_color_image[{$i}]' id='option_color_image[{$i}]' class='alignbottom' width='30' height='15' alt='' /><br>"); |
|
| 233 | - $option_tray->addElement($color_select); |
|
| 234 | - $option_tray->addElement($color_label); |
|
| 235 | - unset($color_select, $color_label); |
|
| 236 | - ++$i; |
|
| 189 | + $classOption = $classPoll . 'Option'; |
|
| 190 | + $poll_form = new \XoopsThemeForm(_MD_NEWBB_POLL_EDITPOLL, 'poll_form', 'polls.php', 'post', true); |
|
| 191 | + $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>'); |
|
| 192 | + $poll_form->addElement($author_label); |
|
| 193 | + $question_text = new \XoopsFormText(_MD_NEWBB_POLL_POLLQUESTION, 'question', 50, 255, $pollObject->getVar('question', 'E')); |
|
| 194 | + $poll_form->addElement($question_text); |
|
| 195 | + $desc_tarea = new \XoopsFormTextarea(_MD_NEWBB_POLL_POLLDESC, 'description', $pollObject->getVar('description', 'E')); |
|
| 196 | + $poll_form->addElement($desc_tarea); |
|
| 197 | + $date = formatTimestamp($pollObject->getVar('end_time'), 'Y-m-d H:i:s'); // important "Y-m-d H:i:s" use in jdf function |
|
| 198 | + if (!$pollObject->hasExpired()) { |
|
| 199 | + $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); |
|
| 200 | + $poll_form->addElement($expire_text); |
|
| 201 | + } else { |
|
| 202 | + // irmtfan full URL - add topic_id |
|
| 203 | + $restart_label = new \XoopsFormLabel( |
|
| 204 | + _MD_NEWBB_POLL_EXPIRATION, |
|
| 205 | + 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>' |
|
| 206 | + ); |
|
| 207 | + $poll_form->addElement($restart_label); |
|
| 208 | + } |
|
| 209 | + $weight_text = new \XoopsFormText(_MD_NEWBB_POLL_DISPLAYORDER, 'weight', 6, 5, $pollObject->getVar('weight')); |
|
| 210 | + $poll_form->addElement($weight_text); |
|
| 211 | + $multi_yn = new \XoopsFormRadioYN(_MD_NEWBB_POLL_ALLOWMULTI, 'multiple', $pollObject->getVar('multiple')); |
|
| 212 | + $poll_form->addElement($multi_yn); |
|
| 213 | + $options_arr =& $classOption::getAllByPollId($poll_id); |
|
| 214 | + $notify_value = 1; |
|
| 215 | + if (0 !== $pollObject->getVar('mail_status')) { |
|
| 216 | + $notify_value = 0; |
|
| 217 | + } |
|
| 218 | + $notify_yn = new \XoopsFormRadioYN(_MD_NEWBB_POLL_NOTIFY, 'notify', $notify_value); |
|
| 219 | + $poll_form->addElement($notify_yn); |
|
| 220 | + $option_tray = new \XoopsFormElementTray(_MD_NEWBB_POLL_POLLOPTIONS, ''); |
|
| 221 | + $barcolor_array = \XoopsLists::getImgListAsArray($GLOBALS['xoops']->path("modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/assets/images/colorbars/")); |
|
| 222 | + $i = 0; |
|
| 223 | + foreach ($options_arr as $option) { |
|
| 224 | + /** @var \XoopsPoll $option */ |
|
| 225 | + $option_tray->addElement(new \XoopsFormText('', 'option_text[]', 50, 255, $option->getVar('option_text'))); |
|
| 226 | + $option_tray->addElement(new \XoopsFormHidden('option_id[]', $option->getVar('option_id'))); |
|
| 227 | + $color_select = new \XoopsFormSelect('', 'option_color[{$i}]', $option->getVar('option_color')); |
|
| 228 | + $color_select->addOptionArray($barcolor_array); |
|
| 229 | + $color_select->setExtra("onchange='showImgSelected(\"option_color_image[{$i}]\", \"option_color[" . $i . "]\", \"modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/assets/images/colorbars\", \"\", \"" . XOOPS_URL . "\")'"); |
|
| 230 | + $color_label = new \XoopsFormLabel('', "<img src='" |
|
| 231 | + . $GLOBALS['xoops']->url("modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/assets/images/colorbars/" . $option->getVar('option_color', 'E')) |
|
| 232 | + . "' name='option_color_image[{$i}]' id='option_color_image[{$i}]' class='alignbottom' width='30' height='15' alt='' /><br>"); |
|
| 233 | + $option_tray->addElement($color_select); |
|
| 234 | + $option_tray->addElement($color_label); |
|
| 235 | + unset($color_select, $color_label); |
|
| 236 | + ++$i; |
|
| 237 | + } |
|
| 238 | + // irmtfan full URL |
|
| 239 | + $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>'); |
|
| 240 | + $option_tray->addElement($more_label); |
|
| 241 | + $poll_form->addElement($option_tray); |
|
| 242 | + $poll_form->addElement(new \XoopsFormHidden('op', 'update')); |
|
| 243 | + $poll_form->addElement(new \XoopsFormHidden('topic_id', $topic_id)); |
|
| 244 | + $poll_form->addElement(new \XoopsFormHidden('poll_id', $poll_id)); |
|
| 245 | + $poll_form->addElement(new \XoopsFormButtonTray('poll_submit', _SUBMIT, 'submit')); |
|
| 246 | + |
|
| 247 | + echo '<h4>' . _MD_NEWBB_POLL_POLLCONF . "</h4>\n"; |
|
| 248 | + $poll_form->display(); |
|
| 237 | 249 | } |
| 238 | - // irmtfan full URL |
|
| 239 | - $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>'); |
|
| 240 | - $option_tray->addElement($more_label); |
|
| 241 | - $poll_form->addElement($option_tray); |
|
| 242 | - $poll_form->addElement(new \XoopsFormHidden('op', 'update')); |
|
| 243 | - $poll_form->addElement(new \XoopsFormHidden('topic_id', $topic_id)); |
|
| 244 | - $poll_form->addElement(new \XoopsFormHidden('poll_id', $poll_id)); |
|
| 245 | - $poll_form->addElement(new \XoopsFormButtonTray('poll_submit', _SUBMIT, 'submit')); |
|
| 250 | + break; // op: edit |
|
| 246 | 251 | |
| 247 | - echo '<h4>' . _MD_NEWBB_POLL_POLLCONF . "</h4>\n"; |
|
| 248 | - $poll_form->display(); |
|
| 249 | - } |
|
| 250 | - break; // op: edit |
|
| 252 | + case 'save': |
|
| 253 | + // old xoopspoll or umfrage or any clone from them |
|
| 254 | + if ($pollModuleHandler->getVar('version') < 140) { |
|
| 255 | + // check security token |
|
| 256 | + if (!$GLOBALS['xoopsSecurity']->check()) { |
|
| 257 | + redirect_header(Request::getString('PHP_SELF', '', 'SERVER'), 2, implode('<br>', $GLOBALS['xoopsSecurity']->getErrors())); |
|
| 258 | + } |
|
| 259 | + /* |
|
| 260 | + * The option check should be done before submitting |
|
| 261 | + */ |
|
| 262 | + $option_empty = true; |
|
| 263 | + if (!Request::getString('option_text', '', 'POST')) { |
|
| 264 | + // irmtfan - issue with javascript:history.go(-1) |
|
| 265 | + redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 2, _MD_NEWBB_ERROROCCURED . ': ' . _MD_NEWBB_POLL_POLLOPTIONS . ' !'); |
|
| 266 | + } |
|
| 267 | + $option_text = Request::getArray('option_text', '', 'POST'); |
|
| 268 | + foreach ($option_text as $optxt) { |
|
| 269 | + if ('' !== trim($optxt)) { |
|
| 270 | + $option_empty = false; |
|
| 271 | + break; |
|
| 272 | + } |
|
| 273 | + } |
|
| 274 | + if ($option_empty) { |
|
| 275 | + // irmtfan - issue with javascript:history.go(-1) |
|
| 276 | + redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 2, _MD_NEWBB_ERROROCCURED . ': ' . _MD_NEWBB_POLL_POLLOPTIONS . ' !'); |
|
| 277 | + } |
|
| 278 | + $pollObject->setVar('question', Request::getString('question', '', 'POST')); |
|
| 279 | + $pollObject->setVar('description', Request::getString('description', '', 'POST')); |
|
| 280 | + $end_time = Request::getString('end_time', '', 'POST'); // (empty($_POST['end_time'])) ? "" : $_POST['end_time']; |
|
| 281 | + if ('' !== $end_time) { |
|
| 282 | + $timezone = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('timezone') : null; |
|
| 283 | + $pollObject->setVar('end_time', userTimeToServerTime(method_exists('XoopsLocal', 'strtotime') ? XoopsLocal::strtotime($end_time) : strtotime($end_time), $timezone)); |
|
| 284 | + } else { |
|
| 285 | + // if expiration date is not set, set it to 10 days from now |
|
| 286 | + $pollObject->setVar('end_time', time() + (86400 * 10)); |
|
| 287 | + } |
|
| 251 | 288 | |
| 252 | - case 'save': |
|
| 253 | - // old xoopspoll or umfrage or any clone from them |
|
| 254 | - if ($pollModuleHandler->getVar('version') < 140) { |
|
| 289 | + $pollObject->setVar('display', 0); |
|
| 290 | + $pollObject->setVar('weight', Request::getInt('weight', 0, 'POST')); |
|
| 291 | + $pollObject->setVar('multiple', Request::getInt('multiple', 0, 'POST')); |
|
| 292 | + $pollObject->setVar('user_id', Request::getInt('user_id', 0, 'POST')); |
|
| 293 | + if (Request::getInt('notify', 0, 'POST') && $end_time > time()) { |
|
| 294 | + // if notify, set mail status to "not mailed" |
|
| 295 | + $pollObject->setVar('mail_status', POLL_NOTMAILED); |
|
| 296 | + } else { |
|
| 297 | + // if not notify, set mail status to already "mailed" |
|
| 298 | + $pollObject->setVar('mail_status', POLL_MAILED); |
|
| 299 | + } |
|
| 300 | + $new_poll_id = $pollObject->store(); |
|
| 301 | + if (empty($new_poll_id)) { |
|
| 302 | + xoops_error($pollObject->getHtmlErrors); |
|
| 303 | + break; |
|
| 304 | + } |
|
| 305 | + $i = 0; |
|
| 306 | + $option_color = Request::getArray('option_color', null, 'POST'); |
|
| 307 | + $classOption = $classPoll . 'Option'; |
|
| 308 | + foreach ($option_text as $optxt) { |
|
| 309 | + $optxt = trim($optxt); |
|
| 310 | + /** @var XoopspollOption $optionObject */ |
|
| 311 | + $optionObject = new $classOption(); |
|
| 312 | + if ('' !== $optxt) { |
|
| 313 | + $optionObject->setVar('option_text', $optxt); |
|
| 314 | + $optionObject->setVar('option_color', $option_color[$i]); |
|
| 315 | + $optionObject->setVar('poll_id', $new_poll_id); |
|
| 316 | + $optionObject->store(); |
|
| 317 | + } |
|
| 318 | + ++$i; |
|
| 319 | + } |
|
| 320 | + // clear the template cache so changes take effect immediately |
|
| 321 | + require_once $GLOBALS['xoops']->path('class/template.php'); |
|
| 322 | + xoops_template_clear_module_cache($GLOBALS['xoopsModule']->getVar('mid')); |
|
| 323 | + xoops_template_clear_module_cache($pollModuleHandler->getVar('mid')); |
|
| 324 | + |
|
| 325 | + // update topic to indicate it has a poll |
|
| 326 | + $topicObject->setVar('topic_haspoll', 1); |
|
| 327 | + $topicObject->setVar('poll_id', $new_poll_id); |
|
| 328 | + $success = $topicHandler->insert($topicObject); |
|
| 329 | + if (!$success) { |
|
| 330 | + xoops_error($topicHandler->getHtmlErrors()); |
|
| 331 | + } else { |
|
| 332 | + redirect_header("viewtopic.php?topic_id={$topic_id}", 2, _MD_NEWBB_POLL_DBUPDATED); |
|
| 333 | + } |
|
| 334 | + break;// op: save |
|
| 335 | + } |
|
| 336 | + // no break |
|
| 337 | + case 'update': |
|
| 255 | 338 | // check security token |
| 256 | 339 | if (!$GLOBALS['xoopsSecurity']->check()) { |
| 257 | 340 | redirect_header(Request::getString('PHP_SELF', '', 'SERVER'), 2, implode('<br>', $GLOBALS['xoopsSecurity']->getErrors())); |
| 258 | 341 | } |
| 259 | - /* |
|
| 260 | - * The option check should be done before submitting |
|
| 261 | - */ |
|
| 262 | - $option_empty = true; |
|
| 263 | - if (!Request::getString('option_text', '', 'POST')) { |
|
| 264 | - // irmtfan - issue with javascript:history.go(-1) |
|
| 342 | + /* make sure there's at least one option */ |
|
| 343 | + $option_text = Request::getString('option_text', '', 'POST'); |
|
| 344 | + $option_string = is_array($option_text) ? implode('', $option_text) : $option_text; |
|
| 345 | + $option_string = trim($option_string); |
|
| 346 | + if ('' === $option_string) { |
|
| 265 | 347 | redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 2, _MD_NEWBB_ERROROCCURED . ': ' . _MD_NEWBB_POLL_POLLOPTIONS . ' !'); |
| 266 | 348 | } |
| 267 | - $option_text = Request::getArray('option_text', '', 'POST'); |
|
| 268 | - foreach ($option_text as $optxt) { |
|
| 269 | - if ('' !== trim($optxt)) { |
|
| 270 | - $option_empty = false; |
|
| 271 | - break; |
|
| 349 | + |
|
| 350 | + // new xoopspoll module |
|
| 351 | + if ($pollModuleHandler->getVar('version') >= 140) { |
|
| 352 | + /** @var \XoopspollOptionHandler $xpOptHandler */ |
|
| 353 | + $xpOptHandler = Xoopspoll\Helper::getInstance()->getHandler('Option'); |
|
| 354 | + /** @var \XoopspollLogHandler $xpLogHandler */ |
|
| 355 | + $xpLogHandler = Xoopspoll\Helper::getInstance()->getHandler('Log'); |
|
| 356 | + // $classRequest = ucfirst($GLOBALS['xoopsModuleConfig']["poll_module"]) . "Request"; |
|
| 357 | + $classConstants = ucfirst($GLOBALS['xoopsModuleConfig']['poll_module']) . 'Constants'; |
|
| 358 | + $notify = Request::getInt('notify', $classConstants::NOTIFICATION_ENABLED, 'POST'); |
|
| 359 | + $currentTimestamp = time(); |
|
| 360 | + //$xuEndTimestamp = method_exists('XoopsLocal', 'strtotime') ? XoopsLocal::strtotime(Request::getString('xu_end_time', null, 'POST')) |
|
| 361 | + // : strtotime(Request::getString('xu_end_time', null, 'POST')); |
|
| 362 | + $xuEndTimestamp = strtotime(Request::getString('xu_end_time', null, 'POST')); |
|
| 363 | + $endTimestamp = (!Request::getString('xu_end_time', null, 'POST')) ? ($currentTimestamp + $classConstants::DEFAULT_POLL_DURATION) : userTimeToServerTime($xuEndTimestamp); |
|
| 364 | + //$xuStartTimestamp = method_exists('XoopsLocal', 'strtotime') ? XoopsLocal::strtotime(Request::getString('xu_start_time', null, 'POST')) |
|
| 365 | + // : strtotime(Request::getString('xu_start_time', null, 'POST')); |
|
| 366 | + $xuStartTimestamp = strtotime(Request::getString('xu_start_time', null, 'POST')); |
|
| 367 | + $startTimestamp = (!Request::getString('xu_start_time', null, 'POST')) ? ($endTimestamp - $classConstants::DEFAULT_POLL_DURATION) : userTimeToServerTime($xuStartTimestamp); |
|
| 368 | + |
|
| 369 | + // don't allow changing start time if there are votes in the log |
|
| 370 | + if (($startTimestamp < $pollObject->getVar('start_time')) |
|
| 371 | + && ($xpLogHandler->getTotalVotesByPollId($poll_id) > 0)) { |
|
| 372 | + $startTimestamp = $pollObject->getVar('start_time'); //don't change start time |
|
| 272 | 373 | } |
| 273 | - } |
|
| 274 | - if ($option_empty) { |
|
| 275 | - // irmtfan - issue with javascript:history.go(-1) |
|
| 276 | - redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 2, _MD_NEWBB_ERROROCCURED . ': ' . _MD_NEWBB_POLL_POLLOPTIONS . ' !'); |
|
| 277 | - } |
|
| 278 | - $pollObject->setVar('question', Request::getString('question', '', 'POST')); |
|
| 279 | - $pollObject->setVar('description', Request::getString('description', '', 'POST')); |
|
| 280 | - $end_time = Request::getString('end_time', '', 'POST'); // (empty($_POST['end_time'])) ? "" : $_POST['end_time']; |
|
| 281 | - if ('' !== $end_time) { |
|
| 282 | - $timezone = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('timezone') : null; |
|
| 283 | - $pollObject->setVar('end_time', userTimeToServerTime(method_exists('XoopsLocal', 'strtotime') ? XoopsLocal::strtotime($end_time) : strtotime($end_time), $timezone)); |
|
| 284 | - } else { |
|
| 285 | - // if expiration date is not set, set it to 10 days from now |
|
| 286 | - $pollObject->setVar('end_time', time() + (86400 * 10)); |
|
| 287 | - } |
|
| 288 | 374 | |
| 289 | - $pollObject->setVar('display', 0); |
|
| 290 | - $pollObject->setVar('weight', Request::getInt('weight', 0, 'POST')); |
|
| 291 | - $pollObject->setVar('multiple', Request::getInt('multiple', 0, 'POST')); |
|
| 292 | - $pollObject->setVar('user_id', Request::getInt('user_id', 0, 'POST')); |
|
| 293 | - if (Request::getInt('notify', 0, 'POST') && $end_time > time()) { |
|
| 294 | - // if notify, set mail status to "not mailed" |
|
| 295 | - $pollObject->setVar('mail_status', POLL_NOTMAILED); |
|
| 375 | + $poll_vars = [ |
|
| 376 | + 'user_id' => Request::getInt('user_id', $GLOBALS['xoopsUser']->uid(), 'POST'), |
|
| 377 | + 'question' => Request::getString('question', null, 'POST'), |
|
| 378 | + 'description' => Request::getText('description', null, 'POST'), |
|
| 379 | + 'mail_status' => ($classConstants::NOTIFICATION_ENABLED == $notify) ? $classConstants::POLL_NOT_MAILED : $classConstants::POLL_MAILED, |
|
| 380 | + 'mail_voter' => Request::getInt('mail_voter', $classConstants::NOT_MAIL_POLL_TO_VOTER, 'POST'), |
|
| 381 | + 'start_time' => $startTimestamp, |
|
| 382 | + 'end_time' => $endTimestamp, |
|
| 383 | + 'display' => Request::getInt('display', $classConstants::DO_NOT_DISPLAY_POLL_IN_BLOCK, 'POST'), |
|
| 384 | + 'visibility' => Request::getInt('visibility', $classConstants::HIDE_NEVER, 'POST'), |
|
| 385 | + 'weight' => Request::getInt('weight', $classConstants::DEFAULT_WEIGHT, 'POST'), |
|
| 386 | + 'multiple' => Request::getInt('multiple', $classConstants::NOT_MULTIPLE_SELECT_POLL, 'POST'), |
|
| 387 | + 'multilimit' => Request::getInt('multilimit', $classConstants::MULTIPLE_SELECT_LIMITLESS, 'POST'), |
|
| 388 | + 'anonymous' => Request::getInt('anonymous', $classConstants::ANONYMOUS_VOTING_DISALLOWED, 'POST') |
|
| 389 | + ]; |
|
| 390 | + $pollObject->setVars($poll_vars); |
|
| 391 | + $poll_id = $xpPollHandler->insert($pollObject); |
|
| 392 | + if (!$poll_id) { |
|
| 393 | + $err = $pollObject->getHtmlErrors(); |
|
| 394 | + exit($err); |
|
| 395 | + } |
|
| 396 | + |
|
| 397 | + // now get the options |
|
| 398 | + $optionIdArray = Request::getArray('option_id', [], 'POST'); |
|
| 399 | + $optionIdArray = array_map('intval', $optionIdArray); |
|
| 400 | + $optionTextArray = Request::getArray('option_text', [], 'POST'); |
|
| 401 | + $optionColorArray = Request::getArray('option_color', [], 'POST'); |
|
| 402 | + |
|
| 403 | + foreach ($optionIdArray as $key => $oId) { |
|
| 404 | + if (!empty($oId) && ($optionObject = $xpOptHandler->get($oId))) { |
|
| 405 | + // existing option object so need to update it |
|
| 406 | + $optionTextArray[$key] = trim($optionTextArray[$key]); |
|
| 407 | + if ('' === $optionTextArray[$key]) { |
|
| 408 | + // want to delete this option |
|
| 409 | + if (false !== $xpOptHandler->delete($optionObject)) { |
|
| 410 | + // now remove it from the log |
|
| 411 | + $xpLogHandler->deleteByOptionId($optionObject->getVar('option_id')); |
|
| 412 | + //update vote count in poll |
|
| 413 | + $xpPollHandler->updateCount($pollObject); |
|
| 414 | + } else { |
|
| 415 | + xoops_error($xpLogHandler->getHtmlErrors()); |
|
| 416 | + break; |
|
| 417 | + } |
|
| 418 | + } else { |
|
| 419 | + $optionObject->setVar('option_text', $optionTextArray[$key]); |
|
| 420 | + $optionObject->setVar('option_color', $optionColorArray[$key]); |
|
| 421 | + $optionObject->setVar('poll_id', $poll_id); |
|
| 422 | + $xpOptHandler->insert($optionObject); |
|
| 423 | + } |
|
| 424 | + } else { |
|
| 425 | + // new option object |
|
| 426 | + $optionObject = $xpOptHandler->create(); |
|
| 427 | + $optionTextArray[$key] = trim($optionTextArray[$key]); |
|
| 428 | + if ('' !== $optionTextArray[$key]) { // ignore if text is empty |
|
| 429 | + $optionObject->setVar('option_text', $optionTextArray[$key]); |
|
| 430 | + $optionObject->setVar('option_color', $optionColorArray[$key]); |
|
| 431 | + $optionObject->setVar('poll_id', $poll_id); |
|
| 432 | + $xpOptHandler->insert($optionObject); |
|
| 433 | + } |
|
| 434 | + unset($optionObject); |
|
| 435 | + } |
|
| 436 | + } |
|
| 437 | + // old xoopspoll or umfrage or any clone from them |
|
| 296 | 438 | } else { |
| 297 | - // if not notify, set mail status to already "mailed" |
|
| 298 | - $pollObject->setVar('mail_status', POLL_MAILED); |
|
| 299 | - } |
|
| 300 | - $new_poll_id = $pollObject->store(); |
|
| 301 | - if (empty($new_poll_id)) { |
|
| 302 | - xoops_error($pollObject->getHtmlErrors); |
|
| 303 | - break; |
|
| 304 | - } |
|
| 305 | - $i = 0; |
|
| 306 | - $option_color = Request::getArray('option_color', null, 'POST'); |
|
| 307 | - $classOption = $classPoll . 'Option'; |
|
| 308 | - foreach ($option_text as $optxt) { |
|
| 309 | - $optxt = trim($optxt); |
|
| 310 | - /** @var XoopspollOption $optionObject */ |
|
| 311 | - $optionObject = new $classOption(); |
|
| 312 | - if ('' !== $optxt) { |
|
| 313 | - $optionObject->setVar('option_text', $optxt); |
|
| 314 | - $optionObject->setVar('option_color', $option_color[$i]); |
|
| 315 | - $optionObject->setVar('poll_id', $new_poll_id); |
|
| 316 | - $optionObject->store(); |
|
| 439 | + $pollObject->setVar('question', Request::getString('question', '', 'POST')); |
|
| 440 | + $pollObject->setVar('description', Request::getString('description', '', 'POST')); |
|
| 441 | + |
|
| 442 | + $end_time = Request::getString('end_time', '', 'POST'); |
|
| 443 | + if ('' !== $end_time) { |
|
| 444 | + $timezone = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('timezone') : null; |
|
| 445 | + $pollObject->setVar('end_time', userTimeToServerTime(method_exists('XoopsLocal', 'strtotime') ? XoopsLocal::strtotime($end_time) : strtotime($end_time), $timezone)); |
|
| 317 | 446 | } |
| 318 | - ++$i; |
|
| 447 | + $pollObject->setVar('display', 0); |
|
| 448 | + $pollObject->setVar('weight', Request::getInt('weight', 0, 'POST')); |
|
| 449 | + $pollObject->setVar('multiple', Request::getInt('multiple', 0, 'POST')); |
|
| 450 | + $pollObject->setVar('user_id', Request::getInt('user_id', 0, 'POST')); |
|
| 451 | + if (Request::getInt('notify', 0, 'POST') && $end_time > time()) { |
|
| 452 | + // if notify, set mail status to "not mailed" |
|
| 453 | + $pollObject->setVar('mail_status', POLL_NOTMAILED); |
|
| 454 | + } else { |
|
| 455 | + // if not notify, set mail status to already "mailed" |
|
| 456 | + $pollObject->setVar('mail_status', POLL_MAILED); |
|
| 457 | + } |
|
| 458 | + |
|
| 459 | + if (!$pollObject->store()) { |
|
| 460 | + xoops_error($pollObject->getHtmlErrors); |
|
| 461 | + break; |
|
| 462 | + } |
|
| 463 | + $i = 0; |
|
| 464 | + $option_id = Request::getArray('option_id', null, 'POST'); |
|
| 465 | + $option_color = Request::getArray('option_color', null, 'POST'); |
|
| 466 | + $classOption = $classPoll . 'Option'; |
|
| 467 | + $classLog = $classPoll . 'Log'; |
|
| 468 | + foreach ($option_id as $opid) { |
|
| 469 | + $optionObject = new $classOption($opid); |
|
| 470 | + $option_text[$i] = trim($option_text[$i]); |
|
| 471 | + if ('' !== $option_text[$i]) { |
|
| 472 | + $optionObject->setVar('option_text', $option_text[$i]); |
|
| 473 | + $optionObject->setVar('option_color', $option_color[$i]); |
|
| 474 | + $optionObject->store(); |
|
| 475 | + } else { |
|
| 476 | + if (false !== $optionObject->delete()) { |
|
| 477 | + $classLog::deleteByOptionId($option->getVar('option_id')); |
|
| 478 | + } |
|
| 479 | + } |
|
| 480 | + ++$i; |
|
| 481 | + } |
|
| 482 | + $pollObject->updateCount(); |
|
| 319 | 483 | } |
| 320 | 484 | // clear the template cache so changes take effect immediately |
| 321 | 485 | require_once $GLOBALS['xoops']->path('class/template.php'); |
@@ -324,433 +488,269 @@ discard block |
||
| 324 | 488 | |
| 325 | 489 | // update topic to indicate it has a poll |
| 326 | 490 | $topicObject->setVar('topic_haspoll', 1); |
| 327 | - $topicObject->setVar('poll_id', $new_poll_id); |
|
| 491 | + $topicObject->setVar('poll_id', $pollObject->getVar('poll_id')); |
|
| 328 | 492 | $success = $topicHandler->insert($topicObject); |
| 329 | 493 | if (!$success) { |
| 330 | 494 | xoops_error($topicHandler->getHtmlErrors()); |
| 331 | 495 | } else { |
| 332 | 496 | redirect_header("viewtopic.php?topic_id={$topic_id}", 2, _MD_NEWBB_POLL_DBUPDATED); |
| 333 | 497 | } |
| 334 | - break;// op: save |
|
| 335 | - } |
|
| 336 | - // no break |
|
| 337 | - case 'update': |
|
| 338 | - // check security token |
|
| 339 | - if (!$GLOBALS['xoopsSecurity']->check()) { |
|
| 340 | - redirect_header(Request::getString('PHP_SELF', '', 'SERVER'), 2, implode('<br>', $GLOBALS['xoopsSecurity']->getErrors())); |
|
| 341 | - } |
|
| 342 | - /* make sure there's at least one option */ |
|
| 343 | - $option_text = Request::getString('option_text', '', 'POST'); |
|
| 344 | - $option_string = is_array($option_text) ? implode('', $option_text) : $option_text; |
|
| 345 | - $option_string = trim($option_string); |
|
| 346 | - if ('' === $option_string) { |
|
| 347 | - redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 2, _MD_NEWBB_ERROROCCURED . ': ' . _MD_NEWBB_POLL_POLLOPTIONS . ' !'); |
|
| 348 | - } |
|
| 349 | - |
|
| 350 | - // new xoopspoll module |
|
| 351 | - if ($pollModuleHandler->getVar('version') >= 140) { |
|
| 352 | - /** @var \XoopspollOptionHandler $xpOptHandler */ |
|
| 353 | - $xpOptHandler = Xoopspoll\Helper::getInstance()->getHandler('Option'); |
|
| 354 | - /** @var \XoopspollLogHandler $xpLogHandler */ |
|
| 355 | - $xpLogHandler = Xoopspoll\Helper::getInstance()->getHandler('Log'); |
|
| 356 | - // $classRequest = ucfirst($GLOBALS['xoopsModuleConfig']["poll_module"]) . "Request"; |
|
| 357 | - $classConstants = ucfirst($GLOBALS['xoopsModuleConfig']['poll_module']) . 'Constants'; |
|
| 358 | - $notify = Request::getInt('notify', $classConstants::NOTIFICATION_ENABLED, 'POST'); |
|
| 359 | - $currentTimestamp = time(); |
|
| 360 | - //$xuEndTimestamp = method_exists('XoopsLocal', 'strtotime') ? XoopsLocal::strtotime(Request::getString('xu_end_time', null, 'POST')) |
|
| 361 | - // : strtotime(Request::getString('xu_end_time', null, 'POST')); |
|
| 362 | - $xuEndTimestamp = strtotime(Request::getString('xu_end_time', null, 'POST')); |
|
| 363 | - $endTimestamp = (!Request::getString('xu_end_time', null, 'POST')) ? ($currentTimestamp + $classConstants::DEFAULT_POLL_DURATION) : userTimeToServerTime($xuEndTimestamp); |
|
| 364 | - //$xuStartTimestamp = method_exists('XoopsLocal', 'strtotime') ? XoopsLocal::strtotime(Request::getString('xu_start_time', null, 'POST')) |
|
| 365 | - // : strtotime(Request::getString('xu_start_time', null, 'POST')); |
|
| 366 | - $xuStartTimestamp = strtotime(Request::getString('xu_start_time', null, 'POST')); |
|
| 367 | - $startTimestamp = (!Request::getString('xu_start_time', null, 'POST')) ? ($endTimestamp - $classConstants::DEFAULT_POLL_DURATION) : userTimeToServerTime($xuStartTimestamp); |
|
| 368 | - |
|
| 369 | - // don't allow changing start time if there are votes in the log |
|
| 370 | - if (($startTimestamp < $pollObject->getVar('start_time')) |
|
| 371 | - && ($xpLogHandler->getTotalVotesByPollId($poll_id) > 0)) { |
|
| 372 | - $startTimestamp = $pollObject->getVar('start_time'); //don't change start time |
|
| 498 | + break;// op: save | update |
|
| 499 | + |
|
| 500 | + case 'addmore': |
|
| 501 | + $question = $pollObject->getVar('question'); |
|
| 502 | + unset($pollObject); |
|
| 503 | + $poll_form = new \XoopsThemeForm(_MD_NEWBB_POLL_ADDMORE, 'poll_form', 'polls.php', 'post', true); |
|
| 504 | + $poll_form->addElement(new \XoopsFormLabel(_MD_NEWBB_POLL_POLLQUESTION, $question)); |
|
| 505 | + // new xoopspoll module |
|
| 506 | + if ($pollModuleHandler->getVar('version') >= 140) { |
|
| 507 | + $xpOptHandler = Xoopspoll\Helper::getInstance()->getHandler('Option'); |
|
| 508 | + $option_tray = $xpOptHandler->renderOptionFormTray($poll_id); |
|
| 509 | + // old xoopspoll or umfrage or any clone from them |
|
| 510 | + } else { |
|
| 511 | + $option_tray = new \XoopsFormElementTray(_MD_NEWBB_POLL_POLLOPTIONS, ''); |
|
| 512 | + $barcolor_array = \XoopsLists::getImgListAsArray($GLOBALS['xoops']->path('modules/' . $GLOBALS['xoopsModuleConfig']['poll_module'] . '/assets/images/colorbars/')); |
|
| 513 | + for ($i = 0; $i < 10; ++$i) { |
|
| 514 | + $current_bar = ('blank.gif' !== current($barcolor_array)) ? current($barcolor_array) : next($barcolor_array); |
|
| 515 | + $option_text = new \XoopsFormText('', 'option_text[]', 50, 255); |
|
| 516 | + $option_tray->addElement($option_text); |
|
| 517 | + $color_select = new \XoopsFormSelect('', "option_color[{$i}]", $current_bar); |
|
| 518 | + $color_select->addOptionArray($barcolor_array); |
|
| 519 | + $color_select->setExtra("onchange='showImgSelected(\"option_color_image[{$i}]\", \"option_color[{$i}]\", \"modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/assets/images/colorbars\", \"\", \"" . XOOPS_URL . "\")'"); |
|
| 520 | + $color_label = new \XoopsFormLabel('', "<img src='" |
|
| 521 | + . $GLOBALS['xoops']->url("modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/assets/images/colorbars/{$current_bar}") |
|
| 522 | + . "' name='option_color_image[{$i}]' id='option_color_image[{$i}]' class='alignbottom' width='30' height='15' alt='' /><br>"); |
|
| 523 | + $option_tray->addElement($color_select); |
|
| 524 | + $option_tray->addElement($color_label); |
|
| 525 | + unset($color_select, $color_label, $option_text); |
|
| 526 | + if (!next($barcolor_array)) { |
|
| 527 | + reset($barcolor_array); |
|
| 528 | + } |
|
| 529 | + } |
|
| 373 | 530 | } |
| 531 | + $poll_form->addElement($option_tray); |
|
| 532 | + $poll_form->addElement(new \XoopsFormButtonTray('poll_submit', _SUBMIT, 'submit')); |
|
| 533 | + $poll_form->addElement(new \XoopsFormHidden('op', 'savemore')); |
|
| 534 | + $poll_form->addElement(new \XoopsFormHidden('topic_id', $topic_id)); |
|
| 535 | + $poll_form->addElement(new \XoopsFormHidden('poll_id', $poll_id)); |
|
| 374 | 536 | |
| 375 | - $poll_vars = [ |
|
| 376 | - 'user_id' => Request::getInt('user_id', $GLOBALS['xoopsUser']->uid(), 'POST'), |
|
| 377 | - 'question' => Request::getString('question', null, 'POST'), |
|
| 378 | - 'description' => Request::getText('description', null, 'POST'), |
|
| 379 | - 'mail_status' => ($classConstants::NOTIFICATION_ENABLED == $notify) ? $classConstants::POLL_NOT_MAILED : $classConstants::POLL_MAILED, |
|
| 380 | - 'mail_voter' => Request::getInt('mail_voter', $classConstants::NOT_MAIL_POLL_TO_VOTER, 'POST'), |
|
| 381 | - 'start_time' => $startTimestamp, |
|
| 382 | - 'end_time' => $endTimestamp, |
|
| 383 | - 'display' => Request::getInt('display', $classConstants::DO_NOT_DISPLAY_POLL_IN_BLOCK, 'POST'), |
|
| 384 | - 'visibility' => Request::getInt('visibility', $classConstants::HIDE_NEVER, 'POST'), |
|
| 385 | - 'weight' => Request::getInt('weight', $classConstants::DEFAULT_WEIGHT, 'POST'), |
|
| 386 | - 'multiple' => Request::getInt('multiple', $classConstants::NOT_MULTIPLE_SELECT_POLL, 'POST'), |
|
| 387 | - 'multilimit' => Request::getInt('multilimit', $classConstants::MULTIPLE_SELECT_LIMITLESS, 'POST'), |
|
| 388 | - 'anonymous' => Request::getInt('anonymous', $classConstants::ANONYMOUS_VOTING_DISALLOWED, 'POST') |
|
| 389 | - ]; |
|
| 390 | - $pollObject->setVars($poll_vars); |
|
| 391 | - $poll_id = $xpPollHandler->insert($pollObject); |
|
| 392 | - if (!$poll_id) { |
|
| 393 | - $err = $pollObject->getHtmlErrors(); |
|
| 394 | - exit($err); |
|
| 537 | + echo '<h4>' . _MD_NEWBB_POLL_POLLCONF . "</h4>\n"; |
|
| 538 | + $poll_form->display(); |
|
| 539 | + break; |
|
| 540 | + |
|
| 541 | + case 'savemore': |
|
| 542 | + // check security token |
|
| 543 | + if (!$GLOBALS['xoopsSecurity']->check()) { |
|
| 544 | + redirect_header(Request::getString('PHP_SELF', '', 'SERVER'), 2, implode('<br>', $GLOBALS['xoopsSecurity']->getErrors())); |
|
| 395 | 545 | } |
| 396 | 546 | |
| 397 | - // now get the options |
|
| 398 | - $optionIdArray = Request::getArray('option_id', [], 'POST'); |
|
| 399 | - $optionIdArray = array_map('intval', $optionIdArray); |
|
| 400 | - $optionTextArray = Request::getArray('option_text', [], 'POST'); |
|
| 401 | - $optionColorArray = Request::getArray('option_color', [], 'POST'); |
|
| 402 | - |
|
| 403 | - foreach ($optionIdArray as $key => $oId) { |
|
| 404 | - if (!empty($oId) && ($optionObject = $xpOptHandler->get($oId))) { |
|
| 405 | - // existing option object so need to update it |
|
| 406 | - $optionTextArray[$key] = trim($optionTextArray[$key]); |
|
| 407 | - if ('' === $optionTextArray[$key]) { |
|
| 408 | - // want to delete this option |
|
| 409 | - if (false !== $xpOptHandler->delete($optionObject)) { |
|
| 410 | - // now remove it from the log |
|
| 411 | - $xpLogHandler->deleteByOptionId($optionObject->getVar('option_id')); |
|
| 412 | - //update vote count in poll |
|
| 413 | - $xpPollHandler->updateCount($pollObject); |
|
| 414 | - } else { |
|
| 415 | - xoops_error($xpLogHandler->getHtmlErrors()); |
|
| 416 | - break; |
|
| 417 | - } |
|
| 418 | - } else { |
|
| 419 | - $optionObject->setVar('option_text', $optionTextArray[$key]); |
|
| 420 | - $optionObject->setVar('option_color', $optionColorArray[$key]); |
|
| 547 | + $option_text = Request::getString('option_text', '', 'POST'); |
|
| 548 | + $option_string = is_array($option_text) ? implode('', $option_text) : $option_text; |
|
| 549 | + $option_string = trim($option_string); |
|
| 550 | + if ('' === $option_string) { |
|
| 551 | + // irmtfan - issue with javascript:history.go(-1) |
|
| 552 | + redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 2, _MD_NEWBB_ERROROCCURED . ': ' . _MD_NEWBB_POLL_POLLOPTIONS . ' !'); |
|
| 553 | + } |
|
| 554 | + $i = 0; |
|
| 555 | + $option_color = Request::getArray('option_color', null, 'POST'); |
|
| 556 | + foreach ($option_text as $optxt) { |
|
| 557 | + $optxt = trim($optxt); |
|
| 558 | + if ('' !== $optxt) { |
|
| 559 | + // new xoopspoll module |
|
| 560 | + if ($pollModuleHandler->getVar('version') >= 140) { |
|
| 561 | + $xpOptHandler = Xoopspoll\Helper::getInstance()->getHandler('Option'); |
|
| 562 | + $optionObject = $xpOptHandler->create(); |
|
| 563 | + $optionObject->setVar('option_text', $optxt); |
|
| 421 | 564 | $optionObject->setVar('poll_id', $poll_id); |
| 565 | + $optionObject->setVar('option_color', $option_color[$i]); |
|
| 422 | 566 | $xpOptHandler->insert($optionObject); |
| 423 | - } |
|
| 424 | - } else { |
|
| 425 | - // new option object |
|
| 426 | - $optionObject = $xpOptHandler->create(); |
|
| 427 | - $optionTextArray[$key] = trim($optionTextArray[$key]); |
|
| 428 | - if ('' !== $optionTextArray[$key]) { // ignore if text is empty |
|
| 429 | - $optionObject->setVar('option_text', $optionTextArray[$key]); |
|
| 430 | - $optionObject->setVar('option_color', $optionColorArray[$key]); |
|
| 567 | + // old xoopspoll or umfrage or any clone from them |
|
| 568 | + } else { |
|
| 569 | + $classOption = $classPoll . 'Option'; |
|
| 570 | + $optionObject = new $classOption(); |
|
| 571 | + $optionObject->setVar('option_text', $optxt); |
|
| 431 | 572 | $optionObject->setVar('poll_id', $poll_id); |
| 432 | - $xpOptHandler->insert($optionObject); |
|
| 573 | + $optionObject->setVar('option_color', $option_color[$i]); |
|
| 574 | + $optionObject->store(); |
|
| 433 | 575 | } |
| 434 | 576 | unset($optionObject); |
| 435 | 577 | } |
| 578 | + ++$i; |
|
| 436 | 579 | } |
| 437 | - // old xoopspoll or umfrage or any clone from them |
|
| 438 | - } else { |
|
| 439 | - $pollObject->setVar('question', Request::getString('question', '', 'POST')); |
|
| 440 | - $pollObject->setVar('description', Request::getString('description', '', 'POST')); |
|
| 580 | + require_once $GLOBALS['xoops']->path('class/template.php'); |
|
| 581 | + xoops_template_clear_module_cache($GLOBALS['xoopsModule']->getVar('mid')); |
|
| 582 | + xoops_template_clear_module_cache($pollModuleHandler->getVar('mid')); |
|
| 583 | + redirect_header("polls.php?op=edit&poll_id={$poll_id}&topic_id={$topic_id}", 2, _MD_NEWBB_POLL_DBUPDATED); |
|
| 584 | + break; |
|
| 441 | 585 | |
| 442 | - $end_time = Request::getString('end_time', '', 'POST'); |
|
| 443 | - if ('' !== $end_time) { |
|
| 444 | - $timezone = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('timezone') : null; |
|
| 445 | - $pollObject->setVar('end_time', userTimeToServerTime(method_exists('XoopsLocal', 'strtotime') ? XoopsLocal::strtotime($end_time) : strtotime($end_time), $timezone)); |
|
| 446 | - } |
|
| 447 | - $pollObject->setVar('display', 0); |
|
| 448 | - $pollObject->setVar('weight', Request::getInt('weight', 0, 'POST')); |
|
| 449 | - $pollObject->setVar('multiple', Request::getInt('multiple', 0, 'POST')); |
|
| 450 | - $pollObject->setVar('user_id', Request::getInt('user_id', 0, 'POST')); |
|
| 451 | - if (Request::getInt('notify', 0, 'POST') && $end_time > time()) { |
|
| 452 | - // if notify, set mail status to "not mailed" |
|
| 453 | - $pollObject->setVar('mail_status', POLL_NOTMAILED); |
|
| 454 | - } else { |
|
| 455 | - // if not notify, set mail status to already "mailed" |
|
| 456 | - $pollObject->setVar('mail_status', POLL_MAILED); |
|
| 457 | - } |
|
| 586 | + case 'delete': |
|
| 587 | + echo '<h4>' . _MD_NEWBB_POLL_POLLCONF . "</h4>\n"; |
|
| 588 | + xoops_confirm(['op' => 'delete_ok', 'topic_id' => $topic_id, 'poll_id' => $poll_id], 'polls.php', sprintf(_MD_NEWBB_POLL_RUSUREDEL, $pollObject->getVar('question'))); |
|
| 589 | + break; |
|
| 458 | 590 | |
| 459 | - if (!$pollObject->store()) { |
|
| 460 | - xoops_error($pollObject->getHtmlErrors); |
|
| 461 | - break; |
|
| 591 | + case 'delete_ok': |
|
| 592 | + // check security token |
|
| 593 | + if (!$GLOBALS['xoopsSecurity']->check()) { |
|
| 594 | + redirect_header(Request::getString('PHP_SELF', '', 'SERVER'), 2, implode('<br>', $GLOBALS['xoopsSecurity']->getErrors())); |
|
| 462 | 595 | } |
| 463 | - $i = 0; |
|
| 464 | - $option_id = Request::getArray('option_id', null, 'POST'); |
|
| 465 | - $option_color = Request::getArray('option_color', null, 'POST'); |
|
| 466 | - $classOption = $classPoll . 'Option'; |
|
| 467 | - $classLog = $classPoll . 'Log'; |
|
| 468 | - foreach ($option_id as $opid) { |
|
| 469 | - $optionObject = new $classOption($opid); |
|
| 470 | - $option_text[$i] = trim($option_text[$i]); |
|
| 471 | - if ('' !== $option_text[$i]) { |
|
| 472 | - $optionObject->setVar('option_text', $option_text[$i]); |
|
| 473 | - $optionObject->setVar('option_color', $option_color[$i]); |
|
| 474 | - $optionObject->store(); |
|
| 596 | + //try and delete the poll |
|
| 597 | + // new xoopspoll module |
|
| 598 | + if ($pollModuleHandler->getVar('version') >= 140) { |
|
| 599 | + $status = $xpPollHandler->delete($pollObject); |
|
| 600 | + if (false !== $status) { |
|
| 601 | + $xpOptHandler = Xoopspoll\Helper::getInstance()->getHandler('Option'); |
|
| 602 | + $xpLogHandler = Xoopspoll\Helper::getInstance()->getHandler('Log'); |
|
| 603 | + $xpOptHandler->deleteByPollId($poll_id); |
|
| 604 | + $xpLogHandler->deleteByPollId($poll_id); |
|
| 475 | 605 | } else { |
| 476 | - if (false !== $optionObject->delete()) { |
|
| 477 | - $classLog::deleteByOptionId($option->getVar('option_id')); |
|
| 478 | - } |
|
| 479 | - } |
|
| 480 | - ++$i; |
|
| 481 | - } |
|
| 482 | - $pollObject->updateCount(); |
|
| 483 | - } |
|
| 484 | - // clear the template cache so changes take effect immediately |
|
| 485 | - require_once $GLOBALS['xoops']->path('class/template.php'); |
|
| 486 | - xoops_template_clear_module_cache($GLOBALS['xoopsModule']->getVar('mid')); |
|
| 487 | - xoops_template_clear_module_cache($pollModuleHandler->getVar('mid')); |
|
| 488 | - |
|
| 489 | - // update topic to indicate it has a poll |
|
| 490 | - $topicObject->setVar('topic_haspoll', 1); |
|
| 491 | - $topicObject->setVar('poll_id', $pollObject->getVar('poll_id')); |
|
| 492 | - $success = $topicHandler->insert($topicObject); |
|
| 493 | - if (!$success) { |
|
| 494 | - xoops_error($topicHandler->getHtmlErrors()); |
|
| 495 | - } else { |
|
| 496 | - redirect_header("viewtopic.php?topic_id={$topic_id}", 2, _MD_NEWBB_POLL_DBUPDATED); |
|
| 497 | - } |
|
| 498 | - break;// op: save | update |
|
| 499 | - |
|
| 500 | - case 'addmore': |
|
| 501 | - $question = $pollObject->getVar('question'); |
|
| 502 | - unset($pollObject); |
|
| 503 | - $poll_form = new \XoopsThemeForm(_MD_NEWBB_POLL_ADDMORE, 'poll_form', 'polls.php', 'post', true); |
|
| 504 | - $poll_form->addElement(new \XoopsFormLabel(_MD_NEWBB_POLL_POLLQUESTION, $question)); |
|
| 505 | - // new xoopspoll module |
|
| 506 | - if ($pollModuleHandler->getVar('version') >= 140) { |
|
| 507 | - $xpOptHandler = Xoopspoll\Helper::getInstance()->getHandler('Option'); |
|
| 508 | - $option_tray = $xpOptHandler->renderOptionFormTray($poll_id); |
|
| 509 | - // old xoopspoll or umfrage or any clone from them |
|
| 510 | - } else { |
|
| 511 | - $option_tray = new \XoopsFormElementTray(_MD_NEWBB_POLL_POLLOPTIONS, ''); |
|
| 512 | - $barcolor_array = \XoopsLists::getImgListAsArray($GLOBALS['xoops']->path('modules/' . $GLOBALS['xoopsModuleConfig']['poll_module'] . '/assets/images/colorbars/')); |
|
| 513 | - for ($i = 0; $i < 10; ++$i) { |
|
| 514 | - $current_bar = ('blank.gif' !== current($barcolor_array)) ? current($barcolor_array) : next($barcolor_array); |
|
| 515 | - $option_text = new \XoopsFormText('', 'option_text[]', 50, 255); |
|
| 516 | - $option_tray->addElement($option_text); |
|
| 517 | - $color_select = new \XoopsFormSelect('', "option_color[{$i}]", $current_bar); |
|
| 518 | - $color_select->addOptionArray($barcolor_array); |
|
| 519 | - $color_select->setExtra("onchange='showImgSelected(\"option_color_image[{$i}]\", \"option_color[{$i}]\", \"modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/assets/images/colorbars\", \"\", \"" . XOOPS_URL . "\")'"); |
|
| 520 | - $color_label = new \XoopsFormLabel('', "<img src='" |
|
| 521 | - . $GLOBALS['xoops']->url("modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/assets/images/colorbars/{$current_bar}") |
|
| 522 | - . "' name='option_color_image[{$i}]' id='option_color_image[{$i}]' class='alignbottom' width='30' height='15' alt='' /><br>"); |
|
| 523 | - $option_tray->addElement($color_select); |
|
| 524 | - $option_tray->addElement($color_label); |
|
| 525 | - unset($color_select, $color_label, $option_text); |
|
| 526 | - if (!next($barcolor_array)) { |
|
| 527 | - reset($barcolor_array); |
|
| 606 | + $msg = $xpPollHandler->getHtmlErrors(); |
|
| 528 | 607 | } |
| 529 | - } |
|
| 530 | - } |
|
| 531 | - $poll_form->addElement($option_tray); |
|
| 532 | - $poll_form->addElement(new \XoopsFormButtonTray('poll_submit', _SUBMIT, 'submit')); |
|
| 533 | - $poll_form->addElement(new \XoopsFormHidden('op', 'savemore')); |
|
| 534 | - $poll_form->addElement(new \XoopsFormHidden('topic_id', $topic_id)); |
|
| 535 | - $poll_form->addElement(new \XoopsFormHidden('poll_id', $poll_id)); |
|
| 536 | - |
|
| 537 | - echo '<h4>' . _MD_NEWBB_POLL_POLLCONF . "</h4>\n"; |
|
| 538 | - $poll_form->display(); |
|
| 539 | - break; |
|
| 540 | - |
|
| 541 | - case 'savemore': |
|
| 542 | - // check security token |
|
| 543 | - if (!$GLOBALS['xoopsSecurity']->check()) { |
|
| 544 | - redirect_header(Request::getString('PHP_SELF', '', 'SERVER'), 2, implode('<br>', $GLOBALS['xoopsSecurity']->getErrors())); |
|
| 545 | - } |
|
| 546 | - |
|
| 547 | - $option_text = Request::getString('option_text', '', 'POST'); |
|
| 548 | - $option_string = is_array($option_text) ? implode('', $option_text) : $option_text; |
|
| 549 | - $option_string = trim($option_string); |
|
| 550 | - if ('' === $option_string) { |
|
| 551 | - // irmtfan - issue with javascript:history.go(-1) |
|
| 552 | - redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 2, _MD_NEWBB_ERROROCCURED . ': ' . _MD_NEWBB_POLL_POLLOPTIONS . ' !'); |
|
| 553 | - } |
|
| 554 | - $i = 0; |
|
| 555 | - $option_color = Request::getArray('option_color', null, 'POST'); |
|
| 556 | - foreach ($option_text as $optxt) { |
|
| 557 | - $optxt = trim($optxt); |
|
| 558 | - if ('' !== $optxt) { |
|
| 559 | - // new xoopspoll module |
|
| 560 | - if ($pollModuleHandler->getVar('version') >= 140) { |
|
| 561 | - $xpOptHandler = Xoopspoll\Helper::getInstance()->getHandler('Option'); |
|
| 562 | - $optionObject = $xpOptHandler->create(); |
|
| 563 | - $optionObject->setVar('option_text', $optxt); |
|
| 564 | - $optionObject->setVar('poll_id', $poll_id); |
|
| 565 | - $optionObject->setVar('option_color', $option_color[$i]); |
|
| 566 | - $xpOptHandler->insert($optionObject); |
|
| 567 | 608 | // old xoopspoll or umfrage or any clone from them |
| 609 | + } else { |
|
| 610 | + $status = $pollObject->delete(); |
|
| 611 | + $classOption = $classPoll . 'Option'; |
|
| 612 | + $classLog = $classPoll . 'Log'; |
|
| 613 | + if (false !== $status) { |
|
| 614 | + $classOption::deleteByPollId($poll_id); |
|
| 615 | + $classLog::deleteByPollId($poll_id); |
|
| 568 | 616 | } else { |
| 569 | - $classOption = $classPoll . 'Option'; |
|
| 570 | - $optionObject = new $classOption(); |
|
| 571 | - $optionObject->setVar('option_text', $optxt); |
|
| 572 | - $optionObject->setVar('poll_id', $poll_id); |
|
| 573 | - $optionObject->setVar('option_color', $option_color[$i]); |
|
| 574 | - $optionObject->store(); |
|
| 617 | + $msg = $pollObject->getHtmlErrors(); |
|
| 575 | 618 | } |
| 576 | - unset($optionObject); |
|
| 577 | 619 | } |
| 578 | - ++$i; |
|
| 579 | - } |
|
| 580 | - require_once $GLOBALS['xoops']->path('class/template.php'); |
|
| 581 | - xoops_template_clear_module_cache($GLOBALS['xoopsModule']->getVar('mid')); |
|
| 582 | - xoops_template_clear_module_cache($pollModuleHandler->getVar('mid')); |
|
| 583 | - redirect_header("polls.php?op=edit&poll_id={$poll_id}&topic_id={$topic_id}", 2, _MD_NEWBB_POLL_DBUPDATED); |
|
| 584 | - break; |
|
| 585 | - |
|
| 586 | - case 'delete': |
|
| 587 | - echo '<h4>' . _MD_NEWBB_POLL_POLLCONF . "</h4>\n"; |
|
| 588 | - xoops_confirm(['op' => 'delete_ok', 'topic_id' => $topic_id, 'poll_id' => $poll_id], 'polls.php', sprintf(_MD_NEWBB_POLL_RUSUREDEL, $pollObject->getVar('question'))); |
|
| 589 | - break; |
|
| 590 | - |
|
| 591 | - case 'delete_ok': |
|
| 592 | - // check security token |
|
| 593 | - if (!$GLOBALS['xoopsSecurity']->check()) { |
|
| 594 | - redirect_header(Request::getString('PHP_SELF', '', 'SERVER'), 2, implode('<br>', $GLOBALS['xoopsSecurity']->getErrors())); |
|
| 595 | - } |
|
| 596 | - //try and delete the poll |
|
| 597 | - // new xoopspoll module |
|
| 598 | - if ($pollModuleHandler->getVar('version') >= 140) { |
|
| 599 | - $status = $xpPollHandler->delete($pollObject); |
|
| 600 | 620 | if (false !== $status) { |
| 601 | - $xpOptHandler = Xoopspoll\Helper::getInstance()->getHandler('Option'); |
|
| 602 | - $xpLogHandler = Xoopspoll\Helper::getInstance()->getHandler('Log'); |
|
| 603 | - $xpOptHandler->deleteByPollId($poll_id); |
|
| 604 | - $xpLogHandler->deleteByPollId($poll_id); |
|
| 621 | + require_once $GLOBALS['xoops']->path('class/template.php'); |
|
| 622 | + xoops_template_clear_module_cache($xoopsModule->getVar('mid')); |
|
| 623 | + xoops_template_clear_module_cache($pollModuleHandler->getVar('mid')); |
|
| 624 | + // delete comments for this poll |
|
| 625 | + xoops_comment_delete($xoopsModule->getVar('mid'), $poll_id); |
|
| 626 | + |
|
| 627 | + $topicObject->setVar('votes', 0); // not sure why we want to clear votes too... but I left it alone |
|
| 628 | + $topicObject->setVar('topic_haspoll', 0); |
|
| 629 | + $topicObject->setVar('poll_id', 0); |
|
| 630 | + $success = $topicHandler->insert($topicObject); |
|
| 631 | + if (!$success) { |
|
| 632 | + xoops_error($topicHandler->getHtmlErrors()); |
|
| 633 | + break; |
|
| 634 | + } |
|
| 605 | 635 | } else { |
| 606 | - $msg = $xpPollHandler->getHtmlErrors(); |
|
| 636 | + xoops_error($msg); |
|
| 637 | + break; |
|
| 607 | 638 | } |
| 639 | + redirect_header(XOOPS_URL . "/modules/newbb/viewtopic.php?topic_id={$topic_id}", 1, _MD_NEWBB_POLL_DBUPDATED); |
|
| 640 | + break; |
|
| 641 | + |
|
| 642 | + case 'restart': |
|
| 643 | + // new xoopspoll module |
|
| 644 | + if ($pollModuleHandler->getVar('version') >= 140) { |
|
| 645 | + $classConstants = ucfirst($GLOBALS['xoopsModuleConfig']['poll_module']) . 'Constants'; |
|
| 646 | + $default_poll_duration = $classConstants::DEFAULT_POLL_DURATION; |
|
| 608 | 647 | // old xoopspoll or umfrage or any clone from them |
| 609 | - } else { |
|
| 610 | - $status = $pollObject->delete(); |
|
| 611 | - $classOption = $classPoll . 'Option'; |
|
| 612 | - $classLog = $classPoll . 'Log'; |
|
| 613 | - if (false !== $status) { |
|
| 614 | - $classOption::deleteByPollId($poll_id); |
|
| 615 | - $classLog::deleteByPollId($poll_id); |
|
| 616 | 648 | } else { |
| 617 | - $msg = $pollObject->getHtmlErrors(); |
|
| 649 | + $default_poll_duration = (86400 * 10); |
|
| 618 | 650 | } |
| 619 | - } |
|
| 620 | - if (false !== $status) { |
|
| 621 | - require_once $GLOBALS['xoops']->path('class/template.php'); |
|
| 622 | - xoops_template_clear_module_cache($xoopsModule->getVar('mid')); |
|
| 623 | - xoops_template_clear_module_cache($pollModuleHandler->getVar('mid')); |
|
| 624 | - // delete comments for this poll |
|
| 625 | - xoops_comment_delete($xoopsModule->getVar('mid'), $poll_id); |
|
| 651 | + $poll_form = new \XoopsThemeForm(_MD_NEWBB_POLL_RESTARTPOLL, 'poll_form', 'polls.php', 'post', true); |
|
| 652 | + $expire_text = new \XoopsFormText( |
|
| 653 | + _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( |
|
| 654 | + _MD_NEWBB_POLL_EXPIREDAT, |
|
| 655 | + formatTimestamp($pollObject->getVar('end_time'), 'Y-m-d H:i:s') |
|
| 656 | + ) . '</small>', |
|
| 657 | + 'end_time', |
|
| 658 | + 20, |
|
| 659 | + 19, |
|
| 660 | + formatTimestamp(time() + $default_poll_duration, 'Y-m-d H:i:s') |
|
| 661 | + ); |
|
| 662 | + $poll_form->addElement($expire_text); |
|
| 663 | + $poll_form->addElement(new \XoopsFormRadioYN(_MD_NEWBB_POLL_NOTIFY, 'notify', 1)); |
|
| 664 | + $poll_form->addElement(new \XoopsFormRadioYN(_MD_NEWBB_POLL_RESET, 'reset', 0)); |
|
| 665 | + $poll_form->addElement(new \XoopsFormHidden('op', 'restart_ok')); |
|
| 666 | + $poll_form->addElement(new \XoopsFormHidden('topic_id', $topic_id)); |
|
| 667 | + $poll_form->addElement(new \XoopsFormHidden('poll_id', $poll_id)); |
|
| 668 | + $poll_form->addElement(new \XoopsFormButton('', 'poll_submit', _MD_NEWBB_POLL_RESTART, 'submit')); |
|
| 626 | 669 | |
| 627 | - $topicObject->setVar('votes', 0); // not sure why we want to clear votes too... but I left it alone |
|
| 628 | - $topicObject->setVar('topic_haspoll', 0); |
|
| 629 | - $topicObject->setVar('poll_id', 0); |
|
| 630 | - $success = $topicHandler->insert($topicObject); |
|
| 631 | - if (!$success) { |
|
| 632 | - xoops_error($topicHandler->getHtmlErrors()); |
|
| 633 | - break; |
|
| 634 | - } |
|
| 635 | - } else { |
|
| 636 | - xoops_error($msg); |
|
| 670 | + echo '<h4>' . _MD_NEWBB_POLL_POLLCONF . "</h4>\n"; |
|
| 671 | + $poll_form->display(); |
|
| 637 | 672 | break; |
| 638 | - } |
|
| 639 | - redirect_header(XOOPS_URL . "/modules/newbb/viewtopic.php?topic_id={$topic_id}", 1, _MD_NEWBB_POLL_DBUPDATED); |
|
| 640 | - break; |
|
| 641 | - |
|
| 642 | - case 'restart': |
|
| 643 | - // new xoopspoll module |
|
| 644 | - if ($pollModuleHandler->getVar('version') >= 140) { |
|
| 645 | - $classConstants = ucfirst($GLOBALS['xoopsModuleConfig']['poll_module']) . 'Constants'; |
|
| 646 | - $default_poll_duration = $classConstants::DEFAULT_POLL_DURATION; |
|
| 647 | - // old xoopspoll or umfrage or any clone from them |
|
| 648 | - } else { |
|
| 649 | - $default_poll_duration = (86400 * 10); |
|
| 650 | - } |
|
| 651 | - $poll_form = new \XoopsThemeForm(_MD_NEWBB_POLL_RESTARTPOLL, 'poll_form', 'polls.php', 'post', true); |
|
| 652 | - $expire_text = new \XoopsFormText( |
|
| 653 | - _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( |
|
| 654 | - _MD_NEWBB_POLL_EXPIREDAT, |
|
| 655 | - formatTimestamp($pollObject->getVar('end_time'), 'Y-m-d H:i:s') |
|
| 656 | - ) . '</small>', |
|
| 657 | - 'end_time', |
|
| 658 | - 20, |
|
| 659 | - 19, |
|
| 660 | - formatTimestamp(time() + $default_poll_duration, 'Y-m-d H:i:s') |
|
| 661 | - ); |
|
| 662 | - $poll_form->addElement($expire_text); |
|
| 663 | - $poll_form->addElement(new \XoopsFormRadioYN(_MD_NEWBB_POLL_NOTIFY, 'notify', 1)); |
|
| 664 | - $poll_form->addElement(new \XoopsFormRadioYN(_MD_NEWBB_POLL_RESET, 'reset', 0)); |
|
| 665 | - $poll_form->addElement(new \XoopsFormHidden('op', 'restart_ok')); |
|
| 666 | - $poll_form->addElement(new \XoopsFormHidden('topic_id', $topic_id)); |
|
| 667 | - $poll_form->addElement(new \XoopsFormHidden('poll_id', $poll_id)); |
|
| 668 | - $poll_form->addElement(new \XoopsFormButton('', 'poll_submit', _MD_NEWBB_POLL_RESTART, 'submit')); |
|
| 669 | - |
|
| 670 | - echo '<h4>' . _MD_NEWBB_POLL_POLLCONF . "</h4>\n"; |
|
| 671 | - $poll_form->display(); |
|
| 672 | - break; |
|
| 673 | - |
|
| 674 | - case 'restart_ok': |
|
| 675 | - // check security token |
|
| 676 | - if (!$GLOBALS['xoopsSecurity']->check()) { |
|
| 677 | - redirect_header(Request::getString('PHP_SELF', '', 'SERVER'), 2, implode('<br>', $GLOBALS['xoopsSecurity']->getErrors())); |
|
| 678 | - } |
|
| 679 | 673 | |
| 680 | - // new xoopspoll module |
|
| 681 | - if ($pollModuleHandler->getVar('version') >= 140) { |
|
| 682 | - $classConstants = ucfirst($GLOBALS['xoopsModuleConfig']['poll_module']) . 'Constants'; |
|
| 683 | - $default_poll_duration = $classConstants::DEFAULT_POLL_DURATION; |
|
| 684 | - $poll_not_mailed = $classConstants::POLL_NOT_MAILED; |
|
| 685 | - $poll_mailed = $classConstants::POLL_MAILED; |
|
| 686 | - // old xoopspoll or umfrage or any clone from them |
|
| 687 | - } else { |
|
| 688 | - $default_poll_duration = (86400 * 10); |
|
| 689 | - $poll_not_mailed = POLL_NOTMAILED; |
|
| 690 | - $poll_mailed = POLL_MAILED; |
|
| 691 | - } |
|
| 674 | + case 'restart_ok': |
|
| 675 | + // check security token |
|
| 676 | + if (!$GLOBALS['xoopsSecurity']->check()) { |
|
| 677 | + redirect_header(Request::getString('PHP_SELF', '', 'SERVER'), 2, implode('<br>', $GLOBALS['xoopsSecurity']->getErrors())); |
|
| 678 | + } |
|
| 692 | 679 | |
| 693 | - $end_time = !Request::getInt('end_time', 0, 'POST'); |
|
| 694 | - if (0 !== $end_time) { |
|
| 695 | - $timezone = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('timezone') : null; |
|
| 696 | - $pollObject->setVar('end_time', userTimeToServerTime(method_exists('XoopsLocal', 'strtotime') ? XoopsLocal::strtotime($end_time) : strtotime($end_time), $timezone)); |
|
| 697 | - } else { |
|
| 698 | - $pollObject->setVar('end_time', time() + $default_poll_duration); |
|
| 699 | - } |
|
| 680 | + // new xoopspoll module |
|
| 681 | + if ($pollModuleHandler->getVar('version') >= 140) { |
|
| 682 | + $classConstants = ucfirst($GLOBALS['xoopsModuleConfig']['poll_module']) . 'Constants'; |
|
| 683 | + $default_poll_duration = $classConstants::DEFAULT_POLL_DURATION; |
|
| 684 | + $poll_not_mailed = $classConstants::POLL_NOT_MAILED; |
|
| 685 | + $poll_mailed = $classConstants::POLL_MAILED; |
|
| 686 | + // old xoopspoll or umfrage or any clone from them |
|
| 687 | + } else { |
|
| 688 | + $default_poll_duration = (86400 * 10); |
|
| 689 | + $poll_not_mailed = POLL_NOTMAILED; |
|
| 690 | + $poll_mailed = POLL_MAILED; |
|
| 691 | + } |
|
| 700 | 692 | |
| 701 | - $isNotify = Request::getInt('notify', 0, 'POST'); |
|
| 702 | - if (!empty($isNotify) && ($end_time > time())) { |
|
| 703 | - // if notify, set mail status to "not mailed" |
|
| 704 | - $pollObject->setVar('mail_status', $poll_not_mailed); |
|
| 705 | - } else { |
|
| 706 | - // if not notify, set mail status to already "mailed" |
|
| 707 | - $pollObject->setVar('mail_status', $poll_mailed); |
|
| 708 | - } |
|
| 693 | + $end_time = !Request::getInt('end_time', 0, 'POST'); |
|
| 694 | + if (0 !== $end_time) { |
|
| 695 | + $timezone = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('timezone') : null; |
|
| 696 | + $pollObject->setVar('end_time', userTimeToServerTime(method_exists('XoopsLocal', 'strtotime') ? XoopsLocal::strtotime($end_time) : strtotime($end_time), $timezone)); |
|
| 697 | + } else { |
|
| 698 | + $pollObject->setVar('end_time', time() + $default_poll_duration); |
|
| 699 | + } |
|
| 709 | 700 | |
| 710 | - // new xoopspoll module |
|
| 711 | - if ($pollModuleHandler->getVar('version') >= 140) { |
|
| 712 | - if (!$xpPollHandler->insert($pollObject)) { // update the poll |
|
| 713 | - xoops_error($pollObject->getHtmlErrors()); |
|
| 714 | - exit(); |
|
| 701 | + $isNotify = Request::getInt('notify', 0, 'POST'); |
|
| 702 | + if (!empty($isNotify) && ($end_time > time())) { |
|
| 703 | + // if notify, set mail status to "not mailed" |
|
| 704 | + $pollObject->setVar('mail_status', $poll_not_mailed); |
|
| 705 | + } else { |
|
| 706 | + // if not notify, set mail status to already "mailed" |
|
| 707 | + $pollObject->setVar('mail_status', $poll_mailed); |
|
| 715 | 708 | } |
| 716 | - if (Request::getInt('reset', 0, 'POST')) { // reset all vote/voter counters |
|
| 717 | - /** @var \XoopspollOptionHandler $xpOptHandler */ |
|
| 718 | - $xpOptHandler = Xoopspoll\Helper::getInstance()->getHandler('Option'); |
|
| 719 | - /** @var \XoopspollLogHandler $xpLogHandler */ |
|
| 720 | - $xpLogHandler = Xoopspoll\Helper::getInstance()->getHandler('Log'); |
|
| 721 | - $xpLogHandler->deleteByPollId($poll_id); |
|
| 722 | - $xpOptHandler->resetCountByPollId($poll_id); |
|
| 723 | - $xpPollHandler->updateCount($pollObject); |
|
| 709 | + |
|
| 710 | + // new xoopspoll module |
|
| 711 | + if ($pollModuleHandler->getVar('version') >= 140) { |
|
| 712 | + if (!$xpPollHandler->insert($pollObject)) { // update the poll |
|
| 713 | + xoops_error($pollObject->getHtmlErrors()); |
|
| 714 | + exit(); |
|
| 715 | + } |
|
| 716 | + if (Request::getInt('reset', 0, 'POST')) { // reset all vote/voter counters |
|
| 717 | + /** @var \XoopspollOptionHandler $xpOptHandler */ |
|
| 718 | + $xpOptHandler = Xoopspoll\Helper::getInstance()->getHandler('Option'); |
|
| 719 | + /** @var \XoopspollLogHandler $xpLogHandler */ |
|
| 720 | + $xpLogHandler = Xoopspoll\Helper::getInstance()->getHandler('Log'); |
|
| 721 | + $xpLogHandler->deleteByPollId($poll_id); |
|
| 722 | + $xpOptHandler->resetCountByPollId($poll_id); |
|
| 723 | + $xpPollHandler->updateCount($pollObject); |
|
| 724 | + } |
|
| 725 | + // old xoopspoll or umfrage or any clone from them |
|
| 726 | + } else { |
|
| 727 | + if (!$pollObject->store()) { // update the poll |
|
| 728 | + xoops_error($pollObject->getHtmlErrors()); |
|
| 729 | + exit(); |
|
| 730 | + } |
|
| 731 | + if (Request::getInt('reset', 0, 'POST')) { // reset all logs |
|
| 732 | + $classOption = $classPoll . 'Option'; |
|
| 733 | + $classLog = $classPoll . 'Log'; |
|
| 734 | + $classLog::deleteByPollId($poll_id); |
|
| 735 | + $classOption::resetCountByPollId($poll_id); |
|
| 736 | + $pollObject->updateCount(); |
|
| 737 | + } |
|
| 724 | 738 | } |
| 739 | + require_once $GLOBALS['xoops']->path('class/template.php'); |
|
| 740 | + xoops_template_clear_module_cache($xoopsModule->getVar('mid')); |
|
| 741 | + xoops_template_clear_module_cache($pollModuleHandler->getVar('mid')); |
|
| 742 | + redirect_header(XOOPS_URL . "/modules/newbb/viewtopic.php?topic_id={$topic_id}", 1, _MD_NEWBB_POLL_DBUPDATED); |
|
| 743 | + break; |
|
| 744 | + |
|
| 745 | + case 'log': |
|
| 746 | + // new xoopspoll module |
|
| 747 | + if ($pollModuleHandler->getVar('version') >= 140) { |
|
| 748 | + redirect_header($GLOBALS['xoops']->url("modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/admin/main.php?op=log&poll_id={$poll_id}"), 2, _MD_NEWBB_POLL_VIEWLOG); |
|
| 725 | 749 | // old xoopspoll or umfrage or any clone from them |
| 726 | - } else { |
|
| 727 | - if (!$pollObject->store()) { // update the poll |
|
| 728 | - xoops_error($pollObject->getHtmlErrors()); |
|
| 729 | - exit(); |
|
| 730 | - } |
|
| 731 | - if (Request::getInt('reset', 0, 'POST')) { // reset all logs |
|
| 732 | - $classOption = $classPoll . 'Option'; |
|
| 733 | - $classLog = $classPoll . 'Log'; |
|
| 734 | - $classLog::deleteByPollId($poll_id); |
|
| 735 | - $classOption::resetCountByPollId($poll_id); |
|
| 736 | - $pollObject->updateCount(); |
|
| 750 | + } else { |
|
| 751 | + redirect_header($GLOBALS['xoops']->url("modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/admin/index.php?op=log&poll_id={$poll_id}"), 2, _MD_NEWBB_POLL_VIEWLOG); |
|
| 737 | 752 | } |
| 738 | - } |
|
| 739 | - require_once $GLOBALS['xoops']->path('class/template.php'); |
|
| 740 | - xoops_template_clear_module_cache($xoopsModule->getVar('mid')); |
|
| 741 | - xoops_template_clear_module_cache($pollModuleHandler->getVar('mid')); |
|
| 742 | - redirect_header(XOOPS_URL . "/modules/newbb/viewtopic.php?topic_id={$topic_id}", 1, _MD_NEWBB_POLL_DBUPDATED); |
|
| 743 | - break; |
|
| 744 | - |
|
| 745 | - case 'log': |
|
| 746 | - // new xoopspoll module |
|
| 747 | - if ($pollModuleHandler->getVar('version') >= 140) { |
|
| 748 | - redirect_header($GLOBALS['xoops']->url("modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/admin/main.php?op=log&poll_id={$poll_id}"), 2, _MD_NEWBB_POLL_VIEWLOG); |
|
| 749 | - // old xoopspoll or umfrage or any clone from them |
|
| 750 | - } else { |
|
| 751 | - redirect_header($GLOBALS['xoops']->url("modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/admin/index.php?op=log&poll_id={$poll_id}"), 2, _MD_NEWBB_POLL_VIEWLOG); |
|
| 752 | - } |
|
| 753 | - break; |
|
| 753 | + break; |
|
| 754 | 754 | } // switch |
| 755 | 755 | |
| 756 | 756 | // irmtfan move to footer.php |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | |
| 22 | 22 | // rewrite by irmtfan and zyspec to accept xoopspoll 1.4 and all old xoopspoll and umfrage versions and all clones |
| 23 | 23 | |
| 24 | -require_once __DIR__ . '/header.php'; |
|
| 24 | +require_once __DIR__.'/header.php'; |
|
| 25 | 25 | require_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); |
| 26 | 26 | require_once $GLOBALS['xoops']->path('class/xoopslists.php'); |
| 27 | 27 | require_once $GLOBALS['xoops']->path('class/xoopsblock.php'); |
@@ -54,18 +54,18 @@ discard block |
||
| 54 | 54 | if (is_object($topicObject)) { |
| 55 | 55 | $forum_id = $topicObject->getVar('forum_id'); |
| 56 | 56 | } else { |
| 57 | - redirect_header(XOOPS_URL . '/index.php', 2, _MD_NEWBB_POLLMODULE_ERROR . ': ' . _MD_NEWBB_FORUMNOEXIST); |
|
| 57 | + redirect_header(XOOPS_URL.'/index.php', 2, _MD_NEWBB_POLLMODULE_ERROR.': '._MD_NEWBB_FORUMNOEXIST); |
|
| 58 | 58 | } |
| 59 | 59 | // forum access permission |
| 60 | 60 | /** @var Newbb\ForumHandler $forumHandler */ |
| 61 | 61 | $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); |
| 62 | 62 | $forumObject = $forumHandler->get($forum_id); |
| 63 | 63 | if (!$forumHandler->getPermission($forumObject)) { |
| 64 | - redirect_header(XOOPS_URL . '/index.php', 2, _MD_NEWBB_NORIGHTTOACCESS); |
|
| 64 | + redirect_header(XOOPS_URL.'/index.php', 2, _MD_NEWBB_NORIGHTTOACCESS); |
|
| 65 | 65 | } |
| 66 | 66 | // topic view permission |
| 67 | 67 | if (!$topicHandler->getPermission($forumObject, $topicObject->getVar('topic_status'), 'view')) { |
| 68 | - redirect_header('viewforum.php?forum=' . $forum_id, 2, _MD_NEWBB_NORIGHTTOVIEW); |
|
| 68 | + redirect_header('viewforum.php?forum='.$forum_id, 2, _MD_NEWBB_NORIGHTTOVIEW); |
|
| 69 | 69 | } |
| 70 | 70 | // poll module |
| 71 | 71 | $pollModuleHandler = $moduleHandler->getByDirname($GLOBALS['xoopsModuleConfig']['poll_module']); |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | $pollObject = $xpPollHandler->get($poll_id); // will create poll if poll_id = 0 exist |
| 83 | 83 | // old xoopspoll or umfrage or any clone from them |
| 84 | 84 | } else { |
| 85 | - include $GLOBALS['xoops']->path('modules/' . $GLOBALS['xoopsModuleConfig']['poll_module'] . '/include/constants.php'); |
|
| 85 | + include $GLOBALS['xoops']->path('modules/'.$GLOBALS['xoopsModuleConfig']['poll_module'].'/include/constants.php'); |
|
| 86 | 86 | $classPoll = $topicObject->loadOldPoll(); |
| 87 | 87 | $pollObject = new $classPoll($poll_id); // will create poll if poll_id = 0 exist |
| 88 | 88 | } |
@@ -112,11 +112,11 @@ discard block |
||
| 112 | 112 | case 'add': |
| 113 | 113 | // new xoopspoll module |
| 114 | 114 | if ($pollModuleHandler->getVar('version') >= 140) { |
| 115 | - echo '<h4>' . _MD_NEWBB_POLL_CREATNEWPOLL . "</h4>\n"; |
|
| 115 | + echo '<h4>'._MD_NEWBB_POLL_CREATNEWPOLL."</h4>\n"; |
|
| 116 | 116 | $pollObject->renderForm(Request::getString('PHP_SELF', '', 'SERVER'), 'post', ['topic_id' => $topic_id]); |
| 117 | 117 | // old xoopspoll or umfrage or any clone from them |
| 118 | 118 | } else { |
| 119 | - $classOption = $classPoll . 'Option'; |
|
| 119 | + $classOption = $classPoll.'Option'; |
|
| 120 | 120 | $poll_form = new \XoopsThemeForm(_MD_NEWBB_POLL_CREATNEWPOLL, 'poll_form', 'polls.php', 'post', true); |
| 121 | 121 | $author_label = new \XoopsFormLabel(_MD_NEWBB_POLL_AUTHOR, is_object($GLOBALS['xoopsUser']) ? ("<a href='" |
| 122 | 122 | . XOOPS_URL |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | $poll_form->addElement($desc_tarea); |
| 133 | 133 | $currenttime = formatTimestamp(time(), 'Y-m-d H:i:s'); |
| 134 | 134 | $endtime = formatTimestamp(time() + 604800, 'Y-m-d H:i:s'); |
| 135 | - $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); |
|
| 135 | + $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); |
|
| 136 | 136 | $poll_form->addElement($expire_text); |
| 137 | 137 | |
| 138 | 138 | $weight_text = new \XoopsFormText(_MD_NEWBB_POLL_DISPLAYORDER, 'weight', 6, 5, 0); |
@@ -145,14 +145,14 @@ discard block |
||
| 145 | 145 | $poll_form->addElement($notify_yn); |
| 146 | 146 | |
| 147 | 147 | $option_tray = new \XoopsFormElementTray(_MD_NEWBB_POLL_POLLOPTIONS, ''); |
| 148 | - $barcolor_array = \XoopsLists::getImgListAsArray($GLOBALS['xoops']->path('modules/' . $GLOBALS['xoopsModuleConfig']['poll_module'] . '/assets/images/colorbars/')); |
|
| 148 | + $barcolor_array = \XoopsLists::getImgListAsArray($GLOBALS['xoops']->path('modules/'.$GLOBALS['xoopsModuleConfig']['poll_module'].'/assets/images/colorbars/')); |
|
| 149 | 149 | for ($i = 0; $i < 10; ++$i) { |
| 150 | 150 | $current_bar = ('blank.gif' !== current($barcolor_array)) ? current($barcolor_array) : next($barcolor_array); |
| 151 | 151 | $option_text = new \XoopsFormText('', 'option_text[]', 50, 255); |
| 152 | 152 | $option_tray->addElement($option_text); |
| 153 | 153 | $color_select = new \XoopsFormSelect('', "option_color[{$i}]", $current_bar); |
| 154 | 154 | $color_select->addOptionArray($barcolor_array); |
| 155 | - $color_select->setExtra("onchange='showImgSelected(\"option_color_image[{$i}]\", \"option_color[{$i}]\", \"modules/" . $GLOBALS['xoopsModuleConfig']['poll_module'] . '/assets/images/colorbars", "", "' . XOOPS_URL . "\")'"); |
|
| 155 | + $color_select->setExtra("onchange='showImgSelected(\"option_color_image[{$i}]\", \"option_color[{$i}]\", \"modules/".$GLOBALS['xoopsModuleConfig']['poll_module'].'/assets/images/colorbars", "", "'.XOOPS_URL."\")'"); |
|
| 156 | 156 | $color_label = new \XoopsFormLabel('', "<img src='" |
| 157 | 157 | . XOOPS_URL |
| 158 | 158 | . '/modules/' |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | $poll_form->addElement(new \XoopsFormHidden('poll_id', $poll_id)); |
| 175 | 175 | $poll_form->addElement(new \XoopsFormHidden('user_id', is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('uid') : 0)); |
| 176 | 176 | $poll_form->addElement(new \XoopsFormButtonTray('poll_submit', _SUBMIT, 'submit')); |
| 177 | - echo '<h4>' . _MD_NEWBB_POLL_POLLCONF . '</h4>'; |
|
| 177 | + echo '<h4>'._MD_NEWBB_POLL_POLLCONF.'</h4>'; |
|
| 178 | 178 | $poll_form->display(); |
| 179 | 179 | } |
| 180 | 180 | break; // op: add |
@@ -182,13 +182,13 @@ discard block |
||
| 182 | 182 | case 'edit': |
| 183 | 183 | // new xoopspoll module |
| 184 | 184 | if ($pollModuleHandler->getVar('version') >= 140) { |
| 185 | - echo '<h4>' . _MD_NEWBB_POLL_EDITPOLL . "</h4>\n"; |
|
| 185 | + echo '<h4>'._MD_NEWBB_POLL_EDITPOLL."</h4>\n"; |
|
| 186 | 186 | $pollObject->renderForm(Request::getString('PHP_SELF', '', 'SERVER'), 'post', ['topic_id' => $topic_id]); |
| 187 | 187 | // old xoopspoll or umfrage or any clone from them |
| 188 | 188 | } else { |
| 189 | - $classOption = $classPoll . 'Option'; |
|
| 189 | + $classOption = $classPoll.'Option'; |
|
| 190 | 190 | $poll_form = new \XoopsThemeForm(_MD_NEWBB_POLL_EDITPOLL, 'poll_form', 'polls.php', 'post', true); |
| 191 | - $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>'); |
|
| 191 | + $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>'); |
|
| 192 | 192 | $poll_form->addElement($author_label); |
| 193 | 193 | $question_text = new \XoopsFormText(_MD_NEWBB_POLL_POLLQUESTION, 'question', 50, 255, $pollObject->getVar('question', 'E')); |
| 194 | 194 | $poll_form->addElement($question_text); |
@@ -196,13 +196,13 @@ discard block |
||
| 196 | 196 | $poll_form->addElement($desc_tarea); |
| 197 | 197 | $date = formatTimestamp($pollObject->getVar('end_time'), 'Y-m-d H:i:s'); // important "Y-m-d H:i:s" use in jdf function |
| 198 | 198 | if (!$pollObject->hasExpired()) { |
| 199 | - $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); |
|
| 199 | + $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); |
|
| 200 | 200 | $poll_form->addElement($expire_text); |
| 201 | 201 | } else { |
| 202 | 202 | // irmtfan full URL - add topic_id |
| 203 | 203 | $restart_label = new \XoopsFormLabel( |
| 204 | 204 | _MD_NEWBB_POLL_EXPIRATION, |
| 205 | - 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>' |
|
| 205 | + 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>' |
|
| 206 | 206 | ); |
| 207 | 207 | $poll_form->addElement($restart_label); |
| 208 | 208 | } |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | $poll_form->addElement($weight_text); |
| 211 | 211 | $multi_yn = new \XoopsFormRadioYN(_MD_NEWBB_POLL_ALLOWMULTI, 'multiple', $pollObject->getVar('multiple')); |
| 212 | 212 | $poll_form->addElement($multi_yn); |
| 213 | - $options_arr =& $classOption::getAllByPollId($poll_id); |
|
| 213 | + $options_arr = & $classOption::getAllByPollId($poll_id); |
|
| 214 | 214 | $notify_value = 1; |
| 215 | 215 | if (0 !== $pollObject->getVar('mail_status')) { |
| 216 | 216 | $notify_value = 0; |
@@ -226,9 +226,9 @@ discard block |
||
| 226 | 226 | $option_tray->addElement(new \XoopsFormHidden('option_id[]', $option->getVar('option_id'))); |
| 227 | 227 | $color_select = new \XoopsFormSelect('', 'option_color[{$i}]', $option->getVar('option_color')); |
| 228 | 228 | $color_select->addOptionArray($barcolor_array); |
| 229 | - $color_select->setExtra("onchange='showImgSelected(\"option_color_image[{$i}]\", \"option_color[" . $i . "]\", \"modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/assets/images/colorbars\", \"\", \"" . XOOPS_URL . "\")'"); |
|
| 229 | + $color_select->setExtra("onchange='showImgSelected(\"option_color_image[{$i}]\", \"option_color[".$i."]\", \"modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/assets/images/colorbars\", \"\", \"".XOOPS_URL."\")'"); |
|
| 230 | 230 | $color_label = new \XoopsFormLabel('', "<img src='" |
| 231 | - . $GLOBALS['xoops']->url("modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/assets/images/colorbars/" . $option->getVar('option_color', 'E')) |
|
| 231 | + . $GLOBALS['xoops']->url("modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/assets/images/colorbars/".$option->getVar('option_color', 'E')) |
|
| 232 | 232 | . "' name='option_color_image[{$i}]' id='option_color_image[{$i}]' class='alignbottom' width='30' height='15' alt='' /><br>"); |
| 233 | 233 | $option_tray->addElement($color_select); |
| 234 | 234 | $option_tray->addElement($color_label); |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | ++$i; |
| 237 | 237 | } |
| 238 | 238 | // irmtfan full URL |
| 239 | - $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>'); |
|
| 239 | + $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>'); |
|
| 240 | 240 | $option_tray->addElement($more_label); |
| 241 | 241 | $poll_form->addElement($option_tray); |
| 242 | 242 | $poll_form->addElement(new \XoopsFormHidden('op', 'update')); |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | $poll_form->addElement(new \XoopsFormHidden('poll_id', $poll_id)); |
| 245 | 245 | $poll_form->addElement(new \XoopsFormButtonTray('poll_submit', _SUBMIT, 'submit')); |
| 246 | 246 | |
| 247 | - echo '<h4>' . _MD_NEWBB_POLL_POLLCONF . "</h4>\n"; |
|
| 247 | + echo '<h4>'._MD_NEWBB_POLL_POLLCONF."</h4>\n"; |
|
| 248 | 248 | $poll_form->display(); |
| 249 | 249 | } |
| 250 | 250 | break; // op: edit |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | $option_empty = true; |
| 263 | 263 | if (!Request::getString('option_text', '', 'POST')) { |
| 264 | 264 | // irmtfan - issue with javascript:history.go(-1) |
| 265 | - redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 2, _MD_NEWBB_ERROROCCURED . ': ' . _MD_NEWBB_POLL_POLLOPTIONS . ' !'); |
|
| 265 | + redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 2, _MD_NEWBB_ERROROCCURED.': '._MD_NEWBB_POLL_POLLOPTIONS.' !'); |
|
| 266 | 266 | } |
| 267 | 267 | $option_text = Request::getArray('option_text', '', 'POST'); |
| 268 | 268 | foreach ($option_text as $optxt) { |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | } |
| 274 | 274 | if ($option_empty) { |
| 275 | 275 | // irmtfan - issue with javascript:history.go(-1) |
| 276 | - redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 2, _MD_NEWBB_ERROROCCURED . ': ' . _MD_NEWBB_POLL_POLLOPTIONS . ' !'); |
|
| 276 | + redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 2, _MD_NEWBB_ERROROCCURED.': '._MD_NEWBB_POLL_POLLOPTIONS.' !'); |
|
| 277 | 277 | } |
| 278 | 278 | $pollObject->setVar('question', Request::getString('question', '', 'POST')); |
| 279 | 279 | $pollObject->setVar('description', Request::getString('description', '', 'POST')); |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | } |
| 305 | 305 | $i = 0; |
| 306 | 306 | $option_color = Request::getArray('option_color', null, 'POST'); |
| 307 | - $classOption = $classPoll . 'Option'; |
|
| 307 | + $classOption = $classPoll.'Option'; |
|
| 308 | 308 | foreach ($option_text as $optxt) { |
| 309 | 309 | $optxt = trim($optxt); |
| 310 | 310 | /** @var XoopspollOption $optionObject */ |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | } else { |
| 332 | 332 | redirect_header("viewtopic.php?topic_id={$topic_id}", 2, _MD_NEWBB_POLL_DBUPDATED); |
| 333 | 333 | } |
| 334 | - break;// op: save |
|
| 334 | + break; // op: save |
|
| 335 | 335 | } |
| 336 | 336 | // no break |
| 337 | 337 | case 'update': |
@@ -344,7 +344,7 @@ discard block |
||
| 344 | 344 | $option_string = is_array($option_text) ? implode('', $option_text) : $option_text; |
| 345 | 345 | $option_string = trim($option_string); |
| 346 | 346 | if ('' === $option_string) { |
| 347 | - redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 2, _MD_NEWBB_ERROROCCURED . ': ' . _MD_NEWBB_POLL_POLLOPTIONS . ' !'); |
|
| 347 | + redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 2, _MD_NEWBB_ERROROCCURED.': '._MD_NEWBB_POLL_POLLOPTIONS.' !'); |
|
| 348 | 348 | } |
| 349 | 349 | |
| 350 | 350 | // new xoopspoll module |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | /** @var \XoopspollLogHandler $xpLogHandler */ |
| 355 | 355 | $xpLogHandler = Xoopspoll\Helper::getInstance()->getHandler('Log'); |
| 356 | 356 | // $classRequest = ucfirst($GLOBALS['xoopsModuleConfig']["poll_module"]) . "Request"; |
| 357 | - $classConstants = ucfirst($GLOBALS['xoopsModuleConfig']['poll_module']) . 'Constants'; |
|
| 357 | + $classConstants = ucfirst($GLOBALS['xoopsModuleConfig']['poll_module']).'Constants'; |
|
| 358 | 358 | $notify = Request::getInt('notify', $classConstants::NOTIFICATION_ENABLED, 'POST'); |
| 359 | 359 | $currentTimestamp = time(); |
| 360 | 360 | //$xuEndTimestamp = method_exists('XoopsLocal', 'strtotime') ? XoopsLocal::strtotime(Request::getString('xu_end_time', null, 'POST')) |
@@ -463,8 +463,8 @@ discard block |
||
| 463 | 463 | $i = 0; |
| 464 | 464 | $option_id = Request::getArray('option_id', null, 'POST'); |
| 465 | 465 | $option_color = Request::getArray('option_color', null, 'POST'); |
| 466 | - $classOption = $classPoll . 'Option'; |
|
| 467 | - $classLog = $classPoll . 'Log'; |
|
| 466 | + $classOption = $classPoll.'Option'; |
|
| 467 | + $classLog = $classPoll.'Log'; |
|
| 468 | 468 | foreach ($option_id as $opid) { |
| 469 | 469 | $optionObject = new $classOption($opid); |
| 470 | 470 | $option_text[$i] = trim($option_text[$i]); |
@@ -495,7 +495,7 @@ discard block |
||
| 495 | 495 | } else { |
| 496 | 496 | redirect_header("viewtopic.php?topic_id={$topic_id}", 2, _MD_NEWBB_POLL_DBUPDATED); |
| 497 | 497 | } |
| 498 | - break;// op: save | update |
|
| 498 | + break; // op: save | update |
|
| 499 | 499 | |
| 500 | 500 | case 'addmore': |
| 501 | 501 | $question = $pollObject->getVar('question'); |
@@ -509,14 +509,14 @@ discard block |
||
| 509 | 509 | // old xoopspoll or umfrage or any clone from them |
| 510 | 510 | } else { |
| 511 | 511 | $option_tray = new \XoopsFormElementTray(_MD_NEWBB_POLL_POLLOPTIONS, ''); |
| 512 | - $barcolor_array = \XoopsLists::getImgListAsArray($GLOBALS['xoops']->path('modules/' . $GLOBALS['xoopsModuleConfig']['poll_module'] . '/assets/images/colorbars/')); |
|
| 512 | + $barcolor_array = \XoopsLists::getImgListAsArray($GLOBALS['xoops']->path('modules/'.$GLOBALS['xoopsModuleConfig']['poll_module'].'/assets/images/colorbars/')); |
|
| 513 | 513 | for ($i = 0; $i < 10; ++$i) { |
| 514 | 514 | $current_bar = ('blank.gif' !== current($barcolor_array)) ? current($barcolor_array) : next($barcolor_array); |
| 515 | 515 | $option_text = new \XoopsFormText('', 'option_text[]', 50, 255); |
| 516 | 516 | $option_tray->addElement($option_text); |
| 517 | 517 | $color_select = new \XoopsFormSelect('', "option_color[{$i}]", $current_bar); |
| 518 | 518 | $color_select->addOptionArray($barcolor_array); |
| 519 | - $color_select->setExtra("onchange='showImgSelected(\"option_color_image[{$i}]\", \"option_color[{$i}]\", \"modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/assets/images/colorbars\", \"\", \"" . XOOPS_URL . "\")'"); |
|
| 519 | + $color_select->setExtra("onchange='showImgSelected(\"option_color_image[{$i}]\", \"option_color[{$i}]\", \"modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/assets/images/colorbars\", \"\", \"".XOOPS_URL."\")'"); |
|
| 520 | 520 | $color_label = new \XoopsFormLabel('', "<img src='" |
| 521 | 521 | . $GLOBALS['xoops']->url("modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/assets/images/colorbars/{$current_bar}") |
| 522 | 522 | . "' name='option_color_image[{$i}]' id='option_color_image[{$i}]' class='alignbottom' width='30' height='15' alt='' /><br>"); |
@@ -534,7 +534,7 @@ discard block |
||
| 534 | 534 | $poll_form->addElement(new \XoopsFormHidden('topic_id', $topic_id)); |
| 535 | 535 | $poll_form->addElement(new \XoopsFormHidden('poll_id', $poll_id)); |
| 536 | 536 | |
| 537 | - echo '<h4>' . _MD_NEWBB_POLL_POLLCONF . "</h4>\n"; |
|
| 537 | + echo '<h4>'._MD_NEWBB_POLL_POLLCONF."</h4>\n"; |
|
| 538 | 538 | $poll_form->display(); |
| 539 | 539 | break; |
| 540 | 540 | |
@@ -549,7 +549,7 @@ discard block |
||
| 549 | 549 | $option_string = trim($option_string); |
| 550 | 550 | if ('' === $option_string) { |
| 551 | 551 | // irmtfan - issue with javascript:history.go(-1) |
| 552 | - redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 2, _MD_NEWBB_ERROROCCURED . ': ' . _MD_NEWBB_POLL_POLLOPTIONS . ' !'); |
|
| 552 | + redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 2, _MD_NEWBB_ERROROCCURED.': '._MD_NEWBB_POLL_POLLOPTIONS.' !'); |
|
| 553 | 553 | } |
| 554 | 554 | $i = 0; |
| 555 | 555 | $option_color = Request::getArray('option_color', null, 'POST'); |
@@ -566,7 +566,7 @@ discard block |
||
| 566 | 566 | $xpOptHandler->insert($optionObject); |
| 567 | 567 | // old xoopspoll or umfrage or any clone from them |
| 568 | 568 | } else { |
| 569 | - $classOption = $classPoll . 'Option'; |
|
| 569 | + $classOption = $classPoll.'Option'; |
|
| 570 | 570 | $optionObject = new $classOption(); |
| 571 | 571 | $optionObject->setVar('option_text', $optxt); |
| 572 | 572 | $optionObject->setVar('poll_id', $poll_id); |
@@ -584,7 +584,7 @@ discard block |
||
| 584 | 584 | break; |
| 585 | 585 | |
| 586 | 586 | case 'delete': |
| 587 | - echo '<h4>' . _MD_NEWBB_POLL_POLLCONF . "</h4>\n"; |
|
| 587 | + echo '<h4>'._MD_NEWBB_POLL_POLLCONF."</h4>\n"; |
|
| 588 | 588 | xoops_confirm(['op' => 'delete_ok', 'topic_id' => $topic_id, 'poll_id' => $poll_id], 'polls.php', sprintf(_MD_NEWBB_POLL_RUSUREDEL, $pollObject->getVar('question'))); |
| 589 | 589 | break; |
| 590 | 590 | |
@@ -608,8 +608,8 @@ discard block |
||
| 608 | 608 | // old xoopspoll or umfrage or any clone from them |
| 609 | 609 | } else { |
| 610 | 610 | $status = $pollObject->delete(); |
| 611 | - $classOption = $classPoll . 'Option'; |
|
| 612 | - $classLog = $classPoll . 'Log'; |
|
| 611 | + $classOption = $classPoll.'Option'; |
|
| 612 | + $classLog = $classPoll.'Log'; |
|
| 613 | 613 | if (false !== $status) { |
| 614 | 614 | $classOption::deleteByPollId($poll_id); |
| 615 | 615 | $classLog::deleteByPollId($poll_id); |
@@ -636,13 +636,13 @@ discard block |
||
| 636 | 636 | xoops_error($msg); |
| 637 | 637 | break; |
| 638 | 638 | } |
| 639 | - redirect_header(XOOPS_URL . "/modules/newbb/viewtopic.php?topic_id={$topic_id}", 1, _MD_NEWBB_POLL_DBUPDATED); |
|
| 639 | + redirect_header(XOOPS_URL."/modules/newbb/viewtopic.php?topic_id={$topic_id}", 1, _MD_NEWBB_POLL_DBUPDATED); |
|
| 640 | 640 | break; |
| 641 | 641 | |
| 642 | 642 | case 'restart': |
| 643 | 643 | // new xoopspoll module |
| 644 | 644 | if ($pollModuleHandler->getVar('version') >= 140) { |
| 645 | - $classConstants = ucfirst($GLOBALS['xoopsModuleConfig']['poll_module']) . 'Constants'; |
|
| 645 | + $classConstants = ucfirst($GLOBALS['xoopsModuleConfig']['poll_module']).'Constants'; |
|
| 646 | 646 | $default_poll_duration = $classConstants::DEFAULT_POLL_DURATION; |
| 647 | 647 | // old xoopspoll or umfrage or any clone from them |
| 648 | 648 | } else { |
@@ -650,10 +650,10 @@ discard block |
||
| 650 | 650 | } |
| 651 | 651 | $poll_form = new \XoopsThemeForm(_MD_NEWBB_POLL_RESTARTPOLL, 'poll_form', 'polls.php', 'post', true); |
| 652 | 652 | $expire_text = new \XoopsFormText( |
| 653 | - _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( |
|
| 653 | + _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( |
|
| 654 | 654 | _MD_NEWBB_POLL_EXPIREDAT, |
| 655 | 655 | formatTimestamp($pollObject->getVar('end_time'), 'Y-m-d H:i:s') |
| 656 | - ) . '</small>', |
|
| 656 | + ).'</small>', |
|
| 657 | 657 | 'end_time', |
| 658 | 658 | 20, |
| 659 | 659 | 19, |
@@ -667,7 +667,7 @@ discard block |
||
| 667 | 667 | $poll_form->addElement(new \XoopsFormHidden('poll_id', $poll_id)); |
| 668 | 668 | $poll_form->addElement(new \XoopsFormButton('', 'poll_submit', _MD_NEWBB_POLL_RESTART, 'submit')); |
| 669 | 669 | |
| 670 | - echo '<h4>' . _MD_NEWBB_POLL_POLLCONF . "</h4>\n"; |
|
| 670 | + echo '<h4>'._MD_NEWBB_POLL_POLLCONF."</h4>\n"; |
|
| 671 | 671 | $poll_form->display(); |
| 672 | 672 | break; |
| 673 | 673 | |
@@ -679,7 +679,7 @@ discard block |
||
| 679 | 679 | |
| 680 | 680 | // new xoopspoll module |
| 681 | 681 | if ($pollModuleHandler->getVar('version') >= 140) { |
| 682 | - $classConstants = ucfirst($GLOBALS['xoopsModuleConfig']['poll_module']) . 'Constants'; |
|
| 682 | + $classConstants = ucfirst($GLOBALS['xoopsModuleConfig']['poll_module']).'Constants'; |
|
| 683 | 683 | $default_poll_duration = $classConstants::DEFAULT_POLL_DURATION; |
| 684 | 684 | $poll_not_mailed = $classConstants::POLL_NOT_MAILED; |
| 685 | 685 | $poll_mailed = $classConstants::POLL_MAILED; |
@@ -729,8 +729,8 @@ discard block |
||
| 729 | 729 | exit(); |
| 730 | 730 | } |
| 731 | 731 | if (Request::getInt('reset', 0, 'POST')) { // reset all logs |
| 732 | - $classOption = $classPoll . 'Option'; |
|
| 733 | - $classLog = $classPoll . 'Log'; |
|
| 732 | + $classOption = $classPoll.'Option'; |
|
| 733 | + $classLog = $classPoll.'Log'; |
|
| 734 | 734 | $classLog::deleteByPollId($poll_id); |
| 735 | 735 | $classOption::resetCountByPollId($poll_id); |
| 736 | 736 | $pollObject->updateCount(); |
@@ -739,7 +739,7 @@ discard block |
||
| 739 | 739 | require_once $GLOBALS['xoops']->path('class/template.php'); |
| 740 | 740 | xoops_template_clear_module_cache($xoopsModule->getVar('mid')); |
| 741 | 741 | xoops_template_clear_module_cache($pollModuleHandler->getVar('mid')); |
| 742 | - redirect_header(XOOPS_URL . "/modules/newbb/viewtopic.php?topic_id={$topic_id}", 1, _MD_NEWBB_POLL_DBUPDATED); |
|
| 742 | + redirect_header(XOOPS_URL."/modules/newbb/viewtopic.php?topic_id={$topic_id}", 1, _MD_NEWBB_POLL_DBUPDATED); |
|
| 743 | 743 | break; |
| 744 | 744 | |
| 745 | 745 | case 'log': |
@@ -754,5 +754,5 @@ discard block |
||
| 754 | 754 | } // switch |
| 755 | 755 | |
| 756 | 756 | // irmtfan move to footer.php |
| 757 | -require_once __DIR__ . '/footer.php'; |
|
| 757 | +require_once __DIR__.'/footer.php'; |
|
| 758 | 758 | include $GLOBALS['xoops']->path('footer.php'); |
@@ -220,9 +220,9 @@ discard block |
||
| 220 | 220 | $xoopsTpl->assign('notifyicon', $category_icon); |
| 221 | 221 | |
| 222 | 222 | $xoopsTpl->assign([ |
| 223 | - 'index_title' => sprintf(_MD_NEWBB_WELCOME, htmlspecialchars($GLOBALS['xoopsConfig']['sitename'], ENT_QUOTES)), |
|
| 224 | - 'index_desc' => _MD_NEWBB_TOSTART |
|
| 225 | - ]); |
|
| 223 | + 'index_title' => sprintf(_MD_NEWBB_WELCOME, htmlspecialchars($GLOBALS['xoopsConfig']['sitename'], ENT_QUOTES)), |
|
| 224 | + 'index_desc' => _MD_NEWBB_TOSTART |
|
| 225 | + ]); |
|
| 226 | 226 | |
| 227 | 227 | /* display user stats */ |
| 228 | 228 | if (!empty($GLOBALS['xoopsModuleConfig']['statistik_enabled'])) { |
@@ -280,10 +280,10 @@ discard block |
||
| 280 | 280 | $xoopsTpl->assign('rss_button', newbbDisplayImage('rss', 'RSS feed')); |
| 281 | 281 | } |
| 282 | 282 | $xoopsTpl->assign([ |
| 283 | - 'img_forum_new' => newbbDisplayImage('forum_new', _MD_NEWBB_NEWPOSTS), |
|
| 284 | - 'img_forum' => newbbDisplayImage('forum', _MD_NEWBB_NONEWPOSTS), |
|
| 285 | - 'img_subforum' => newbbDisplayImage('subforum') |
|
| 286 | - ]); |
|
| 283 | + 'img_forum_new' => newbbDisplayImage('forum_new', _MD_NEWBB_NEWPOSTS), |
|
| 284 | + 'img_forum' => newbbDisplayImage('forum', _MD_NEWBB_NONEWPOSTS), |
|
| 285 | + 'img_subforum' => newbbDisplayImage('subforum') |
|
| 286 | + ]); |
|
| 287 | 287 | |
| 288 | 288 | // irmtfan move to footer.php |
| 289 | 289 | require_once __DIR__ . '/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 | /* deal with marks */ |
| 18 | 18 | if (Request::getInt('mark_read', 0)) { |
@@ -23,13 +23,13 @@ discard block |
||
| 23 | 23 | $markvalue = 0; |
| 24 | 24 | $markresult = _MD_NEWBB_MARK_UNREAD; |
| 25 | 25 | } |
| 26 | - require_once __DIR__ . '/include/functions.read.php'; |
|
| 26 | + require_once __DIR__.'/include/functions.read.php'; |
|
| 27 | 27 | newbbSetReadForum($markvalue); |
| 28 | - $url = XOOPS_URL . '/modules/newbb/index.php'; |
|
| 29 | - redirect_header($url, 2, _MD_NEWBB_ALL_FORUM_MARKED . ' ' . $markresult); |
|
| 28 | + $url = XOOPS_URL.'/modules/newbb/index.php'; |
|
| 29 | + redirect_header($url, 2, _MD_NEWBB_ALL_FORUM_MARKED.' '.$markresult); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | -$viewcat = Request::getInt('cat', 0, 'GET');//TODO mb check if this is GET or POST? |
|
| 32 | +$viewcat = Request::getInt('cat', 0, 'GET'); //TODO mb check if this is GET or POST? |
|
| 33 | 33 | ///** @var Newbb\CategoryHandler $categoryHandler */ |
| 34 | 34 | //$categoryHandler = Newbb\Helper::getInstance()->getHandler('Category'); |
| 35 | 35 | |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | $categories[$viewcat] = $categoryObject->getValues(); |
| 45 | 45 | } |
| 46 | 46 | $forum_index_title = sprintf(_MD_NEWBB_FORUMINDEX, htmlspecialchars($GLOBALS['xoopsConfig']['sitename'], ENT_QUOTES)); |
| 47 | - $xoops_pagetitle = $categoryObject->getVar('cat_title') . ' [' . $xoopsModule->getVar('name') . ']'; |
|
| 47 | + $xoops_pagetitle = $categoryObject->getVar('cat_title').' ['.$xoopsModule->getVar('name').']'; |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | if (0 === count($categories)) { |
@@ -57,12 +57,12 @@ discard block |
||
| 57 | 57 | //$xoopsOption['xoops_module_header'] = $xoops_module_header; |
| 58 | 58 | // irmtfan include header.php after defining $xoopsOption['template_main'] |
| 59 | 59 | require_once $GLOBALS['xoops']->path('header.php'); |
| 60 | -require_once __DIR__ . '/include/functions.render.php'; |
|
| 60 | +require_once __DIR__.'/include/functions.render.php'; |
|
| 61 | 61 | /* rss feed */ |
| 62 | 62 | // irmtfan new method |
| 63 | 63 | if (!empty($GLOBALS['xoopsModuleConfig']['rss_enable'])) { |
| 64 | 64 | $xoopsTpl->assign('xoops_module_header', ' |
| 65 | - <link rel="alternate" type="application/xml+rss" title="' . $xoopsModule->getVar('name') . '" href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/rss.php" /> |
|
| 65 | + <link rel="alternate" type="application/xml+rss" title="' . $xoopsModule->getVar('name').'" href="'.XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname', 'n').'/rss.php" /> |
|
| 66 | 66 | ' . @$xoopsTpl->get_template_vars('xoops_module_header')); |
| 67 | 67 | } |
| 68 | 68 | $xoopsTpl->assign('xoops_pagetitle', $xoops_pagetitle); |
@@ -89,8 +89,8 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | if (!empty($forums_allowed)) { |
| 91 | 91 | $crit_top = new \CriteriaCompo(new \Criteria('parent_forum', 0)); |
| 92 | - $crit_top->add(new \Criteria('cat_id', '(' . implode(', ', array_keys($categories)) . ')', 'IN')); |
|
| 93 | - $crit_top->add(new \Criteria('forum_id', '(' . implode(', ', $forums_allowed) . ')', 'IN')); |
|
| 92 | + $crit_top->add(new \Criteria('cat_id', '('.implode(', ', array_keys($categories)).')', 'IN')); |
|
| 93 | + $crit_top->add(new \Criteria('forum_id', '('.implode(', ', $forums_allowed).')', 'IN')); |
|
| 94 | 94 | $forums_top = $forumHandler->getIds($crit_top); |
| 95 | 95 | } |
| 96 | 96 | |
@@ -98,8 +98,8 @@ discard block |
||
| 98 | 98 | if ('hidden' === $GLOBALS['xoopsModuleConfig']['subforum_display'] || 0 === count($forums_top)) { |
| 99 | 99 | $forums_sub = []; |
| 100 | 100 | } else { |
| 101 | - $crit_sub = new \CriteriaCompo(new \Criteria('parent_forum', '(' . implode(', ', $forums_top) . ')', 'IN')); |
|
| 102 | - $crit_sub->add(new \Criteria('forum_id', '(' . implode(', ', $forums_allowed) . ')', 'IN')); |
|
| 101 | + $crit_sub = new \CriteriaCompo(new \Criteria('parent_forum', '('.implode(', ', $forums_top).')', 'IN')); |
|
| 102 | + $crit_sub->add(new \Criteria('forum_id', '('.implode(', ', $forums_allowed).')', 'IN')); |
|
| 103 | 103 | $forums_sub = $forumHandler->getIds($crit_sub); |
| 104 | 104 | } |
| 105 | 105 | |
@@ -111,17 +111,17 @@ discard block |
||
| 111 | 111 | $newposts = 0; |
| 112 | 112 | $deleteposts = 0; |
| 113 | 113 | if (0 !== count($forums_available)) { |
| 114 | - $crit_forum = new \Criteria('forum_id', '(' . implode(', ', $forums_available) . ')', 'IN'); |
|
| 114 | + $crit_forum = new \Criteria('forum_id', '('.implode(', ', $forums_available).')', 'IN'); |
|
| 115 | 115 | $crit_forum->setSort('cat_id ASC, parent_forum ASC, forum_order'); |
| 116 | 116 | $crit_forum->setOrder('ASC'); |
| 117 | 117 | $forums = $forumHandler->getAll($crit_forum, null, false); |
| 118 | 118 | $newtopics = $forumHandler->getTopicCount($forums, 0, 'pending'); |
| 119 | 119 | $deletetopics = $forumHandler->getTopicCount($forums, 0, 'deleted'); |
| 120 | 120 | $forums_array = $forumHandler->display($forums, $GLOBALS['xoopsModuleConfig']['length_title_index'], $GLOBALS['xoopsModuleConfig']['count_subforum']); |
| 121 | - $crit = new \CriteriaCompo(new \Criteria('forum_id', '(' . implode(', ', $forums_available) . ')', 'IN')); |
|
| 121 | + $crit = new \CriteriaCompo(new \Criteria('forum_id', '('.implode(', ', $forums_available).')', 'IN')); |
|
| 122 | 122 | $crit->add(new \Criteria('approved', '-1')); |
| 123 | 123 | $deleteposts = $postHandler->getCount($crit); |
| 124 | - $crit = new \CriteriaCompo(new \Criteria('forum_id', '(' . implode(', ', $forums_available) . ')', 'IN')); |
|
| 124 | + $crit = new \CriteriaCompo(new \Criteria('forum_id', '('.implode(', ', $forums_available).')', 'IN')); |
|
| 125 | 125 | $crit->add(new \Criteria('approved', '0')); |
| 126 | 126 | $newposts = $postHandler->getCount($crit); |
| 127 | 127 | } |
@@ -168,15 +168,15 @@ discard block |
||
| 168 | 168 | $forums = []; |
| 169 | 169 | $onecat = $categories[$id]; |
| 170 | 170 | |
| 171 | - $cat_element_id = 'cat_' . $onecat['cat_id']; |
|
| 171 | + $cat_element_id = 'cat_'.$onecat['cat_id']; |
|
| 172 | 172 | $expand = (count($toggles) > 0) ? (in_array($cat_element_id, $toggles) ? false : true) : true; |
| 173 | 173 | // START irmtfan to improve newbbDisplayImage |
| 174 | 174 | if ($expand) { |
| 175 | - $cat_display = 'block'; //irmtfan move semicolon |
|
| 175 | + $cat_display = 'block'; //irmtfan move semicolon |
|
| 176 | 176 | $cat_icon_display = 'minus'; |
| 177 | 177 | $cat_alt = _MD_NEWBB_HIDE; |
| 178 | 178 | } else { |
| 179 | - $cat_display = 'none'; //irmtfan move semicolon |
|
| 179 | + $cat_display = 'none'; //irmtfan move semicolon |
|
| 180 | 180 | $cat_icon_display = 'plus'; |
| 181 | 181 | $cat_alt = _MD_NEWBB_SEE; |
| 182 | 182 | } |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | $cat_image = ''; |
| 200 | 200 | $cat_image = $onecat['cat_image']; |
| 201 | 201 | if ('' !== $cat_image && 'blank.gif' !== $cat_image && $cat_image) { |
| 202 | - $cat_image = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/assets/images/category/' . $cat_image; |
|
| 202 | + $cat_image = XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname', 'n').'/assets/images/category/'.$cat_image; |
|
| 203 | 203 | } |
| 204 | 204 | $category_array[] = [ |
| 205 | 205 | 'cat_id' => $onecat['cat_id'], |
@@ -250,15 +250,15 @@ discard block |
||
| 250 | 250 | $stats = $statsHandler->getStats(array_merge([0], $forums_available)); |
| 251 | 251 | $xoopsTpl->assign_by_ref('stats', $stats); |
| 252 | 252 | $xoopsTpl->assign('subforum_display', $GLOBALS['xoopsModuleConfig']['subforum_display']); |
| 253 | -$xoopsTpl->assign('mark_read', XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/index.php?mark_read=1'); |
|
| 254 | -$xoopsTpl->assign('mark_unread', XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/index.php?mark_read=2'); |
|
| 253 | +$xoopsTpl->assign('mark_read', XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname', 'n').'/index.php?mark_read=1'); |
|
| 254 | +$xoopsTpl->assign('mark_unread', XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname', 'n').'/index.php?mark_read=2'); |
|
| 255 | 255 | |
| 256 | -$xoopsTpl->assign('all_link', XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/list.topic.php?status=all'); |
|
| 257 | -$xoopsTpl->assign('post_link', XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/viewpost.php?status=all'); |
|
| 258 | -$xoopsTpl->assign('newpost_link', XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/viewpost.php?status=new'); |
|
| 259 | -$xoopsTpl->assign('digest_link', XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/list.topic.php?status=digest'); |
|
| 260 | -$xoopsTpl->assign('unreplied_link', XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/list.topic.php?status=unreplied'); |
|
| 261 | -$xoopsTpl->assign('unread_link', XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/list.topic.php?status=unread'); |
|
| 256 | +$xoopsTpl->assign('all_link', XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname', 'n').'/list.topic.php?status=all'); |
|
| 257 | +$xoopsTpl->assign('post_link', XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname', 'n').'/viewpost.php?status=all'); |
|
| 258 | +$xoopsTpl->assign('newpost_link', XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname', 'n').'/viewpost.php?status=new'); |
|
| 259 | +$xoopsTpl->assign('digest_link', XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname', 'n').'/list.topic.php?status=digest'); |
|
| 260 | +$xoopsTpl->assign('unreplied_link', XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname', 'n').'/list.topic.php?status=unreplied'); |
|
| 261 | +$xoopsTpl->assign('unread_link', XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname', 'n').'/list.topic.php?status=unread'); |
|
| 262 | 262 | $xoopsTpl->assign('menumode', $menumode); |
| 263 | 263 | $xoopsTpl->assign('menumode_other', $menumode_other); |
| 264 | 264 | |
@@ -286,5 +286,5 @@ discard block |
||
| 286 | 286 | ]); |
| 287 | 287 | |
| 288 | 288 | // irmtfan move to footer.php |
| 289 | -require_once __DIR__ . '/footer.php'; |
|
| 289 | +require_once __DIR__.'/footer.php'; |
|
| 290 | 290 | include $GLOBALS['xoops']->path('footer.php'); |
@@ -20,16 +20,16 @@ discard block |
||
| 20 | 20 | define('LIST_TOPIC_DEFINED', true); |
| 21 | 21 | |
| 22 | 22 | //require_once dirname(__DIR__) . '/include/functions.ini.php'; |
| 23 | -require_once dirname(__DIR__) . '/class/TopicRenderer.php'; |
|
| 24 | -require_once dirname(__DIR__) . '/footer.php'; // to include js/style files like validate function |
|
| 23 | +require_once dirname(__DIR__).'/class/TopicRenderer.php'; |
|
| 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); |
@@ -66,8 +66,8 @@ discard block |
||
| 66 | 66 | global $accessForums; |
| 67 | 67 | global $xoopsLogger; |
| 68 | 68 | |
| 69 | - require_once __DIR__ . '/../include/functions.config.php'; |
|
| 70 | - require_once __DIR__ . '/../include/functions.time.php'; |
|
| 69 | + require_once __DIR__.'/../include/functions.config.php'; |
|
| 70 | + require_once __DIR__.'/../include/functions.time.php'; |
|
| 71 | 71 | |
| 72 | 72 | $myts = \MyTextSanitizer::getInstance(); |
| 73 | 73 | $block = []; |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | $extraCriteria = ''; |
| 77 | 77 | if (!empty($options[2])) { |
| 78 | 78 | //require_once __DIR__ . '/../include/functions.time.php'; |
| 79 | - $extraCriteria .= ' AND p.post_time>' . (time() - newbbGetSinceTime($options[2])); |
|
| 79 | + $extraCriteria .= ' AND p.post_time>'.(time() - newbbGetSinceTime($options[2])); |
|
| 80 | 80 | } |
| 81 | 81 | switch ($options[0]) { |
| 82 | 82 | case 'time': |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | return $block; |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - $forumCriteria = ' AND t.forum_id IN (' . implode(',', $allowedForums) . ')'; |
|
| 105 | + $forumCriteria = ' AND t.forum_id IN ('.implode(',', $allowedForums).')'; |
|
| 106 | 106 | $approveCriteria = ' AND t.approved = 1'; |
| 107 | 107 | |
| 108 | 108 | $newbbConfig = newbbLoadConfig(); |
@@ -158,13 +158,13 @@ discard block |
||
| 158 | 158 | return $block; |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | - require_once __DIR__ . '/../include/functions.user.php'; |
|
| 161 | + require_once __DIR__.'/../include/functions.user.php'; |
|
| 162 | 162 | $author_name = newbbGetUnameFromIds(array_keys($author), $newbbConfig['show_realname'], true); |
| 163 | 163 | |
| 164 | 164 | if (count($types) > 0) { |
| 165 | 165 | /** @var Newbb\TypeHandler $typeHandler */ |
| 166 | 166 | $typeHandler = Newbb\Helper::getInstance()->getHandler('Type'); |
| 167 | - $type_list = $typeHandler->getList(new \Criteria('type_id', '(' . implode(', ', array_keys($types)) . ')', 'IN')); |
|
| 167 | + $type_list = $typeHandler->getList(new \Criteria('type_id', '('.implode(', ', array_keys($types)).')', 'IN')); |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | foreach ($rows as $arr) { |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | xoops_loadLanguage('main', 'newbb'); |
| 173 | 173 | $topic = []; |
| 174 | 174 | $topic_page_jump = newbbDisplayImage('lastposticon', _MD_NEWBB_GOTOLASTPOST); |
| 175 | - $topic['topic_subject'] = empty($type_list[$arr['type_id']]) ? '' : '[' . $type_list[$arr['type_id']] . ']'; |
|
| 175 | + $topic['topic_subject'] = empty($type_list[$arr['type_id']]) ? '' : '['.$type_list[$arr['type_id']].']'; |
|
| 176 | 176 | |
| 177 | 177 | $topic['post_id'] = $arr['post_id']; |
| 178 | 178 | $topic['topic_status'] = $arr['topic_status']; |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | if (!empty($options[5])) { |
| 185 | 185 | $title = xoops_substr($title, 0, $options[5]); |
| 186 | 186 | } |
| 187 | - $topic['title'] = $topic['topic_subject'] . ' ' . $title; |
|
| 187 | + $topic['title'] = $topic['topic_subject'].' '.$title; |
|
| 188 | 188 | $topic['replies'] = $arr['topic_replies']; |
| 189 | 189 | $topic['views'] = $arr['topic_views']; |
| 190 | 190 | $topic['time'] = newbbFormatTimestamp($arr['post_time']); |
@@ -196,9 +196,9 @@ discard block |
||
| 196 | 196 | $topic['topic_poster'] = $topic_poster; |
| 197 | 197 | $topic['topic_page_jump'] = $topic_page_jump; |
| 198 | 198 | // START irmtfan remove hardcoded html in URLs - add $seo_topic_url |
| 199 | - $seo_url = XOOPS_URL . '/' . SEO_MODULE_NAME . '/viewtopic.php?post_id=' . $topic['post_id']; |
|
| 200 | - $seo_topic_url = XOOPS_URL . '/' . SEO_MODULE_NAME . '/viewtopic.php?topic_id=' . $topic['id']; |
|
| 201 | - $seo_forum_url = XOOPS_URL . '/' . SEO_MODULE_NAME . '/viewforum.php?forum=' . $topic['forum_id']; |
|
| 199 | + $seo_url = XOOPS_URL.'/'.SEO_MODULE_NAME.'/viewtopic.php?post_id='.$topic['post_id']; |
|
| 200 | + $seo_topic_url = XOOPS_URL.'/'.SEO_MODULE_NAME.'/viewtopic.php?topic_id='.$topic['id']; |
|
| 201 | + $seo_forum_url = XOOPS_URL.'/'.SEO_MODULE_NAME.'/viewforum.php?forum='.$topic['forum_id']; |
|
| 202 | 202 | if (!empty($newbbConfig['do_rewrite'])) { |
| 203 | 203 | $topic['seo_url'] = seo_urls($seo_url); |
| 204 | 204 | $topic['seo_topic_url'] = seo_urls($seo_topic_url); |
@@ -213,11 +213,11 @@ discard block |
||
| 213 | 213 | unset($topic); |
| 214 | 214 | } |
| 215 | 215 | // START irmtfan remove hardcoded html in URLs |
| 216 | - $seo_top_allforums = XOOPS_URL . '/' . SEO_MODULE_NAME; |
|
| 216 | + $seo_top_allforums = XOOPS_URL.'/'.SEO_MODULE_NAME; |
|
| 217 | 217 | $block['seo_top_allforums'] = !empty($newbbConfig['do_rewrite']) ? seo_urls($seo_top_allforums) : $seo_top_allforums; |
| 218 | - $seo_top_allforums = XOOPS_URL . '/' . SEO_MODULE_NAME . '/list.topic.php'; |
|
| 218 | + $seo_top_allforums = XOOPS_URL.'/'.SEO_MODULE_NAME.'/list.topic.php'; |
|
| 219 | 219 | $block['seo_top_alltopics'] = !empty($newbbConfig['do_rewrite']) ? seo_urls($seo_top_allforums) : $seo_top_allforums; |
| 220 | - $seo_top_allforums = XOOPS_URL . '/' . SEO_MODULE_NAME . '/viewpost.php'; |
|
| 220 | + $seo_top_allforums = XOOPS_URL.'/'.SEO_MODULE_NAME.'/viewpost.php'; |
|
| 221 | 221 | $block['seo_top_allposts'] = !empty($newbbConfig['do_rewrite']) ? seo_urls($seo_top_allforums) : $seo_top_allforums; |
| 222 | 222 | // END irmtfan remove hardcoded html in URLs |
| 223 | 223 | $block['indexNav'] = (int)$options[4]; |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | function b_newbb_topic_show($options) |
| 241 | 241 | { |
| 242 | 242 | global $accessForums; |
| 243 | - require_once __DIR__ . '/../include/functions.time.php'; |
|
| 243 | + require_once __DIR__.'/../include/functions.time.php'; |
|
| 244 | 244 | $myts = \MyTextSanitizer::getInstance(); |
| 245 | 245 | $block = []; |
| 246 | 246 | $i = 0; |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | $time_criteria = null; |
| 250 | 250 | if (!empty($options[2])) { |
| 251 | 251 | $time_criteria = time() - newbbGetSinceTime($options[2]); |
| 252 | - $extraCriteria = ' AND t.topic_time>' . $time_criteria; |
|
| 252 | + $extraCriteria = ' AND t.topic_time>'.$time_criteria; |
|
| 253 | 253 | } |
| 254 | 254 | switch ($options[0]) { |
| 255 | 255 | case 'views': |
@@ -262,11 +262,11 @@ discard block |
||
| 262 | 262 | $order = 't.digest_time'; |
| 263 | 263 | $extraCriteria = ' AND t.topic_digest=1'; |
| 264 | 264 | if (null !== $time_criteria) { |
| 265 | - $extraCriteria .= ' AND t.digest_time>' . $time_criteria; |
|
| 265 | + $extraCriteria .= ' AND t.digest_time>'.$time_criteria; |
|
| 266 | 266 | } |
| 267 | 267 | break; |
| 268 | 268 | case 'sticky': |
| 269 | - $order = 't.topic_id'; |
|
| 269 | + $order = 't.topic_id'; |
|
| 270 | 270 | $extraCriteria .= ' AND t.topic_sticky=1'; |
| 271 | 271 | break; |
| 272 | 272 | case 'time': |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | return false; |
| 303 | 303 | } |
| 304 | 304 | |
| 305 | - $forumCriteria = ' AND t.forum_id IN (' . implode(',', $allowedForums) . ')'; |
|
| 305 | + $forumCriteria = ' AND t.forum_id IN ('.implode(',', $allowedForums).')'; |
|
| 306 | 306 | $approveCriteria = ' AND t.approved = 1'; |
| 307 | 307 | |
| 308 | 308 | $query = 'SELECT' |
@@ -342,19 +342,19 @@ discard block |
||
| 342 | 342 | if (count($rows) < 1) { |
| 343 | 343 | return $block; |
| 344 | 344 | } |
| 345 | - require_once __DIR__ . '/../include/functions.user.php'; |
|
| 345 | + require_once __DIR__.'/../include/functions.user.php'; |
|
| 346 | 346 | $author_name = newbbGetUnameFromIds(array_keys($author), $newbbConfig['show_realname'], true); |
| 347 | 347 | if (count($types) > 0) { |
| 348 | 348 | /** @var Newbb\TypeHandler $typeHandler */ |
| 349 | 349 | $typeHandler = Newbb\Helper::getInstance()->getHandler('Type'); |
| 350 | - $type_list = $typeHandler->getList(new \Criteria('type_id', '(' . implode(', ', array_keys($types)) . ')', 'IN')); |
|
| 350 | + $type_list = $typeHandler->getList(new \Criteria('type_id', '('.implode(', ', array_keys($types)).')', 'IN')); |
|
| 351 | 351 | } |
| 352 | 352 | |
| 353 | 353 | foreach ($rows as $arr) { |
| 354 | 354 | // irmtfan remove $topic_page_jump because there is no last post |
| 355 | 355 | //$topic_page_jump = ''; |
| 356 | 356 | $topic = []; |
| 357 | - $topic['topic_subject'] = empty($type_list[$arr['type_id']]) ? '' : '[' . $type_list[$arr['type_id']] . '] '; |
|
| 357 | + $topic['topic_subject'] = empty($type_list[$arr['type_id']]) ? '' : '['.$type_list[$arr['type_id']].'] '; |
|
| 358 | 358 | $topic['forum_id'] = $arr['forum_id']; |
| 359 | 359 | $topic['forum_name'] = $myts->htmlSpecialChars($arr['forum_name']); |
| 360 | 360 | $topic['id'] = $arr['topic_id']; |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | if (!empty($options[5])) { |
| 364 | 364 | $title = xoops_substr($title, 0, $options[5]); |
| 365 | 365 | } |
| 366 | - $topic['title'] = $topic['topic_subject'] . $title; |
|
| 366 | + $topic['title'] = $topic['topic_subject'].$title; |
|
| 367 | 367 | $topic['replies'] = $arr['topic_replies']; |
| 368 | 368 | $topic['views'] = $arr['topic_views']; |
| 369 | 369 | $topic['time'] = newbbFormatTimestamp($arr['topic_time']); |
@@ -376,8 +376,8 @@ discard block |
||
| 376 | 376 | // irmtfan remove $topic_page_jump because there is no last post |
| 377 | 377 | //$topic['topic_page_jump'] = $topic_page_jump; |
| 378 | 378 | // START irmtfan remove hardcoded html in URLs - add $seo_topic_url |
| 379 | - $seo_topic_url = XOOPS_URL . '/' . SEO_MODULE_NAME . '/viewtopic.php?topic_id=' . $topic['id']; |
|
| 380 | - $seo_forum_url = XOOPS_URL . '/' . SEO_MODULE_NAME . '/viewforum.php?forum=' . $topic['forum_id']; |
|
| 379 | + $seo_topic_url = XOOPS_URL.'/'.SEO_MODULE_NAME.'/viewtopic.php?topic_id='.$topic['id']; |
|
| 380 | + $seo_forum_url = XOOPS_URL.'/'.SEO_MODULE_NAME.'/viewforum.php?forum='.$topic['forum_id']; |
|
| 381 | 381 | |
| 382 | 382 | if (!empty($newbbConfig['do_rewrite'])) { |
| 383 | 383 | $topic['seo_topic_url'] = seo_urls($seo_topic_url); |
@@ -391,11 +391,11 @@ discard block |
||
| 391 | 391 | unset($topic); |
| 392 | 392 | } |
| 393 | 393 | // START irmtfan remove hardcoded html in URLs |
| 394 | - $seo_top_allforums = XOOPS_URL . '/' . SEO_MODULE_NAME; |
|
| 394 | + $seo_top_allforums = XOOPS_URL.'/'.SEO_MODULE_NAME; |
|
| 395 | 395 | $block['seo_top_allforums'] = !empty($newbbConfig['do_rewrite']) ? seo_urls($seo_top_allforums) : $seo_top_allforums; |
| 396 | - $seo_top_allforums = XOOPS_URL . '/' . SEO_MODULE_NAME . '/list.topic.php'; |
|
| 396 | + $seo_top_allforums = XOOPS_URL.'/'.SEO_MODULE_NAME.'/list.topic.php'; |
|
| 397 | 397 | $block['seo_top_alltopics'] = !empty($newbbConfig['do_rewrite']) ? seo_urls($seo_top_allforums) : $seo_top_allforums; |
| 398 | - $seo_top_allforums = XOOPS_URL . '/' . SEO_MODULE_NAME . '/viewpost.php'; |
|
| 398 | + $seo_top_allforums = XOOPS_URL.'/'.SEO_MODULE_NAME.'/viewpost.php'; |
|
| 399 | 399 | $block['seo_top_allposts'] = !empty($newbbConfig['do_rewrite']) ? seo_urls($seo_top_allforums) : $seo_top_allforums; |
| 400 | 400 | // END irmtfan remove hardcoded html in URLs |
| 401 | 401 | $block['indexNav'] = (int)$options[4]; |
@@ -420,7 +420,7 @@ discard block |
||
| 420 | 420 | global $accessForums; |
| 421 | 421 | global $newbbConfig; |
| 422 | 422 | |
| 423 | - require_once __DIR__ . '/../include/functions.time.php'; |
|
| 423 | + require_once __DIR__.'/../include/functions.time.php'; |
|
| 424 | 424 | $myts = \MyTextSanitizer::getInstance(); |
| 425 | 425 | $block = []; |
| 426 | 426 | $i = 0; |
@@ -429,7 +429,7 @@ discard block |
||
| 429 | 429 | $time_criteria = null; |
| 430 | 430 | if (!empty($options[2])) { |
| 431 | 431 | $time_criteria = time() - newbbGetSinceTime($options[2]); |
| 432 | - $extraCriteria = ' AND p.post_time>' . $time_criteria; |
|
| 432 | + $extraCriteria = ' AND p.post_time>'.$time_criteria; |
|
| 433 | 433 | } |
| 434 | 434 | |
| 435 | 435 | switch ($options[0]) { |
@@ -473,7 +473,7 @@ discard block |
||
| 473 | 473 | return $block; |
| 474 | 474 | } |
| 475 | 475 | |
| 476 | - $forumCriteria = ' AND p.forum_id IN (' . implode(',', $allowedForums) . ')'; |
|
| 476 | + $forumCriteria = ' AND p.forum_id IN ('.implode(',', $allowedForums).')'; |
|
| 477 | 477 | $approveCriteria = ' AND p.approved = 1'; |
| 478 | 478 | |
| 479 | 479 | $query = 'SELECT'; |
@@ -481,11 +481,11 @@ discard block |
||
| 481 | 481 | if ('text' === $options[0]) { |
| 482 | 482 | $query .= ' pt.dohtml, pt.dosmiley, pt.doxcode, pt.dobr, pt.post_text,'; |
| 483 | 483 | } |
| 484 | - $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'; |
|
| 484 | + $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'; |
|
| 485 | 485 | if ('text' === $options[0]) { |
| 486 | - $query .= ' LEFT JOIN ' . $GLOBALS['xoopsDB']->prefix('newbb_posts_text') . ' AS pt ON pt.post_id=p.post_id'; |
|
| 486 | + $query .= ' LEFT JOIN '.$GLOBALS['xoopsDB']->prefix('newbb_posts_text').' AS pt ON pt.post_id=p.post_id'; |
|
| 487 | 487 | } |
| 488 | - $query .= ' WHERE 1=1 ' . $forumCriteria . $approveCriteria . $extraCriteria . ' ORDER BY ' . $order . ' DESC'; |
|
| 488 | + $query .= ' WHERE 1=1 '.$forumCriteria.$approveCriteria.$extraCriteria.' ORDER BY '.$order.' DESC'; |
|
| 489 | 489 | |
| 490 | 490 | $result = $GLOBALS['xoopsDB']->query($query, $options[1], 0); |
| 491 | 491 | if (!$result) { |
@@ -502,15 +502,15 @@ discard block |
||
| 502 | 502 | if (count($rows) < 1) { |
| 503 | 503 | return $block; |
| 504 | 504 | } |
| 505 | - require_once __DIR__ . '/../include/functions.user.php'; |
|
| 505 | + require_once __DIR__.'/../include/functions.user.php'; |
|
| 506 | 506 | $author_name = newbbGetUnameFromIds(array_keys($author), $newbbConfig['show_realname'], true); |
| 507 | 507 | |
| 508 | 508 | foreach ($rows as $arr) { |
| 509 | 509 | //if ($arr['icon'] && is_file($GLOBALS['xoops']->path('images/subject/' . $arr['icon']))) { |
| 510 | 510 | if (!empty($arr['icon'])) { |
| 511 | - $last_post_icon = '<img src="' . XOOPS_URL . '/images/subject/' . htmlspecialchars($arr['icon']) . '" alt="" />'; |
|
| 511 | + $last_post_icon = '<img src="'.XOOPS_URL.'/images/subject/'.htmlspecialchars($arr['icon']).'" alt="" />'; |
|
| 512 | 512 | } else { |
| 513 | - $last_post_icon = '<img src="' . XOOPS_URL . '/images/subject/icon1.gif" alt="" />'; |
|
| 513 | + $last_post_icon = '<img src="'.XOOPS_URL.'/images/subject/icon1.gif" alt="" />'; |
|
| 514 | 514 | } |
| 515 | 515 | //$topic['jump_post'] = "<a href='" . XOOPS_URL . "/modules/newbb/viewtopic.php?post_id=" . $arr['post_id'] ."#forumpost" . $arr['post_id'] . "'>" . $last_post_icon . '</a>'; |
| 516 | 516 | $topic = []; |
@@ -540,8 +540,8 @@ discard block |
||
| 540 | 540 | $topic['post_text'] = $post_text; |
| 541 | 541 | } |
| 542 | 542 | // START irmtfan remove hardcoded html in URLs |
| 543 | - $seo_url = XOOPS_URL . '/' . SEO_MODULE_NAME . '/viewtopic.php?post_id=' . $topic['post_id']; |
|
| 544 | - $seo_forum_url = XOOPS_URL . '/' . SEO_MODULE_NAME . '/viewforum.php?forum=' . $topic['forum_id']; |
|
| 543 | + $seo_url = XOOPS_URL.'/'.SEO_MODULE_NAME.'/viewtopic.php?post_id='.$topic['post_id']; |
|
| 544 | + $seo_forum_url = XOOPS_URL.'/'.SEO_MODULE_NAME.'/viewforum.php?forum='.$topic['forum_id']; |
|
| 545 | 545 | // END irmtfan remove hardcoded html in URLs |
| 546 | 546 | if (!empty($newbbConfig['do_rewrite'])) { |
| 547 | 547 | $topic['seo_url'] = seo_urls($seo_url); |
@@ -555,11 +555,11 @@ discard block |
||
| 555 | 555 | unset($topic); |
| 556 | 556 | } |
| 557 | 557 | // START irmtfan remove hardcoded html in URLs |
| 558 | - $seo_top_allforums = XOOPS_URL . '/' . SEO_MODULE_NAME; |
|
| 558 | + $seo_top_allforums = XOOPS_URL.'/'.SEO_MODULE_NAME; |
|
| 559 | 559 | $block['seo_top_allforums'] = !empty($newbbConfig['do_rewrite']) ? seo_urls($seo_top_allforums) : $seo_top_allforums; |
| 560 | - $seo_top_allforums = XOOPS_URL . '/' . SEO_MODULE_NAME . '/list.topic.php'; |
|
| 560 | + $seo_top_allforums = XOOPS_URL.'/'.SEO_MODULE_NAME.'/list.topic.php'; |
|
| 561 | 561 | $block['seo_top_alltopics'] = !empty($newbbConfig['do_rewrite']) ? seo_urls($seo_top_allforums) : $seo_top_allforums; |
| 562 | - $seo_top_allforums = XOOPS_URL . '/' . SEO_MODULE_NAME . '/viewpost.php'; |
|
| 562 | + $seo_top_allforums = XOOPS_URL.'/'.SEO_MODULE_NAME.'/viewpost.php'; |
|
| 563 | 563 | $block['seo_top_allposts'] = !empty($newbbConfig['do_rewrite']) ? seo_urls($seo_top_allforums) : $seo_top_allforums; |
| 564 | 564 | // END irmtfan remove hardcoded html in URLs |
| 565 | 565 | |
@@ -592,9 +592,9 @@ discard block |
||
| 592 | 592 | $extraCriteria = ''; |
| 593 | 593 | $time_criteria = null; |
| 594 | 594 | if (!empty($options[2])) { |
| 595 | - require_once __DIR__ . '/../include/functions.time.php'; |
|
| 595 | + require_once __DIR__.'/../include/functions.time.php'; |
|
| 596 | 596 | $time_criteria = time() - newbbGetSinceTime($options[2]); |
| 597 | - $extraCriteria = ' AND topic_time > ' . $time_criteria; |
|
| 597 | + $extraCriteria = ' AND topic_time > '.$time_criteria; |
|
| 598 | 598 | } |
| 599 | 599 | switch ($options[0]) { |
| 600 | 600 | case 'topic': |
@@ -602,7 +602,7 @@ discard block |
||
| 602 | 602 | case 'digest': |
| 603 | 603 | $extraCriteria = ' AND topic_digest = 1'; |
| 604 | 604 | if (null !== $time_criteria) { |
| 605 | - $extraCriteria .= ' AND digest_time > ' . $time_criteria; |
|
| 605 | + $extraCriteria .= ' AND digest_time > '.$time_criteria; |
|
| 606 | 606 | } |
| 607 | 607 | break; |
| 608 | 608 | case 'sticky': |
@@ -612,7 +612,7 @@ discard block |
||
| 612 | 612 | default: |
| 613 | 613 | $type = 'post'; |
| 614 | 614 | if (null !== $time_criteria) { |
| 615 | - $extraCriteria = ' AND post_time > ' . $time_criteria; |
|
| 615 | + $extraCriteria = ' AND post_time > '.$time_criteria; |
|
| 616 | 616 | } |
| 617 | 617 | break; |
| 618 | 618 | } |
@@ -636,17 +636,17 @@ discard block |
||
| 636 | 636 | } |
| 637 | 637 | |
| 638 | 638 | if ('topic' === $type) { |
| 639 | - $forumCriteria = ' AND forum_id IN (' . implode(',', $allowedForums) . ')'; |
|
| 639 | + $forumCriteria = ' AND forum_id IN ('.implode(',', $allowedForums).')'; |
|
| 640 | 640 | $approveCriteria = ' AND approved = 1'; |
| 641 | 641 | $query = 'SELECT DISTINCT topic_poster AS author, COUNT(*) AS count |
| 642 | - FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . ' |
|
| 643 | - WHERE topic_poster>0 ' . $forumCriteria . $approveCriteria . $extraCriteria . ' GROUP BY topic_poster ORDER BY ' . $order . ' DESC'; |
|
| 642 | + FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics').' |
|
| 643 | + WHERE topic_poster>0 ' . $forumCriteria.$approveCriteria.$extraCriteria.' GROUP BY topic_poster ORDER BY '.$order.' DESC'; |
|
| 644 | 644 | } else { |
| 645 | - $forumCriteria = ' AND forum_id IN (' . implode(',', $allowedForums) . ')'; |
|
| 645 | + $forumCriteria = ' AND forum_id IN ('.implode(',', $allowedForums).')'; |
|
| 646 | 646 | $approveCriteria = ' AND approved = 1'; |
| 647 | 647 | $query = 'SELECT DISTINCT uid AS author, COUNT(*) AS count |
| 648 | - FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . ' |
|
| 649 | - WHERE uid > 0 ' . $forumCriteria . $approveCriteria . $extraCriteria . ' GROUP BY uid ORDER BY ' . $order . ' DESC'; |
|
| 648 | + FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_posts').' |
|
| 649 | + WHERE uid > 0 ' . $forumCriteria.$approveCriteria.$extraCriteria.' GROUP BY uid ORDER BY '.$order.' DESC'; |
|
| 650 | 650 | } |
| 651 | 651 | |
| 652 | 652 | $result = $GLOBALS['xoopsDB']->query($query, $options[1], 0); |
@@ -661,12 +661,12 @@ discard block |
||
| 661 | 661 | if (count($author) < 1) { |
| 662 | 662 | return $block; |
| 663 | 663 | } |
| 664 | - require_once __DIR__ . '/../include/functions.user.php'; |
|
| 664 | + require_once __DIR__.'/../include/functions.user.php'; |
|
| 665 | 665 | $author_name = newbbGetUnameFromIds(array_keys($author), $newbbConfig['show_realname']); |
| 666 | 666 | foreach (array_keys($author) as $uid) { |
| 667 | 667 | $author[$uid]['name'] = $myts->htmlSpecialChars($author_name[$uid]); |
| 668 | 668 | } |
| 669 | - $block['authors'] =& $author; |
|
| 669 | + $block['authors'] = & $author; |
|
| 670 | 670 | $block['disp_mode'] = $options[3]; // 0 - full view; 1 - lite view; |
| 671 | 671 | $block['indexNav'] = (int)$options[4]; |
| 672 | 672 | |
@@ -679,45 +679,45 @@ discard block |
||
| 679 | 679 | */ |
| 680 | 680 | function b_newbb_edit($options) |
| 681 | 681 | { |
| 682 | - require_once __DIR__ . '/../include/functions.forum.php'; |
|
| 682 | + require_once __DIR__.'/../include/functions.forum.php'; |
|
| 683 | 683 | |
| 684 | - $form = _MB_NEWBB_CRITERIA . "<select name='options[0]'>"; |
|
| 684 | + $form = _MB_NEWBB_CRITERIA."<select name='options[0]'>"; |
|
| 685 | 685 | $form .= "<option value='time'"; |
| 686 | 686 | if ('time' === $options[0]) { |
| 687 | 687 | $form .= " selected='selected' "; |
| 688 | 688 | } |
| 689 | - $form .= '>' . _MB_NEWBB_CRITERIA_TIME . '</option>'; |
|
| 689 | + $form .= '>'._MB_NEWBB_CRITERIA_TIME.'</option>'; |
|
| 690 | 690 | $form .= '</select>'; |
| 691 | - $form .= '<br>' . _MB_NEWBB_DISPLAY . "<input type='text' name='options[1]' value='" . $options[1] . "' />"; |
|
| 692 | - $form .= '<br>' . _MB_NEWBB_TIME . "<input type='text' name='options[2]' value='" . $options[2] . "' />"; |
|
| 693 | - $form .= '<br> <small>' . _MB_NEWBB_TIME_DESC . '</small>'; |
|
| 694 | - $form .= '<br>' . _MB_NEWBB_DISPLAYMODE . "<input type='radio' name='options[3]' value='0'"; |
|
| 691 | + $form .= '<br>'._MB_NEWBB_DISPLAY."<input type='text' name='options[1]' value='".$options[1]."' />"; |
|
| 692 | + $form .= '<br>'._MB_NEWBB_TIME."<input type='text' name='options[2]' value='".$options[2]."' />"; |
|
| 693 | + $form .= '<br> <small>'._MB_NEWBB_TIME_DESC.'</small>'; |
|
| 694 | + $form .= '<br>'._MB_NEWBB_DISPLAYMODE."<input type='radio' name='options[3]' value='0'"; |
|
| 695 | 695 | if (0 == $options[3]) { |
| 696 | 696 | $form .= ' checked'; |
| 697 | 697 | } |
| 698 | - $form .= ' /> ' . _MB_NEWBB_DISPLAYMODE_FULL . "<input type='radio' name='options[3]' value='1'"; |
|
| 698 | + $form .= ' /> '._MB_NEWBB_DISPLAYMODE_FULL."<input type='radio' name='options[3]' value='1'"; |
|
| 699 | 699 | if (1 == $options[3]) { |
| 700 | 700 | $form .= ' checked'; |
| 701 | 701 | } |
| 702 | - $form .= ' /> ' . _MB_NEWBB_DISPLAYMODE_COMPACT . "<input type='radio' name='options[3]' value='2'"; |
|
| 702 | + $form .= ' /> '._MB_NEWBB_DISPLAYMODE_COMPACT."<input type='radio' name='options[3]' value='2'"; |
|
| 703 | 703 | if (2 == $options[3]) { |
| 704 | 704 | $form .= ' checked'; |
| 705 | 705 | } |
| 706 | - $form .= ' /> ' . _MB_NEWBB_DISPLAYMODE_LITE; |
|
| 706 | + $form .= ' /> '._MB_NEWBB_DISPLAYMODE_LITE; |
|
| 707 | 707 | |
| 708 | - $form .= '<br>' . _MB_NEWBB_INDEXNAV . '<input type="radio" name="options[4]" value="1"'; |
|
| 708 | + $form .= '<br>'._MB_NEWBB_INDEXNAV.'<input type="radio" name="options[4]" value="1"'; |
|
| 709 | 709 | if (1 == $options[4]) { |
| 710 | 710 | $form .= ' checked'; |
| 711 | 711 | } |
| 712 | - $form .= ' />' . _YES . '<input type="radio" name="options[4]" value="0"'; |
|
| 712 | + $form .= ' />'._YES.'<input type="radio" name="options[4]" value="0"'; |
|
| 713 | 713 | if (0 == $options[4]) { |
| 714 | 714 | $form .= ' checked'; |
| 715 | 715 | } |
| 716 | - $form .= ' />' . _NO; |
|
| 716 | + $form .= ' />'._NO; |
|
| 717 | 717 | |
| 718 | - $form .= '<br>' . _MB_NEWBB_TITLE_LENGTH . "<input type='text' name='options[5]' value='" . $options[5] . "' />"; |
|
| 718 | + $form .= '<br>'._MB_NEWBB_TITLE_LENGTH."<input type='text' name='options[5]' value='".$options[5]."' />"; |
|
| 719 | 719 | |
| 720 | - $form .= '<br><br>' . _MB_NEWBB_FORUMLIST; |
|
| 720 | + $form .= '<br><br>'._MB_NEWBB_FORUMLIST; |
|
| 721 | 721 | |
| 722 | 722 | $optionsForum = array_filter(array_slice($options, 6), 'b_newbb_array_filter'); // get allowed forums |
| 723 | 723 | $isAll = (0 === count($optionsForum) || empty($optionsForum[0])); |
@@ -726,7 +726,7 @@ discard block |
||
| 726 | 726 | if ($isAll) { |
| 727 | 727 | $form .= ' selected'; |
| 728 | 728 | } |
| 729 | - $form .= '>' . _ALL . '</option>'; |
|
| 729 | + $form .= '>'._ALL.'</option>'; |
|
| 730 | 730 | $form .= newbbForumSelectBox($optionsForum); |
| 731 | 731 | $form .= '</select><br>'; |
| 732 | 732 | |
@@ -739,64 +739,64 @@ discard block |
||
| 739 | 739 | */ |
| 740 | 740 | function b_newbb_topic_edit($options) |
| 741 | 741 | { |
| 742 | - require_once __DIR__ . '/../include/functions.forum.php'; |
|
| 743 | - $form = _MB_NEWBB_CRITERIA . "<select name='options[0]'>"; |
|
| 742 | + require_once __DIR__.'/../include/functions.forum.php'; |
|
| 743 | + $form = _MB_NEWBB_CRITERIA."<select name='options[0]'>"; |
|
| 744 | 744 | $form .= "<option value='time'"; |
| 745 | 745 | if ('time' === $options[0]) { |
| 746 | 746 | $form .= " selected='selected' "; |
| 747 | 747 | } |
| 748 | - $form .= '>' . _MB_NEWBB_CRITERIA_TIME . '</option>'; |
|
| 748 | + $form .= '>'._MB_NEWBB_CRITERIA_TIME.'</option>'; |
|
| 749 | 749 | $form .= "<option value='views'"; |
| 750 | 750 | if ('views' === $options[0]) { |
| 751 | 751 | $form .= " selected='selected' "; |
| 752 | 752 | } |
| 753 | - $form .= '>' . _MB_NEWBB_CRITERIA_VIEWS . '</option>'; |
|
| 753 | + $form .= '>'._MB_NEWBB_CRITERIA_VIEWS.'</option>'; |
|
| 754 | 754 | $form .= "<option value='replies'"; |
| 755 | 755 | if ('replies' === $options[0]) { |
| 756 | 756 | $form .= " selected='selected' "; |
| 757 | 757 | } |
| 758 | - $form .= '>' . _MB_NEWBB_CRITERIA_REPLIES . '</option>'; |
|
| 758 | + $form .= '>'._MB_NEWBB_CRITERIA_REPLIES.'</option>'; |
|
| 759 | 759 | $form .= "<option value='digest'"; |
| 760 | 760 | if ('digest' === $options[0]) { |
| 761 | 761 | $form .= " selected='selected' "; |
| 762 | 762 | } |
| 763 | - $form .= '>' . _MB_NEWBB_CRITERIA_DIGEST . '</option>'; |
|
| 763 | + $form .= '>'._MB_NEWBB_CRITERIA_DIGEST.'</option>'; |
|
| 764 | 764 | $form .= "<option value='sticky'"; |
| 765 | 765 | if ('sticky' === $options[0]) { |
| 766 | 766 | $form .= " selected='selected' "; |
| 767 | 767 | } |
| 768 | - $form .= '>' . _MB_NEWBB_CRITERIA_STICKY . '</option>'; |
|
| 768 | + $form .= '>'._MB_NEWBB_CRITERIA_STICKY.'</option>'; |
|
| 769 | 769 | $form .= '</select>'; |
| 770 | - $form .= '<br>' . _MB_NEWBB_DISPLAY . "<input type='text' name='options[1]' value='" . $options[1] . "' />"; |
|
| 771 | - $form .= '<br>' . _MB_NEWBB_TIME . "<input type='text' name='options[2]' value='" . $options[2] . "' />"; |
|
| 772 | - $form .= '<br> <small>' . _MB_NEWBB_TIME_DESC . '</small>'; |
|
| 773 | - $form .= '<br>' . _MB_NEWBB_DISPLAYMODE . "<input type='radio' name='options[3]' value='0'"; |
|
| 770 | + $form .= '<br>'._MB_NEWBB_DISPLAY."<input type='text' name='options[1]' value='".$options[1]."' />"; |
|
| 771 | + $form .= '<br>'._MB_NEWBB_TIME."<input type='text' name='options[2]' value='".$options[2]."' />"; |
|
| 772 | + $form .= '<br> <small>'._MB_NEWBB_TIME_DESC.'</small>'; |
|
| 773 | + $form .= '<br>'._MB_NEWBB_DISPLAYMODE."<input type='radio' name='options[3]' value='0'"; |
|
| 774 | 774 | if (0 == $options[3]) { |
| 775 | 775 | $form .= ' checked'; |
| 776 | 776 | } |
| 777 | - $form .= ' /> ' . _MB_NEWBB_DISPLAYMODE_FULL . "<input type='radio' name='options[3]' value='1'"; |
|
| 777 | + $form .= ' /> '._MB_NEWBB_DISPLAYMODE_FULL."<input type='radio' name='options[3]' value='1'"; |
|
| 778 | 778 | if (1 == $options[3]) { |
| 779 | 779 | $form .= ' checked'; |
| 780 | 780 | } |
| 781 | - $form .= ' /> ' . _MB_NEWBB_DISPLAYMODE_COMPACT . "<input type='radio' name='options[3]' value='2'"; |
|
| 781 | + $form .= ' /> '._MB_NEWBB_DISPLAYMODE_COMPACT."<input type='radio' name='options[3]' value='2'"; |
|
| 782 | 782 | if (2 == $options[3]) { |
| 783 | 783 | $form .= ' checked'; |
| 784 | 784 | } |
| 785 | - $form .= ' /> ' . _MB_NEWBB_DISPLAYMODE_LITE; |
|
| 785 | + $form .= ' /> '._MB_NEWBB_DISPLAYMODE_LITE; |
|
| 786 | 786 | |
| 787 | - $form .= '<br>' . _MB_NEWBB_INDEXNAV . '<input type="radio" name="options[4]" value="1"'; |
|
| 787 | + $form .= '<br>'._MB_NEWBB_INDEXNAV.'<input type="radio" name="options[4]" value="1"'; |
|
| 788 | 788 | if (1 == $options[4]) { |
| 789 | 789 | $form .= ' checked'; |
| 790 | 790 | } |
| 791 | - $form .= ' />' . _YES . '<input type="radio" name="options[4]" value="0"'; |
|
| 791 | + $form .= ' />'._YES.'<input type="radio" name="options[4]" value="0"'; |
|
| 792 | 792 | if (0 == $options[4]) { |
| 793 | 793 | $form .= ' checked'; |
| 794 | 794 | } |
| 795 | - $form .= ' />' . _NO; |
|
| 795 | + $form .= ' />'._NO; |
|
| 796 | 796 | |
| 797 | - $form .= '<br>' . _MB_NEWBB_TITLE_LENGTH . "<input type='text' name='options[5]' value='" . $options[5] . "' />"; |
|
| 797 | + $form .= '<br>'._MB_NEWBB_TITLE_LENGTH."<input type='text' name='options[5]' value='".$options[5]."' />"; |
|
| 798 | 798 | |
| 799 | - $form .= '<br><br>' . _MB_NEWBB_FORUMLIST; |
|
| 799 | + $form .= '<br><br>'._MB_NEWBB_FORUMLIST; |
|
| 800 | 800 | |
| 801 | 801 | $optionsForum = array_filter(array_slice($options, 6), 'b_newbb_array_filter'); // get allowed forums |
| 802 | 802 | |
@@ -806,7 +806,7 @@ discard block |
||
| 806 | 806 | if ($isAll) { |
| 807 | 807 | $form .= ' selected="selected"'; |
| 808 | 808 | } |
| 809 | - $form .= '>' . _ALL . '</option>'; |
|
| 809 | + $form .= '>'._ALL.'</option>'; |
|
| 810 | 810 | $form .= newbbForumSelectBox($optionsForum); |
| 811 | 811 | $form .= '</select><br>'; |
| 812 | 812 | |
@@ -819,49 +819,49 @@ discard block |
||
| 819 | 819 | */ |
| 820 | 820 | function b_newbb_post_edit($options) |
| 821 | 821 | { |
| 822 | - require_once __DIR__ . '/../include/functions.forum.php'; |
|
| 823 | - $form = _MB_NEWBB_CRITERIA . "<select name='options[0]'>"; |
|
| 822 | + require_once __DIR__.'/../include/functions.forum.php'; |
|
| 823 | + $form = _MB_NEWBB_CRITERIA."<select name='options[0]'>"; |
|
| 824 | 824 | $form .= "<option value='title'"; |
| 825 | 825 | if ('title' === $options[0]) { |
| 826 | 826 | $form .= " selected='selected' "; |
| 827 | 827 | } |
| 828 | - $form .= '>' . _MB_NEWBB_CRITERIA_TITLE . '</option>'; |
|
| 828 | + $form .= '>'._MB_NEWBB_CRITERIA_TITLE.'</option>'; |
|
| 829 | 829 | $form .= "<option value='text'"; |
| 830 | 830 | if ('text' === $options[0]) { |
| 831 | 831 | $form .= " selected='selected' "; |
| 832 | 832 | } |
| 833 | - $form .= '>' . _MB_NEWBB_CRITERIA_TEXT . '</option>'; |
|
| 833 | + $form .= '>'._MB_NEWBB_CRITERIA_TEXT.'</option>'; |
|
| 834 | 834 | $form .= '</select>'; |
| 835 | - $form .= '<br>' . _MB_NEWBB_DISPLAY . "<input type='text' name='options[1]' value='" . $options[1] . "' />"; |
|
| 836 | - $form .= '<br>' . _MB_NEWBB_TIME . "<input type='text' name='options[2]' value='" . $options[2] . "' />"; |
|
| 837 | - $form .= '<br> <small>' . _MB_NEWBB_TIME_DESC . '</small>'; |
|
| 838 | - $form .= '<br>' . _MB_NEWBB_DISPLAYMODE . "<input type='radio' name='options[3]' value='0'"; |
|
| 835 | + $form .= '<br>'._MB_NEWBB_DISPLAY."<input type='text' name='options[1]' value='".$options[1]."' />"; |
|
| 836 | + $form .= '<br>'._MB_NEWBB_TIME."<input type='text' name='options[2]' value='".$options[2]."' />"; |
|
| 837 | + $form .= '<br> <small>'._MB_NEWBB_TIME_DESC.'</small>'; |
|
| 838 | + $form .= '<br>'._MB_NEWBB_DISPLAYMODE."<input type='radio' name='options[3]' value='0'"; |
|
| 839 | 839 | if (0 == $options[3]) { |
| 840 | 840 | $form .= ' checked'; |
| 841 | 841 | } |
| 842 | - $form .= ' /> ' . _MB_NEWBB_DISPLAYMODE_FULL . "<input type='radio' name='options[3]' value='1'"; |
|
| 842 | + $form .= ' /> '._MB_NEWBB_DISPLAYMODE_FULL."<input type='radio' name='options[3]' value='1'"; |
|
| 843 | 843 | if (1 == $options[3]) { |
| 844 | 844 | $form .= ' checked'; |
| 845 | 845 | } |
| 846 | - $form .= ' /> ' . _MB_NEWBB_DISPLAYMODE_COMPACT . "<input type='radio' name='options[3]' value='2'"; |
|
| 846 | + $form .= ' /> '._MB_NEWBB_DISPLAYMODE_COMPACT."<input type='radio' name='options[3]' value='2'"; |
|
| 847 | 847 | if (2 == $options[3]) { |
| 848 | 848 | $form .= ' checked'; |
| 849 | 849 | } |
| 850 | - $form .= ' /> ' . _MB_NEWBB_DISPLAYMODE_LITE; |
|
| 850 | + $form .= ' /> '._MB_NEWBB_DISPLAYMODE_LITE; |
|
| 851 | 851 | |
| 852 | - $form .= '<br>' . _MB_NEWBB_INDEXNAV . '<input type="radio" name="options[4]" value="1"'; |
|
| 852 | + $form .= '<br>'._MB_NEWBB_INDEXNAV.'<input type="radio" name="options[4]" value="1"'; |
|
| 853 | 853 | if (1 == $options[4]) { |
| 854 | 854 | $form .= ' checked'; |
| 855 | 855 | } |
| 856 | - $form .= ' />' . _YES . '<input type="radio" name="options[4]" value="0"'; |
|
| 856 | + $form .= ' />'._YES.'<input type="radio" name="options[4]" value="0"'; |
|
| 857 | 857 | if (0 == $options[4]) { |
| 858 | 858 | $form .= ' checked'; |
| 859 | 859 | } |
| 860 | - $form .= ' />' . _NO; |
|
| 860 | + $form .= ' />'._NO; |
|
| 861 | 861 | |
| 862 | - $form .= '<br>' . _MB_NEWBB_TITLE_LENGTH . "<input type='text' name='options[5]' value='" . $options[5] . "' />"; |
|
| 862 | + $form .= '<br>'._MB_NEWBB_TITLE_LENGTH."<input type='text' name='options[5]' value='".$options[5]."' />"; |
|
| 863 | 863 | |
| 864 | - $form .= '<br><br>' . _MB_NEWBB_FORUMLIST; |
|
| 864 | + $form .= '<br><br>'._MB_NEWBB_FORUMLIST; |
|
| 865 | 865 | |
| 866 | 866 | $optionsForum = array_filter(array_slice($options, 6), 'b_newbb_array_filter'); // get allowed forums |
| 867 | 867 | $isAll = (0 === count($optionsForum) || empty($optionsForum[0])); |
@@ -870,7 +870,7 @@ discard block |
||
| 870 | 870 | if ($isAll) { |
| 871 | 871 | $form .= ' selected="selected"'; |
| 872 | 872 | } |
| 873 | - $form .= '>' . _ALL . '</option>'; |
|
| 873 | + $form .= '>'._ALL.'</option>'; |
|
| 874 | 874 | $form .= newbbForumSelectBox($optionsForum); |
| 875 | 875 | $form .= '</select><br>'; |
| 876 | 876 | |
@@ -883,53 +883,53 @@ discard block |
||
| 883 | 883 | */ |
| 884 | 884 | function b_newbb_author_edit($options) |
| 885 | 885 | { |
| 886 | - require_once __DIR__ . '/../include/functions.forum.php'; |
|
| 887 | - $form = _MB_NEWBB_CRITERIA . "<select name='options[0]'>"; |
|
| 886 | + require_once __DIR__.'/../include/functions.forum.php'; |
|
| 887 | + $form = _MB_NEWBB_CRITERIA."<select name='options[0]'>"; |
|
| 888 | 888 | $form .= "<option value='post'"; |
| 889 | 889 | if ('post' === $options[0]) { |
| 890 | 890 | $form .= " selected='selected' "; |
| 891 | 891 | } |
| 892 | - $form .= '>' . _MB_NEWBB_CRITERIA_POST . '</option>'; |
|
| 892 | + $form .= '>'._MB_NEWBB_CRITERIA_POST.'</option>'; |
|
| 893 | 893 | $form .= "<option value='topic'"; |
| 894 | 894 | if ('topic' === $options[0]) { |
| 895 | 895 | $form .= " selected='selected' "; |
| 896 | 896 | } |
| 897 | - $form .= '>' . _MB_NEWBB_CRITERIA_TOPIC . '</option>'; |
|
| 897 | + $form .= '>'._MB_NEWBB_CRITERIA_TOPIC.'</option>'; |
|
| 898 | 898 | $form .= "<option value='digest'"; |
| 899 | 899 | if ('digest' === $options[0]) { |
| 900 | 900 | $form .= " selected='selected' "; |
| 901 | 901 | } |
| 902 | - $form .= '>' . _MB_NEWBB_CRITERIA_DIGESTS . '</option>'; |
|
| 902 | + $form .= '>'._MB_NEWBB_CRITERIA_DIGESTS.'</option>'; |
|
| 903 | 903 | $form .= "<option value='sticky'"; |
| 904 | 904 | if ('sticky' === $options[0]) { |
| 905 | 905 | $form .= " selected='selected' "; |
| 906 | 906 | } |
| 907 | - $form .= '>' . _MB_NEWBB_CRITERIA_STICKYS . '</option>'; |
|
| 907 | + $form .= '>'._MB_NEWBB_CRITERIA_STICKYS.'</option>'; |
|
| 908 | 908 | $form .= '</select>'; |
| 909 | - $form .= '<br>' . _MB_NEWBB_DISPLAY . "<input type='text' name='options[1]' value='" . $options[1] . "' />"; |
|
| 910 | - $form .= '<br>' . _MB_NEWBB_TIME . "<input type='text' name='options[2]' value='" . $options[2] . "' />"; |
|
| 911 | - $form .= '<br> <small>' . _MB_NEWBB_TIME_DESC . '</small>'; |
|
| 912 | - $form .= '<br>' . _MB_NEWBB_DISPLAYMODE . "<input type='radio' name='options[3]' value='0'"; |
|
| 909 | + $form .= '<br>'._MB_NEWBB_DISPLAY."<input type='text' name='options[1]' value='".$options[1]."' />"; |
|
| 910 | + $form .= '<br>'._MB_NEWBB_TIME."<input type='text' name='options[2]' value='".$options[2]."' />"; |
|
| 911 | + $form .= '<br> <small>'._MB_NEWBB_TIME_DESC.'</small>'; |
|
| 912 | + $form .= '<br>'._MB_NEWBB_DISPLAYMODE."<input type='radio' name='options[3]' value='0'"; |
|
| 913 | 913 | if (0 == $options[3]) { |
| 914 | 914 | $form .= ' checked'; |
| 915 | 915 | } |
| 916 | - $form .= ' /> ' . _MB_NEWBB_DISPLAYMODE_COMPACT . "<input type='radio' name='options[3]' value='1'"; |
|
| 916 | + $form .= ' /> '._MB_NEWBB_DISPLAYMODE_COMPACT."<input type='radio' name='options[3]' value='1'"; |
|
| 917 | 917 | if (1 == $options[3]) { |
| 918 | 918 | $form .= ' checked'; |
| 919 | 919 | } |
| 920 | - $form .= ' /> ' . _MB_NEWBB_DISPLAYMODE_LITE; |
|
| 920 | + $form .= ' /> '._MB_NEWBB_DISPLAYMODE_LITE; |
|
| 921 | 921 | |
| 922 | - $form .= '<br>' . _MB_NEWBB_INDEXNAV . '<input type="radio" name="options[4]" value="1"'; |
|
| 922 | + $form .= '<br>'._MB_NEWBB_INDEXNAV.'<input type="radio" name="options[4]" value="1"'; |
|
| 923 | 923 | if (1 == $options[4]) { |
| 924 | 924 | $form .= ' checked'; |
| 925 | 925 | } |
| 926 | - $form .= ' />' . _YES . '<input type="radio" name="options[4]" value="0"'; |
|
| 926 | + $form .= ' />'._YES.'<input type="radio" name="options[4]" value="0"'; |
|
| 927 | 927 | if (0 == $options[4]) { |
| 928 | 928 | $form .= ' checked'; |
| 929 | 929 | } |
| 930 | - $form .= ' />' . _NO; |
|
| 930 | + $form .= ' />'._NO; |
|
| 931 | 931 | |
| 932 | - $form .= '<br><br>' . _MB_NEWBB_FORUMLIST; |
|
| 932 | + $form .= '<br><br>'._MB_NEWBB_FORUMLIST; |
|
| 933 | 933 | |
| 934 | 934 | $optionsForum = array_filter(array_slice($options, 5), 'b_newbb_array_filter'); // get allowed forums |
| 935 | 935 | $isAll = (0 === count($optionsForum) || empty($optionsForum[0])); |
@@ -938,7 +938,7 @@ discard block |
||
| 938 | 938 | if ($isAll) { |
| 939 | 939 | $form .= ' selected="selected"'; |
| 940 | 940 | } |
| 941 | - $form .= '>' . _ALL . '</option>'; |
|
| 941 | + $form .= '>'._ALL.'</option>'; |
|
| 942 | 942 | $form .= newbbForumSelectBox($optionsForum); |
| 943 | 943 | $form .= '</select><br>'; |
| 944 | 944 | |
@@ -952,8 +952,8 @@ discard block |
||
| 952 | 952 | function b_newbb_custom($options) |
| 953 | 953 | { |
| 954 | 954 | // if no newbb module block set, we have to include the language file |
| 955 | - if (is_readable($GLOBALS['xoops']->path('modules/newbb/language/' . $GLOBALS['xoopsConfig']['language'] . '/blocks.php'))) { |
|
| 956 | - require_once $GLOBALS['xoops']->path('modules/newbb/language/' . $GLOBALS['xoopsConfig']['language'] . '/blocks.php'); |
|
| 955 | + if (is_readable($GLOBALS['xoops']->path('modules/newbb/language/'.$GLOBALS['xoopsConfig']['language'].'/blocks.php'))) { |
|
| 956 | + require_once $GLOBALS['xoops']->path('modules/newbb/language/'.$GLOBALS['xoopsConfig']['language'].'/blocks.php'); |
|
| 957 | 957 | } else { |
| 958 | 958 | require_once $GLOBALS['xoops']->path('modules/newbb/language/english/blocks.php'); |
| 959 | 959 | } |
@@ -977,8 +977,8 @@ discard block |
||
| 977 | 977 | { |
| 978 | 978 | |
| 979 | 979 | // if no newbb module block set, we have to include the language file |
| 980 | - if (is_readable($GLOBALS['xoops']->path('modules/newbb/language/' . $GLOBALS['xoopsConfig']['language'] . '/blocks.php'))) { |
|
| 981 | - require_once $GLOBALS['xoops']->path('modules/newbb/language/' . $GLOBALS['xoopsConfig']['language'] . '/blocks.php'); |
|
| 980 | + if (is_readable($GLOBALS['xoops']->path('modules/newbb/language/'.$GLOBALS['xoopsConfig']['language'].'/blocks.php'))) { |
|
| 981 | + require_once $GLOBALS['xoops']->path('modules/newbb/language/'.$GLOBALS['xoopsConfig']['language'].'/blocks.php'); |
|
| 982 | 982 | } else { |
| 983 | 983 | require_once $GLOBALS['xoops']->path('modules/newbb/language/english/blocks.php'); |
| 984 | 984 | } |
@@ -1002,8 +1002,8 @@ discard block |
||
| 1002 | 1002 | { |
| 1003 | 1003 | |
| 1004 | 1004 | // if no newbb module block set, we have to include the language file |
| 1005 | - if (is_readable($GLOBALS['xoops']->path('modules/newbb/language/' . $GLOBALS['xoopsConfig']['language'] . '/blocks.php'))) { |
|
| 1006 | - require_once $GLOBALS['xoops']->path('modules/newbb/language/' . $GLOBALS['xoopsConfig']['language'] . '/blocks.php'); |
|
| 1005 | + if (is_readable($GLOBALS['xoops']->path('modules/newbb/language/'.$GLOBALS['xoopsConfig']['language'].'/blocks.php'))) { |
|
| 1006 | + require_once $GLOBALS['xoops']->path('modules/newbb/language/'.$GLOBALS['xoopsConfig']['language'].'/blocks.php'); |
|
| 1007 | 1007 | } else { |
| 1008 | 1008 | require_once $GLOBALS['xoops']->path('modules/newbb/language/english/blocks.php'); |
| 1009 | 1009 | } |
@@ -1026,8 +1026,8 @@ discard block |
||
| 1026 | 1026 | function b_newbb_custom_author($options) |
| 1027 | 1027 | { |
| 1028 | 1028 | // if no newbb module block set, we have to include the language file |
| 1029 | - if (is_readable($GLOBALS['xoops']->path('modules/newbb/language/' . $GLOBALS['xoopsConfig']['language'] . '/blocks.php'))) { |
|
| 1030 | - require_once $GLOBALS['xoops']->path('modules/newbb/language/' . $GLOBALS['xoopsConfig']['language'] . '/blocks.php'); |
|
| 1029 | + if (is_readable($GLOBALS['xoops']->path('modules/newbb/language/'.$GLOBALS['xoopsConfig']['language'].'/blocks.php'))) { |
|
| 1030 | + require_once $GLOBALS['xoops']->path('modules/newbb/language/'.$GLOBALS['xoopsConfig']['language'].'/blocks.php'); |
|
| 1031 | 1031 | } else { |
| 1032 | 1032 | require_once $GLOBALS['xoops']->path('modules/newbb/language/english/blocks.php'); |
| 1033 | 1033 | } |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | define('_AM_NEWBB_DIGEST_HELP_4', 'After creating and sending, do not delete the created messages. Otherwise they will be generated again.'); |
| 77 | 77 | define( |
| 78 | 78 | '_AM_NEWBB_DIGEST_HELP_AUTO_DIGEST', |
| 79 | - 'To configure the automatic creation and distribution of Digest topics, you need to create a cron task on your server.<br>For example: * NIX systems: <strong>0 6 * * * wget --post-data \'foo=bar\' https://example.com/modules/newbb/digest.php</strong><br>In this example, the script will run every day at 6.00 and check if there are any new Digest topics. If they are not found, mailing will not be done.<br>If for any reason you do not have the opportunity to create a task, then it is possible to create and make the dispatch on this page manually by clicking on the button above.<br>Please note that it is not recommended to delete created mailings, otherwise they will be created and sent again.' |
|
| 79 | + 'To configure the automatic creation and distribution of Digest topics, you need to create a cron task on your server.<br>For example: * NIX systems: <strong>0 6 * * * wget --post-data \'foo=bar\' https://example.com/modules/newbb/digest.php</strong><br>In this example, the script will run every day at 6.00 and check if there are any new Digest topics. If they are not found, mailing will not be done.<br>If for any reason you do not have the opportunity to create a task, then it is possible to create and make the dispatch on this page manually by clicking on the button above.<br>Please note that it is not recommended to delete created mailings, otherwise they will be created and sent again.' |
|
| 80 | 80 | ); |
| 81 | 81 | //define('_AM_NEWBB_DIGEST_PAST', '<span style="color:red;">Should be sent out %d minutes ago</span>'); |
| 82 | 82 | //define('_AM_NEWBB_DIGEST_NEXT', 'Need to send out in %d minutes'); |
@@ -325,30 +325,30 @@ discard block |
||
| 325 | 325 | // Help tab |
| 326 | 326 | define( |
| 327 | 327 | '_AM_NEWBB_HELP_CATEGORY_TAB', |
| 328 | - 'To create a category, use the button above and fill in all the fields on the form.<br>By default, category images are located: /modules/newbb/assets/images/category/<br>Sponsor link should be written in the following format: https://xoops.org/modules/newbb/ newBB Support. First the link, then the sponsor\'s name or other text.' |
|
| 328 | + 'To create a category, use the button above and fill in all the fields on the form.<br>By default, category images are located: /modules/newbb/assets/images/category/<br>Sponsor link should be written in the following format: https://xoops.org/modules/newbb/ newBB Support. First the link, then the sponsor\'s name or other text.' |
|
| 329 | 329 | ); |
| 330 | 330 | define( |
| 331 | 331 | '_AM_NEWBB_HELP_FORUM_TAB', |
| 332 | - 'To create and manage the forums use the buttons with the right<br>To create the forum, use the \'Create forum\' button. Then fill in all the fields of the form. You can also create a subforum.<br>To move the forum between categories, use the \'Move\' button. Follow the further instructions.<br>To merge forums, use the \'Merge\' button. Follow the further instructions.<br>If you have an access rights template, then you can apply it to the forum you are creating.' |
|
| 332 | + 'To create and manage the forums use the buttons with the right<br>To create the forum, use the \'Create forum\' button. Then fill in all the fields of the form. You can also create a subforum.<br>To move the forum between categories, use the \'Move\' button. Follow the further instructions.<br>To merge forums, use the \'Merge\' button. Follow the further instructions.<br>If you have an access rights template, then you can apply it to the forum you are creating.' |
|
| 333 | 333 | ); |
| 334 | 334 | define( |
| 335 | 335 | '_AM_NEWBB_HELP_PERMISSION_TAB', |
| 336 | - '<strong>When setting permissions, be careful.</strong><br>After you install and apply the settings, you will automatically go to the next permissions tab.<br>Also here it is possible to create a default access rights template and apply it either to one forum or to all forums.' |
|
| 336 | + '<strong>When setting permissions, be careful.</strong><br>After you install and apply the settings, you will automatically go to the next permissions tab.<br>Also here it is possible to create a default access rights template and apply it either to one forum or to all forums.' |
|
| 337 | 337 | ); |
| 338 | 338 | define('_AM_NEWBB_HELP_ORDER_TAB', 'Allows you to set the order of categories and forums relative to each other.<br>The order (Weight) is set to 0 - top, 99 (and further) - bottom.'); |
| 339 | 339 | define('_AM_NEWBB_HELP_PRUNE_TAB', 'Allows you to clear forums from empty themes, obsolete themes, etc.<br>Also you can not delete topics that you want to clear, but transfer them to a specially created category \'Archive\' or any other.'); |
| 340 | 340 | define( |
| 341 | 341 | '_AM_NEWBB_HELP_REPORT_TAB', |
| 342 | - 'Allows you to process reports that users send to you if they believe that the message on the forum does not comply with forum rules or ethical rules.<br>You can review the report and take action in relation to the message, the author, etc.<br>When a user sends a message, moderators and administrators are notified by e-mail.' |
|
| 342 | + 'Allows you to process reports that users send to you if they believe that the message on the forum does not comply with forum rules or ethical rules.<br>You can review the report and take action in relation to the message, the author, etc.<br>When a user sends a message, moderators and administrators are notified by e-mail.' |
|
| 343 | 343 | ); |
| 344 | 344 | define('_AM_NEWBB_HELP_VOTE_TAB', 'If you have the voting function enabled, here you can see the results of the voting.<br>This vote is not associated with other XOOPS modules.'); |
| 345 | 345 | define( |
| 346 | 346 | '_AM_NEWBB_HELP_TYPE_TAB', |
| 347 | - 'Allows you to create tags for highlighting themes. For example:<br><strong style="color:blue;">[Important]</strong> <strong>Topic Title</strong><br><strong style="color:red;">[ATTENTION]</strong> <strong>Topic Title</strong><br>You can set theme types when creating a theme on the user side.' |
|
| 347 | + 'Allows you to create tags for highlighting themes. For example:<br><strong style="color:blue;">[Important]</strong> <strong>Topic Title</strong><br><strong style="color:red;">[ATTENTION]</strong> <strong>Topic Title</strong><br>You can set theme types when creating a theme on the user side.' |
|
| 348 | 348 | ); |
| 349 | 349 | define( |
| 350 | 350 | '_AM_NEWBB_HELP_GROUPMOD_TAB', |
| 351 | - 'Allows you to install users of certain groups as moderators for the entire module, and for individual categories and forums.<br>It is recommended to create separate groups of moderators, for more convenient management of moderators.<br>You can also assign specific users to moderators when creating a forum.' |
|
| 351 | + 'Allows you to install users of certain groups as moderators for the entire module, and for individual categories and forums.<br>It is recommended to create separate groups of moderators, for more convenient management of moderators.<br>You can also assign specific users to moderators when creating a forum.' |
|
| 352 | 352 | ); |
| 353 | 353 | define('_AM_NEWBB_HELP_SYNC_TAB', 'If you notice a problem with the message dates, the appearance of blank messages, etc. Here you can synchronize and correct forum data and topics'); |
| 354 | 354 | |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | define('_MI_NEWBB_DIR_ATTACHMENT', 'Attachments physical path.'); |
| 44 | 44 | define( |
| 45 | 45 | '_MI_NEWBB_DIR_ATTACHMENT_DESC', |
| 46 | - "Physical path only needs to be set from your xoops root and not before, for example you may have attachments uploaded to www.yoururl.com/uploads/newbb the path entered would then be '/uploads/newbb' never include a trailing slash '/' the thumbnails path becomes '/uploads/newbb/thumbs'" |
|
| 46 | + "Physical path only needs to be set from your xoops root and not before, for example you may have attachments uploaded to www.yoururl.com/uploads/newbb the path entered would then be '/uploads/newbb' never include a trailing slash '/' the thumbnails path becomes '/uploads/newbb/thumbs'" |
|
| 47 | 47 | ); |
| 48 | 48 | define('_MI_NEWBB_PATH_MAGICK', 'Path for ImageMagick'); |
| 49 | 49 | define('_MI_NEWBB_PATH_MAGICK_DESC', "Usually it is '/usr/bin/X11'. Leave it BLANK if you do not have ImageMagicK installed or for autodetecting."); |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | define('_MI_NEWBB_USERLEVEL', 'HP/MP/EXP Level Mode'); |
| 83 | 83 | define( |
| 84 | 84 | '_MI_NEWBB_USERLEVEL_DESC', |
| 85 | - '<strong>HP</strong> is determined by your average posts per day.<br><strong>MP</strong> is determined by your join date related to your post count.<br><strong>EXP</strong> goes up each time you post, and when you get to 100%, you gain a level and the EXP drops to 0 again.' |
|
| 85 | + '<strong>HP</strong> is determined by your average posts per day.<br><strong>MP</strong> is determined by your join date related to your post count.<br><strong>EXP</strong> goes up each time you post, and when you get to 100%, you gain a level and the EXP drops to 0 again.' |
|
| 86 | 86 | ); |
| 87 | 87 | define('_MI_NEWBB_RSS_ENABLE', 'Enable RSS Feed'); |
| 88 | 88 | define('_MI_NEWBB_RSS_ENABLE_DESC', 'Enable RSS Feed, edit options below for maximum Items and Description length'); |
@@ -46,179 +46,179 @@ |
||
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | switch ($op) { |
| 49 | - case 'restore': |
|
| 50 | - $post_id = array_values($post_id); |
|
| 51 | - sort($post_id); |
|
| 52 | - $topics = []; |
|
| 53 | - $forums = []; |
|
| 54 | - foreach ($post_id as $post) { |
|
| 55 | - $postObject = $postHandler->get($post); |
|
| 56 | - if ($postObject->getVar('topic_id') < 1) { |
|
| 57 | - continue; |
|
| 49 | + case 'restore': |
|
| 50 | + $post_id = array_values($post_id); |
|
| 51 | + sort($post_id); |
|
| 52 | + $topics = []; |
|
| 53 | + $forums = []; |
|
| 54 | + foreach ($post_id as $post) { |
|
| 55 | + $postObject = $postHandler->get($post); |
|
| 56 | + if ($postObject->getVar('topic_id') < 1) { |
|
| 57 | + continue; |
|
| 58 | + } |
|
| 59 | + |
|
| 60 | + $postHandler->approve($postObject, true); |
|
| 61 | + $topics[$postObject->getVar('topic_id')] = 1; |
|
| 62 | + $forums[$postObject->getVar('forum_id')] = 1; |
|
| 63 | + unset($postObject); |
|
| 64 | + } |
|
| 65 | + foreach (array_keys($topics) as $topic) { |
|
| 66 | + $topicHandler->synchronization($topic); |
|
| 67 | + } |
|
| 68 | + foreach (array_keys($forums) as $forum) { |
|
| 69 | + $forumHandler->synchronization($forum); |
|
| 70 | + } |
|
| 71 | + break; |
|
| 72 | + case 'approve': |
|
| 73 | + $post_id = array_values($post_id); |
|
| 74 | + sort($post_id); |
|
| 75 | + $topics = []; |
|
| 76 | + $forums = []; |
|
| 77 | + $criteria = new \Criteria('post_id', '(' . implode(',', $post_id) . ')', 'IN'); |
|
| 78 | + $postsObject = $postHandler->getObjects($criteria, true); |
|
| 79 | + foreach ($post_id as $post) { |
|
| 80 | + /** @var Newbb\Post $postObject */ |
|
| 81 | + $postObject = $postsObject[$post]; |
|
| 82 | + if (!empty($topic_id) && $topic_id !== $postObject->getVar('topic_id')) { |
|
| 83 | + continue; |
|
| 84 | + } |
|
| 85 | + $postHandler->approve($postObject); |
|
| 86 | + $topics[$postObject->getVar('topic_id')] = $post; |
|
| 87 | + $forums[$postObject->getVar('forum_id')] = 1; |
|
| 88 | + } |
|
| 89 | + foreach (array_keys($topics) as $topic) { |
|
| 90 | + $topicHandler->synchronization($topic); |
|
| 91 | + } |
|
| 92 | + foreach (array_keys($forums) as $forum) { |
|
| 93 | + $forumHandler->synchronization($forum); |
|
| 58 | 94 | } |
| 59 | 95 | |
| 60 | - $postHandler->approve($postObject, true); |
|
| 61 | - $topics[$postObject->getVar('topic_id')] = 1; |
|
| 62 | - $forums[$postObject->getVar('forum_id')] = 1; |
|
| 63 | - unset($postObject); |
|
| 64 | - } |
|
| 65 | - foreach (array_keys($topics) as $topic) { |
|
| 66 | - $topicHandler->synchronization($topic); |
|
| 67 | - } |
|
| 68 | - foreach (array_keys($forums) as $forum) { |
|
| 69 | - $forumHandler->synchronization($forum); |
|
| 70 | - } |
|
| 71 | - break; |
|
| 72 | - case 'approve': |
|
| 73 | - $post_id = array_values($post_id); |
|
| 74 | - sort($post_id); |
|
| 75 | - $topics = []; |
|
| 76 | - $forums = []; |
|
| 77 | - $criteria = new \Criteria('post_id', '(' . implode(',', $post_id) . ')', 'IN'); |
|
| 78 | - $postsObject = $postHandler->getObjects($criteria, true); |
|
| 79 | - foreach ($post_id as $post) { |
|
| 80 | - /** @var Newbb\Post $postObject */ |
|
| 81 | - $postObject = $postsObject[$post]; |
|
| 82 | - if (!empty($topic_id) && $topic_id !== $postObject->getVar('topic_id')) { |
|
| 83 | - continue; |
|
| 96 | + if (empty($GLOBALS['xoopsModuleConfig']['notification_enabled'])) { |
|
| 97 | + break; |
|
| 98 | + } |
|
| 99 | + |
|
| 100 | + $criteria_topic = new \Criteria('topic_id', '(' . implode(',', array_keys($topics)) . ')', 'IN'); |
|
| 101 | + $topic_list = $topicHandler->getList($criteria_topic, true); |
|
| 102 | + |
|
| 103 | + $criteria_forum = new \Criteria('forum_id', '(' . implode(',', array_keys($forums)) . ')', 'IN'); |
|
| 104 | + $forum_list = $forumHandler->getList($criteria_forum); |
|
| 105 | + |
|
| 106 | + require_once __DIR__ . '/include/notification.inc.php'; |
|
| 107 | + /** @var \XoopsNotificationHandler $notificationHandler */ |
|
| 108 | + $notificationHandler = xoops_getHandler('notification'); |
|
| 109 | + foreach ($post_id as $post) { |
|
| 110 | + $tags = []; |
|
| 111 | + /** @var Newbb\Post[] $postsObject [$post] */ |
|
| 112 | + $tags['THREAD_NAME'] = $topic_list[$postsObject[$post]->getVar('topic_id')]; |
|
| 113 | + $tags['THREAD_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewtopic.php?topic_id=' . $postsObject[$post]->getVar('topic_id') . '&forum=' . $postsObject[$post]->getVar('forum_id'); |
|
| 114 | + $tags['FORUM_NAME'] = $forum_list[$postsObject[$post]->getVar('forum_id')]; |
|
| 115 | + $tags['FORUM_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewforum.php?forum=' . $postsObject[$post]->getVar('forum_id'); |
|
| 116 | + $tags['POST_URL'] = $tags['THREAD_URL'] . '#forumpost' . $post; |
|
| 117 | + $notificationHandler->triggerEvent('thread', $postsObject[$post]->getVar('topic_id'), 'new_post', $tags); |
|
| 118 | + $notificationHandler->triggerEvent('forum', $postsObject[$post]->getVar('forum_id'), 'new_post', $tags); |
|
| 119 | + $notificationHandler->triggerEvent('global', 0, 'new_post', $tags); |
|
| 120 | + $tags['POST_CONTENT'] = $postsObject[$post]->getVar('post_text'); |
|
| 121 | + $tags['POST_NAME'] = $postsObject[$post]->getVar('subject'); |
|
| 122 | + $notificationHandler->triggerEvent('global', 0, 'new_fullpost', $tags); |
|
| 123 | + $notificationHandler->triggerEvent('forum', $postsObject[$post]->getVar('forum_id'), 'new_fullpost', $tags); |
|
| 84 | 124 | } |
| 85 | - $postHandler->approve($postObject); |
|
| 86 | - $topics[$postObject->getVar('topic_id')] = $post; |
|
| 87 | - $forums[$postObject->getVar('forum_id')] = 1; |
|
| 88 | - } |
|
| 89 | - foreach (array_keys($topics) as $topic) { |
|
| 90 | - $topicHandler->synchronization($topic); |
|
| 91 | - } |
|
| 92 | - foreach (array_keys($forums) as $forum) { |
|
| 93 | - $forumHandler->synchronization($forum); |
|
| 94 | - } |
|
| 95 | - |
|
| 96 | - if (empty($GLOBALS['xoopsModuleConfig']['notification_enabled'])) { |
|
| 97 | 125 | break; |
| 98 | - } |
|
| 99 | - |
|
| 100 | - $criteria_topic = new \Criteria('topic_id', '(' . implode(',', array_keys($topics)) . ')', 'IN'); |
|
| 101 | - $topic_list = $topicHandler->getList($criteria_topic, true); |
|
| 102 | - |
|
| 103 | - $criteria_forum = new \Criteria('forum_id', '(' . implode(',', array_keys($forums)) . ')', 'IN'); |
|
| 104 | - $forum_list = $forumHandler->getList($criteria_forum); |
|
| 105 | - |
|
| 106 | - require_once __DIR__ . '/include/notification.inc.php'; |
|
| 107 | - /** @var \XoopsNotificationHandler $notificationHandler */ |
|
| 108 | - $notificationHandler = xoops_getHandler('notification'); |
|
| 109 | - foreach ($post_id as $post) { |
|
| 110 | - $tags = []; |
|
| 111 | - /** @var Newbb\Post[] $postsObject [$post] */ |
|
| 112 | - $tags['THREAD_NAME'] = $topic_list[$postsObject[$post]->getVar('topic_id')]; |
|
| 113 | - $tags['THREAD_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewtopic.php?topic_id=' . $postsObject[$post]->getVar('topic_id') . '&forum=' . $postsObject[$post]->getVar('forum_id'); |
|
| 114 | - $tags['FORUM_NAME'] = $forum_list[$postsObject[$post]->getVar('forum_id')]; |
|
| 115 | - $tags['FORUM_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewforum.php?forum=' . $postsObject[$post]->getVar('forum_id'); |
|
| 116 | - $tags['POST_URL'] = $tags['THREAD_URL'] . '#forumpost' . $post; |
|
| 117 | - $notificationHandler->triggerEvent('thread', $postsObject[$post]->getVar('topic_id'), 'new_post', $tags); |
|
| 118 | - $notificationHandler->triggerEvent('forum', $postsObject[$post]->getVar('forum_id'), 'new_post', $tags); |
|
| 119 | - $notificationHandler->triggerEvent('global', 0, 'new_post', $tags); |
|
| 120 | - $tags['POST_CONTENT'] = $postsObject[$post]->getVar('post_text'); |
|
| 121 | - $tags['POST_NAME'] = $postsObject[$post]->getVar('subject'); |
|
| 122 | - $notificationHandler->triggerEvent('global', 0, 'new_fullpost', $tags); |
|
| 123 | - $notificationHandler->triggerEvent('forum', $postsObject[$post]->getVar('forum_id'), 'new_fullpost', $tags); |
|
| 124 | - } |
|
| 125 | - break; |
|
| 126 | - case 'delete': |
|
| 127 | - $post_id = array_values($post_id); |
|
| 128 | - rsort($post_id); |
|
| 129 | - $topics = []; |
|
| 130 | - $forums = []; |
|
| 131 | - foreach ($post_id as $post) { |
|
| 132 | - $postObject = $postHandler->get($post); |
|
| 133 | - if (!empty($topic_id) && $topic_id !== $postObject->getVar('topic_id')) { |
|
| 134 | - continue; |
|
| 126 | + case 'delete': |
|
| 127 | + $post_id = array_values($post_id); |
|
| 128 | + rsort($post_id); |
|
| 129 | + $topics = []; |
|
| 130 | + $forums = []; |
|
| 131 | + foreach ($post_id as $post) { |
|
| 132 | + $postObject = $postHandler->get($post); |
|
| 133 | + if (!empty($topic_id) && $topic_id !== $postObject->getVar('topic_id')) { |
|
| 134 | + continue; |
|
| 135 | + } |
|
| 136 | + $topics[$postObject->getVar('topic_id')] = 1; |
|
| 137 | + $forums[$postObject->getVar('forum_id')] = 1; |
|
| 138 | + $postHandler->delete($postObject, true); |
|
| 139 | + unset($postObject); |
|
| 140 | + } |
|
| 141 | + foreach (array_keys($topics) as $topic) { |
|
| 142 | + $topicHandler->synchronization($topic); |
|
| 143 | + } |
|
| 144 | + foreach (array_keys($forums) as $forum) { |
|
| 145 | + $forumHandler->synchronization($forum); |
|
| 135 | 146 | } |
| 136 | - $topics[$postObject->getVar('topic_id')] = 1; |
|
| 137 | - $forums[$postObject->getVar('forum_id')] = 1; |
|
| 138 | - $postHandler->delete($postObject, true); |
|
| 139 | - unset($postObject); |
|
| 140 | - } |
|
| 141 | - foreach (array_keys($topics) as $topic) { |
|
| 142 | - $topicHandler->synchronization($topic); |
|
| 143 | - } |
|
| 144 | - foreach (array_keys($forums) as $forum) { |
|
| 145 | - $forumHandler->synchronization($forum); |
|
| 146 | - } |
|
| 147 | - break; |
|
| 148 | - case 'split': |
|
| 149 | - /** @var Newbb\Post $postObject */ |
|
| 150 | - $postObject = $postHandler->get($post_id); |
|
| 151 | - if (0 === count($post_id) || $postObject->isTopic()) { |
|
| 152 | 147 | break; |
| 153 | - } |
|
| 154 | - $topic_id = $postObject->getVar('topic_id'); |
|
| 155 | - |
|
| 156 | - $newtopic = $topicHandler->create(); |
|
| 157 | - $newtopic->setVar('topic_title', $postObject->getVar('subject'), true); |
|
| 158 | - $newtopic->setVar('topic_poster', $postObject->getVar('uid'), true); |
|
| 159 | - $newtopic->setVar('forum_id', $postObject->getVar('forum_id'), true); |
|
| 160 | - $newtopic->setVar('topic_time', $postObject->getVar('post_time'), true); |
|
| 161 | - $newtopic->setVar('poster_name', $postObject->getVar('poster_name'), true); |
|
| 162 | - $newtopic->setVar('approved', 1, true); |
|
| 163 | - $topicHandler->insert($newtopic, true); |
|
| 164 | - $new_topic_id = $newtopic->getVar('topic_id'); |
|
| 165 | - |
|
| 166 | - $pid = $postObject->getVar('pid'); |
|
| 167 | - |
|
| 168 | - $postObject->setVar('topic_id', $new_topic_id, true); |
|
| 169 | - $postObject->setVar('pid', 0, true); |
|
| 170 | - $postHandler->insert($postObject); |
|
| 171 | - |
|
| 172 | - /* split a single post */ |
|
| 173 | - if (1 === $mode) { |
|
| 174 | - $criteria = new \CriteriaCompo(new \Criteria('topic_id', $topic_id)); |
|
| 175 | - $criteria->add(new \Criteria('pid', $post_id)); |
|
| 176 | - $postHandler->updateAll('pid', $pid, $criteria, true); |
|
| 177 | - /* split a post and its children posts */ |
|
| 178 | - } elseif (2 === $mode) { |
|
| 179 | - require_once $GLOBALS['xoops']->path('class/xoopstree.php'); |
|
| 180 | - $mytree = new \XoopsTree($GLOBALS['xoopsDB']->prefix('newbb_posts'), 'post_id', 'pid'); |
|
| 181 | - $posts = $mytree->getAllChildId($post_id); |
|
| 182 | - if (count($posts) > 0) { |
|
| 183 | - $criteria = new \Criteria('post_id', '(' . implode(',', $posts) . ')', 'IN'); |
|
| 184 | - $postHandler->updateAll('topic_id', $new_topic_id, $criteria, true); |
|
| 148 | + case 'split': |
|
| 149 | + /** @var Newbb\Post $postObject */ |
|
| 150 | + $postObject = $postHandler->get($post_id); |
|
| 151 | + if (0 === count($post_id) || $postObject->isTopic()) { |
|
| 152 | + break; |
|
| 185 | 153 | } |
| 186 | - /* split a post and all posts coming after */ |
|
| 187 | - } elseif (3 === $mode) { |
|
| 188 | - $criteria = new \CriteriaCompo(new \Criteria('topic_id', $topic_id)); |
|
| 189 | - $criteria->add(new \Criteria('post_id', $post_id, '>')); |
|
| 190 | - $postHandler->updateAll('topic_id', $new_topic_id, $criteria, true); |
|
| 191 | - |
|
| 192 | - unset($criteria); |
|
| 193 | - $criteria = new \CriteriaCompo(new \Criteria('topic_id', $new_topic_id)); |
|
| 194 | - $criteria->add(new \Criteria('post_id', $post_id, '>')); |
|
| 195 | - $postHandler->identifierName = 'pid'; |
|
| 196 | - $posts = $postHandler->getList($criteria); |
|
| 197 | - |
|
| 198 | - unset($criteria); |
|
| 199 | - $post_update = []; |
|
| 200 | - foreach ($posts as $postid => $pid) { |
|
| 201 | - // if (!in_array($pid, array_keys($posts))) { |
|
| 202 | - if (!array_key_exists($pid, $posts)) { |
|
| 203 | - $post_update[] = $pid; |
|
| 154 | + $topic_id = $postObject->getVar('topic_id'); |
|
| 155 | + |
|
| 156 | + $newtopic = $topicHandler->create(); |
|
| 157 | + $newtopic->setVar('topic_title', $postObject->getVar('subject'), true); |
|
| 158 | + $newtopic->setVar('topic_poster', $postObject->getVar('uid'), true); |
|
| 159 | + $newtopic->setVar('forum_id', $postObject->getVar('forum_id'), true); |
|
| 160 | + $newtopic->setVar('topic_time', $postObject->getVar('post_time'), true); |
|
| 161 | + $newtopic->setVar('poster_name', $postObject->getVar('poster_name'), true); |
|
| 162 | + $newtopic->setVar('approved', 1, true); |
|
| 163 | + $topicHandler->insert($newtopic, true); |
|
| 164 | + $new_topic_id = $newtopic->getVar('topic_id'); |
|
| 165 | + |
|
| 166 | + $pid = $postObject->getVar('pid'); |
|
| 167 | + |
|
| 168 | + $postObject->setVar('topic_id', $new_topic_id, true); |
|
| 169 | + $postObject->setVar('pid', 0, true); |
|
| 170 | + $postHandler->insert($postObject); |
|
| 171 | + |
|
| 172 | + /* split a single post */ |
|
| 173 | + if (1 === $mode) { |
|
| 174 | + $criteria = new \CriteriaCompo(new \Criteria('topic_id', $topic_id)); |
|
| 175 | + $criteria->add(new \Criteria('pid', $post_id)); |
|
| 176 | + $postHandler->updateAll('pid', $pid, $criteria, true); |
|
| 177 | + /* split a post and its children posts */ |
|
| 178 | + } elseif (2 === $mode) { |
|
| 179 | + require_once $GLOBALS['xoops']->path('class/xoopstree.php'); |
|
| 180 | + $mytree = new \XoopsTree($GLOBALS['xoopsDB']->prefix('newbb_posts'), 'post_id', 'pid'); |
|
| 181 | + $posts = $mytree->getAllChildId($post_id); |
|
| 182 | + if (count($posts) > 0) { |
|
| 183 | + $criteria = new \Criteria('post_id', '(' . implode(',', $posts) . ')', 'IN'); |
|
| 184 | + $postHandler->updateAll('topic_id', $new_topic_id, $criteria, true); |
|
| 204 | 185 | } |
| 205 | - if (!array_key_exists($pid, $posts)) { |
|
| 206 | - $post_update2[] = $pid; |
|
| 186 | + /* split a post and all posts coming after */ |
|
| 187 | + } elseif (3 === $mode) { |
|
| 188 | + $criteria = new \CriteriaCompo(new \Criteria('topic_id', $topic_id)); |
|
| 189 | + $criteria->add(new \Criteria('post_id', $post_id, '>')); |
|
| 190 | + $postHandler->updateAll('topic_id', $new_topic_id, $criteria, true); |
|
| 191 | + |
|
| 192 | + unset($criteria); |
|
| 193 | + $criteria = new \CriteriaCompo(new \Criteria('topic_id', $new_topic_id)); |
|
| 194 | + $criteria->add(new \Criteria('post_id', $post_id, '>')); |
|
| 195 | + $postHandler->identifierName = 'pid'; |
|
| 196 | + $posts = $postHandler->getList($criteria); |
|
| 197 | + |
|
| 198 | + unset($criteria); |
|
| 199 | + $post_update = []; |
|
| 200 | + foreach ($posts as $postid => $pid) { |
|
| 201 | + // if (!in_array($pid, array_keys($posts))) { |
|
| 202 | + if (!array_key_exists($pid, $posts)) { |
|
| 203 | + $post_update[] = $pid; |
|
| 204 | + } |
|
| 205 | + if (!array_key_exists($pid, $posts)) { |
|
| 206 | + $post_update2[] = $pid; |
|
| 207 | + } |
|
| 208 | + } |
|
| 209 | + if (count($post_update)) { |
|
| 210 | + $criteria = new \Criteria('post_id', '(' . implode(',', $post_update) . ')', 'IN'); |
|
| 211 | + $postHandler->updateAll('pid', $post_id, $criteria, true); |
|
| 207 | 212 | } |
| 208 | 213 | } |
| 209 | - if (count($post_update)) { |
|
| 210 | - $criteria = new \Criteria('post_id', '(' . implode(',', $post_update) . ')', 'IN'); |
|
| 211 | - $postHandler->updateAll('pid', $post_id, $criteria, true); |
|
| 212 | - } |
|
| 213 | - } |
|
| 214 | 214 | |
| 215 | - $forum_id = $postObject->getVar('forum_id'); |
|
| 216 | - $topicHandler->synchronization($topic_id); |
|
| 217 | - $topicHandler->synchronization($new_topic_id); |
|
| 218 | - $sql = sprintf('UPDATE "%s" SET forum_topics = forum_topics+1 WHERE forum_id = "%u"', $GLOBALS['xoopsDB']->prefix('newbb_forums'), $forum_id); |
|
| 219 | - $result = $GLOBALS['xoopsDB']->queryF($sql); |
|
| 215 | + $forum_id = $postObject->getVar('forum_id'); |
|
| 216 | + $topicHandler->synchronization($topic_id); |
|
| 217 | + $topicHandler->synchronization($new_topic_id); |
|
| 218 | + $sql = sprintf('UPDATE "%s" SET forum_topics = forum_topics+1 WHERE forum_id = "%u"', $GLOBALS['xoopsDB']->prefix('newbb_forums'), $forum_id); |
|
| 219 | + $result = $GLOBALS['xoopsDB']->queryF($sql); |
|
| 220 | 220 | |
| 221 | - break; |
|
| 221 | + break; |
|
| 222 | 222 | } |
| 223 | 223 | if (!empty($topic_id)) { |
| 224 | 224 | redirect_header(XOOPS_URL . "/modules/newbb/viewtopic.php?topic_id=$topic_id", 2, _MD_NEWBB_DBUPDATED); |
@@ -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 | $topic_id = Request::getInt('topic_id', 0, 'POST'); |
| 18 | 18 | $post_id = Request::getArray('post_id', Request::getArray('post_id', [], 'POST'), 'GET'); |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | $isAdmin = newbbIsAdmin($forumObject); |
| 43 | 43 | |
| 44 | 44 | if (!$isAdmin) { |
| 45 | - redirect_header(XOOPS_URL . '/index.php', 2, _MD_NEWBB_NORIGHTTOACCESS); |
|
| 45 | + redirect_header(XOOPS_URL.'/index.php', 2, _MD_NEWBB_NORIGHTTOACCESS); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | switch ($op) { |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | sort($post_id); |
| 75 | 75 | $topics = []; |
| 76 | 76 | $forums = []; |
| 77 | - $criteria = new \Criteria('post_id', '(' . implode(',', $post_id) . ')', 'IN'); |
|
| 77 | + $criteria = new \Criteria('post_id', '('.implode(',', $post_id).')', 'IN'); |
|
| 78 | 78 | $postsObject = $postHandler->getObjects($criteria, true); |
| 79 | 79 | foreach ($post_id as $post) { |
| 80 | 80 | /** @var Newbb\Post $postObject */ |
@@ -97,23 +97,23 @@ discard block |
||
| 97 | 97 | break; |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - $criteria_topic = new \Criteria('topic_id', '(' . implode(',', array_keys($topics)) . ')', 'IN'); |
|
| 100 | + $criteria_topic = new \Criteria('topic_id', '('.implode(',', array_keys($topics)).')', 'IN'); |
|
| 101 | 101 | $topic_list = $topicHandler->getList($criteria_topic, true); |
| 102 | 102 | |
| 103 | - $criteria_forum = new \Criteria('forum_id', '(' . implode(',', array_keys($forums)) . ')', 'IN'); |
|
| 103 | + $criteria_forum = new \Criteria('forum_id', '('.implode(',', array_keys($forums)).')', 'IN'); |
|
| 104 | 104 | $forum_list = $forumHandler->getList($criteria_forum); |
| 105 | 105 | |
| 106 | - require_once __DIR__ . '/include/notification.inc.php'; |
|
| 106 | + require_once __DIR__.'/include/notification.inc.php'; |
|
| 107 | 107 | /** @var \XoopsNotificationHandler $notificationHandler */ |
| 108 | 108 | $notificationHandler = xoops_getHandler('notification'); |
| 109 | 109 | foreach ($post_id as $post) { |
| 110 | 110 | $tags = []; |
| 111 | 111 | /** @var Newbb\Post[] $postsObject [$post] */ |
| 112 | 112 | $tags['THREAD_NAME'] = $topic_list[$postsObject[$post]->getVar('topic_id')]; |
| 113 | - $tags['THREAD_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewtopic.php?topic_id=' . $postsObject[$post]->getVar('topic_id') . '&forum=' . $postsObject[$post]->getVar('forum_id'); |
|
| 113 | + $tags['THREAD_URL'] = XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname').'/viewtopic.php?topic_id='.$postsObject[$post]->getVar('topic_id').'&forum='.$postsObject[$post]->getVar('forum_id'); |
|
| 114 | 114 | $tags['FORUM_NAME'] = $forum_list[$postsObject[$post]->getVar('forum_id')]; |
| 115 | - $tags['FORUM_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewforum.php?forum=' . $postsObject[$post]->getVar('forum_id'); |
|
| 116 | - $tags['POST_URL'] = $tags['THREAD_URL'] . '#forumpost' . $post; |
|
| 115 | + $tags['FORUM_URL'] = XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname').'/viewforum.php?forum='.$postsObject[$post]->getVar('forum_id'); |
|
| 116 | + $tags['POST_URL'] = $tags['THREAD_URL'].'#forumpost'.$post; |
|
| 117 | 117 | $notificationHandler->triggerEvent('thread', $postsObject[$post]->getVar('topic_id'), 'new_post', $tags); |
| 118 | 118 | $notificationHandler->triggerEvent('forum', $postsObject[$post]->getVar('forum_id'), 'new_post', $tags); |
| 119 | 119 | $notificationHandler->triggerEvent('global', 0, 'new_post', $tags); |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | $mytree = new \XoopsTree($GLOBALS['xoopsDB']->prefix('newbb_posts'), 'post_id', 'pid'); |
| 181 | 181 | $posts = $mytree->getAllChildId($post_id); |
| 182 | 182 | if (count($posts) > 0) { |
| 183 | - $criteria = new \Criteria('post_id', '(' . implode(',', $posts) . ')', 'IN'); |
|
| 183 | + $criteria = new \Criteria('post_id', '('.implode(',', $posts).')', 'IN'); |
|
| 184 | 184 | $postHandler->updateAll('topic_id', $new_topic_id, $criteria, true); |
| 185 | 185 | } |
| 186 | 186 | /* split a post and all posts coming after */ |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | } |
| 208 | 208 | } |
| 209 | 209 | if (count($post_update)) { |
| 210 | - $criteria = new \Criteria('post_id', '(' . implode(',', $post_update) . ')', 'IN'); |
|
| 210 | + $criteria = new \Criteria('post_id', '('.implode(',', $post_update).')', 'IN'); |
|
| 211 | 211 | $postHandler->updateAll('pid', $post_id, $criteria, true); |
| 212 | 212 | } |
| 213 | 213 | } |
@@ -221,12 +221,12 @@ discard block |
||
| 221 | 221 | break; |
| 222 | 222 | } |
| 223 | 223 | if (!empty($topic_id)) { |
| 224 | - redirect_header(XOOPS_URL . "/modules/newbb/viewtopic.php?topic_id=$topic_id", 2, _MD_NEWBB_DBUPDATED); |
|
| 224 | + redirect_header(XOOPS_URL."/modules/newbb/viewtopic.php?topic_id=$topic_id", 2, _MD_NEWBB_DBUPDATED); |
|
| 225 | 225 | } elseif (!empty($forum_id)) { |
| 226 | - redirect_header(XOOPS_URL . "/modules/newbb/viewforum.php?forum=$forum_id", 2, _MD_NEWBB_DBUPDATED); |
|
| 226 | + redirect_header(XOOPS_URL."/modules/newbb/viewforum.php?forum=$forum_id", 2, _MD_NEWBB_DBUPDATED); |
|
| 227 | 227 | } else { |
| 228 | - redirect_header(XOOPS_URL . "/modules/newbb/viewpost.php?uid=$uid", 2, _MD_NEWBB_DBUPDATED); |
|
| 228 | + redirect_header(XOOPS_URL."/modules/newbb/viewpost.php?uid=$uid", 2, _MD_NEWBB_DBUPDATED); |
|
| 229 | 229 | } |
| 230 | 230 | // irmtfan move to footer.php |
| 231 | -require_once __DIR__ . '/footer.php'; |
|
| 231 | +require_once __DIR__.'/footer.php'; |
|
| 232 | 232 | include $GLOBALS['xoops']->path('footer.php'); |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | use Xmf\Request; |
| 33 | 33 | |
| 34 | -require_once __DIR__ . '/header.php'; |
|
| 34 | +require_once __DIR__.'/header.php'; |
|
| 35 | 35 | |
| 36 | 36 | $ratinguser = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('uid') : 0; |
| 37 | 37 | $anonwaitdays = 1; |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | if (empty($rate)) { |
| 54 | - redirect_header('viewtopic.php?topic_id=' . $topic_id . '&forum=' . $forum . '', 4, _MD_NEWBB_NOVOTERATE); |
|
| 54 | + redirect_header('viewtopic.php?topic_id='.$topic_id.'&forum='.$forum.'', 4, _MD_NEWBB_NOVOTERATE); |
|
| 55 | 55 | } |
| 56 | 56 | ///** @var Newbb\RateHandler $rateHandler */ |
| 57 | 57 | //$rateHandler = Newbb\Helper::getInstance()->getHandler('Rate'); |
@@ -62,13 +62,13 @@ discard block |
||
| 62 | 62 | // /** @var Newbb\PostHandler $postHandler */ |
| 63 | 63 | // $postHandler = Newbb\Helper::getInstance()->getHandler('Post'); |
| 64 | 64 | if ($postHandler->getCount($crit_post)) { |
| 65 | - redirect_header('viewtopic.php?topic_id=' . $topic_id . '&forum=' . $forum . '', 4, _MD_NEWBB_CANTVOTEOWN); |
|
| 65 | + redirect_header('viewtopic.php?topic_id='.$topic_id.'&forum='.$forum.'', 4, _MD_NEWBB_CANTVOTEOWN); |
|
| 66 | 66 | } |
| 67 | 67 | // Check if REG user is trying to vote twice. |
| 68 | 68 | $crit_rate = new \CriteriaCompo(new \Criteria('topic_id', $topic_id)); |
| 69 | 69 | $crit_rate->add(new \Criteria('ratinguser', $ratinguser)); |
| 70 | 70 | if ($rateHandler->getCount($crit_rate)) { |
| 71 | - redirect_header('viewtopic.php?topic_id=' . $topic_id . '&forum=' . $forum . '', 4, _MD_NEWBB_VOTEONCE); |
|
| 71 | + redirect_header('viewtopic.php?topic_id='.$topic_id.'&forum='.$forum.'', 4, _MD_NEWBB_VOTEONCE); |
|
| 72 | 72 | } |
| 73 | 73 | } else { |
| 74 | 74 | // Check if ANONYMOUS user is trying to vote more than once per day. |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | $crit_rate->add(new \Criteria('ratinghostname', $ip)); |
| 78 | 78 | $crit_rate->add(new \Criteria('ratingtimestamp', time() - (86400 * $anonwaitdays), '>')); |
| 79 | 79 | if ($rateHandler->getCount($crit_rate)) { |
| 80 | - redirect_header('viewtopic.php?topic_id=' . $topic_id . '&forum=' . $forum . '', 4, _MD_NEWBB_VOTEONCE); |
|
| 80 | + redirect_header('viewtopic.php?topic_id='.$topic_id.'&forum='.$forum.'', 4, _MD_NEWBB_VOTEONCE); |
|
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | 83 | $rateObject = $rateHandler->create(); |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | $ratingid = $rateHandler->insert($rateObject); |
| 91 | 91 | |
| 92 | -$query = 'SELECT rating FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_votedata') . ' WHERE topic_id = ' . $topic_id . ' '; |
|
| 92 | +$query = 'SELECT rating FROM '.$GLOBALS['xoopsDB']->prefix('newbb_votedata').' WHERE topic_id = '.$topic_id.' '; |
|
| 93 | 93 | $voteresult = $GLOBALS['xoopsDB']->query($query); |
| 94 | 94 | $votesDB = $GLOBALS['xoopsDB']->getRowsNum($voteresult); |
| 95 | 95 | $totalrating = 0; |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | $sql = sprintf('UPDATE "%s" SET rating = "%u", votes = "%u" WHERE topic_id = "%u"', $GLOBALS['xoopsDB']->prefix('newbb_topics'), $finalrating, $votesDB, $topic_id); |
| 102 | 102 | $GLOBALS['xoopsDB']->queryF($sql); |
| 103 | 103 | |
| 104 | -$ratemessage = _MD_NEWBB_VOTEAPPRE . '<br>' . sprintf(_MD_NEWBB_THANKYOU, $GLOBALS['xoopsConfig']['sitename']); |
|
| 105 | -redirect_header('viewtopic.php?topic_id=' . $topic_id . '&forum=' . $forum . '', 2, $ratemessage); |
|
| 104 | +$ratemessage = _MD_NEWBB_VOTEAPPRE.'<br>'.sprintf(_MD_NEWBB_THANKYOU, $GLOBALS['xoopsConfig']['sitename']); |
|
| 105 | +redirect_header('viewtopic.php?topic_id='.$topic_id.'&forum='.$forum.'', 2, $ratemessage); |
|
| 106 | 106 | // irmtfan enhance include footer.php |
| 107 | 107 | include $GLOBALS['xoops']->path('footer.php'); |
@@ -37,150 +37,150 @@ |
||
| 37 | 37 | redirect_header(XOOPS_URL . '/index.php', 2, _MD_NEWBB_NORIGHTTOACCESS); |
| 38 | 38 | } |
| 39 | 39 | switch ($op) { |
| 40 | - case 'restore': |
|
| 41 | - $forums = []; |
|
| 42 | - $topicsObject = $topicHandler->getAll(new \Criteria('topic_id', '(' . implode(',', $topic_id) . ')', 'IN')); |
|
| 43 | - foreach (array_keys($topicsObject) as $id) { |
|
| 44 | - /** @var Newbb\Topic $topicObject */ |
|
| 45 | - $topicObject = $topicsObject[$id]; |
|
| 46 | - $topicHandler->approve($topicObject); |
|
| 47 | - $topicHandler->synchronization($topicObject); |
|
| 48 | - $forums[$topicObject->getVar('forum_id')] = 1; |
|
| 49 | - } |
|
| 50 | - $criteria_forum = new \Criteria('forum_id', '(' . implode(',', array_keys($forums)) . ')', 'IN'); |
|
| 51 | - $forumsObject = $forumHandler->getAll($criteria_forum); |
|
| 52 | - foreach (array_keys($forumsObject) as $id) { |
|
| 53 | - $forumHandler->synchronization($forumsObject[$id]); |
|
| 54 | - } |
|
| 55 | - unset($topicsObject, $forumsObject); |
|
| 56 | - break; |
|
| 57 | - case 'approve': |
|
| 58 | - $forums = []; |
|
| 59 | - $topicsObject = $topicHandler->getAll(new \Criteria('topic_id', '(' . implode(',', $topic_id) . ')', 'IN')); |
|
| 60 | - foreach (array_keys($topicsObject) as $id) { |
|
| 61 | - /** @var Newbb\Topic $topicObject */ |
|
| 62 | - $topicObject = $topicsObject[$id]; |
|
| 63 | - $topicHandler->approve($topicObject); |
|
| 64 | - $topicHandler->synchronization($topicObject); |
|
| 65 | - $forums[$topicObject->getVar('forum_id')] = 1; |
|
| 66 | - } |
|
| 40 | + case 'restore': |
|
| 41 | + $forums = []; |
|
| 42 | + $topicsObject = $topicHandler->getAll(new \Criteria('topic_id', '(' . implode(',', $topic_id) . ')', 'IN')); |
|
| 43 | + foreach (array_keys($topicsObject) as $id) { |
|
| 44 | + /** @var Newbb\Topic $topicObject */ |
|
| 45 | + $topicObject = $topicsObject[$id]; |
|
| 46 | + $topicHandler->approve($topicObject); |
|
| 47 | + $topicHandler->synchronization($topicObject); |
|
| 48 | + $forums[$topicObject->getVar('forum_id')] = 1; |
|
| 49 | + } |
|
| 50 | + $criteria_forum = new \Criteria('forum_id', '(' . implode(',', array_keys($forums)) . ')', 'IN'); |
|
| 51 | + $forumsObject = $forumHandler->getAll($criteria_forum); |
|
| 52 | + foreach (array_keys($forumsObject) as $id) { |
|
| 53 | + $forumHandler->synchronization($forumsObject[$id]); |
|
| 54 | + } |
|
| 55 | + unset($topicsObject, $forumsObject); |
|
| 56 | + break; |
|
| 57 | + case 'approve': |
|
| 58 | + $forums = []; |
|
| 59 | + $topicsObject = $topicHandler->getAll(new \Criteria('topic_id', '(' . implode(',', $topic_id) . ')', 'IN')); |
|
| 60 | + foreach (array_keys($topicsObject) as $id) { |
|
| 61 | + /** @var Newbb\Topic $topicObject */ |
|
| 62 | + $topicObject = $topicsObject[$id]; |
|
| 63 | + $topicHandler->approve($topicObject); |
|
| 64 | + $topicHandler->synchronization($topicObject); |
|
| 65 | + $forums[$topicObject->getVar('forum_id')] = 1; |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - $criteria_forum = new \Criteria('forum_id', '(' . implode(',', array_keys($forums)) . ')', 'IN'); |
|
| 69 | - $forumsObject = $forumHandler->getAll($criteria_forum); |
|
| 70 | - foreach (array_keys($forumsObject) as $id) { |
|
| 71 | - $forumHandler->synchronization($forumsObject[$id]); |
|
| 72 | - } |
|
| 68 | + $criteria_forum = new \Criteria('forum_id', '(' . implode(',', array_keys($forums)) . ')', 'IN'); |
|
| 69 | + $forumsObject = $forumHandler->getAll($criteria_forum); |
|
| 70 | + foreach (array_keys($forumsObject) as $id) { |
|
| 71 | + $forumHandler->synchronization($forumsObject[$id]); |
|
| 72 | + } |
|
| 73 | 73 | |
| 74 | - if (empty($GLOBALS['xoopsModuleConfig']['notification_enabled'])) { |
|
| 75 | - break; |
|
| 76 | - } |
|
| 74 | + if (empty($GLOBALS['xoopsModuleConfig']['notification_enabled'])) { |
|
| 75 | + break; |
|
| 76 | + } |
|
| 77 | 77 | |
| 78 | - require_once __DIR__ . '/include/notification.inc.php'; |
|
| 79 | - /** @var \XoopsNotificationHandler $notificationHandler */ |
|
| 80 | - $notificationHandler = xoops_getHandler('notification'); |
|
| 81 | - foreach (array_keys($topicsObject) as $id) { |
|
| 82 | - $topicObject = $topicsObject[$id]; |
|
| 83 | - $tags = []; |
|
| 84 | - $tags['THREAD_NAME'] = $topicObject->getVar('topic_title'); |
|
| 85 | - $tags['THREAD_URL'] = XOOPS_URL . '/modules/' . $moduleDirName . '/viewtopic.php?topic_id=' . $id . '&forum=' . $topicObject->getVar('forum_id'); |
|
| 86 | - /** @var Newbb\Forum[] $forumsObject */ |
|
| 87 | - $tags['FORUM_NAME'] = $forumsObject[$topicObject->getVar('forum_id')]->getVar('forum_name'); |
|
| 88 | - $tags['FORUM_URL'] = XOOPS_URL . '/modules/' . $moduleDirName . '/viewforum.php?forum=' . $topicObject->getVar('forum_id'); |
|
| 89 | - $notificationHandler->triggerEvent('global', 0, 'new_thread', $tags); |
|
| 90 | - $notificationHandler->triggerEvent('forum', $topicObject->getVar('forum_id'), 'new_thread', $tags); |
|
| 91 | - $postObject = $topicHandler->getTopPost($id); |
|
| 92 | - $tags['POST_URL'] = $tags['THREAD_URL'] . '#forumpost' . $postObject->getVar('post_id'); |
|
| 93 | - $notificationHandler->triggerEvent('thread', $id, 'new_post', $tags); |
|
| 94 | - $notificationHandler->triggerEvent('forum', $topicObject->getVar('forum_id'), 'new_post', $tags); |
|
| 95 | - $notificationHandler->triggerEvent('global', 0, 'new_post', $tags); |
|
| 96 | - $tags['POST_CONTENT'] = $postObject->getVar('post_text'); |
|
| 97 | - $tags['POST_NAME'] = $postObject->getVar('subject'); |
|
| 98 | - $notificationHandler->triggerEvent('global', 0, 'new_fullpost', $tags); |
|
| 99 | - $notificationHandler->triggerEvent('forum', $topicObject->getVar('forum_id'), 'new_fullpost', $tags); |
|
| 100 | - unset($postObject); |
|
| 101 | - } |
|
| 102 | - unset($topicsObject, $forumsObject); |
|
| 103 | - break; |
|
| 104 | - case 'delete': |
|
| 105 | - $forums = []; |
|
| 106 | - /** @var Newbb\TopicHandler|\XoopsPersistableObjectHandler $topicHandler */ |
|
| 107 | - $topicsObject = $topicHandler->getAll(new \Criteria('topic_id', '(' . implode(',', $topic_id) . ')', 'IN')); |
|
| 108 | - foreach (array_keys($topicsObject) as $id) { |
|
| 109 | - /** @var Newbb\Topic $topicObject */ |
|
| 110 | - $topicObject = $topicsObject[$id]; |
|
| 111 | - // irmtfan should be set to false to not delete topic from database |
|
| 112 | - $topicHandler->delete($topicObject, false); |
|
| 113 | - $topicHandler->synchronization($topicObject); |
|
| 114 | - $forums[$topicObject->getVar('forum_id')] = 1; |
|
| 115 | - } |
|
| 78 | + require_once __DIR__ . '/include/notification.inc.php'; |
|
| 79 | + /** @var \XoopsNotificationHandler $notificationHandler */ |
|
| 80 | + $notificationHandler = xoops_getHandler('notification'); |
|
| 81 | + foreach (array_keys($topicsObject) as $id) { |
|
| 82 | + $topicObject = $topicsObject[$id]; |
|
| 83 | + $tags = []; |
|
| 84 | + $tags['THREAD_NAME'] = $topicObject->getVar('topic_title'); |
|
| 85 | + $tags['THREAD_URL'] = XOOPS_URL . '/modules/' . $moduleDirName . '/viewtopic.php?topic_id=' . $id . '&forum=' . $topicObject->getVar('forum_id'); |
|
| 86 | + /** @var Newbb\Forum[] $forumsObject */ |
|
| 87 | + $tags['FORUM_NAME'] = $forumsObject[$topicObject->getVar('forum_id')]->getVar('forum_name'); |
|
| 88 | + $tags['FORUM_URL'] = XOOPS_URL . '/modules/' . $moduleDirName . '/viewforum.php?forum=' . $topicObject->getVar('forum_id'); |
|
| 89 | + $notificationHandler->triggerEvent('global', 0, 'new_thread', $tags); |
|
| 90 | + $notificationHandler->triggerEvent('forum', $topicObject->getVar('forum_id'), 'new_thread', $tags); |
|
| 91 | + $postObject = $topicHandler->getTopPost($id); |
|
| 92 | + $tags['POST_URL'] = $tags['THREAD_URL'] . '#forumpost' . $postObject->getVar('post_id'); |
|
| 93 | + $notificationHandler->triggerEvent('thread', $id, 'new_post', $tags); |
|
| 94 | + $notificationHandler->triggerEvent('forum', $topicObject->getVar('forum_id'), 'new_post', $tags); |
|
| 95 | + $notificationHandler->triggerEvent('global', 0, 'new_post', $tags); |
|
| 96 | + $tags['POST_CONTENT'] = $postObject->getVar('post_text'); |
|
| 97 | + $tags['POST_NAME'] = $postObject->getVar('subject'); |
|
| 98 | + $notificationHandler->triggerEvent('global', 0, 'new_fullpost', $tags); |
|
| 99 | + $notificationHandler->triggerEvent('forum', $topicObject->getVar('forum_id'), 'new_fullpost', $tags); |
|
| 100 | + unset($postObject); |
|
| 101 | + } |
|
| 102 | + unset($topicsObject, $forumsObject); |
|
| 103 | + break; |
|
| 104 | + case 'delete': |
|
| 105 | + $forums = []; |
|
| 106 | + /** @var Newbb\TopicHandler|\XoopsPersistableObjectHandler $topicHandler */ |
|
| 107 | + $topicsObject = $topicHandler->getAll(new \Criteria('topic_id', '(' . implode(',', $topic_id) . ')', 'IN')); |
|
| 108 | + foreach (array_keys($topicsObject) as $id) { |
|
| 109 | + /** @var Newbb\Topic $topicObject */ |
|
| 110 | + $topicObject = $topicsObject[$id]; |
|
| 111 | + // irmtfan should be set to false to not delete topic from database |
|
| 112 | + $topicHandler->delete($topicObject, false); |
|
| 113 | + $topicHandler->synchronization($topicObject); |
|
| 114 | + $forums[$topicObject->getVar('forum_id')] = 1; |
|
| 115 | + } |
|
| 116 | 116 | |
| 117 | - $criteria_forum = new \Criteria('forum_id', '(' . implode(',', array_keys($forums)) . ')', 'IN'); |
|
| 118 | - $forumsObject = $forumHandler->getAll($criteria_forum); |
|
| 119 | - foreach (array_keys($forumsObject) as $id) { |
|
| 120 | - $forumHandler->synchronization($forumsObject[$id]); |
|
| 121 | - } |
|
| 122 | - unset($topicsObject, $forumsObject); |
|
| 123 | - break; |
|
| 124 | - case 'move': |
|
| 125 | - if (Request::getInt('newforum', 0, 'POST') |
|
| 126 | - && Request::getInt('newforum', 0, 'POST') !== $forum_id |
|
| 127 | - && $forumHandler->getPermission(Request::getInt('newforum', 0, 'POST'), 'post')) { |
|
| 128 | - $criteria = new \Criteria('topic_id', '(' . implode(',', $topic_id) . ')', 'IN'); |
|
| 129 | - // /** @var Newbb\PostHandler $postHandler */ |
|
| 130 | - // $postHandler = Newbb\Helper::getInstance()->getHandler('Post'); |
|
| 131 | - $postHandler->updateAll('forum_id', Request::getInt('newforum', 0, 'POST'), $criteria, true); |
|
| 132 | - $topicHandler->updateAll('forum_id', Request::getInt('newforum', 0, 'POST'), $criteria, true); |
|
| 133 | - $forumHandler->synchronization(Request::getInt('newforum', 0, 'POST')); |
|
| 134 | - $forumHandler->synchronization($forum_id); |
|
| 135 | - } else { |
|
| 136 | - include $GLOBALS['xoops']->path('header.php'); |
|
| 137 | - // /** @var Newbb\CategoryHandler $categoryHandler */ |
|
| 138 | - // $categoryHandler = Newbb\Helper::getInstance()->getHandler('Category'); |
|
| 139 | - $categories = $categoryHandler->getByPermission('access'); |
|
| 140 | - $forums = $forumHandler->getForumsByCategory(array_keys($categories), 'post', false); |
|
| 117 | + $criteria_forum = new \Criteria('forum_id', '(' . implode(',', array_keys($forums)) . ')', 'IN'); |
|
| 118 | + $forumsObject = $forumHandler->getAll($criteria_forum); |
|
| 119 | + foreach (array_keys($forumsObject) as $id) { |
|
| 120 | + $forumHandler->synchronization($forumsObject[$id]); |
|
| 121 | + } |
|
| 122 | + unset($topicsObject, $forumsObject); |
|
| 123 | + break; |
|
| 124 | + case 'move': |
|
| 125 | + if (Request::getInt('newforum', 0, 'POST') |
|
| 126 | + && Request::getInt('newforum', 0, 'POST') !== $forum_id |
|
| 127 | + && $forumHandler->getPermission(Request::getInt('newforum', 0, 'POST'), 'post')) { |
|
| 128 | + $criteria = new \Criteria('topic_id', '(' . implode(',', $topic_id) . ')', 'IN'); |
|
| 129 | + // /** @var Newbb\PostHandler $postHandler */ |
|
| 130 | + // $postHandler = Newbb\Helper::getInstance()->getHandler('Post'); |
|
| 131 | + $postHandler->updateAll('forum_id', Request::getInt('newforum', 0, 'POST'), $criteria, true); |
|
| 132 | + $topicHandler->updateAll('forum_id', Request::getInt('newforum', 0, 'POST'), $criteria, true); |
|
| 133 | + $forumHandler->synchronization(Request::getInt('newforum', 0, 'POST')); |
|
| 134 | + $forumHandler->synchronization($forum_id); |
|
| 135 | + } else { |
|
| 136 | + include $GLOBALS['xoops']->path('header.php'); |
|
| 137 | + // /** @var Newbb\CategoryHandler $categoryHandler */ |
|
| 138 | + // $categoryHandler = Newbb\Helper::getInstance()->getHandler('Category'); |
|
| 139 | + $categories = $categoryHandler->getByPermission('access'); |
|
| 140 | + $forums = $forumHandler->getForumsByCategory(array_keys($categories), 'post', false); |
|
| 141 | 141 | |
| 142 | - $box = '<select name="newforum" size="1">'; |
|
| 143 | - if (count($categories) > 0 && count($forums) > 0) { |
|
| 144 | - foreach (array_keys($forums) as $key) { |
|
| 142 | + $box = '<select name="newforum" size="1">'; |
|
| 143 | + if (count($categories) > 0 && count($forums) > 0) { |
|
| 144 | + foreach (array_keys($forums) as $key) { |
|
| 145 | 145 | |
| 146 | - /** @var Newbb\Category[] $categories */ |
|
| 147 | - $box .= "<option value='-1'>[" . $categories[$key]->getVar('cat_title') . ']</option>'; |
|
| 148 | - foreach ($forums[$key] as $forumid => $_forum) { |
|
| 149 | - $box .= "<option value='" . $forumid . "'>-- " . $_forum['title'] . '</option>'; |
|
| 150 | - if (!isset($_forum['sub'])) { |
|
| 151 | - continue; |
|
| 152 | - } |
|
| 153 | - foreach (array_keys($_forum['sub']) as $fid) { |
|
| 154 | - $box .= "<option value='" . $fid . "'>---- " . $_forum['sub'][$fid]['title'] . '</option>'; |
|
| 146 | + /** @var Newbb\Category[] $categories */ |
|
| 147 | + $box .= "<option value='-1'>[" . $categories[$key]->getVar('cat_title') . ']</option>'; |
|
| 148 | + foreach ($forums[$key] as $forumid => $_forum) { |
|
| 149 | + $box .= "<option value='" . $forumid . "'>-- " . $_forum['title'] . '</option>'; |
|
| 150 | + if (!isset($_forum['sub'])) { |
|
| 151 | + continue; |
|
| 152 | + } |
|
| 153 | + foreach (array_keys($_forum['sub']) as $fid) { |
|
| 154 | + $box .= "<option value='" . $fid . "'>---- " . $_forum['sub'][$fid]['title'] . '</option>'; |
|
| 155 | + } |
|
| 155 | 156 | } |
| 156 | 157 | } |
| 158 | + } else { |
|
| 159 | + $box .= "<option value='-1'>" . _MD_NEWBB_NOFORUMINDB . '</option>'; |
|
| 157 | 160 | } |
| 158 | - } else { |
|
| 159 | - $box .= "<option value='-1'>" . _MD_NEWBB_NOFORUMINDB . '</option>'; |
|
| 160 | - } |
|
| 161 | - $box .= '</select>'; |
|
| 162 | - unset($forums, $categories); |
|
| 161 | + $box .= '</select>'; |
|
| 162 | + unset($forums, $categories); |
|
| 163 | 163 | |
| 164 | - echo "<form action='" . Request::getString('PHP_SELF', '', 'SERVER') . "' method='post'>"; |
|
| 165 | - echo "<table border='0' cellpadding='1' cellspacing='0' align='center' width='95%'>"; |
|
| 166 | - echo "<tr><td class='bg2'>"; |
|
| 167 | - echo "<table border='0' cellpadding='1' cellspacing='1' width='100%'>"; |
|
| 168 | - echo '<tr><td class="bg3">' . _MD_NEWBB_MOVETOPICTO . '</td><td class="bg1">'; |
|
| 169 | - echo $box; |
|
| 170 | - echo '</td></tr>'; |
|
| 171 | - echo '<tr class="bg3"><td colspan="2" align="center">'; |
|
| 172 | - echo "<input type='hidden' name='op' value='move' />"; |
|
| 173 | - echo "<input type='hidden' name='forum_id' value='{$forum_id}' />"; |
|
| 174 | - foreach ($topic_id as $id) { |
|
| 175 | - echo "<input type='hidden' name='topic_id[]' value='" . $id . "' />"; |
|
| 164 | + echo "<form action='" . Request::getString('PHP_SELF', '', 'SERVER') . "' method='post'>"; |
|
| 165 | + echo "<table border='0' cellpadding='1' cellspacing='0' align='center' width='95%'>"; |
|
| 166 | + echo "<tr><td class='bg2'>"; |
|
| 167 | + echo "<table border='0' cellpadding='1' cellspacing='1' width='100%'>"; |
|
| 168 | + echo '<tr><td class="bg3">' . _MD_NEWBB_MOVETOPICTO . '</td><td class="bg1">'; |
|
| 169 | + echo $box; |
|
| 170 | + echo '</td></tr>'; |
|
| 171 | + echo '<tr class="bg3"><td colspan="2" align="center">'; |
|
| 172 | + echo "<input type='hidden' name='op' value='move' />"; |
|
| 173 | + echo "<input type='hidden' name='forum_id' value='{$forum_id}' />"; |
|
| 174 | + foreach ($topic_id as $id) { |
|
| 175 | + echo "<input type='hidden' name='topic_id[]' value='" . $id . "' />"; |
|
| 176 | + } |
|
| 177 | + echo "<input type='submit' name='submit' value='" . _SUBMIT . "' />"; |
|
| 178 | + echo '</td></tr></table></td></tr></table>'; |
|
| 179 | + echo '</form>'; |
|
| 180 | + include $GLOBALS['xoops']->path('footer.php'); |
|
| 181 | + exit(); |
|
| 176 | 182 | } |
| 177 | - echo "<input type='submit' name='submit' value='" . _SUBMIT . "' />"; |
|
| 178 | - echo '</td></tr></table></td></tr></table>'; |
|
| 179 | - echo '</form>'; |
|
| 180 | - include $GLOBALS['xoops']->path('footer.php'); |
|
| 181 | - exit(); |
|
| 182 | - } |
|
| 183 | - break; |
|
| 183 | + break; |
|
| 184 | 184 | } |
| 185 | 185 | ///** @var Newbb\StatsHandler $statsHandler */ |
| 186 | 186 | //$statsHandler = Newbb\Helper::getInstance()->getHandler('Stats'); |
@@ -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 | $forum_id = Request::getInt('forum_id', 0, 'POST'); |
| 18 | 18 | $topic_id = Request::getArray('topic_id', null, 'POST'); |
@@ -34,12 +34,12 @@ discard block |
||
| 34 | 34 | $isAdmin = newbbIsAdmin($forum_id); |
| 35 | 35 | |
| 36 | 36 | if (!$isAdmin) { |
| 37 | - redirect_header(XOOPS_URL . '/index.php', 2, _MD_NEWBB_NORIGHTTOACCESS); |
|
| 37 | + redirect_header(XOOPS_URL.'/index.php', 2, _MD_NEWBB_NORIGHTTOACCESS); |
|
| 38 | 38 | } |
| 39 | 39 | switch ($op) { |
| 40 | 40 | case 'restore': |
| 41 | 41 | $forums = []; |
| 42 | - $topicsObject = $topicHandler->getAll(new \Criteria('topic_id', '(' . implode(',', $topic_id) . ')', 'IN')); |
|
| 42 | + $topicsObject = $topicHandler->getAll(new \Criteria('topic_id', '('.implode(',', $topic_id).')', 'IN')); |
|
| 43 | 43 | foreach (array_keys($topicsObject) as $id) { |
| 44 | 44 | /** @var Newbb\Topic $topicObject */ |
| 45 | 45 | $topicObject = $topicsObject[$id]; |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | $topicHandler->synchronization($topicObject); |
| 48 | 48 | $forums[$topicObject->getVar('forum_id')] = 1; |
| 49 | 49 | } |
| 50 | - $criteria_forum = new \Criteria('forum_id', '(' . implode(',', array_keys($forums)) . ')', 'IN'); |
|
| 50 | + $criteria_forum = new \Criteria('forum_id', '('.implode(',', array_keys($forums)).')', 'IN'); |
|
| 51 | 51 | $forumsObject = $forumHandler->getAll($criteria_forum); |
| 52 | 52 | foreach (array_keys($forumsObject) as $id) { |
| 53 | 53 | $forumHandler->synchronization($forumsObject[$id]); |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | break; |
| 57 | 57 | case 'approve': |
| 58 | 58 | $forums = []; |
| 59 | - $topicsObject = $topicHandler->getAll(new \Criteria('topic_id', '(' . implode(',', $topic_id) . ')', 'IN')); |
|
| 59 | + $topicsObject = $topicHandler->getAll(new \Criteria('topic_id', '('.implode(',', $topic_id).')', 'IN')); |
|
| 60 | 60 | foreach (array_keys($topicsObject) as $id) { |
| 61 | 61 | /** @var Newbb\Topic $topicObject */ |
| 62 | 62 | $topicObject = $topicsObject[$id]; |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | $forums[$topicObject->getVar('forum_id')] = 1; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - $criteria_forum = new \Criteria('forum_id', '(' . implode(',', array_keys($forums)) . ')', 'IN'); |
|
| 68 | + $criteria_forum = new \Criteria('forum_id', '('.implode(',', array_keys($forums)).')', 'IN'); |
|
| 69 | 69 | $forumsObject = $forumHandler->getAll($criteria_forum); |
| 70 | 70 | foreach (array_keys($forumsObject) as $id) { |
| 71 | 71 | $forumHandler->synchronization($forumsObject[$id]); |
@@ -75,21 +75,21 @@ discard block |
||
| 75 | 75 | break; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - require_once __DIR__ . '/include/notification.inc.php'; |
|
| 78 | + require_once __DIR__.'/include/notification.inc.php'; |
|
| 79 | 79 | /** @var \XoopsNotificationHandler $notificationHandler */ |
| 80 | 80 | $notificationHandler = xoops_getHandler('notification'); |
| 81 | 81 | foreach (array_keys($topicsObject) as $id) { |
| 82 | 82 | $topicObject = $topicsObject[$id]; |
| 83 | 83 | $tags = []; |
| 84 | 84 | $tags['THREAD_NAME'] = $topicObject->getVar('topic_title'); |
| 85 | - $tags['THREAD_URL'] = XOOPS_URL . '/modules/' . $moduleDirName . '/viewtopic.php?topic_id=' . $id . '&forum=' . $topicObject->getVar('forum_id'); |
|
| 85 | + $tags['THREAD_URL'] = XOOPS_URL.'/modules/'.$moduleDirName.'/viewtopic.php?topic_id='.$id.'&forum='.$topicObject->getVar('forum_id'); |
|
| 86 | 86 | /** @var Newbb\Forum[] $forumsObject */ |
| 87 | 87 | $tags['FORUM_NAME'] = $forumsObject[$topicObject->getVar('forum_id')]->getVar('forum_name'); |
| 88 | - $tags['FORUM_URL'] = XOOPS_URL . '/modules/' . $moduleDirName . '/viewforum.php?forum=' . $topicObject->getVar('forum_id'); |
|
| 88 | + $tags['FORUM_URL'] = XOOPS_URL.'/modules/'.$moduleDirName.'/viewforum.php?forum='.$topicObject->getVar('forum_id'); |
|
| 89 | 89 | $notificationHandler->triggerEvent('global', 0, 'new_thread', $tags); |
| 90 | 90 | $notificationHandler->triggerEvent('forum', $topicObject->getVar('forum_id'), 'new_thread', $tags); |
| 91 | 91 | $postObject = $topicHandler->getTopPost($id); |
| 92 | - $tags['POST_URL'] = $tags['THREAD_URL'] . '#forumpost' . $postObject->getVar('post_id'); |
|
| 92 | + $tags['POST_URL'] = $tags['THREAD_URL'].'#forumpost'.$postObject->getVar('post_id'); |
|
| 93 | 93 | $notificationHandler->triggerEvent('thread', $id, 'new_post', $tags); |
| 94 | 94 | $notificationHandler->triggerEvent('forum', $topicObject->getVar('forum_id'), 'new_post', $tags); |
| 95 | 95 | $notificationHandler->triggerEvent('global', 0, 'new_post', $tags); |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | case 'delete': |
| 105 | 105 | $forums = []; |
| 106 | 106 | /** @var Newbb\TopicHandler|\XoopsPersistableObjectHandler $topicHandler */ |
| 107 | - $topicsObject = $topicHandler->getAll(new \Criteria('topic_id', '(' . implode(',', $topic_id) . ')', 'IN')); |
|
| 107 | + $topicsObject = $topicHandler->getAll(new \Criteria('topic_id', '('.implode(',', $topic_id).')', 'IN')); |
|
| 108 | 108 | foreach (array_keys($topicsObject) as $id) { |
| 109 | 109 | /** @var Newbb\Topic $topicObject */ |
| 110 | 110 | $topicObject = $topicsObject[$id]; |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | $forums[$topicObject->getVar('forum_id')] = 1; |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - $criteria_forum = new \Criteria('forum_id', '(' . implode(',', array_keys($forums)) . ')', 'IN'); |
|
| 117 | + $criteria_forum = new \Criteria('forum_id', '('.implode(',', array_keys($forums)).')', 'IN'); |
|
| 118 | 118 | $forumsObject = $forumHandler->getAll($criteria_forum); |
| 119 | 119 | foreach (array_keys($forumsObject) as $id) { |
| 120 | 120 | $forumHandler->synchronization($forumsObject[$id]); |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | if (Request::getInt('newforum', 0, 'POST') |
| 126 | 126 | && Request::getInt('newforum', 0, 'POST') !== $forum_id |
| 127 | 127 | && $forumHandler->getPermission(Request::getInt('newforum', 0, 'POST'), 'post')) { |
| 128 | - $criteria = new \Criteria('topic_id', '(' . implode(',', $topic_id) . ')', 'IN'); |
|
| 128 | + $criteria = new \Criteria('topic_id', '('.implode(',', $topic_id).')', 'IN'); |
|
| 129 | 129 | // /** @var Newbb\PostHandler $postHandler */ |
| 130 | 130 | // $postHandler = Newbb\Helper::getInstance()->getHandler('Post'); |
| 131 | 131 | $postHandler->updateAll('forum_id', Request::getInt('newforum', 0, 'POST'), $criteria, true); |
@@ -144,37 +144,37 @@ discard block |
||
| 144 | 144 | foreach (array_keys($forums) as $key) { |
| 145 | 145 | |
| 146 | 146 | /** @var Newbb\Category[] $categories */ |
| 147 | - $box .= "<option value='-1'>[" . $categories[$key]->getVar('cat_title') . ']</option>'; |
|
| 147 | + $box .= "<option value='-1'>[".$categories[$key]->getVar('cat_title').']</option>'; |
|
| 148 | 148 | foreach ($forums[$key] as $forumid => $_forum) { |
| 149 | - $box .= "<option value='" . $forumid . "'>-- " . $_forum['title'] . '</option>'; |
|
| 149 | + $box .= "<option value='".$forumid."'>-- ".$_forum['title'].'</option>'; |
|
| 150 | 150 | if (!isset($_forum['sub'])) { |
| 151 | 151 | continue; |
| 152 | 152 | } |
| 153 | 153 | foreach (array_keys($_forum['sub']) as $fid) { |
| 154 | - $box .= "<option value='" . $fid . "'>---- " . $_forum['sub'][$fid]['title'] . '</option>'; |
|
| 154 | + $box .= "<option value='".$fid."'>---- ".$_forum['sub'][$fid]['title'].'</option>'; |
|
| 155 | 155 | } |
| 156 | 156 | } |
| 157 | 157 | } |
| 158 | 158 | } else { |
| 159 | - $box .= "<option value='-1'>" . _MD_NEWBB_NOFORUMINDB . '</option>'; |
|
| 159 | + $box .= "<option value='-1'>"._MD_NEWBB_NOFORUMINDB.'</option>'; |
|
| 160 | 160 | } |
| 161 | 161 | $box .= '</select>'; |
| 162 | 162 | unset($forums, $categories); |
| 163 | 163 | |
| 164 | - echo "<form action='" . Request::getString('PHP_SELF', '', 'SERVER') . "' method='post'>"; |
|
| 164 | + echo "<form action='".Request::getString('PHP_SELF', '', 'SERVER')."' method='post'>"; |
|
| 165 | 165 | echo "<table border='0' cellpadding='1' cellspacing='0' align='center' width='95%'>"; |
| 166 | 166 | echo "<tr><td class='bg2'>"; |
| 167 | 167 | echo "<table border='0' cellpadding='1' cellspacing='1' width='100%'>"; |
| 168 | - echo '<tr><td class="bg3">' . _MD_NEWBB_MOVETOPICTO . '</td><td class="bg1">'; |
|
| 168 | + echo '<tr><td class="bg3">'._MD_NEWBB_MOVETOPICTO.'</td><td class="bg1">'; |
|
| 169 | 169 | echo $box; |
| 170 | 170 | echo '</td></tr>'; |
| 171 | 171 | echo '<tr class="bg3"><td colspan="2" align="center">'; |
| 172 | 172 | echo "<input type='hidden' name='op' value='move' />"; |
| 173 | 173 | echo "<input type='hidden' name='forum_id' value='{$forum_id}' />"; |
| 174 | 174 | foreach ($topic_id as $id) { |
| 175 | - echo "<input type='hidden' name='topic_id[]' value='" . $id . "' />"; |
|
| 175 | + echo "<input type='hidden' name='topic_id[]' value='".$id."' />"; |
|
| 176 | 176 | } |
| 177 | - echo "<input type='submit' name='submit' value='" . _SUBMIT . "' />"; |
|
| 177 | + echo "<input type='submit' name='submit' value='"._SUBMIT."' />"; |
|
| 178 | 178 | echo '</td></tr></table></td></tr></table>'; |
| 179 | 179 | echo '</form>'; |
| 180 | 180 | include $GLOBALS['xoops']->path('footer.php'); |
@@ -186,10 +186,10 @@ discard block |
||
| 186 | 186 | //$statsHandler = Newbb\Helper::getInstance()->getHandler('Stats'); |
| 187 | 187 | $statsHandler->reset(); |
| 188 | 188 | if (empty($forum_id)) { |
| 189 | - redirect_header(XOOPS_URL . '/modules/newbb/list.topic.php', 2, _MD_NEWBB_DBUPDATED); |
|
| 189 | + redirect_header(XOOPS_URL.'/modules/newbb/list.topic.php', 2, _MD_NEWBB_DBUPDATED); |
|
| 190 | 190 | } else { |
| 191 | - redirect_header(XOOPS_URL . "/modules/newbb/viewforum.php?forum={$forum_id}", 2, _MD_NEWBB_DBUPDATED); |
|
| 191 | + redirect_header(XOOPS_URL."/modules/newbb/viewforum.php?forum={$forum_id}", 2, _MD_NEWBB_DBUPDATED); |
|
| 192 | 192 | } |
| 193 | 193 | // irmtfan move to footer.php |
| 194 | -require_once __DIR__ . '/footer.php'; |
|
| 194 | +require_once __DIR__.'/footer.php'; |
|
| 195 | 195 | include $GLOBALS['xoops']->path('footer.php'); |