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

As the title says.

https://github.com/mybb/mybb/issues/1707
I'm quite sure it is too, no idea why it was done like this, I'll remove it.