Mark tickets overdue which have no SLA

If a ticket has a due date and does not have an SLA set, the ticket would
never transition to overdue. This patch addresses an SQL flaw preventing the
ticket from being transitioned.

Fixes #757
Support incorrectly labeled us-ascii charsets

Some email clients (names omitted to protect the innocent) advertise the
encoding as us-ascii when iso-8859-1 was really implied. This patch allows
the two charsets to be interchangable.
Emit a backtrace on db_error logs
Merge pull request #770 from greezybacon/issue/us-ascii-not-really

Support incorrectly labeled us-ascii charsets

Reviewed-By: Peter Rotich <peter@osticket.com>
Reduce cost of deleting orphaned files

Previous explain included a nested sub-select, which exponentially increased
the count of the rows to be examined. This patch eliminates one layer of
nesting on the sub-select and dramatically increases the performance finding
orphaned files.

Fixes #773

References:
http://www.osticket.com/forums/forum/osticket-1-7-latest-release/troubleshooting-and-problems-aa/9446-version-1-7-much-slower-than-1-6
Support updating the source of the ticket

Fixes #772
Make Crypto::random() more reliable on Windows

This patch makes openssl the preferred source of random data on Windows and
will only use mcrypt_create_iv on PHP 5.3.7 and newer.

Fixes #771
add table prefix to places missing in the query
Use http::redirect(...) which exits on redirect.
Merge pull request #779 from protich/develop

Die on redirect

Reviewed-By: Jared Hancock <jared@osticket.com>
Use http redirect
Merge pull request #19 from yakatz/patch-1

add table prefix to places missing in the query

Reviewed-By: Peter Rotich <peter@osticket.com>
Merge pull request #18 from greezybacon/issue/db-error-backtrace

Emit a backtrace on db_error logs

Reviewed-By: Peter Rotich <peter@osticket.com>
Handle parsing email if Reply-To header is missing
Merge pull request #777 from greezybacon/issue/772

Support updating the source of the ticket

Reviewed-By: Peter Rotich <peter@osticket.com>
Merge pull request #778 from greezybacon/issue/773

Reduce cost of deleting orphaned files

Reviewed-By: Peter Rotich <peter@osticket.com>
Merge pull request #780 from greezybacon/issue/email-reply-to

Handle parsing email if Reply-To header is missing

Reviewed-By: Peter Rotich <peter@osticket.com>
Merge pull request #776 from greezybacon/issue/771

Make Crypto::random() more reliable on Windows

Reviewed-By: Peter Rotich <peter@osticket.com>
Merge pull request #767 from greezybacon/issue/757

Mark tickets overdue which have no SLA

Reviewed-By:  Peter Rotich <peter@osticket.com>
Merge remote branch 'upstream-1.7/develop' into develop

Include changes post 1.7.2

Conflicts:
	include/class.file.php
	main.inc.php