He'd do better on full turnout. There is a LOT more bacteria and nasties in a stall than out in a pasture. If it's too wet, then keep him in, but change his bedding frequently.
You need to get on a good 4-6 week trimming schedule. I'd recommend putting him on a hoof supplement too, something like BioFlax20, Quick Links
To cure the funk, I HIGHLY recommend Oxine AH. You'll need two soaking boots, Oxine, and the activator. Use 1/2 cup of Oxine, 1 gallon of water, and 1/2 tsp of the citric acid activator. Mix up, poor in the boot, and stick your horse's foot in. Do the other foot at the same time. Soak for 20 minutes, then carefully remove the horse's foot (keep the liquid in) and use the same soak for the back feet.
Soak every other day until the infection is gone. Soak once a week to prevent infection until the feet start healing.
Oxine: Bio-Cide International - Oxine AH #114-101-Z
It's safe to use on your horse, even on the skin.