phpBB

Code Changes

File: assets/javascript/plupload.js

  Unmodified   Added   Modified   Removed
Line 21Line 21
	// Only execute if Plupload initialized successfully.
phpbb.plupload.uploader.bind('Init', function() {
phpbb.plupload.form = $(phpbb.plupload.config.form_hook)[0];

	// Only execute if Plupload initialized successfully.
phpbb.plupload.uploader.bind('Init', function() {
phpbb.plupload.form = $(phpbb.plupload.config.form_hook)[0];

		phpbb.plupload.rowTpl = $('#attach-row-tpl')[0].outerHTML;



		let $attachRowTemplate = $('#attach-row-tpl');
$attachRowTemplate.removeClass('attach-row-tpl');
phpbb.plupload.rowTpl = $attachRowTemplate[0].outerHTML;


// Hide the basic upload panel and remove the attach row template.
$('#attach-row-tpl, #attach-panel-basic').remove();


// Hide the basic upload panel and remove the attach row template.
$('#attach-row-tpl, #attach-panel-basic').remove();

Line 88Line 90
			obj['attachment_data[' + i + '][' + key + ']'] = datum[key];
}
}

			obj['attachment_data[' + i + '][' + key + ']'] = datum[key];
}
}

 

// Insert form data
var $pluploadForm = $(phpbb.plupload.config.form_hook).first();
obj.creation_time = $pluploadForm.find('input[type=hidden][name="creation_time"]').val();
obj.form_token = $pluploadForm.find('input[type=hidden][name="form_token"]').val();


	return obj;
};


	return obj;
};


Line 211Line 219
			.attr('type', 'hidden')
.attr('name', 'attachment_data[' + index + '][' + key + ']')
.attr('value', attach[key]);

			.attr('type', 'hidden')
.attr('name', 'attachment_data[' + index + '][' + key + ']')
.attr('value', attach[key]);

		$('textarea', row).after(input);

		$(row).append(input);

	}
};


	}
};


Line 262Line 270

return;
}


return;
}

 

// Handle errors while deleting file
if (typeof response.error !== 'undefined') {
phpbb.alert(phpbb.plupload.lang.ERROR, response.error.message);

// We will have to assume that the deletion failed. So leave the file status as uploaded.
row.find('.file-status').toggleClass('file-uploaded');

return;
}


		phpbb.plupload.update(response, 'removal', index);
// Check if the user can upload files now if he had reached the max files limit.
phpbb.plupload.handleMaxFilesReached();

		phpbb.plupload.update(response, 'removal', index);
// Check if the user can upload files now if he had reached the max files limit.
phpbb.plupload.handleMaxFilesReached();

Line 443Line 462
 */
phpbb.plupload.uploader = new plupload.Uploader(phpbb.plupload.config);
phpbb.plupload.initialize();

 */
phpbb.plupload.uploader = new plupload.Uploader(phpbb.plupload.config);
phpbb.plupload.initialize();

 

/**
* Add a file filter to check for max file sizes per mime type.
*/
plupload.addFileFilter('mime_types_max_file_size', function(types, file, callback) {
if (file.size !== 'undefined') {
$(types).each(function(i, type) {
let extensions = [],
extsArray = type.extensions.split(',');

$(extsArray).each(function(i, extension) {
/^\s*\*\s*$/.test(extension) ? extensions.push("\\.*") : extensions.push("\\." + extension.replace(new RegExp("[" + "/^$.*+?|()[]{}\\".replace(/./g, "\\$&") + "]", "g"), "\\$&"));
});

let regex = new RegExp("(" + extensions.join("|") + ")$", "i");

if (regex.test(file.name)) {
if (type.max_file_size !== 'undefined' && type.max_file_size) {
if (file.size > type.max_file_size) {
phpbb.plupload.uploader.trigger('Error', {
code: plupload.FILE_SIZE_ERROR,
message: plupload.translate('File size error.'),
file: file
});

callback(false);
} else {
callback(true);
}
} else {
callback(true);
}

return false;
}
});
}
});


var $fileList = $('#file-list');



var $fileList = $('#file-list');