Fix: Email processing occurs in the wrong order.

The purpose of the email queue is to allow batch processing emails to speed up web page response.

Our aim should be to ensure the email table is as close to empty at all times,
(if cron jobs are not used, we try to clear the table at the end of the web page request)

Therefore:

a) There's no need to define a custom sort order for the table. In the ideal world, where the table is empty, the sort order is going to be irrelevant

b) Emails should be sent in the order they are generated. Therefore, they should always be processed in ASCending order.

After this, I plan on looking at how we handle emails that previously errored to ensure that users are notified of problems in some way, and we avoid performance issues, as email troubleshooting is one of our more popular support issues with end users
Fix #0016570: Page content is forgotten when user clicks [Back] button

By default we disable $g_allow_browser_cache in all circumstances.

The config value is commented out in config_defaults.inc.php. In fact, thraxisp
added the config option in 2005 in the commented out state.

It would appear the DHX re-ordered this call when implemented require_api
- see:

 https://github.com/mantisbt/mantisbt/commit/2d5455cce290531359a55d353010258c6f3f6f34

The above code is only in 1.3 and not in the 1.2 series, so the above fix should
be safe to apply.

We probably need to consider whether we actually want to remove this configuration option

After all, it's a configuration option we've probably never had anyone use in 5 years
so I expect that the value of it is rather....
Fix missed global variables
Fix E_RECOVERABLE_ERROR in category API

category_sort_rows_by_project() is called in 2 steps:
1. with a project id in 1st param to set the "preferred" project (and
   2nd param null)
2. with 2 arrays containing category details

Because of this behavior, the 'array' type hint can't be used on the
first parameter as it throws an error when initializing the sort in
category_get_all_rows().

Regression introduced by 5458f7020999317b35f403fa2a0e477d6182ec12

Fixes #17515
Fix application error 203 when reporting new issue

There was a missing '"' in function print_category_option_list().

Regression introduced by ee1b1c959ff4cf8458aa901fdbe6c13e0571a9b8.

Fixes #17512
Fix PHP notice in admin index page

The error is caused by incorrect regex in ADOdb library.
See https://github.com/ADOdb/ADOdb/issues/16

Fix was applied by cherry-picking commit from upstream master branch
https://github.com/ADOdb/ADOdb/commit/701798f02ad2f06f7bba9e3922a2f6a9d8f05918
Fix missing button on "Workflow Thresholds" page

Regression introduced by ee1b1c959ff4cf8458aa901fdbe6c13e0571a9b8

Fixes #17507
Fix #17506: type mismatch error in news edit page
Fix #17519: button label in bug update page
Localisation updates from https://translatewiki.net.
Fix system notice in tag_view_page.php

Use of undefined constant name - assumed 'name'

Fixes #17518
Fix system notices in tag API

Use of undefined constant id - assumed 'id'

Fixes #17518
Fix system notices in filter API

Use of undefined constant id - assumed 'id'

Fixes #17518
Whitespace
Remove extra word and whitespace in comments
Fix Undefined offset system notice in filter api
Fix 'Attached Issues' link on tag_view_page.php

After clicking the link, Mantis triggers SYSTEM WARNING: 'Invalid
argument supplied for foreach()' in 'gpc_api.php' line 259.

The root cause is actually an additional E_RECOVERABLE_ERROR (Argument 2
passed to gpc_get_string_array() must be of the type array, integer
given) which is thrown in search.php but hidden with default error
display settings.

Regression introduced by 5458f7020999317b35f403fa2a0e477d6182ec12.

This resolves the problem by changing the default value passed to
gpc_get_string_array() by search.php from (integer) 'META_FILTER_ANY'
to 'array( META_FILTER_ANY )'.

Fixes #17517
Set profile to user's default when reporting issues

The default profile was not picked up before this, because the caller
(bug_report_page.php) actually sent '0' as profile id to select, while
the print functions did a strict check for ''.

Fixes #9460
Fix E_RECOVERABLE_ERROR calling gpc_get_string_array()

Argument 2 passed to gpc_get_string_array() must be of the type array,
integer given) is thrown (but hidden with default error display
settings).

Regression introduced by 5458f7020999317b35f403fa2a0e477d6182ec12.
Fix E_RECOVERABLE_ERROR in filter_draw_selection_area2()

filter_draw_selection_area2() calls current_user_get_bug_filter() which
returns false when no filter is currently defined. This value is passed
on to filter_ensure_valid_filter() which expects an array, triggering
the error.

To fix the problem we pass an empty array if there is no defined filter.

Regression introduced by 5458f7020999317b35f403fa2a0e477d6182ec12.