Stop duplicate flags in templatedetails.extra_flags + security fix to website_code/php/properties/delete_file_template.php

Improve the storing of new extra_flags (e.g. changing the template from flash to javascript).
This change stops duplicate keys.