Matter-affected neutrino oscillations in ordinary and mirror stars and their implications for gamma-ray bursts