Code Duplication    Length = 14-14 lines in 4 locations

class/class.newsstory.php 4 locations

@@ 280-293 (lines=14) @@
277
                    return null;
278
                }
279
            }
280
        } else {
281
            if ($checkRight) {
282
                $topics = news_MygetItemIds('news_view');
283
                if (count($topics) > 0) {
284
                    $topics = implode(',', $topics);
285
                    $sql .= ' AND s.topicid IN (' . $topics . ')';
286
                } else {
287
                    return null;
288
                }
289
            }
290
            if ((int)$ihome == 0) {
291
                $sql .= ' AND s.ihome=0';
292
            }
293
        }
294
        if ($topic_frontpage) {
295
            $sql .= ' AND t.topic_frontpage=1';
296
        }
@@ 412-425 (lines=14) @@
409
                    return null;
410
                }
411
            }
412
        } else {
413
            if ($checkRight) {
414
                $topics = news_MygetItemIds('news_view');
415
                if (count($topics) > 0) {
416
                    $topics = implode(',', $topics);
417
                    $sql .= ' AND topicid IN (' . $topics . ')';
418
                } else {
419
                    return null;
420
                }
421
            }
422
            if ((int)$ihome == 0) {
423
                $sql .= ' AND ihome=0';
424
            }
425
        }
426
        $sql .= " ORDER BY $order DESC";
427
        $result = $db->query($sql, (int)$limit, (int)$start);
428
        while ($myrow = $db->fetchArray($result)) {
@@ 699-712 (lines=14) @@
696
               . ' AND (expired = 0 OR expired > '
697
               . time()
698
               . ')';
699
        if (!empty($topicid)) {
700
            $sql .= ' AND topicid=' . (int)$topicid;
701
        } else {
702
            $sql .= ' AND ihome=0';
703
            if ($checkRight) {
704
                $topics = news_MygetItemIds('news_view');
705
                if (count($topics) > 0) {
706
                    $topics = implode(',', $topics);
707
                    $sql .= ' AND topicid IN (' . $topics . ')';
708
                } else {
709
                    return null;
710
                }
711
            }
712
        }
713
        $result = $db->query($sql);
714
        list($count) = $db->fetchRow($result);
715
@@ 1392-1405 (lines=14) @@
1389
                    return null;
1390
                }
1391
            }
1392
        } else {
1393
            if ($checkRight) {
1394
                $topics = news_MygetItemIds('news_view');
1395
                if (count($topics) > 0) {
1396
                    $topics = implode(',', $topics);
1397
                    $sql .= ' AND topicid IN (' . $topics . ')';
1398
                } else {
1399
                    return null;
1400
                }
1401
            }
1402
            if ((int)$ihome == 0) {
1403
                $sql .= ' AND ihome=0';
1404
            }
1405
        }
1406
        if ($topic_frontpage) {
1407
            $sql .= ' AND t.topic_frontpage=1';
1408
        }