| Conditions | 74 |
| Paths | 0 |
| Total Lines | 332 |
| Code Lines | 217 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 6 | ||
| Bugs | 1 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php declare(strict_types=1); |
||
| 169 | public function getAllTopics($forum, array $criteria = null): array |
||
| 170 | { |
||
| 171 | global $myts, $viewAllForums, $xoopsUser; |
||
| 172 | $startdate = 0; |
||
| 173 | $type = ''; |
||
| 174 | $status = ''; |
||
| 175 | $excerpt = 0; |
||
| 176 | $sort = ''; |
||
| 177 | $order = ''; |
||
| 178 | $start = 0; |
||
| 179 | |||
| 180 | require_once $GLOBALS['xoops']->path('modules/newbb/include/functions.render.php'); |
||
| 181 | require_once $GLOBALS['xoops']->path('modules/newbb/include/functions.session.php'); |
||
| 182 | require_once $GLOBALS['xoops']->path('modules/newbb/include/functions.time.php'); |
||
| 183 | require_once $GLOBALS['xoops']->path('modules/newbb/include/functions.read.php'); |
||
| 184 | require_once $GLOBALS['xoops']->path('modules/newbb/include/functions.topic.php'); |
||
| 185 | |||
| 186 | //BigKev73 > Added this to suport the call into the Topic Handler |
||
| 187 | $topicHandler = Helper::getInstance()->getHandler('Topic'); |
||
| 188 | |||
| 189 | $criteria_vars = ['startdate', 'start', 'sort', 'order', 'type', 'status', 'excerpt']; |
||
| 190 | foreach ($criteria_vars as $var) { |
||
| 191 | ${$var} = $criteria[$var]; |
||
| 192 | } |
||
| 193 | |||
| 194 | $topic_lastread = \newbbGetCookie('LT', true); |
||
| 195 | $criteria_forum = ''; |
||
| 196 | if (\is_object($forum)) { |
||
| 197 | $criteria_forum = ' AND t.forum_id = ' . $forum->getVar('forum_id'); |
||
| 198 | $hot_threshold = $forum->getVar('hot_threshold'); |
||
| 199 | } else { |
||
| 200 | $hot_threshold = 10; |
||
| 201 | if ($forum && \is_array($forum)) { |
||
| 202 | $criteria_forum = ' AND t.forum_id IN (' . \implode(',', \array_keys($forum)) . ')'; |
||
| 203 | } elseif (!empty($forum)) { |
||
| 204 | $criteria_forum = ' AND t.forum_id =' . (int)$forum; |
||
| 205 | } |
||
| 206 | } |
||
| 207 | |||
| 208 | $criteria_post = $startdate ? ' p.post_time > ' . $startdate : ' 1 = 1 '; |
||
| 209 | $criteria_topic = empty($type) ? '' : " AND t.type_id={$type}"; |
||
| 210 | $criteria_extra = ''; |
||
| 211 | $criteria_approve = ' AND t.approved = 1'; |
||
| 212 | $post_on = ' p.post_id = t.topic_last_post_id'; |
||
| 213 | $leftjoin = ' LEFT JOIN ' . $this->db->prefix('newbb_posts') . ' p ON p.post_id = t.topic_last_post_id'; |
||
| 214 | $sort_array = []; |
||
| 215 | switch ($status) { |
||
| 216 | case 'digest': |
||
| 217 | $criteria_extra = ' AND t.topic_digest = 1'; |
||
| 218 | break; |
||
| 219 | case 'unreplied': |
||
| 220 | $criteria_extra = ' AND t.topic_replies < 1'; |
||
| 221 | break; |
||
| 222 | case 'unread': |
||
| 223 | if (empty($GLOBALS['xoopsModuleConfig']['read_mode'])) { |
||
| 224 | } elseif (2 == $GLOBALS['xoopsModuleConfig']['read_mode']) { |
||
| 225 | // START irmtfan use read_uid to find the unread posts when the user is logged in |
||
| 226 | $read_uid = \is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('uid') : 0; |
||
| 227 | if (!empty($read_uid)) { |
||
| 228 | $leftjoin .= ' LEFT JOIN ' . $this->db->prefix('newbb_reads_topic') . ' r ON r.read_item = t.topic_id AND r.uid = ' . $read_uid . ' '; |
||
| 229 | $criteria_post .= ' AND (r.read_id IS NULL OR r.post_id < t.topic_last_post_id)'; |
||
| 230 | } |
||
| 231 | // END irmtfan use read_uid to find the unread posts when the user is logged in |
||
| 232 | } elseif (1 == $GLOBALS['xoopsModuleConfig']['read_mode']) { |
||
| 233 | // START irmtfan fix read_mode = 1 bugs - for all users (member and anon) |
||
| 234 | $time_criterion = \max($GLOBALS['last_visit'], $startdate); |
||
| 235 | if ($time_criterion) { |
||
| 236 | $criteria_post = ' p.post_time > ' . $time_criterion; // for all users |
||
| 237 | $topics = []; |
||
| 238 | $topic_lastread = \newbbGetCookie('LT', true); |
||
| 239 | if ((is_countable($topic_lastread) ? \count($topic_lastread) : 0) > 0) { |
||
| 240 | foreach ($topic_lastread as $id => $time) { |
||
| 241 | if ($time > $time_criterion) { |
||
| 242 | $topics[] = $id; |
||
| 243 | } |
||
| 244 | } |
||
| 245 | } |
||
| 246 | if (\count($topics) > 0) { |
||
| 247 | $criteria_extra = ' AND t.topic_id NOT IN (' . \implode(',', $topics) . ')'; |
||
| 248 | } |
||
| 249 | } |
||
| 250 | // END irmtfan fix read_mode = 1 bugs - for all users (member and anon) |
||
| 251 | } |
||
| 252 | break; |
||
| 253 | case 'pending': |
||
| 254 | $post_on = ' p.topic_id = t.topic_id'; |
||
| 255 | $criteria_post .= ' AND p.pid = 0'; |
||
| 256 | $criteria_approve = ' AND t.approved = 0'; |
||
| 257 | break; |
||
| 258 | case 'deleted': |
||
| 259 | $criteria_approve = ' AND t.approved = -1'; |
||
| 260 | break; |
||
| 261 | case 'all': // For viewall.php; do not display sticky topics at first |
||
| 262 | case 'active': // same as "all" |
||
| 263 | break; |
||
| 264 | default: |
||
| 265 | if ($startdate > 0) { |
||
| 266 | $criteria_post = ' (p.post_time > ' . $startdate . ' OR t.topic_sticky=1)'; |
||
| 267 | } |
||
| 268 | $sort_array[] = 't.topic_sticky DESC'; |
||
| 269 | break; |
||
| 270 | } |
||
| 271 | |||
| 272 | $select = 't.*, ' . ' p.post_time as last_post_time, p.poster_name as last_poster_name, p.icon, p.post_id, p.uid'; |
||
| 273 | $from = $this->db->prefix('newbb_topics') . ' t ' . $leftjoin; |
||
| 274 | $where = $criteria_post . $criteria_topic . $criteria_forum . $criteria_extra . $criteria_approve; |
||
| 275 | |||
| 276 | if ($excerpt) { |
||
| 277 | $select .= ', p.post_karma, p.require_reply, pt.post_text'; |
||
| 278 | $from .= ' LEFT JOIN ' . $this->db->prefix('newbb_posts_text') . ' pt ON pt.post_id = t.topic_last_post_id'; |
||
| 279 | } |
||
| 280 | if ('u.uname' === $sort) { |
||
| 281 | $sort = 't.topic_poster'; |
||
| 282 | } |
||
| 283 | |||
| 284 | $sort_array[] = \trim($sort . ' ' . $order); |
||
| 285 | $sortby = \implode(', ', \array_filter($sort_array)); |
||
| 286 | if (empty($sortby)) { |
||
| 287 | $sortby = 't.topic_last_post_id DESC'; |
||
| 288 | } |
||
| 289 | |||
| 290 | $sql = 'SELECT ' . $select . ' FROM ' . $from . ' WHERE ' . $where . ' ORDER BY ' . $sortby; |
||
| 291 | $result = $this->db->query($sql, $GLOBALS['xoopsModuleConfig']['topics_per_page'], $start); |
||
| 292 | if (!$this->db->isResultSet($result)) { |
||
| 293 | \redirect_header('index.php', 2, \_MD_NEWBB_ERROROCCURED); |
||
| 294 | } |
||
| 295 | |||
| 296 | $sticky = 0; |
||
| 297 | $topics = []; |
||
| 298 | $posters = []; |
||
| 299 | $reads = []; |
||
| 300 | $types = []; |
||
| 301 | |||
| 302 | /** @var TypeHandler $typeHandler */ |
||
| 303 | $typeHandler = Helper::getInstance()->getHandler('Type'); |
||
| 304 | $typen = $typeHandler->getByForum($forum->getVar('forum_id')); |
||
| 305 | while (false !== ($myrow = $this->db->fetchArray($result))) { |
||
| 306 | if ($myrow['topic_sticky']) { |
||
| 307 | ++$sticky; |
||
| 308 | } |
||
| 309 | |||
| 310 | // ------------------------------------------------------ |
||
| 311 | // topic_icon: priority: sticky -> digest -> regular |
||
| 312 | |||
| 313 | if ($myrow['topic_haspoll']) { |
||
| 314 | if ($myrow['topic_sticky']) { |
||
| 315 | $topic_icon = \newbbDisplayImage('topic_sticky', \_MD_NEWBB_TOPICSTICKY) . '<br>' . \newbbDisplayImage('poll', \_MD_NEWBB_TOPICHASPOLL); |
||
| 316 | } else { |
||
| 317 | $topic_icon = \newbbDisplayImage('poll', \_MD_NEWBB_TOPICHASPOLL); |
||
| 318 | } |
||
| 319 | } elseif ($myrow['topic_sticky']) { |
||
| 320 | $topic_icon = \newbbDisplayImage('topic_sticky', \_MD_NEWBB_TOPICSTICKY); |
||
| 321 | } elseif (!empty($myrow['icon'])) { |
||
| 322 | $topic_icon = '<img src="' . XOOPS_URL . '/images/subject/' . \htmlspecialchars((string)$myrow['icon'], \ENT_QUOTES | \ENT_HTML5) . '" alt="" >'; |
||
| 323 | } else { |
||
| 324 | $topic_icon = '<img src="' . XOOPS_URL . '/images/icons/no_posticon.gif" alt="" >'; |
||
| 325 | } |
||
| 326 | |||
| 327 | // ------------------------------------------------------ |
||
| 328 | // rating_img |
||
| 329 | $rating = \number_format($myrow['rating'] / 2, 0); |
||
| 330 | // irmtfan - add alt key for rating |
||
| 331 | if ($rating < 1) { |
||
| 332 | $rating_img = \newbbDisplayImage('blank'); |
||
| 333 | } else { |
||
| 334 | $rating_img = \newbbDisplayImage('rate' . $rating, \constant('_MD_NEWBB_RATE' . $rating)); |
||
| 335 | } |
||
| 336 | // ------------------------------------------------------ |
||
| 337 | // topic_page_jump |
||
| 338 | $topic_page_jump = ''; |
||
| 339 | $topic_page_jump_icon = ''; |
||
| 340 | $totalpages = \ceil(($myrow['topic_replies'] + 1) / $GLOBALS['xoopsModuleConfig']['posts_per_page']); |
||
| 341 | if ($totalpages > 1) { |
||
| 342 | $topic_page_jump .= ' '; |
||
| 343 | $append = false; |
||
| 344 | for ($i = 1; $i <= $totalpages; ++$i) { |
||
| 345 | if ($i > 3 && $i < $totalpages) { |
||
| 346 | if (!$append) { |
||
| 347 | $topic_page_jump .= '...'; |
||
| 348 | $append = true; |
||
| 349 | } |
||
| 350 | } else { |
||
| 351 | //BigKev73 - Made change so link scroll directly to that post |
||
| 352 | $topic_page_jump .= '[<a href="' . XOOPS_URL . '/modules/newbb/viewtopic.php?topic_id=' . $myrow['topic_id'] . '&start=' . (($i - 1) * $GLOBALS['xoopsModuleConfig']['posts_per_page']) . '#forumpost' . $myrow['post_id'] . '">' . $i . '</a>]'; |
||
| 353 | // $topic_page_jump .= '[<a href="' . XOOPS_URL . '/modules/newbb/viewtopic.php?topic_id=' . $myrow['topic_id'] . '&start=' . (($i - 1) * $GLOBALS['xoopsModuleConfig']['posts_per_page']) . '">' . $i . '</a>]'; |
||
| 354 | // irmtfan remove here and move |
||
| 355 | //$topic_page_jump_icon = "<a href='" . XOOPS_URL . "/modules/newbb/viewtopic.php?post_id=" . $myrow['post_id'] . "&start=" . (($i - 1) * $GLOBALS['xoopsModuleConfig']['posts_per_page']) . "'>" . newbbDisplayImage('lastposticon',_MD_NEWBB_GOTOLASTPOST) . '</a>'; |
||
| 356 | } |
||
| 357 | } |
||
| 358 | } |
||
| 359 | // irmtfan - move here for both topics with and without pages |
||
| 360 | $topic_page_jump_icon = "<a href='" . XOOPS_URL . '/modules/newbb/viewtopic.php?topic_id=' . $myrow['topic_id'] . '&post_id=' . $myrow['post_id'] . '#forumpost' . $myrow['post_id'] . "'>" . \newbbDisplayImage('lastposticon', \_MD_NEWBB_GOTOLASTPOST) . '</a>'; |
||
| 361 | |||
| 362 | // ------------------------------------------------------ |
||
| 363 | // => topic array |
||
| 364 | $forum_link = ''; |
||
| 365 | if (!empty($viewAllForums[$myrow['forum_id']])) { |
||
| 366 | $forum_link = '<a href="' . XOOPS_URL . '/modules/newbb/viewforum.php?forum=' . $myrow['forum_id'] . '">' . $viewAllForums[$myrow['forum_id']]['forum_name'] . '</a>'; |
||
| 367 | } |
||
| 368 | |||
| 369 | $topic_title = \htmlspecialchars((string)$myrow['topic_title'], \ENT_QUOTES | \ENT_HTML5); |
||
| 370 | // irmtfan remove here and move to for loop |
||
| 371 | //if ($myrow['type_id'] > 0) { |
||
| 372 | //$topic_title = '<span style="color:'.$typen[$myrow["type_id"]]["type_color"].'">['.$typen[$myrow["type_id"]]["type_name"].']</span> '.$topic_title.''; |
||
| 373 | //} |
||
| 374 | if ($myrow['topic_digest']) { |
||
| 375 | $topic_title = "<span class='digest'>" . $topic_title . '</span>'; |
||
| 376 | } |
||
| 377 | |||
| 378 | if (0 == $excerpt) { |
||
| 379 | $topic_excerpt = ''; |
||
| 380 | } elseif (($myrow['post_karma'] > 0 || $myrow['require_reply'] > 0) && !\newbbIsAdmin($forum)) { |
||
| 381 | $topic_excerpt = ''; |
||
| 382 | } else { |
||
| 383 | $topic_excerpt = \xoops_substr(\newbbHtml2text($myts->displayTarea($myrow['post_text'])), 0, $excerpt); |
||
| 384 | $topic_excerpt = \str_replace('[', '[', \htmlspecialchars((string) $topic_excerpt, \ENT_QUOTES | \ENT_HTML5)); |
||
| 385 | } |
||
| 386 | // START irmtfan move here |
||
| 387 | |||
| 388 | //BigKev73 > Adding this code to support jumping directly to the last read post if that value exists for a user, block also would need to change to support same functionality |
||
| 389 | $topicLink = 'viewtopic.php?topic_id=' . $myrow['topic_id']; |
||
| 390 | |||
| 391 | if ($xoopsUser) { |
||
| 392 | $lastRead = \newbbGetRead('topic', (int)$myrow['topic_id']); |
||
| 393 | if (isset($lastRead)) { |
||
| 394 | if (!empty($lastRead)) { |
||
| 395 | if ($lastRead < $myrow['topic_last_post_id']) { |
||
| 396 | $topicLink = 'viewtopic.php?topic_id=' . $myrow['topic_id'] . '&post_id=' . $lastRead . '#forumpost' . $lastRead; |
||
| 397 | |||
| 398 | //BigKev73 > Adding this code to support jumping to the next post after the LastReadPost, otherwise we could end up on the prior page |
||
| 399 | // if the lastread post is not on the last page and the next new post. Added getNextPostId to topichandler to support this |
||
| 400 | $nextPostID = $topicHandler->getNextPostId((int)$myrow['topic_id'], $lastRead); |
||
| 401 | if (!empty($nextPostID)) { |
||
| 402 | $topicLink = 'viewtopic.php?topic_id=' . $myrow['topic_id'] . '&post_id=' . $nextPostID . '#forumpost' . $nextPostID; |
||
| 403 | print('LastRead=' . $lastRead . ', NextPostID= ' . $nextPostID); |
||
| 404 | } |
||
| 405 | } |
||
| 406 | } |
||
| 407 | } |
||
| 408 | } |
||
| 409 | |||
| 410 | $topics[$myrow['topic_id']] = [ |
||
| 411 | 'topic_id' => $myrow['topic_id'], |
||
| 412 | 'topic_icon' => $topic_icon, |
||
| 413 | 'type_id' => $myrow['type_id'], |
||
| 414 | //'type_text' => $topic_prefix,/*irmtfan remove here and move to for loop*/ |
||
| 415 | 'topic_title' => $topic_title, |
||
| 416 | //'topic_link' => XOOPS_URL . '/modules/newbb/viewtopic.php?topic_id=' . $myrow['topic_id'], |
||
| 417 | //'topic_link' => 'viewtopic.php?topic_id=' . $myrow['topic_id'], |
||
| 418 | 'topic_link' => $topicLink, |
||
| 419 | 'rating_img' => $rating_img, |
||
| 420 | 'topic_page_jump' => $topic_page_jump, |
||
| 421 | 'topic_page_jump_icon' => $topic_page_jump_icon, |
||
| 422 | 'topic_replies' => $myrow['topic_replies'], |
||
| 423 | |||
| 424 | 'topic_digest' => $myrow['topic_digest'], |
||
| 425 | //mb |
||
| 426 | |||
| 427 | 'topic_poster_uid' => $myrow['topic_poster'], |
||
| 428 | 'topic_poster_name' => \htmlspecialchars((string) ((string)$myrow['poster_name'] ?: $GLOBALS['xoopsConfig']['anonymous']), \ENT_QUOTES | \ENT_HTML5), |
||
| 429 | 'topic_views' => $myrow['topic_views'], |
||
| 430 | 'topic_time' => \newbbFormatTimestamp((int)$myrow['topic_time']), |
||
| 431 | 'topic_last_posttime' => \newbbFormatTimestamp((int)$myrow['last_post_time']), |
||
| 432 | 'topic_last_poster_uid' => $myrow['uid'], |
||
| 433 | 'topic_last_poster_name' => \htmlspecialchars((string) ((string)$myrow['last_poster_name'] ?: $GLOBALS['xoopsConfig']['anonymous']), \ENT_QUOTES | \ENT_HTML5), |
||
| 434 | 'topic_forum_link' => $forum_link, |
||
| 435 | 'topic_excerpt' => $topic_excerpt, |
||
| 436 | 'stick' => empty($myrow['topic_sticky']), |
||
| 437 | 'stats' => [ |
||
| 438 | $myrow['topic_status'], |
||
| 439 | $myrow['topic_digest'], |
||
| 440 | $myrow['topic_replies'], |
||
| 441 | ], |
||
| 442 | /* irmtfan uncomment use ib the for loop*/ |
||
| 443 | //"topic_poster" => $topic_poster,/*irmtfan remove here and move to for loop*/ |
||
| 444 | //"topic_last_poster" => $topic_last_poster,/*irmtfan remove here and move to for loop*/ |
||
| 445 | //"topic_folder" => newbbDisplayImage($topic_folder,$topic_folder_text),/*irmtfan remove here and move to for loop*/ |
||
| 446 | ]; |
||
| 447 | // END irmtfan move here |
||
| 448 | /* users */ |
||
| 449 | $posters[$myrow['topic_poster']] = 1; |
||
| 450 | $posters[$myrow['uid']] = 1; |
||
| 451 | // reads |
||
| 452 | if (!empty($GLOBALS['xoopsModuleConfig']['read_mode'])) { |
||
| 453 | $reads[$myrow['topic_id']] = (1 == $GLOBALS['xoopsModuleConfig']['read_mode']) ? $myrow['last_post_time'] : $myrow['topic_last_post_id']; |
||
| 454 | } |
||
| 455 | }// irmtfan while end |
||
| 456 | // START irmtfan move to a for loop |
||
| 457 | $posters_name = \newbbGetUnameFromIds(\array_keys($posters), (bool)$GLOBALS['xoopsModuleConfig']['show_realname'], true); |
||
| 458 | //$topic_poster = newbbGetUnameFromId($myrow['topic_poster'], $GLOBALS['xoopsModuleConfig']['show_realname'], true); |
||
| 459 | //$topic_last_poster = newbbGetUnameFromId($myrow['uid'], $GLOBALS['xoopsModuleConfig']['show_realname'], true); |
||
| 460 | $topic_isRead = \newbbIsRead('topic', $reads); |
||
| 461 | foreach (\array_keys($topics) as $id) { |
||
| 462 | $topics[$id]['topic_read'] = empty($topic_isRead[$id]) ? 0 : 1; // add topic-read/topic-new smarty variable |
||
| 463 | if (!empty($topics[$id]['type_id']) && isset($typen[$topics[$id]['type_id']])) { |
||
| 464 | $topics[$id]['topic_title'] = \getTopicTitle($topics[$id]['topic_title'], $typen[$topics[$id]['type_id']]['type_name'], $typen[$topics[$id]['type_id']]['type_color']); |
||
| 465 | } |
||
| 466 | //$topic_prefix = (!empty($typen[$myrow['type_id']])) ? getTopicTitle("", $typen[$myrow['type_id']]["type_name"], $typen[$myrow['type_id']]["type_color"]) : ""; |
||
| 467 | $topics[$id]['topic_poster'] = !empty($posters_name[$topics[$id]['topic_poster_uid']]) ? $posters_name[$topics[$id]['topic_poster_uid']] : $topics[$id]['topic_poster_name']; |
||
| 468 | $topics[$id]['topic_last_poster'] = !empty($posters_name[$topics[$id]['topic_last_poster_uid']]) ? $posters_name[$topics[$id]['topic_last_poster_uid']] : $topics[$id]['topic_last_poster_name']; |
||
| 469 | |||
| 470 | // ------------------------------------------------------ |
||
| 471 | // topic_folder: priority: newhot -> hot/new -> regular |
||
| 472 | [$topic_status, $topic_digest, $topic_replies] = $topics[$id]['stats']; |
||
| 473 | if (1 == $topic_status) { |
||
| 474 | $topic_folder = 'topic_locked'; |
||
| 475 | $topic_folder_text = \_MD_NEWBB_TOPICLOCKED; |
||
| 476 | } elseif ($topic_digest) { |
||
| 477 | $topic_folder = 'topic_digest'; |
||
| 478 | $topic_folder_text = \_MD_NEWBB_TOPICDIGEST; |
||
| 479 | } elseif ($topic_replies >= $hot_threshold) { |
||
| 480 | $topic_folder = empty($topic_isRead[$id]) ? 'topic_hot_new' : 'topic_hot'; |
||
| 481 | $topic_folder_text = empty($topic_isRead[$id]) ? \_MD_NEWBB_MORETHAN : \_MD_NEWBB_MORETHAN2; |
||
| 482 | } else { |
||
| 483 | $topic_folder = empty($topic_isRead[$id]) ? 'topic_new' : 'topic'; |
||
| 484 | $topic_folder_text = empty($topic_isRead[$id]) ? \_MD_NEWBB_NEWPOSTS : \_MD_NEWBB_NONEWPOSTS; |
||
| 485 | } |
||
| 486 | $topics[$id]['topic_folder'] = \newbbDisplayImage($topic_folder, $topic_folder_text); |
||
| 487 | unset($topics[$id]['topic_poster_name'], $topics[$id]['topic_last_poster_name'], $topics[$id]['stats']); |
||
| 488 | } // irmtfan end for loop |
||
| 489 | // END irmtfan move to a for loop |
||
| 490 | if (\count($topics) > 0) { |
||
| 491 | $sql = ' SELECT DISTINCT topic_id FROM ' . $this->db->prefix('newbb_posts') . " WHERE attachment != ''" . ' AND topic_id IN (' . \implode(',', \array_keys($topics)) . ')'; |
||
| 492 | $result = $this->db->query($sql); |
||
| 493 | if ($this->db->isResultSet($result)) { |
||
| 494 | while ([$topic_id] = $this->db->fetchRow($result)) { |
||
| 495 | $topics[$topic_id]['attachment'] = ' ' . \newbbDisplayImage('attachment', \_MD_NEWBB_TOPICSHASATT); |
||
| 496 | } |
||
| 497 | } |
||
| 498 | } |
||
| 499 | |||
| 500 | return [$topics, $sticky]; |
||
| 501 | } |
||
| 1125 |