require'ing files is better inside functions

Signed-off-by: emanuele <emanuele45@gmail.com>
Some defaults missing, some tweaks

Signed-off-by: emanuele <emanuele45@gmail.com>
dos2unix

Signed-off-by: emanuele <emanuele45@gmail.com>
 Adding an attachment gives a db error (no default for thumbnail)

Signed-off-by: emanuele <emanuele45@gmail.com>