@@ 126-149 (lines=24) @@ | ||
123 | ||
124 | $posts_context = []; |
|
125 | $posts_contextObject = $istopic ? [] : [$postHandler->get($postObject->getVar('pid'))]; |
|
126 | foreach ($posts_contextObject as $post_contextObject) { |
|
127 | if ($GLOBALS['xoopsModuleConfig']['enable_karma'] && $post_contextObject->getVar('post_karma') > 0) { |
|
128 | $p_message = sprintf(_MD_NEWBB_KARMA_REQUIREMENT, '***', $post_contextObject->getVar('post_karma')) . '</div>'; |
|
129 | } elseif ($GLOBALS['xoopsModuleConfig']['allow_require_reply'] && $post_contextObject->getVar('require_reply')) { |
|
130 | $p_message = _MD_NEWBB_REPLY_REQUIREMENT; |
|
131 | } else { |
|
132 | $p_message = $post_contextObject->getVar('post_text'); |
|
133 | } |
|
134 | ||
135 | if ($post_contextObject->getVar('uid')) { |
|
136 | $p_name = newbbGetUnameFromId($post_contextObject->getVar('uid'), $GLOBALS['xoopsModuleConfig']['show_realname']); |
|
137 | } else { |
|
138 | $poster_name = $post_contextObject->getVar('poster_name'); |
|
139 | $p_name = empty($poster_name) ? htmlspecialchars($GLOBALS['xoopsConfig']['anonymous']) : $poster_name; |
|
140 | } |
|
141 | $p_date = formatTimestamp($post_contextObject->getVar('post_time')); |
|
142 | $p_subject = $post_contextObject->getVar('subject'); |
|
143 | ||
144 | $posts_context[] = [ |
|
145 | 'subject' => $p_subject, |
|
146 | 'meta' => _MD_NEWBB_BY . ' ' . $p_name . ' ' . _MD_NEWBB_ON . ' ' . $p_date, |
|
147 | 'content' => $p_message |
|
148 | ]; |
|
149 | } |
|
150 | $xoopsTpl->assign_by_ref('posts_context', $posts_context); |
|
151 | // irmtfan move to footer.php |
|
152 | include_once __DIR__ . '/footer.php'; |
@@ 179-203 (lines=25) @@ | ||
176 | //$posts_contextObject = $postHandler->getByLimit($topic_id, 5); //mb |
|
177 | $posts_contextObject = $postHandler->getByLimit(5, 0, null, null, true, $topic_id, 1); |
|
178 | /** @var \NewbbPost $post_contextObject */ |
|
179 | foreach ($posts_contextObject as $post_contextObject) { |
|
180 | // Sorry, in order to save queries, we have to hide the non-open post_text even if you have replied or have adequate karma, even an admin. |
|
181 | if ($GLOBALS['xoopsModuleConfig']['enable_karma'] && $post_contextObject->getVar('post_karma') > 0) { |
|
182 | $p_message = sprintf(_MD_NEWBB_KARMA_REQUIREMENT, '***', $post_contextObject->getVar('post_karma')) . '</div>'; |
|
183 | } elseif ($GLOBALS['xoopsModuleConfig']['allow_require_reply'] && $post_contextObject->getVar('require_reply')) { |
|
184 | $p_message = _MD_NEWBB_REPLY_REQUIREMENT; |
|
185 | } else { |
|
186 | $p_message = $post_contextObject->getVar('post_text'); |
|
187 | } |
|
188 | ||
189 | if ($post_contextObject->getVar('uid')) { |
|
190 | $p_name = newbbGetUnameFromId($post_contextObject->getVar('uid'), $GLOBALS['xoopsModuleConfig']['show_realname']); |
|
191 | } else { |
|
192 | $poster_name = $post_contextObject->getVar('poster_name'); |
|
193 | $p_name = empty($poster_name) ? htmlspecialchars($GLOBALS['xoopsConfig']['anonymous']) : $poster_name; |
|
194 | } |
|
195 | $p_date = formatTimestamp($post_contextObject->getVar('post_time')); |
|
196 | $p_subject = $post_contextObject->getVar('subject'); |
|
197 | ||
198 | $posts_context[] = [ |
|
199 | 'subject' => $p_subject, |
|
200 | 'meta' => _MD_NEWBB_BY . ' ' . $p_name . ' ' . _MD_NEWBB_ON . ' ' . $p_date, |
|
201 | 'content' => $p_message |
|
202 | ]; |
|
203 | } |
|
204 | $xoopsTpl->assign_by_ref('posts_context', $posts_context); |
|
205 | // irmtfan move to footer.php |
|
206 | include_once __DIR__ . '/footer.php'; |