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

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

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

submit.php 2 locations

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