Passed
Push — master ( 492cc7...e5a5fc )
by Michael
45s queued 11s
created
action.topic.php 1 patch
Indentation   +142 added lines, -142 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
 $op = in_array($op, ['approve', 'delete', 'restore', 'move'], true) ? $op : '';
22 22
 
23 23
 if (0 === count($topic_id) || 0 === count($op)) {
24
-    // irmtfan - issue with javascript:history.go(-1)
25
-    redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 2, _MD_NEWBB_NO_SELECTION);
24
+	// irmtfan - issue with javascript:history.go(-1)
25
+	redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 2, _MD_NEWBB_NO_SELECTION);
26 26
 }
27 27
 
28 28
 $topic_id = array_values($topic_id);
@@ -34,161 +34,161 @@  discard block
 block discarded – undo
34 34
 $isAdmin = newbbIsAdmin($forum_id);
35 35
 
36 36
 if (!$isAdmin) {
37
-    redirect_header(XOOPS_URL . '/index.php', 2, _MD_NEWBB_NORIGHTTOACCESS);
37
+	redirect_header(XOOPS_URL . '/index.php', 2, _MD_NEWBB_NORIGHTTOACCESS);
38 38
 }
39 39
 switch ($op) {
40
-    case 'restore':
41
-        $forums       = [];
42
-        $topicsObject = $topicHandler->getAll(new \Criteria('topic_id', '(' . implode(',', $topic_id) . ')', 'IN'));
43
-        foreach (array_keys($topicsObject) as $id) {
44
-            /** @var Newbb\Topic $topicObject */
45
-            $topicObject = $topicsObject[$id];
46
-            $topicHandler->approve($topicObject);
47
-            $topicHandler->synchronization($topicObject);
48
-            $forums[$topicObject->getVar('forum_id')] = 1;
49
-        }
50
-        $criteria_forum = new \Criteria('forum_id', '(' . implode(',', array_keys($forums)) . ')', 'IN');
51
-        $forumsObject   = $forumHandler->getAll($criteria_forum);
52
-        foreach (array_keys($forumsObject) as $id) {
53
-            $forumHandler->synchronization($forumsObject[$id]);
54
-        }
55
-        unset($topicsObject, $forumsObject);
56
-        break;
57
-    case 'approve':
58
-        $forums       = [];
59
-        $topicsObject = $topicHandler->getAll(new \Criteria('topic_id', '(' . implode(',', $topic_id) . ')', 'IN'));
60
-        foreach (array_keys($topicsObject) as $id) {
61
-            /** @var Newbb\Topic $topicObject */
62
-            $topicObject = $topicsObject[$id];
63
-            $topicHandler->approve($topicObject);
64
-            $topicHandler->synchronization($topicObject);
65
-            $forums[$topicObject->getVar('forum_id')] = 1;
66
-        }
40
+	case 'restore':
41
+		$forums       = [];
42
+		$topicsObject = $topicHandler->getAll(new \Criteria('topic_id', '(' . implode(',', $topic_id) . ')', 'IN'));
43
+		foreach (array_keys($topicsObject) as $id) {
44
+			/** @var Newbb\Topic $topicObject */
45
+			$topicObject = $topicsObject[$id];
46
+			$topicHandler->approve($topicObject);
47
+			$topicHandler->synchronization($topicObject);
48
+			$forums[$topicObject->getVar('forum_id')] = 1;
49
+		}
50
+		$criteria_forum = new \Criteria('forum_id', '(' . implode(',', array_keys($forums)) . ')', 'IN');
51
+		$forumsObject   = $forumHandler->getAll($criteria_forum);
52
+		foreach (array_keys($forumsObject) as $id) {
53
+			$forumHandler->synchronization($forumsObject[$id]);
54
+		}
55
+		unset($topicsObject, $forumsObject);
56
+		break;
57
+	case 'approve':
58
+		$forums       = [];
59
+		$topicsObject = $topicHandler->getAll(new \Criteria('topic_id', '(' . implode(',', $topic_id) . ')', 'IN'));
60
+		foreach (array_keys($topicsObject) as $id) {
61
+			/** @var Newbb\Topic $topicObject */
62
+			$topicObject = $topicsObject[$id];
63
+			$topicHandler->approve($topicObject);
64
+			$topicHandler->synchronization($topicObject);
65
+			$forums[$topicObject->getVar('forum_id')] = 1;
66
+		}
67 67
 
68
-        $criteria_forum = new \Criteria('forum_id', '(' . implode(',', array_keys($forums)) . ')', 'IN');
69
-        $forumsObject   = $forumHandler->getAll($criteria_forum);
70
-        foreach (array_keys($forumsObject) as $id) {
71
-            $forumHandler->synchronization($forumsObject[$id]);
72
-        }
68
+		$criteria_forum = new \Criteria('forum_id', '(' . implode(',', array_keys($forums)) . ')', 'IN');
69
+		$forumsObject   = $forumHandler->getAll($criteria_forum);
70
+		foreach (array_keys($forumsObject) as $id) {
71
+			$forumHandler->synchronization($forumsObject[$id]);
72
+		}
73 73
 
74
-        if (empty($GLOBALS['xoopsModuleConfig']['notification_enabled'])) {
75
-            break;
76
-        }
74
+		if (empty($GLOBALS['xoopsModuleConfig']['notification_enabled'])) {
75
+			break;
76
+		}
77 77
 
78
-        require_once __DIR__ . '/include/notification.inc.php';
79
-        /** @var \XoopsNotificationHandler $notificationHandler */
80
-        $notificationHandler = xoops_getHandler('notification');
81
-        foreach (array_keys($topicsObject) as $id) {
82
-            $topicObject         = $topicsObject[$id];
83
-            $tags                = [];
84
-            $tags['THREAD_NAME'] = $topicObject->getVar('topic_title');
85
-            $tags['THREAD_URL']  = XOOPS_URL . '/modules/' . $moduleDirName . '/viewtopic.php?topic_id=' . $id . '&forum=' . $topicObject->getVar('forum_id');
86
-            /** @var Newbb\Forum[] $forumsObject */
87
-            $tags['FORUM_NAME'] = $forumsObject[$topicObject->getVar('forum_id')]->getVar('forum_name');
88
-            $tags['FORUM_URL']  = XOOPS_URL . '/modules/' . $moduleDirName . '/viewforum.php?forum=' . $topicObject->getVar('forum_id');
89
-            $notificationHandler->triggerEvent('global', 0, 'new_thread', $tags);
90
-            $notificationHandler->triggerEvent('forum', $topicObject->getVar('forum_id'), 'new_thread', $tags);
91
-            $postObject       = $topicHandler->getTopPost($id);
92
-            $tags['POST_URL'] = $tags['THREAD_URL'] . '#forumpost' . $postObject->getVar('post_id');
93
-            $notificationHandler->triggerEvent('thread', $id, 'new_post', $tags);
94
-            $notificationHandler->triggerEvent('forum', $topicObject->getVar('forum_id'), 'new_post', $tags);
95
-            $notificationHandler->triggerEvent('global', 0, 'new_post', $tags);
96
-            $tags['POST_CONTENT'] = $postObject->getVar('post_text');
97
-            $tags['POST_NAME']    = $postObject->getVar('subject');
98
-            $notificationHandler->triggerEvent('global', 0, 'new_fullpost', $tags);
99
-            $notificationHandler->triggerEvent('forum', $topicObject->getVar('forum_id'), 'new_fullpost', $tags);
100
-            unset($postObject);
101
-        }
102
-        unset($topicsObject, $forumsObject);
103
-        break;
104
-    case 'delete':
105
-        $forums = [];
106
-        /** @var Newbb\TopicHandler|\XoopsPersistableObjectHandler $topicHandler */
107
-        $topicsObject = $topicHandler->getAll(new \Criteria('topic_id', '(' . implode(',', $topic_id) . ')', 'IN'));
108
-        foreach (array_keys($topicsObject) as $id) {
109
-            /** @var Newbb\Topic $topicObject */
110
-            $topicObject = $topicsObject[$id];
111
-            // irmtfan should be set to false to not delete topic from database
112
-            $topicHandler->delete($topicObject, false);
113
-            $topicHandler->synchronization($topicObject);
114
-            $forums[$topicObject->getVar('forum_id')] = 1;
115
-        }
78
+		require_once __DIR__ . '/include/notification.inc.php';
79
+		/** @var \XoopsNotificationHandler $notificationHandler */
80
+		$notificationHandler = xoops_getHandler('notification');
81
+		foreach (array_keys($topicsObject) as $id) {
82
+			$topicObject         = $topicsObject[$id];
83
+			$tags                = [];
84
+			$tags['THREAD_NAME'] = $topicObject->getVar('topic_title');
85
+			$tags['THREAD_URL']  = XOOPS_URL . '/modules/' . $moduleDirName . '/viewtopic.php?topic_id=' . $id . '&forum=' . $topicObject->getVar('forum_id');
86
+			/** @var Newbb\Forum[] $forumsObject */
87
+			$tags['FORUM_NAME'] = $forumsObject[$topicObject->getVar('forum_id')]->getVar('forum_name');
88
+			$tags['FORUM_URL']  = XOOPS_URL . '/modules/' . $moduleDirName . '/viewforum.php?forum=' . $topicObject->getVar('forum_id');
89
+			$notificationHandler->triggerEvent('global', 0, 'new_thread', $tags);
90
+			$notificationHandler->triggerEvent('forum', $topicObject->getVar('forum_id'), 'new_thread', $tags);
91
+			$postObject       = $topicHandler->getTopPost($id);
92
+			$tags['POST_URL'] = $tags['THREAD_URL'] . '#forumpost' . $postObject->getVar('post_id');
93
+			$notificationHandler->triggerEvent('thread', $id, 'new_post', $tags);
94
+			$notificationHandler->triggerEvent('forum', $topicObject->getVar('forum_id'), 'new_post', $tags);
95
+			$notificationHandler->triggerEvent('global', 0, 'new_post', $tags);
96
+			$tags['POST_CONTENT'] = $postObject->getVar('post_text');
97
+			$tags['POST_NAME']    = $postObject->getVar('subject');
98
+			$notificationHandler->triggerEvent('global', 0, 'new_fullpost', $tags);
99
+			$notificationHandler->triggerEvent('forum', $topicObject->getVar('forum_id'), 'new_fullpost', $tags);
100
+			unset($postObject);
101
+		}
102
+		unset($topicsObject, $forumsObject);
103
+		break;
104
+	case 'delete':
105
+		$forums = [];
106
+		/** @var Newbb\TopicHandler|\XoopsPersistableObjectHandler $topicHandler */
107
+		$topicsObject = $topicHandler->getAll(new \Criteria('topic_id', '(' . implode(',', $topic_id) . ')', 'IN'));
108
+		foreach (array_keys($topicsObject) as $id) {
109
+			/** @var Newbb\Topic $topicObject */
110
+			$topicObject = $topicsObject[$id];
111
+			// irmtfan should be set to false to not delete topic from database
112
+			$topicHandler->delete($topicObject, false);
113
+			$topicHandler->synchronization($topicObject);
114
+			$forums[$topicObject->getVar('forum_id')] = 1;
115
+		}
116 116
 
117
-        $criteria_forum = new \Criteria('forum_id', '(' . implode(',', array_keys($forums)) . ')', 'IN');
118
-        $forumsObject   = $forumHandler->getAll($criteria_forum);
119
-        foreach (array_keys($forumsObject) as $id) {
120
-            $forumHandler->synchronization($forumsObject[$id]);
121
-        }
122
-        unset($topicsObject, $forumsObject);
123
-        break;
124
-    case 'move':
125
-        if (Request::getInt('newforum', 0, 'POST')
126
-            && Request::getInt('newforum', 0, 'POST') !== $forum_id
127
-            && $forumHandler->getPermission(Request::getInt('newforum', 0, 'POST'), 'post')) {
128
-            $criteria = new \Criteria('topic_id', '(' . implode(',', $topic_id) . ')', 'IN');
129
-            //            /** @var Newbb\PostHandler $postHandler */
130
-            //            $postHandler = Newbb\Helper::getInstance()->getHandler('Post');
131
-            $postHandler->updateAll('forum_id', Request::getInt('newforum', 0, 'POST'), $criteria, true);
132
-            $topicHandler->updateAll('forum_id', Request::getInt('newforum', 0, 'POST'), $criteria, true);
133
-            $forumHandler->synchronization(Request::getInt('newforum', 0, 'POST'));
134
-            $forumHandler->synchronization($forum_id);
135
-        } else {
136
-            require_once $GLOBALS['xoops']->path('header.php');
137
-            //            /** @var Newbb\CategoryHandler $categoryHandler */
138
-            //            $categoryHandler = Newbb\Helper::getInstance()->getHandler('Category');
139
-            $categories = $categoryHandler->getByPermission('access');
140
-            $forums     = $forumHandler->getForumsByCategory(array_keys($categories), 'post', false);
117
+		$criteria_forum = new \Criteria('forum_id', '(' . implode(',', array_keys($forums)) . ')', 'IN');
118
+		$forumsObject   = $forumHandler->getAll($criteria_forum);
119
+		foreach (array_keys($forumsObject) as $id) {
120
+			$forumHandler->synchronization($forumsObject[$id]);
121
+		}
122
+		unset($topicsObject, $forumsObject);
123
+		break;
124
+	case 'move':
125
+		if (Request::getInt('newforum', 0, 'POST')
126
+			&& Request::getInt('newforum', 0, 'POST') !== $forum_id
127
+			&& $forumHandler->getPermission(Request::getInt('newforum', 0, 'POST'), 'post')) {
128
+			$criteria = new \Criteria('topic_id', '(' . implode(',', $topic_id) . ')', 'IN');
129
+			//            /** @var Newbb\PostHandler $postHandler */
130
+			//            $postHandler = Newbb\Helper::getInstance()->getHandler('Post');
131
+			$postHandler->updateAll('forum_id', Request::getInt('newforum', 0, 'POST'), $criteria, true);
132
+			$topicHandler->updateAll('forum_id', Request::getInt('newforum', 0, 'POST'), $criteria, true);
133
+			$forumHandler->synchronization(Request::getInt('newforum', 0, 'POST'));
134
+			$forumHandler->synchronization($forum_id);
135
+		} else {
136
+			require_once $GLOBALS['xoops']->path('header.php');
137
+			//            /** @var Newbb\CategoryHandler $categoryHandler */
138
+			//            $categoryHandler = Newbb\Helper::getInstance()->getHandler('Category');
139
+			$categories = $categoryHandler->getByPermission('access');
140
+			$forums     = $forumHandler->getForumsByCategory(array_keys($categories), 'post', false);
141 141
 
142
-            $box = '<select name="newforum" size="1">';
143
-            if (count($categories) > 0 && count($forums) > 0) {
144
-                foreach (array_keys($forums) as $key) {
142
+			$box = '<select name="newforum" size="1">';
143
+			if (count($categories) > 0 && count($forums) > 0) {
144
+				foreach (array_keys($forums) as $key) {
145 145
 
146
-                    /** @var Newbb\Category[] $categories */
147
-                    $box .= "<option value='-1'>[" . $categories[$key]->getVar('cat_title') . ']</option>';
148
-                    foreach ($forums[$key] as $forumid => $_forum) {
149
-                        $box .= "<option value='" . $forumid . "'>-- " . $_forum['title'] . '</option>';
150
-                        if (!isset($_forum['sub'])) {
151
-                            continue;
152
-                        }
153
-                        foreach (array_keys($_forum['sub']) as $fid) {
154
-                            $box .= "<option value='" . $fid . "'>---- " . $_forum['sub'][$fid]['title'] . '</option>';
155
-                        }
156
-                    }
157
-                }
158
-            } else {
159
-                $box .= "<option value='-1'>" . _MD_NEWBB_NOFORUMINDB . '</option>';
160
-            }
161
-            $box .= '</select>';
162
-            unset($forums, $categories);
146
+					/** @var Newbb\Category[] $categories */
147
+					$box .= "<option value='-1'>[" . $categories[$key]->getVar('cat_title') . ']</option>';
148
+					foreach ($forums[$key] as $forumid => $_forum) {
149
+						$box .= "<option value='" . $forumid . "'>-- " . $_forum['title'] . '</option>';
150
+						if (!isset($_forum['sub'])) {
151
+							continue;
152
+						}
153
+						foreach (array_keys($_forum['sub']) as $fid) {
154
+							$box .= "<option value='" . $fid . "'>---- " . $_forum['sub'][$fid]['title'] . '</option>';
155
+						}
156
+					}
157
+				}
158
+			} else {
159
+				$box .= "<option value='-1'>" . _MD_NEWBB_NOFORUMINDB . '</option>';
160
+			}
161
+			$box .= '</select>';
162
+			unset($forums, $categories);
163 163
 
164
-            echo "<form action='" . Request::getString('PHP_SELF', '', 'SERVER') . "' method='post'>";
165
-            echo "<table border='0' cellpadding='1' cellspacing='0' align='center' width='95%'>";
166
-            echo "<tr><td class='bg2'>";
167
-            echo "<table border='0' cellpadding='1' cellspacing='1' width='100%'>";
168
-            echo '<tr><td class="bg3">' . _MD_NEWBB_MOVETOPICTO . '</td><td class="bg1">';
169
-            echo $box;
170
-            echo '</td></tr>';
171
-            echo '<tr class="bg3"><td colspan="2" align="center">';
172
-            echo "<input type='hidden' name='op' value='move' />";
173
-            echo "<input type='hidden' name='forum_id' value='{$forum_id}' />";
174
-            foreach ($topic_id as $id) {
175
-                echo "<input type='hidden' name='topic_id[]' value='" . $id . "' />";
176
-            }
177
-            echo "<input type='submit' name='submit' value='" . _SUBMIT . "' />";
178
-            echo '</td></tr></table></td></tr></table>';
179
-            echo '</form>';
180
-            require_once $GLOBALS['xoops']->path('footer.php');
181
-            exit();
182
-        }
183
-        break;
164
+			echo "<form action='" . Request::getString('PHP_SELF', '', 'SERVER') . "' method='post'>";
165
+			echo "<table border='0' cellpadding='1' cellspacing='0' align='center' width='95%'>";
166
+			echo "<tr><td class='bg2'>";
167
+			echo "<table border='0' cellpadding='1' cellspacing='1' width='100%'>";
168
+			echo '<tr><td class="bg3">' . _MD_NEWBB_MOVETOPICTO . '</td><td class="bg1">';
169
+			echo $box;
170
+			echo '</td></tr>';
171
+			echo '<tr class="bg3"><td colspan="2" align="center">';
172
+			echo "<input type='hidden' name='op' value='move' />";
173
+			echo "<input type='hidden' name='forum_id' value='{$forum_id}' />";
174
+			foreach ($topic_id as $id) {
175
+				echo "<input type='hidden' name='topic_id[]' value='" . $id . "' />";
176
+			}
177
+			echo "<input type='submit' name='submit' value='" . _SUBMIT . "' />";
178
+			echo '</td></tr></table></td></tr></table>';
179
+			echo '</form>';
180
+			require_once $GLOBALS['xoops']->path('footer.php');
181
+			exit();
182
+		}
183
+		break;
184 184
 }
185 185
 ///** @var Newbb\StatsHandler $statsHandler */
186 186
 //$statsHandler = Newbb\Helper::getInstance()->getHandler('Stats');
187 187
 $statsHandler->reset();
188 188
 if (empty($forum_id)) {
189
-    redirect_header(XOOPS_URL . '/modules/newbb/list.topic.php', 2, _MD_NEWBB_DBUPDATED);
189
+	redirect_header(XOOPS_URL . '/modules/newbb/list.topic.php', 2, _MD_NEWBB_DBUPDATED);
190 190
 } else {
191
-    redirect_header(XOOPS_URL . "/modules/newbb/viewforum.php?forum={$forum_id}", 2, _MD_NEWBB_DBUPDATED);
191
+	redirect_header(XOOPS_URL . "/modules/newbb/viewforum.php?forum={$forum_id}", 2, _MD_NEWBB_DBUPDATED);
192 192
 }
193 193
 // irmtfan move to footer.php
194 194
 require_once __DIR__ . '/footer.php';
Please login to merge, or discard this patch.
language/english/main.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
1 1
 <?php
2 2
 //
3 3
 if (defined('NEWBB_MAIN_DEFINED')) {
4
-    return;
4
+	return;
5 5
 }
6 6
 define('NEWBB_MAIN_DEFINED', true);
7 7
 
Please login to merge, or discard this patch.
language/english/blocks.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,9 +2,9 @@
 block discarded – undo
2 2
 //
3 3
 // Blocks
4 4
 if (defined('NEWBB_BLOCKS_DEFINED')) {
5
-    return;
5
+	return;
6 6
 } else {
7
-    define('NEWBB_BLOCKS_DEFINED', true);
7
+	define('NEWBB_BLOCKS_DEFINED', true);
8 8
 }
9 9
 define('_MB_NEWBB_FORUM', 'Forum');
10 10
 define('_MB_NEWBB_TOPIC', 'Topic');
Please login to merge, or discard this patch.
language/english/admin.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 //
3 3
 if (defined('NEWBB_ADMIN_DEFINED')) {
4
-    return;
4
+	return;
5 5
 } else {
6
-    define('NEWBB_ADMIN_DEFINED', true);
6
+	define('NEWBB_ADMIN_DEFINED', true);
7 7
 }
8 8
 //%%%%%%    File Name  index.php       %%%%%
9 9
 define('_AM_NEWBB_FORUMCONF', 'Forum Configuration');
@@ -75,8 +75,8 @@  discard block
 block discarded – undo
75 75
 define('_AM_NEWBB_DIGEST_HELP_3', 'The dispatch is made only to users signed up for notification of digest topics.');
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
-    '_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.'
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.'
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');
@@ -324,31 +324,31 @@  discard block
 block discarded – undo
324 324
 
325 325
 // Help tab
326 326
 define(
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.'
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.'
329 329
 );
330 330
 define(
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.'
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.'
333 333
 );
334 334
 define(
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.'
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.'
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
-    '_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.'
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.'
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
-    '_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.'
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.'
348 348
 );
349 349
 define(
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.'
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.'
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
 
Please login to merge, or discard this patch.
language/english/modinfo.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 //
3 3
 // Thanks Tom (http://www.wf-projects.com), for correcting the Engligh language package
4 4
 if (defined('NEWBB_MODINFO_DEFINED')) {
5
-    return;
5
+	return;
6 6
 }
7 7
 define('NEWBB_MODINO_DEFINED', true);
8 8
 // Module Info
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
 //define('_MI_NEWBB_THEMESET_DESC', "Module-wide, select '' . _NONE . '' will use site-wide theme");
43 43
 define('_MI_NEWBB_DIR_ATTACHMENT', 'Attachments physical path.');
44 44
 define(
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'"
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'"
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.");
@@ -81,8 +81,8 @@  discard block
 block discarded – undo
81 81
 define('_MI_NEWBB_GRAPHIC', 'graphic');
82 82
 define('_MI_NEWBB_USERLEVEL', 'HP/MP/EXP Level Mode');
83 83
 define(
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.'
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.'
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');
Please login to merge, or discard this patch.
xoops_version.php 1 patch
Indentation   +691 added lines, -691 removed lines patch added patch discarded remove patch
@@ -14,105 +14,105 @@  discard block
 block discarded – undo
14 14
 $moduleDirName = basename(__DIR__);
15 15
 
16 16
 $modversion    = [
17
-    'version'             => 5.00,
18
-    'module_status'       => 'Beta 1',
19
-    'release_date'        => '2018/03/25',
20
-    'name'                => _MI_NEWBB_NAME,
21
-    'description'         => _MI_NEWBB_DESC,
22
-    'help'                => 'page=help',
23
-    'credits'             => 'NewBB 2 developed by Marko Schmuck (predator) / D.J. (phppp) / Alfred(dhcst)',
24
-    'author'              => 'Marko Schmuck (predator) / D.J. (phppp) / Alfred(dhcst) / (irmtfan) / (Geekwright) / (Mamba) / (Aerograf)',
25
-    'license'             => 'GNU GPL 2.0',
26
-    'license_url'         => 'www.gnu.org/licenses/gpl-2.0.html/',
27
-    'image'               => 'assets/images/logoModule.png',
28
-    'dirname'             => basename(__DIR__),
29
-    'author_realname'     => 'NewBB Dev Team',
30
-    'author_email'        => '',
31
-    'module_website_url'  => 'www.xoops.org/',
32
-    'module_website_name' => 'XOOPS',
33
-    'min_php'             => '5.5',
34
-    'min_xoops'           => '2.5.9',
35
-    'min_admin'           => '1.2',
36
-    'min_db'              => ['mysql' => '5.5'],
37
-    'modicons16'          => 'assets/images/icons/16',
38
-    'modicons32'          => 'assets/images/icons/32',
39
-    'demo_site_url'       => 'https://xoops.org/newbb/',
40
-    'demo_site_name'      => 'XOOPS Project',
41
-    'support_site_url'    => 'https://xoops.org/newbb/',
42
-    'support_site_name'   => 'XOOPS Project',
43
-    'submit_feature'      => 'https://xoops.org/modules/newbb/viewforum.php?forum=30',
44
-    'submit_bug'          => 'https://xoops.org/modules/newbb/viewforum.php?forum=28',
45
-    // ------------------- Mysql -----------------------------
46
-    'sqlfile'             => ['mysql' => 'sql/mysql.sql'],
47
-    // ------------------- Tables ----------------------------
48
-    'tables'              => [
49
-        $moduleDirName . '_' . 'archive',
50
-        $moduleDirName . '_' . 'categories',
51
-        $moduleDirName . '_' . 'votedata',
52
-        $moduleDirName . '_' . 'forums',
53
-        $moduleDirName . '_' . 'posts',
54
-        $moduleDirName . '_' . 'posts_text',
55
-        $moduleDirName . '_' . 'topics',
56
-        $moduleDirName . '_' . 'online',
57
-        $moduleDirName . '_' . 'digest',
58
-        $moduleDirName . '_' . 'report',
59
-        $moduleDirName . '_' . 'attachments',
60
-        $moduleDirName . '_' . 'moderates',
61
-        $moduleDirName . '_' . 'reads_forum',
62
-        $moduleDirName . '_' . 'reads_topic',
63
-        $moduleDirName . '_' . 'type',
64
-        $moduleDirName . '_' . 'type_forum',
65
-        $moduleDirName . '_' . 'stats',
66
-        $moduleDirName . '_' . 'user_stats'
67
-    ],
68
-    // ------------------- Admin Menu -------------------
69
-    'system_menu'         => 1,
70
-    'hasAdmin'            => 1,
71
-    'adminindex'          => 'admin/index.php',
72
-    'adminmenu'           => 'admin/menu.php',
73
-    // ------------------- Main Menu -------------------
74
-    'hasMain'             => 1,
75
-    // ------------------- Search ---------------------------
76
-    'hasSearch'           => 1,
77
-    'search'              => [
78
-        'file' => 'include/search.inc.php',
79
-        'func' => 'newbb_search',
80
-    ],
81
-    // ------------------- Install/Update -------------------
82
-    'onInstall'           => 'include/module.php',
83
-    'onUpdate'            => 'include/module.php',
84
-    //  'onUninstall'         => 'include/onuninstall.php',
17
+	'version'             => 5.00,
18
+	'module_status'       => 'Beta 1',
19
+	'release_date'        => '2018/03/25',
20
+	'name'                => _MI_NEWBB_NAME,
21
+	'description'         => _MI_NEWBB_DESC,
22
+	'help'                => 'page=help',
23
+	'credits'             => 'NewBB 2 developed by Marko Schmuck (predator) / D.J. (phppp) / Alfred(dhcst)',
24
+	'author'              => 'Marko Schmuck (predator) / D.J. (phppp) / Alfred(dhcst) / (irmtfan) / (Geekwright) / (Mamba) / (Aerograf)',
25
+	'license'             => 'GNU GPL 2.0',
26
+	'license_url'         => 'www.gnu.org/licenses/gpl-2.0.html/',
27
+	'image'               => 'assets/images/logoModule.png',
28
+	'dirname'             => basename(__DIR__),
29
+	'author_realname'     => 'NewBB Dev Team',
30
+	'author_email'        => '',
31
+	'module_website_url'  => 'www.xoops.org/',
32
+	'module_website_name' => 'XOOPS',
33
+	'min_php'             => '5.5',
34
+	'min_xoops'           => '2.5.9',
35
+	'min_admin'           => '1.2',
36
+	'min_db'              => ['mysql' => '5.5'],
37
+	'modicons16'          => 'assets/images/icons/16',
38
+	'modicons32'          => 'assets/images/icons/32',
39
+	'demo_site_url'       => 'https://xoops.org/newbb/',
40
+	'demo_site_name'      => 'XOOPS Project',
41
+	'support_site_url'    => 'https://xoops.org/newbb/',
42
+	'support_site_name'   => 'XOOPS Project',
43
+	'submit_feature'      => 'https://xoops.org/modules/newbb/viewforum.php?forum=30',
44
+	'submit_bug'          => 'https://xoops.org/modules/newbb/viewforum.php?forum=28',
45
+	// ------------------- Mysql -----------------------------
46
+	'sqlfile'             => ['mysql' => 'sql/mysql.sql'],
47
+	// ------------------- Tables ----------------------------
48
+	'tables'              => [
49
+		$moduleDirName . '_' . 'archive',
50
+		$moduleDirName . '_' . 'categories',
51
+		$moduleDirName . '_' . 'votedata',
52
+		$moduleDirName . '_' . 'forums',
53
+		$moduleDirName . '_' . 'posts',
54
+		$moduleDirName . '_' . 'posts_text',
55
+		$moduleDirName . '_' . 'topics',
56
+		$moduleDirName . '_' . 'online',
57
+		$moduleDirName . '_' . 'digest',
58
+		$moduleDirName . '_' . 'report',
59
+		$moduleDirName . '_' . 'attachments',
60
+		$moduleDirName . '_' . 'moderates',
61
+		$moduleDirName . '_' . 'reads_forum',
62
+		$moduleDirName . '_' . 'reads_topic',
63
+		$moduleDirName . '_' . 'type',
64
+		$moduleDirName . '_' . 'type_forum',
65
+		$moduleDirName . '_' . 'stats',
66
+		$moduleDirName . '_' . 'user_stats'
67
+	],
68
+	// ------------------- Admin Menu -------------------
69
+	'system_menu'         => 1,
70
+	'hasAdmin'            => 1,
71
+	'adminindex'          => 'admin/index.php',
72
+	'adminmenu'           => 'admin/menu.php',
73
+	// ------------------- Main Menu -------------------
74
+	'hasMain'             => 1,
75
+	// ------------------- Search ---------------------------
76
+	'hasSearch'           => 1,
77
+	'search'              => [
78
+		'file' => 'include/search.inc.php',
79
+		'func' => 'newbb_search',
80
+	],
81
+	// ------------------- Install/Update -------------------
82
+	'onInstall'           => 'include/module.php',
83
+	'onUpdate'            => 'include/module.php',
84
+	//  'onUninstall'         => 'include/onuninstall.php',
85 85
 ];
86 86
 // ------------------- Help files ------------------- //
87 87
 $modversion['helpsection'] = [
88
-    ['name' => _MI_NEWBB_OVERVIEW, 'link' => 'page=help'],
89
-    ['name' => _MI_NEWBB_HELP_DISCLAIMER, 'link' => 'page=disclaimer'],
90
-    ['name' => _MI_NEWBB_LICENSE, 'link' => 'page=license'],
91
-    ['name' => _MI_NEWBB_SUPPORT, 'link' => 'page=support'],
92
-    //    array('name' => _MI_NEWBB_HOWTO, 'link' => 'page=__howto'),
93
-    //    array('name' => _MI_NEWBB_REQUIREMENTS, 'link' => 'page=__requirements'),
94
-    //    array('name' => _MI_NEWBB_CREDITS, 'link' => 'page=__credits'),
88
+	['name' => _MI_NEWBB_OVERVIEW, 'link' => 'page=help'],
89
+	['name' => _MI_NEWBB_HELP_DISCLAIMER, 'link' => 'page=disclaimer'],
90
+	['name' => _MI_NEWBB_LICENSE, 'link' => 'page=license'],
91
+	['name' => _MI_NEWBB_SUPPORT, 'link' => 'page=support'],
92
+	//    array('name' => _MI_NEWBB_HOWTO, 'link' => 'page=__howto'),
93
+	//    array('name' => _MI_NEWBB_REQUIREMENTS, 'link' => 'page=__requirements'),
94
+	//    array('name' => _MI_NEWBB_CREDITS, 'link' => 'page=__credits'),
95 95
 ];
96 96
 // Templates
97 97
 $modversion['templates'] = [
98
-    ['file' => 'newbb_index_menu.tpl', 'description' => ''],
99
-    ['file' => 'newbb_index.tpl', 'description' => ''],
100
-    ['file' => 'newbb_viewforum_subforum.tpl', 'description' => ''],
101
-    ['file' => 'newbb_viewforum_menu.tpl', 'description' => ''],
102
-    ['file' => 'newbb_viewforum.tpl', 'description' => ''],
103
-    ['file' => 'newbb_viewtopic.tpl', 'description' => ''],
104
-    ['file' => 'newbb_thread.tpl', 'description' => ''],
105
-    ['file' => 'newbb_edit_post.tpl', 'description' => ''],
106
-    ['file' => 'newbb_poll_results.tpl', 'description' => ''],
107
-    ['file' => 'newbb_poll_view.tpl', 'description' => ''],
108
-    ['file' => 'newbb_searchresults.tpl', 'description' => ''],
109
-    ['file' => 'newbb_search.tpl', 'description' => ''],
110
-    ['file' => 'newbb_viewall.tpl', 'description' => ''],
111
-    ['file' => 'newbb_viewpost.tpl', 'description' => ''],
112
-    ['file' => 'newbb_online.tpl', 'description' => ''],
113
-    ['file' => 'newbb_rss.tpl', 'description' => ''],
114
-    ['file' => 'newbb_notification_select.tpl', 'description' => ''],
115
-    ['file' => 'newbb_moderate.tpl', 'description' => ''],
98
+	['file' => 'newbb_index_menu.tpl', 'description' => ''],
99
+	['file' => 'newbb_index.tpl', 'description' => ''],
100
+	['file' => 'newbb_viewforum_subforum.tpl', 'description' => ''],
101
+	['file' => 'newbb_viewforum_menu.tpl', 'description' => ''],
102
+	['file' => 'newbb_viewforum.tpl', 'description' => ''],
103
+	['file' => 'newbb_viewtopic.tpl', 'description' => ''],
104
+	['file' => 'newbb_thread.tpl', 'description' => ''],
105
+	['file' => 'newbb_edit_post.tpl', 'description' => ''],
106
+	['file' => 'newbb_poll_results.tpl', 'description' => ''],
107
+	['file' => 'newbb_poll_view.tpl', 'description' => ''],
108
+	['file' => 'newbb_searchresults.tpl', 'description' => ''],
109
+	['file' => 'newbb_search.tpl', 'description' => ''],
110
+	['file' => 'newbb_viewall.tpl', 'description' => ''],
111
+	['file' => 'newbb_viewpost.tpl', 'description' => ''],
112
+	['file' => 'newbb_online.tpl', 'description' => ''],
113
+	['file' => 'newbb_rss.tpl', 'description' => ''],
114
+	['file' => 'newbb_notification_select.tpl', 'description' => ''],
115
+	['file' => 'newbb_moderate.tpl', 'description' => ''],
116 116
 ];
117 117
 // Blocks
118 118
 // options[0] - Citeria valid: time(by default)
@@ -122,14 +122,14 @@  discard block
 block discarded – undo
122 122
 // options[4] - Display Navigator: 1 (by default), 0 (No)
123 123
 // options[5] - SelectedForumIDs: null for all
124 124
 $modversion['blocks'][1] = [
125
-    'file'        => 'newbb_block.php',
126
-    'name'        => _MI_NEWBB_BLOCK_TOPIC_POST,
127
-    'description' => 'It Will drop (use advance topic renderer block)',
128
-    // irmtfan
129
-    'show_func'   => 'b_newbb_show',
130
-    'options'     => 'time|5|360|0|1|0',
131
-    'edit_func'   => 'b_newbb_edit',
132
-    'template'    => 'newbb_block.tpl'
125
+	'file'        => 'newbb_block.php',
126
+	'name'        => _MI_NEWBB_BLOCK_TOPIC_POST,
127
+	'description' => 'It Will drop (use advance topic renderer block)',
128
+	// irmtfan
129
+	'show_func'   => 'b_newbb_show',
130
+	'options'     => 'time|5|360|0|1|0',
131
+	'edit_func'   => 'b_newbb_edit',
132
+	'template'    => 'newbb_block.tpl'
133 133
 ];
134 134
 // options[0] - Citeria valid: time(by default), views, replies, digest, sticky
135 135
 // options[1] - NumberToDisplay: any positive integer
@@ -139,14 +139,14 @@  discard block
 block discarded – undo
139 139
 // options[5] - Title Length : 0 - no limit
140 140
 // options[6] - SelectedForumIDs: null for all
141 141
 $modversion['blocks'][] = [
142
-    'file'        => 'newbb_block.php',
143
-    'name'        => _MI_NEWBB_BLOCK_TOPIC,
144
-    'description' => 'It Will drop (use advance topic renderer block)',
145
-    // irmtfan
146
-    'show_func'   => 'b_newbb_topic_show',
147
-    'options'     => 'time|5|0|0|1|0|0',
148
-    'edit_func'   => 'b_newbb_topic_edit',
149
-    'template'    => 'newbb_block_topic.tpl'
142
+	'file'        => 'newbb_block.php',
143
+	'name'        => _MI_NEWBB_BLOCK_TOPIC,
144
+	'description' => 'It Will drop (use advance topic renderer block)',
145
+	// irmtfan
146
+	'show_func'   => 'b_newbb_topic_show',
147
+	'options'     => 'time|5|0|0|1|0|0',
148
+	'edit_func'   => 'b_newbb_topic_edit',
149
+	'template'    => 'newbb_block_topic.tpl'
150 150
 ];
151 151
 // options[0] - Citeria valid: title(by default), text
152 152
 // options[1] - NumberToDisplay: any positive integer
@@ -156,13 +156,13 @@  discard block
 block discarded – undo
156 156
 // options[5] - Title/Text Length : 0 - no limit
157 157
 // options[6] - SelectedForumIDs: null for all
158 158
 $modversion['blocks'][] = [
159
-    'file'        => 'newbb_block.php',
160
-    'name'        => _MI_NEWBB_BLOCK_POST,
161
-    'description' => 'Shows recent posts in the forums',
162
-    'show_func'   => 'b_newbb_post_show',
163
-    'options'     => 'title|10|0|0|1|0|0',
164
-    'edit_func'   => 'b_newbb_post_edit',
165
-    'template'    => 'newbb_block_post.tpl'
159
+	'file'        => 'newbb_block.php',
160
+	'name'        => _MI_NEWBB_BLOCK_POST,
161
+	'description' => 'Shows recent posts in the forums',
162
+	'show_func'   => 'b_newbb_post_show',
163
+	'options'     => 'title|10|0|0|1|0|0',
164
+	'edit_func'   => 'b_newbb_post_edit',
165
+	'template'    => 'newbb_block_post.tpl'
166 166
 ];
167 167
 // options[0] - Citeria valid: post(by default), topic, digest, sticky
168 168
 // options[1] - NumberToDisplay: any positive integer
@@ -171,13 +171,13 @@  discard block
 block discarded – undo
171 171
 // options[4] - Display Navigator: 1 (by default), 0 (No)
172 172
 // options[5] - SelectedForumIDs: null for all
173 173
 $modversion['blocks'][] = [
174
-    'file'        => 'newbb_block.php',
175
-    'name'        => _MI_NEWBB_BLOCK_AUTHOR,
176
-    'description' => 'Shows authors stats',
177
-    'show_func'   => 'b_newbb_author_show',
178
-    'options'     => 'topic|5|0|0|1|0',
179
-    'edit_func'   => 'b_newbb_author_edit',
180
-    'template'    => 'newbb_block_author.tpl'
174
+	'file'        => 'newbb_block.php',
175
+	'name'        => _MI_NEWBB_BLOCK_AUTHOR,
176
+	'description' => 'Shows authors stats',
177
+	'show_func'   => 'b_newbb_author_show',
178
+	'options'     => 'topic|5|0|0|1|0',
179
+	'edit_func'   => 'b_newbb_author_edit',
180
+	'template'    => 'newbb_block_author.tpl'
181 181
 ];
182 182
 /*
183 183
  * $options:
@@ -187,13 +187,13 @@  discard block
 block discarded – undo
187 187
  *                    $options[3] - min font size (px or %)
188 188
  */
189 189
 $modversion['blocks'][] = [
190
-    'file'        => 'newbb_block_tag.php',
191
-    'name'        => _MI_NEWBB_BLOCK_TAG_CLOUD,
192
-    'description' => 'Show tag cloud',
193
-    'show_func'   => 'newbb_tag_block_cloud_show',
194
-    'edit_func'   => 'newbb_tag_block_cloud_edit',
195
-    'options'     => '100|0|150|80',
196
-    'template'    => 'newbb_tag_block_cloud.tpl'
190
+	'file'        => 'newbb_block_tag.php',
191
+	'name'        => _MI_NEWBB_BLOCK_TAG_CLOUD,
192
+	'description' => 'Show tag cloud',
193
+	'show_func'   => 'newbb_tag_block_cloud_show',
194
+	'edit_func'   => 'newbb_tag_block_cloud_edit',
195
+	'options'     => '100|0|150|80',
196
+	'template'    => 'newbb_tag_block_cloud.tpl'
197 197
 ];
198 198
 /*
199 199
  * $options:
@@ -202,13 +202,13 @@  discard block
 block discarded – undo
202 202
  *                    $options[2] - sort: a - alphabet; c - count; t - time
203 203
  */
204 204
 $modversion['blocks'][] = [
205
-    'file'        => 'newbb_block_tag.php',
206
-    'name'        => _MI_NEWBB_BLOCK_TAG_TOP,
207
-    'description' => 'Show top tags',
208
-    'show_func'   => 'newbb_tag_block_top_show',
209
-    'edit_func'   => 'newbb_tag_block_top_edit',
210
-    'options'     => '50|0|c',
211
-    'template'    => 'newbb_tag_block_top.tpl'
205
+	'file'        => 'newbb_block_tag.php',
206
+	'name'        => _MI_NEWBB_BLOCK_TAG_TOP,
207
+	'description' => 'Show top tags',
208
+	'show_func'   => 'newbb_tag_block_top_show',
209
+	'edit_func'   => 'newbb_tag_block_top_edit',
210
+	'options'     => '50|0|c',
211
+	'template'    => 'newbb_tag_block_top.tpl'
212 212
 ];
213 213
 // options[0] - Status in WHERE claus: all(by default), sticky, digest,lock, poll, voted, viewed, replied, read, (UN_) , active, pending, deleted (admin) (It is  multi-select)
214 214
 // options[1] - Uid in WHERE claus: uid of the topic poster : -1 - all users (by default)
@@ -224,498 +224,498 @@  discard block
 block discarded – undo
224 224
 // options[11] - Post text Length: 0 - dont show post text - 200 by default
225 225
 // options[12] - SelectedForumIDs: multi-select ngative values for categories and positive values for forums: null for all(by default)
226 226
 $modversion['blocks'][] = [
227
-    'file'        => 'list_topic.php',
228
-    'name'        => _MI_NEWBB_BLOCK_LIST_TOPIC,
229
-    'description' => 'Shows a list of topics (advance renderer)',
230
-    'show_func'   => 'newbb_list_topic_show',
231
-    'options'     => 'all|-1|-1|0|lastpost|0|5|360|topic,forum,replies,lastpost,lastposttime,lastposter,lastpostmsgicon,publish|1|0|200|0',
232
-    'edit_func'   => 'newbb_list_topic_edit',
233
-    'template'    => 'newbb_block_list_topic.tpl'
227
+	'file'        => 'list_topic.php',
228
+	'name'        => _MI_NEWBB_BLOCK_LIST_TOPIC,
229
+	'description' => 'Shows a list of topics (advance renderer)',
230
+	'show_func'   => 'newbb_list_topic_show',
231
+	'options'     => 'all|-1|-1|0|lastpost|0|5|360|topic,forum,replies,lastpost,lastposttime,lastposter,lastpostmsgicon,publish|1|0|200|0',
232
+	'edit_func'   => 'newbb_list_topic_edit',
233
+	'template'    => 'newbb_block_list_topic.tpl'
234 234
 ];
235 235
 // Smarty
236 236
 $modversion['use_smarty'] = 1;
237 237
 // Configs
238 238
 $modversion['config']   = [];
239 239
 $modversion['config'][] = [
240
-    'name'        => 'do_rewrite',
241
-    'title'       => '_MI_NEWBB_DO_REWRITE',
242
-    'description' => '_MI_NEWBB_DO_REWRITE_DESC',
243
-    'formtype'    => 'yesno',
244
-    'valuetype'   => 'int',
245
-    'default'     => 0
246
-];
247
-$modversion['config'][] = [
248
-    'name'        => 'subforum_display',
249
-    'title'       => '_MI_NEWBB_SUBFORUM_DISPLAY',
250
-    'description' => '_MI_NEWBB_SUBFORUM_DISPLAY_DESC',
251
-    'formtype'    => 'select',
252
-    'valuetype'   => 'text',
253
-    'options'     => [
254
-        _MI_NEWBB_SUBFORUM_EXPAND   => 'expand',
255
-        _MI_NEWBB_SUBFORUM_COLLAPSE => 'collapse',
256
-        _MI_NEWBB_SUBFORUM_HIDDEN   => 'hidden'
257
-    ],
258
-    'default'     => 'collapse'
259
-];
260
-$modversion['config'][] = [
261
-    'name'        => 'post_excerpt',
262
-    'title'       => '_MI_NEWBB_POST_EXCERPT',
263
-    'description' => '_MI_NEWBB_POST_EXCERPT_DESC',
264
-    'formtype'    => 'textbox',
265
-    'valuetype'   => 'int',
266
-    'default'     => 100
267
-];
268
-$modversion['config'][] = [
269
-    'name'        => 'topics_per_page',
270
-    'title'       => '_MI_NEWBB_TOPICSPERPAGE',
271
-    'description' => '_MI_NEWBB_TOPICSPERPAGE_DESC',
272
-    'formtype'    => 'textbox',
273
-    'valuetype'   => 'int',
274
-    'default'     => 20
275
-];
276
-$modversion['config'][] = [
277
-    'name'        => 'posts_per_page',
278
-    'title'       => '_MI_NEWBB_POSTSPERPAGE',
279
-    'description' => '_MI_NEWBB_POSTSPERPAGE_DESC',
280
-    'formtype'    => 'textbox',
281
-    'valuetype'   => 'int',
282
-    'default'     => 10
283
-];
284
-$modversion['config'][] = [
285
-    'name'        => 'pagenav_display',
286
-    'title'       => '_MI_NEWBB_PAGENAV_DISPLAY',
287
-    'description' => '_MI_NEWBB_PAGENAV_DISPLAY_DESC',
288
-    'formtype'    => 'select',
289
-    'valuetype'   => 'text',
290
-    'options'     => [
291
-        _MI_NEWBB_PAGENAV_NUMBER => 'number',
292
-        _MI_NEWBB_PAGENAV_IMAGE  => 'image',
293
-        _MI_NEWBB_PAGENAV_SELECT => 'select'
294
-    ],
295
-    'default'     => 'number'
296
-];
297
-$modversion['config'][] = [
298
-    'name'        => 'cache_enabled',
299
-    'title'       => '_MI_NEWBB_CACHE_ENABLE',
300
-    'description' => '_MI_NEWBB_CACHE_ENABLE_DESC',
301
-    'formtype'    => 'yesno',
302
-    'valuetype'   => 'int',
303
-    'default'     => 0
304
-];
305
-$modversion['config'][] = [
306
-    'name'        => 'statistik_enabled',
307
-    'title'       => '_MI_NEWBB_STATISTIK_ENABLE',
308
-    'description' => '_MI_NEWBB_STATISTIK_ENABLE_DESC',
309
-    'formtype'    => 'yesno',
310
-    'valuetype'   => 'int',
311
-    'default'     => 1
312
-];
313
-$modversion['config'][] = [
314
-    'name'        => 'dir_attachments',
315
-    'title'       => '_MI_NEWBB_DIR_ATTACHMENT',
316
-    'description' => '_MI_NEWBB_DIR_ATTACHMENT_DESC',
317
-    'formtype'    => 'textbox',
318
-    'valuetype'   => 'text',
319
-    'default'     => 'uploads/newbb'
320
-];
321
-$modversion['config'][] = [
322
-    'name'        => 'media_allowed',
323
-    'title'       => '_MI_NEWBB_MEDIA_ENABLE',
324
-    'description' => '_MI_NEWBB_MEDIA_ENABLE_DESC',
325
-    'formtype'    => 'yesno',
326
-    'valuetype'   => 'int',
327
-    'default'     => 1
328
-];
329
-$modversion['config'][] = [
330
-    'name'        => 'path_magick',
331
-    'title'       => '_MI_NEWBB_PATH_MAGICK',
332
-    'description' => '_MI_NEWBB_PATH_MAGICK_DESC',
333
-    'formtype'    => 'textbox',
334
-    'valuetype'   => 'text',
335
-    'default'     => '/usr/bin/X11'
336
-];
337
-$modversion['config'][] = [
338
-    'name'        => 'path_netpbm',
339
-    'title'       => '_MI_NEWBB_PATH_NETPBM',
340
-    'description' => '_MI_NEWBB_PATH_NETPBM_DESC',
341
-    'formtype'    => 'textbox',
342
-    'valuetype'   => 'text',
343
-    'default'     => '/usr/bin'
344
-];
345
-$modversion['config'][] = [
346
-    'name'        => 'image_lib',
347
-    'title'       => '_MI_NEWBB_IMAGELIB',
348
-    'description' => '_MI_NEWBB_IMAGELIB_DESC',
349
-    'formtype'    => 'select',
350
-    'valuetype'   => 'int',
351
-    'default'     => 0,
352
-    'options'     => [
353
-        _MI_NEWBB_AUTO   => 0,
354
-        _MI_NEWBB_MAGICK => 1,
355
-        _MI_NEWBB_NETPBM => 2,
356
-        _MI_NEWBB_GD1    => 3,
357
-        _MI_NEWBB_GD2    => 4
358
-    ]
359
-];
360
-$modversion['config'][] = [
361
-    'name'        => 'show_userattach',
362
-    'title'       => '_MI_NEWBB_USERATTACH_ENABLE',
363
-    'description' => '_MI_NEWBB_USERATTACH_ENABLE_DESC',
364
-    'formtype'    => 'yesno',
365
-    'valuetype'   => 'int',
366
-    'default'     => 1
367
-];
368
-$modversion['config'][] = [
369
-    'name'        => 'max_img_width',
370
-    'title'       => '_MI_NEWBB_MAX_IMG_WIDTH',
371
-    'description' => '_MI_NEWBB_MAX_IMG_WIDTH_DESC',
372
-    'formtype'    => 'textbox',
373
-    'valuetype'   => 'int',
374
-    'default'     => 800
375
-];
376
-$modversion['config'][] = [
377
-    'name'        => 'max_img_height',
378
-    'title'       => '_MI_NEWBB_MAX_IMG_HEIGHT',
379
-    'description' => '_MI_NEWBB_MAX_IMG_HEIGHT_DESC',
380
-    'formtype'    => 'textbox',
381
-    'valuetype'   => 'int',
382
-    'default'     => 640
383
-];
384
-$modversion['config'][] = [
385
-    'name'        => 'max_image_width',
386
-    'title'       => '_MI_NEWBB_MAX_IMAGE_WIDTH',
387
-    'description' => '_MI_NEWBB_MAX_IMAGE_WIDTH_DESC',
388
-    'formtype'    => 'textbox',
389
-    'valuetype'   => 'int',
390
-    'default'     => 150
391
-];
392
-$modversion['config'][] = [
393
-    'name'        => 'max_image_height',
394
-    'title'       => '_MI_NEWBB_MAX_IMAGE_HEIGHT',
395
-    'description' => '_MI_NEWBB_MAX_IMAGE_HEIGHT_DESC',
396
-    'formtype'    => 'textbox',
397
-    'valuetype'   => 'int',
398
-    'default'     => 150
399
-];
400
-$modversion['config'][] = [
401
-    'name'        => 'wol_enabled',
402
-    'title'       => '_MI_NEWBB_WOL_ENABLE',
403
-    'description' => '_MI_NEWBB_WOL_ENABLE_DESC',
404
-    'formtype'    => 'yesno',
405
-    'valuetype'   => 'int',
406
-    'default'     => 1
407
-];
408
-$modversion['config'][] = [
409
-    'name'        => 'user_level',
410
-    'title'       => '_MI_NEWBB_USERLEVEL',
411
-    'description' => '_MI_NEWBB_USERLEVEL_DESC',
412
-    'formtype'    => 'select',
413
-    'valuetype'   => 'int',
414
-    'default'     => 2,
415
-    'options'     => [
416
-        _MI_NEWBB_NULL    => 0,
417
-        _MI_NEWBB_TEXT    => 1,
418
-        _MI_NEWBB_GRAPHIC => 2
419
-    ]
420
-];
421
-$modversion['config'][] = [
422
-    'name'        => 'show_realname',
423
-    'title'       => '_MI_NEWBB_SHOW_REALNAME',
424
-    'description' => '_MI_NEWBB_SHOW_REALNAME_DESC',
425
-    'formtype'    => 'yesno',
426
-    'valuetype'   => 'int',
427
-    'default'     => 0
428
-];
429
-$modversion['config'][] = [
430
-    'name'        => 'groupbar_enabled',
431
-    'title'       => '_MI_NEWBB_GROUPBAR_ENABLE',
432
-    'description' => '_MI_NEWBB_GROUPBAR_ENABLE_DESC',
433
-    'formtype'    => 'yesno',
434
-    'valuetype'   => 'int',
435
-    'default'     => 1
436
-];
437
-$modversion['config'][] = [
438
-    'name'        => 'rating_enabled',
439
-    'title'       => '_MI_NEWBB_RATING_ENABLE',
440
-    'description' => '_MI_NEWBB_RATING_ENABLE_DESC',
441
-    'formtype'    => 'yesno',
442
-    'valuetype'   => 'int',
443
-    'default'     => 0
444
-];
445
-$modversion['config'][] = [
446
-    'name'        => 'reportmod_enabled',
447
-    'title'       => '_MI_NEWBB_REPORTMOD_ENABLE',
448
-    'description' => '_MI_NEWBB_REPORTMOD_ENABLE_DESC',
449
-    'formtype'    => 'yesno',
450
-    'valuetype'   => 'int',
451
-    'default'     => 0
452
-];
453
-$modversion['config'][] = [
454
-    'name'        => 'quickreply_enabled',
455
-    'title'       => '_MI_NEWBB_QUICKREPLY_ENABLE',
456
-    'description' => '_MI_NEWBB_QUICKREPLY_ENABLE_DESC',
457
-    'formtype'    => 'yesno',
458
-    'valuetype'   => 'int',
459
-    'default'     => 1
460
-];
461
-$modversion['config'][] = [
462
-    'name'        => 'rss_enable',
463
-    'title'       => '_MI_NEWBB_RSS_ENABLE',
464
-    'description' => '_MI_NEWBB_RSS_ENABLE_DESC',
465
-    'formtype'    => 'yesno',
466
-    'valuetype'   => 'int',
467
-    'default'     => 1
468
-];
469
-$modversion['config'][] = [
470
-    'name'        => 'rss_maxitems',
471
-    'title'       => '_MI_NEWBB_RSS_MAX_ITEMS',
472
-    'description' => '',
473
-    'formtype'    => 'textbox',
474
-    'valuetype'   => 'int',
475
-    'default'     => 10
476
-];
477
-$modversion['config'][] = [
478
-    'name'        => 'rss_maxdescription',
479
-    'title'       => '_MI_NEWBB_RSS_MAX_DESCRIPTION',
480
-    'description' => '',
481
-    'formtype'    => 'textbox',
482
-    'valuetype'   => 'int',
483
-    'default'     => 0
484
-];
485
-$modversion['config'][] = [
486
-    'name'        => 'rss_cachetime',
487
-    'title'       => '_MI_NEWBB_RSS_CACHETIME',
488
-    'description' => '_MI_NEWBB_RSS_CACHETIME_DESCRIPTION',
489
-    'formtype'    => 'textbox',
490
-    'valuetype'   => 'int',
491
-    'default'     => 30
240
+	'name'        => 'do_rewrite',
241
+	'title'       => '_MI_NEWBB_DO_REWRITE',
242
+	'description' => '_MI_NEWBB_DO_REWRITE_DESC',
243
+	'formtype'    => 'yesno',
244
+	'valuetype'   => 'int',
245
+	'default'     => 0
246
+];
247
+$modversion['config'][] = [
248
+	'name'        => 'subforum_display',
249
+	'title'       => '_MI_NEWBB_SUBFORUM_DISPLAY',
250
+	'description' => '_MI_NEWBB_SUBFORUM_DISPLAY_DESC',
251
+	'formtype'    => 'select',
252
+	'valuetype'   => 'text',
253
+	'options'     => [
254
+		_MI_NEWBB_SUBFORUM_EXPAND   => 'expand',
255
+		_MI_NEWBB_SUBFORUM_COLLAPSE => 'collapse',
256
+		_MI_NEWBB_SUBFORUM_HIDDEN   => 'hidden'
257
+	],
258
+	'default'     => 'collapse'
259
+];
260
+$modversion['config'][] = [
261
+	'name'        => 'post_excerpt',
262
+	'title'       => '_MI_NEWBB_POST_EXCERPT',
263
+	'description' => '_MI_NEWBB_POST_EXCERPT_DESC',
264
+	'formtype'    => 'textbox',
265
+	'valuetype'   => 'int',
266
+	'default'     => 100
267
+];
268
+$modversion['config'][] = [
269
+	'name'        => 'topics_per_page',
270
+	'title'       => '_MI_NEWBB_TOPICSPERPAGE',
271
+	'description' => '_MI_NEWBB_TOPICSPERPAGE_DESC',
272
+	'formtype'    => 'textbox',
273
+	'valuetype'   => 'int',
274
+	'default'     => 20
275
+];
276
+$modversion['config'][] = [
277
+	'name'        => 'posts_per_page',
278
+	'title'       => '_MI_NEWBB_POSTSPERPAGE',
279
+	'description' => '_MI_NEWBB_POSTSPERPAGE_DESC',
280
+	'formtype'    => 'textbox',
281
+	'valuetype'   => 'int',
282
+	'default'     => 10
283
+];
284
+$modversion['config'][] = [
285
+	'name'        => 'pagenav_display',
286
+	'title'       => '_MI_NEWBB_PAGENAV_DISPLAY',
287
+	'description' => '_MI_NEWBB_PAGENAV_DISPLAY_DESC',
288
+	'formtype'    => 'select',
289
+	'valuetype'   => 'text',
290
+	'options'     => [
291
+		_MI_NEWBB_PAGENAV_NUMBER => 'number',
292
+		_MI_NEWBB_PAGENAV_IMAGE  => 'image',
293
+		_MI_NEWBB_PAGENAV_SELECT => 'select'
294
+	],
295
+	'default'     => 'number'
296
+];
297
+$modversion['config'][] = [
298
+	'name'        => 'cache_enabled',
299
+	'title'       => '_MI_NEWBB_CACHE_ENABLE',
300
+	'description' => '_MI_NEWBB_CACHE_ENABLE_DESC',
301
+	'formtype'    => 'yesno',
302
+	'valuetype'   => 'int',
303
+	'default'     => 0
304
+];
305
+$modversion['config'][] = [
306
+	'name'        => 'statistik_enabled',
307
+	'title'       => '_MI_NEWBB_STATISTIK_ENABLE',
308
+	'description' => '_MI_NEWBB_STATISTIK_ENABLE_DESC',
309
+	'formtype'    => 'yesno',
310
+	'valuetype'   => 'int',
311
+	'default'     => 1
312
+];
313
+$modversion['config'][] = [
314
+	'name'        => 'dir_attachments',
315
+	'title'       => '_MI_NEWBB_DIR_ATTACHMENT',
316
+	'description' => '_MI_NEWBB_DIR_ATTACHMENT_DESC',
317
+	'formtype'    => 'textbox',
318
+	'valuetype'   => 'text',
319
+	'default'     => 'uploads/newbb'
320
+];
321
+$modversion['config'][] = [
322
+	'name'        => 'media_allowed',
323
+	'title'       => '_MI_NEWBB_MEDIA_ENABLE',
324
+	'description' => '_MI_NEWBB_MEDIA_ENABLE_DESC',
325
+	'formtype'    => 'yesno',
326
+	'valuetype'   => 'int',
327
+	'default'     => 1
328
+];
329
+$modversion['config'][] = [
330
+	'name'        => 'path_magick',
331
+	'title'       => '_MI_NEWBB_PATH_MAGICK',
332
+	'description' => '_MI_NEWBB_PATH_MAGICK_DESC',
333
+	'formtype'    => 'textbox',
334
+	'valuetype'   => 'text',
335
+	'default'     => '/usr/bin/X11'
336
+];
337
+$modversion['config'][] = [
338
+	'name'        => 'path_netpbm',
339
+	'title'       => '_MI_NEWBB_PATH_NETPBM',
340
+	'description' => '_MI_NEWBB_PATH_NETPBM_DESC',
341
+	'formtype'    => 'textbox',
342
+	'valuetype'   => 'text',
343
+	'default'     => '/usr/bin'
344
+];
345
+$modversion['config'][] = [
346
+	'name'        => 'image_lib',
347
+	'title'       => '_MI_NEWBB_IMAGELIB',
348
+	'description' => '_MI_NEWBB_IMAGELIB_DESC',
349
+	'formtype'    => 'select',
350
+	'valuetype'   => 'int',
351
+	'default'     => 0,
352
+	'options'     => [
353
+		_MI_NEWBB_AUTO   => 0,
354
+		_MI_NEWBB_MAGICK => 1,
355
+		_MI_NEWBB_NETPBM => 2,
356
+		_MI_NEWBB_GD1    => 3,
357
+		_MI_NEWBB_GD2    => 4
358
+	]
359
+];
360
+$modversion['config'][] = [
361
+	'name'        => 'show_userattach',
362
+	'title'       => '_MI_NEWBB_USERATTACH_ENABLE',
363
+	'description' => '_MI_NEWBB_USERATTACH_ENABLE_DESC',
364
+	'formtype'    => 'yesno',
365
+	'valuetype'   => 'int',
366
+	'default'     => 1
367
+];
368
+$modversion['config'][] = [
369
+	'name'        => 'max_img_width',
370
+	'title'       => '_MI_NEWBB_MAX_IMG_WIDTH',
371
+	'description' => '_MI_NEWBB_MAX_IMG_WIDTH_DESC',
372
+	'formtype'    => 'textbox',
373
+	'valuetype'   => 'int',
374
+	'default'     => 800
375
+];
376
+$modversion['config'][] = [
377
+	'name'        => 'max_img_height',
378
+	'title'       => '_MI_NEWBB_MAX_IMG_HEIGHT',
379
+	'description' => '_MI_NEWBB_MAX_IMG_HEIGHT_DESC',
380
+	'formtype'    => 'textbox',
381
+	'valuetype'   => 'int',
382
+	'default'     => 640
383
+];
384
+$modversion['config'][] = [
385
+	'name'        => 'max_image_width',
386
+	'title'       => '_MI_NEWBB_MAX_IMAGE_WIDTH',
387
+	'description' => '_MI_NEWBB_MAX_IMAGE_WIDTH_DESC',
388
+	'formtype'    => 'textbox',
389
+	'valuetype'   => 'int',
390
+	'default'     => 150
391
+];
392
+$modversion['config'][] = [
393
+	'name'        => 'max_image_height',
394
+	'title'       => '_MI_NEWBB_MAX_IMAGE_HEIGHT',
395
+	'description' => '_MI_NEWBB_MAX_IMAGE_HEIGHT_DESC',
396
+	'formtype'    => 'textbox',
397
+	'valuetype'   => 'int',
398
+	'default'     => 150
399
+];
400
+$modversion['config'][] = [
401
+	'name'        => 'wol_enabled',
402
+	'title'       => '_MI_NEWBB_WOL_ENABLE',
403
+	'description' => '_MI_NEWBB_WOL_ENABLE_DESC',
404
+	'formtype'    => 'yesno',
405
+	'valuetype'   => 'int',
406
+	'default'     => 1
407
+];
408
+$modversion['config'][] = [
409
+	'name'        => 'user_level',
410
+	'title'       => '_MI_NEWBB_USERLEVEL',
411
+	'description' => '_MI_NEWBB_USERLEVEL_DESC',
412
+	'formtype'    => 'select',
413
+	'valuetype'   => 'int',
414
+	'default'     => 2,
415
+	'options'     => [
416
+		_MI_NEWBB_NULL    => 0,
417
+		_MI_NEWBB_TEXT    => 1,
418
+		_MI_NEWBB_GRAPHIC => 2
419
+	]
420
+];
421
+$modversion['config'][] = [
422
+	'name'        => 'show_realname',
423
+	'title'       => '_MI_NEWBB_SHOW_REALNAME',
424
+	'description' => '_MI_NEWBB_SHOW_REALNAME_DESC',
425
+	'formtype'    => 'yesno',
426
+	'valuetype'   => 'int',
427
+	'default'     => 0
428
+];
429
+$modversion['config'][] = [
430
+	'name'        => 'groupbar_enabled',
431
+	'title'       => '_MI_NEWBB_GROUPBAR_ENABLE',
432
+	'description' => '_MI_NEWBB_GROUPBAR_ENABLE_DESC',
433
+	'formtype'    => 'yesno',
434
+	'valuetype'   => 'int',
435
+	'default'     => 1
436
+];
437
+$modversion['config'][] = [
438
+	'name'        => 'rating_enabled',
439
+	'title'       => '_MI_NEWBB_RATING_ENABLE',
440
+	'description' => '_MI_NEWBB_RATING_ENABLE_DESC',
441
+	'formtype'    => 'yesno',
442
+	'valuetype'   => 'int',
443
+	'default'     => 0
444
+];
445
+$modversion['config'][] = [
446
+	'name'        => 'reportmod_enabled',
447
+	'title'       => '_MI_NEWBB_REPORTMOD_ENABLE',
448
+	'description' => '_MI_NEWBB_REPORTMOD_ENABLE_DESC',
449
+	'formtype'    => 'yesno',
450
+	'valuetype'   => 'int',
451
+	'default'     => 0
452
+];
453
+$modversion['config'][] = [
454
+	'name'        => 'quickreply_enabled',
455
+	'title'       => '_MI_NEWBB_QUICKREPLY_ENABLE',
456
+	'description' => '_MI_NEWBB_QUICKREPLY_ENABLE_DESC',
457
+	'formtype'    => 'yesno',
458
+	'valuetype'   => 'int',
459
+	'default'     => 1
460
+];
461
+$modversion['config'][] = [
462
+	'name'        => 'rss_enable',
463
+	'title'       => '_MI_NEWBB_RSS_ENABLE',
464
+	'description' => '_MI_NEWBB_RSS_ENABLE_DESC',
465
+	'formtype'    => 'yesno',
466
+	'valuetype'   => 'int',
467
+	'default'     => 1
468
+];
469
+$modversion['config'][] = [
470
+	'name'        => 'rss_maxitems',
471
+	'title'       => '_MI_NEWBB_RSS_MAX_ITEMS',
472
+	'description' => '',
473
+	'formtype'    => 'textbox',
474
+	'valuetype'   => 'int',
475
+	'default'     => 10
476
+];
477
+$modversion['config'][] = [
478
+	'name'        => 'rss_maxdescription',
479
+	'title'       => '_MI_NEWBB_RSS_MAX_DESCRIPTION',
480
+	'description' => '',
481
+	'formtype'    => 'textbox',
482
+	'valuetype'   => 'int',
483
+	'default'     => 0
484
+];
485
+$modversion['config'][] = [
486
+	'name'        => 'rss_cachetime',
487
+	'title'       => '_MI_NEWBB_RSS_CACHETIME',
488
+	'description' => '_MI_NEWBB_RSS_CACHETIME_DESCRIPTION',
489
+	'formtype'    => 'textbox',
490
+	'valuetype'   => 'int',
491
+	'default'     => 30
492 492
 ];
493 493
 // 4.05
494 494
 $modversion['config'][] = [
495
-    'name'        => 'show_infobox',
496
-    'title'       => '_MI_NEWBB_SHOW_INFOBOX',
497
-    'description' => '_MI_NEWBB_SHOW_INFOBOX_DESC',
498
-    'formtype'    => 'select',
499
-    'valuetype'   => 'int',
500
-    'default'     => 1,
501
-    'options'     => [
502
-        _MI_NEWBB_INFOBOX_NONE   => 0,
503
-        _MI_NEWBB_INFOBOX_HIDDEN => 1,
504
-        _MI_NEWBB_INFOBOX_SHOW   => 2
505
-    ]
506
-];
507
-$modversion['config'][] = [
508
-    'name'        => 'show_sociallinks',
509
-    'title'       => '_MI_NEWBB_SHOW_SOCIALLINKS',
510
-    'description' => '_MI_NEWBB_SHOW_SOCIALLINKS_DESC',
511
-    'formtype'    => 'yesno',
512
-    'valuetype'   => 'int',
513
-    'default'     => 1
514
-];
515
-$modversion['config'][] = [
516
-    'name'        => 'show_advertising',
517
-    'title'       => '_MI_NEWBB_ADVERTISING',
518
-    'description' => '_MI_NEWBB_ADVERTISING_DESC',
519
-    'formtype'    => 'yesno',
520
-    'valuetype'   => 'int',
521
-    'default'     => 0
522
-];
523
-$modversion['config'][] = [
524
-    'name'        => 'show_jump',
525
-    'title'       => '_MI_NEWBB_SHOW_JUMPBOX',
526
-    'description' => '_MI_NEWBB_SHOW_JUMPBOX_DESC',
527
-    'formtype'    => 'yesno',
528
-    'valuetype'   => 'int',
529
-    'default'     => 1
530
-];
531
-$modversion['config'][] = [
532
-    'name'        => 'show_permissiontable',
533
-    'title'       => '_MI_NEWBB_SHOW_PERMISSIONTABLE',
534
-    'description' => '_MI_NEWBB_SHOW_PERMISSIONTABLE_DESC',
535
-    'formtype'    => 'yesno',
536
-    'valuetype'   => 'int',
537
-    'default'     => 1
538
-];
539
-$modversion['config'][] = [
540
-    'name'        => 'email_digest',
541
-    'title'       => '_MI_NEWBB_EMAIL_DIGEST',
542
-    'description' => '_MI_NEWBB_EMAIL_DIGEST_DESC',
543
-    'formtype'    => 'select',
544
-    'valuetype'   => 'int',
545
-    'default'     => 0,
546
-    'options'     => [
547
-        _MI_NEWBB_EMAIL_NONE   => 0,
548
-        _MI_NEWBB_EMAIL_DAILY  => 1,
549
-        _MI_NEWBB_EMAIL_WEEKLY => 2
550
-    ]
551
-];
552
-$modversion['config'][] = [
553
-    'name'        => 'show_ip',
554
-    'title'       => '_MI_NEWBB_SHOW_IP',
555
-    'description' => '_MI_NEWBB_SHOW_IP_DESC',
556
-    'formtype'    => 'yesno',
557
-    'valuetype'   => 'int',
558
-    'default'     => 1
559
-];
560
-$modversion['config'][] = [
561
-    'name'        => 'enable_karma',
562
-    'title'       => '_MI_NEWBB_ENABLE_KARMA',
563
-    'description' => '_MI_NEWBB_ENABLE_KARMA_DESC',
564
-    'formtype'    => 'yesno',
565
-    'valuetype'   => 'int',
566
-    'default'     => 1
567
-];
568
-$modversion['config'][] = [
569
-    'name'        => 'karma_options',
570
-    'title'       => '_MI_NEWBB_KARMA_OPTIONS',
571
-    'description' => '_MI_NEWBB_KARMA_OPTIONS_DESC',
572
-    'formtype'    => 'textbox',
573
-    'valuetype'   => 'text',
574
-    'default'     => '0, 10, 50, 100, 500, 1000, 5000, 10000'
495
+	'name'        => 'show_infobox',
496
+	'title'       => '_MI_NEWBB_SHOW_INFOBOX',
497
+	'description' => '_MI_NEWBB_SHOW_INFOBOX_DESC',
498
+	'formtype'    => 'select',
499
+	'valuetype'   => 'int',
500
+	'default'     => 1,
501
+	'options'     => [
502
+		_MI_NEWBB_INFOBOX_NONE   => 0,
503
+		_MI_NEWBB_INFOBOX_HIDDEN => 1,
504
+		_MI_NEWBB_INFOBOX_SHOW   => 2
505
+	]
506
+];
507
+$modversion['config'][] = [
508
+	'name'        => 'show_sociallinks',
509
+	'title'       => '_MI_NEWBB_SHOW_SOCIALLINKS',
510
+	'description' => '_MI_NEWBB_SHOW_SOCIALLINKS_DESC',
511
+	'formtype'    => 'yesno',
512
+	'valuetype'   => 'int',
513
+	'default'     => 1
514
+];
515
+$modversion['config'][] = [
516
+	'name'        => 'show_advertising',
517
+	'title'       => '_MI_NEWBB_ADVERTISING',
518
+	'description' => '_MI_NEWBB_ADVERTISING_DESC',
519
+	'formtype'    => 'yesno',
520
+	'valuetype'   => 'int',
521
+	'default'     => 0
522
+];
523
+$modversion['config'][] = [
524
+	'name'        => 'show_jump',
525
+	'title'       => '_MI_NEWBB_SHOW_JUMPBOX',
526
+	'description' => '_MI_NEWBB_SHOW_JUMPBOX_DESC',
527
+	'formtype'    => 'yesno',
528
+	'valuetype'   => 'int',
529
+	'default'     => 1
530
+];
531
+$modversion['config'][] = [
532
+	'name'        => 'show_permissiontable',
533
+	'title'       => '_MI_NEWBB_SHOW_PERMISSIONTABLE',
534
+	'description' => '_MI_NEWBB_SHOW_PERMISSIONTABLE_DESC',
535
+	'formtype'    => 'yesno',
536
+	'valuetype'   => 'int',
537
+	'default'     => 1
538
+];
539
+$modversion['config'][] = [
540
+	'name'        => 'email_digest',
541
+	'title'       => '_MI_NEWBB_EMAIL_DIGEST',
542
+	'description' => '_MI_NEWBB_EMAIL_DIGEST_DESC',
543
+	'formtype'    => 'select',
544
+	'valuetype'   => 'int',
545
+	'default'     => 0,
546
+	'options'     => [
547
+		_MI_NEWBB_EMAIL_NONE   => 0,
548
+		_MI_NEWBB_EMAIL_DAILY  => 1,
549
+		_MI_NEWBB_EMAIL_WEEKLY => 2
550
+	]
551
+];
552
+$modversion['config'][] = [
553
+	'name'        => 'show_ip',
554
+	'title'       => '_MI_NEWBB_SHOW_IP',
555
+	'description' => '_MI_NEWBB_SHOW_IP_DESC',
556
+	'formtype'    => 'yesno',
557
+	'valuetype'   => 'int',
558
+	'default'     => 1
559
+];
560
+$modversion['config'][] = [
561
+	'name'        => 'enable_karma',
562
+	'title'       => '_MI_NEWBB_ENABLE_KARMA',
563
+	'description' => '_MI_NEWBB_ENABLE_KARMA_DESC',
564
+	'formtype'    => 'yesno',
565
+	'valuetype'   => 'int',
566
+	'default'     => 1
567
+];
568
+$modversion['config'][] = [
569
+	'name'        => 'karma_options',
570
+	'title'       => '_MI_NEWBB_KARMA_OPTIONS',
571
+	'description' => '_MI_NEWBB_KARMA_OPTIONS_DESC',
572
+	'formtype'    => 'textbox',
573
+	'valuetype'   => 'text',
574
+	'default'     => '0, 10, 50, 100, 500, 1000, 5000, 10000'
575 575
 ];
576 576
 // irmtfan - add 365 = one year
577 577
 $modversion['config'][] = [
578
-    'name'        => 'since_options',
579
-    'title'       => '_MI_NEWBB_SINCE_OPTIONS',
580
-    'description' => '_MI_NEWBB_SINCE_OPTIONS_DESC',
581
-    'formtype'    => 'textbox',
582
-    'valuetype'   => 'text',
583
-    'default'     => '-1, -2, -6, -12, 0, 1, 2, 5, 10, 20, 30, 60, 100, 365'
584
-];
585
-$modversion['config'][] = [
586
-    'name'        => 'since_default',
587
-    'title'       => '_MI_NEWBB_SINCE_DEFAULT',
588
-    'description' => '_MI_NEWBB_SINCE_DEFAULT_DESC',
589
-    'formtype'    => 'textbox',
590
-    'valuetype'   => 'int',
591
-    'default'     => 0
592
-];
593
-$modversion['config'][] = [
594
-    'name'        => 'allow_user_anonymous',
595
-    'title'       => '_MI_NEWBB_USER_ANONYMOUS',
596
-    'description' => '_MI_NEWBB_USER_ANONYMOUS_DESC',
597
-    'formtype'    => 'yesno',
598
-    'valuetype'   => 'int',
599
-    'default'     => 0
600
-];
601
-$modversion['config'][] = [
602
-    'name'        => 'anonymous_prefix',
603
-    'title'       => '_MI_NEWBB_ANONYMOUS_PRE',
604
-    'description' => '_MI_NEWBB_ANONYMOUS_PRE_DESC',
605
-    'formtype'    => 'textbox',
606
-    'valuetype'   => 'text',
607
-    'default'     => $GLOBALS['xoopsConfig']['anonymous'] . '-'
608
-];
609
-$modversion['config'][] = [
610
-    'name'        => 'allow_require_reply',
611
-    'title'       => '_MI_NEWBB_REQUIRE_REPLY',
612
-    'description' => '_MI_NEWBB_REQUIRE_REPLY_DESC',
613
-    'formtype'    => 'yesno',
614
-    'valuetype'   => 'int',
615
-    'default'     => 0
616
-];
617
-$modversion['config'][] = [
618
-    'name'        => 'edit_timelimit',
619
-    'title'       => '_MI_NEWBB_EDIT_TIMELIMIT',
620
-    'description' => '_MI_NEWBB_EDIT_TIMELIMIT_DESC',
621
-    'formtype'    => 'textbox',
622
-    'valuetype'   => 'int',
623
-    'default'     => 60
624
-];
625
-$modversion['config'][] = [
626
-    'name'        => 'recordedit_timelimit',
627
-    'title'       => '_MI_RECORDEDIT_TIMELIMIT',
628
-    'description' => '_MI_RECORDEDIT_TIMELIMIT_DESC',
629
-    'formtype'    => 'textbox',
630
-    'valuetype'   => 'int',
631
-    'default'     => 15
632
-];
633
-$modversion['config'][] = [
634
-    'name'        => 'delete_timelimit',
635
-    'title'       => '_MI_NEWBB_DELETE_TIMELIMIT',
636
-    'description' => '_MI_NEWBB_DELETE_TIMELIMIT_DESC',
637
-    'formtype'    => 'textbox',
638
-    'valuetype'   => 'int',
639
-    'default'     => 60
640
-];
641
-$modversion['config'][] = [
642
-    'name'        => 'post_timelimit',
643
-    'title'       => '_MI_NEWBB_POST_TIMELIMIT',
644
-    'description' => '_MI_NEWBB_POST_TIMELIMIT_DESC',
645
-    'formtype'    => 'textbox',
646
-    'valuetype'   => 'int',
647
-    'default'     => 30
648
-];
649
-$modversion['config'][] = [
650
-    'name'        => 'enable_permcheck',
651
-    'title'       => '_MI_NEWBB_PERMCHECK_ONDISPLAY',
652
-    'description' => '_MI_NEWBB_PERMCHECK_ONDISPLAY_DESC',
653
-    'formtype'    => 'yesno',
654
-    'valuetype'   => 'int',
655
-    'default'     => 1
656
-];
657
-$modversion['config'][] = [
658
-    'name'        => 'enable_usermoderate',
659
-    'title'       => '_MI_NEWBB_USERMODERATE',
660
-    'description' => '_MI_NEWBB_USERMODERATE_DESC',
661
-    'formtype'    => 'yesno',
662
-    'valuetype'   => 'int',
663
-    'default'     => 0
664
-];
665
-$modversion['config'][] = [
666
-    'name'        => 'disc_show',
667
-    'title'       => '_MI_NEWBB_SHOW_DIS',
668
-    'description' => '',
669
-    'formtype'    => 'select',
670
-    'valuetype'   => 'int',
671
-    'default'     => 0,
672
-    'options'     => [
673
-        _MI_NEWBB_NONE    => 0,
674
-        _MI_NEWBB_POST    => 1,
675
-        _MI_NEWBB_REPLY   => 2,
676
-        _MI_NEWBB_OP_BOTH => 3
677
-    ]
678
-];
679
-$modversion['config'][] = [
680
-    'name'        => 'disclaimer',
681
-    'title'       => '_MI_NEWBB_DISCLAIMER',
682
-    'description' => '_MI_NEWBB_DISCLAIMER_DESC',
683
-    'formtype'    => 'textarea',
684
-    'valuetype'   => 'text',
685
-    'default'     => _MI_NEWBB_DISCLAIMER_TEXT
686
-];
687
-$modversion['config'][] = [
688
-    'name'        => 'welcome_forum',
689
-    'title'       => '_MI_NEWBB_WELCOMEFORUM',
690
-    'description' => '_MI_NEWBB_WELCOMEFORUM_DESC',
691
-    'formtype'    => 'textbox',
692
-    'valuetype'   => 'int',
693
-    'default'     => 0,
694
-    //    'options'     => $forum_options
695
-];
696
-$modversion['config'][] = [
697
-    'name'        => 'welcome_forum_message',
698
-    'title'       => '_MI_NEWBB_WELCOMEFORUM_MESSAGE',
699
-    'description' => '_MI_NEWBB_WELCOMEFORUM_MESSAGE_DESC',
700
-    'formtype'    => 'textarea',
701
-    'valuetype'   => 'text',
702
-    'default'     => _MI_NEWBB_WELCOMEFORUM_DESC_MESSAGE
703
-];
704
-$modversion['config'][] = [
705
-    'name'        => 'poll_module',
706
-    'title'       => '_MI_NEWBB_POLL_MODULE',
707
-    'description' => '_MI_NEWBB_POLL_MODULE_DESC',
708
-    'valuetype'   => 'text',
709
-    'formtype'    => 'textbox',
710
-    'default'     => 'xoopspoll',
711
-];
712
-$modversion['config'][] = [
713
-    'name'        => 'forum_desc_length',
714
-    'title'       => '_MI_NEWBB_FORUM_DESC_LENGTH',
715
-    'description' => '_MI_NEWBB_FORUM_DESC_LENGTH_DESC',
716
-    'formtype'    => 'textbox',
717
-    'valuetype'   => 'int',
718
-    'default'     => 440
578
+	'name'        => 'since_options',
579
+	'title'       => '_MI_NEWBB_SINCE_OPTIONS',
580
+	'description' => '_MI_NEWBB_SINCE_OPTIONS_DESC',
581
+	'formtype'    => 'textbox',
582
+	'valuetype'   => 'text',
583
+	'default'     => '-1, -2, -6, -12, 0, 1, 2, 5, 10, 20, 30, 60, 100, 365'
584
+];
585
+$modversion['config'][] = [
586
+	'name'        => 'since_default',
587
+	'title'       => '_MI_NEWBB_SINCE_DEFAULT',
588
+	'description' => '_MI_NEWBB_SINCE_DEFAULT_DESC',
589
+	'formtype'    => 'textbox',
590
+	'valuetype'   => 'int',
591
+	'default'     => 0
592
+];
593
+$modversion['config'][] = [
594
+	'name'        => 'allow_user_anonymous',
595
+	'title'       => '_MI_NEWBB_USER_ANONYMOUS',
596
+	'description' => '_MI_NEWBB_USER_ANONYMOUS_DESC',
597
+	'formtype'    => 'yesno',
598
+	'valuetype'   => 'int',
599
+	'default'     => 0
600
+];
601
+$modversion['config'][] = [
602
+	'name'        => 'anonymous_prefix',
603
+	'title'       => '_MI_NEWBB_ANONYMOUS_PRE',
604
+	'description' => '_MI_NEWBB_ANONYMOUS_PRE_DESC',
605
+	'formtype'    => 'textbox',
606
+	'valuetype'   => 'text',
607
+	'default'     => $GLOBALS['xoopsConfig']['anonymous'] . '-'
608
+];
609
+$modversion['config'][] = [
610
+	'name'        => 'allow_require_reply',
611
+	'title'       => '_MI_NEWBB_REQUIRE_REPLY',
612
+	'description' => '_MI_NEWBB_REQUIRE_REPLY_DESC',
613
+	'formtype'    => 'yesno',
614
+	'valuetype'   => 'int',
615
+	'default'     => 0
616
+];
617
+$modversion['config'][] = [
618
+	'name'        => 'edit_timelimit',
619
+	'title'       => '_MI_NEWBB_EDIT_TIMELIMIT',
620
+	'description' => '_MI_NEWBB_EDIT_TIMELIMIT_DESC',
621
+	'formtype'    => 'textbox',
622
+	'valuetype'   => 'int',
623
+	'default'     => 60
624
+];
625
+$modversion['config'][] = [
626
+	'name'        => 'recordedit_timelimit',
627
+	'title'       => '_MI_RECORDEDIT_TIMELIMIT',
628
+	'description' => '_MI_RECORDEDIT_TIMELIMIT_DESC',
629
+	'formtype'    => 'textbox',
630
+	'valuetype'   => 'int',
631
+	'default'     => 15
632
+];
633
+$modversion['config'][] = [
634
+	'name'        => 'delete_timelimit',
635
+	'title'       => '_MI_NEWBB_DELETE_TIMELIMIT',
636
+	'description' => '_MI_NEWBB_DELETE_TIMELIMIT_DESC',
637
+	'formtype'    => 'textbox',
638
+	'valuetype'   => 'int',
639
+	'default'     => 60
640
+];
641
+$modversion['config'][] = [
642
+	'name'        => 'post_timelimit',
643
+	'title'       => '_MI_NEWBB_POST_TIMELIMIT',
644
+	'description' => '_MI_NEWBB_POST_TIMELIMIT_DESC',
645
+	'formtype'    => 'textbox',
646
+	'valuetype'   => 'int',
647
+	'default'     => 30
648
+];
649
+$modversion['config'][] = [
650
+	'name'        => 'enable_permcheck',
651
+	'title'       => '_MI_NEWBB_PERMCHECK_ONDISPLAY',
652
+	'description' => '_MI_NEWBB_PERMCHECK_ONDISPLAY_DESC',
653
+	'formtype'    => 'yesno',
654
+	'valuetype'   => 'int',
655
+	'default'     => 1
656
+];
657
+$modversion['config'][] = [
658
+	'name'        => 'enable_usermoderate',
659
+	'title'       => '_MI_NEWBB_USERMODERATE',
660
+	'description' => '_MI_NEWBB_USERMODERATE_DESC',
661
+	'formtype'    => 'yesno',
662
+	'valuetype'   => 'int',
663
+	'default'     => 0
664
+];
665
+$modversion['config'][] = [
666
+	'name'        => 'disc_show',
667
+	'title'       => '_MI_NEWBB_SHOW_DIS',
668
+	'description' => '',
669
+	'formtype'    => 'select',
670
+	'valuetype'   => 'int',
671
+	'default'     => 0,
672
+	'options'     => [
673
+		_MI_NEWBB_NONE    => 0,
674
+		_MI_NEWBB_POST    => 1,
675
+		_MI_NEWBB_REPLY   => 2,
676
+		_MI_NEWBB_OP_BOTH => 3
677
+	]
678
+];
679
+$modversion['config'][] = [
680
+	'name'        => 'disclaimer',
681
+	'title'       => '_MI_NEWBB_DISCLAIMER',
682
+	'description' => '_MI_NEWBB_DISCLAIMER_DESC',
683
+	'formtype'    => 'textarea',
684
+	'valuetype'   => 'text',
685
+	'default'     => _MI_NEWBB_DISCLAIMER_TEXT
686
+];
687
+$modversion['config'][] = [
688
+	'name'        => 'welcome_forum',
689
+	'title'       => '_MI_NEWBB_WELCOMEFORUM',
690
+	'description' => '_MI_NEWBB_WELCOMEFORUM_DESC',
691
+	'formtype'    => 'textbox',
692
+	'valuetype'   => 'int',
693
+	'default'     => 0,
694
+	//    'options'     => $forum_options
695
+];
696
+$modversion['config'][] = [
697
+	'name'        => 'welcome_forum_message',
698
+	'title'       => '_MI_NEWBB_WELCOMEFORUM_MESSAGE',
699
+	'description' => '_MI_NEWBB_WELCOMEFORUM_MESSAGE_DESC',
700
+	'formtype'    => 'textarea',
701
+	'valuetype'   => 'text',
702
+	'default'     => _MI_NEWBB_WELCOMEFORUM_DESC_MESSAGE
703
+];
704
+$modversion['config'][] = [
705
+	'name'        => 'poll_module',
706
+	'title'       => '_MI_NEWBB_POLL_MODULE',
707
+	'description' => '_MI_NEWBB_POLL_MODULE_DESC',
708
+	'valuetype'   => 'text',
709
+	'formtype'    => 'textbox',
710
+	'default'     => 'xoopspoll',
711
+];
712
+$modversion['config'][] = [
713
+	'name'        => 'forum_desc_length',
714
+	'title'       => '_MI_NEWBB_FORUM_DESC_LENGTH',
715
+	'description' => '_MI_NEWBB_FORUM_DESC_LENGTH_DESC',
716
+	'formtype'    => 'textbox',
717
+	'valuetype'   => 'int',
718
+	'default'     => 440
719 719
 ];
720 720
 
721 721
 // Notification
@@ -724,98 +724,98 @@  discard block
 block discarded – undo
724 724
 $modversion['notification']['lookup_file'] = 'include/notification.inc.php';
725 725
 $modversion['notification']['lookup_func'] = 'newbb_notify_iteminfo';
726 726
 $modversion['notification']['category'][]  = [
727
-    'name'           => 'thread',
728
-    'title'          => _MI_NEWBB_THREAD_NOTIFY,
729
-    'description'    => _MI_NEWBB_THREAD_NOTIFYDSC,
730
-    'subscribe_from' => 'viewtopic.php',
731
-    'item_name'      => 'topic_id',
732
-    'allow_bookmark' => 1,
727
+	'name'           => 'thread',
728
+	'title'          => _MI_NEWBB_THREAD_NOTIFY,
729
+	'description'    => _MI_NEWBB_THREAD_NOTIFYDSC,
730
+	'subscribe_from' => 'viewtopic.php',
731
+	'item_name'      => 'topic_id',
732
+	'allow_bookmark' => 1,
733 733
 ];
734 734
 $modversion['notification']['category'][]  = [
735
-    'name'           => 'forum',
736
-    'title'          => _MI_NEWBB_FORUM_NOTIFY,
737
-    'description'    => _MI_NEWBB_FORUM_NOTIFYDSC,
738
-    'subscribe_from' => 'viewforum.php',
739
-    'item_name'      => 'forum',
740
-    'allow_bookmark' => 1,
735
+	'name'           => 'forum',
736
+	'title'          => _MI_NEWBB_FORUM_NOTIFY,
737
+	'description'    => _MI_NEWBB_FORUM_NOTIFYDSC,
738
+	'subscribe_from' => 'viewforum.php',
739
+	'item_name'      => 'forum',
740
+	'allow_bookmark' => 1,
741 741
 ];
742 742
 $modversion['notification']['category'][]  = [
743
-    'name'           => 'global',
744
-    'title'          => _MI_NEWBB_GLOBAL_NOTIFY,
745
-    'description'    => _MI_NEWBB_GLOBAL_NOTIFYDSC,
746
-    'subscribe_from' => 'index.php',
743
+	'name'           => 'global',
744
+	'title'          => _MI_NEWBB_GLOBAL_NOTIFY,
745
+	'description'    => _MI_NEWBB_GLOBAL_NOTIFYDSC,
746
+	'subscribe_from' => 'index.php',
747 747
 ];
748 748
 $modversion['notification']['event'][]     = [
749
-    'name'          => 'new_post',
750
-    'category'      => 'thread',
751
-    'title'         => _MI_NEWBB_THREAD_NEWPOST_NOTIFY,
752
-    'caption'       => _MI_NEWBB_THREAD_NEWPOST_NOTIFYCAP,
753
-    'description'   => _MI_NEWBB_THREAD_NEWPOST_NOTIFYDSC,
754
-    'mail_template' => 'thread_newpost_notify',
755
-    'mail_subject'  => _MI_NEWBB_THREAD_NEWPOST_NOTIFYSBJ,
749
+	'name'          => 'new_post',
750
+	'category'      => 'thread',
751
+	'title'         => _MI_NEWBB_THREAD_NEWPOST_NOTIFY,
752
+	'caption'       => _MI_NEWBB_THREAD_NEWPOST_NOTIFYCAP,
753
+	'description'   => _MI_NEWBB_THREAD_NEWPOST_NOTIFYDSC,
754
+	'mail_template' => 'thread_newpost_notify',
755
+	'mail_subject'  => _MI_NEWBB_THREAD_NEWPOST_NOTIFYSBJ,
756 756
 ];
757 757
 $modversion['notification']['event'][]     = [
758
-    'name'          => 'new_thread',
759
-    'category'      => 'forum',
760
-    'title'         => _MI_NEWBB_FORUM_NEWTHREAD_NOTIFY,
761
-    'caption'       => _MI_NEWBB_FORUM_NEWTHREAD_NOTIFYCAP,
762
-    'description'   => _MI_NEWBB_FORUM_NEWTHREAD_NOTIFYDSC,
763
-    'mail_template' => 'forum_newthread_notify',
764
-    'mail_subject'  => _MI_NEWBB_FORUM_NEWTHREAD_NOTIFYSBJ,
758
+	'name'          => 'new_thread',
759
+	'category'      => 'forum',
760
+	'title'         => _MI_NEWBB_FORUM_NEWTHREAD_NOTIFY,
761
+	'caption'       => _MI_NEWBB_FORUM_NEWTHREAD_NOTIFYCAP,
762
+	'description'   => _MI_NEWBB_FORUM_NEWTHREAD_NOTIFYDSC,
763
+	'mail_template' => 'forum_newthread_notify',
764
+	'mail_subject'  => _MI_NEWBB_FORUM_NEWTHREAD_NOTIFYSBJ,
765 765
 ];
766 766
 $modversion['notification']['event'][]     = [
767
-    'name'          => 'new_forum',
768
-    'category'      => 'global',
769
-    'title'         => _MI_NEWBB_GLOBAL_NEWFORUM_NOTIFY,
770
-    'caption'       => _MI_NEWBB_GLOBAL_NEWFORUM_NOTIFYCAP,
771
-    'description'   => _MI_NEWBB_GLOBAL_NEWFORUM_NOTIFYDSC,
772
-    'mail_template' => 'global_newforum_notify',
773
-    'mail_subject'  => _MI_NEWBB_GLOBAL_NEWFORUM_NOTIFYSBJ,
767
+	'name'          => 'new_forum',
768
+	'category'      => 'global',
769
+	'title'         => _MI_NEWBB_GLOBAL_NEWFORUM_NOTIFY,
770
+	'caption'       => _MI_NEWBB_GLOBAL_NEWFORUM_NOTIFYCAP,
771
+	'description'   => _MI_NEWBB_GLOBAL_NEWFORUM_NOTIFYDSC,
772
+	'mail_template' => 'global_newforum_notify',
773
+	'mail_subject'  => _MI_NEWBB_GLOBAL_NEWFORUM_NOTIFYSBJ,
774 774
 ];
775 775
 $modversion['notification']['event'][]     = [
776
-    'name'          => 'new_post',
777
-    'category'      => 'global',
778
-    'title'         => _MI_NEWBB_GLOBAL_NEWPOST_NOTIFY,
779
-    'caption'       => _MI_NEWBB_GLOBAL_NEWPOST_NOTIFYCAP,
780
-    'description'   => _MI_NEWBB_GLOBAL_NEWPOST_NOTIFYDSC,
781
-    'mail_template' => 'global_newpost_notify',
782
-    'mail_subject'  => _MI_NEWBB_GLOBAL_NEWPOST_NOTIFYSBJ,
776
+	'name'          => 'new_post',
777
+	'category'      => 'global',
778
+	'title'         => _MI_NEWBB_GLOBAL_NEWPOST_NOTIFY,
779
+	'caption'       => _MI_NEWBB_GLOBAL_NEWPOST_NOTIFYCAP,
780
+	'description'   => _MI_NEWBB_GLOBAL_NEWPOST_NOTIFYDSC,
781
+	'mail_template' => 'global_newpost_notify',
782
+	'mail_subject'  => _MI_NEWBB_GLOBAL_NEWPOST_NOTIFYSBJ,
783 783
 ];
784 784
 $modversion['notification']['event'][]     = [
785
-    'name'          => 'new_post',
786
-    'category'      => 'forum',
787
-    'title'         => _MI_NEWBB_FORUM_NEWPOST_NOTIFY,
788
-    'caption'       => _MI_NEWBB_FORUM_NEWPOST_NOTIFYCAP,
789
-    'description'   => _MI_NEWBB_FORUM_NEWPOST_NOTIFYDSC,
790
-    'mail_template' => 'forum_newpost_notify',
791
-    'mail_subject'  => _MI_NEWBB_FORUM_NEWPOST_NOTIFYSBJ,
785
+	'name'          => 'new_post',
786
+	'category'      => 'forum',
787
+	'title'         => _MI_NEWBB_FORUM_NEWPOST_NOTIFY,
788
+	'caption'       => _MI_NEWBB_FORUM_NEWPOST_NOTIFYCAP,
789
+	'description'   => _MI_NEWBB_FORUM_NEWPOST_NOTIFYDSC,
790
+	'mail_template' => 'forum_newpost_notify',
791
+	'mail_subject'  => _MI_NEWBB_FORUM_NEWPOST_NOTIFYSBJ,
792 792
 ];
793 793
 $modversion['notification']['event'][]     = [
794
-    'name'          => 'new_fullpost',
795
-    'category'      => 'global',
796
-    'admin_only'    => 1,
797
-    'title'         => _MI_NEWBB_GLOBAL_NEWFULLPOST_NOTIFY,
798
-    'caption'       => _MI_NEWBB_GLOBAL_NEWFULLPOST_NOTIFYCAP,
799
-    'description'   => _MI_NEWBB_GLOBAL_NEWFULLPOST_NOTIFYDSC,
800
-    'mail_template' => 'global_newfullpost_notify',
801
-    'mail_subject'  => _MI_NEWBB_GLOBAL_NEWFULLPOST_NOTIFYSBJ,
794
+	'name'          => 'new_fullpost',
795
+	'category'      => 'global',
796
+	'admin_only'    => 1,
797
+	'title'         => _MI_NEWBB_GLOBAL_NEWFULLPOST_NOTIFY,
798
+	'caption'       => _MI_NEWBB_GLOBAL_NEWFULLPOST_NOTIFYCAP,
799
+	'description'   => _MI_NEWBB_GLOBAL_NEWFULLPOST_NOTIFYDSC,
800
+	'mail_template' => 'global_newfullpost_notify',
801
+	'mail_subject'  => _MI_NEWBB_GLOBAL_NEWFULLPOST_NOTIFYSBJ,
802 802
 ];
803 803
 $modversion['notification']['event'][]     = [
804
-    'name'          => 'digest',
805
-    'category'      => 'global',
806
-    'title'         => _MI_NEWBB_GLOBAL_DIGEST_NOTIFY,
807
-    'caption'       => _MI_NEWBB_GLOBAL_DIGEST_NOTIFYCAP,
808
-    'description'   => _MI_NEWBB_GLOBAL_DIGEST_NOTIFYDSC,
809
-    'mail_template' => 'global_digest_notify',
810
-    'mail_subject'  => _MI_NEWBB_GLOBAL_DIGEST_NOTIFYSBJ,
804
+	'name'          => 'digest',
805
+	'category'      => 'global',
806
+	'title'         => _MI_NEWBB_GLOBAL_DIGEST_NOTIFY,
807
+	'caption'       => _MI_NEWBB_GLOBAL_DIGEST_NOTIFYCAP,
808
+	'description'   => _MI_NEWBB_GLOBAL_DIGEST_NOTIFYDSC,
809
+	'mail_template' => 'global_digest_notify',
810
+	'mail_subject'  => _MI_NEWBB_GLOBAL_DIGEST_NOTIFYSBJ,
811 811
 ];
812 812
 $modversion['notification']['event'][]     = [
813
-    'name'          => 'new_fullpost',
814
-    'category'      => 'forum',
815
-    'admin_only'    => 1,
816
-    'title'         => _MI_NEWBB_GLOBAL_NEWFULLPOST_NOTIFY,
817
-    'caption'       => _MI_NEWBB_GLOBAL_NEWFULLPOST_NOTIFYCAP,
818
-    'description'   => _MI_NEWBB_GLOBAL_NEWFULLPOST_NOTIFYDSC,
819
-    'mail_template' => 'global_newfullpost_notify',
820
-    'mail_subject'  => _MI_NEWBB_GLOBAL_NEWFULLPOST_NOTIFYSBJ,
813
+	'name'          => 'new_fullpost',
814
+	'category'      => 'forum',
815
+	'admin_only'    => 1,
816
+	'title'         => _MI_NEWBB_GLOBAL_NEWFULLPOST_NOTIFY,
817
+	'caption'       => _MI_NEWBB_GLOBAL_NEWFULLPOST_NOTIFYCAP,
818
+	'description'   => _MI_NEWBB_GLOBAL_NEWFULLPOST_NOTIFYDSC,
819
+	'mail_template' => 'global_newfullpost_notify',
820
+	'mail_subject'  => _MI_NEWBB_GLOBAL_NEWFULLPOST_NOTIFYSBJ,
821 821
 ];
Please login to merge, or discard this patch.
index.php 1 patch
Indentation   +130 added lines, -130 removed lines patch added patch discarded remove patch
@@ -16,17 +16,17 @@  discard block
 block discarded – undo
16 16
 
17 17
 /* deal with marks */
18 18
 if (Request::getInt('mark_read', 0)) {
19
-    if (1 === Request::getInt('mark_read', 0)) { // marked as read
20
-        $markvalue  = 1;
21
-        $markresult = _MD_NEWBB_MARK_READ;
22
-    } else { // marked as unread
23
-        $markvalue  = 0;
24
-        $markresult = _MD_NEWBB_MARK_UNREAD;
25
-    }
26
-    require_once __DIR__ . '/include/functions.read.php';
27
-    newbbSetReadForum($markvalue);
28
-    $url = XOOPS_URL . '/modules/newbb/index.php';
29
-    redirect_header($url, 2, _MD_NEWBB_ALL_FORUM_MARKED . ' ' . $markresult);
19
+	if (1 === Request::getInt('mark_read', 0)) { // marked as read
20
+		$markvalue  = 1;
21
+		$markresult = _MD_NEWBB_MARK_READ;
22
+	} else { // marked as unread
23
+		$markvalue  = 0;
24
+		$markresult = _MD_NEWBB_MARK_UNREAD;
25
+	}
26
+	require_once __DIR__ . '/include/functions.read.php';
27
+	newbbSetReadForum($markvalue);
28
+	$url = XOOPS_URL . '/modules/newbb/index.php';
29
+	redirect_header($url, 2, _MD_NEWBB_ALL_FORUM_MARKED . ' ' . $markresult);
30 30
 }
31 31
 
32 32
 $viewcat = Request::getInt('cat', 0, 'GET');//TODO mb check if this is GET or POST?
@@ -35,20 +35,20 @@  discard block
 block discarded – undo
35 35
 
36 36
 $categories = [];
37 37
 if (!$viewcat) {
38
-    $categories        = $categoryHandler->getByPermission('access', null, false);
39
-    $forum_index_title = '';
40
-    $xoops_pagetitle   = $xoopsModule->getVar('name');
38
+	$categories        = $categoryHandler->getByPermission('access', null, false);
39
+	$forum_index_title = '';
40
+	$xoops_pagetitle   = $xoopsModule->getVar('name');
41 41
 } else {
42
-    $categoryObject = $categoryHandler->get($viewcat);
43
-    if ($categoryHandler->getPermission($categoryObject)) {
44
-        $categories[$viewcat] = $categoryObject->getValues();
45
-    }
46
-    $forum_index_title = sprintf(_MD_NEWBB_FORUMINDEX, htmlspecialchars($GLOBALS['xoopsConfig']['sitename'], ENT_QUOTES));
47
-    $xoops_pagetitle   = $categoryObject->getVar('cat_title') . ' [' . $xoopsModule->getVar('name') . ']';
42
+	$categoryObject = $categoryHandler->get($viewcat);
43
+	if ($categoryHandler->getPermission($categoryObject)) {
44
+		$categories[$viewcat] = $categoryObject->getValues();
45
+	}
46
+	$forum_index_title = sprintf(_MD_NEWBB_FORUMINDEX, htmlspecialchars($GLOBALS['xoopsConfig']['sitename'], ENT_QUOTES));
47
+	$xoops_pagetitle   = $categoryObject->getVar('cat_title') . ' [' . $xoopsModule->getVar('name') . ']';
48 48
 }
49 49
 
50 50
 if (0 === count($categories)) {
51
-    redirect_header(XOOPS_URL, 2, _MD_NEWBB_NORIGHTTOACCESS);
51
+	redirect_header(XOOPS_URL, 2, _MD_NEWBB_NORIGHTTOACCESS);
52 52
 }
53 53
 
54 54
 $xoopsOption['template_main']   = 'newbb_index.tpl';
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 /* rss feed */
62 62
 // irmtfan new method
63 63
 if (!empty($GLOBALS['xoopsModuleConfig']['rss_enable'])) {
64
-    $xoopsTpl->assign('xoops_module_header', '
64
+	$xoopsTpl->assign('xoops_module_header', '
65 65
     <link rel="alternate" type="application/xml+rss" title="' . $xoopsModule->getVar('name') . '" href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/rss.php" />
66 66
     ' . @$xoopsTpl->get_template_vars('xoops_module_header'));
67 67
 }
@@ -71,10 +71,10 @@  discard block
 block discarded – undo
71 71
 $xoopsTpl->assign('forum_index_title', $forum_index_title);
72 72
 //if ($GLOBALS['xoopsModuleConfig']['wol_enabled']) {
73 73
 if (!empty($GLOBALS['xoopsModuleConfig']['wol_enabled'])) {
74
-    //    /** @var Newbb\OnlineHandler $onlineHandler */
75
-    //    $onlineHandler = Newbb\Helper::getInstance()->getHandler('Online');
76
-    $onlineHandler->init();
77
-    $xoopsTpl->assign('online', $onlineHandler->showOnline());
74
+	//    /** @var Newbb\OnlineHandler $onlineHandler */
75
+	//    $onlineHandler = Newbb\Helper::getInstance()->getHandler('Online');
76
+	$onlineHandler->init();
77
+	$xoopsTpl->assign('online', $onlineHandler->showOnline());
78 78
 }
79 79
 /** @var Newbb\ForumHandler $forumHandler */
80 80
 $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum');
@@ -88,19 +88,19 @@  discard block
 block discarded – undo
88 88
 $forums_top = [];
89 89
 
90 90
 if (!empty($forums_allowed)) {
91
-    $crit_top = new \CriteriaCompo(new \Criteria('parent_forum', 0));
92
-    $crit_top->add(new \Criteria('cat_id', '(' . implode(', ', array_keys($categories)) . ')', 'IN'));
93
-    $crit_top->add(new \Criteria('forum_id', '(' . implode(', ', $forums_allowed) . ')', 'IN'));
94
-    $forums_top = $forumHandler->getIds($crit_top);
91
+	$crit_top = new \CriteriaCompo(new \Criteria('parent_forum', 0));
92
+	$crit_top->add(new \Criteria('cat_id', '(' . implode(', ', array_keys($categories)) . ')', 'IN'));
93
+	$crit_top->add(new \Criteria('forum_id', '(' . implode(', ', $forums_allowed) . ')', 'IN'));
94
+	$forums_top = $forumHandler->getIds($crit_top);
95 95
 }
96 96
 
97 97
 /* fetch subforums if required to display */
98 98
 if ('hidden' === $GLOBALS['xoopsModuleConfig']['subforum_display'] || 0 === count($forums_top)) {
99
-    $forums_sub = [];
99
+	$forums_sub = [];
100 100
 } else {
101
-    $crit_sub = new \CriteriaCompo(new \Criteria('parent_forum', '(' . implode(', ', $forums_top) . ')', 'IN'));
102
-    $crit_sub->add(new \Criteria('forum_id', '(' . implode(', ', $forums_allowed) . ')', 'IN'));
103
-    $forums_sub = $forumHandler->getIds($crit_sub);
101
+	$crit_sub = new \CriteriaCompo(new \Criteria('parent_forum', '(' . implode(', ', $forums_top) . ')', 'IN'));
102
+	$crit_sub->add(new \Criteria('forum_id', '(' . implode(', ', $forums_allowed) . ')', 'IN'));
103
+	$forums_sub = $forumHandler->getIds($crit_sub);
104 104
 }
105 105
 
106 106
 /* Fetch forum data */
@@ -111,32 +111,32 @@  discard block
 block discarded – undo
111 111
 $newposts         = 0;
112 112
 $deleteposts      = 0;
113 113
 if (0 !== count($forums_available)) {
114
-    $crit_forum = new \Criteria('forum_id', '(' . implode(', ', $forums_available) . ')', 'IN');
115
-    $crit_forum->setSort('cat_id ASC, parent_forum ASC, forum_order');
116
-    $crit_forum->setOrder('ASC');
117
-    $forums       = $forumHandler->getAll($crit_forum, null, false);
118
-    $newtopics    = $forumHandler->getTopicCount($forums, 0, 'pending');
119
-    $deletetopics = $forumHandler->getTopicCount($forums, 0, 'deleted');
120
-    $forums_array = $forumHandler->display($forums, $GLOBALS['xoopsModuleConfig']['length_title_index'], $GLOBALS['xoopsModuleConfig']['count_subforum']);
121
-    $crit         = new \CriteriaCompo(new \Criteria('forum_id', '(' . implode(', ', $forums_available) . ')', 'IN'));
122
-    $crit->add(new \Criteria('approved', '-1'));
123
-    $deleteposts = $postHandler->getCount($crit);
124
-    $crit        = new \CriteriaCompo(new \Criteria('forum_id', '(' . implode(', ', $forums_available) . ')', 'IN'));
125
-    $crit->add(new \Criteria('approved', '0'));
126
-    $newposts = $postHandler->getCount($crit);
114
+	$crit_forum = new \Criteria('forum_id', '(' . implode(', ', $forums_available) . ')', 'IN');
115
+	$crit_forum->setSort('cat_id ASC, parent_forum ASC, forum_order');
116
+	$crit_forum->setOrder('ASC');
117
+	$forums       = $forumHandler->getAll($crit_forum, null, false);
118
+	$newtopics    = $forumHandler->getTopicCount($forums, 0, 'pending');
119
+	$deletetopics = $forumHandler->getTopicCount($forums, 0, 'deleted');
120
+	$forums_array = $forumHandler->display($forums, $GLOBALS['xoopsModuleConfig']['length_title_index'], $GLOBALS['xoopsModuleConfig']['count_subforum']);
121
+	$crit         = new \CriteriaCompo(new \Criteria('forum_id', '(' . implode(', ', $forums_available) . ')', 'IN'));
122
+	$crit->add(new \Criteria('approved', '-1'));
123
+	$deleteposts = $postHandler->getCount($crit);
124
+	$crit        = new \CriteriaCompo(new \Criteria('forum_id', '(' . implode(', ', $forums_available) . ')', 'IN'));
125
+	$crit->add(new \Criteria('approved', '0'));
126
+	$newposts = $postHandler->getCount($crit);
127 127
 }
128 128
 
129 129
 if ($newtopics > 0) {
130
-    $xoopsTpl->assign('wait_new_topic', $newtopics);
130
+	$xoopsTpl->assign('wait_new_topic', $newtopics);
131 131
 }
132 132
 if ($deletetopics > 0) {
133
-    $xoopsTpl->assign('delete_topic', $deletetopics);
133
+	$xoopsTpl->assign('delete_topic', $deletetopics);
134 134
 }
135 135
 if ($newposts > 0) {
136
-    $xoopsTpl->assign('wait_new_post', $newposts);
136
+	$xoopsTpl->assign('wait_new_post', $newposts);
137 137
 }
138 138
 if ($deleteposts > 0) {
139
-    $xoopsTpl->assign('delete_post', $deleteposts);
139
+	$xoopsTpl->assign('delete_post', $deleteposts);
140 140
 }
141 141
 
142 142
 ///** @var Newbb\ReportHandler $reportHandler */
@@ -144,74 +144,74 @@  discard block
 block discarded – undo
144 144
 $reported = $reportHandler->getCount(new \Criteria('report_result', 0));
145 145
 $xoopsTpl->assign('reported_count', $reported);
146 146
 if ($reported > 0) {
147
-    $xoopsTpl->assign('report_post', sprintf(_MD_NEWBB_SEEWAITREPORT, $reported));
147
+	$xoopsTpl->assign('report_post', sprintf(_MD_NEWBB_SEEWAITREPORT, $reported));
148 148
 }
149 149
 
150 150
 if (count($forums_array) > 0) {
151
-    foreach ($forums_array[0] as $parent => $forum) {
152
-        if (isset($forums_array[$forum['forum_id']])) {
153
-            $forum['subforum'] = $forums_array[$forum['forum_id']];
154
-        }
155
-        $forumsByCat[$forum['forum_cid']][] = $forum;
156
-    }
151
+	foreach ($forums_array[0] as $parent => $forum) {
152
+		if (isset($forums_array[$forum['forum_id']])) {
153
+			$forum['subforum'] = $forums_array[$forum['forum_id']];
154
+		}
155
+		$forumsByCat[$forum['forum_cid']][] = $forum;
156
+	}
157 157
 }
158 158
 
159 159
 $category_array = [];
160 160
 $toggles        = newbbGetCookie('G', true);
161 161
 $iconHandler    = newbbGetIconHandler();
162 162
 $category_icon  = [
163
-    'expand'   => $iconHandler->getImageSource('minus'),
164
-    'collapse' => $iconHandler->getImageSource('plus')
163
+	'expand'   => $iconHandler->getImageSource('minus'),
164
+	'collapse' => $iconHandler->getImageSource('plus')
165 165
 ];
166 166
 
167 167
 foreach (array_keys($categories) as $id) {
168
-    $forums = [];
169
-    $onecat = $categories[$id];
168
+	$forums = [];
169
+	$onecat = $categories[$id];
170 170
 
171
-    $cat_element_id = 'cat_' . $onecat['cat_id'];
172
-    $expand         = (count($toggles) > 0) ? (in_array($cat_element_id, $toggles) ? false : true) : true;
173
-    // START irmtfan to improve newbbDisplayImage
174
-    if ($expand) {
175
-        $cat_display      = 'block';        //irmtfan move semicolon
176
-        $cat_icon_display = 'minus';
177
-        $cat_alt          = _MD_NEWBB_HIDE;
178
-    } else {
179
-        $cat_display      = 'none';        //irmtfan move semicolon
180
-        $cat_icon_display = 'plus';
181
-        $cat_alt          = _MD_NEWBB_SEE;
182
-    }
183
-    $cat_displayImage = newbbDisplayImage($cat_icon_display, $cat_alt);
171
+	$cat_element_id = 'cat_' . $onecat['cat_id'];
172
+	$expand         = (count($toggles) > 0) ? (in_array($cat_element_id, $toggles) ? false : true) : true;
173
+	// START irmtfan to improve newbbDisplayImage
174
+	if ($expand) {
175
+		$cat_display      = 'block';        //irmtfan move semicolon
176
+		$cat_icon_display = 'minus';
177
+		$cat_alt          = _MD_NEWBB_HIDE;
178
+	} else {
179
+		$cat_display      = 'none';        //irmtfan move semicolon
180
+		$cat_icon_display = 'plus';
181
+		$cat_alt          = _MD_NEWBB_SEE;
182
+	}
183
+	$cat_displayImage = newbbDisplayImage($cat_icon_display, $cat_alt);
184 184
 
185
-    if (isset($forumsByCat[$onecat['cat_id']])) {
186
-        $forums = $forumsByCat[$onecat['cat_id']];
187
-    }
185
+	if (isset($forumsByCat[$onecat['cat_id']])) {
186
+		$forums = $forumsByCat[$onecat['cat_id']];
187
+	}
188 188
 
189
-    $cat_sponsor = [];
190
-    @list($url, $title) = array_map('trim', explode(' ', $onecat['cat_url'], 2));
191
-    if ('' === $title) {
192
-        $title = $url;
193
-    }
194
-    $title = $myts->htmlSpecialChars($title);
195
-    if ('' !== $url) {
196
-        $cat_sponsor = ['title' => $title, 'link' => formatURL($url)];
197
-    }
198
-    //$cat_image = $onecat['cat_image'];
199
-    $cat_image = '';
200
-    $cat_image = $onecat['cat_image'];
201
-    if ('' !== $cat_image && 'blank.gif' !== $cat_image && $cat_image) {
202
-        $cat_image = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/assets/images/category/' . $cat_image;
203
-    }
204
-    $category_array[] = [
205
-        'cat_id'           => $onecat['cat_id'],
206
-        'cat_title'        => $myts->displayTarea($onecat['cat_title'], 1),
207
-        'cat_image'        => $cat_image,
208
-        'cat_sponsor'      => $cat_sponsor,
209
-        'cat_description'  => $myts->displayTarea($onecat['cat_description'], 1),
210
-        'cat_element_id'   => $cat_element_id,
211
-        'cat_display'      => $cat_display,
212
-        'cat_displayImage' => $cat_displayImage,
213
-        'forums'           => $forums
214
-    ];
189
+	$cat_sponsor = [];
190
+	@list($url, $title) = array_map('trim', explode(' ', $onecat['cat_url'], 2));
191
+	if ('' === $title) {
192
+		$title = $url;
193
+	}
194
+	$title = $myts->htmlSpecialChars($title);
195
+	if ('' !== $url) {
196
+		$cat_sponsor = ['title' => $title, 'link' => formatURL($url)];
197
+	}
198
+	//$cat_image = $onecat['cat_image'];
199
+	$cat_image = '';
200
+	$cat_image = $onecat['cat_image'];
201
+	if ('' !== $cat_image && 'blank.gif' !== $cat_image && $cat_image) {
202
+		$cat_image = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/assets/images/category/' . $cat_image;
203
+	}
204
+	$category_array[] = [
205
+		'cat_id'           => $onecat['cat_id'],
206
+		'cat_title'        => $myts->displayTarea($onecat['cat_title'], 1),
207
+		'cat_image'        => $cat_image,
208
+		'cat_sponsor'      => $cat_sponsor,
209
+		'cat_description'  => $myts->displayTarea($onecat['cat_description'], 1),
210
+		'cat_element_id'   => $cat_element_id,
211
+		'cat_display'      => $cat_display,
212
+		'cat_displayImage' => $cat_displayImage,
213
+		'forums'           => $forums
214
+	];
215 215
 }
216 216
 
217 217
 unset($categories, $forums_array, $forumsByCat);
@@ -220,28 +220,28 @@  discard block
 block discarded – undo
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'])) {
229
-    $userstats = [];
230
-    if (is_object($GLOBALS['xoopsUser'])) {
231
-        //        /** @var Newbb\UserstatsHandler $userstatsHandler */
232
-        //        $userstatsHandler         = Newbb\Helper::getInstance()->getHandler('Userstats');
233
-        $userstats_row            = $userstatsHandler->getStats($GLOBALS['xoopsUser']->getVar('uid'));
234
-        $userstats['topics']      = sprintf(_MD_NEWBB_USER_TOPICS, (int)(@$userstats_row['user_topics']));
235
-        $userstats['posts']       = sprintf(_MD_NEWBB_USER_POSTS, (int)(@$userstats_row['user_posts']));
236
-        $userstats['digests']     = sprintf(_MD_NEWBB_USER_DIGESTS, (int)(@$userstats_row['user_digests']));
237
-        $userstats['currenttime'] = sprintf(_MD_NEWBB_TIMENOW, formatTimestamp(time(), 's')); // irmtfan should be removed because it is for anon users too
238
-        $userstats['lastvisit']   = sprintf(_MD_NEWBB_USER_LASTVISIT, formatTimestamp($last_visit, 's')); // irmtfan should be removed because it is for anon users too
239
-        $userstats['lastpost']    = empty($userstats_row['user_lastpost']) ? _MD_NEWBB_USER_NOLASTPOST : sprintf(_MD_NEWBB_USER_LASTPOST, formatTimestamp($userstats_row['user_lastpost'], 's'));
240
-    }
241
-    $xoopsTpl->assign_by_ref('userstats', $userstats);
242
-    // irmtfan add lastvisit smarty variable for all users
243
-    $xoopsTpl->assign('lastvisit', sprintf(_MD_NEWBB_USER_LASTVISIT, formatTimestamp($last_visit, 'l')));
244
-    $xoopsTpl->assign('currenttime', sprintf(_MD_NEWBB_TIMENOW, formatTimestamp(time(), 'm')));
229
+	$userstats = [];
230
+	if (is_object($GLOBALS['xoopsUser'])) {
231
+		//        /** @var Newbb\UserstatsHandler $userstatsHandler */
232
+		//        $userstatsHandler         = Newbb\Helper::getInstance()->getHandler('Userstats');
233
+		$userstats_row            = $userstatsHandler->getStats($GLOBALS['xoopsUser']->getVar('uid'));
234
+		$userstats['topics']      = sprintf(_MD_NEWBB_USER_TOPICS, (int)(@$userstats_row['user_topics']));
235
+		$userstats['posts']       = sprintf(_MD_NEWBB_USER_POSTS, (int)(@$userstats_row['user_posts']));
236
+		$userstats['digests']     = sprintf(_MD_NEWBB_USER_DIGESTS, (int)(@$userstats_row['user_digests']));
237
+		$userstats['currenttime'] = sprintf(_MD_NEWBB_TIMENOW, formatTimestamp(time(), 's')); // irmtfan should be removed because it is for anon users too
238
+		$userstats['lastvisit']   = sprintf(_MD_NEWBB_USER_LASTVISIT, formatTimestamp($last_visit, 's')); // irmtfan should be removed because it is for anon users too
239
+		$userstats['lastpost']    = empty($userstats_row['user_lastpost']) ? _MD_NEWBB_USER_NOLASTPOST : sprintf(_MD_NEWBB_USER_LASTPOST, formatTimestamp($userstats_row['user_lastpost'], 's'));
240
+	}
241
+	$xoopsTpl->assign_by_ref('userstats', $userstats);
242
+	// irmtfan add lastvisit smarty variable for all users
243
+	$xoopsTpl->assign('lastvisit', sprintf(_MD_NEWBB_USER_LASTVISIT, formatTimestamp($last_visit, 'l')));
244
+	$xoopsTpl->assign('currenttime', sprintf(_MD_NEWBB_TIMENOW, formatTimestamp(time(), 'm')));
245 245
 }
246 246
 
247 247
 /* display forum stats */
@@ -272,18 +272,18 @@  discard block
 block discarded – undo
272 272
 
273 273
 /* To be removed */
274 274
 if ($isAdmin) {
275
-    $xoopsTpl->assign('forum_index_cpanel', ['link' => 'admin/index.php', 'name' => _MD_NEWBB_ADMINCP]);
275
+	$xoopsTpl->assign('forum_index_cpanel', ['link' => 'admin/index.php', 'name' => _MD_NEWBB_ADMINCP]);
276 276
 }
277 277
 
278 278
 if (1 == $GLOBALS['xoopsModuleConfig']['rss_enable']) {
279
-    $xoopsTpl->assign('rss_enable', 1);
280
-    $xoopsTpl->assign('rss_button', newbbDisplayImage('rss', 'RSS feed'));
279
+	$xoopsTpl->assign('rss_enable', 1);
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';
Please login to merge, or discard this patch.
seo_url.php 1 patch
Indentation   +338 added lines, -338 removed lines patch added patch discarded remove patch
@@ -14,24 +14,24 @@  discard block
 block discarded – undo
14 14
  */
15 15
 function seo_urls($s)
16 16
 {
17
-    $XPS_URL     = str_replace('/', '\/', quotemeta(XOOPS_URL));
18
-    $module_name = str_replace('/', '\/', quotemeta(SEO_MODULE_NAME));
17
+	$XPS_URL     = str_replace('/', '\/', quotemeta(XOOPS_URL));
18
+	$module_name = str_replace('/', '\/', quotemeta(SEO_MODULE_NAME));
19 19
 
20
-    $search = [
20
+	$search = [
21 21
 
22
-        // Search URLs of modules' directry.
23
-        '/<(a|meta)([^>]*)(href|url)=([\'\"]{0,1})' . $XPS_URL . '\/' . $module_name . '\/(index.php)([^>\'\"]*)([\'\"]{1})([^>]*)>/i',
24
-        '/<(a|meta)([^>]*)(href|url)=([\'\"]{0,1})' . $XPS_URL . '\/' . $module_name . '\/(viewpost.php)([^>\'\"]*)([\'\"]{1})([^>]*)>/i',
25
-        '/<(a|meta)([^>]*)(href|url)=([\'\"]{0,1})' . $XPS_URL . '\/' . $module_name . '\/(rss.php)([^>\'\"]*)([\'\"]{1})([^>]*)>/i',
26
-        '/<(a|meta)([^>]*)(href|url)=([\'\"]{0,1})' . $XPS_URL . '\/' . $module_name . '\/(viewforum.php)([^>\'\"]*)([\'\"]{1})([^>]*)>/i',
27
-        '/<(a|meta)([^>]*)(href|url)=([\'\"]{0,1})' . $XPS_URL . '\/' . $module_name . '\/(viewtopic.php)([^>\'\"]*)([\'\"]{1})([^>]*)>/i',
28
-        '/<(a|meta)([^>]*)(href|url)=([\'\"]{0,1})' . $XPS_URL . '\/' . $module_name . '\/(newtopic.php)([^>\'\"]*)([\'\"]{1})([^>]*)>/i',
29
-        '/<(a|meta)([^>]*)(href|url)=([\'\"]{0,1})' . $XPS_URL . '\/' . $module_name . '\/(.*)([^>\'\"]*)([\'\"]{1})([^>]*)>/i'
30
-    ];
22
+		// Search URLs of modules' directry.
23
+		'/<(a|meta)([^>]*)(href|url)=([\'\"]{0,1})' . $XPS_URL . '\/' . $module_name . '\/(index.php)([^>\'\"]*)([\'\"]{1})([^>]*)>/i',
24
+		'/<(a|meta)([^>]*)(href|url)=([\'\"]{0,1})' . $XPS_URL . '\/' . $module_name . '\/(viewpost.php)([^>\'\"]*)([\'\"]{1})([^>]*)>/i',
25
+		'/<(a|meta)([^>]*)(href|url)=([\'\"]{0,1})' . $XPS_URL . '\/' . $module_name . '\/(rss.php)([^>\'\"]*)([\'\"]{1})([^>]*)>/i',
26
+		'/<(a|meta)([^>]*)(href|url)=([\'\"]{0,1})' . $XPS_URL . '\/' . $module_name . '\/(viewforum.php)([^>\'\"]*)([\'\"]{1})([^>]*)>/i',
27
+		'/<(a|meta)([^>]*)(href|url)=([\'\"]{0,1})' . $XPS_URL . '\/' . $module_name . '\/(viewtopic.php)([^>\'\"]*)([\'\"]{1})([^>]*)>/i',
28
+		'/<(a|meta)([^>]*)(href|url)=([\'\"]{0,1})' . $XPS_URL . '\/' . $module_name . '\/(newtopic.php)([^>\'\"]*)([\'\"]{1})([^>]*)>/i',
29
+		'/<(a|meta)([^>]*)(href|url)=([\'\"]{0,1})' . $XPS_URL . '\/' . $module_name . '\/(.*)([^>\'\"]*)([\'\"]{1})([^>]*)>/i'
30
+	];
31 31
 
32
-    $s = preg_replace_callback($search, 'replace_links', $s);
32
+	$s = preg_replace_callback($search, 'replace_links', $s);
33 33
 
34
-    return $s;
34
+	return $s;
35 35
 }
36 36
 
37 37
 /**
@@ -40,139 +40,139 @@  discard block
 block discarded – undo
40 40
  */
41 41
 function replace_links($matches)
42 42
 {
43
-    switch ($matches[5]) {
44
-        case 'index.php':
45
-            $add_to_url = '';
46
-            $req_string = $matches[6];
47
-            if (!empty($matches[6])) {
48
-                //                replacing cat=x
49
-                if (preg_match('/cat=(\d+)/', $matches[6], $mvars)) {
50
-                    $add_to_url = 'c-' . $mvars[1] . '/' . forum_seo_cat($mvars[1]) . '';
51
-                    $req_string = preg_replace('/cat=\d+/', '', $matches[6]);
52
-                } else {
53
-                    return $matches['0'];
54
-                }
55
-            }
56
-            break;
57
-        case 'viewpost.php':
58
-            $add_to_url = '';
59
-            $req_string = $matches[6];
60
-            if (!empty($matches[6])) {
61
-                //                replacing status=x
62
-                if (preg_match('/status=([a-z]+)/', $matches[6], $mvars)) {
63
-                    $add_to_url = 'viewpost.php' . $matches[6];
64
-                    $req_string = preg_replace('/status=([a-z])+/', '', $matches[6]);
65
-                } else {
66
-                    return $matches['0'];
67
-                }
68
-            } else {
69
-                $add_to_url = 'viewpost.php' . $matches[6];
70
-            }
71
-            break;
72
-        case 'rss.php':
73
-            $add_to_url = '';
74
-            $req_string = $matches[6];
75
-            if (!empty($matches[6])) {
76
-                //                replacing c=x
77
-                if (preg_match('/c=(\d+)/', $matches[6], $mvars)) {
78
-                    $add_to_url = 'rc-';
79
-                    if ($mvars[1] > 0) {
80
-                        $add_to_url .= $mvars[1] . '/' . forum_seo_cat($mvars[1]) . '';
81
-                    } else {
82
-                        $add_to_url .= $mvars[1] . '/rss.html';
83
-                    }
84
-                    $req_string = preg_replace('/c=\d+/', '', $matches[6]);
85
-                } elseif (preg_match('/f=(\d+)/', $matches[6], $mvars)) {
86
-                    $add_to_url = 'rf-';
87
-                    if ($mvars[1] > 0) {
88
-                        $add_to_url .= $mvars[1] . '/' . forum_seo_forum($mvars[1]) . '';
89
-                    } else {
90
-                        $add_to_url .= $mvars[1] . '/rss.html';
91
-                    }
92
-                    $req_string = preg_replace('/f=\d+/', '', $matches[6]);
93
-                } else {
94
-                    return $matches['0'];
95
-                }
96
-                //$add_to_url .= 'rss-feed.html';
97
-            }
98
-            break;
99
-        case 'viewforum.php':
100
-            $add_to_url = '';
101
-            $req_string = $matches[6];
102
-            if (!empty($matches[6])) {
103
-                //                replacing forum=x
104
-                if (preg_match('/forum=(\d+)/', $matches[6], $mvars)) {
105
-                    $add_to_url = 'f-' . $mvars[1] . '/' . forum_seo_forum($mvars[1]) . '';
106
-                    $req_string = preg_replace('/forum=\d+/', '', $matches[6]);
107
-                } else {
108
-                    return $matches['0'];
109
-                }
110
-            }
111
-            break;
112
-        case 'viewtopic.php':
113
-            $add_to_url = '';
114
-            $req_string = $matches[6];
115
-            if (!empty($matches[6])) {
116
-                //                replacing topic_id=x
117
-                if (preg_match('/topic_id=(\d+)/', $matches[6], $mvars)) {
118
-                    $add_to_url = 't-' . $mvars[1] . '/' . forum_seo_topic($mvars[1]) . '';
119
-                    $req_string = preg_replace('/topic_id=\d+/', '', $matches[6]);
120
-                } //replacing post_id=x
121
-                elseif (preg_match('/post_id=(\d+)/', $matches[6], $mvars)) {
122
-                    $add_to_url = 'p-' . $mvars[1] . '/' . forum_seo_post($mvars[1]) . '';
123
-                    $req_string = preg_replace('/post_id=\d+/', '', $matches[6]);
124
-                } else {
125
-                    return $matches['0'];
126
-                }
127
-            }
128
-            break;
129
-        case 'print.php':
130
-            $add_to_url = '';
131
-            $req_string = $matches[6];
132
-            if (!empty($matches[6])) {
133
-                //                replacing topic_id=x
134
-                if (preg_match('/topic_id=(\d+)/', $matches[6], $mvars)) {
135
-                    $add_to_url = 'pr-' . $mvars[1] . '/' . forum_seo_topic($mvars[1]) . '';
136
-                    $req_string = preg_replace('/topic_id=\d+/', '', $matches[6]);
137
-                } //replacing post_id=x
138
-                elseif (preg_match('/post_id=(\d+)/', $matches[6], $mvars)) {
139
-                    $add_to_url = 'pr-' . $mvars[1] . '/' . forum_seo_post($mvars[1]) . '';
140
-                    $req_string = preg_replace('/post_id=\d+/', '', $matches[6]);
141
-                } else {
142
-                    return $matches['0'];
143
-                }
144
-            }
145
-            break;
146
-        case 'makepdf.php':
147
-            $add_to_url = '';
148
-            $req_string = $matches[6];
149
-            if (!empty($matches[6])) {
150
-                //                replacing topic_id=x
151
-                if (preg_match('/topic_id=(\d+)/', $matches[6], $mvars)) {
152
-                    $add_to_url = 'pdf-' . $mvars[1] . '/' . forum_seo_topic($mvars[1]) . '';
153
-                    $req_string = preg_replace('/topic_id=\d+/', '', $matches[6]);
154
-                } //replacing post_id=x
155
-                elseif (preg_match('/post_id=(\d+)/', $matches[6], $mvars)) {
156
-                    $add_to_url = 'pdf-' . $mvars[1] . '/' . forum_seo_post($mvars[1]) . '';
157
-                    $req_string = preg_replace('/post_id=\d+/', '', $matches[6]);
158
-                } else {
159
-                    return $matches['0'];
160
-                }
161
-            }
162
-            break;
163
-        default:
164
-            $req_string = $matches[6];
165
-            $add_to_url = $matches[5];
166
-            //if ($add_to_url === '') $add_to_url ='index.php';
167
-            break;
168
-    }
169
-    if ('?' === $req_string) {
170
-        $req_string = '';
171
-    }
172
-    $ret = '<' . $matches[1] . $matches[2] . $matches[3] . '=' . $matches[4] . XOOPS_URL . '/' . SEO_MODULE_NAME . '/' . $add_to_url . $req_string . $matches[7] . $matches[8] . '>';
43
+	switch ($matches[5]) {
44
+		case 'index.php':
45
+			$add_to_url = '';
46
+			$req_string = $matches[6];
47
+			if (!empty($matches[6])) {
48
+				//                replacing cat=x
49
+				if (preg_match('/cat=(\d+)/', $matches[6], $mvars)) {
50
+					$add_to_url = 'c-' . $mvars[1] . '/' . forum_seo_cat($mvars[1]) . '';
51
+					$req_string = preg_replace('/cat=\d+/', '', $matches[6]);
52
+				} else {
53
+					return $matches['0'];
54
+				}
55
+			}
56
+			break;
57
+		case 'viewpost.php':
58
+			$add_to_url = '';
59
+			$req_string = $matches[6];
60
+			if (!empty($matches[6])) {
61
+				//                replacing status=x
62
+				if (preg_match('/status=([a-z]+)/', $matches[6], $mvars)) {
63
+					$add_to_url = 'viewpost.php' . $matches[6];
64
+					$req_string = preg_replace('/status=([a-z])+/', '', $matches[6]);
65
+				} else {
66
+					return $matches['0'];
67
+				}
68
+			} else {
69
+				$add_to_url = 'viewpost.php' . $matches[6];
70
+			}
71
+			break;
72
+		case 'rss.php':
73
+			$add_to_url = '';
74
+			$req_string = $matches[6];
75
+			if (!empty($matches[6])) {
76
+				//                replacing c=x
77
+				if (preg_match('/c=(\d+)/', $matches[6], $mvars)) {
78
+					$add_to_url = 'rc-';
79
+					if ($mvars[1] > 0) {
80
+						$add_to_url .= $mvars[1] . '/' . forum_seo_cat($mvars[1]) . '';
81
+					} else {
82
+						$add_to_url .= $mvars[1] . '/rss.html';
83
+					}
84
+					$req_string = preg_replace('/c=\d+/', '', $matches[6]);
85
+				} elseif (preg_match('/f=(\d+)/', $matches[6], $mvars)) {
86
+					$add_to_url = 'rf-';
87
+					if ($mvars[1] > 0) {
88
+						$add_to_url .= $mvars[1] . '/' . forum_seo_forum($mvars[1]) . '';
89
+					} else {
90
+						$add_to_url .= $mvars[1] . '/rss.html';
91
+					}
92
+					$req_string = preg_replace('/f=\d+/', '', $matches[6]);
93
+				} else {
94
+					return $matches['0'];
95
+				}
96
+				//$add_to_url .= 'rss-feed.html';
97
+			}
98
+			break;
99
+		case 'viewforum.php':
100
+			$add_to_url = '';
101
+			$req_string = $matches[6];
102
+			if (!empty($matches[6])) {
103
+				//                replacing forum=x
104
+				if (preg_match('/forum=(\d+)/', $matches[6], $mvars)) {
105
+					$add_to_url = 'f-' . $mvars[1] . '/' . forum_seo_forum($mvars[1]) . '';
106
+					$req_string = preg_replace('/forum=\d+/', '', $matches[6]);
107
+				} else {
108
+					return $matches['0'];
109
+				}
110
+			}
111
+			break;
112
+		case 'viewtopic.php':
113
+			$add_to_url = '';
114
+			$req_string = $matches[6];
115
+			if (!empty($matches[6])) {
116
+				//                replacing topic_id=x
117
+				if (preg_match('/topic_id=(\d+)/', $matches[6], $mvars)) {
118
+					$add_to_url = 't-' . $mvars[1] . '/' . forum_seo_topic($mvars[1]) . '';
119
+					$req_string = preg_replace('/topic_id=\d+/', '', $matches[6]);
120
+				} //replacing post_id=x
121
+				elseif (preg_match('/post_id=(\d+)/', $matches[6], $mvars)) {
122
+					$add_to_url = 'p-' . $mvars[1] . '/' . forum_seo_post($mvars[1]) . '';
123
+					$req_string = preg_replace('/post_id=\d+/', '', $matches[6]);
124
+				} else {
125
+					return $matches['0'];
126
+				}
127
+			}
128
+			break;
129
+		case 'print.php':
130
+			$add_to_url = '';
131
+			$req_string = $matches[6];
132
+			if (!empty($matches[6])) {
133
+				//                replacing topic_id=x
134
+				if (preg_match('/topic_id=(\d+)/', $matches[6], $mvars)) {
135
+					$add_to_url = 'pr-' . $mvars[1] . '/' . forum_seo_topic($mvars[1]) . '';
136
+					$req_string = preg_replace('/topic_id=\d+/', '', $matches[6]);
137
+				} //replacing post_id=x
138
+				elseif (preg_match('/post_id=(\d+)/', $matches[6], $mvars)) {
139
+					$add_to_url = 'pr-' . $mvars[1] . '/' . forum_seo_post($mvars[1]) . '';
140
+					$req_string = preg_replace('/post_id=\d+/', '', $matches[6]);
141
+				} else {
142
+					return $matches['0'];
143
+				}
144
+			}
145
+			break;
146
+		case 'makepdf.php':
147
+			$add_to_url = '';
148
+			$req_string = $matches[6];
149
+			if (!empty($matches[6])) {
150
+				//                replacing topic_id=x
151
+				if (preg_match('/topic_id=(\d+)/', $matches[6], $mvars)) {
152
+					$add_to_url = 'pdf-' . $mvars[1] . '/' . forum_seo_topic($mvars[1]) . '';
153
+					$req_string = preg_replace('/topic_id=\d+/', '', $matches[6]);
154
+				} //replacing post_id=x
155
+				elseif (preg_match('/post_id=(\d+)/', $matches[6], $mvars)) {
156
+					$add_to_url = 'pdf-' . $mvars[1] . '/' . forum_seo_post($mvars[1]) . '';
157
+					$req_string = preg_replace('/post_id=\d+/', '', $matches[6]);
158
+				} else {
159
+					return $matches['0'];
160
+				}
161
+			}
162
+			break;
163
+		default:
164
+			$req_string = $matches[6];
165
+			$add_to_url = $matches[5];
166
+			//if ($add_to_url === '') $add_to_url ='index.php';
167
+			break;
168
+	}
169
+	if ('?' === $req_string) {
170
+		$req_string = '';
171
+	}
172
+	$ret = '<' . $matches[1] . $matches[2] . $matches[3] . '=' . $matches[4] . XOOPS_URL . '/' . SEO_MODULE_NAME . '/' . $add_to_url . $req_string . $matches[7] . $matches[8] . '>';
173 173
 
174
-    //$ret = '<'.$matches[1].$matches[2].$matches[3].'='.$matches[4].XOOPS_URL.'/'.REAL_MODULE_NAME.'/'.$add_to_url.$req_string.$matches[7].$matches[8].'>';
175
-    return $ret;
174
+	//$ret = '<'.$matches[1].$matches[2].$matches[3].'='.$matches[4].XOOPS_URL.'/'.REAL_MODULE_NAME.'/'.$add_to_url.$req_string.$matches[7].$matches[8].'>';
175
+	return $ret;
176 176
 }
177 177
 
178 178
 /**
@@ -181,26 +181,26 @@  discard block
 block discarded – undo
181 181
  */
182 182
 function forum_seo_cat($_cat_id)
183 183
 {
184
-    xoops_load('XoopsCache');
185
-    $key = 'newbb_seo_cat';
186
-    $ret = false;
187
-    if ($ret = \XoopsCache::read($key)) {
188
-        $ret = @$ret[$_cat_id];
189
-        if ($ret) {
190
-            return $ret;
191
-        }
192
-    }
193
-    $query  = 'SELECT cat_id, cat_title FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_categories');
194
-    $result = $GLOBALS['xoopsDB']->query($query);
195
-    $_ret   = [];
196
-    while (false !== ($res = $GLOBALS['xoopsDB']->fetchArray($result))) {
197
-        $_ret[$res['cat_id']] = forum_seo_title($res['cat_title']);
198
-    }
199
-    XoopsCache::write($key, $_ret);
200
-    $ret = \XoopsCache::read($key);
201
-    $ret = $ret[$_cat_id];
184
+	xoops_load('XoopsCache');
185
+	$key = 'newbb_seo_cat';
186
+	$ret = false;
187
+	if ($ret = \XoopsCache::read($key)) {
188
+		$ret = @$ret[$_cat_id];
189
+		if ($ret) {
190
+			return $ret;
191
+		}
192
+	}
193
+	$query  = 'SELECT cat_id, cat_title FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_categories');
194
+	$result = $GLOBALS['xoopsDB']->query($query);
195
+	$_ret   = [];
196
+	while (false !== ($res = $GLOBALS['xoopsDB']->fetchArray($result))) {
197
+		$_ret[$res['cat_id']] = forum_seo_title($res['cat_title']);
198
+	}
199
+	XoopsCache::write($key, $_ret);
200
+	$ret = \XoopsCache::read($key);
201
+	$ret = $ret[$_cat_id];
202 202
 
203
-    return $ret;
203
+	return $ret;
204 204
 }
205 205
 
206 206
 /**
@@ -209,26 +209,26 @@  discard block
 block discarded – undo
209 209
  */
210 210
 function forum_seo_forum($_cat_id)
211 211
 {
212
-    xoops_load('XoopsCache');
213
-    $key = 'newbb_seo_forum';
214
-    $ret = false;
215
-    if ($ret = \XoopsCache::read($key)) {
216
-        $ret = @$ret[$_cat_id];
217
-        if ($ret) {
218
-            return $ret;
219
-        }
220
-    }
221
-    $query  = 'SELECT forum_id, forum_name    FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_forums');
222
-    $result = $GLOBALS['xoopsDB']->query($query);
223
-    $_ret   = [];
224
-    while (false !== ($res = $GLOBALS['xoopsDB']->fetchArray($result))) {
225
-        $_ret[$res['forum_id']] = forum_seo_title($res['forum_name']);
226
-    }
227
-    XoopsCache::write($key, $_ret);
228
-    $ret = \XoopsCache::read($key);
229
-    $ret = $ret[$_cat_id];
212
+	xoops_load('XoopsCache');
213
+	$key = 'newbb_seo_forum';
214
+	$ret = false;
215
+	if ($ret = \XoopsCache::read($key)) {
216
+		$ret = @$ret[$_cat_id];
217
+		if ($ret) {
218
+			return $ret;
219
+		}
220
+	}
221
+	$query  = 'SELECT forum_id, forum_name    FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_forums');
222
+	$result = $GLOBALS['xoopsDB']->query($query);
223
+	$_ret   = [];
224
+	while (false !== ($res = $GLOBALS['xoopsDB']->fetchArray($result))) {
225
+		$_ret[$res['forum_id']] = forum_seo_title($res['forum_name']);
226
+	}
227
+	XoopsCache::write($key, $_ret);
228
+	$ret = \XoopsCache::read($key);
229
+	$ret = $ret[$_cat_id];
230 230
 
231
-    return $ret;
231
+	return $ret;
232 232
 }
233 233
 
234 234
 /**
@@ -237,19 +237,19 @@  discard block
 block discarded – undo
237 237
  */
238 238
 function forum_seo_topic($_cat_id)
239 239
 {
240
-    $query  = 'SELECT    topic_title    FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . ' WHERE topic_id = ' . $_cat_id;
241
-    $result = $GLOBALS['xoopsDB']->query($query);
242
-    $res    = $GLOBALS['xoopsDB']->fetchArray($result);
243
-    $ret    = forum_seo_title($res['topic_title']);
240
+	$query  = 'SELECT    topic_title    FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . ' WHERE topic_id = ' . $_cat_id;
241
+	$result = $GLOBALS['xoopsDB']->query($query);
242
+	$res    = $GLOBALS['xoopsDB']->fetchArray($result);
243
+	$ret    = forum_seo_title($res['topic_title']);
244 244
 
245
-    $moduleDirName = basename(__DIR__);
246
-    /** @var Newbb\TopicHandler $topicsHandler */
247
-    $topicsHandler = Newbb\Helper::getInstance()->getHandler('Topic');
248
-    $criteria      = new \CriteriaCompo(new \Criteria('topic_id', $_cat_id, '='));
249
-    $fields        = ['topic_title'];
250
-    $ret0          = $topicsHandler->getAll($criteria, $fields, false);
245
+	$moduleDirName = basename(__DIR__);
246
+	/** @var Newbb\TopicHandler $topicsHandler */
247
+	$topicsHandler = Newbb\Helper::getInstance()->getHandler('Topic');
248
+	$criteria      = new \CriteriaCompo(new \Criteria('topic_id', $_cat_id, '='));
249
+	$fields        = ['topic_title'];
250
+	$ret0          = $topicsHandler->getAll($criteria, $fields, false);
251 251
 
252
-    return $ret;
252
+	return $ret;
253 253
 }
254 254
 
255 255
 /**
@@ -258,12 +258,12 @@  discard block
 block discarded – undo
258 258
  */
259 259
 function forum_seo_post($_cat_id)
260 260
 {
261
-    $query  = 'SELECT    subject    FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . ' WHERE post_id = ' . $_cat_id;
262
-    $result = $GLOBALS['xoopsDB']->query($query);
263
-    $res    = $GLOBALS['xoopsDB']->fetchArray($result);
264
-    $ret    = forum_seo_title($res['subject']);
261
+	$query  = 'SELECT    subject    FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . ' WHERE post_id = ' . $_cat_id;
262
+	$result = $GLOBALS['xoopsDB']->query($query);
263
+	$res    = $GLOBALS['xoopsDB']->fetchArray($result);
264
+	$ret    = forum_seo_title($res['subject']);
265 265
 
266
-    return $ret;
266
+	return $ret;
267 267
 }
268 268
 
269 269
 /**
@@ -273,152 +273,152 @@  discard block
 block discarded – undo
273 273
  */
274 274
 function forum_seo_title($title = '', $withExt = true)
275 275
 {
276
-    /**
277
-     * if XOOPS ML is present, let's sanitize the title with the current language
278
-     */
279
-    $myts = \MyTextSanitizer::getInstance();
280
-    if (method_exists($myts, 'formatForML')) {
281
-        $title = $myts->formatForML($title);
282
-    }
276
+	/**
277
+	 * if XOOPS ML is present, let's sanitize the title with the current language
278
+	 */
279
+	$myts = \MyTextSanitizer::getInstance();
280
+	if (method_exists($myts, 'formatForML')) {
281
+		$title = $myts->formatForML($title);
282
+	}
283 283
 
284
-    // Transformation de la chaine en minuscule
285
-    // Codage de la chaine afin d'�viter les erreurs 500 en cas de caract�res impr�vus
286
-    $title = rawurlencode(strtolower($title));
284
+	// Transformation de la chaine en minuscule
285
+	// Codage de la chaine afin d'�viter les erreurs 500 en cas de caract�res impr�vus
286
+	$title = rawurlencode(strtolower($title));
287 287
 
288
-    // Transformation des ponctuations
289
-    //                 Tab     Space      !        "        #        %        &        '        (        )        ,        /        :        ;        <        =        >        ?        @        [        \        ]        ^        {        |        }        ~       .
290
-    $pattern = [
291
-        '/%09/',
292
-        '/%20/',
293
-        '/%21/',
294
-        '/%22/',
295
-        '/%23/',
296
-        '/%25/',
297
-        '/%26/',
298
-        '/%27/',
299
-        '/%28/',
300
-        '/%29/',
301
-        '/%2C/',
302
-        '/%2F/',
303
-        '/%3A/',
304
-        '/%3B/',
305
-        '/%3C/',
306
-        '/%3D/',
307
-        '/%3E/',
308
-        '/%3F/',
309
-        '/%40/',
310
-        '/%5B/',
311
-        '/%5C/',
312
-        '/%5D/',
313
-        '/%5E/',
314
-        '/%7B/',
315
-        '/%7C/',
316
-        '/%7D/',
317
-        '/%7E/',
318
-        '/\./',
319
-        '/%2A/'
320
-    ];
321
-    $rep_pat = [
322
-        '-',
323
-        '-',
324
-        '',
325
-        '',
326
-        '',
327
-        '-100',
328
-        '',
329
-        '-',
330
-        '',
331
-        '',
332
-        '',
333
-        '-',
334
-        '',
335
-        '',
336
-        '',
337
-        '-',
338
-        '',
339
-        '',
340
-        '-at-',
341
-        '',
342
-        '-',
343
-        '',
344
-        '-',
345
-        '',
346
-        '-',
347
-        '',
348
-        '-',
349
-        '',
350
-        ''
351
-    ];
352
-    $title   = preg_replace($pattern, $rep_pat, $title);
288
+	// Transformation des ponctuations
289
+	//                 Tab     Space      !        "        #        %        &        '        (        )        ,        /        :        ;        <        =        >        ?        @        [        \        ]        ^        {        |        }        ~       .
290
+	$pattern = [
291
+		'/%09/',
292
+		'/%20/',
293
+		'/%21/',
294
+		'/%22/',
295
+		'/%23/',
296
+		'/%25/',
297
+		'/%26/',
298
+		'/%27/',
299
+		'/%28/',
300
+		'/%29/',
301
+		'/%2C/',
302
+		'/%2F/',
303
+		'/%3A/',
304
+		'/%3B/',
305
+		'/%3C/',
306
+		'/%3D/',
307
+		'/%3E/',
308
+		'/%3F/',
309
+		'/%40/',
310
+		'/%5B/',
311
+		'/%5C/',
312
+		'/%5D/',
313
+		'/%5E/',
314
+		'/%7B/',
315
+		'/%7C/',
316
+		'/%7D/',
317
+		'/%7E/',
318
+		'/\./',
319
+		'/%2A/'
320
+	];
321
+	$rep_pat = [
322
+		'-',
323
+		'-',
324
+		'',
325
+		'',
326
+		'',
327
+		'-100',
328
+		'',
329
+		'-',
330
+		'',
331
+		'',
332
+		'',
333
+		'-',
334
+		'',
335
+		'',
336
+		'',
337
+		'-',
338
+		'',
339
+		'',
340
+		'-at-',
341
+		'',
342
+		'-',
343
+		'',
344
+		'-',
345
+		'',
346
+		'-',
347
+		'',
348
+		'-',
349
+		'',
350
+		''
351
+	];
352
+	$title   = preg_replace($pattern, $rep_pat, $title);
353 353
 
354
-    // Transformation des caractères accentués
355
-    //                  è         é        ê         ë         ç         à         â         ä        î         ï        ù         ü         û         ô        ö
356
-    $pattern = [
357
-        '/%B0/',
358
-        '/%E8/',
359
-        '/%E9/',
360
-        '/%EA/',
361
-        '/%EB/',
362
-        '/%E7/',
363
-        '/%E0/',
364
-        '/%E2/',
365
-        '/%E4/',
366
-        '/%EE/',
367
-        '/%EF/',
368
-        '/%F9/',
369
-        '/%FC/',
370
-        '/%FB/',
371
-        '/%F4/',
372
-        '/%F6/',
373
-        '/%E3%BC/',
374
-        '/%E3%96/',
375
-        '/%E3%84/',
376
-        '/%E3%9C/',
377
-        '/%E3%FF/',
378
-        '/%E3%B6/',
379
-        '/%E3%A4/',
380
-        '/%E3%9F/'
381
-    ];
382
-    $rep_pat = [
383
-        '-',
384
-        'e',
385
-        'e',
386
-        'e',
387
-        'e',
388
-        'c',
389
-        'a',
390
-        'a',
391
-        'a',
392
-        'i',
393
-        'i',
394
-        'u',
395
-        'u',
396
-        'u',
397
-        'o',
398
-        'o',
399
-        'ue',
400
-        'oe',
401
-        'ae',
402
-        'ue',
403
-        'ss',
404
-        'oe',
405
-        'ae',
406
-        'ss'
407
-    ];
408
-    $title   = preg_replace($pattern, $rep_pat, $title);
354
+	// Transformation des caractères accentués
355
+	//                  è         é        ê         ë         ç         à         â         ä        î         ï        ù         ü         û         ô        ö
356
+	$pattern = [
357
+		'/%B0/',
358
+		'/%E8/',
359
+		'/%E9/',
360
+		'/%EA/',
361
+		'/%EB/',
362
+		'/%E7/',
363
+		'/%E0/',
364
+		'/%E2/',
365
+		'/%E4/',
366
+		'/%EE/',
367
+		'/%EF/',
368
+		'/%F9/',
369
+		'/%FC/',
370
+		'/%FB/',
371
+		'/%F4/',
372
+		'/%F6/',
373
+		'/%E3%BC/',
374
+		'/%E3%96/',
375
+		'/%E3%84/',
376
+		'/%E3%9C/',
377
+		'/%E3%FF/',
378
+		'/%E3%B6/',
379
+		'/%E3%A4/',
380
+		'/%E3%9F/'
381
+	];
382
+	$rep_pat = [
383
+		'-',
384
+		'e',
385
+		'e',
386
+		'e',
387
+		'e',
388
+		'c',
389
+		'a',
390
+		'a',
391
+		'a',
392
+		'i',
393
+		'i',
394
+		'u',
395
+		'u',
396
+		'u',
397
+		'o',
398
+		'o',
399
+		'ue',
400
+		'oe',
401
+		'ae',
402
+		'ue',
403
+		'ss',
404
+		'oe',
405
+		'ae',
406
+		'ss'
407
+	];
408
+	$title   = preg_replace($pattern, $rep_pat, $title);
409 409
 
410
-    /*$string = str_replace(' ', '-', $title);
410
+	/*$string = str_replace(' ', '-', $title);
411 411
     $string = iconv('utf-8', 'ascii//translit', $string);
412 412
     $string = preg_replace('#[^a-z0-9\-\.]#si', '', $string);
413 413
     $title  = str_replace('\/','', $string);  */
414 414
 
415
-    if (count($title) > 0) {
416
-        if ($withExt) {
417
-            $title .= '.html';
418
-        }
415
+	if (count($title) > 0) {
416
+		if ($withExt) {
417
+			$title .= '.html';
418
+		}
419 419
 
420
-        return $title;
421
-    }
420
+		return $title;
421
+	}
422 422
 
423
-    return '';
423
+	return '';
424 424
 }
Please login to merge, or discard this patch.
post.php 1 patch
Indentation   +455 added lines, -455 removed lines patch added patch discarded remove patch
@@ -22,22 +22,22 @@  discard block
 block discarded – undo
22 22
 require_once __DIR__ . '/header.php';
23 23
 
24 24
 foreach ([
25
-             'forum',
26
-             'topic_id',
27
-             'post_id',
28
-             'order',
29
-             'pid',
30
-             'start',
31
-             'isreply',
32
-             'isedit'
33
-         ] as $getint) {
34
-    ${$getint} = Request::getInt($getint, 0, 'POST');
25
+			 'forum',
26
+			 'topic_id',
27
+			 'post_id',
28
+			 'order',
29
+			 'pid',
30
+			 'start',
31
+			 'isreply',
32
+			 'isedit'
33
+		 ] as $getint) {
34
+	${$getint} = Request::getInt($getint, 0, 'POST');
35 35
 }
36 36
 $token_valid = false;
37 37
 $op       = Request::getCmd('op', '', 'POST');
38 38
 $viewmode = ('flat' !== Request::getString('viewmode', '', 'POST')) ? 'thread' : 'flat';
39 39
 if (empty($forum)) {
40
-    redirect_header('index.php', 2, _MD_NEWBB_ERRORFORUM);
40
+	redirect_header('index.php', 2, _MD_NEWBB_ERRORFORUM);
41 41
 }
42 42
 
43 43
 ///** @var Newbb\ForumHandler $forumHandler */
@@ -48,356 +48,356 @@  discard block
 block discarded – undo
48 48
 //$postHandler = Newbb\Helper::getInstance()->getHandler('Post');
49 49
 
50 50
 if (!empty($isedit) && $post_id > 0) {
51
-    /** @var Post $postObject */
52
-    $postObject = $postHandler->get($post_id);
53
-    $topic_id   = $postObject->getVar('topic_id');
51
+	/** @var Post $postObject */
52
+	$postObject = $postHandler->get($post_id);
53
+	$topic_id   = $postObject->getVar('topic_id');
54 54
 } else {
55
-    $postObject = $postHandler->create();
55
+	$postObject = $postHandler->create();
56 56
 }
57 57
 $topicObject = $topicHandler->get($topic_id);
58 58
 $forum_id    = $topic_id ? $topicObject->getVar('forum_id') : $forum;
59 59
 $forumObject = $forumHandler->get($forum_id);
60 60
 if (!$forumHandler->getPermission($forumObject)) {
61
-    redirect_header('index.php', 2, _NOPERM);
61
+	redirect_header('index.php', 2, _NOPERM);
62 62
 }
63 63
 
64 64
 if ($GLOBALS['xoopsModuleConfig']['wol_enabled']) {
65
-    //    /** @var Newbb\OnlineHandler $onlineHandler */
66
-    //    $onlineHandler = Newbb\Helper::getInstance()->getHandler('Online');
67
-    $onlineHandler->init($forumObject);
65
+	//    /** @var Newbb\OnlineHandler $onlineHandler */
66
+	//    $onlineHandler = Newbb\Helper::getInstance()->getHandler('Online');
67
+	$onlineHandler->init($forumObject);
68 68
 }
69 69
 
70 70
 $error_message = [];
71 71
 
72 72
 if (Request::getString('contents_submit', '', 'POST')) {
73
-    $token_valid = $GLOBALS['xoopsSecurity']->check();
74
-
75
-    $captcha_invalid = false;
76
-    if (!is_object($GLOBALS['xoopsUser']) && Request::hasVar('uname', 'POST') && Request::hasVar('pass', 'POST')) {
77
-        $uname = Request::getString('uname', '', 'POST');
78
-        $pass  = Request::getString('pass', '', 'POST');
79
-        /** @var \XoopsMemberHandler $memberHandler */
80
-        $memberHandler = xoops_getHandler('member');
81
-        $user          = $memberHandler->loginUser($uname, $pass);
82
-        if (is_object($user) && 0 < $user->getVar('level')) {
83
-            if (Request::getString('login', '', 'POST')) {
84
-                $user->setVar('last_login', time());
85
-                if (!$memberHandler->insertUser($user)) {
86
-                }
87
-                $_SESSION                    = [];
88
-                $_SESSION['xoopsUserId']     = $user->getVar('uid');
89
-                $_SESSION['xoopsUserGroups'] = $user->getGroups();
90
-                if ($GLOBALS['xoopsConfig']['use_mysession'] && '' !== $GLOBALS['xoopsConfig']['session_name']) {
91
-                    setcookie($GLOBALS['xoopsConfig']['session_name'], session_id(), time() + (60 * $GLOBALS['xoopsConfig']['session_expire']), '/', '', 0);
92
-                }
93
-                $user_theme = $user->getVar('theme');
94
-                if (in_array($user_theme, $GLOBALS['xoopsConfig']['theme_set_allowed'])) {
95
-                    $_SESSION['xoopsUserTheme'] = $user_theme;
96
-                }
97
-            }
98
-            $GLOBALS['xoopsUser'] = $user;
99
-            $xoopsUserIsAdmin     = $GLOBALS['xoopsUser']->isAdmin($xoopsModule->getVar('mid'));
100
-        }
101
-    }
102
-    if (!is_object($GLOBALS['xoopsUser'])) {
103
-        xoops_load('captcha');
104
-        $xoopsCaptcha = \XoopsCaptcha::getInstance();
105
-        if (!$xoopsCaptcha->verify()) {
106
-            $captcha_invalid = true;
107
-            $error_message[] = $xoopsCaptcha->getMessage();
108
-        }
109
-    }
110
-
111
-    $isAdmin = newbbIsAdmin($forumObject);
112
-
113
-    $time_valid = true;
114
-    if (!$isAdmin && !empty($GLOBALS['xoopsModuleConfig']['post_timelimit'])) {
115
-        $last_post = newbbGetSession('LP');
116
-        if (time() - $last_post < $GLOBALS['xoopsModuleConfig']['post_timelimit']) {
117
-            $time_valid = false;
118
-        }
119
-    }
120
-
121
-    if ($captcha_invalid || !$token_valid || !$time_valid) {
122
-        $_POST['contents_preview'] = 1;
123
-        $_POST['contents_submit']  = null;
124
-        $_POST['contents_upload']  = null;
125
-        if (!$token_valid) {
126
-            $error_message[] = _MD_NEWBB_INVALID_SUBMIT;
127
-        }
128
-        if (!$time_valid) {
129
-            $error_message[] = sprintf(_MD_NEWBB_POSTING_LIMITED, $GLOBALS['xoopsModuleConfig']['post_timelimit']);
130
-        }
131
-    }
73
+	$token_valid = $GLOBALS['xoopsSecurity']->check();
74
+
75
+	$captcha_invalid = false;
76
+	if (!is_object($GLOBALS['xoopsUser']) && Request::hasVar('uname', 'POST') && Request::hasVar('pass', 'POST')) {
77
+		$uname = Request::getString('uname', '', 'POST');
78
+		$pass  = Request::getString('pass', '', 'POST');
79
+		/** @var \XoopsMemberHandler $memberHandler */
80
+		$memberHandler = xoops_getHandler('member');
81
+		$user          = $memberHandler->loginUser($uname, $pass);
82
+		if (is_object($user) && 0 < $user->getVar('level')) {
83
+			if (Request::getString('login', '', 'POST')) {
84
+				$user->setVar('last_login', time());
85
+				if (!$memberHandler->insertUser($user)) {
86
+				}
87
+				$_SESSION                    = [];
88
+				$_SESSION['xoopsUserId']     = $user->getVar('uid');
89
+				$_SESSION['xoopsUserGroups'] = $user->getGroups();
90
+				if ($GLOBALS['xoopsConfig']['use_mysession'] && '' !== $GLOBALS['xoopsConfig']['session_name']) {
91
+					setcookie($GLOBALS['xoopsConfig']['session_name'], session_id(), time() + (60 * $GLOBALS['xoopsConfig']['session_expire']), '/', '', 0);
92
+				}
93
+				$user_theme = $user->getVar('theme');
94
+				if (in_array($user_theme, $GLOBALS['xoopsConfig']['theme_set_allowed'])) {
95
+					$_SESSION['xoopsUserTheme'] = $user_theme;
96
+				}
97
+			}
98
+			$GLOBALS['xoopsUser'] = $user;
99
+			$xoopsUserIsAdmin     = $GLOBALS['xoopsUser']->isAdmin($xoopsModule->getVar('mid'));
100
+		}
101
+	}
102
+	if (!is_object($GLOBALS['xoopsUser'])) {
103
+		xoops_load('captcha');
104
+		$xoopsCaptcha = \XoopsCaptcha::getInstance();
105
+		if (!$xoopsCaptcha->verify()) {
106
+			$captcha_invalid = true;
107
+			$error_message[] = $xoopsCaptcha->getMessage();
108
+		}
109
+	}
110
+
111
+	$isAdmin = newbbIsAdmin($forumObject);
112
+
113
+	$time_valid = true;
114
+	if (!$isAdmin && !empty($GLOBALS['xoopsModuleConfig']['post_timelimit'])) {
115
+		$last_post = newbbGetSession('LP');
116
+		if (time() - $last_post < $GLOBALS['xoopsModuleConfig']['post_timelimit']) {
117
+			$time_valid = false;
118
+		}
119
+	}
120
+
121
+	if ($captcha_invalid || !$token_valid || !$time_valid) {
122
+		$_POST['contents_preview'] = 1;
123
+		$_POST['contents_submit']  = null;
124
+		$_POST['contents_upload']  = null;
125
+		if (!$token_valid) {
126
+			$error_message[] = _MD_NEWBB_INVALID_SUBMIT;
127
+		}
128
+		if (!$time_valid) {
129
+			$error_message[] = sprintf(_MD_NEWBB_POSTING_LIMITED, $GLOBALS['xoopsModuleConfig']['post_timelimit']);
130
+		}
131
+	}
132 132
 }
133 133
 
134 134
 if (Request::getString('contents_submit', '', 'POST')) {
135
-    $message = Request::getText('message', '', 'POST');
136
-    if (empty($message)) {
137
-        // irmtfan - issue with javascript:history.go(-1) - add error message
138
-        redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 1, _MD_NEWBB_ERROR_BACK);
139
-    }
140
-    if (!empty($isedit) && $post_id > 0) {
141
-        $uid = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('uid') : 0;
142
-
143
-        $topic_status = $topicObject->getVar('topic_status');
144
-        if ($topicHandler->getPermission($forumObject, $topic_status, 'edit')
145
-            && ($isAdmin
146
-                || ($postObject->checkTimelimit('edit_timelimit')
147
-                    && $postObject->checkIdentity()))) {
148
-        } else {
149
-            redirect_header(XOOPS_URL . "/modules/newbb/viewtopic.php?forum={$forum_id}&amp;topic_id={$topic_id}&amp;post_id={$post_id}&amp;order={$order}&amp;viewmode={$viewmode}", 2, _MD_NEWBB_NORIGHTTOEDIT);
150
-        }
151
-
152
-        $delete_attach = Request::getArray('delete_attach', [], 'POST');
153
-        if (is_array($delete_attach) && count($delete_attach) > 0) {
154
-            $postObject->deleteAttachment($delete_attach);
155
-        }
156
-    } else {
157
-        if ($topic_id) {
158
-            $topic_status = $topicObject->getVar('topic_status');
159
-            if (!$topicHandler->getPermission($forumObject, $topic_status, 'reply')) {
160
-                redirect_header(XOOPS_URL . "/modules/newbb/viewtopic.php?forum={$forum_id}&amp;topic_id={$topic_id}&amp;post_id={$post_id}&amp;order={$order}&amp;viewmode={$viewmode}", 2, _MD_NEWBB_NORIGHTTOREPLY);
161
-            }
162
-        } else {
163
-            $topic_status = 0;
164
-            if (!$topicHandler->getPermission($forumObject, $topic_status, 'post')) {
165
-                redirect_header(XOOPS_URL . "/modules/newbb/viewtopic.php?forum={$forum_id}", 2, _MD_NEWBB_NORIGHTTOPOST);
166
-            }
167
-        }
168
-
169
-        $isreply = 0;
170
-        $isnew   = 1;
171
-        if (!is_object($GLOBALS['xoopsUser'])
172
-            || (Request::getString('noname', '', 'POST')
173
-                && !empty($GLOBALS['xoopsModuleConfig']['allow_user_anonymous']))) {
174
-            $uid = 0;
175
-        } else {
176
-            $uid = $GLOBALS['xoopsUser']->getVar('uid');
177
-        }
178
-        if (!empty($pid)) {
179
-            $postObject->setVar('pid', $pid);
180
-        }
181
-        if (!empty($topic_id)) {
182
-            $postObject->setVar('topic_id', $topic_id);
183
-            $isreply = 1;
184
-        }
185
-        $postObject->setVar('poster_ip', Xmf\IPAddress::fromRequest()->asReadable());
186
-        $postObject->setVar('uid', $uid);
187
-        $postObject->setVar('post_time', time());
188
-    }
189
-
190
-    $approved = $topicHandler->getPermission($forumObject, $topic_status, 'noapprove');
191
-    $postObject->setVar('approved', $approved);
192
-
193
-    $postObject->setVar('forum_id', $forumObject->getVar('forum_id'));
194
-
195
-    $subject       = xoops_trim(Request::getString('subject', '', 'POST'));
196
-    $subject       = ('' === $subject) ? _NOTITLE : $subject;
197
-    $poster_name   = xoops_trim(Request::getString('poster_name', '', 'POST'));
198
-    $dohtml        = Request::getInt('dohtml', 0, 'POST')
199
-                     && $topicHandler->getPermission($forumObject, $topic_status, 'html');
200
-    $dosmiley      = Request::getInt('dosmiley', 0, 'POST');
201
-    $doxcode       = Request::getInt('doxcode', 0, 'POST') ? 1 : 0;
202
-    $dobr          = Request::getInt('dobr', 0, 'POST') ? 1 : 0;
203
-    $icon          = (Request::getString('icon', '', 'POST')
204
-                      && is_file($GLOBALS['xoops']->path('images/subject/' . Request::getString('icon', '', 'POST'))) ? Request::getString('icon', '', 'POST') : '');
205
-    $attachsig     = Request::getBool('attachsig', false, 'POST')
206
-                     && $topicHandler->getPermission($forumObject, $topic_status, 'signature');
207
-    $view_require  = Request::getString('view_require', '', 'POST');
208
-    $post_karma    = ('require_karma' === $view_require) ? Request::getInt('post_karma', 0, 'POST') : 0;
209
-    $require_reply = ('require_reply' === $view_require);
210
-    $postObject->setVar('subject', $subject);
211
-    $editwhy = xoops_trim(Request::getString('editwhy', '', 'POST')); // !empty($_POST['editwhy'])) ? xoops_trim($_POST['editwhy']) : "";
212
-
213
-    if ($dohtml && !newbbIsAdmin($forumObject)) {
214
-        //$message=newbb_textFilter($message);
215
-    }
216
-    $postObject->setVar('post_text', $message);
217
-    $postObject->setVar('post_karma', $post_karma);
218
-    $postObject->setVar('require_reply', $require_reply);
219
-    $postObject->setVar('poster_name', $poster_name);
220
-    $postObject->setVar('dohtml', $dohtml);
221
-    $postObject->setVar('dosmiley', $dosmiley);
222
-    $postObject->setVar('doxcode', $doxcode);
223
-    $postObject->setVar('dobr', $dobr);
224
-    $postObject->setVar('icon', $icon);
225
-    $postObject->setVar('attachsig', $attachsig);
226
-    $postObject->setAttachment();
227
-    if (!empty($post_id)) {
228
-        $postObject->setPostEdit($poster_name, $editwhy);
229
-    } // is reply
230
-
231
-    //    $attachments_tmp = array();
232
-    //    if (!empty($_POST["attachments_tmp"])) {
233
-    if (Request::getString('attachments_tmp', '', 'POST')) {
234
-        $attachments_tmp = unserialize(base64_decode(Request::getString('attachments_tmp', '', 'POST')));
235
-        if (Request::getArray('delete_tmp', null, 'POST') && count(Request::getArray('delete_tmp', null, 'POST')) > 1) {
236
-            foreach (Request::getArray('delete_tmp', null, 'POST') as $key) {
237
-                unlink($GLOBALS['xoops']->path($GLOBALS['xoopsModuleConfig']['dir_attachments'] . '/' . $attachments_tmp[$key][0]));
238
-                unset($attachments_tmp[$key]);
239
-            }
240
-        }
241
-    }
242
-    if (isset($attachments_tmp) && count($attachments_tmp)) {
243
-        foreach ($attachments_tmp as $key => $attach) {
244
-            if (rename(XOOPS_CACHE_PATH . '/' . $attachments_tmp[$key][0], $GLOBALS['xoops']->path($GLOBALS['xoopsModuleConfig']['dir_attachments'] . '/' . $attachments_tmp[$key][0]))) {
245
-                $postObject->setAttachment($attach[0], $attach[1], $attach[2]);
246
-            }
247
-        }
248
-    }
249
-    $error_upload = '';
250
-
251
-    if (isset($_FILES['userfile']['name']) && '' !== $_FILES['userfile']['name']
252
-        && $topicHandler->getPermission($forumObject, $topic_status, 'attach')) {
135
+	$message = Request::getText('message', '', 'POST');
136
+	if (empty($message)) {
137
+		// irmtfan - issue with javascript:history.go(-1) - add error message
138
+		redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 1, _MD_NEWBB_ERROR_BACK);
139
+	}
140
+	if (!empty($isedit) && $post_id > 0) {
141
+		$uid = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('uid') : 0;
142
+
143
+		$topic_status = $topicObject->getVar('topic_status');
144
+		if ($topicHandler->getPermission($forumObject, $topic_status, 'edit')
145
+			&& ($isAdmin
146
+				|| ($postObject->checkTimelimit('edit_timelimit')
147
+					&& $postObject->checkIdentity()))) {
148
+		} else {
149
+			redirect_header(XOOPS_URL . "/modules/newbb/viewtopic.php?forum={$forum_id}&amp;topic_id={$topic_id}&amp;post_id={$post_id}&amp;order={$order}&amp;viewmode={$viewmode}", 2, _MD_NEWBB_NORIGHTTOEDIT);
150
+		}
151
+
152
+		$delete_attach = Request::getArray('delete_attach', [], 'POST');
153
+		if (is_array($delete_attach) && count($delete_attach) > 0) {
154
+			$postObject->deleteAttachment($delete_attach);
155
+		}
156
+	} else {
157
+		if ($topic_id) {
158
+			$topic_status = $topicObject->getVar('topic_status');
159
+			if (!$topicHandler->getPermission($forumObject, $topic_status, 'reply')) {
160
+				redirect_header(XOOPS_URL . "/modules/newbb/viewtopic.php?forum={$forum_id}&amp;topic_id={$topic_id}&amp;post_id={$post_id}&amp;order={$order}&amp;viewmode={$viewmode}", 2, _MD_NEWBB_NORIGHTTOREPLY);
161
+			}
162
+		} else {
163
+			$topic_status = 0;
164
+			if (!$topicHandler->getPermission($forumObject, $topic_status, 'post')) {
165
+				redirect_header(XOOPS_URL . "/modules/newbb/viewtopic.php?forum={$forum_id}", 2, _MD_NEWBB_NORIGHTTOPOST);
166
+			}
167
+		}
168
+
169
+		$isreply = 0;
170
+		$isnew   = 1;
171
+		if (!is_object($GLOBALS['xoopsUser'])
172
+			|| (Request::getString('noname', '', 'POST')
173
+				&& !empty($GLOBALS['xoopsModuleConfig']['allow_user_anonymous']))) {
174
+			$uid = 0;
175
+		} else {
176
+			$uid = $GLOBALS['xoopsUser']->getVar('uid');
177
+		}
178
+		if (!empty($pid)) {
179
+			$postObject->setVar('pid', $pid);
180
+		}
181
+		if (!empty($topic_id)) {
182
+			$postObject->setVar('topic_id', $topic_id);
183
+			$isreply = 1;
184
+		}
185
+		$postObject->setVar('poster_ip', Xmf\IPAddress::fromRequest()->asReadable());
186
+		$postObject->setVar('uid', $uid);
187
+		$postObject->setVar('post_time', time());
188
+	}
189
+
190
+	$approved = $topicHandler->getPermission($forumObject, $topic_status, 'noapprove');
191
+	$postObject->setVar('approved', $approved);
192
+
193
+	$postObject->setVar('forum_id', $forumObject->getVar('forum_id'));
194
+
195
+	$subject       = xoops_trim(Request::getString('subject', '', 'POST'));
196
+	$subject       = ('' === $subject) ? _NOTITLE : $subject;
197
+	$poster_name   = xoops_trim(Request::getString('poster_name', '', 'POST'));
198
+	$dohtml        = Request::getInt('dohtml', 0, 'POST')
199
+					 && $topicHandler->getPermission($forumObject, $topic_status, 'html');
200
+	$dosmiley      = Request::getInt('dosmiley', 0, 'POST');
201
+	$doxcode       = Request::getInt('doxcode', 0, 'POST') ? 1 : 0;
202
+	$dobr          = Request::getInt('dobr', 0, 'POST') ? 1 : 0;
203
+	$icon          = (Request::getString('icon', '', 'POST')
204
+					  && is_file($GLOBALS['xoops']->path('images/subject/' . Request::getString('icon', '', 'POST'))) ? Request::getString('icon', '', 'POST') : '');
205
+	$attachsig     = Request::getBool('attachsig', false, 'POST')
206
+					 && $topicHandler->getPermission($forumObject, $topic_status, 'signature');
207
+	$view_require  = Request::getString('view_require', '', 'POST');
208
+	$post_karma    = ('require_karma' === $view_require) ? Request::getInt('post_karma', 0, 'POST') : 0;
209
+	$require_reply = ('require_reply' === $view_require);
210
+	$postObject->setVar('subject', $subject);
211
+	$editwhy = xoops_trim(Request::getString('editwhy', '', 'POST')); // !empty($_POST['editwhy'])) ? xoops_trim($_POST['editwhy']) : "";
212
+
213
+	if ($dohtml && !newbbIsAdmin($forumObject)) {
214
+		//$message=newbb_textFilter($message);
215
+	}
216
+	$postObject->setVar('post_text', $message);
217
+	$postObject->setVar('post_karma', $post_karma);
218
+	$postObject->setVar('require_reply', $require_reply);
219
+	$postObject->setVar('poster_name', $poster_name);
220
+	$postObject->setVar('dohtml', $dohtml);
221
+	$postObject->setVar('dosmiley', $dosmiley);
222
+	$postObject->setVar('doxcode', $doxcode);
223
+	$postObject->setVar('dobr', $dobr);
224
+	$postObject->setVar('icon', $icon);
225
+	$postObject->setVar('attachsig', $attachsig);
226
+	$postObject->setAttachment();
227
+	if (!empty($post_id)) {
228
+		$postObject->setPostEdit($poster_name, $editwhy);
229
+	} // is reply
230
+
231
+	//    $attachments_tmp = array();
232
+	//    if (!empty($_POST["attachments_tmp"])) {
233
+	if (Request::getString('attachments_tmp', '', 'POST')) {
234
+		$attachments_tmp = unserialize(base64_decode(Request::getString('attachments_tmp', '', 'POST')));
235
+		if (Request::getArray('delete_tmp', null, 'POST') && count(Request::getArray('delete_tmp', null, 'POST')) > 1) {
236
+			foreach (Request::getArray('delete_tmp', null, 'POST') as $key) {
237
+				unlink($GLOBALS['xoops']->path($GLOBALS['xoopsModuleConfig']['dir_attachments'] . '/' . $attachments_tmp[$key][0]));
238
+				unset($attachments_tmp[$key]);
239
+			}
240
+		}
241
+	}
242
+	if (isset($attachments_tmp) && count($attachments_tmp)) {
243
+		foreach ($attachments_tmp as $key => $attach) {
244
+			if (rename(XOOPS_CACHE_PATH . '/' . $attachments_tmp[$key][0], $GLOBALS['xoops']->path($GLOBALS['xoopsModuleConfig']['dir_attachments'] . '/' . $attachments_tmp[$key][0]))) {
245
+				$postObject->setAttachment($attach[0], $attach[1], $attach[2]);
246
+			}
247
+		}
248
+	}
249
+	$error_upload = '';
250
+
251
+	if (isset($_FILES['userfile']['name']) && '' !== $_FILES['userfile']['name']
252
+		&& $topicHandler->getPermission($forumObject, $topic_status, 'attach')) {
253 253
 //        require_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname', 'n') . '/class/uploader.php');
254
-        $maxfilesize = $forumObject->getVar('attach_maxkb') * 1024;
255
-        $uploaddir   = XOOPS_CACHE_PATH;
256
-
257
-        $uploader = new Newbb\Uploader($uploaddir, $forumObject->getVar('attach_ext'), (int)$maxfilesize, (int)$GLOBALS['xoopsModuleConfig']['max_img_width'], (int)$GLOBALS['xoopsModuleConfig']['max_img_height']);
258
-
259
-        if ($_FILES['userfile']['error'] > 0) {
260
-            switch ($_FILES['userfile']['error']) {
261
-                case 1:
262
-                    $error_message[] = _MD_NEWBB_MAXUPLOADFILEINI;
263
-                    break;
264
-                case 2:
265
-                    $error_message[] = sprintf(_MD_NEWBB_MAXKB, $forumObject->getVar('attach_maxkb'));
266
-                    break;
267
-                default:
268
-                    $error_message[] = _MD_NEWBB_UPLOAD_ERRNODEF;
269
-                    break;
270
-            }
271
-        } else {
272
-            $uploader->setCheckMediaTypeByExt();
273
-            $temp = Request::getArray('xoops_upload_file', [], 'POST');
274
-            if ($uploader->fetchMedia($temp[0])) {
275
-                $prefix = is_object($GLOBALS['xoopsUser']) ? (string)$GLOBALS['xoopsUser']->uid() . '_' : 'newbb_';
276
-                $uploader->setPrefix($prefix);
277
-                if (!$uploader->upload()) {
278
-                    $error_message[] = $error_upload = $uploader->getErrors();
279
-                } else {
280
-                    if (is_file($uploader->getSavedDestination())) {
281
-                        if (rename(XOOPS_CACHE_PATH . '/' . $uploader->getSavedFileName(), $GLOBALS['xoops']->path($GLOBALS['xoopsModuleConfig']['dir_attachments'] . '/' . $uploader->getSavedFileName()))) {
282
-                            $postObject->setAttachment($uploader->getSavedFileName(), $uploader->getMediaName(), $uploader->getMediaType());
283
-                        }
284
-                    }
285
-                }
286
-            } else {
287
-                $error_message[] = $error_upload = $uploader->getErrors();
288
-            }
289
-        }
290
-    }
291
-
292
-    $postid = $postHandler->insert($postObject);
293
-
294
-    if (!$postid) {
295
-        require_once $GLOBALS['xoops']->path('header.php');
296
-        xoops_error($postObject->getErrors());
297
-        require_once $GLOBALS['xoops']->path('footer.php');
298
-    }
299
-    newbbSetSession('LP', time()); // Recording last post time
300
-    $topicObject = $topicHandler->get($postObject->getVar('topic_id'));
301
-    $uid         = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('uid') : 0;
302
-    if (newbbIsAdmin($forumObject)
303
-        || ($topicHandler->getPermission($forumObject, $topic_status, 'type')
304
-            && (0 == $topic_id
305
-                || $uid == $topicObject->getVar('topic_poster')))) {
306
-        $topicObject->setVar('type_id', Request::getInt('type_id', 0, 'POST'));
307
-    }
308
-
309
-    if (!empty($GLOBALS['xoopsModuleConfig']['do_tag']) && $postObject->isTopic()) {
310
-        $topicObject->setVar('topic_tags', Request::getInt('topic_tags', 0, 'POST'));
311
-    }
312
-    $topicHandler->insert($topicObject);
313
-
314
-    // Set read mark
315
-    if (!empty($isnew)) {
316
-        require_once $GLOBALS['xoops']->path('modules/newbb/include/functions.read.php');
317
-        newbbSetRead('topic', $topicObject->getVar('topic_id'), $postid);
318
-        if (!$postObject->getVar('pid')) {
319
-            newbbSetRead('forum', $forumObject->getVar('forum_id'), $postid);
320
-        }
321
-    }
322
-
323
-    //$postObject->loadFilters(empty($isnew) ? 'update' : 'insert');
324
-
325
-    // Define tags for notification message
326
-    if (!empty($isnew) && $approved && !empty($GLOBALS['xoopsModuleConfig']['notification_enabled'])) {
327
-        $tags                = [];
328
-        $tags['THREAD_NAME'] = Request::getString('subject', '', 'POST');
329
-        $tags['THREAD_URL']  = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/viewtopic.php?post_id=' . $postid;
330
-        $tags['POST_URL']    = $tags['THREAD_URL']; // . '#forumpost' . $postid;
331
-        require_once __DIR__ . '/include/notification.inc.php';
332
-        $forum_info         = newbb_notify_iteminfo('forum', $forumObject->getVar('forum_id'));
333
-        $tags['FORUM_NAME'] = $forum_info['name'];
334
-        $tags['FORUM_URL']  = $forum_info['url'];
335
-        /** @var \XoopsNotificationHandler $notificationHandler */
336
-        $notificationHandler = xoops_getHandler('notification');
337
-        if (empty($isreply)) {
338
-            // Notify of new thread
339
-            $notificationHandler->triggerEvent('forum', $forumObject->getVar('forum_id'), 'new_thread', $tags);
340
-        } else {
341
-            // Notify of new post
342
-            $notificationHandler->triggerEvent('thread', $topic_id, 'new_post', $tags);
343
-            $_tags['name'] = $tags['THREAD_NAME'];
344
-            $_tags['url']  = $tags['POST_URL'];
345
-            $_tags['uid']  = $uid;
346
-            $notificationHandler->triggerEvent('thread', $topic_id, 'post', $_tags);
347
-        }
348
-        $notificationHandler->triggerEvent('global', 0, 'new_post', $tags);
349
-        $notificationHandler->triggerEvent('forum', $forumObject->getVar('forum_id'), 'new_post', $tags);
350
-        $tags['POST_CONTENT'] = Request::getString('message', '', 'POST');
351
-        $tags['POST_NAME']    = Request::getString('subject', '', 'POST');
352
-        $notificationHandler->triggerEvent('global', 0, 'new_fullpost', $tags);
353
-        $notificationHandler->triggerEvent('forum', $forumObject->getVar('forum_id'), 'new_fullpost', $tags);
354
-    }
355
-
356
-    // If user checked notification box, subscribe them to the
357
-    // appropriate event; if unchecked, then unsubscribe
358
-    if (!empty($GLOBALS['xoopsUser']) && !empty($GLOBALS['xoopsModuleConfig']['notification_enabled'])) {
359
-        $notificationHandler = xoops_getHandler('notification');
360
-        if (!Request::getInt('notify', 0, 'POST')) {
361
-            $notificationHandler->unsubscribe('thread', $postObject->getVar('topic_id'), 'new_post');
362
-        } elseif (Request::getInt('notify', 0, 'POST') > 0) {
363
-            $notificationHandler->subscribe('thread', $postObject->getVar('topic_id'), 'new_post');
364
-        }
365
-        // elseif ($_POST['notify']<0) keep it as it is
366
-    }
367
-
368
-    if ($approved) {
369
-        if (!empty($GLOBALS['xoopsModuleConfig']['cache_enabled'])) {
370
-            newbbSetSession('t' . $postObject->getVar('topic_id'), null);
371
-        }
372
-        // Update user
373
-        if ($uid > 0) {
374
-            $sql = 'SELECT count(*)' . '    FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . '    WHERE approved=1 AND topic_poster =' . $uid;
375
-            $ret = $GLOBALS['xoopsDB']->query($sql);
376
-            list($topics) = $GLOBALS['xoopsDB']->fetchRow($ret);
377
-
378
-            $sql = '    SELECT count(*)' . '    FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . '    WHERE approved=1 AND topic_digest > 0 AND topic_poster =' . $uid;
379
-            $ret = $GLOBALS['xoopsDB']->query($sql);
380
-            list($digests) = $GLOBALS['xoopsDB']->fetchRow($ret);
381
-
382
-            $sql = '    SELECT count(*), MAX(post_time)' . '    FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . '    WHERE approved=1 AND uid =' . $uid;
383
-            $ret = $GLOBALS['xoopsDB']->query($sql);
384
-            list($posts, $lastpost) = $GLOBALS['xoopsDB']->fetchRow($ret);
385
-
386
-            $GLOBALS['xoopsDB']->queryF('    REPLACE INTO ' . $GLOBALS['xoopsDB']->prefix('newbb_user_stats') . "     SET uid = '{$uid}', user_topics = '{$topics}', user_posts = '{$posts}', user_digests = '{$digests}', user_lastpost = '{$lastpost}'");
387
-        }
388
-
389
-        $redirect = XOOPS_URL . '/modules/newbb/viewtopic.php?post_id=' . $postid;
390
-        $message  = _MD_NEWBB_THANKSSUBMIT . '<br>' . $error_upload;
391
-    } else {
392
-        $redirect = XOOPS_URL . '/modules/newbb/viewforum.php?forum=' . $postObject->getVar('forum_id');
393
-        $message  = _MD_NEWBB_THANKSSUBMIT . '<br>' . _MD_NEWBB_WAITFORAPPROVAL . '<br>' . $error_upload;
394
-    }
395
-
396
-    if ('add' === $op) {
397
-        redirect_header(XOOPS_URL . '/modules/newbb/polls.php?op=add&amp;forum=' . $postObject->getVar('forum_id') . '&amp;topic_id=' . $postObject->getVar('topic_id'), 1, _MD_NEWBB_ADDPOLL);
398
-    } else {
399
-        redirect_header($redirect, 2, $message);
400
-    }
254
+		$maxfilesize = $forumObject->getVar('attach_maxkb') * 1024;
255
+		$uploaddir   = XOOPS_CACHE_PATH;
256
+
257
+		$uploader = new Newbb\Uploader($uploaddir, $forumObject->getVar('attach_ext'), (int)$maxfilesize, (int)$GLOBALS['xoopsModuleConfig']['max_img_width'], (int)$GLOBALS['xoopsModuleConfig']['max_img_height']);
258
+
259
+		if ($_FILES['userfile']['error'] > 0) {
260
+			switch ($_FILES['userfile']['error']) {
261
+				case 1:
262
+					$error_message[] = _MD_NEWBB_MAXUPLOADFILEINI;
263
+					break;
264
+				case 2:
265
+					$error_message[] = sprintf(_MD_NEWBB_MAXKB, $forumObject->getVar('attach_maxkb'));
266
+					break;
267
+				default:
268
+					$error_message[] = _MD_NEWBB_UPLOAD_ERRNODEF;
269
+					break;
270
+			}
271
+		} else {
272
+			$uploader->setCheckMediaTypeByExt();
273
+			$temp = Request::getArray('xoops_upload_file', [], 'POST');
274
+			if ($uploader->fetchMedia($temp[0])) {
275
+				$prefix = is_object($GLOBALS['xoopsUser']) ? (string)$GLOBALS['xoopsUser']->uid() . '_' : 'newbb_';
276
+				$uploader->setPrefix($prefix);
277
+				if (!$uploader->upload()) {
278
+					$error_message[] = $error_upload = $uploader->getErrors();
279
+				} else {
280
+					if (is_file($uploader->getSavedDestination())) {
281
+						if (rename(XOOPS_CACHE_PATH . '/' . $uploader->getSavedFileName(), $GLOBALS['xoops']->path($GLOBALS['xoopsModuleConfig']['dir_attachments'] . '/' . $uploader->getSavedFileName()))) {
282
+							$postObject->setAttachment($uploader->getSavedFileName(), $uploader->getMediaName(), $uploader->getMediaType());
283
+						}
284
+					}
285
+				}
286
+			} else {
287
+				$error_message[] = $error_upload = $uploader->getErrors();
288
+			}
289
+		}
290
+	}
291
+
292
+	$postid = $postHandler->insert($postObject);
293
+
294
+	if (!$postid) {
295
+		require_once $GLOBALS['xoops']->path('header.php');
296
+		xoops_error($postObject->getErrors());
297
+		require_once $GLOBALS['xoops']->path('footer.php');
298
+	}
299
+	newbbSetSession('LP', time()); // Recording last post time
300
+	$topicObject = $topicHandler->get($postObject->getVar('topic_id'));
301
+	$uid         = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('uid') : 0;
302
+	if (newbbIsAdmin($forumObject)
303
+		|| ($topicHandler->getPermission($forumObject, $topic_status, 'type')
304
+			&& (0 == $topic_id
305
+				|| $uid == $topicObject->getVar('topic_poster')))) {
306
+		$topicObject->setVar('type_id', Request::getInt('type_id', 0, 'POST'));
307
+	}
308
+
309
+	if (!empty($GLOBALS['xoopsModuleConfig']['do_tag']) && $postObject->isTopic()) {
310
+		$topicObject->setVar('topic_tags', Request::getInt('topic_tags', 0, 'POST'));
311
+	}
312
+	$topicHandler->insert($topicObject);
313
+
314
+	// Set read mark
315
+	if (!empty($isnew)) {
316
+		require_once $GLOBALS['xoops']->path('modules/newbb/include/functions.read.php');
317
+		newbbSetRead('topic', $topicObject->getVar('topic_id'), $postid);
318
+		if (!$postObject->getVar('pid')) {
319
+			newbbSetRead('forum', $forumObject->getVar('forum_id'), $postid);
320
+		}
321
+	}
322
+
323
+	//$postObject->loadFilters(empty($isnew) ? 'update' : 'insert');
324
+
325
+	// Define tags for notification message
326
+	if (!empty($isnew) && $approved && !empty($GLOBALS['xoopsModuleConfig']['notification_enabled'])) {
327
+		$tags                = [];
328
+		$tags['THREAD_NAME'] = Request::getString('subject', '', 'POST');
329
+		$tags['THREAD_URL']  = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/viewtopic.php?post_id=' . $postid;
330
+		$tags['POST_URL']    = $tags['THREAD_URL']; // . '#forumpost' . $postid;
331
+		require_once __DIR__ . '/include/notification.inc.php';
332
+		$forum_info         = newbb_notify_iteminfo('forum', $forumObject->getVar('forum_id'));
333
+		$tags['FORUM_NAME'] = $forum_info['name'];
334
+		$tags['FORUM_URL']  = $forum_info['url'];
335
+		/** @var \XoopsNotificationHandler $notificationHandler */
336
+		$notificationHandler = xoops_getHandler('notification');
337
+		if (empty($isreply)) {
338
+			// Notify of new thread
339
+			$notificationHandler->triggerEvent('forum', $forumObject->getVar('forum_id'), 'new_thread', $tags);
340
+		} else {
341
+			// Notify of new post
342
+			$notificationHandler->triggerEvent('thread', $topic_id, 'new_post', $tags);
343
+			$_tags['name'] = $tags['THREAD_NAME'];
344
+			$_tags['url']  = $tags['POST_URL'];
345
+			$_tags['uid']  = $uid;
346
+			$notificationHandler->triggerEvent('thread', $topic_id, 'post', $_tags);
347
+		}
348
+		$notificationHandler->triggerEvent('global', 0, 'new_post', $tags);
349
+		$notificationHandler->triggerEvent('forum', $forumObject->getVar('forum_id'), 'new_post', $tags);
350
+		$tags['POST_CONTENT'] = Request::getString('message', '', 'POST');
351
+		$tags['POST_NAME']    = Request::getString('subject', '', 'POST');
352
+		$notificationHandler->triggerEvent('global', 0, 'new_fullpost', $tags);
353
+		$notificationHandler->triggerEvent('forum', $forumObject->getVar('forum_id'), 'new_fullpost', $tags);
354
+	}
355
+
356
+	// If user checked notification box, subscribe them to the
357
+	// appropriate event; if unchecked, then unsubscribe
358
+	if (!empty($GLOBALS['xoopsUser']) && !empty($GLOBALS['xoopsModuleConfig']['notification_enabled'])) {
359
+		$notificationHandler = xoops_getHandler('notification');
360
+		if (!Request::getInt('notify', 0, 'POST')) {
361
+			$notificationHandler->unsubscribe('thread', $postObject->getVar('topic_id'), 'new_post');
362
+		} elseif (Request::getInt('notify', 0, 'POST') > 0) {
363
+			$notificationHandler->subscribe('thread', $postObject->getVar('topic_id'), 'new_post');
364
+		}
365
+		// elseif ($_POST['notify']<0) keep it as it is
366
+	}
367
+
368
+	if ($approved) {
369
+		if (!empty($GLOBALS['xoopsModuleConfig']['cache_enabled'])) {
370
+			newbbSetSession('t' . $postObject->getVar('topic_id'), null);
371
+		}
372
+		// Update user
373
+		if ($uid > 0) {
374
+			$sql = 'SELECT count(*)' . '    FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . '    WHERE approved=1 AND topic_poster =' . $uid;
375
+			$ret = $GLOBALS['xoopsDB']->query($sql);
376
+			list($topics) = $GLOBALS['xoopsDB']->fetchRow($ret);
377
+
378
+			$sql = '    SELECT count(*)' . '    FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . '    WHERE approved=1 AND topic_digest > 0 AND topic_poster =' . $uid;
379
+			$ret = $GLOBALS['xoopsDB']->query($sql);
380
+			list($digests) = $GLOBALS['xoopsDB']->fetchRow($ret);
381
+
382
+			$sql = '    SELECT count(*), MAX(post_time)' . '    FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . '    WHERE approved=1 AND uid =' . $uid;
383
+			$ret = $GLOBALS['xoopsDB']->query($sql);
384
+			list($posts, $lastpost) = $GLOBALS['xoopsDB']->fetchRow($ret);
385
+
386
+			$GLOBALS['xoopsDB']->queryF('    REPLACE INTO ' . $GLOBALS['xoopsDB']->prefix('newbb_user_stats') . "     SET uid = '{$uid}', user_topics = '{$topics}', user_posts = '{$posts}', user_digests = '{$digests}', user_lastpost = '{$lastpost}'");
387
+		}
388
+
389
+		$redirect = XOOPS_URL . '/modules/newbb/viewtopic.php?post_id=' . $postid;
390
+		$message  = _MD_NEWBB_THANKSSUBMIT . '<br>' . $error_upload;
391
+	} else {
392
+		$redirect = XOOPS_URL . '/modules/newbb/viewforum.php?forum=' . $postObject->getVar('forum_id');
393
+		$message  = _MD_NEWBB_THANKSSUBMIT . '<br>' . _MD_NEWBB_WAITFORAPPROVAL . '<br>' . $error_upload;
394
+	}
395
+
396
+	if ('add' === $op) {
397
+		redirect_header(XOOPS_URL . '/modules/newbb/polls.php?op=add&amp;forum=' . $postObject->getVar('forum_id') . '&amp;topic_id=' . $postObject->getVar('topic_id'), 1, _MD_NEWBB_ADDPOLL);
398
+	} else {
399
+		redirect_header($redirect, 2, $message);
400
+	}
401 401
 }
402 402
 
403 403
 $xoopsOption['template_main']                                        = 'newbb_edit_post.tpl';
@@ -409,125 +409,125 @@  discard block
 block discarded – undo
409 409
 //$xoopsTpl->assign('xoops_module_header', $xoops_module_header);
410 410
 
411 411
 if (Request::getString('contents_upload', null, 'POST')) {
412
-    $attachments_tmp = [];
413
-    if (Request::getArray('attachments_tmp', null, 'POST')) {
414
-        $attachments_tmp = unserialize(base64_decode(Request::getArray('attachments_tmp', [], 'POST')));
415
-        if (Request::getArray('delete_tmp', null, 'POST') && count(Request::getArray('delete_tmp', null, 'POST'))) {
416
-            foreach (Request::getArray('delete_tmp', '', 'POST') as $key) {
417
-                unlink($uploaddir = $GLOBALS['xoops']->path($GLOBALS['xoopsModuleConfig']['dir_attachments'] . '/' . $attachments_tmp[$key][0]));
418
-                unset($attachments_tmp[$key]);
419
-            }
420
-        }
421
-    }
422
-
423
-    $error_upload = '';
424
-    if (isset($_FILES['userfile']['name']) && '' !== $_FILES['userfile']['name']) {
412
+	$attachments_tmp = [];
413
+	if (Request::getArray('attachments_tmp', null, 'POST')) {
414
+		$attachments_tmp = unserialize(base64_decode(Request::getArray('attachments_tmp', [], 'POST')));
415
+		if (Request::getArray('delete_tmp', null, 'POST') && count(Request::getArray('delete_tmp', null, 'POST'))) {
416
+			foreach (Request::getArray('delete_tmp', '', 'POST') as $key) {
417
+				unlink($uploaddir = $GLOBALS['xoops']->path($GLOBALS['xoopsModuleConfig']['dir_attachments'] . '/' . $attachments_tmp[$key][0]));
418
+				unset($attachments_tmp[$key]);
419
+			}
420
+		}
421
+	}
422
+
423
+	$error_upload = '';
424
+	if (isset($_FILES['userfile']['name']) && '' !== $_FILES['userfile']['name']) {
425 425
 //        require_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname', 'n') . '/class/uploader.php');
426
-        $maxfilesize = $forumObject->getVar('attach_maxkb') * 1024;
427
-        $uploaddir   = XOOPS_CACHE_PATH;
428
-
429
-        $uploader = new Newbb\Uploader($uploaddir, $forumObject->getVar('attach_ext'), (int)$maxfilesize, (int)$GLOBALS['xoopsModuleConfig']['max_img_width'], (int)$GLOBALS['xoopsModuleConfig']['max_img_height']);
430
-        if ($_FILES['userfile']['error'] > 0) {
431
-            switch ($_FILES['userfile']['error']) {
432
-                case 1:
433
-                    $error_message[] = _MD_NEWBB_MAXUPLOADFILEINI;
434
-                    break;
435
-                case 2:
436
-                    $error_message[] = sprintf(_MD_NEWBB_MAXKB, $forumObject->getVar('attach_maxkb'));
437
-                    break;
438
-                default:
439
-                    $error_message[] = _MD_NEWBB_UPLOAD_ERRNODEF;
440
-                    break;
441
-            }
442
-        } else {
443
-            $uploader->setCheckMediaTypeByExt();
444
-            $temp = Request::getArray('xoops_upload_file', [], 'POST');
445
-            if ($uploader->fetchMedia($temp[0])) {
446
-                $prefix = is_object($GLOBALS['xoopsUser']) ? (string)$GLOBALS['xoopsUser']->uid() . '_' : 'newbb_';
447
-                $uploader->setPrefix($prefix);
448
-                if (!$uploader->upload()) {
449
-                    $error_message[] = $error_upload = $uploader->getErrors();
450
-                } else {
451
-                    if (is_file($uploader->getSavedDestination())) {
452
-                        $attachments_tmp[(string)time()] = [
453
-                            $uploader->getSavedFileName(),
454
-                            $uploader->getMediaName(),
455
-                            $uploader->getMediaType()
456
-                        ];
457
-                    }
458
-                }
459
-            } else {
460
-                $error_message[] = $error_upload = $uploader->getErrors();
461
-            }
462
-        }
463
-    }
426
+		$maxfilesize = $forumObject->getVar('attach_maxkb') * 1024;
427
+		$uploaddir   = XOOPS_CACHE_PATH;
428
+
429
+		$uploader = new Newbb\Uploader($uploaddir, $forumObject->getVar('attach_ext'), (int)$maxfilesize, (int)$GLOBALS['xoopsModuleConfig']['max_img_width'], (int)$GLOBALS['xoopsModuleConfig']['max_img_height']);
430
+		if ($_FILES['userfile']['error'] > 0) {
431
+			switch ($_FILES['userfile']['error']) {
432
+				case 1:
433
+					$error_message[] = _MD_NEWBB_MAXUPLOADFILEINI;
434
+					break;
435
+				case 2:
436
+					$error_message[] = sprintf(_MD_NEWBB_MAXKB, $forumObject->getVar('attach_maxkb'));
437
+					break;
438
+				default:
439
+					$error_message[] = _MD_NEWBB_UPLOAD_ERRNODEF;
440
+					break;
441
+			}
442
+		} else {
443
+			$uploader->setCheckMediaTypeByExt();
444
+			$temp = Request::getArray('xoops_upload_file', [], 'POST');
445
+			if ($uploader->fetchMedia($temp[0])) {
446
+				$prefix = is_object($GLOBALS['xoopsUser']) ? (string)$GLOBALS['xoopsUser']->uid() . '_' : 'newbb_';
447
+				$uploader->setPrefix($prefix);
448
+				if (!$uploader->upload()) {
449
+					$error_message[] = $error_upload = $uploader->getErrors();
450
+				} else {
451
+					if (is_file($uploader->getSavedDestination())) {
452
+						$attachments_tmp[(string)time()] = [
453
+							$uploader->getSavedFileName(),
454
+							$uploader->getMediaName(),
455
+							$uploader->getMediaType()
456
+						];
457
+					}
458
+				}
459
+			} else {
460
+				$error_message[] = $error_upload = $uploader->getErrors();
461
+			}
462
+		}
463
+	}
464 464
 }
465 465
 
466 466
 if (Request::getString('contents_preview', Request::getString('contents_preview', '', 'POST'), 'GET')) {
467
-    if (Request::getString('attachments_tmp', '', 'POST')) {
468
-        $attachments_tmp = unserialize(base64_decode(Request::getString('attachments_tmp', '', 'POST')));
469
-    }
470
-
471
-    $p_subject = $myts->htmlSpecialChars(Request::getString('subject', '', 'POST'));
472
-    $dosmiley  = Request::getInt('dosmiley', 0, 'POST');
473
-    $dohtml    = Request::getInt('dohtml', 0, 'POST');
474
-    $doxcode   = Request::getInt('doxcode', 0, 'POST');
475
-    $dobr      = Request::getInt('dobr', 0, 'POST');
476
-    $p_message = Request::getString('message', '', 'POST');
477
-    $p_message = $myts->previewTarea($p_message, $dohtml, $dosmiley, $doxcode, 1, $dobr);
478
-    $p_date    = formatTimestamp(time());
479
-    if ($postObject->isNew()) {
480
-        if (is_object($GLOBALS['xoopsUser'])) {
481
-            $p_name = $GLOBALS['xoopsUser']->getVar('uname');
482
-            if (!empty($GLOBALS['xoopsModuleConfig']['show_realname']) && $GLOBALS['xoopsUser']->getVar('name')) {
483
-                $p_name = $GLOBALS['xoopsUser']->getVar('name');
484
-            }
485
-        }
486
-    } elseif ($postObject->getVar('uid')) {
487
-        $p_name = newbbGetUnameFromId($postObject->getVar('uid'), $GLOBALS['xoopsModuleConfig']['show_realname']);
488
-    }
489
-    if (empty($p_name)) {
490
-        $p_name = Request::getString('poster_name', '', 'POST') ? htmlspecialchars(Request::getString('poster_name', '', 'POST'), ENT_QUOTES | ENT_HTML5) : htmlspecialchars($GLOBALS['xoopsConfig']['anonymous'], ENT_QUOTES | ENT_HTML5);
491
-    }
492
-
493
-    $post_preview = [
494
-        'subject' => $p_subject,
495
-        'meta'    => _MD_NEWBB_BY . ' ' . $p_name . ' ' . _MD_NEWBB_ON . ' ' . $p_date,
496
-        'content' => $p_message
497
-    ];
498
-    $xoopsTpl->assign_by_ref('post_preview', $post_preview);
467
+	if (Request::getString('attachments_tmp', '', 'POST')) {
468
+		$attachments_tmp = unserialize(base64_decode(Request::getString('attachments_tmp', '', 'POST')));
469
+	}
470
+
471
+	$p_subject = $myts->htmlSpecialChars(Request::getString('subject', '', 'POST'));
472
+	$dosmiley  = Request::getInt('dosmiley', 0, 'POST');
473
+	$dohtml    = Request::getInt('dohtml', 0, 'POST');
474
+	$doxcode   = Request::getInt('doxcode', 0, 'POST');
475
+	$dobr      = Request::getInt('dobr', 0, 'POST');
476
+	$p_message = Request::getString('message', '', 'POST');
477
+	$p_message = $myts->previewTarea($p_message, $dohtml, $dosmiley, $doxcode, 1, $dobr);
478
+	$p_date    = formatTimestamp(time());
479
+	if ($postObject->isNew()) {
480
+		if (is_object($GLOBALS['xoopsUser'])) {
481
+			$p_name = $GLOBALS['xoopsUser']->getVar('uname');
482
+			if (!empty($GLOBALS['xoopsModuleConfig']['show_realname']) && $GLOBALS['xoopsUser']->getVar('name')) {
483
+				$p_name = $GLOBALS['xoopsUser']->getVar('name');
484
+			}
485
+		}
486
+	} elseif ($postObject->getVar('uid')) {
487
+		$p_name = newbbGetUnameFromId($postObject->getVar('uid'), $GLOBALS['xoopsModuleConfig']['show_realname']);
488
+	}
489
+	if (empty($p_name)) {
490
+		$p_name = Request::getString('poster_name', '', 'POST') ? htmlspecialchars(Request::getString('poster_name', '', 'POST'), ENT_QUOTES | ENT_HTML5) : htmlspecialchars($GLOBALS['xoopsConfig']['anonymous'], ENT_QUOTES | ENT_HTML5);
491
+	}
492
+
493
+	$post_preview = [
494
+		'subject' => $p_subject,
495
+		'meta'    => _MD_NEWBB_BY . ' ' . $p_name . ' ' . _MD_NEWBB_ON . ' ' . $p_date,
496
+		'content' => $p_message
497
+	];
498
+	$xoopsTpl->assign_by_ref('post_preview', $post_preview);
499 499
 }
500 500
 
501 501
 if (Request::getString('contents_upload', null, 'POST') || Request::getString('contents_preview', null, 'POST')
502
-    || Request::getString('contents_preview', null, 'GET')
503
-    || Request::getString('editor', '', 'POST')) {
504
-    $editor        = Request::getString('editor', '', 'POST');
505
-    $dosmiley      = Request::getInt('dosmiley', 0, 'POST');
506
-    $dohtml        = Request::getInt('dohtml', 0, 'POST');
507
-    $doxcode       = Request::getInt('doxcode', 0, 'POST');
508
-    $dobr          = Request::getInt('dobr', 0, 'POST');
509
-    $subject       = Request::getString('subject', '', 'POST');
510
-    $message       = Request::getString('message', '', 'POST');
511
-    $poster_name   = Request::getString('poster_name', '', 'POST');
512
-    $hidden        = Request::getString('hidden', '', 'POST');
513
-    $notify        = Request::getInt('notify', 0, 'POST');
514
-    $attachsig     = Request::getInt('attachsig', 0, 'POST');//!empty($_POST['attachsig']) ? 1 : 0;
515
-    $isreply       = Request::getInt('isreply', 0, 'POST'); //!empty($_POST['isreply']) ? 1 : 0;
516
-    $isedit        = Request::getInt('isedit', 0, 'POST'); //!empty($_POST['isedit']) ? 1 : 0;
517
-    $icon          = (Request::getString('icon', '', 'POST')
518
-                      && is_file($GLOBALS['xoops']->path('images/subject/' . Request::getString('icon', '', 'POST'))) ? Request::getString('icon', '', 'POST') : '');
519
-    $view_require  = Request::getString('view_require', '', 'POST');
520
-    $post_karma    = (('require_karma' === $view_require)
521
-                      && !Request::getInt('post_karma', 0, 'POST')) ? Request::getInt('post_karma', 0, 'POST') : 0;
522
-    $require_reply = ('require_reply' === $view_require) ? 1 : 0;
523
-
524
-    if (!Request::getString('contents_upload', '', 'POST')) {
525
-        $contents_preview = 1;
526
-    }
527
-    $attachments = $postObject->getAttachment();
528
-    $xoopsTpl->assign('error_message', implode('<br>', $error_message));
529
-
530
-    require_once __DIR__   . '/include/form.post.php';
502
+	|| Request::getString('contents_preview', null, 'GET')
503
+	|| Request::getString('editor', '', 'POST')) {
504
+	$editor        = Request::getString('editor', '', 'POST');
505
+	$dosmiley      = Request::getInt('dosmiley', 0, 'POST');
506
+	$dohtml        = Request::getInt('dohtml', 0, 'POST');
507
+	$doxcode       = Request::getInt('doxcode', 0, 'POST');
508
+	$dobr          = Request::getInt('dobr', 0, 'POST');
509
+	$subject       = Request::getString('subject', '', 'POST');
510
+	$message       = Request::getString('message', '', 'POST');
511
+	$poster_name   = Request::getString('poster_name', '', 'POST');
512
+	$hidden        = Request::getString('hidden', '', 'POST');
513
+	$notify        = Request::getInt('notify', 0, 'POST');
514
+	$attachsig     = Request::getInt('attachsig', 0, 'POST');//!empty($_POST['attachsig']) ? 1 : 0;
515
+	$isreply       = Request::getInt('isreply', 0, 'POST'); //!empty($_POST['isreply']) ? 1 : 0;
516
+	$isedit        = Request::getInt('isedit', 0, 'POST'); //!empty($_POST['isedit']) ? 1 : 0;
517
+	$icon          = (Request::getString('icon', '', 'POST')
518
+					  && is_file($GLOBALS['xoops']->path('images/subject/' . Request::getString('icon', '', 'POST'))) ? Request::getString('icon', '', 'POST') : '');
519
+	$view_require  = Request::getString('view_require', '', 'POST');
520
+	$post_karma    = (('require_karma' === $view_require)
521
+					  && !Request::getInt('post_karma', 0, 'POST')) ? Request::getInt('post_karma', 0, 'POST') : 0;
522
+	$require_reply = ('require_reply' === $view_require) ? 1 : 0;
523
+
524
+	if (!Request::getString('contents_upload', '', 'POST')) {
525
+		$contents_preview = 1;
526
+	}
527
+	$attachments = $postObject->getAttachment();
528
+	$xoopsTpl->assign('error_message', implode('<br>', $error_message));
529
+
530
+	require_once __DIR__   . '/include/form.post.php';
531 531
 }
532 532
 // irmtfan move to footer.php
533 533
 require_once __DIR__ . '/footer.php';
Please login to merge, or discard this patch.