Code Duplication    Length = 9-9 lines in 5 locations

admin/question.php 1 location

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

answer.php 1 location

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

request.php 1 location

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

submit.php 2 locations

@@ 63-71 (lines=9) @@
60
        $answerObj   = $answerHandler->create();
61
        $categoryObj = $categoryHandler->get($_POST['categoryid']);
62
63
        if (!$xoopsUser) {
64
            if (1 == $xoopsModuleConfig['anonpost']) {
65
                $uid = 0;
66
            } else {
67
                redirect_header('index.php', 3, _NOPERM);
68
            }
69
        } else {
70
            $uid = $xoopsUser->uid();
71
        }
72
73
        $notifypub = isset($_POST['notifypub']) ? $_POST['notifypub'] : 0;
74
@@ 126-134 (lines=9) @@
123
        $newFaqObj    = $faqHandler->create();
124
        $newAnswerObj = $answerHandler->create();
125
126
        if (!$xoopsUser) {
127
            if (1 == $xoopsModuleConfig['anonpost']) {
128
                $uid = 0;
129
            } else {
130
                redirect_header('index.php', 3, _NOPERM);
131
            }
132
        } else {
133
            $uid = $xoopsUser->uid();
134
        }
135
136
        $notifypub = isset($_POST['notifypub']) ? $_POST['notifypub'] : 0;
137