Whitespace fixes
Revised PHPdoc for file_add() function
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.
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>
UserTest: preferences should compare against default value

Previously the test was comparing the retrieved user preference
'bugnote_order' with a hardcoded value, so the test would fail if the
config_inc settings were different.

Fixes #16204
IssueHistoryTest: Fix Whitespace
IssueHistoryTest: use MantisBT constants
IssueHistoryTest: fix failure when using descending order

Tests would incorrectly be marked as failure when $g_history_order is
set to DESC, as the cases assume the default of ASC.

Fixes #16205
IssueHistoryTest: fix random failure with simultaneous entries

This happens when history entries are created in rapid sequence (i.e.
within the same second), and the RDBMS then returns the records in
random order. Since the tests rely on a fixed order of the entries, this
occasionally causes failures.

Fixes #16203
Tests: move include of constant_inc.php to SoapBase.php
Remove useless variable initialization

Follow up fix on commit ec5397514cd2e96eb8dfba4b9940ab8c0cde1d49
Fix #16187: error caused by array_combine() with PHP<5.4

array_combine() function behavior was changed in PHP 5.4 [1]; in earlier
versions it would issue a warning and return false when working with
empty arrays, which then causes Mantis to trigger an application error.

This is a regression introduced by cc7703acc8d05f253d52a152a7d8cd0c1c43815d

[1] http://php.net/function.array-combine.php
Fix #16158: mc_filter_get_issues does not populate monitors fiels for
retrieved issues
soap api: make sure we have a compatible soap extension installed

Even though the soap extension is installed, versions of PHP older than
5.2.2 do not support all the features we need. To guard against
unexpected errors, we now enable the soap extension if the
SOAP_USE_XSI_ARRAY_TYPE constant is defined. This constant is used at
runtime by the SOAP extension and is a good indicator of a recent enough
soap extension.

Fixes #16252: API SOAP provides no answer after MantisBT upgrade
Merge branch 'master' into 13x