1419227'; $msg_apple_artist_id = $encrypt->process($apple_artist_id); $err_msg .= '&err_msg[]=32edty66&msg_apple_artist_id=' . $msg_apple_artist_id; } if (in_array($action, array('update_track_artist')) && (!empty($spotify_artist) && !ctype_alnum($spotify_artist))) { $encrypt = WebMessage::getParamHandler('Encrypt'); $spotify_artist_id = '3Nrfpe0tUJi4K4DXYWgMUX'; $msg_spotify_artist_id = $encrypt->process($spotify_artist_id); $err_msg .= '&err_msg[]=32edty65&msg_spotify_artist_id=' . $msg_spotify_artist_id; } if ($err_msg) { header("Location: add_ex_a_track_artist_pop.php?track_id=$track_id" . $err_msg); exit(); } } if ($action == 'update_track_artist') { if ($track_artist_id) { $isParticipantSaveFailed = false; $sql = 'UPDATE track_artist SET type = ?, name = ? WHERE id = ?'; $dataParams = []; $dataParams[] = $role; $dataParams[] = stripControlChars(trimCommas($artist_name)); $dataParams[] = $track_artist_id; $result = $wrapperObj->executeQuery($sql, $dataParams, QueryWrapper::RETURN_AFFECTED_ROWS); if ($result === false) { show_pdo_error($sql, $wrapperObj->getLastStatement()); } // *******************************Update Artist URIs*********************************** if ($isUpdateSpotifyAppleIdsWithGraphqlEnabled) { $artistInfo = $vendorResult; $artistInfo['vendorId'] = $artistInfo['vendor_id']; $artistInfo['subaccountId'] = $artistInfo['subaccount_id']; $artistInfo['name'] = $artist_name; $artistInfo['id'] = $participant_id; $artistInfo['spotifyId'] = !empty($spotify_artist) ? trim($spotify_artist) : null; $artistInfo['appleMusicId'] = !empty($apple_artist) ? trim($apple_artist) : null; $artistInfo['spotifyArtistKey'] = !empty($spotify_artist_key) ? trim($spotify_artist_key) : null; unset($artistInfo['vendor_id']); unset($artistInfo['subaccount_id']); $updateParticipant = $graphqlGatewayServiceClient->updateParticipantById($artistInfo); if ($updateParticipant['errors']) { $isParticipantSaveFailed = true; } } else if ($isOaParticipantIdentifierEnabled) { $artistInfo = $vendorResult; $artistInfo['orchard_artist_name'] = $artist_name; $artistInfo['store_id'] = APPLE_STORE_ID; if (!empty($apple_artist)) { $artistInfo['store_artist_id'] = $apple_artist; updateArtistURIs($wrapperObj, $artistInfo); } else { deleteParticipantIdentifier($wrapperObj, $artistInfo); } $artistInfo['store_id'] = SPOTIFY_STORE_ID; if (!empty($spotify_artist)) { $artistInfo['store_artist_id'] = $spotify_artist; updateArtistURIs($wrapperObj, $artistInfo); } else { deleteParticipantIdentifier($wrapperObj, $artistInfo); } } // ************************************************************************************ $msg = $isParticipantSaveFailed === true ? '&err_msg[]=jbs19120' : ''; if ($msg) { header("Location: add_ex_a_track_artist_pop.php?track_id=$track_id" . $msg); exit(); } } } elseif ($action == 'add_track_artist') { $insert_query = 'INSERT INTO track_artist (track_id, type, name) VALUES (?, ?, ?)'; $dataParams = []; $dataParams[] = $track_id; $dataParams[] = $role; $dataParams[] = stripControlChars(trimCommas($artist_name)); $result = $wrapperObj->executeQuery($insert_query, $dataParams, QueryWrapper::RETURN_INSERT_ID); if ($result === false) { show_pdo_error($insert_query, $wrapperObj->getLastStatement()); } } elseif ($action == 'delete_track_artist') { if ($track_artist_id) { $artistArray = getTrackArtistArray($track_id, $wrapperObj); $artistCount = array_count_values($artistArray); $totalPerformers = $artistCount['performer']; if ($totalPerformers <= 1 && $role == 'performer') { $err_msg = 'd8d0974b'; header("Location: add_ex_a_track_artist_pop.php?track_id=$track_id&err_msg=$err_msg"); exit(); } $sql = 'DELETE FROM track_artist WHERE id = ?'; $dataParams = []; $dataParams[] = $track_artist_id; $result = $wrapperObj->executeQuery($sql, $dataParams, QueryWrapper::RETURN_AFFECTED_ROWS); if ($result === false) { show_pdo_error($sql, $wrapperObj->getLastStatement()); } } }