Code Duplication    Length = 10-10 lines in 5 locations

admin/question.php 1 location

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

answer.php 1 location

@@ 49-58 (lines=10) @@
46
    Global $faqObj, $xoopsUser, $xoopsConfig, $xoopsModule, $xoopsModuleConfig, $xoopsDB;
47
48
    // If user is anonymous and we don't allow anonymous posting, exit; else, get the uid
49
    if (!$xoopsUser) {
50
        if ($xoopsModuleConfig['anonpost'] == 1) {
51
            $uid = 0;
52
        } else {
53
            redirect_header("index.php", 3, _NOPERM);
54
            exit();
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

@@ 49-58 (lines=10) @@
46
47
    $newFaqObj = $faq_handler->create();
48
49
    if (!$xoopsUser) {
50
        if ($xoopsModuleConfig['anonpost'] == 1) {
51
            $uid = 0;
52
        } else {
53
            redirect_header("index.php", 3, _NOPERM);
54
            exit();
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

@@ 58-67 (lines=10) @@
55
    $answerObj = $answer_handler->create();
56
    $categoryObj = $category_handler->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
            exit();
64
        }
65
    } else {
66
        $uid = $xoopsUser->uid();
67
    }
68
69
    $notifypub = isset($_POST['notifypub'])? $_POST['notifypub'] : 0;
70
@@ 122-131 (lines=10) @@
119
    $newFaqObj = $faq_handler->create();
120
    $newAnswerObj = $answer_handler->create();
121
122
    if (!$xoopsUser) {
123
        if ($xoopsModuleConfig['anonpost'] == 1) {
124
            $uid = 0;
125
        } else {
126
            redirect_header("index.php", 3, _NOPERM);
127
            exit();
128
        }
129
    } else {
130
        $uid = $xoopsUser->uid();
131
    }
132
133
    $notifypub = isset($_POST['notifypub'])? $_POST['notifypub'] : 0;
134