| Conditions | 68 | 
| Paths | > 20000 | 
| Total Lines | 303 | 
| Code Lines | 198 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 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 namespace XoopsModules\Newbb;  | 
            ||
| 165 | public function getAllTopics(&$forum, $criteria = null)  | 
            ||
| 166 |     { | 
            ||
| 167 | global $myts, $viewAllForums;  | 
            ||
| 168 | $startdate = '';  | 
            ||
| 169 | |||
| 170 |         require_once $GLOBALS['xoops']->path('modules/newbb/include/functions.render.php'); | 
            ||
| 171 |         require_once $GLOBALS['xoops']->path('modules/newbb/include/functions.session.php'); | 
            ||
| 172 |         require_once $GLOBALS['xoops']->path('modules/newbb/include/functions.time.php'); | 
            ||
| 173 |         require_once $GLOBALS['xoops']->path('modules/newbb/include/functions.read.php'); | 
            ||
| 174 |         require_once $GLOBALS['xoops']->path('modules/newbb/include/functions.topic.php'); | 
            ||
| 175 | |||
| 176 | $criteria_vars = ['startdate', 'start', 'sort', 'order', 'type', 'status', 'excerpt'];  | 
            ||
| 177 |         foreach ($criteria_vars as $var) { | 
            ||
| 178 |             ${$var} = $criteria[$var]; | 
            ||
| 179 | }  | 
            ||
| 180 | |||
| 181 |         $topic_lastread = newbbGetCookie('LT', true); | 
            ||
| 182 | $criteria_forum = '';  | 
            ||
| 183 |         if (is_object($forum)) { | 
            ||
| 184 |             $criteria_forum = ' AND t.forum_id = ' . $forum->getVar('forum_id'); | 
            ||
| 185 |             $hot_threshold  = $forum->getVar('hot_threshold'); | 
            ||
| 186 |         } else { | 
            ||
| 187 | $hot_threshold = 10;  | 
            ||
| 188 |             if (is_array($forum) && count($forum) > 0) { | 
            ||
| 189 |                 $criteria_forum = ' AND t.forum_id IN (' . implode(',', array_keys($forum)) . ')'; | 
            ||
| 190 |             } elseif (!empty($forum)) { | 
            ||
| 191 | $criteria_forum = ' AND t.forum_id =' . (int)$forum;  | 
            ||
| 192 | }  | 
            ||
| 193 | }  | 
            ||
| 194 | |||
| 195 | $criteria_post = $startdate ? ' p.post_time > ' . $startdate : ' 1 = 1 ';  | 
            ||
| 196 |         $criteria_topic   = empty($type) ? '' : " AND t.type_id={$type}"; | 
            ||
| 197 | $criteria_extra = '';  | 
            ||
| 198 | $criteria_approve = ' AND t.approved = 1';  | 
            ||
| 199 | $post_on = ' p.post_id = t.topic_last_post_id';  | 
            ||
| 200 |         $leftjoin         = ' LEFT JOIN ' . $this->db->prefix('newbb_posts') . ' p ON p.post_id = t.topic_last_post_id'; | 
            ||
| 201 | $sort_array = [];  | 
            ||
| 202 |         switch ($status) { | 
            ||
| 203 | case 'digest':  | 
            ||
| 204 | $criteria_extra = ' AND t.topic_digest = 1';  | 
            ||
| 205 | break;  | 
            ||
| 206 | |||
| 207 | case 'unreplied':  | 
            ||
| 208 | $criteria_extra = ' AND t.topic_replies < 1';  | 
            ||
| 209 | break;  | 
            ||
| 210 | |||
| 211 | case 'unread':  | 
            ||
| 212 |                 if (empty($GLOBALS['xoopsModuleConfig']['read_mode'])) { | 
            ||
| 213 |                 } elseif (2 == $GLOBALS['xoopsModuleConfig']['read_mode']) { | 
            ||
| 214 | // START irmtfan use read_uid to find the unread posts when the user is logged in  | 
            ||
| 215 |                     $read_uid = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('uid') : 0; | 
            ||
| 216 |                     if (!empty($read_uid)) { | 
            ||
| 217 |                         $leftjoin      .= ' LEFT JOIN ' . $this->db->prefix('newbb_reads_topic') . ' r ON r.read_item = t.topic_id AND r.uid = ' . $read_uid . ' '; | 
            ||
| 218 | $criteria_post .= ' AND (r.read_id IS NULL OR r.post_id < t.topic_last_post_id)';  | 
            ||
| 219 |                     } else { | 
            ||
| 220 | }  | 
            ||
| 221 | // END irmtfan use read_uid to find the unread posts when the user is logged in  | 
            ||
| 222 |                 } elseif (1 == $GLOBALS['xoopsModuleConfig']['read_mode']) { | 
            ||
| 223 | // START irmtfan fix read_mode = 1 bugs - for all users (member and anon)  | 
            ||
| 224 |                     if ($time_criterion = max($GLOBALS['last_visit'], $startdate)) { | 
            ||
| 225 | $criteria_post = ' p.post_time > ' . $time_criterion; // for all users  | 
            ||
| 226 | $topics = [];  | 
            ||
| 227 |                         $topic_lastread = newbbGetCookie('LT', true); | 
            ||
| 228 |                         if (count($topic_lastread) > 0) { | 
            ||
| 229 |                             foreach ($topic_lastread as $id => $time) { | 
            ||
| 230 |                                 if ($time > $time_criterion) { | 
            ||
| 231 | $topics[] = $id;  | 
            ||
| 232 | }  | 
            ||
| 233 | }  | 
            ||
| 234 | }  | 
            ||
| 235 |                         if (count($topics) > 0) { | 
            ||
| 236 |                             $criteria_extra = ' AND t.topic_id NOT IN (' . implode(',', $topics) . ')'; | 
            ||
| 237 | }  | 
            ||
| 238 | }  | 
            ||
| 239 | // END irmtfan fix read_mode = 1 bugs - for all users (member and anon)  | 
            ||
| 240 | }  | 
            ||
| 241 | break;  | 
            ||
| 242 | case 'pending':  | 
            ||
| 243 | $post_on = ' p.topic_id = t.topic_id';  | 
            ||
| 244 | $criteria_post .= ' AND p.pid = 0';  | 
            ||
| 245 | $criteria_approve = ' AND t.approved = 0';  | 
            ||
| 246 | break;  | 
            ||
| 247 | |||
| 248 | case 'deleted':  | 
            ||
| 249 | $criteria_approve = ' AND t.approved = -1';  | 
            ||
| 250 | break;  | 
            ||
| 251 | |||
| 252 | case 'all': // For viewall.php; do not display sticky topics at first  | 
            ||
| 253 | case 'active': // same as "all"  | 
            ||
| 254 | break;  | 
            ||
| 255 | |||
| 256 | default:  | 
            ||
| 257 |                 if ($startdate > 0) { | 
            ||
| 258 | $criteria_post = ' (p.post_time > ' . $startdate . ' OR t.topic_sticky=1)';  | 
            ||
| 259 | }  | 
            ||
| 260 | $sort_array[] = 't.topic_sticky DESC';  | 
            ||
| 261 | break;  | 
            ||
| 262 | }  | 
            ||
| 263 | |||
| 264 | $select = 't.*, ' . ' p.post_time as last_post_time, p.poster_name as last_poster_name, p.icon, p.post_id, p.uid';  | 
            ||
| 265 |         $from   = $this->db->prefix('newbb_topics') . ' t ' . $leftjoin; | 
            ||
| 266 | $where = $criteria_post . $criteria_topic . $criteria_forum . $criteria_extra . $criteria_approve;  | 
            ||
| 267 | |||
| 268 |         if ($excerpt) { | 
            ||
| 269 | $select .= ', p.post_karma, p.require_reply, pt.post_text';  | 
            ||
| 270 |             $from   .= ' LEFT JOIN ' . $this->db->prefix('newbb_posts_text') . ' pt ON pt.post_id = t.topic_last_post_id'; | 
            ||
| 271 | }  | 
            ||
| 272 |         if ('u.uname' === $sort) { | 
            ||
| 273 | $sort = 't.topic_poster';  | 
            ||
| 274 | }  | 
            ||
| 275 | |||
| 276 | $sort_array[] = trim($sort . ' ' . $order);  | 
            ||
| 277 |         $sortby       = implode(', ', array_filter($sort_array)); | 
            ||
| 278 |         if (empty($sortby)) { | 
            ||
| 279 | $sortby = 't.topic_last_post_id DESC';  | 
            ||
| 280 | }  | 
            ||
| 281 | |||
| 282 | $sql = 'SELECT ' . $select . ' FROM ' . $from . ' WHERE ' . $where . ' ORDER BY ' . $sortby;  | 
            ||
| 283 | |||
| 284 |         if (!$result = $this->db->query($sql, $GLOBALS['xoopsModuleConfig']['topics_per_page'], $start)) { | 
            ||
| 285 |             redirect_header('index.php', 2, _MD_NEWBB_ERROROCCURED); | 
            ||
| 286 | }  | 
            ||
| 287 | |||
| 288 | $sticky = 0;  | 
            ||
| 289 | $topics = [];  | 
            ||
| 290 | $posters = [];  | 
            ||
| 291 | $reads = [];  | 
            ||
| 292 | $types = [];  | 
            ||
| 293 | |||
| 294 | /** @var Newbb\TypeHandler $typeHandler */  | 
            ||
| 295 |         $typeHandler = Newbb\Helper::getInstance()->getHandler('Type'); | 
            ||
| 296 |         $typen       = $typeHandler->getByForum($forum->getVar('forum_id')); | 
            ||
| 297 |        while (false !== ($myrow = $this->db->fetchArray($result))) { | 
            ||
| 298 |             if ($myrow['topic_sticky']) { | 
            ||
| 299 | ++$sticky;  | 
            ||
| 300 | }  | 
            ||
| 301 | |||
| 302 | // ------------------------------------------------------  | 
            ||
| 303 | // topic_icon: priority: sticky -> digest -> regular  | 
            ||
| 304 | |||
| 305 |             if ($myrow['topic_haspoll']) { | 
            ||
| 306 |                 if ($myrow['topic_sticky']) { | 
            ||
| 307 |                     $topic_icon = newbbDisplayImage('topic_sticky', _MD_NEWBB_TOPICSTICKY) . '<br>' . newbbDisplayImage('poll', _MD_NEWBB_TOPICHASPOLL); | 
            ||
| 308 |                 } else { | 
            ||
| 309 |                     $topic_icon = newbbDisplayImage('poll', _MD_NEWBB_TOPICHASPOLL); | 
            ||
| 310 | }  | 
            ||
| 311 |             } elseif ($myrow['topic_sticky']) { | 
            ||
| 312 |                 $topic_icon = newbbDisplayImage('topic_sticky', _MD_NEWBB_TOPICSTICKY); | 
            ||
| 313 |             } elseif (!empty($myrow['icon'])) { | 
            ||
| 314 | $topic_icon = '<img src="' . XOOPS_URL . '/images/subject/' . htmlspecialchars($myrow['icon']) . '" alt="" />';  | 
            ||
| 315 |             } else { | 
            ||
| 316 | $topic_icon = '<img src="' . XOOPS_URL . '/images/icons/no_posticon.gif" alt="" />';  | 
            ||
| 317 | }  | 
            ||
| 318 | |||
| 319 | // ------------------------------------------------------  | 
            ||
| 320 | // rating_img  | 
            ||
| 321 | $rating = number_format($myrow['rating'] / 2, 0);  | 
            ||
| 322 | // irmtfan - add alt key for rating  | 
            ||
| 323 |             if ($rating < 1) { | 
            ||
| 324 |                 $rating_img = newbbDisplayImage('blank'); | 
            ||
| 325 |             } else { | 
            ||
| 326 |                 $rating_img = newbbDisplayImage('rate' . $rating, constant('_MD_NEWBB_RATE' . $rating)); | 
            ||
| 327 | }  | 
            ||
| 328 | // ------------------------------------------------------  | 
            ||
| 329 | // topic_page_jump  | 
            ||
| 330 | $topic_page_jump = '';  | 
            ||
| 331 | $topic_page_jump_icon = '';  | 
            ||
| 332 | $totalpages = ceil(($myrow['topic_replies'] + 1) / $GLOBALS['xoopsModuleConfig']['posts_per_page']);  | 
            ||
| 333 |             if ($totalpages > 1) { | 
            ||
| 334 | $topic_page_jump .= '  ';  | 
            ||
| 335 | $append = false;  | 
            ||
| 336 |                 for ($i = 1; $i <= $totalpages; ++$i) { | 
            ||
| 337 |                     if ($i > 3 && $i < $totalpages) { | 
            ||
| 338 |                         if (!$append) { | 
            ||
| 339 | $topic_page_jump .= '...';  | 
            ||
| 340 | $append = true;  | 
            ||
| 341 | }  | 
            ||
| 342 |                     } else { | 
            ||
| 343 | $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>]';  | 
            ||
| 344 | // irmtfan remove here and move  | 
            ||
| 345 |                         //$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>'; | 
            ||
| 346 | }  | 
            ||
| 347 | }  | 
            ||
| 348 | }  | 
            ||
| 349 | // irmtfan - move here for both topics with and without pages  | 
            ||
| 350 |             $topic_page_jump_icon = "<a href='" . XOOPS_URL . '/modules/newbb/viewtopic.php?post_id=' . $myrow['post_id'] . "'>" . newbbDisplayImage('lastposticon', _MD_NEWBB_GOTOLASTPOST) . '</a>'; | 
            ||
| 351 | |||
| 352 | // ------------------------------------------------------  | 
            ||
| 353 | // => topic array  | 
            ||
| 354 | $forum_link = '';  | 
            ||
| 355 |             if (!empty($viewAllForums[$myrow['forum_id']])) { | 
            ||
| 356 | $forum_link = '<a href="' . XOOPS_URL . '/modules/newbb/viewforum.php?forum=' . $myrow['forum_id'] . '">' . $viewAllForums[$myrow['forum_id']]['forum_name'] . '</a>';  | 
            ||
| 357 | }  | 
            ||
| 358 | |||
| 359 | $topic_title = $myts->htmlSpecialChars($myrow['topic_title']);  | 
            ||
| 360 | // irmtfan remove here and move to for loop  | 
            ||
| 361 |             //if ($myrow['type_id'] > 0) { | 
            ||
| 362 | //$topic_title = '<span style="color:'.$typen[$myrow["type_id"]]["type_color"].'">['.$typen[$myrow["type_id"]]["type_name"].']</span> '.$topic_title.'';  | 
            ||
| 363 | //}  | 
            ||
| 364 |             if ($myrow['topic_digest']) { | 
            ||
| 365 | $topic_title = "<span class='digest'>" . $topic_title . '</span>';  | 
            ||
| 366 | }  | 
            ||
| 367 | |||
| 368 |             if (0 == $excerpt) { | 
            ||
| 369 | $topic_excerpt = '';  | 
            ||
| 370 |             } elseif (($myrow['post_karma'] > 0 || $myrow['require_reply'] > 0) && !newbbIsAdmin($forum)) { | 
            ||
| 371 | $topic_excerpt = '';  | 
            ||
| 372 |             } else { | 
            ||
| 373 | $topic_excerpt = xoops_substr(newbbHtml2text($myts->displayTarea($myrow['post_text'])), 0, $excerpt);  | 
            ||
| 374 |                 $topic_excerpt = str_replace('[', '[', $myts->htmlSpecialChars($topic_excerpt)); | 
            ||
| 375 | }  | 
            ||
| 376 | // START irmtfan move here  | 
            ||
| 377 | $topics[$myrow['topic_id']] = [  | 
            ||
| 378 | 'topic_id' => $myrow['topic_id'],  | 
            ||
| 379 | 'topic_icon' => $topic_icon,  | 
            ||
| 380 | 'type_id' => $myrow['type_id'],  | 
            ||
| 381 | //'type_text' => $topic_prefix,/*irmtfan remove here and move to for loop*/  | 
            ||
| 382 | 'topic_title' => $topic_title,  | 
            ||
| 383 | //'topic_link' => XOOPS_URL . '/modules/newbb/viewtopic.php?topic_id=' . $myrow['topic_id'],  | 
            ||
| 384 | 'topic_link' => 'viewtopic.php?topic_id=' . $myrow['topic_id'],  | 
            ||
| 385 | 'rating_img' => $rating_img,  | 
            ||
| 386 | 'topic_page_jump' => $topic_page_jump,  | 
            ||
| 387 | 'topic_page_jump_icon' => $topic_page_jump_icon,  | 
            ||
| 388 | 'topic_replies' => $myrow['topic_replies'],  | 
            ||
| 389 | |||
| 390 | 'topic_digest' => $myrow['topic_digest'],  | 
            ||
| 391 | //mb  | 
            ||
| 392 | |||
| 393 | 'topic_poster_uid' => $myrow['topic_poster'],  | 
            ||
| 394 | 'topic_poster_name' => $myts->htmlSpecialChars($myrow['poster_name'] ?: $GLOBALS['xoopsConfig']['anonymous']),  | 
            ||
| 395 | 'topic_views' => $myrow['topic_views'],  | 
            ||
| 396 | 'topic_time' => newbbFormatTimestamp($myrow['topic_time']),  | 
            ||
| 397 | 'topic_last_posttime' => newbbFormatTimestamp($myrow['last_post_time']),  | 
            ||
| 398 | 'topic_last_poster_uid' => $myrow['uid'],  | 
            ||
| 399 | 'topic_last_poster_name' => $myts->htmlSpecialChars($myrow['last_poster_name'] ?: $GLOBALS['xoopsConfig']['anonymous']),  | 
            ||
| 400 | 'topic_forum_link' => $forum_link,  | 
            ||
| 401 | 'topic_excerpt' => $topic_excerpt,  | 
            ||
| 402 | 'stick' => empty($myrow['topic_sticky']),  | 
            ||
| 403 | 'stats' => [  | 
            ||
| 404 | $myrow['topic_status'],  | 
            ||
| 405 | $myrow['topic_digest'],  | 
            ||
| 406 | $myrow['topic_replies']  | 
            ||
| 407 | ],  | 
            ||
| 408 | /* irmtfan uncomment use ib the for loop*/  | 
            ||
| 409 | //"topic_poster" => $topic_poster,/*irmtfan remove here and move to for loop*/  | 
            ||
| 410 | //"topic_last_poster" => $topic_last_poster,/*irmtfan remove here and move to for loop*/  | 
            ||
| 411 | //"topic_folder" => newbbDisplayImage($topic_folder,$topic_folder_text),/*irmtfan remove here and move to for loop*/  | 
            ||
| 412 | ];  | 
            ||
| 413 | // END irmtfan move here  | 
            ||
| 414 | /* users */  | 
            ||
| 415 | $posters[$myrow['topic_poster']] = 1;  | 
            ||
| 416 | $posters[$myrow['uid']] = 1;  | 
            ||
| 417 | // reads  | 
            ||
| 418 |             if (!empty($GLOBALS['xoopsModuleConfig']['read_mode'])) { | 
            ||
| 419 | $reads[$myrow['topic_id']] = (1 == $GLOBALS['xoopsModuleConfig']['read_mode']) ? $myrow['last_post_time'] : $myrow['topic_last_post_id'];  | 
            ||
| 420 | }  | 
            ||
| 421 | }// irmtfan while end  | 
            ||
| 422 | // START irmtfan move to a for loop  | 
            ||
| 423 | $posters_name = newbbGetUnameFromIds(array_keys($posters), $GLOBALS['xoopsModuleConfig']['show_realname'], true);  | 
            ||
| 424 | //$topic_poster = newbbGetUnameFromId($myrow['topic_poster'], $GLOBALS['xoopsModuleConfig']['show_realname'], true);  | 
            ||
| 425 | //$topic_last_poster = newbbGetUnameFromId($myrow['uid'], $GLOBALS['xoopsModuleConfig']['show_realname'], true);  | 
            ||
| 426 |         $topic_isRead = newbbIsRead('topic', $reads); | 
            ||
| 427 |         foreach (array_keys($topics) as $id) { | 
            ||
| 428 | $topics[$id]['topic_read'] = empty($topic_isRead[$id]) ? 0 : 1; // add topic-read/topic-new smarty variable  | 
            ||
| 429 |             if (!empty($topics[$id]['type_id']) && isset($typen[$topics[$id]['type_id']])) { | 
            ||
| 430 | $topics[$id]['topic_title'] = getTopicTitle($topics[$id]['topic_title'], $typen[$topics[$id]['type_id']]['type_name'], $typen[$topics[$id]['type_id']]['type_color']);  | 
            ||
| 431 | }  | 
            ||
| 432 |             //$topic_prefix =  (!empty($typen[$myrow['type_id']])) ? getTopicTitle("", $typen[$myrow['type_id']]["type_name"], $typen[$myrow['type_id']]["type_color"]) : ""; | 
            ||
| 433 | $topics[$id]['topic_poster'] = !empty($posters_name[$topics[$id]['topic_poster_uid']]) ? $posters_name[$topics[$id]['topic_poster_uid']] : $topics[$id]['topic_poster_name'];  | 
            ||
| 434 | $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'];  | 
            ||
| 435 | |||
| 436 | // ------------------------------------------------------  | 
            ||
| 437 | // topic_folder: priority: newhot -> hot/new -> regular  | 
            ||
| 438 | list($topic_status, $topic_digest, $topic_replies) = $topics[$id]['stats'];  | 
            ||
| 439 |             if (1 == $topic_status) { | 
            ||
| 440 | $topic_folder = 'topic_locked';  | 
            ||
| 441 | $topic_folder_text = _MD_NEWBB_TOPICLOCKED;  | 
            ||
| 442 |             } else { | 
            ||
| 443 |                 if ($topic_digest) { | 
            ||
| 444 | $topic_folder = 'topic_digest';  | 
            ||
| 445 | $topic_folder_text = _MD_NEWBB_TOPICDIGEST;  | 
            ||
| 446 |                 } elseif ($topic_replies >= $hot_threshold) { | 
            ||
| 447 | $topic_folder = empty($topic_isRead[$id]) ? 'topic_hot_new' : 'topic_hot';  | 
            ||
| 448 | $topic_folder_text = empty($topic_isRead[$id]) ? _MD_NEWBB_MORETHAN : _MD_NEWBB_MORETHAN2;  | 
            ||
| 449 |                 } else { | 
            ||
| 450 | $topic_folder = empty($topic_isRead[$id]) ? 'topic_new' : 'topic';  | 
            ||
| 451 | $topic_folder_text = empty($topic_isRead[$id]) ? _MD_NEWBB_NEWPOSTS : _MD_NEWBB_NONEWPOSTS;  | 
            ||
| 452 | }  | 
            ||
| 453 | }  | 
            ||
| 454 | $topics[$id]['topic_folder'] = newbbDisplayImage($topic_folder, $topic_folder_text);  | 
            ||
| 455 | unset($topics[$id]['topic_poster_name'], $topics[$id]['topic_last_poster_name'], $topics[$id]['stats']);  | 
            ||
| 456 | } // irmtfan end for loop  | 
            ||
| 457 | // END irmtfan move to a for loop  | 
            ||
| 458 |         if (count($topics) > 0) { | 
            ||
| 459 |             $sql = ' SELECT DISTINCT topic_id FROM ' . $this->db->prefix('newbb_posts') . " WHERE attachment != ''" . ' AND topic_id IN (' . implode(',', array_keys($topics)) . ')'; | 
            ||
| 460 |             if ($result = $this->db->query($sql)) { | 
            ||
| 461 |                 while (list($topic_id) = $this->db->fetchRow($result)) { | 
            ||
| 462 |                     $topics[$topic_id]['attachment'] = ' ' . newbbDisplayImage('attachment', _MD_NEWBB_TOPICSHASATT); | 
            ||
| 463 | }  | 
            ||
| 464 | }  | 
            ||
| 465 | }  | 
            ||
| 466 | |||
| 467 | return [$topics, $sticky];  | 
            ||
| 468 | }  | 
            ||
| 1069 | 
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.