Code Duplication    Length = 9-9 lines in 2 locations

class/class.newsstory.php 1 location

@@ 348-356 (lines=9) @@
345
        $sql   = 'SELECT s.*, t.* FROM ' . $db->prefix('news_stories') . ' s, ' . $db->prefix('news_topics') . ' t WHERE (s.topicid=t.topic_id) AND (published > ' . $tdate . ' AND published < ' . time() . ') AND (expired > ' . time() . ' OR expired = 0) ';
346
347
        if (0 != (int)$topic) {
348
            if (!is_array($topic)) {
349
                $sql .= ' AND topicid=' . (int)$topic . ' AND (ihome=1 OR ihome=0)';
350
            } else {
351
                if (count($topic) > 0) {
352
                    $sql .= ' AND topicid IN (' . implode(',', $topic) . ')';
353
                } else {
354
                    return null;
355
                }
356
            }
357
        } else {
358
            if ($checkRight) {
359
                $topics = NewsUtility::getMyItemIds('news_view');

class/class.newstopic.php 1 location

@@ 605-613 (lines=9) @@
602
    {
603
        $myts = MyTextSanitizer::getInstance();
604
        $sql  = 'SELECT topic_id, topic_title, topic_imgurl FROM ' . $this->table . ' WHERE ';
605
        if (!is_array($topic)) {
606
            $sql .= ' topic_id=' . (int)$topic;
607
        } else {
608
            if (count($topic) > 0) {
609
                $sql .= ' topic_id IN (' . implode(',', $topic) . ')';
610
            } else {
611
                return null;
612
            }
613
        }
614
        $result = $this->db->query($sql);
615
        while ($row = $this->db->fetchArray($result)) {
616
            $topicstitles[$row['topic_id']] = [