From aabd70bca4bd5cf5960249368886484c63d22884 Mon Sep 17 00:00:00 2001 From: Trevor Slocum Date: Wed, 1 Aug 2018 10:12:57 -0700 Subject: [PATCH] Add error message when embedding a URL and uploading a file at the same time Closes #62 --- imgboard.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/imgboard.php b/imgboard.php index 7cbc3ea..6f81e8b 100644 --- a/imgboard.php +++ b/imgboard.php @@ -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.");