Temperature and magnetic field dependence of critical currents in granular superconductors