I think the 2nd File Edit could be done as a Plugin on Hook showthread_complete, and maybe should check for Quickreply being shown - otherwise it does unnecessary work
PHP Code:
$attach_editor['url'] = "newattachment.php?$session[sessionurl]t=$threadinfo[threadid]&poststarttime=$poststarttime&posthash=$posthash";
This must be changed to
PHP Code:
$attach_editor['url'] = 'newattachment.php?' . $vbulletin->session->vars['sessionurl'] . "t=$threadinfo[threadid]&poststarttime=$poststarttime&posthash=$posthash";