Code Duplication    Length = 38-41 lines in 2 locations

include/blocksadmin.inc.php 2 locations

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