Code Duplication    Length = 15-15 lines in 2 locations

class/Form.php 1 location

@@ 359-373 (lines=15) @@
356
            $result = $GLOBALS['xoopsDB']->queryF($sql);
357
            $i      = $GLOBALS['xoopsDB']->getRowsNum($result);
358
            $v      = [];
359
            if ($i >= 1) {
360
                while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) {
361
                    $v    = unserialize(stripslashes($row['value']));
362
                    $pv   = ('1' == $v['posts']) ? ' checked' : '';
363
                    $cv   = ('1' == $v['comments']) ? ' checked' : '';
364
                    $nv   = ('1' == $v['notify']) ? ' checked' : '';
365
                    $form .= '<input type="checkbox" name="usersettings[]" id="posts" value="' . $v['posts'] . '" ' . $pv . '> ' . _SMALLWORLD_SHOWMYPOSTS . '<br>';
366
                    $form .= '<input type="checkbox" name="usersettings[]" id="comments" value="' . $v['comments'] . '" ' . $cv . '> ' . _SMALLWORLD_SHOWMYCOMMENTS . '<br>';
367
                    $form .= '<input type="checkbox" name="usersettings[]" id="notify" value="' . $v['notify'] . '" ' . $nv . '> ' . _SMALLWORLD_NOTIFYME . '<br>';
368
                }
369
            } else {
370
                $form .= '<input type="checkbox" name="usersettings[]" id="posts" value="0"> ' . _SMALLWORLD_SHOWMYPOSTS . '<br>';
371
                $form .= '<input type="checkbox" name="usersettings[]" id="comments" value="0"> ' . _SMALLWORLD_SHOWMYCOMMENTS . '<br>';
372
                $form .= '<input type="checkbox" name="usersettings[]" id="notify" value="0"> ' . _SMALLWORLD_NOTIFYME . '<br>';
373
            }
374
        }
375
        $form .= "<br><input type='submit' id='smallworld_privsave' value='" . _SMALLWORLD_SUBMIT . "' class='smallworld_finish'>";
376
        $form .= '</form></fieldset></div></div>';

class/SmallWorldForm.php 1 location

@@ 319-333 (lines=15) @@
316
            $result = $xoopsDB->queryF($sql);
317
            $i      = $xoopsDB->getRowsNum($result);
318
            $v      = [];
319
            if ($i >= 1) {
320
                while ($row = $xoopsDB->fetchArray($result)) {
321
                    $v    = unserialize(stripslashes($row['value']));
322
                    $pv   = ('1' == $v['posts']) ? ' checked' : '';
323
                    $cv   = ('1' == $v['comments']) ? ' checked' : '';
324
                    $nv   = ('1' == $v['notify']) ? ' checked' : '';
325
                    $form .= '<input type="checkbox" name="usersettings[]" id="posts" value="' . $v['posts'] . '" ' . $pv . '> ' . _SMALLWORLD_SHOWMYPOSTS . '<br>';
326
                    $form .= '<input type="checkbox" name="usersettings[]" id="comments" value="' . $v['comments'] . '" ' . $cv . '> ' . _SMALLWORLD_SHOWMYCOMMENTS . '<br>';
327
                    $form .= '<input type="checkbox" name="usersettings[]" id="notify" value="' . $v['notify'] . '" ' . $nv . '> ' . _SMALLWORLD_NOTIFYME . '<br>';
328
                }
329
            } else {
330
                $form .= '<input type="checkbox" name="usersettings[]" id="posts" value="0"> ' . _SMALLWORLD_SHOWMYPOSTS . '<br>';
331
                $form .= '<input type="checkbox" name="usersettings[]" id="comments" value="0"> ' . _SMALLWORLD_SHOWMYCOMMENTS . '<br>';
332
                $form .= '<input type="checkbox" name="usersettings[]" id="notify" value="0"> ' . _SMALLWORLD_NOTIFYME . '<br>';
333
            }
334
        }
335
        $form .= "<br><input type='submit' id='smallworld_privsave' value='" . _SMALLWORLD_SUBMIT . "' class='smallworld_finish'>";
336
        $form .= '</form></fieldset></div></div>';