Themes fixes (first part)
Fixed: Customer search form is broken due to wrong SQL queries + some security issues
Refactoring + small fixes