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.
Check project existence before access level

Failure to do so causes "Project not found" error when a user has a
cached filter on a project that has been deleted.

Fixes #17520
Fix SQL error in profile_get_field_all_for_user()

Regression from b78f966e013d494ea27d92bba39d797a1266b7b7