$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 { //actualizo los datos y login $USUARIO->forzarLogin($resultadoBusqueda['_id']);
$VALIDACION = false; } } $filtro['ciudad'] = new MongoRegex("/" . $_POST['txtCiudad'] . "/i"); $datos = $CIUDAD->lista($filtro); if ($VALIDACION) { $DATOS = array(); $DATOS['nombre'] = $_POST['txtNombre']; $DATOS['apellidos'] = $_POST['txtApellidos']; $DATOS['email'] = $_POST['txtEmail']; $DATOS['password'] = $_POST['txtPassword']; $DATOS['fechaNacimiento'] = $_POST['txtFechaNacimiento']; $DATOS['pais'] = $_POST['txtPais']; $DATOS['ciudad'] = array('nombre' => $_POST['txtCiudad'], 'id' => ''); $DATOS['genero'] = $_POST['txtGenero']; $USUARIO->agregar($DATOS); $USUARIO->email = $_POST['txtEmail']; $USUARIO->password = $_POST['txtPassword']; $USUARIO->CONFIG = $CONFIG; $USUARIO->login(); header("Location: authorize?client_id={$_GET['client_id']}&scope={$_GET['scope']}&status={$_GET['status']}&response_type={$_GET['response_type']}"); } } //}catch(Exception $e){ // $LOG->registra("Login", $e->getMessage(), "Ocurrio un error al intentar firmarse con el usuario " ); //} ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="es"><head>