An Afghan court has sentenced a women 's magazine editor to two years in prison for publishing anti-Islamic articles .