Phase Transitions in Porous Media