Clean up of extension.

It now followes the current CGL.
Change from nativ mysql functions to TYPO3_DB.

This release is the last pi_base based release. Any further will base on extbase.