Code Duplication    Length = 22-22 lines in 2 locations

src/controllers/SequencesController.php 1 location

@@ 535-556 (lines=22) @@
532
    /**
533
     * Actually creates the new sequence in the database
534
     */
535
    public function doSaveCreateSequence()
536
    {
537
        $conf = $this->conf;
538
        $misc = $this->misc;
539
        $lang = $this->lang;
540
        $data = $misc->getDatabaseAccessor();
541
542
        // Check that they've given a name and at least one column
543
        if ($_POST['formSequenceName'] == '') {
544
            $this->doCreateSequence($lang['strsequenceneedsname']);
545
        } else {
546
            $status = $data->createSequence($_POST['formSequenceName'],
547
                $_POST['formIncrement'], $_POST['formMinValue'],
548
                $_POST['formMaxValue'], $_POST['formStartValue'],
549
                $_POST['formCacheValue'], isset($_POST['formCycledValue']));
550
            if ($status == 0) {
551
                $this->doDefault($lang['strsequencecreated']);
552
            } else {
553
                $this->doCreateSequence($lang['strsequencecreatedbad']);
554
            }
555
        }
556
    }
557
558
    /**
559
     * Restarts a sequence

src/controllers/UsersController.php 1 location

@@ 468-489 (lines=22) @@
465
    /**
466
     * Actually creates the new user in the database
467
     */
468
    public function doSaveCreate()
469
    {
470
        $conf = $this->conf;
471
        $misc = $this->misc;
472
        $lang = $this->lang;
473
        $data = $misc->getDatabaseAccessor();
474
475
        // Check data
476
        if ($_POST['formUsername'] == '') {
477
            $this->doCreate($lang['struserneedsname']);
478
        } elseif ($_POST['formPassword'] != $_POST['formConfirm']) {
479
            $this->doCreate($lang['strpasswordconfirm']);
480
        } else {
481
            $status = $data->createUser($_POST['formUsername'], $_POST['formPassword'],
482
                isset($_POST['formCreateDB']), isset($_POST['formSuper']), $_POST['formExpires'], []);
483
            if ($status == 0) {
484
                $this->doDefault($lang['strusercreated']);
485
            } else {
486
                $this->doCreate($lang['strusercreatedbad']);
487
            }
488
        }
489
    }
490
}
491