Phase transitions of epidemics on random graphs