use GLOBALS smarty; ensure feature flags; try to make cache_set a little less stupid about caching locally

use GLOBALS smarty; ensure feature flags; try to make cache_set a little less stupid about caching locally