mysqli: Allow specification of a unix socket

This patch allows for the specification of a socket in the database hostname
field, such as localhost:/path/to/mysql.sock
Merge pull request #864 from greezybacon/issue/mysqli-local-socket

mysqli: Allow specification of a unix socket

Reviewed-By: Peter Rotich <peter@osticket.com>
upgrader: Fix 1.6 banlist corruption on upgrade
Merge pull request #869 from greezybacon/issue/upgrade-banlist-corruption

upgrader: Fix 1.6 banlist corruption on upgrade

Reviewed-By: Peter Rotich <peter@osticket.com>
ui: Fix missing <html> tag for client panel
ui: Add closing div for attached files block

Fixes #356
Honor ticket number in subject line without brackets

We introduced a glitch in 29b3714, which was the patch that introduced
matching on email headers other than the Subject.

I misinterpreted the original `preg_match()` regex, thinking that it was
requiring brackets. Looking at it again today, I see that it didn't. The
current one does, however, require surrounding brackets.

This patch also allows for extra letters or dashes between the `#` and the
ticket number. Eventually we should allow the ticket number itself to have
extra characters -- be formattable.

Fixes osTicket/osTicket-1.8#342
perf: Use a materialized view to speed queue views

This patch introduces an automatic materialized view to speed database
performance when querying and displaying the ticket views. This can
eventually be extended to the search and advanced search features to speed
them as well.

The data from the dynamic form entries related to ticket details is copied
to a %ticket__cdata table. The %ticket__cdata table is then joined directly
to the other tables in the query for the ticket view. MySQL is magically
and dramatically faster using this method.

The downside is that the disk usage for the custom data is doubled, and the
time needed to update the dynamic data is at least doubled as the form
entries and the materialized view must both be updated.

This method should also extend well to other database platforms in the
future. It will be likely that most other database query optimizers will
have difficulty joining, scanning, and sorting the table models we have for
custom data fields.
IE: Fix redactor and IE compatibility view for SCP
Improve advanced search performance

Use a union query to avoid using DISTINCT and lots and lots of joins in the
from clause.

Initial tests seem to indicate about a 80% faster (~500ms down from ~800ms)
on querying about 9k tickets).
Fix up search on dynamic fields

Fix adding fields to an existing form
Merge pull request #873 from greezybacon/issue/subject-ticket-number

Honor ticket number in subject line without brackets

Reviewed-By: Peter Rotich <peter@osticket.com>
Merge pull request #368 from greezybacon/issue/ie-compatibility-view

IE: Fix redactor and IE compatibility view for SCP

Reviewed-By: Peter Rotich <peter@osticket.com>
Merge pull request #357 from greezybacon/issue/ticket-queue-performance

perf: Use a materialized view to speed queue views

Reviewed-By: Peter Rotich <peter@osticket.com>
http: Legacy versions of IIS redirect incorrectly

(And newer versions don't seem to like the legacy code). This patch uses a
`Refresh` header for IIS versions prior to 7.0 (included with Windows Vista
/ Server 2008). Starting with IIS 7.0, the Location header should be
properly handled by IIS.
Merge pull request #874 from greezybacon/issue/iis-refresh

http: Legacy versions of IIS redirect incorrectly

Reviewed-By: Peter Rotich <peter@osticket.com>
Add underline button to redactor toolbars
Ensure form for fields created during install

Fixes #374
Don't send attachments in staff alerts
email: (Almost) always convert html on text body

This is especially important if the html ticket thread is disabled. In such
a case the message body will still be HTML, but an HTML email should not be
sent out.