Move fetching groups, photosets, galleries to afg_libs.php