Remove some unused variables and globals in admin scripts
Fixed a couple of places where $scripturl wasn't globalized but was used in admin scripts
Remove an unused variable
Get rid of some more queries in favor of standard functions