OverrideOutgoingMailFrom: Use $CorrespondAddress if the queue's isn't set

Otherwise the meaning of the Default key changes depending on the
queue's correspond address being set or not.  Using the global
correspond address for queues with no specific correspond address, as
well as moving the Default check into the else branch, means the Default
key is only used when there's no ticket involved.  This is the
documented behaviour in RT_Config.pm.
SetOutgoingMailFrom: Accept an email address as a value and use it globally

Covers the simple case of sending all bounces to a specific address,
without the only previous solution of resorting to defining all queues
in OverrideOutgoingMailFrom.  Any definitions in the Override option
still take precedence.
Explicitly force 404s on non-WebPath requests

Because the DocumentRoot is set to share/html, a request for /index.html
with WebPath set to /rt still _succeeds_, and presents the Mason source
for share/html/index.html

Add an explicit rewrite rule to 404 anything which is not under the
WebPath.
Don't exit a sub via next

If your lib/ contained anything but .pm files you would get a bunch of
perl warnings about next'ing out of the sub instead of returning.
Allow for an html/ directory

RT doesn't have one (since the 3.8 days) but external extensions use
html not share/html.
Check for the existence of items before tagging

When running this script outside of RT, you often won't have a
devel/tools or a Makefile.in
Warn on failures to create RT::URI::* resolver objects

Otherwise compilation errors and the like are hidden in $@ never to be
seen by human eyes.

Errors locating the RT/URI/*.pm file itself are ignored so as not to
fill the logs with noise on normal http, https, ftp, etc. links.
Error handling for text and HTML quote extraction when displaying attachments

Improves the error message by adding the attachment ID and directs bug
reports to rt-bugs@bestpractical.com.
RT::CurrentUser objects should access Attributes as an RT::User

Otherwise attributes on the user object aren't found when accessed via
an equivalent current user object.

A larger, more invasive 4.2 fix for this should be introducing an
_ObjectType method or similar which is provided by the superclass and
used instead of ref().
Only treat ">" as an email quoting character

All of the other defaults (!, #, %, =, |, :) cause too many false
positives and hardly any true use as a quote character.
return more results when reminders are updated
Escape { and } in regexes when used as literals

Perl 5.17.6 (on the path to 5.18) deprecates and warns quite noisily
about unescaped braces.  RT's dependency chain isn't fully clean of this
warning, however...
File::Temp under 5.18 warns if passed an undefined template

File::Temp does not require that a defined template be provided -- if an
even number of arguments is passed, an undef template is assumed.  This
has been true for all versions of File::Temp, so does not break
backcompat.

Explicitly passing an undef template causes "Use of uninitialized value
$_[0] in string eq" warnings on 5.18, so skip doing so.
Don't force Bookmarks to be unlimited.

This code dates from the original Bookmarks implementation when we just
used '__Bookmarks__' instead of "id = '__Bookmarked__'".

Without this, if you have 20 bookmarks, they all list on your homepage.
After the change, it obeys RowsPerPage.

Bookmarks is a normal search now, so you can always click on the title
to see a 'full' list.

I'm leaving __Bookmarks__ alone because it's the old deprecated code
that we're going to remove in 4.4 anyway.
Create new reminders in the configured "reminder_on_open" status

Otherwise reminders are created in the lifecycle's "on_create" status.
Completing reminders in this case requires a transition between the
"on_create" status (often "new") and the "reminder_on_resolve" status,
which may not be present outside of the stock configuration.

Additionally, creating reminders in a status other than the open status
means reminders start in a state that they can never return to;
re-opening a completed reminder returns to the open status, not the
create state.

Reminders don't need the complexity of a full lifecycle, and a two-state
system of "open"/"complete" is fine.

This does require that the reminder_on_open status is valid at creation
(i.e. can transition from "").  That requirement is less onerous than
requiring a transition directly from a new state to an inactive state.
Merge branch '4.0/outgoing-mail-from' into 4.0-trunk

Conflicts:
	etc/RT_Config.pm.in
Upgrade notes for the Set/OverrideOutgoingMailFrom changes
Show friendly string instead of "0" for non-ticket "local" links in search results
extract our code that fetches table names

keep function private, so far we use it in upgrade
scripts and tests.
require newer DBD::Pg on Pg 9.2 for upgrade

We use DBI's table_info method in upgrade scripts.
It fails on Pg 9.2 with old DBD::Pg driver. We don't
have to bump required version for all Pg users, but
can help users of Pg 9.2 to solve the problem by
providing better error message.