Code Duplication    Length = 6-6 lines in 3 locations

addmedia.php 2 locations

@@ 116-121 (lines=6) @@
113
	}
114
115
	// The media folder exists. Now create a thumbnail folder to match it.
116
	if (!is_dir(WT_DATA_DIR . $MEDIA_DIRECTORY . 'thumbs/' . $folderName)) {
117
		if (!File::mkdir(WT_DATA_DIR . $MEDIA_DIRECTORY . 'thumbs/' . $folderName)) {
118
			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');
119
			break;
120
		}
121
	}
122
123
	// A thumbnail file with no main image?
124
	if (!empty($_FILES['thumbnail']['name']) && empty($_FILES['mediafile']['name'])) {
@@ 272-277 (lines=6) @@
269
	}
270
271
	// The media folder exists. Now create a thumbnail folder to match it.
272
	if (!is_dir(WT_DATA_DIR . $MEDIA_DIRECTORY . 'thumbs/' . $folderName)) {
273
		if (!File::mkdir(WT_DATA_DIR . $MEDIA_DIRECTORY . 'thumbs/' . $folderName)) {
274
			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');
275
			break;
276
		}
277
	}
278
279
	// Validate the media path and filename
280
	if (preg_match('/^https?:\/\//i', $filename, $match)) {

admin_media_upload.php 1 location

@@ 82-87 (lines=6) @@
79
			}
80
81
			// The media folder exists. Now create a thumbnail folder to match it.
82
			if (!is_dir(WT_DATA_DIR . $MEDIA_DIRECTORY . 'thumbs/' . $folderName)) {
83
				if (!File::mkdir(WT_DATA_DIR . $MEDIA_DIRECTORY . 'thumbs/' . $folderName)) {
84
					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)));
85
					break;
86
				}
87
			}
88
89
			// A thumbnail file with no main image?
90
			if (!empty($_FILES['thumbnail' . $i]['name']) && empty($_FILES['mediafile' . $i]['name'])) {