Fix 1.6-* upgrade to 1.7.1

8e72e521d48ca04fd8db7d05318e2c55b9b2d278 (v1.7.1.2+) introduced a bug where
osTicket version 1.6 would not send a cookie (by calling PHP
session_start()) for the login page. Therefore, after unpacking the 1.7.1
source code, an upgrade would not be possible, because a login would never
be processed correctly.
Merge pull request #736 from greezybacon/issue/1.6-upgrade

Fix 1.6-* upgrade to 1.7.1

Reviewed-By: Peter Rotich <peter@osticket.com>
Detect attachments with Content-Type: ...; name=

RFC2045, section 5.1 seems to indicate that arbitrary parameters can be
appended to a Content-Type header specification. Some email clients seem to
use the Content-Type header to specify an attachment without giving a
separate Content-Disposition header normally used to signify attachments.

This patch corrects attachment detection for piped emails to detect such
emails. The patch also correctly decodes filenames specified either in the
Content-Disposition or Content-Type headers using RFC5987, where the
filename can be encoded using an arbitrary character set (ie, not us-ascii).
Merge pull request #737 from greezybacon/issue/mailparse-attachments

Detect attachments with Content-Type: ...; name=

Reviewed-With: Jared Hancock <jared@osticket.com>
Implement RFC5987 for fetched attachments

Previously, filenames specified in email headers fetched using the PHP imap
extension were not decoded properly. Specifically, if RFC5987 was used to
encode the filenames, no decoding was performed at all.

This patch properly detects the filename attribute, using a decoding scheme
for RFC5987 if the attribute was encoded properly.

References:
http://osticket.com/forums/showthread.php?t=6129
Disable Kerberos and NTLM auth for mail fetch

On some configurations of PHP and remote mail servers, Kerberos and NTLM
challenge response authentication could be possibly attempted. This is
essentially futile and potentially fatal for osTicket mail fetching, as the
system is currently designed for username and password authentication only.

This patch disables challenge and response authentication for PHP versions
5.3.2 and newer, which support the fix.

This patch also consistently encodes mailbox names according to the rfc 2060
for IMAP.
Actually show correct template description

Fixes #742
Record message-id's for rejected emails

In the event that the system is set to do-nothing for POP fetched
emails, and eventually, one of the emails is rejected, ensure that the
message-id is logged so that the message will not be re-fetched, even if it
is undeleted.
Accept attachments from email messages

if the References or In-Reply-To header matches in a way that continues a
ticket's thread, include the attachments in the thread if allowed by the
system settings.
Merge pull request #743 from greezybacon/issue/tpl-description

Actually show correct template description

Reviewed-By: Peter Rotich <peter@osticket.com>
Merge pull request #745 from greezybacon/issue/message-reply-attachments

Accept attachments from email messages

Reviewed-By: Peter Rotich <peter@osticket.com>
Change last message lookup to use ticket_id instead of external ticket
id/number.

* Ticket number will be customization in the future
* Ticket thread only link to Ticket should be internal ticket id.
Require email match to thread incoming email when ticket number on subject
line is used.
Support last message lookup without setting last message id.
Disambiguate version string when running off of git

If a user is running off of the develop branch, disambiguate what the
version they are running.
Forbid empty reply separators

If it only contains whitespace, it is also invalid
Only send alerts if logs is written to DB.
Merge pull request #738 from greezybacon/issue/fetch-attachment-filename

Implement RFC5987 for fetched attachments

Reviewed-By: Peter Rotich <peter@osticket.com>
Merge pull request #739 from greezybacon/issue/mailfetch-auth

Disable Kerberos and NTLM auth for mail fetch

Reviewed-By: Peter Rotich <peter@osticket.com>
Merge pull request #748 from protich/feature/message-id-tracking-revisited

Message id tracking revisited

Reviewed-By: Jared Hancock <jared@osticket.com>