Code Duplication    Length = 38-39 lines in 2 locations

admin/blocksadmin.php 2 locations

@@ 283-321 (lines=39) @@
280
        }
281
        $helper->redirect('admin/blocksadmin.php', Constants::REDIRECT_DELAY_MEDIUM, constant('CO_' . $moduleDirNameUpper . '_' . 'UPDATE_SUCCESS'));
282
        break;
283
    case ('clone'):
284
        $bid = Request::getInt('bid', 0);
285
        xoops_cp_header();
286
287
        xoops_loadLanguage('admin', 'system');
288
        xoops_loadLanguage('admin/blocksadmin', 'system');
289
        xoops_loadLanguage('admin/groups', 'system');
290
291
        //        mpu_adm_menu();
292
        $myblock = new \XoopsBlock($bid);
293
        $sql     = 'SELECT module_id FROM ' . $GLOBALS['xoopsDB']->prefix('block_module_link') . ' WHERE block_id=' . (int)$bid;
294
        $result  = $GLOBALS['xoopsDB']->query($sql);
295
        $modules = [];
296
        while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) {
297
            $modules[] = (int)$row['module_id'];
298
        }
299
        $is_custom = ('C' === $myblock->getVar('block_type') || 'E' === $myblock->getVar('block_type'));
300
        $block     = [
301
            'title'      => $myblock->getVar('title') . ' Clone',
302
            'form_title' => constant('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_CLONEBLOCK'),
303
            'name'       => $myblock->getVar('name'),
304
            'side'       => $myblock->getVar('side'),
305
            'weight'     => $myblock->getVar('weight'),
306
            'visible'    => $myblock->getVar('visible'),
307
            'content'    => $myblock->getVar('content', 'N'),
308
            'modules'    => $modules,
309
            'is_custom'  => $is_custom,
310
            'ctype'      => $myblock->getVar('c_type'),
311
            'bcachetime' => $myblock->getVar('bcachetime'),
312
            'op'         => 'clone_ok',
313
            'bid'        => $myblock->getVar('bid'),
314
            'edit_form'  => $myblock->getOptions(),
315
            'template'   => $myblock->getVar('template'),
316
            'options'    => $myblock->getVar('options'),
317
        ];
318
        echo "<a href='" . $helper->url('admin/blocksadmin.php') . "'>" . _AM_BADMIN . "</a>&nbsp;<span class='bold'>&raquo;&raquo;</span>&nbsp;" . _AM_SYSTEM_BLOCKS_CLONEBLOCK . "<br><br>\n";
319
        require_once __DIR__ . '/blockform.php';
320
        $form->display();
321
        break;
322
    case ('edit'):
323
        $bid = Request::getInt('bid', 0, 'POST');
324
        xoops_cp_header();
@@ 322-359 (lines=38) @@
319
        require_once __DIR__ . '/blockform.php';
320
        $form->display();
321
        break;
322
    case ('edit'):
323
        $bid = Request::getInt('bid', 0, 'POST');
324
        xoops_cp_header();
325
326
        xoops_loadLanguage('admin', 'system');
327
        xoops_loadLanguage('admin/blocksadmin', 'system');
328
        xoops_loadLanguage('admin/groups', 'system');
329
        //        mpu_adm_menu();
330
        $myblock = new \XoopsBlock($bid);
331
        $sql     = 'SELECT module_id FROM ' . $GLOBALS['xoopsDB']->prefix('block_module_link') . ' WHERE block_id=' . $bid;
332
        $result  = $GLOBALS['xoopsDB']->query($sql);
333
        $modules = [];
334
        while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) {
335
            $modules[] = (int)$row['module_id'];
336
        }
337
        $is_custom = ('C' === $myblock->getVar('block_type') || 'E' === $myblock->getVar('block_type'));
338
        $block     = [
339
            'title'      => $myblock->getVar('title'),
340
            'form_title' => constant('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_EDITBLOCK'),
341
            //        'name'       => $myblock->getVar('name'),
342
            'side'       => $myblock->getVar('side'),
343
            'weight'     => $myblock->getVar('weight'),
344
            'visible'    => $myblock->getVar('visible'),
345
            'content'    => $myblock->getVar('content', 'N'),
346
            'modules'    => $modules,
347
            'is_custom'  => $is_custom,
348
            'ctype'      => $myblock->getVar('c_type'),
349
            'bcachetime' => $myblock->getVar('bcachetime'),
350
            'op'         => 'edit_ok',
351
            'bid'        => $myblock->getVar('bid'),
352
            'edit_form'  => $myblock->getOptions(),
353
            'template'   => $myblock->getVar('template'),
354
            'options'    => $myblock->getVar('options'),
355
        ];
356
        echo "<a href='" . $helper->url('admin/blocksadmin.php') . "'>" . _AM_BADMIN . "</a>&nbsp;<span class='bold'>&raquo;&raquo;</span>&nbsp;" . _AM_SYSTEM_BLOCKS_EDITBLOCK . "<br><br>\n";
357
        require_once __DIR__ . '/blockform.php';
358
        $form->display();
359
        break;
360
    case('edit_ok'):
361
        $bid        = Request::getInt('bid', 0);
362
        $btitle     = Request::getString('btitle');