Code Duplication    Length = 6-8 lines in 3 locations

application/modules/gallery/admin.php 1 location

@@ 269-275 (lines=7) @@
266
                    $allowedTypes = ['ttf', 'fnt', 'fon', 'otf'];
267
                    $ext = pathinfo($_FILES['watermark_font_path']['name'], PATHINFO_EXTENSION);
268
                    if (in_array($ext, $allowedTypes)) {
269
                        if (!$this->upload->do_upload('watermark_font_path')) {
270
                            $this->upload->display_errors('', '');
271
                        } else {
272
                            $udata = $this->upload->data();
273
                            // changing value in the DB
274
                            $params['watermark_font_path'] = $uploadPath . $udata['file_name'];
275
                        }
276
                    }
277
                } else {
278
                    $params['watermark_font_path'] = trim($this->input->post('watermark_font_path_tmp'));

application/modules/admin/settings.php 1 location

@@ 389-396 (lines=8) @@
386
        // setting old value
387
        $oldValue = $this->siteinfo->getSiteInfo($paramName);
388
        $siteinfo[$paramName] = !empty($oldValue) ? $oldValue : '';
389
        if (isset($_FILES[$paramName])) {
390
            if (!$this->upload->do_upload($paramName)) {
391
                echo $this->upload->display_errors('', '');
392
            } else {
393
                $uploadData = $this->upload->data();
394
                $siteinfo[$paramName] = $uploadData['file_name'];
395
            }
396
        }
397
    }
398
399
    public function switch_admin_lang($lang) {

application/modules/template_manager/admin.php 1 location

@@ 227-232 (lines=6) @@
224
            return;
225
        }
226
227
        if (!$this->upload->do_upload($paramName)) {
228
            throw new Exception($this->upload->display_errors('', ''));
229
        } else {
230
            $uploadData = $this->upload->data();
231
            $siteinfo[$paramName] = $uploadData['file_name'];
232
        }
233
    }
234
235
    /**