Code Duplication    Length = 38-41 lines in 2 locations

include/blocksadmin.inc.php 2 locations

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