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);

submit.php 2 locations

@@ 185-193 (lines=9) @@
182
    case 'preview':
183
        $topic_id = (int)$_POST['topic_id'];
184
        $xt       = new NewsTopic($topic_id);
185
        if (isset($_GET['storyid'])) {
186
            $storyid = (int)$_GET['storyid'];
187
        } else {
188
            if (isset($_POST['storyid'])) {
189
                $storyid = (int)$_POST['storyid'];
190
            } else {
191
                $storyid = 0;
192
            }
193
        }
194
195
        if (!empty($storyid)) {
196
            $story     = new NewsStory($storyid);
@@ 307-315 (lines=9) @@
304
            $uid = 0;
305
        }
306
307
        if (isset($_GET['storyid'])) {
308
            $storyid = (int)$_GET['storyid'];
309
        } else {
310
            if (isset($_POST['storyid'])) {
311
                $storyid = (int)$_POST['storyid'];
312
            } else {
313
                $storyid = 0;
314
            }
315
        }
316
317
        if (empty($storyid)) {
318
            $story    = new NewsStory();

admin/index.php 1 location

@@ 1946-1950 (lines=5) @@
1943
1944
    case 'delete':
1945
        $storyid = 0;
1946
        if (isset($_GET['storyid'])) {
1947
            $storyid = (int)$_GET['storyid'];
1948
        } elseif (isset($_POST['storyid'])) {
1949
            $storyid = (int)$_POST['storyid'];
1950
        }
1951
1952
        if (!empty($_POST['ok'])) {
1953
            if (empty($storyid)) {