[ticket/13018] Remove duplicate logic in confirm box and alert box handling.

This ensures a more consistent handling of the various closing/opening actions
and fixes some bugs where certain event handlers are not turned off in certain
instances.

PHPBB3-13018
[ticket/13018] Reduce the delta further.

The callback does not actually do anything when cancelling the confirmation
box so we can avoid calling it altogether when cancel is clicked.

PHPBB3-13018
[ticket/13018] Do not handle events in close function.

PHPBB3-13018
[ticket/13018] Clean up and fix some logic.

PHPBB3-13018
Merge pull request #2958 from prototech/ticket/13018

[ticket/13018] Remove duplicate logic in confirm box and alert box handling.

* prototech/ticket/13018:
  [ticket/13018] Clean up and fix some logic.
  [ticket/13018] Do not handle events in close function.
  [ticket/13018] Reduce the delta further.
  [ticket/13018] Remove duplicate logic in confirm box and alert box handling.