Code Duplication    Length = 7-7 lines in 8 locations

class/class.newsstory.php 8 locations

@@ 286-292 (lines=7) @@
283
        $sql .= " ORDER BY s.$order DESC";
284
        $result = $db->query($sql, (int)$limit, (int)$start);
285
286
        while ($myrow = $db->fetchArray($result)) {
287
            if ($asobject) {
288
                $ret[] = new NewsStory($myrow);
289
            } else {
290
                $ret[$myrow['storyid']] = $myts->htmlSpecialChars($myrow['title']);
291
            }
292
        }
293
294
        return $ret;
295
    }
@@ 334-340 (lines=7) @@
331
        }
332
        $sql .= " ORDER BY $order DESC";
333
        $result = $db->query($sql);
334
        while ($myrow = $db->fetchArray($result)) {
335
            if ($asobject) {
336
                $ret[] = new NewsStory($myrow);
337
            } else {
338
                $ret[$myrow['storyid']] = $myts->htmlSpecialChars($myrow['title']);
339
            }
340
        }
341
342
        return $ret;
343
    }
@@ 402-408 (lines=7) @@
399
        }
400
        $sql .= " ORDER BY $order DESC";
401
        $result = $db->query($sql, (int)$limit, (int)$start);
402
        while ($myrow = $db->fetchArray($result)) {
403
            if ($asobject) {
404
                $ret[] = new NewsStory($myrow);
405
            } else {
406
                $ret[$myrow['storyid']] = $myts->htmlSpecialChars($myrow['title']);
407
            }
408
        }
409
410
        return $ret;
411
    }
@@ 518-524 (lines=7) @@
515
516
        $sql .= ' ORDER BY expired DESC';
517
        $result = $db->query($sql, (int)$limit, (int)$start);
518
        while ($myrow = $db->fetchArray($result)) {
519
            if ($asobject) {
520
                $ret[] = new NewsStory($myrow);
521
            } else {
522
                $ret[$myrow['storyid']] = $myts->htmlSpecialChars($myrow['title']);
523
            }
524
        }
525
526
        return $ret;
527
    }
@@ 543-549 (lines=7) @@
540
        $ret    = array();
541
        $sql    = 'SELECT * FROM ' . $db->prefix('news_stories') . ' WHERE published > ' . time() . ' ORDER BY published ASC';
542
        $result = $db->query($sql, (int)$limit, (int)$start);
543
        while ($myrow = $db->fetchArray($result)) {
544
            if ($asobject) {
545
                $ret[] = new NewsStory($myrow);
546
            } else {
547
                $ret[$myrow['storyid']] = $myts->htmlSpecialChars($myrow['title']);
548
            }
549
        }
550
551
        return $ret;
552
    }
@@ 586-592 (lines=7) @@
583
        $sql = 'SELECT s.*, t.* FROM ' . $db->prefix('news_stories') . ' s, ' . $db->prefix('news_topics') . ' t ';
584
        $sql .= ' ' . $criteria->renderWhere() . ' AND (s.topicid=t.topic_id) ORDER BY created DESC';
585
        $result = $db->query($sql, (int)$limit, (int)$start);
586
        while ($myrow = $db->fetchArray($result)) {
587
            if ($asobject) {
588
                $ret[] = new NewsStory($myrow);
589
            } else {
590
                $ret[$myrow['storyid']] = $myts->htmlSpecialChars($myrow['title']);
591
            }
592
        }
593
594
        return $ret;
595
    }
@@ 1074-1080 (lines=7) @@
1071
        }
1072
        $sql .= " ORDER BY $order DESC";
1073
        $result = $this->db->query($sql);
1074
        while ($myrow = $this->db->fetchArray($result)) {
1075
            if ($asobject) {
1076
                $ret[] = new NewsStory($myrow);
1077
            } else {
1078
                $ret[$myrow['storyid']] = $myts->htmlSpecialChars($myrow['title']);
1079
            }
1080
        }
1081
1082
        return $ret;
1083
    }
@@ 1684-1690 (lines=7) @@
1681
        $sql .= " ORDER BY s.$order DESC";
1682
        $result = $db->query($sql, (int)$limit, (int)$start);
1683
1684
        while ($myrow = $db->fetchArray($result)) {
1685
            if ($asobject) {
1686
                $ret[$myrow['storyid']] = new NewsStory($myrow);
1687
            } else {
1688
                $ret[$myrow['storyid']] = $myts->htmlSpecialChars($myrow['title']);
1689
            }
1690
        }
1691
1692
        return $ret;
1693
    }