Code Duplication    Length = 21-22 lines in 2 locations

Apps/Controller/Admin/User.php 1 location

@@ 187-208 (lines=22) @@
184
     * Send invite to user by email
185
     * @return string
186
     */
187
    public function actionInvite()
188
    {
189
        // init model
190
        $model = new FormInviteSend();
191
192
        if ($model->send()) {
193
            if ($model->validate()) {
194
                if ($model->make()) {
195
                    App::$Session->getFlashBag()->add('success', __('Invite was successful send!'));
196
                } else {
197
                    App::$Session->getFlashBag()->add('error', __('Mail server connection is failed!'));
198
                }
199
            } else {
200
                App::$Session->getFlashBag()->add('error', __('Form validation is failed'));
201
            }
202
        }
203
204
        // render view
205
        return App::$View->render('invite', [
206
            'model' => $model
207
        ]);
208
    }
209
}

Apps/Controller/Admin/Main.php 1 location

@@ 61-81 (lines=21) @@
58
    /**
59
     * Manage settings in web
60
     */
61
    public function actionSettings()
62
    {
63
        $model = new FormSettings();
64
65
        if ($model->send()) {
66
            if ($model->validate()) {
67
                if ($model->makeSave()) {
68
                    // show message about successful save and take system some time ;)
69
                    return App::$View->render('settings_save');
70
                } else {
71
                    App::$Session->getFlashBag()->add('error', __('Configuration file is not writable! Check /Private/Config/ dir and files'));
72
                }
73
            } else {
74
                App::$Session->getFlashBag()->add('error', __('Validation of form data is failed!'));
75
            }
76
        }
77
78
        return App::$View->render('settings', [
79
            'model' => $model // no $model->export() there
80
        ]);
81
    }
82
83
    /**
84
     * Manage files via elFinder