Code Duplication    Length = 8-9 lines in 2 locations

admin/category.php 2 locations

@@ 369-377 (lines=9) @@
366
                // get all links in each subcategory
367
                $result = $GLOBALS['xoopsDB']->query('SELECT lid FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . ' WHERE cid=' . (int)$arr[$i]);
368
                // now for each linkload, delete the text data and vote ata associated with the linkload
369
                while (false !== (list($lid) = $GLOBALS['xoopsDB']->fetchRow($result))) {
370
                    $sql = sprintf('DELETE FROM %s WHERE lid = %u', $GLOBALS['xoopsDB']->prefix('xoopstube_votedata'), (int)$lid);
371
                    $GLOBALS['xoopsDB']->query($sql);
372
                    $sql = sprintf('DELETE FROM %s WHERE lid = %u', $GLOBALS['xoopsDB']->prefix('xoopstube_videos'), (int)$lid);
373
                    $GLOBALS['xoopsDB']->query($sql);
374
375
                    // delete comments
376
                    xoops_comment_delete($xoopsModule->getVar('mid'), $lid);
377
                }
378
                // all links for each subcategory is deleted, now delete the subcategory data
379
                $sql = sprintf('DELETE FROM %s WHERE cid = %u', $GLOBALS['xoopsDB']->prefix('xoopstube_cat'), (int)$arr[$i]);
380
                $GLOBALS['xoopsDB']->query($sql);
@@ 387-394 (lines=8) @@
384
            }
385
            // all subcategory and associated data are deleted, now delete category data and its associated data
386
            $result = $GLOBALS['xoopsDB']->query('SELECT lid FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . ' WHERE cid=' . (int)$cid);
387
            while (false !== (list($lid) = $GLOBALS['xoopsDB']->fetchRow($result))) {
388
                $sql = sprintf('DELETE FROM %s WHERE lid = %u', $GLOBALS['xoopsDB']->prefix('xoopstube_videos'), (int)$lid);
389
                $GLOBALS['xoopsDB']->query($sql);
390
                // delete comments
391
                xoops_comment_delete($xoopsModule->getVar('mid'), (int)$lid);
392
                $sql = sprintf('DELETE FROM %s WHERE lid = %u', $GLOBALS['xoopsDB']->prefix('xoopstube_votedata'), (int)$lid);
393
                $GLOBALS['xoopsDB']->query($sql);
394
            }
395
396
            // delete altcat entries
397
            $sql = sprintf('DELETE FROM %s WHERE cid = %u', $GLOBALS['xoopsDB']->prefix('xoopstube_altcat'), (int)$cid);