Code Duplication    Length = 9-9 lines in 5 locations

admin/question.php 1 location

@@ 195-203 (lines=9) @@
192
    case 'addfaq':
193
        global $xoopsUser;
194
195
        if (!$xoopsUser) {
196
            if ($xoopsModuleConfig['anonpost'] == 1) {
197
                $uid = 0;
198
            } else {
199
                redirect_header('index.php', 3, _NOPERM);
200
            }
201
        } else {
202
            $uid = $xoopsUser->uid();
203
        }
204
205
        $faqid = isset($_POST['faqid']) ? (int)$_POST['faqid'] : -1;
206

answer.php 1 location

@@ 50-58 (lines=9) @@
47
        global $faqObj, $xoopsUser, $xoopsConfig, $xoopsModule, $xoopsModuleConfig, $xoopsDB;
48
49
        // If user is anonymous and we don't allow anonymous posting, exit; else, get the uid
50
        if (!$xoopsUser) {
51
            if ($xoopsModuleConfig['anonpost'] == 1) {
52
                $uid = 0;
53
            } else {
54
                redirect_header('index.php', 3, _NOPERM);
55
            }
56
        } else {
57
            $uid = $xoopsUser->uid();
58
        }
59
60
        // Creating the FAQ object for the selected FAQ
61
        $faqObj = new sfFaq($faqid);

request.php 1 location

@@ 50-58 (lines=9) @@
47
48
        $newFaqObj = $faqHandler->create();
49
50
        if (!$xoopsUser) {
51
            if ($xoopsModuleConfig['anonpost'] == 1) {
52
                $uid = 0;
53
            } else {
54
                redirect_header('index.php', 3, _NOPERM);
55
            }
56
        } else {
57
            $uid = $xoopsUser->uid();
58
        }
59
60
        // Putting the values about the FAQ in the FAQ object
61
        $newFaqObj->setVar('categoryid', $_POST['categoryid']);

submit.php 2 locations

@@ 53-61 (lines=9) @@
50
        $answerObj   = $answerHandler->create();
51
        $categoryObj = $categoryHandler->get($_POST['categoryid']);
52
53
        if (!$xoopsUser) {
54
            if ($xoopsModuleConfig['anonpost'] == 1) {
55
                $uid = 0;
56
            } else {
57
                redirect_header('index.php', 3, _NOPERM);
58
            }
59
        } else {
60
            $uid = $xoopsUser->uid();
61
        }
62
63
        $notifypub = isset($_POST['notifypub']) ? $_POST['notifypub'] : 0;
64
@@ 116-124 (lines=9) @@
113
        $newFaqObj    = $faqHandler->create();
114
        $newAnswerObj = $answerHandler->create();
115
116
        if (!$xoopsUser) {
117
            if ($xoopsModuleConfig['anonpost'] == 1) {
118
                $uid = 0;
119
            } else {
120
                redirect_header('index.php', 3, _NOPERM);
121
            }
122
        } else {
123
            $uid = $xoopsUser->uid();
124
        }
125
126
        $notifypub = isset($_POST['notifypub']) ? $_POST['notifypub'] : 0;
127