Theory of the luminescence of porous silicon