Opium, "magic" mushrooms and other psychoactive substances have been used since prehistoric times by people all over the world, according to a new study.