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 #15451: Incorrect invocations of SoapObjectsFactory::newSoapFault

Signed-off-by: Robert Munteanu <robert@lmn.ro>
Fix #15453: Only display Close button if workflow allows Closed status
Documentation: custom fields localization

The indications in the Custom Fields localization section contained an
incorrect reference to lang_get_current() to determine the current
language in custom_strings_inc.php. Using this function will cause the
code to return incorrect translations if the default language is
different from English.

Fixes #10118
Fix #2971: add reminder events to the bug history
Removed trailing ':' from reminder_sent_to language string

This is for consistency, as except for error messages punctuation is
generally added by the code.

Issue #2971
Improve handling of reminders' recipients list truncation

Replaced the previous method of truncating the list to a hardcoded
number of entries (50), to a more robust approach based on the size of
the underlying database field (250 chars, note_attr in bugnote table).

Added a message on the REMINDER bugnote, to inform user that the list of
recipients stored with the note, was actually truncated (Users should
refer to the issue's history to see who actually received the reminder).

This functionality relies on a hack, i.e. to indicate that the list was
truncated, bug_reminder.php is not storing the trailing delimiter in the
note_attr field, and this is picked up in bugnote_view_inc.php to
display the note to the user's attention.

Fixes #15470
Optimize code to add reminder recipients to monitoring list
Fix return value of email_bug_reminder()

The function now returns an array containing only the users to whom the
reminder e-mail was actually sent (i.e. excludes failures, blank e-mails,
etc).

In addition, the return value is now an array of user id's instead of
user names, which indeed makes more sense from an API perspective, as
mentioned by Julian Fitzell in 5ea3d0bc837ef14fd66b63d63e5481ea3addcf29,
since the function's only caller is bug_reminder.php which exclusively
relies on user id's.

Fixes #15472
bug_reminder.php does not handle unsent reminders

Reminders are not logged in history (or the bugnote) if the e-mail was not
actually sent to the recipient.

The function now uses email_bug_reminder()'s return value instead of the
full user-provided list of recipients for inclusion in the reminder's
bugnote and to add history entries.

Fixes #15471