Phase Transitions in a Bose-Hubbard Model with Cavity-Mediated Global-Range Interactions