forms: Fix ambiguous id / value for typeahead

If a dynamic list is displayed as a typeahead box, the value, when saved,
will be confused with the corresponding ID field for the list. MySQL
supports numeric comparison between the INT id column and the textual value
column. Therefore, if a typeahead field has the value of '01 - GooGoo', then
record will match the ListItem<id=1>, regardless of which list the item is
defined for.

This patch resolves the issue by submitting the ID number of the list
selection in the HTTP form.
Ensure staff lookups are based on valid inputs

If something fishy, like an Array is received into the password reset system
or any part of the Staff management system, it should be rejected.

References:
http://osticket.com/forum/discussion/76003/sql-attack
Log password reset attempts
Double check value entered in typeahead fields

If the text does not match the value on record in the custom list, then the
value entered in the field cannot be accepted.

NOTE: This may have unintended i18n consequences, where there are varying
ways to write a letter in Unicode which may be rendered the same but will
not be correct with a string ==.
Merge pull request #435 from greezybacon/issue/log-pwreset-attempts

Log password reset attempts

Reviewed-By: Peter Rotich <peter@osticket.com>
Merge pull request #422 from greezybacon/issue/numeric-typeahead-values

forms: Fix ambiguous id / value for typeahead

Reviewed-By: Peter Rotich <peter@osticket.com>
lint: Properly analyze PHP abstract functions
lint: Fix usage of undeclared global var
Fixup querying drop-down lists via advanced search

It turns out that the _id field was not added to the cdata table when it was
created for SelectionField items, because the ::hasIdValue() method was not
implemented. This patch correctly searches SelectionFields via advanced
search.
Merge pull request #444 from greezybacon/issue/selection-field-ids

Fixup querying drop-down lists via advanced search

Reviewed-By: Peter Rotich <peter@osticket.com>
oops: Fixup deploy for 1.8.1 and onward
Merge pull request #450 from greezybacon/issue/deploy-next

oops: Fixup deploy for 1.8.1 and onward

Reviewed-By: Peter Rotich <peter@osticket.com>
Fix display of priority field in queue export

Also removes the fetching of priorities separately and addresses sorting of
priorities by the ID field rather than the urgency field.
Don't send out SQL error on upgrade to 1.8.1
Ship with a plugins/ folder
Merge branch 'issue/ship-plugins-folder' into develop-next
Merge pull request #451 from greezybacon/issue/priority-export

Fix display of priority field in queue export

Reviewed-By: Peter Rotich <peter@osticket.com>
Merge pull request #452 from greezybacon/issue/449

Don't send out SQL error on upgrade to 1.8.1

Reviewed-By: Peter Rotich <peter@osticket.com>
forms: Fix crash if selection-field not set

If a custom list item were added to an email template, and there is no data
for the field (ie. the field is not required) when the template is rendered,
the system would crash.

toString() is required to return a string, no matter what. This patch
cascades the (string) coercion to the current value of the list field if it
is not an instance of a DynamicListItem
Make Plugin class abstract