Code Duplication    Length = 9-9 lines in 6 locations

src/controllers/TablesController.php 2 locations

@@ 492-500 (lines=9) @@
489
490
                // Check inputs
491
                $fields = trim($_REQUEST['fields']);
492
                if (trim($_REQUEST['name']) == '') {
493
                    $_REQUEST['stage'] = 1;
494
                    $this->doCreate($lang['strtableneedsname']);
495
                    return;
496
                } elseif ($fields == '' || !is_numeric($fields) || $fields != (int) $fields || $fields < 1) {
497
                    $_REQUEST['stage'] = 1;
498
                    $this->doCreate($lang['strtableneedscols']);
499
                    return;
500
                }
501
502
                $types        = $data->getTypes(true, false, true);
503
                $types_for_js = [];
@@ 631-639 (lines=9) @@
628
629
                // Check inputs
630
                $fields = trim($_REQUEST['fields']);
631
                if (trim($_REQUEST['name']) == '') {
632
                    $_REQUEST['stage'] = 1;
633
                    $this->doCreate($lang['strtableneedsname']);
634
                    return;
635
                } elseif ($fields == '' || !is_numeric($fields) || $fields != (int) $fields || $fields <= 0) {
636
                    $_REQUEST['stage'] = 1;
637
                    $this->doCreate($lang['strtableneedscols']);
638
                    return;
639
                }
640
641
                $status = $data->createTable($_REQUEST['name'], $_REQUEST['fields'], $_REQUEST['field'],
642
                    $_REQUEST['type'], $_REQUEST['array'], $_REQUEST['length'], $_REQUEST['notnull'], $_REQUEST['default'],

src/controllers/TypesController.php 4 locations

@@ 416-424 (lines=9) @@
413
414
                // Check inputs
415
                $fields = trim($_REQUEST['fields']);
416
                if (trim($_REQUEST['name']) == '') {
417
                    $_REQUEST['stage'] = 1;
418
                    $this->doCreateComposite($lang['strtypeneedsname']);
419
                    return;
420
                } elseif ($fields == '' || !is_numeric($fields) || $fields != (int) $fields || $fields < 1) {
421
                    $_REQUEST['stage'] = 1;
422
                    $this->doCreateComposite($lang['strtypeneedscols']);
423
                    return;
424
                }
425
426
                $types = $data->getTypes(true, false, true);
427
@@ 493-501 (lines=9) @@
490
491
                // Check inputs
492
                $fields = trim($_REQUEST['fields']);
493
                if (trim($_REQUEST['name']) == '') {
494
                    $_REQUEST['stage'] = 1;
495
                    $this->doCreateComposite($lang['strtypeneedsname']);
496
                    return;
497
                } elseif ($fields == '' || !is_numeric($fields) || $fields != (int) $fields || $fields <= 0) {
498
                    $_REQUEST['stage'] = 1;
499
                    $this->doCreateComposite($lang['strtypeneedscols']);
500
                    return;
501
                }
502
503
                $status = $data->createCompositeType($_REQUEST['name'], $_REQUEST['fields'], $_REQUEST['field'],
504
                    $_REQUEST['type'], $_REQUEST['array'], $_REQUEST['length'], $_REQUEST['colcomment'],
@@ 581-589 (lines=9) @@
578
579
                // Check inputs
580
                $values = trim($_REQUEST['values']);
581
                if (trim($_REQUEST['name']) == '') {
582
                    $_REQUEST['stage'] = 1;
583
                    $this->doCreateEnum($lang['strtypeneedsname']);
584
                    return;
585
                } elseif ($values == '' || !is_numeric($values) || $values != (int) $values || $values < 1) {
586
                    $_REQUEST['stage'] = 1;
587
                    $this->doCreateEnum($lang['strtypeneedsvals']);
588
                    return;
589
                }
590
591
                $this->printTrail('schema');
592
                $this->printTitle($lang['strcreateenumtype'], 'pg.type.create');
@@ 626-634 (lines=9) @@
623
624
                // Check inputs
625
                $values = trim($_REQUEST['values']);
626
                if (trim($_REQUEST['name']) == '') {
627
                    $_REQUEST['stage'] = 1;
628
                    $this->doCreateEnum($lang['strtypeneedsname']);
629
                    return;
630
                } elseif ($values == '' || !is_numeric($values) || $values != (int) $values || $values <= 0) {
631
                    $_REQUEST['stage'] = 1;
632
                    $this->doCreateEnum($lang['strtypeneedsvals']);
633
                    return;
634
                }
635
636
                $status = $data->createEnumType($_REQUEST['name'], $_REQUEST['value'], $_REQUEST['typcomment']);
637