add simple script to write a patch
This commit is contained in:
parent
32fa9a3313
commit
1874ba22ff
|
@ -1,2 +1,4 @@
|
||||||
cache
|
cache
|
||||||
attachments
|
attachments
|
||||||
|
*.sh
|
||||||
|
*.patch
|
||||||
|
|
|
@ -23,9 +23,7 @@ if (!defined('SMF'))
|
||||||
|
|
||||||
function UploadAttachment()
|
function UploadAttachment()
|
||||||
{
|
{
|
||||||
global $txt, $scripturl, $topic, $modSettings, $board;
|
global $modSettings, $user_info, $sourcedir;
|
||||||
global $user_info, $sc, $board_info, $context, $settings;
|
|
||||||
global $sourcedir, $options, $smcFunc, $language;
|
|
||||||
|
|
||||||
if (!allowedTo('post_attachment') && !allowedTo('post_unapproved_attachments')){
|
if (!allowedTo('post_attachment') && !allowedTo('post_unapproved_attachments')){
|
||||||
die(json_encode(array(
|
die(json_encode(array(
|
||||||
|
@ -67,44 +65,6 @@ function UploadAttachment()
|
||||||
'ok' => false,
|
'ok' => false,
|
||||||
'error' => $attachmentOptions['errors'][0]
|
'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');
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue