update api module for image fixes

This allows setting a URL for an image for persons and organizations
over the API. It also correctly displays the _id field of images added
using the front end and provides the URL for images hosted on the popit
instance.
display add another x buttons consistently

In view mode if there is an existing link, contact etc then make sure an
add another button is displayed that takes you into edit mode. Also
make language on the Add another buttons in edit more consistent with
the buttons in view mode.

Fixes #618
Remove extraneous labels on edit forms

There were extra labels for several of the tabs which were creating
visual clutter
keep selected tab when switching to edit mode on org page

Detect if we are on the organization page or the persons page so we can
do the correct selector to work out which is the active tab when
switching to edit mode
retain active tab when saving changes to org/person

Add the url hash to the form action so that when the saved page is
loaded it displays the tab selected when save was pressed so it's easier
to see that changes have been saved
replace-database: it's safer to use second granularity in the timestamp

It's very common for me to have to run replace-database more than once a
day, but extremely unlikely that one would run it twice in a second for
the instance, so I think it's safer to have the timestamp to a
granularity of seconds rather than days.
Switch to passport-localapikey-update module

The passport-localapikey module is no longer being maintained and the
latest version, with support for putting the API keys in the headers,
hasn't been released to the npm registry.

To work around these issues passport-localapikey-update has been
created, which has the added bonus of being updated to work with the
latest version of passport, which should hopefully reduce the chance of
problems due to differing versions.
Merge branch 'small-ui-fixes'
Make sure NODE_ENV correctly set and we're using the right master db

If NODE_ENV is not set then it will fall back to development which means
that on a production server any settings in a production config will be
ignored. To avoid this we require that NODE_ENV be set.

As a further check compare the master db name passed in on the command
line and the one that is used by a node script to make sure they agree
and bail if they don't
Search organization names as well as person names

Refactor out the name_search method to utils and use that for searching
organizations too. Then use it to search both the organizations and
persons and concatenate the results.

Add a label to the results to indicate what type of entity each result
is just in case.

Fixes #476