add simple script to write a patch

This commit is contained in:
Vivian Lim 2020-07-24 19:28:57 -07:00
parent 32fa9a3313
commit 1874ba22ff
2 changed files with 3 additions and 41 deletions

2
.gitignore vendored
View File

@ -1,2 +1,4 @@
cache
attachments
*.sh
*.patch

View File

@ -23,9 +23,7 @@ if (!defined('SMF'))
function UploadAttachment()
{
global $txt, $scripturl, $topic, $modSettings, $board;
global $user_info, $sc, $board_info, $context, $settings;
global $sourcedir, $options, $smcFunc, $language;
global $modSettings, $user_info, $sourcedir;
if (!allowedTo('post_attachment') && !allowedTo('post_unapproved_attachments')){
die(json_encode(array(
@ -67,44 +65,6 @@ function UploadAttachment()
'ok' => false,
'error' => $attachmentOptions['errors'][0]
)));
/* consider mapping errors to readable strings
if (in_array('could_not_upload', $attachmentOptions['errors']))
{
checkSubmitOnce('free');
fatal_lang_error('attach_timeout', 'critical');
}
if (in_array('too_large', $attachmentOptions['errors']))
{
checkSubmitOnce('free');
fatal_lang_error('file_too_big', false, array($modSettings['attachmentSizeLimit']));
}
if (in_array('bad_extension', $attachmentOptions['errors']))
{
checkSubmitOnce('free');
fatal_error($attachmentOptions['name'] . '.<br />' . $txt['cant_upload_type'] . ' ' . $modSettings['attachmentExtensions'] . '.', false);
}
if (in_array('directory_full', $attachmentOptions['errors']))
{
checkSubmitOnce('free');
fatal_lang_error('ran_out_of_space', 'critical');
}
if (in_array('bad_filename', $attachmentOptions['errors']))
{
checkSubmitOnce('free');
fatal_error(basename($attachmentOptions['name']) . '.<br />' . $txt['restricted_filename'] . '.', 'critical');
}
if (in_array('taken_filename', $attachmentOptions['errors']))
{
checkSubmitOnce('free');
fatal_lang_error('filename_exists');
}
if (in_array('bad_attachment', $attachmentOptions['errors']))
{
checkSubmitOnce('free');
fatal_lang_error('bad_attachment');
}
*/
}
}
}