Code Duplication    Length = 20-24 lines in 2 locations

include/blocksadmin.inc.php 2 locations

@@ 354-377 (lines=24) @@
351
    exit();
352
}
353
354
if ('edit' == $op) {
355
356
    xoops_cp_header();
357
    // edit_block($bid); GIJ imported from blocksadmin.php
358
    $myblock = new XoopsBlock($bid);
359
360
    $db =& XoopsDatabaseFactory::getDatabaseConnection();
361
    $sql = 'SELECT module_id FROM '.$db->prefix('block_module_link').' WHERE block_id='.intval($bid);
362
    $result = $db->query($sql);
363
    $modules = array();
364
    while ($row = $db->fetchArray($result)) {
365
        $modules[] = intval($row['module_id']);
366
    }
367
    $is_custom = ('C' == $myblock->getVar('block_type') || 'E' == $myblock->getVar('block_type')) ? true : false;
368
    $block = array('form_title' => _AM_EDITBLOCK, 'name' => $myblock->getVar('name'), 'side' => $myblock->getVar('side'), 'weight' => $myblock->getVar('weight'), 'visible' => $myblock->getVar('visible'), 'title' => $myblock->getVar('title','E'), 'content' => $myblock->getVar('content','n'), 'modules' => $modules, 'is_custom' => $is_custom, 'ctype' => $myblock->getVar('c_type'), 'cachetime' => $myblock->getVar('bcachetime'), 'op' => 'update', 'bid' => $myblock->getVar('bid'), 'edit_form' => $myblock->getOptions(), 'template' => $myblock->getVar('template'), 'options' => $myblock->getVar('options'), 'submit_button' => _SUBMIT);
369
370
    echo '<a href="myblocksadmin.php">' . _AM_MYLINKS_BADMIN . '</a>&nbsp;<span style="font-weight:bold;">&raquo;&raquo;</span>&nbsp;' . _AM_EDITBLOCK . '<br><br>';
371
    include __DIR__ . '/../admin/myblockform.php'; //GIJ
372
    $xoopsGTicket->addTicketXoopsFormElement($form, __LINE__, 1800, 'myblocksadmin'); //GIJ
373
    $form->display();
374
    // end of edit_block() GIJ
375
    xoops_cp_footer();
376
    exit();
377
}
378
379
if ('clone' == $op) {
380
    xoops_cp_header();
@@ 379-398 (lines=20) @@
376
    exit();
377
}
378
379
if ('clone' == $op) {
380
    xoops_cp_header();
381
    $myblock = new XoopsBlock($bid);
382
383
    $db =& XoopsDatabaseFactory::getDatabaseConnection();
384
    $sql = 'SELECT module_id FROM ' . $db->prefix('block_module_link') . ' WHERE block_id=' . intval($bid);
385
    $result = $db->query($sql);
386
    $modules = array();
387
    while ($row = $db->fetchArray($result)) {
388
        $modules[] = intval($row['module_id']);
389
    }
390
    $is_custom = ('C' == $myblock->getVar('block_type') || 'E' == $myblock->getVar('block_type')) ? true : false;
391
    $block = array('form_title' => _AM_CLONEBLOCK, 'name' => $myblock->getVar('name'), 'side' => $myblock->getVar('side'), 'weight' => $myblock->getVar('weight'), 'visible' => $myblock->getVar('visible'), 'content' => $myblock->getVar('content', 'N'), 'title' => $myblock->getVar('title','E'), 'modules' => $modules, 'is_custom' => $is_custom, 'ctype' => $myblock->getVar('c_type'), 'cachetime' => $myblock->getVar('bcachetime'), 'op' => 'clone_ok', 'bid' => $myblock->getVar('bid'), 'edit_form' => $myblock->getOptions(), 'template' => $myblock->getVar('template'), 'options' => $myblock->getVar('options'), 'submit_button' => _CLONE);
392
    echo '<a href="myblocksadmin.php">' . _AM_MYLINKS_BADMIN . '</a>&nbsp;<span style="font-weight:bold;">&raquo;&raquo;</span>&nbsp;'. _AM_CLONEBLOCK . '<br><br>';
393
    include __DIR__ . '/../admin/myblockform.php';
394
    $xoopsGTicket->addTicketXoopsFormElement($form, __LINE__, 1800, 'myblocksadmin'); //GIJ
395
    $form->display();
396
    xoops_cp_footer();
397
    exit();
398
}
399
400
if ('clone_ok' == $op) {
401
    // Ticket Check