I need to add functionality to an existing open source forum software called Kusaba X ([url removed, login to view]). When posting a message there's an option to upload an image attachment, I need an additional field in which an image's URL can be entered, instead of uploading an image file. If a valid image URL is provided, the code should fetch the image and pass it on to the existing code handling image attachments as if it were an uploaded file. Fetching should use referrer spoofing with the image URL's domain. The image URL field should be a hidden input.
* A working version of the forum software with the additional function.
* Detailed instructions on how to add the additional function to a clean version of Kusaba X.