Added phpDoc
Whitespace
Coding guidelines
Initialize variables in else block

Avoids PHP notices, fixes #16950
Convert user agent to lowercase

Improves performance by avoiding multiple case-insensitive string
operations.
Fix PHP Notice Undefined offset
Use static variable to improve performance
Fix #16950: PHP notice errors in Browser check

Pull request https://github.com/mantisbt/mantisbt-web/pull/3