Fixed SQL syntax errors
Fixed permission check
Merge branch 'master' of github.com:WoltLab/WCF