Code Duplication    Length = 7-7 lines in 8 locations

class/class.newsstory.php 8 locations

@@ 1684-1690 (lines=7) @@
1681
        $sql    .= " ORDER BY s.$order DESC";
1682
        $result = $db->query($sql, $limit, $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
    }
@@ 265-271 (lines=7) @@
262
        $sql    .= " ORDER BY s.$order DESC";
263
        $result = $db->query($sql, (int)$limit, (int)$start);
264
265
        while ($myrow = $db->fetchArray($result)) {
266
            if ($asobject) {
267
                $ret[] = new NewsStory($myrow);
268
            } else {
269
                $ret[$myrow['storyid']] = $myts->htmlSpecialChars($myrow['title']);
270
            }
271
        }
272
273
        return $ret;
274
    }
@@ 308-314 (lines=7) @@
305
        }
306
        $sql    .= " ORDER BY $order DESC";
307
        $result = $db->query($sql);
308
        while ($myrow = $db->fetchArray($result)) {
309
            if ($asobject) {
310
                $ret[] = new NewsStory($myrow);
311
            } else {
312
                $ret[$myrow['storyid']] = $myts->htmlSpecialChars($myrow['title']);
313
            }
314
        }
315
316
        return $ret;
317
    }
@@ 373-379 (lines=7) @@
370
        }
371
        $sql    .= " ORDER BY $order DESC";
372
        $result = $db->query($sql, (int)$limit, (int)$start);
373
        while ($myrow = $db->fetchArray($result)) {
374
            if ($asobject) {
375
                $ret[] = new NewsStory($myrow);
376
            } else {
377
                $ret[$myrow['storyid']] = $myts->htmlSpecialChars($myrow['title']);
378
            }
379
        }
380
381
        return $ret;
382
    }
@@ 489-495 (lines=7) @@
486
487
        $sql    .= ' ORDER BY expired DESC';
488
        $result = $db->query($sql, (int)$limit, (int)$start);
489
        while ($myrow = $db->fetchArray($result)) {
490
            if ($asobject) {
491
                $ret[] = new NewsStory($myrow);
492
            } else {
493
                $ret[$myrow['storyid']] = $myts->htmlSpecialChars($myrow['title']);
494
            }
495
        }
496
497
        return $ret;
498
    }
@@ 514-520 (lines=7) @@
511
        $ret    = [];
512
        $sql    = 'SELECT * FROM ' . $db->prefix('news_stories') . ' WHERE published > ' . time() . ' ORDER BY published ASC';
513
        $result = $db->query($sql, (int)$limit, (int)$start);
514
        while ($myrow = $db->fetchArray($result)) {
515
            if ($asobject) {
516
                $ret[] = new NewsStory($myrow);
517
            } else {
518
                $ret[$myrow['storyid']] = $myts->htmlSpecialChars($myrow['title']);
519
            }
520
        }
521
522
        return $ret;
523
    }
@@ 557-563 (lines=7) @@
554
        $sql    = 'SELECT s.*, t.* FROM ' . $db->prefix('news_stories') . ' s, ' . $db->prefix('news_topics') . ' t ';
555
        $sql    .= ' ' . $criteria->renderWhere() . ' AND (s.topicid=t.topic_id) ORDER BY created DESC';
556
        $result = $db->query($sql, (int)$limit, (int)$start);
557
        while ($myrow = $db->fetchArray($result)) {
558
            if ($asobject) {
559
                $ret[] = new NewsStory($myrow);
560
            } else {
561
                $ret[$myrow['storyid']] = $myts->htmlSpecialChars($myrow['title']);
562
            }
563
        }
564
565
        return $ret;
566
    }
@@ 1018-1024 (lines=7) @@
1015
        }
1016
        $sql    .= " ORDER BY $order DESC";
1017
        $result = $this->db->query($sql);
1018
        while ($myrow = $this->db->fetchArray($result)) {
1019
            if ($asobject) {
1020
                $ret[] = new NewsStory($myrow);
1021
            } else {
1022
                $ret[$myrow['storyid']] = $myts->htmlSpecialChars($myrow['title']);
1023
            }
1024
        }
1025
1026
        return $ret;
1027
    }