Replace the use of libctemplate with libflate

libflate is from Fabien Menemenlis (http://flate.dead-inside.org/)

The main differences between them are that libflate is released under
the LGPL whereas libctemplate is under the GPL.

The other main difference is that it doesn't have the if and loop
statements of libctemplate, this has the advantage of keeping the logic
out of the html files and keeping it all in the application.

In order to make libflate work with FastCGI I hade to make some minor
modifications. I also implemented the format function capability from
libctemplate that allows you to manipulate output strings before they
are sent to the browser. Useful for things like anti-XSS.

You can find these changes in the fcgx branch of libflate here
https://github.com/ac000/libflate

This should make for cleaner template files and it also resulted in a
healthy code reduction.

Signed-off-by: Andrew Clayton <andrew@digital-domain.net>