Fix regression in test_langs.php

Commit 78cee358 added file Web.config to plugins and lang folder.
test_langs.php treated the file as a plugin folder and a language file.
Fix: email address threshold check

Currently, we check for access to view the users' email address
against the threshold for the current project.

This check should occur against the threshold for the project that
the bug being viewed is located in instead.
Store config entries json encoded

Store collapse tokens as json encoded

Store MantisGraph tokens as json encoded

Store Filters json encoded
Remove legacy code following nusoap removal
Only show webmaster email if not blank.

This allows someone to disable showing 'contact us' line at the bottom of the page.
Fix: adm_config_report.php filtering does not check config option is valid

I've left this throwing ERROR_GENERIC as the only time this should be able
to be hit is if we have invalid input to start with.
Fix usage of db_query_bound

Pass all parameters in as arguments in user_api.
Remove inbuilt php long arrays

PHP Long arrays are deprecated and removed in php 5.4.

We already check both $_SERVER and $GLOBALS
so there's no need to check for $QUERY_STRING itself.
Use crypto API as random number source to generate filenames

Whilst I can't really see anyone being able to do anything useful with this,
instead of using a seed (of time() + bug ID), which could be predicatable.

We instead use our complex random string routines that dhx added.

In addition, I've fixed the comment on file_generate_unique_name to state
it returns 32 characters and not 64 characters. I did consider whether to
fix the code to match the comment, but in this case, it would seem to be
likely to be less problematic to stick with the shorter string.

In addition, I've dropped the 'file_generate_name' function, in favour of
just having a single function to generate a unique name. Even the while()
loop in the generate_unique_name function seems somewhat excessive:
current downside: it's an extra DB query - given we could prepend the seed
(bug_id), add an _ and the chances of md5() generating a collision is
probably fairly low.
Fix db_get_table calls in move attachments pages
use strtolower over utf8_strtolower for choice of get|post.

We should probably consider whether to change this function to use a user defined constant.
The value stored in the config table may be a string, boolean, or integer.

For better compatibility across the db layers, we should always cast this
to a string, to match the underlying data type.
Backport from DB API changes functionality to set table name.

This would allow the use of the new syntax i.e.:

-$t_query = 'SELECT COUNT(*) AS unused_user_count FROM ' . $t_user_table . '
+$t_query = 'SELECT COUNT(*) AS unused_user_count FROM {user}

Whilst still allowing use of the old syntax, to give developers and plugin
authors the opportunity to start migrating code to the new syntax ready
for the 2.x.

By doing this, it also helps us extend the life of 1.3 - as it stands, if we
release test versions of mantis with the new DB layer about within a month of
the final 1.3 release as previously agreed, we could reach the stage where we
have support issues from our side for the 1.3 release.
Update commit following Damien's comments.
Single quotes around function names
Fix typo in install function name
DB Casts within custom field api.

For better compatibilty across the db layers and types,
cast the parameters appropriately
adm_config_report: improve invalid config handling

When receiving an invalid config_id, the page will default the select to
[any] (META_FILTER_NONE) instead of adding the invalid config to the
list.

Improvement over cabacdc291c251bfde0dc2a2c945c02cef41bf40, we don't
really need to trigger an error here, it's more user-friendly to fall
back to a sensible default, similar to what we do when given an invalid
project.
DB Casts within history api.

    For better compatibilty across the db layers and types,
    cast the parameters appropriately
remove most references to (unused) document_files_prefix config setting