Code Duplication    Length = 6-8 lines in 3 locations

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
    /**

application/modules/gallery/admin.php 1 location

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

application/modules/admin/settings.php 1 location

@@ 440-447 (lines=8) @@
437
        // setting old value
438
        $oldValue = $this->siteinfo->getSiteInfo($paramName);
439
        $siteinfo[$paramName] = !empty($oldValue) ? $oldValue : '';
440
        if (isset($_FILES[$paramName])) {
441
            if (!$this->upload->do_upload($paramName)) {
442
                echo $this->upload->display_errors('', '');
443
            } else {
444
                $uploadData = $this->upload->data();
445
                $siteinfo[$paramName] = $uploadData['file_name'];
446
            }
447
        }
448
    }
449
450
    public function switch_admin_lang($lang) {