Code Duplication    Length = 5-5 lines in 12 locations

admin/altcat.php 2 locations

@@ 80-84 (lines=5) @@
77
    case 'save':
78
        // first delete all alternate categories for this topic
79
        $sql = 'DELETE FROM ' . $xoopsDB->prefix('wflinks_altcat') . ' WHERE lid=' . $lid;
80
        if (!$result = $xoopsDB->query($sql)) {
81
            XoopsErrorHandler_HandleError(E_USER_WARNING, $sql, __FILE__, __LINE__);
82
83
            return false;
84
        }
85
86
        $k = array_keys($_REQUEST);
87
        foreach ($k as $sid) {
@@ 90-94 (lines=5) @@
87
        foreach ($k as $sid) {
88
            if (preg_match('/cid-([0-9]*)/', $sid, $cid)) {
89
                $sql = 'INSERT INTO ' . $xoopsDB->prefix('wflinks_altcat') . "(cid, lid) VALUES('" . $cid[1] . "','" . $lid . "')";
90
                if (!$result = $xoopsDB->query($sql)) {
91
                    XoopsErrorHandler_HandleError(E_USER_WARNING, $sql, __FILE__, __LINE__);
92
93
                    return false;
94
                }
95
            }
96
        }
97
        redirect_header('index.php', 1, _AM_WFL_ALTCAT_CREATED);

admin/indexpage.php 2 locations

@@ 37-41 (lines=5) @@
34
        $sql              = 'UPDATE '
35
                            . $xoopsDB->prefix('wflinks_indexpage')
36
                            . " set indexheading='$indexheading', indexheader='$indexheader', indexfooter='$indexfooter', indeximage='$indeximage', indexheaderalign='$indexheaderalign ', indexfooteralign='$indexfooteralign', nohtml='$nohtml', nosmiley='$nosmiley', noxcodes='$noxcodes', noimages='$noimages', nobreak='$nobreak', lastlinksyn='$lastlinksyn', lastlinkstotal='$lastlinkstotal'";
37
        if (!$result = $xoopsDB->query($sql)) {
38
            XoopsErrorHandler_HandleError(E_USER_WARNING, $sql, __FILE__, __LINE__);
39
40
            return false;
41
        }
42
        redirect_header('index.php', 1, _AM_WFL_IPAGE_UPDATED);
43
        break;
44
@@ 47-51 (lines=5) @@
44
45
    default:
46
        $sql = 'SELECT indeximage, indexheading, indexheader, indexfooter, nohtml, nosmiley, noxcodes, noimages, nobreak, indexheaderalign, indexfooteralign, lastlinksyn, lastlinkstotal FROM ' . $xoopsDB->prefix('wflinks_indexpage');
47
        if (!$result = $xoopsDB->query($sql)) {
48
            XoopsErrorHandler_HandleError(E_USER_WARNING, $sql, __FILE__, __LINE__);
49
50
            return false;
51
        }
52
        list($indeximage, $indexheading, $indexheader, $indexfooter, $nohtml, $nosmiley, $noxcodes, $noimages, $nobreak, $indexheaderalign, $indexfooteralign, $lastlinksyn, $lastlinkstotal) = $xoopsDB->fetchRow($result);
53
54
        xoops_cp_header();

admin/newlinks.php 2 locations

@@ 23-27 (lines=5) @@
20
21
        global $xoopsModule;
22
        $sql = 'SELECT cid, title, notifypub FROM ' . $xoopsDB->prefix('wflinks_links') . ' WHERE lid=' . $lid;
23
        if (!$result = $xoopsDB->query($sql)) {
24
            XoopsErrorHandler_HandleError(E_USER_WARNING, $sql, __FILE__, __LINE__);
25
26
            return false;
27
        }
28
        list($cid, $title, $notifypub) = $xoopsDB->fetchRow($result);
29
30
        // Update the database
@@ 63-67 (lines=5) @@
60
        xoops_load('XoopsUserUtility');
61
        $start = WflinksUtility::cleanRequestVars($_REQUEST, 'start', 0);
62
        $sql   = 'SELECT * FROM ' . $xoopsDB->prefix('wflinks_links') . ' WHERE published = 0 ORDER BY lid DESC';
63
        if (!$result = $xoopsDB->query($sql)) {
64
            XoopsErrorHandler_HandleError(E_USER_WARNING, $sql, __FILE__, __LINE__);
65
66
            return false;
67
        }
68
        $new_array       = $xoopsDB->query($sql, $xoopsModuleConfig['admin_perpage'], $start);
69
        $new_array_count = $xoopsDB->getRowsNum($xoopsDB->query($sql));
70

admin/main.php 5 locations

@@ 29-33 (lines=5) @@
26
    global $xoopsDB, $wfmyts, $mytree, $imageArray, $xoopsConfig, $xoopsModuleConfig, $xoopsModule, $xoopsUser;
27
28
    $sql = 'SELECT * FROM ' . $xoopsDB->prefix('wflinks_links') . ' WHERE lid=' . $lid;
29
    if (!$result = $xoopsDB->query($sql)) {
30
        XoopsErrorHandler_HandleError(E_USER_WARNING, $sql, __FILE__, __LINE__);
31
32
        return false;
33
    }
34
    $link_array = $xoopsDB->fetchArray($xoopsDB->query($sql));
35
36
    $directory    = $xoopsModuleConfig['screenshots'];
@@ 408-412 (lines=5) @@
405
            $sql .= ' WHERE cid=' . $cid;
406
        }
407
        $sql .= ' ORDER BY lid DESC';
408
        if (!$result = $xoopsDB->query($sql)) {
409
            XoopsErrorHandler_HandleError(E_USER_WARNING, $sql, __FILE__, __LINE__);
410
411
            return false;
412
        }
413
        $broken_array       = $xoopsDB->query($sql, $xoopsModuleConfig['admin_perpage'], $start);
414
        $broken_array_count = $xoopsDB->getRowsNum($result);
415
@@ 622-626 (lines=5) @@
619
620
            // delete link
621
            $sql = 'DELETE FROM ' . $xoopsDB->prefix('wflinks_links') . ' WHERE lid=' . $lid;
622
            if (!$result = $xoopsDB->query($sql)) {
623
                XoopsErrorHandler_HandleError(E_USER_WARNING, $sql, __FILE__, __LINE__);
624
625
                return false;
626
            }
627
628
            // delete from altcat
629
            $sql = 'DELETE FROM ' . $xoopsDB->prefix('wflinks_altcat') . ' WHERE lid=' . $lid;
@@ 630-634 (lines=5) @@
627
628
            // delete from altcat
629
            $sql = 'DELETE FROM ' . $xoopsDB->prefix('wflinks_altcat') . ' WHERE lid=' . $lid;
630
            if (!$result = $xoopsDB->query($sql)) {
631
                XoopsErrorHandler_HandleError(E_USER_WARNING, $sql, __FILE__, __LINE__);
632
633
                return false;
634
            }
635
636
            // delete vote data
637
            $sql = 'DELETE FROM ' . $xoopsDB->prefix('wflinks_votedata') . ' WHERE lid=' . $lid;
@@ 638-642 (lines=5) @@
635
636
            // delete vote data
637
            $sql = 'DELETE FROM ' . $xoopsDB->prefix('wflinks_votedata') . ' WHERE lid=' . $lid;
638
            if (!$result = $xoopsDB->query($sql)) {
639
                XoopsErrorHandler_HandleError(E_USER_WARNING, $sql, __FILE__, __LINE__);
640
641
                return false;
642
            }
643
644
            // delete comments
645
            xoops_comment_delete($xoopsModule->getVar('mid'), $lid);

admin/category.php 1 location

@@ 315-319 (lines=5) @@
312
                             . $cid;
313
            $database_mess = _AM_WFL_CCATEGORY_MODIFIED;
314
        }
315
        if (!$result = $xoopsDB->query($sql)) {
316
            XoopsErrorHandler_HandleError(E_USER_WARNING, $sql, __FILE__, __LINE__);
317
318
            return false;
319
        }
320
        redirect_header('category.php', 1, $database_mess);
321
        break;
322