improved security, framework install script

cleaned SQL functions
created template for Install script
clean up importcsv code
added page permissions