Code Duplication    Length = 22-22 lines in 2 locations

class/files/admin/AdminPhpCode.php 1 location

@@ 433-454 (lines=22) @@
430
    *  @param string $fieldMain
431
    *  @return string
432
    */
433
    public function getAdminPhpCodeDelete($tableName, $language, $fieldId, $fieldMain)
434
    {
435
        $ret = <<<EOT
436
    case 'delete':
437
        \${$tableName}Obj =& \${$tableName}Handler->get(\${$fieldId});
438
        if (isset(\$_REQUEST['ok']) && 1 == \$_REQUEST['ok']) {
439
            if ( !\$GLOBALS['xoopsSecurity']->check() ) {
440
                redirect_header('{$tableName}.php', 3, implode(', ', \$GLOBALS['xoopsSecurity']->getErrors()));
441
            }
442
            if (\${$tableName}Handler->delete(\${$tableName}Obj)) {
443
                redirect_header('{$tableName}.php', 3, {$language}FORMDELOK);
444
            } else {
445
                echo \${$tableName}Obj->getHtmlErrors();
446
            }
447
        } else {
448
            xoops_confirm(array('ok' => 1, '{$fieldId}' => \${$fieldId}, 'op' => 'delete'), \$_SERVER['REQUEST_URI'], sprintf({$language}FORMSUREDEL, \${$tableName}Obj->getVar('{$fieldMain}')));
449
        }
450
    break;\n
451
EOT;
452
453
        return $ret;
454
    }
455
456
    /*
457
    *  @public function getAdminPhpCodeUpdate

class/files/admin/AdminXoopsCode.php 1 location

@@ 419-440 (lines=22) @@
416
    *  @param string $fieldMain
417
    *  @return string
418
    */
419
    public function getAdminXoopsCodeDelete($tableName, $language, $fieldId, $fieldMain)
420
    {
421
        $ret = <<<EOT
422
    case 'delete':
423
        \${$tableName}Obj =& \${$tableName}Handler->get(\${$fieldId});
424
        if (isset(\$_REQUEST['ok']) && 1 == \$_REQUEST['ok']) {
425
            if ( !\$GLOBALS['xoopsSecurity']->check() ) {
426
                redirect_header('{$tableName}.php', 3, implode(', ', \$GLOBALS['xoopsSecurity']->getErrors()));
427
            }
428
            if (\${$tableName}Handler->delete(\${$tableName}Obj)) {
429
                redirect_header('{$tableName}.php', 3, {$language}FORMDELOK);
430
            } else {
431
                echo \${$tableName}Obj->getHtmlErrors();
432
            }
433
        } else {
434
            xoops_confirm(array('ok' => 1, '{$fieldId}' => \${$fieldId}, 'op' => 'delete'), \$_SERVER['REQUEST_URI'], sprintf({$language}FORMSUREDEL, \${$tableName}Obj->getVar('{$fieldMain}')));
435
        }
436
    break;\n
437
EOT;
438
439
        return $ret;
440
    }
441
442
    /*
443
    *  @public function getAdminXoopsCodeUpdate