Fix #1707 move substr() outside of get_current_location()

As the title says.

https://github.com/mybb/mybb/issues/1707