Code Duplication    Length = 5-9 lines in 4 locations

ratenews.php 1 location

@@ 88-94 (lines=7) @@
85
86
// 2) Is the story published ?
87
$storyid = 0;
88
if (isset($_GET['storyid'])) {
89
    $storyid = (int)$_GET['storyid'];
90
} else {
91
    if (isset($_POST['storyid'])) {
92
        $storyid = (int)$_POST['storyid'];
93
    }
94
}
95
96
if (!empty($storyid)) {
97
    $article = new NewsStory($storyid);

admin/index.php 1 location

@@ 1997-2001 (lines=5) @@
1994
1995
    case 'delete':
1996
        $storyid = 0;
1997
        if (isset($_GET['storyid'])) {
1998
            $storyid = (int)$_GET['storyid'];
1999
        } elseif (isset($_POST['storyid'])) {
2000
            $storyid = (int)$_POST['storyid'];
2001
        }
2002
2003
        if (!empty($_POST['ok'])) {
2004
            if (empty($storyid)) {

submit.php 2 locations

@@ 189-197 (lines=9) @@
186
    case 'preview':
187
        $topic_id = (int)$_POST['topic_id'];
188
        $xt       = new NewsTopic($topic_id);
189
        if (isset($_GET['storyid'])) {
190
            $storyid = (int)$_GET['storyid'];
191
        } else {
192
            if (isset($_POST['storyid'])) {
193
                $storyid = (int)$_POST['storyid'];
194
            } else {
195
                $storyid = 0;
196
            }
197
        }
198
199
        if (!empty($storyid)) {
200
            $story     = new NewsStory($storyid);
@@ 316-324 (lines=9) @@
313
            $uid = 0;
314
        }
315
316
        if (isset($_GET['storyid'])) {
317
            $storyid = (int)$_GET['storyid'];
318
        } else {
319
            if (isset($_POST['storyid'])) {
320
                $storyid = (int)$_POST['storyid'];
321
            } else {
322
                $storyid = 0;
323
            }
324
        }
325
326
        if (empty($storyid)) {
327
            $story    = new NewsStory();