Code Duplication    Length = 6-6 lines in 3 locations

addmedia.php 2 locations

@@ 123-128 (lines=6) @@
120
	}
121
122
	// The media folder exists. Now create a thumbnail folder to match it.
123
	if (!is_dir(WT_DATA_DIR . $MEDIA_DIRECTORY . 'thumbs/' . $folderName)) {
124
		if (!File::mkdir(WT_DATA_DIR . $MEDIA_DIRECTORY . 'thumbs/' . $folderName)) {
125
			FlashMessages::addMessage(I18N::translate('The folder %s does not exist, and it could not be created.', Html::filename(WT_DATA_DIR . $MEDIA_DIRECTORY . 'thumbs/' . $folderName)), 'danger');
126
			break;
127
		}
128
	}
129
130
	// A thumbnail file with no main image?
131
	if (!empty($_FILES['thumbnail']['name']) && empty($_FILES['mediafile']['name'])) {
@@ 280-285 (lines=6) @@
277
	}
278
279
	// The media folder exists. Now create a thumbnail folder to match it.
280
	if (!is_dir(WT_DATA_DIR . $MEDIA_DIRECTORY . 'thumbs/' . $folderName)) {
281
		if (!File::mkdir(WT_DATA_DIR . $MEDIA_DIRECTORY . 'thumbs/' . $folderName)) {
282
			FlashMessages::addMessage(I18N::translate('The folder %s does not exist, and it could not be created.', Html::filename(WT_DATA_DIR . $MEDIA_DIRECTORY . 'thumbs/' . $folderName)), 'danger');
283
			break;
284
		}
285
	}
286
287
	// Validate the media path and filename
288
	if (preg_match('/^https?:\/\//i', $filename, $match)) {

admin_media_upload.php 1 location

@@ 87-92 (lines=6) @@
84
			}
85
86
			// The media folder exists. Now create a thumbnail folder to match it.
87
			if (!is_dir(WT_DATA_DIR . $MEDIA_DIRECTORY . 'thumbs/' . $folderName)) {
88
				if (!File::mkdir(WT_DATA_DIR . $MEDIA_DIRECTORY . 'thumbs/' . $folderName)) {
89
					FlashMessages::addMessage(I18N::translate('The folder %s does not exist, and it could not be created.', Html::filename(WT_DATA_DIR . $MEDIA_DIRECTORY . 'thumbs/' . $folderName)));
90
					break;
91
				}
92
			}
93
94
			// A thumbnail file with no main image?
95
			if (!empty($_FILES['thumbnail' . $i]['name']) && empty($_FILES['mediafile' . $i]['name'])) {