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.
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.
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>
Merge pull request #749 from greezybacon/issue/git-version

Disambiguate version string when running off of git

Reviewed-By: Peter Rotich <peter@osticket.com>
Allow deployment of setup/

Useful for initial installs, where deployment of the `setup/` folder is
required for the initial install. Thereafter, deployment can be run without
the setup option so that the rest of the codebase can be maintained (already
supported)
Merge pull request #750 from greezybacon/feature/deploy-setup

Allow deployment of setup/

Reviewed-By: Peter Rotich <peter@osticket.com>
Expose fail count to shell environment

Also, run the tests in the packager. The packager will automatically run the
regression test suite prior to packaging a release. The package will not
build if there is at least one fail from the regression tests.
Merge pull request #751 from greezybacon/feature/package-run-tests

Expose fail count to shell environment

Reviewed-By: Peter Rotich <peter@osticket.com>
Merge pull request #752 from greezybacon/feature/disallow-empty-reply-sep

Forbid empty reply separators

Reviewed-By: Peter Rotich <peter@osticket.com>
Merge pull request #754 from protich/feature/admin-alert

Limit admin alerts to logged messages.

Reviewed-By: Jared Hancock <jared@osticket.com>
Merge pull request #744 from greezybacon/issue/fetch-rejected-loop

Record message-id's for rejected emails

Reviewed-By: Peter Rotich <peter@osticket.com>