Code Duplication    Length = 7-7 lines in 2 locations

class/smartobjectcontroller.php 2 locations

@@ 60-66 (lines=7) @@
57
                            unlink($oldFile);
58
                        }
59
                    }
60
                    if (isset($_POST['delete_' . $key]) && $_POST['delete_' . $key] == '1') {
61
                        $oldFile = $smartObj->getUploadDir(true) . $smartObj->getVar($key, 'e');
62
                        $smartObj->setVar($key, '');
63
                        if (file_exists($oldFile)) {
64
                            unlink($oldFile);
65
                        }
66
                    }
67
                    break;
68
69
                case XOBJ_DTYPE_URLLINK:
@@ 53-59 (lines=7) @@
50
        foreach (array_keys($smartObj->vars) as $key) {
51
            switch ($smartObj->vars[$key]['data_type']) {
52
                case XOBJ_DTYPE_IMAGE:
53
                    if (isset($_POST['url_' . $key]) && $_POST['url_' . $key] !== '') {
54
                        $oldFile = $smartObj->getUploadDir(true) . $smartObj->getVar($key, 'e');
55
                        $smartObj->setVar($key, $_POST['url_' . $key]);
56
                        if (file_exists($oldFile)) {
57
                            unlink($oldFile);
58
                        }
59
                    }
60
                    if (isset($_POST['delete_' . $key]) && $_POST['delete_' . $key] == '1') {
61
                        $oldFile = $smartObj->getUploadDir(true) . $smartObj->getVar($key, 'e');
62
                        $smartObj->setVar($key, '');