Whitespace fixes
Revised PHPdoc for file_add() function
Backport changes to file_add() function from master

Align with changes from 84017535f8718685d755d58af7a39d80f52ffca8
to ease future code maintenance.
Use bind variables in file_add() function

Use of db_query() in file_add() is causing issues on Oracle due to the
size of literal SQL statements being limited to 2000 chars: error
ORA-01704 occurs when attaching files with DB storage. To avoid the
problem, bind variables must be used.

We now call db_query_bound() instead of db_query(), and file_add() has
been refactored to remove usage of deprecated db_prepare_* functions.

Fixes #14563
Fix encoding of BLOB columns

The db_prepare_binary_string() function was designed for use with
db_query(), and therefore used to surround the binary string to
encode with single quotes.

Use of db_query_bound() with the function's return value would result in
a corrupted attachment because the quotes would be treated as integral
part of the binary data.

MySQL does not require any special encoding (except regular string
processing which is already done by db_query_bound()).

For PostgreSQL, instead of calling pg_escape_bytea() directly, we now
use ADOdb connection's BlobEncode() method.

MSSQL encoding was left as is was (no test platform available).

Based on documentation, Oracle (oci8) should not require any encoding
either, but was not tested either.

Fixes #12955
Move error checking code to beginning of file_add() function
SOAP API: align mci_file_add() with core file_add()

Most importantly, use bind variables (db_query_bound) and remove
deprecated db_prepare_* function calls.

A few other, minor changes were made to ensure mci_file_add() is as
similar as possible as the core file_add(), and the two functions behave
in a consistent way.
Whitespace fixes
SOAP tests: fix issue with testProjectAttachmentIsAdded()

The assertions for the project attachments are incorrect, as the rely on
there being no existing files, consequently the test fails if there are
any existing documents attached.

Added messages on assertions to facilitate troubleshooting.
Fix errors in mc_file_add()

SYSTEM NOTICE errors were detected by phpunit tests.
Remove calls to deprecated functions db_prepare* in "Docs" update page

Those calls cause the strings to be escaped twice : by db_prepare* and
then by db_query_bound, which leads to backslashes apparing in the
database.

All c_ prefixed variables have been removed as well, as there is no need
anymore for SQL cleaned variables.

Fixes #14541

Signed-off-by: Damien Regad <damien.regad@merckgroup.com>
Fix invalid access denied error caused by access_has_bug_level()

Commit d42e80c01277eec37c7436a23ec72073c9961c49 changed the code in
access_has_bug_level() function, and introduced a bug in the call to
access_compare_level() when access is limited to issue reporter
(inverted parameters caused an incorrect access denied error).

See also 9ec47a056156ac32e1f95cd0ec20d4db8bd54d3b.

Issue #15538
Print pages: don't show custom fields user has no access to

Prior to this, if a custom field's 'read' access level were higher than
the user's access, the print pages would display the field's label (but
not the data). This behavior is not consistent with how this situation
is handled in the View Issue page, where the field is not shown at all.

For consistency, we now skip the of the custom field users have no read
access to in the print pages, so that nothing is displayed.

Fixes #15528
Documentation: added php_mbstring as recommended extension

Fixes #15575
Localisation updates from http://translatewiki.net.
filter_api: ensure that the free_text where clauses are always ANDed

Fixes #15573: One query can be issued via current Mantis interface to
take down site
email_bug_info_to_one_user() is not using email_build_subject() function
add hook EVENT_DISPLAY_EMAIL_BUILD_SUBJECT for email subject
Localisation updates from http://translatewiki.net.
Revert "filter_api: ensure that the free_text where clauses are always ANDed"

This reverts commit 543ba012999c20310a2208bd8e5f7f88efe392ce.