Code Duplication    Length = 38-41 lines in 2 locations

include/blocksadmin.inc.php 2 locations

@@ 372-412 (lines=41) @@
369
    exit();
370
}
371
372
if ($op === 'edit') {
373
    xoops_cp_header();
374
    // edit_block($bid); GIJ imported from blocksadmin.php
375
    $myblock = new XoopsBlock($bid);
376
377
    $db      = XoopsDatabaseFactory::getDatabaseConnection();
378
    $sql     = 'SELECT module_id FROM ' . $db->prefix('block_module_link') . ' WHERE block_id=' . (int)$bid;
379
    $result  = $db->query($sql);
380
    $modules = array();
381
    while ($row = $db->fetchArray($result)) {
382
        $modules[] = (int)$row['module_id'];
383
    }
384
    $is_custom = ($myblock->getVar('block_type') === 'C' || $myblock->getVar('block_type') === 'E') ? true : false;
385
    $block     = array(
386
        'form_title'    => _AM_EDITBLOCK,
387
        'name'          => $myblock->getVar('name'),
388
        'side'          => $myblock->getVar('side'),
389
        'weight'        => $myblock->getVar('weight'),
390
        'visible'       => $myblock->getVar('visible'),
391
        'title'         => $myblock->getVar('title', 'E'),
392
        'content'       => $myblock->getVar('content', 'n'),
393
        'modules'       => $modules,
394
        'is_custom'     => $is_custom,
395
        'ctype'         => $myblock->getVar('c_type'),
396
        'cachetime'     => $myblock->getVar('bcachetime'),
397
        'op'            => 'update',
398
        'bid'           => $myblock->getVar('bid'),
399
        'edit_form'     => $myblock->getOptions(),
400
        'template'      => $myblock->getVar('template'),
401
        'options'       => $myblock->getVar('options'),
402
        'submit_button' => _SUBMIT
403
    );
404
405
    echo '<a href="myblocksadmin.php">' . _AM_BADMIN . '</a>&nbsp;<span style="font-weight:bold;">&raquo;&raquo;</span>&nbsp;' . _AM_EDITBLOCK . '<br><br>';
406
    include __DIR__ . '/../admin/myblockform.php'; //GIJ
407
    $xoopsGTicket->addTicketXoopsFormElement($form, __LINE__, 1800, 'myblocksadmin'); //GIJ
408
    $form->display();
409
    // end of edit_block() GIJ
410
    xoops_cp_footer();
411
    exit();
412
}
413
414
if ($op === 'clone') {
415
    xoops_cp_header();
@@ 414-451 (lines=38) @@
411
    exit();
412
}
413
414
if ($op === 'clone') {
415
    xoops_cp_header();
416
    $myblock = new XoopsBlock($bid);
417
418
    $db      = XoopsDatabaseFactory::getDatabaseConnection();
419
    $sql     = 'SELECT module_id FROM ' . $db->prefix('block_module_link') . ' WHERE block_id=' . (int)$bid;
420
    $result  = $db->query($sql);
421
    $modules = array();
422
    while ($row = $db->fetchArray($result)) {
423
        $modules[] = (int)$row['module_id'];
424
    }
425
    $is_custom = ($myblock->getVar('block_type') === 'C' || $myblock->getVar('block_type') === 'E') ? true : false;
426
    $block     = array(
427
        'form_title'    => _AM_CLONEBLOCK,
428
        'name'          => $myblock->getVar('name'),
429
        'side'          => $myblock->getVar('side'),
430
        'weight'        => $myblock->getVar('weight'),
431
        'visible'       => $myblock->getVar('visible'),
432
        'content'       => $myblock->getVar('content', 'N'),
433
        'title'         => $myblock->getVar('title', 'E'),
434
        'modules'       => $modules,
435
        'is_custom'     => $is_custom,
436
        'ctype'         => $myblock->getVar('c_type'),
437
        'cachetime'     => $myblock->getVar('bcachetime'),
438
        'op'            => 'clone_ok',
439
        'bid'           => $myblock->getVar('bid'),
440
        'edit_form'     => $myblock->getOptions(),
441
        'template'      => $myblock->getVar('template'),
442
        'options'       => $myblock->getVar('options'),
443
        'submit_button' => _CLONE
444
    );
445
    echo '<a href="myblocksadmin.php">' . _AM_BADMIN . '</a>&nbsp;<span style="font-weight:bold;">&raquo;&raquo;</span>&nbsp;' . _AM_CLONEBLOCK . '<br><br>';
446
    include __DIR__ . '/../admin/myblockform.php';
447
    $xoopsGTicket->addTicketXoopsFormElement($form, __LINE__, 1800, 'myblocksadmin'); //GIJ
448
    $form->display();
449
    xoops_cp_footer();
450
    exit();
451
}
452
453
if ($op === 'clone_ok') {
454
    // Ticket Check