Influence of electron-phonon interaction on the optical spectrum and quantum statistics in a quantum-dot–cavity system: Master-equation approach