Unify the config_file_helpers in installer & main Bonfire

Installer's write_db_config() had an $apppath option, to allow targetting
the real bonfire directory.  Add the option to write_db_config() and
write_config() in main Bonfire, then I can copy its version of
config_file_helper.php back into the installer.

This replaces the installer's hack for write_config(), so change the
callsite in the installer as well.

There was one other fix from the installer's write_db_config(), which
can easily be seen in the diff around file_get_contents().
install: remove two uses of APPATH.'../bonfire'