Code Duplication    Length = 38-41 lines in 2 locations

include/blocksadmin.inc.php 2 locations

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