Пример #1
0
     $CONDICION_BUSQUEDA = array();
     $CONDICION_BUSQUEDA['email'] = $user->email;
     $resultadoBusqueda = $USUARIO->obtenerUsuarioFiltros($CONDICION_BUSQUEDA);
     //No esta registrado el usuario en Inova 360
     if ($resultadoBusqueda == "") {
         //se agrega el usuario y login
         $DATOS = array();
         $DATOS['nombre'] = $user->first_name;
         $DATOS['apellidos'] = $user->last_name;
         $DATOS['email'] = $user->email;
         $DATOS['password'] = "";
         $DATOS['fechaCreacion'] = time();
         $DATOS['facebook_usuario'] = $user->username;
         $DATOS['fechaNacimiento'] = $datosFecha[1] . "/" . $datosFecha[0] . "/" . $datosFecha[2];
         $DATOS['pais'] = $user2->hometown_location->country;
         $DATOS['ciudad'] = $UTILIDADES->limpiarURLCorta($user->hometown);
         $DATOS['genero'] = $user->gender == "male" ? "H" : "M";
         $idUsuario = $USUARIO->agregar($DATOS);
         $USUARIO->forzarLogin($idUsuario);
         header("Location: authorize?client_id={$_GET['client_id']}&scope={$_GET['scope']}&status={$_GET['status']}&response_type={$_GET['response_type']}");
     } else {
         //se relaciona el usuario de facebook con la cuenta inova360 y login
         $DATOS = array();
         $DATOS['facebook_usuario'] = $user->username;
         $CONDICION = array();
         $CONDICION['_id'] = new MongoId($resultadoBusqueda['_id']);
         $idUsuario = $USUARIO->editar($CONDICION, $DATOS);
         $USUARIO->forzarLogin($resultadoBusqueda['_id']);
         header("Location: authorize?client_id={$_GET['client_id']}&scope={$_GET['scope']}&status={$_GET['status']}&response_type={$_GET['response_type']}");
     }
 } else {