Code Duplication    Length = 24-25 lines in 5 locations

app/lib/FFCMS/Controllers/Admin/Config.php 1 location

@@ 90-113 (lines=24) @@
87
     * @param \Base $f3
88
     * @return void
89
     */
90
    public function delete(\Base $f3)
91
    {
92
        $this->redirectLoggedOutUser();
93
        $this->csrf();
94
95
        if (false == $f3->get('isRoot')) {
96
            $this->notify(_('You do not have (root) permission!'), 'error');
97
            return $f3->reroute('@admin_config_list');
98
        }
99
100
        $uuid = $f3->get('REQUEST.uuid');
101
102
        $mapper = new Mappers\ConfigData;
103
        $mapper->load(['uuid = ?', $uuid]);
104
105
        if (null == $mapper->id) {
106
            $this->notify(_('The config item no longer exists!'), 'error');
107
            return $f3->reroute('@admin_config_list');
108
        }
109
110
        $mapper->erase();
111
        $this->notify('Config item deleted!', 'success');
112
        return $f3->reroute('@admin_config_list');
113
    }
114
115
116
    /**

app/lib/FFCMS/Controllers/Admin/Reports.php 1 location

@@ 438-462 (lines=25) @@
435
     * @param \Base $f3
436
     * @return void
437
     */
438
    public function delete(\Base $f3)
439
    {
440
        $this->redirectLoggedOutUser();
441
        $this->csrf();
442
443
        if (false == $f3->get('isRoot')) {
444
            $this->notify(_('You do not have (root) permission!'), 'error');
445
            return $f3->reroute('@admin_reports_list');
446
        }
447
448
        $uuid = $f3->get('REQUEST.uuid');
449
450
        $mapper = new Mappers\Reports;
451
        $mapper->load(['uuid = ?', $uuid]);
452
453
        if (null == $mapper->id) {
454
            $this->notify(_('The report no longer exists!'), 'error');
455
            return $f3->reroute('@admin_reports_list');
456
        }
457
458
        $mapper->erase();
459
        $this->notify('Report deleted!', 'success');
460
        $this->notify(_('Unable to update report data!'), 'error');
461
        return $f3->reroute('@admin_reports_list');
462
    }
463
464
465
}

app/lib/FFCMS/Controllers/Admin/Tokens.php 1 location

@@ 164-188 (lines=25) @@
161
     * @param \Base $f3
162
     * @return void
163
     */
164
    public function delete(\Base $f3)
165
    {
166
        $this->redirectLoggedOutUser();
167
        $this->csrf();
168
169
        if (false == $f3->get('isRoot')) {
170
            $this->notify(_('You do not have (root) permission!'), 'error');
171
            return $f3->reroute('@admin_tokens_list');
172
        }
173
174
        $uuid = $f3->get('REQUEST.uuid');
175
176
        $mapper = new Mappers\OAuth2Tokens;
177
        $mapper->load(['uuid = ?', $uuid]);
178
179
        if (null == $mapper->id) {
180
            $this->notify(_('The token no longer exists!'), 'error');
181
            return $f3->reroute('@admin_tokens_list');
182
        }
183
184
        $mapper->erase();
185
        $this->notify('Token deleted!', 'success');
186
187
        return $f3->reroute('@admin_tokens_list');
188
    }
189
190
}
191

app/lib/FFCMS/Controllers/Admin/Users.php 1 location

@@ 253-277 (lines=25) @@
250
     * @param \Base $f3
251
     * @return void
252
     */
253
    public function delete(\Base $f3)
254
    {
255
        $this->redirectLoggedOutUser();
256
        $this->csrf();
257
258
        if (false == $f3->get('isRoot')) {
259
            $this->notify(_('You do not have (root) permission!'), 'error');
260
            return $f3->reroute('@admin_users_list');
261
        }
262
263
        $uuid = $f3->get('REQUEST.uuid');
264
265
        $mapper = new Mappers\Users;
266
        $mapper->load(['uuid = ?', $uuid]);
267
268
        if (null == $mapper->id) {
269
            $this->notify(_('The user no longer exists!'), 'error');
270
            return $f3->reroute('@admin_users_list');
271
        }
272
273
        $mapper->erase();
274
        $this->notify('User deleted!', 'success');
275
276
        return $f3->reroute('@admin_users_list');
277
    }
278
279
}
280

app/lib/FFCMS/Controllers/Admin/UsersData.php 1 location

@@ 428-451 (lines=24) @@
425
     * @param \Base $f3
426
     * @return void
427
     */
428
    public function delete(\Base $f3)
429
    {
430
        $this->redirectLoggedOutUser();
431
        $this->csrf();
432
433
        if (false == $f3->get('isRoot')) {
434
            $this->notify(_('You do not have (root) permission!'), 'error');
435
            return $f3->reroute('@admin_usersdata_list');
436
        }
437
438
        $uuid = $f3->get('REQUEST.uuid');
439
440
        $mapper = new Mappers\UsersData;
441
        $mapper->load(['uuid = ?', $uuid]);
442
443
        if (null == $mapper->id) {
444
            $this->notify(_('The data item no longer exists!'), 'error');
445
            return $f3->reroute('@admin_usersdata_list');
446
        }
447
448
        $mapper->erase();
449
        $this->notify('User data deleted!', 'success');
450
        return $f3->reroute('@admin_usersdata_list');
451
    }
452
453
}
454