Unified treatment and classification of superintegrable systems with integrals quadratic in momenta on a two-dimensional manifold