Theory of nuclear reactions: VII. Photon channels