Code Duplication    Length = 11-11 lines in 2 locations

admin/main.php 1 location

@@ 519-529 (lines=11) @@
516
                        }
517
                    }
518
                }
519
                if ($itemid == null) {
520
                    //That means there was not any value, so a new record should be added to the data table.
521
                    $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_data') . '_dataid_seq');
522
                    $sql   = sprintf("INSERT INTO %s (dataid, itemid, dtypeid, VALUE, created) VALUES (%u, %u, %u, '%s', '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_data'), $newid, $post_itemid, $dtypeid, $post_value, time());
523
                    $xoopsDB->query($sql) or $eh->show('0013');
524
                } else {
525
                    if ($value != $post_value) {
526
                        $sql = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_data') . " SET value = '$post_value' WHERE dtypeid = $dtypeid AND itemid = $itemid";
527
                        $xoopsDB->query($sql) or $eh->show('0013');
528
                    }
529
                }
530
            }
531
532
            $efqlisting        = new efqListing();

edit.php 1 location

@@ 242-252 (lines=11) @@
239
        if ($post_urllink !== '') {
240
            $post_value = $post_urllink . '|' . $post_urltitle;
241
        }
242
        if ($itemid == null) {
243
            //That means there was not any value, so a new record should be added to the data table.
244
            $newid = $xoopsDB->genId($xoopsDB->prefix($module->getVar('dirname', 'n') . '_data') . '_dataid_seq');
245
            $sql   = sprintf("INSERT INTO %s (dataid, itemid, dtypeid, VALUE, created, customtitle) VALUES (%u, %u, %u, '%s', '%s', '%s')", $xoopsDB->prefix($module->getVar('dirname', 'n') . '_data'), $newid, $post_itemid, $dtypeid, $post_value, time(), $post_customtitle);
246
            $xoopsDB->query($sql) or $eh->show('0013');
247
        } else {
248
            if ($value != $post_value) {
249
                $sql = 'UPDATE ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_data') . " SET value = '$post_value', customtitle = '$post_customtitle' WHERE dtypeid = '$dtypeid' AND itemid = '$post_itemid'";
250
                $xoopsDB->query($sql) or $eh->show('0013');
251
            }
252
        }
253
    }
254
    redirect_header("edit.php?item=$post_itemid", 1, _MD_ITEM_UPDATED);
255
    exit();