Handle port aliases & validate port on use

Anyterm settings accept textual input for the port (useful: an alias can be specified, e.g., for fw ACL rules). 

But the code for the actual service errors out nastily if an alias or non-port is used, since it assumes $port exists, is valid, and is already numeric.  None of these are necessarily true, it should instead check the data is meaningful and resolve if a port alias, before using raw text.

Tested, works.  Effects of patch:

1) explicitly checks a port is defined;
2) correctly handle port if textual (i.e., port alias) and validate value obtained (numeric 1-65535) within both server and client code
3) provides at least rudimentary error handling for invalid data (like Unbound, an attempt to use the functional tab if data is bad, returns the user to the package "Settings" tab instead).


NOTE - there is a small alias handling issue revealed by this - if you define an alias "AnytermPort" as port 999, then the contents of $config['aliases']['AnytermPort'] is left padded with spaces ("  999" not "999"), and filter_expand_alias() returns this value which fails since (is_numericint($port) && $port <-=65535) isn't true due to padding. Workaround - using intval() first, since the fix is in alias handling not here.