Code Duplication    Length = 21-22 lines in 2 locations

Apps/Controller/Admin/User.php 1 location

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

Apps/Controller/Admin/Main.php 1 location

@@ 36-56 (lines=21) @@
33
    /**
34
     * Manage settings in web
35
     */
36
    public function actionSettings()
37
    {
38
        $model = new FormSettings();
39
40
        if ($model->send()) {
41
            if ($model->validate()) {
42
                if ($model->makeSave()) {
43
                    // show message about successful save and take system some time ;)
44
                    return App::$View->render('settings_save');
45
                } else {
46
                    App::$Session->getFlashBag()->add('error', __('Configuration file is not writable! Check /Private/Config/ dir and files'));
47
                }
48
            } else {
49
                App::$Session->getFlashBag()->add('error', __('Validation of form data is failed!'));
50
            }
51
        }
52
53
        return App::$View->render('settings', [
54
            'model' => $model // no $model->export() there
55
        ]);
56
    }
57
58
    /**
59
     * Manage files via elFinder