Merging some (rebased, fixed, ..) pull requests and more

No changes in 10 months - I have not much hope this is still alive.

I went through some of the pull requests and reviewed them; i also fixed the pull requests i thought worth fixing, and merged the good stuff.

Finally I added some fixes I need myself.

* From #36 picked:
  * added docs for functions
  * redirect back on login
* from #41 picked:
  * field reorder
  * more verbose links
* #47
  * remove duplicate function
  * fix SQL limit/offset bug (important!)
* #66
  * fix zone_sort_by=count_records
  * secondary sort by name
  * pagination improvement
* #114
  * fix record validation
  * htmlspecialchars() for input values
* own stuff:
  * SPF content sanitizing in edit_record.php
  * pdnssec rectify-zone fix
  * Support more record types (fixes #44)
  * Always add current record type to drop down (don't show wrong record type), whether supported or not
    + more SPF content sanitizing and htmlspecialchars()
  * fix undefined var in bulk_registration.php

If you actually want to do the merges yourself, I can rebase (and split into pull requests) my own fixes if needed.