Code Duplication    Length = 19-19 lines in 2 locations

include/get_selects.php 1 location

@@ 35-53 (lines=19) @@
32
//$userString = '{"relat":"", "partner":"", "gender":"", "politic":"", "religion":""}';
33
$userString = '{"relat":"0", "partner":"", "gender":"0", "politic":"0", "religion":"0"}';
34
35
if ($GLOBALS['xoopsUser'] && ($GLOBALS['xoopsUser'] instanceof \XoopsUser)) {
36
    $swUserHandler = Smallworld\Helper::getInstance()->getHandler('SwUser');
37
    $user          = $swUserHandler->get($GLOBALS['xoopsUser']->uid()); // get the user
38
    if ($user instanceof \XoopsModules\Smallworld\SwUser) {
39
        $userVals      = $user->getValues();
40
        $userString = "{\"relat\":\"{$userVals['relationship']}\", \"partner\":\"{$userVals['partner']}\", \"gender\":\"{$userVals['gender']}\", \"politic\":\"{$userVals['politic']}\", \"religion\":\"{$userVals['religion']}\"}";
41
    }
42
/*
43
    $swDB     = new Smallworld\SwDatabase();
44
    $id       = $GLOBALS['xoopsUser']->uid();
45
    $relat    = $swDB->getVar($id, 'relationship');
46
    $partner  = $swDB->getVar($id, 'partner');
47
    $gender   = $swDB->getVar($id, 'gender');
48
    $politic  = $swDB->getVar($id, 'politic');
49
    $religion = $swDB->getVar($id, 'religion');
50
    header('Content-type: "application/json"');
51
    echo "{\"relat\":\"{$relat}\", \"partner\":\"{$partner}\", \"gender\":\"{$gender}\", \"politic\":\"{$politic}\", \"religion\":\"{$religion}\"}";
52
*/
53
}
54
55
header('Content-type: "application/json"');
56
echo $userString;

include/getSelects.php 1 location

@@ 35-53 (lines=19) @@
32
//$userString = '{"relat":"", "partner":"", "gender":"", "politic":"", "religion":""}';
33
$userString = '{"relat":"0", "partner":"", "gender":"0", "politic":"0", "religion":"0"}';
34
35
if ($GLOBALS['xoopsUser'] && ($GLOBALS['xoopsUser'] instanceof \XoopsUser)) {
36
    $swUserHandler = Smallworld\Helper::getInstance()->getHandler('SwUser');
37
    $user          = $swUserHandler->get($GLOBALS['xoopsUser']->uid()); // get the user
38
    if ($user instanceof \XoopsModules\Smallworld\SwUser) {
39
        $userVals      = $user->getValues();
40
        $userString = "{\"relat\":\"{$userVals['relationship']}\", \"partner\":\"{$userVals['partner']}\", \"gender\":\"{$userVals['gender']}\", \"politic\":\"{$userVals['politic']}\", \"religion\":\"{$userVals['religion']}\"}";
41
    }
42
/*
43
    $swDB     = new Smallworld\SwDatabase();
44
    $id       = $GLOBALS['xoopsUser']->uid();
45
    $relat    = $swDB->getVar($id, 'relationship');
46
    $partner  = $swDB->getVar($id, 'partner');
47
    $gender   = $swDB->getVar($id, 'gender');
48
    $politic  = $swDB->getVar($id, 'politic');
49
    $religion = $swDB->getVar($id, 'religion');
50
    header('Content-type: "application/json"');
51
    echo "{\"relat\":\"{$relat}\", \"partner\":\"{$partner}\", \"gender\":\"{$gender}\", \"politic\":\"{$politic}\", \"religion\":\"{$religion}\"}";
52
*/
53
}
54
55
header('Content-type: "application/json"');
56
echo $userString;