JSON CIG: Now escaping object and array keys

Previously scalar values were being escaped properly, but not array
and object keys. This commit fixes that.
Merge branch 'master' of github.com:NagiosEnterprises/nagioscore

* 'master' of github.com:NagiosEnterprises/nagioscore:
  Prep for 4.0.8 release.
  Changelog for runcmd fixes.
JSON CGI: Fixed memory overwrite issue in string escaping.
Archive JSON: Fixed null pointer dereferences

When the time period for the state change list and availability queries in
the archive JSON is sufficiently small, there may be no entries in the list.
Previously this could have caused pointers that were never initialized to
be deferenced. This commit adds checks to verify that those pointers are not
null before using them.
Macros: Strip/escape long output macros again.

Previously these had been marked to have invalid characters stripped or
escaped when output. 3e971bb699c144850a48662adfb4f181ff3a1597 removed
this per-macro information. fbab504b738666bc0c613ac6a1a9dffe5d5a679b
restored this, but not for the long output macros, and also changed the
flags for other macros.

As the historical behavior was to strip these long output macros, and
our "Understanding Macros and How They Work"
(http://nagios.sourceforge.net/docs/nagioscore/4/en/macros.html)
documentation includes them in the list of macros to be
stripped/escaped, we'll restore that behavior. The documentation for
illegal_macro_output_chars should be brought into line as well.

The stripping, escaping, and URL-encoding of macros has seen some flux
from c56c1373d17db228041fea6f52d4091bd8cca798 through
4b8877ca7b438984d4cd16b2a819e9fcf85ebc06,
977e68bf6a86647d8a8348e06ec8d7e12c668632,
8b64789bb67f6200f679b6247b2a2dd5fd9bdee8,
3e971bb699c144850a48662adfb4f181ff3a1597 and
fbab504b738666bc0c613ac6a1a9dffe5d5a679b, to this commit. There will
likely be further changes to arrive at an improved solution.
Fix checkresult output processing (again).

Similar to 0834195418570a457e525334b743ffa91e548dbc, this commit
unescapes plugin output submitted via external commands.

The unescape_check_result_file_output() (previously
unescape_newlines()) function that handles the unescaping has been
renamed and made externally visible so it can be used from base/utils.c
and base/commands.c.

The previous braggadocio should now be correct: All checkresult output,
single or multiple line, and from all sources, should now be parsed
correctly by Core.
runcmd: Fix build when we don't HAVE_SETENV.

A two character change (or move a '=' character...) to fix an
incredibly horrid mistake on my part that broke the build on Solaris,
OS X, and other systems that don't have setenv(). I didn't retest
without HAVE_SETENV after adding in the errror handling. I'm going to
frame this and put it on the wall next to the other smart things I've
done...
JSON: Fixed escaping of keys for scalar values
Merge branch 'master' of github.com:NagiosEnterprises/nagioscore

* 'master' of github.com:NagiosEnterprises/nagioscore:
  runcmd: Fix build when we don't HAVE_SETENV.
  Fix checkresult output processing (again).
  Macros: Strip/escape long output macros again.
Status JSON: Added next_check to service details
Fixed Github bug #18 - archivejson.cgi returns wrong host for state change query
Merge branch 'master' into localize-Japanese

Conflicts:
	cgi/jsonutils.c