Code Duplication    Length = 7-7 lines in 8 locations

class/class.newsstory.php 8 locations

@@ 300-306 (lines=7) @@
297
        $sql .= " ORDER BY s.$order DESC";
298
        $result = $db->query($sql, (int)$limit, (int)$start);
299
300
        while ($myrow = $db->fetchArray($result)) {
301
            if ($asobject) {
302
                $ret[] = new NewsStory($myrow);
303
            } else {
304
                $ret[$myrow['storyid']] = $myts->htmlSpecialChars($myrow['title']);
305
            }
306
        }
307
308
        return $ret;
309
    }
@@ 353-359 (lines=7) @@
350
        }
351
        $sql .= " ORDER BY $order DESC";
352
        $result = $db->query($sql);
353
        while ($myrow = $db->fetchArray($result)) {
354
            if ($asobject) {
355
                $ret[] = new NewsStory($myrow);
356
            } else {
357
                $ret[$myrow['storyid']] = $myts->htmlSpecialChars($myrow['title']);
358
            }
359
        }
360
361
        return $ret;
362
    }
@@ 428-434 (lines=7) @@
425
        }
426
        $sql .= " ORDER BY $order DESC";
427
        $result = $db->query($sql, (int)$limit, (int)$start);
428
        while ($myrow = $db->fetchArray($result)) {
429
            if ($asobject) {
430
                $ret[] = new NewsStory($myrow);
431
            } else {
432
                $ret[$myrow['storyid']] = $myts->htmlSpecialChars($myrow['title']);
433
            }
434
        }
435
436
        return $ret;
437
    }
@@ 544-550 (lines=7) @@
541
542
        $sql .= ' ORDER BY expired DESC';
543
        $result = $db->query($sql, (int)$limit, (int)$start);
544
        while ($myrow = $db->fetchArray($result)) {
545
            if ($asobject) {
546
                $ret[] = new NewsStory($myrow);
547
            } else {
548
                $ret[$myrow['storyid']] = $myts->htmlSpecialChars($myrow['title']);
549
            }
550
        }
551
552
        return $ret;
553
    }
@@ 569-575 (lines=7) @@
566
        $ret    = array();
567
        $sql    = 'SELECT * FROM ' . $db->prefix('news_stories') . ' WHERE published > ' . time() . ' ORDER BY published ASC';
568
        $result = $db->query($sql, (int)$limit, (int)$start);
569
        while ($myrow = $db->fetchArray($result)) {
570
            if ($asobject) {
571
                $ret[] = new NewsStory($myrow);
572
            } else {
573
                $ret[$myrow['storyid']] = $myts->htmlSpecialChars($myrow['title']);
574
            }
575
        }
576
577
        return $ret;
578
    }
@@ 612-618 (lines=7) @@
609
        $sql = 'SELECT s.*, t.* FROM ' . $db->prefix('news_stories') . ' s, ' . $db->prefix('news_topics') . ' t ';
610
        $sql .= ' ' . $criteria->renderWhere() . ' AND (s.topicid=t.topic_id) ORDER BY created DESC';
611
        $result = $db->query($sql, (int)$limit, (int)$start);
612
        while ($myrow = $db->fetchArray($result)) {
613
            if ($asobject) {
614
                $ret[] = new NewsStory($myrow);
615
            } else {
616
                $ret[$myrow['storyid']] = $myts->htmlSpecialChars($myrow['title']);
617
            }
618
        }
619
620
        return $ret;
621
    }
@@ 1142-1148 (lines=7) @@
1139
        }
1140
        $sql .= " ORDER BY $order DESC";
1141
        $result = $this->db->query($sql);
1142
        while ($myrow = $this->db->fetchArray($result)) {
1143
            if ($asobject) {
1144
                $ret[] = new NewsStory($myrow);
1145
            } else {
1146
                $ret[$myrow['storyid']] = $myts->htmlSpecialChars($myrow['title']);
1147
            }
1148
        }
1149
1150
        return $ret;
1151
    }
@@ 1789-1795 (lines=7) @@
1786
        $sql .= " ORDER BY s.$order DESC";
1787
        $result = $db->query($sql, (int)$limit, (int)$start);
1788
1789
        while ($myrow = $db->fetchArray($result)) {
1790
            if ($asobject) {
1791
                $ret[$myrow['storyid']] = new NewsStory($myrow);
1792
            } else {
1793
                $ret[$myrow['storyid']] = $myts->htmlSpecialChars($myrow['title']);
1794
            }
1795
        }
1796
1797
        return $ret;
1798
    }