Fix Lack of detailed error message during schema creation

During MantisBT installation, when a schema upgrade step includes
several SQL statements (as generated by ADOdb), a detailed error message
was only reported the problem occurs while executing the last statement.

Calling ExecuteSQLArray() with the 2nd param = false forces the function
to return the error message on first failure instead of continuing with
the next statement.

Fixes #14399
Localisation updates from http://translatewiki.net.
Fix #14418: Alternate text for logo image is hardcoded
Fix #14420: system warning in make_captcha

Per PHP documentation [1], second param of imagejpeg() should be set to
null to output the image directly.

Thanks to Andrew Kovalenko for noticing and providing fix for the issue

[1] http://php.net/imagejpeg
Fix PostgreSQL error when adding project/subproject

Release 1.2.11 (see commit b8d4b5039598248d0b0c78619450c51d4dc98df2 and
issue #14288) introduced a regression preventing the user from creating
a new project or adding a subproject.

The error is caused by columns mantis_project_table.inherit_global and
mantis_project_hierarchy_table.inherit_parent, which are defined as
unsigned int in schema.php, but treated as boolean in the code. This is
a problem with PostgreSQL due to strict type checking, but not on MySQL
as type cast is done automatically.

This commit is a workaround for the problem (sending an int to the DB
instead of a bool if using PostgreSQL), as fixing the root cause would
require a schema change which is not possible in 1.2.x.

Fixes #14385
Fix PostgreSQL error when updating a project

Release 1.2.11 (see commit b8d4b5039598248d0b0c78619450c51d4dc98df2 and
issue #14288) introduced a regression preventing the user from updating
an existing project.

This commit is a workaround for the problem (sending an int to the DB
instead of a bool if using PostgreSQL), as fixing the root cause would
require a schema change which is not possible in 1.2.x.

Fixes #14385
Fix #11687: Bugs with attachments that are moved will lose attachments

Backporting 08c027af59b88a6934377d71d19a86edfd7d12dd to 1.2.x branch.

When a bug is logged and assigned to a project which has a project path
assigned, and later a mantis "administrator" moves the bug from the
initial project to a new project, the attachments are lost.

Signed-off-by: Damien Regad <damien.regad@merckgroup.com>
Fix #11687: use of incorrect error constant
Localisation updates from http://translatewiki.net.
SOAP API: calling mc_issue_update unduly updated bugnotes

History shows 'Note View State changed' even though it has not been
modified, and if time tracking is enabled the bugnote's last_updated
date is changed.

This was caused by a type-strict comparison of the value returned by the
api (string) to an integer.

Fixes #14412
LDAP binding calls are made even if $g_login_method <> LDAP

If for some reason $g_use_ldap_email or $g_use_ldap_realname are ON with
$g_login_method <> 'LDAP', binding calls are attempted when retrieving
the user's e-mail or real name.

Adding a check on $g_login_method to avoid this unwanted behavior.

Fixes #14442
Fix system warning in html_status_legend() with custom status

When using custom status for which no language strings are defined,
html_status_legend() triggered system warnings.

MantisBT now displays the custom status' name as defined in the enum,
in case there is no available translation string.

Fixes #14446
Add param to bug_resolve() to allow "resolution" to custom status

Function bug_resolve() sets the status to bug_resolved_status_threshold.
This behavior is fine with MantisBT's default status enum, but is
causing issues when using a custom target status that is
>= $g_bug_resolved_status_threshold & < $g_bug_closed_status_threshold.

In this case, when changing status using the button on view.php, the
target status selected by the user is overriden by the value of
bug_resolved_status_threshold, resulting in incorrect behavior. The only
way to effectively reach the custom state is by editing the issue.

To address this, a new optional parameter $p_status is added to
bug_resolve(). To make the function call more logical, the signature was
modified: new parameter inserted in 3rd position after $p_resolution.

The function's phpdoc header has been completed.

Fixes #14443
Code cleanup in bug_update.php

Fixes whitespace, code alignment, typos in comments, long lines
Whitespace fixes
Fix email validation regex rejects addresses with single subdomain

Per RFC 5322, e.g. user@localhost is a valid e-mail address but the
previously implemented regex rejected it.

Fixes #14453
Fix #14448: 'Undefined index: jpg' in '.../core/file_api.php'
Custom field validation should pass when empty and min length > 0

Fix for #12029 (commit 9c71d4f884200f682636e772cf3584202fc2443d)
introduced a regression in the validation of numeric custom fields when
the field's minimum length is greater than 0 and the data being
validated is empty. This prevents e.g. reporting of new issues with a
hidden custom field, or updating issues having a non-required, empty
field.

This commit resolves the problem by passing validation when the field is
empty. This should not cause problems for required fields, as that case
is covered by an earlier check in bug_report.php and bug_update.php.

Fixes #14516
Fix #14192: Add Exchange header for automessage
Localisation updates from http://translatewiki.net.