install: remove define(BFPATH) in favour of new define(INSTALLPATH)

public/index.php defines a BFPATH constant as pointing to bonfire/

The installer was confusing matters by defining a BFPATH constant
to point to application/.  Replace it with a variable,
Installer_lib::APPPATH.  Also provide ::FCPATH and ::BFPATH
variables to match; we'll use them later.

The variables are all derived from the same $path in index.php
(transmitted through an INSTALLPATH constant) - I'm not trying
to support sharing a BFPATH between multiple apps with these
changes.

This does not alter the standard CI _constants_ FCPATH and APPPATH.
I.e. inside the installer, these constants will still point to install/
and public/install/index.php respectively.
install: simplify paths using new variables

We can now remove these str_replace() shenanigans.
install: fix mistaken uses of FCPATH

Many of the uses of the FCPATH constant in installer_lib were wrong -
they wanted the FCPATH used by the installed app, not the FCPATH used
by the installer app.  The installer still worked because the affected
code is either dead or non-essential.

One affected instance of FCPATH.'../' can be replaced with INSTALLPATH,
so it now respects the value of the $path variable in install/index.php.
config_file_helper: don't call Modules::find() for null module

Installer doesn't have Modules, so this should let us share the code a bit
more freely.

Might also avoid some unexpected results.
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().

Conflicts:
	bonfire/helpers/config_file_helper.php
install: remove two uses of APPATH.'../bonfire'