Code Duplication    Length = 5-6 lines in 2 locations

xoops_trust_path/libs/altsys/include/tpls_functions.php 2 locations

@@ 22-26 (lines=5) @@
19
        if ($count <= 0) {
20
            // copy from 'default' to the tplset
21
            $result = $db->query('SELECT * FROM ' . $db->prefix('tplfile') . " WHERE tpl_tplset='default' AND tpl_file='" . addslashes($tpl_file) . "'") ;
22
            while ($row = $db->fetchArray($result)) {
23
                $db->queryF('INSERT INTO ' . $db->prefix('tplfile') . " SET tpl_refid='" . addslashes($row['tpl_refid']) . "',tpl_module='" . addslashes($row['tpl_module']) . "',tpl_tplset='" . addslashes($tplset) . "',tpl_file='" . addslashes($tpl_file) . "',tpl_desc='" . addslashes($row['tpl_desc']) . "',tpl_type='" . addslashes($row['tpl_type']) . "'") ;
24
                $tpl_id = $db->getInsertId() ;
25
                $db->queryF('INSERT INTO ' . $db->prefix('tplsource') . " SET tpl_id='$tpl_id', tpl_source=''") ;
26
            }
27
        }
28
    }
29
@@ 81-86 (lines=6) @@
78
            $db->query('INSERT INTO ' . $db->prefix('tplsource') . " SET tpl_id='$tpl_id', tpl_source='" . addslashes($tpl_source) . "'") ;
79
            altsys_template_touch($tpl_id) ;
80
        } else {
81
            while (list($tpl_id) = $db->fetchRow($drs)) {
82
                // UPDATE mode
83
                $db->query('UPDATE ' . $db->prefix('tplfile') . " SET tpl_refid='" . addslashes($row['tpl_refid']) . "',tpl_desc='" . addslashes($row['tpl_desc']) . "',tpl_lastmodified='" . addslashes($row['tpl_lastmodified']) . "',tpl_lastimported='" . addslashes($row['tpl_lastimported']) . "',tpl_type='" . addslashes($row['tpl_type']) . "' WHERE tpl_id='$tpl_id'") ;
84
                $db->query('UPDATE ' . $db->prefix('tplsource') . " SET tpl_source='" . addslashes($tpl_source) . "' WHERE tpl_id='$tpl_id'") ;
85
                altsys_template_touch($tpl_id) ;
86
            }
87
        }
88
    }
89
}