@@ -88,16 +88,16 @@ |
||
| 88 | 88 | $approved = 1 |
| 89 | 89 | ) { |
| 90 | 90 | $sql = 'SELECT p.*, t.*, tp.topic_status FROM ' |
| 91 | - . $this->db->prefix('newbb_posts') |
|
| 92 | - . ' p LEFT JOIN ' |
|
| 93 | - . $this->db->prefix('newbb_posts_text') |
|
| 94 | - . ' t ON p.post_id=t.post_id LEFT JOIN ' |
|
| 95 | - . $this->db->prefix('newbb_topics') |
|
| 96 | - . ' tp ON tp.topic_id=p.topic_id WHERE p.topic_id=' |
|
| 97 | - . $topic_id |
|
| 98 | - . ' AND p.approved =' |
|
| 99 | - . $approved |
|
| 100 | - . ' ORDER BY p.post_time DESC'; |
|
| 91 | + . $this->db->prefix('newbb_posts') |
|
| 92 | + . ' p LEFT JOIN ' |
|
| 93 | + . $this->db->prefix('newbb_posts_text') |
|
| 94 | + . ' t ON p.post_id=t.post_id LEFT JOIN ' |
|
| 95 | + . $this->db->prefix('newbb_topics') |
|
| 96 | + . ' tp ON tp.topic_id=p.topic_id WHERE p.topic_id=' |
|
| 97 | + . $topic_id |
|
| 98 | + . ' AND p.approved =' |
|
| 99 | + . $approved |
|
| 100 | + . ' ORDER BY p.post_time DESC'; |
|
| 101 | 101 | $result = $this->db->query($sql, $limit, 0); |
| 102 | 102 | $ret = []; |
| 103 | 103 | while (false !== ($myrow = $this->db->fetchArray($result))) { |
@@ -42,14 +42,14 @@ discard block |
||
| 42 | 42 | $forums = (is_array($forums) ? array_filter(array_map('intval', array_map('trim', $forums))) : (empty($forums) ? 0 : [(int)$forums])); |
| 43 | 43 | |
| 44 | 44 | $sql = ' SELECT o.type_id, o.type_name, o.type_color, l.type_order' |
| 45 | - . ' FROM ' |
|
| 46 | - . $this->db->prefix('newbb_type_forum') |
|
| 47 | - . ' AS l ' |
|
| 48 | - . " LEFT JOIN {$this->table} AS o ON o.{$this->keyName} = l.{$this->keyName} " |
|
| 49 | - . ' WHERE ' |
|
| 50 | - . ' l.forum_id ' |
|
| 51 | - . (empty($forums) ? 'IS NOT NULL' : 'IN (' . implode(', ', $forums) . ')') |
|
| 52 | - . ' ORDER BY l.type_order ASC'; |
|
| 45 | + . ' FROM ' |
|
| 46 | + . $this->db->prefix('newbb_type_forum') |
|
| 47 | + . ' AS l ' |
|
| 48 | + . " LEFT JOIN {$this->table} AS o ON o.{$this->keyName} = l.{$this->keyName} " |
|
| 49 | + . ' WHERE ' |
|
| 50 | + . ' l.forum_id ' |
|
| 51 | + . (empty($forums) ? 'IS NOT NULL' : 'IN (' . implode(', ', $forums) . ')') |
|
| 52 | + . ' ORDER BY l.type_order ASC'; |
|
| 53 | 53 | if (false === ($result = $this->db->query($sql))) { |
| 54 | 54 | //xoops_error($this->db->error()); |
| 55 | 55 | return $ret; |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | |
| 106 | 106 | if (!empty($types_valid)) { |
| 107 | 107 | $sql = 'DELETE FROM ' . $this->db->prefix('newbb_type_forum') . ' WHERE ' . ' forum_id = ' . $forum_id . ' AND ' . // irmtfan bug fix: delete other forums types when update the type for a specific forum |
| 108 | - " {$this->keyName} NOT IN (" . implode(', ', $types_valid) . ')'; |
|
| 108 | + " {$this->keyName} NOT IN (" . implode(', ', $types_valid) . ')'; |
|
| 109 | 109 | if (false === ($result = $this->db->queryF($sql))) { |
| 110 | 110 | } |
| 111 | 111 | } |
@@ -110,8 +110,8 @@ |
||
| 110 | 110 | $path = is_dir($theme_path . "/{$rel_dir}/{$type}/") ? $theme_path . "/{$rel_dir}/{$type}" : ( |
| 111 | 111 | is_dir($theme_path . "/{$rel_dir}/{$default}/") ? $theme_path . "/{$rel_dir}/{$default}" : ( |
| 112 | 112 | is_dir(XOOPS_THEME_PATH . "/default/{$rel_dir}/{$type}/") ? XOOPS_THEME_PATH |
| 113 | - . "/default/{$rel_dir}/{$type}" : ( |
|
| 114 | - is_dir(XOOPS_THEME_PATH . "/default/{$rel_dir}/{$default}/") ? XOOPS_THEME_PATH . "/default/{$rel_dir}/{$default}" |
|
| 113 | + . "/default/{$rel_dir}/{$type}" : ( |
|
| 114 | + is_dir(XOOPS_THEME_PATH . "/default/{$rel_dir}/{$default}/") ? XOOPS_THEME_PATH . "/default/{$rel_dir}/{$default}" |
|
| 115 | 115 | : (is_dir($GLOBALS['xoops']->path("modules/{$dirname}/templates/{$endDir}/{$type}/")) ? $GLOBALS['xoops']->path("modules/{$dirname}/templates/{$endDir}/{$type}") |
| 116 | 116 | : $GLOBALS['xoops']->path("modules/{$dirname}/templates/{$endDir}/{$default}")) // XOOPS_ROOT_PATH |
| 117 | 117 | ) // XOOPS_THEME_PATH {$default} |
@@ -252,18 +252,18 @@ |
||
| 252 | 252 | $xoopsOnlineTable = $xoops_onlineHandler->table; |
| 253 | 253 | |
| 254 | 254 | $sql = 'DELETE FROM ' |
| 255 | - . $this->db->prefix('newbb_online') |
|
| 256 | - . ' WHERE' |
|
| 257 | - . ' ( online_uid > 0 AND online_uid NOT IN ( SELECT online_uid FROM ' |
|
| 258 | - . $xoopsOnlineTable |
|
| 259 | - . ' WHERE online_module =' |
|
| 260 | - . $xoopsModule->getVar('mid') |
|
| 261 | - . ' ) )' |
|
| 262 | - . ' OR ( online_uid = 0 AND online_ip NOT IN ( SELECT online_ip FROM ' |
|
| 263 | - . $xoopsOnlineTable |
|
| 264 | - . ' WHERE online_module =' |
|
| 265 | - . $xoopsModule->getVar('mid') |
|
| 266 | - . ' AND online_uid = 0 ) )'; |
|
| 255 | + . $this->db->prefix('newbb_online') |
|
| 256 | + . ' WHERE' |
|
| 257 | + . ' ( online_uid > 0 AND online_uid NOT IN ( SELECT online_uid FROM ' |
|
| 258 | + . $xoopsOnlineTable |
|
| 259 | + . ' WHERE online_module =' |
|
| 260 | + . $xoopsModule->getVar('mid') |
|
| 261 | + . ' ) )' |
|
| 262 | + . ' OR ( online_uid = 0 AND online_ip NOT IN ( SELECT online_ip FROM ' |
|
| 263 | + . $xoopsOnlineTable |
|
| 264 | + . ' WHERE online_module =' |
|
| 265 | + . $xoopsModule->getVar('mid') |
|
| 266 | + . ' AND online_uid = 0 ) )'; |
|
| 267 | 267 | |
| 268 | 268 | if ($result = $this->db->queryF($sql)) { |
| 269 | 269 | return true; |
@@ -214,18 +214,18 @@ |
||
| 214 | 214 | $reply_criteria = $GLOBALS['xoopsModuleConfig']['allow_require_reply'] ? ' AND p.require_reply=0' : ''; |
| 215 | 215 | |
| 216 | 216 | $query = 'SELECT t.topic_id, t.forum_id, t.topic_title, t.topic_time, t.digest_time, p.uid, p.poster_name, pt.post_text FROM ' |
| 217 | - . $this->db->prefix('newbb_topics') |
|
| 218 | - . ' t, ' |
|
| 219 | - . $this->db->prefix('newbb_posts_text') |
|
| 220 | - . ' pt, ' |
|
| 221 | - . $this->db->prefix('newbb_posts') |
|
| 222 | - . ' p WHERE t.topic_digest = 1 AND p.topic_id=t.topic_id AND p.pid=0 ' |
|
| 223 | - . $forumCriteria |
|
| 224 | - . $approveCriteria |
|
| 225 | - . $time_criteria |
|
| 226 | - . $karma_criteria |
|
| 227 | - . $reply_criteria |
|
| 228 | - . ' AND pt.post_id=p.post_id ORDER BY t.digest_time DESC'; |
|
| 217 | + . $this->db->prefix('newbb_topics') |
|
| 218 | + . ' t, ' |
|
| 219 | + . $this->db->prefix('newbb_posts_text') |
|
| 220 | + . ' pt, ' |
|
| 221 | + . $this->db->prefix('newbb_posts') |
|
| 222 | + . ' p WHERE t.topic_digest = 1 AND p.topic_id=t.topic_id AND p.pid=0 ' |
|
| 223 | + . $forumCriteria |
|
| 224 | + . $approveCriteria |
|
| 225 | + . $time_criteria |
|
| 226 | + . $karma_criteria |
|
| 227 | + . $reply_criteria |
|
| 228 | + . ' AND pt.post_id=p.post_id ORDER BY t.digest_time DESC'; |
|
| 229 | 229 | if (!$result = $this->db->query($query)) { |
| 230 | 230 | //echo "<br>No result:<br>$query"; |
| 231 | 231 | return false; |
@@ -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 |
@@ -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'; |
@@ -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'); |