Gaia Data Release 2. Photometric content and validation