Improvements for PandoraFMS SQLi module

Simplified some things by creating methods instead of copy/pasted code.