Mega with wiznet shield (wire hack)+thingspeak+sd problem

I am a bit confused about the pin modes...
wiznet is 10
sd is 8
DS18 onewire sensors is 3
I have read because of bug, after Ethernet.begin() 10 should pe put to high.
regarding the last code, to where ( and which ) should I insert the pinmode()-s and digitalwrite()-s?

Thanks