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 (1 == $xoopsModuleConfig['anonpost']) {
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

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

request.php 1 location

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

submit.php 2 locations

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