Phase transitions in 8CB liquid crystal confined to a controlled-pore glass: Deuteron NMR and small angle X-ray scattering studies