Code Duplication    Length = 3-5 lines in 18 locations

class/Common/FilesManagement.php 2 locations

@@ 63-65 (lines=3) @@
60
    {
61
        $dir = opendir($src);
62
        //        @mkdir($dst);
63
        if (!@mkdir($dst) && !is_dir($dst)) {
64
            throw new \RuntimeException('The directory ' . $dst . ' could not be created.');
65
        }
66
        while (false !== ($file = readdir($dir))) {
67
            if (('.' !== $file) && ('..' !== $file)) {
68
                if (is_dir($src . '/' . $file)) {
@@ 100-104 (lines=5) @@
97
        }
98
99
        // Make destination directory
100
        if (!is_dir($dest)) {
101
            if (!mkdir($dest) && !is_dir($dest)) {
102
                throw new \RuntimeException(sprintf('Directory "%s" was not created', $dest));
103
            }
104
        }
105
106
        // Loop through the folder
107
        $dir = dir($source);

include/install.php 8 locations

@@ 33-37 (lines=5) @@
30
31
//Creation of folder "uploads" for the module to the site root
32
$module_uploads = XOOPS_ROOT_PATH . '/uploads/xnewsletter';
33
if (!is_dir($module_uploads)) {
34
    if (!mkdir($module_uploads, 0777) && !is_dir($module_uploads)) {
35
        throw new \RuntimeException(sprintf('Directory "%s" was not created', $module_uploads));
36
    }
37
}
38
chmod($module_uploads, 0777);
39
copy($indexFile, XOOPS_ROOT_PATH . '/uploads/xnewsletter/index.html');
40
@@ 43-47 (lines=5) @@
40
41
//Creation of the file accounts in uploads directory
42
$module_uploads = XOOPS_ROOT_PATH . '/uploads/xnewsletter/accounts';
43
if (!is_dir($module_uploads)) {
44
    if (!mkdir($module_uploads, 0777) && !is_dir($module_uploads)) {
45
        throw new \RuntimeException(sprintf('Directory "%s" was not created', $module_uploads));
46
    }
47
}
48
chmod($module_uploads, 0777);
49
copy($indexFile, XOOPS_ROOT_PATH . '/uploads/xnewsletter/accounts/index.html');
50
@@ 53-57 (lines=5) @@
50
51
//Creation of the file cat in uploads directory
52
$module_uploads = XOOPS_ROOT_PATH . '/uploads/xnewsletter/cat';
53
if (!is_dir($module_uploads)) {
54
    if (!mkdir($module_uploads, 0777) && !is_dir($module_uploads)) {
55
        throw new \RuntimeException(sprintf('Directory "%s" was not created', $module_uploads));
56
    }
57
}
58
chmod($module_uploads, 0777);
59
copy($indexFile, XOOPS_ROOT_PATH . '/uploads/xnewsletter/cat/index.html');
60
@@ 63-67 (lines=5) @@
60
61
//Creation of the file subscr in uploads directory
62
$module_uploads = XOOPS_ROOT_PATH . '/uploads/xnewsletter/subscr';
63
if (!is_dir($module_uploads)) {
64
    if (!mkdir($module_uploads, 0777) && !is_dir($module_uploads)) {
65
        throw new \RuntimeException(sprintf('Directory "%s" was not created', $module_uploads));
66
    }
67
}
68
chmod($module_uploads, 0777);
69
copy($indexFile, XOOPS_ROOT_PATH . '/uploads/xnewsletter/subscr/index.html');
70
@@ 73-77 (lines=5) @@
70
71
//Creation of the file catsubscr in uploads directory
72
$module_uploads = XOOPS_ROOT_PATH . '/uploads/xnewsletter/catsubscr';
73
if (!is_dir($module_uploads)) {
74
    if (!mkdir($module_uploads, 0777) && !is_dir($module_uploads)) {
75
        throw new \RuntimeException(sprintf('Directory "%s" was not created', $module_uploads));
76
    }
77
}
78
chmod($module_uploads, 0777);
79
copy($indexFile, XOOPS_ROOT_PATH . '/uploads/xnewsletter/catsubscr/index.html');
80
@@ 83-87 (lines=5) @@
80
81
//Creation of the file letter in uploads directory
82
$module_uploads = XOOPS_ROOT_PATH . '/uploads/xnewsletter/letter';
83
if (!is_dir($module_uploads)) {
84
    if (!mkdir($module_uploads, 0777) && !is_dir($module_uploads)) {
85
        throw new \RuntimeException(sprintf('Directory "%s" was not created', $module_uploads));
86
    }
87
}
88
chmod($module_uploads, 0777);
89
copy($indexFile, XOOPS_ROOT_PATH . '/uploads/xnewsletter/letter/index.html');
90
@@ 93-97 (lines=5) @@
90
91
//Creation of the file protocol in uploads directory
92
$module_uploads = XOOPS_ROOT_PATH . '/uploads/xnewsletter/protocol';
93
if (!is_dir($module_uploads)) {
94
    if (!mkdir($module_uploads, 0777) && !is_dir($module_uploads)) {
95
        throw new \RuntimeException(sprintf('Directory "%s" was not created', $module_uploads));
96
    }
97
}
98
chmod($module_uploads, 0777);
99
copy($indexFile, XOOPS_ROOT_PATH . '/uploads/xnewsletter/protocol/index.html');
100
@@ 103-107 (lines=5) @@
100
101
//Creation of the folder letter_attachment in uploads directory for files
102
$module_uploads = XOOPS_ROOT_PATH . '/uploads/xnewsletter/attachments/';
103
if (!is_dir($module_uploads)) {
104
    if (!mkdir($module_uploads, 0777) && !is_dir($module_uploads)) {
105
        throw new \RuntimeException(sprintf('Directory "%s" was not created', $module_uploads));
106
    }
107
}
108
chmod($module_uploads, 0777);
109
copy($indexFile, XOOPS_ROOT_PATH . '/uploads/xnewsletter/attachments/index.html');
110

include/oninstall.php 8 locations

@@ 66-70 (lines=5) @@
63
64
    //Creation of folder "uploads" for the module to the site root
65
    $path = XOOPS_ROOT_PATH . '/uploads/xnewsletter';
66
    if (!is_dir($path)) {
67
        if (!mkdir($path, 0777, true) && !is_dir($path)) {
68
            throw new \RuntimeException(sprintf('Directory "%s" was not created', $path));
69
        }
70
    }
71
    chmod($path, 0777);
72
    copy(INDEX_FILE_PATH, $path . '/index.html');
73
@@ 76-80 (lines=5) @@
73
74
    //Creation of the file accounts in uploads directory
75
    $path = XOOPS_ROOT_PATH . '/uploads/xnewsletter/accounts';
76
    if (!is_dir($path)) {
77
        if (!mkdir($path, 0777, true) && !is_dir($path)) {
78
            throw new \RuntimeException(sprintf('Directory "%s" was not created', $path));
79
        }
80
    }
81
    chmod($path, 0777);
82
    copy(INDEX_FILE_PATH, $path . '/index.html');
83
@@ 86-90 (lines=5) @@
83
84
    //Creation of the file cat in uploads directory
85
    $path = XOOPS_ROOT_PATH . '/uploads/xnewsletter/cat';
86
    if (!is_dir($path)) {
87
        if (!mkdir($path, 0777, true) && !is_dir($path)) {
88
            throw new \RuntimeException(sprintf('Directory "%s" was not created', $path));
89
        }
90
    }
91
    chmod($path, 0777);
92
    copy(INDEX_FILE_PATH, $path . '/index.html');
93
@@ 96-100 (lines=5) @@
93
94
    //Creation of the file subscr in uploads directory
95
    $path = XOOPS_ROOT_PATH . '/uploads/xnewsletter/subscr';
96
    if (!is_dir($path)) {
97
        if (!mkdir($path, 0777, true) && !is_dir($path)) {
98
            throw new \RuntimeException(sprintf('Directory "%s" was not created', $path));
99
        }
100
    }
101
    chmod($path, 0777);
102
    copy(INDEX_FILE_PATH, $path . '/index.html');
103
@@ 106-110 (lines=5) @@
103
104
    //Creation of the file catsubscr in uploads directory
105
    $path = XOOPS_ROOT_PATH . '/uploads/xnewsletter/catsubscr';
106
    if (!is_dir($path)) {
107
        if (!mkdir($path, 0777, true) && !is_dir($path)) {
108
            throw new \RuntimeException(sprintf('Directory "%s" was not created', $path));
109
        }
110
    }
111
    chmod($path, 0777);
112
    copy(INDEX_FILE_PATH, $path . '/index.html');
113
@@ 116-120 (lines=5) @@
113
114
    //Creation of the file letter in uploads directory
115
    $path = XOOPS_ROOT_PATH . '/uploads/xnewsletter/letter';
116
    if (!is_dir($path)) {
117
        if (!mkdir($path, 0777, true) && !is_dir($path)) {
118
            throw new \RuntimeException(sprintf('Directory "%s" was not created', $path));
119
        }
120
    }
121
    chmod($path, 0777);
122
    copy(INDEX_FILE_PATH, $path . '/index.html');
123
@@ 126-130 (lines=5) @@
123
124
    //Creation of the file protocol in uploads directory
125
    $path = XOOPS_ROOT_PATH . '/uploads/xnewsletter/protocol';
126
    if (!is_dir($path)) {
127
        if (!mkdir($path, 0777, true) && !is_dir($path)) {
128
            throw new \RuntimeException(sprintf('Directory "%s" was not created', $path));
129
        }
130
    }
131
    chmod($path, 0777);
132
    copy(INDEX_FILE_PATH, $path . '/index.html');
133
@@ 136-140 (lines=5) @@
133
134
    //Creation of the folder letter_attachment in uploads directory for files
135
    $path = XOOPS_ROOT_PATH . '/uploads' . $configArray['xn_attachment_path'];
136
    if (!is_dir($path)) {
137
        if (!mkdir($path, 0777, true) && !is_dir($path)) {
138
            throw new \RuntimeException(sprintf('Directory "%s" was not created', $path));
139
        }
140
    }
141
    chmod($path, 0777);
142
    copy(INDEX_FILE_PATH, $path . '/index.html');
143