Add error message when embedding a URL and uploading a file at the same time

Closes #62
This commit is contained in:
Trevor Slocum 2018-08-01 10:12:57 -07:00
parent 7446ac644d
commit aabd70bca4
1 changed files with 4 additions and 0 deletions

View File

@ -121,6 +121,10 @@ if (isset($_POST['message']) || isset($_POST['file'])) {
$post['nameblock'] = nameBlock($post['name'], $post['tripcode'], $post['email'], time(), $rawposttext);
if (isset($_POST['embed']) && trim($_POST['embed']) != '' && ($rawpost || !in_array('embed', $hide_fields))) {
if (isset($_FILES['file']) && $_FILES['file']['name'] != "") {
fancyDie("Embedding a URL and uploading a file at the same time is not supported.");
}
list($service, $embed) = getEmbed(trim($_POST['embed']));
if (empty($embed) || !isset($embed['html']) || !isset($embed['title']) || !isset($embed['thumbnail_url'])) {
fancyDie("Invalid embed URL. Only " . (implode("/", array_keys($tinyib_embeds))) . " URLs are supported.");