From e0c1a257ec0f7ae7e33c05b46db2d99748007f65 Mon Sep 17 00:00:00 2001 From: Tristan Olive Date: Wed, 22 Apr 2015 10:40:33 -0400 Subject: [PATCH] Fixed bug preventing changes to Transifex auth settings (DBOINCP-141) --- .../boinc/modules/boinctranslate/boinctranslate.admin.inc | 2 +- .../boinc/modules/boinctranslate/boinctranslate.module | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drupal/sites/default/boinc/modules/boinctranslate/boinctranslate.admin.inc b/drupal/sites/default/boinc/modules/boinctranslate/boinctranslate.admin.inc index 42158ebfaa..5daff8ec86 100644 --- a/drupal/sites/default/boinc/modules/boinctranslate/boinctranslate.admin.inc +++ b/drupal/sites/default/boinc/modules/boinctranslate/boinctranslate.admin.inc @@ -219,7 +219,7 @@ function boinctranslate_admin_settings_validate($form, &$form_state) { // Test authentication $authenticated = FALSE; $path = "project/{$boinc_name}/resource/{$boinc_resources[0]}/translation/en"; - $response = boinctranslate_transifex_request($path); + $response = boinctranslate_transifex_request($path, NULL, TRUE, FALSE, $username, $password); if ($response) { if ($response == '401 UNAUTHORIZED') { diff --git a/drupal/sites/default/boinc/modules/boinctranslate/boinctranslate.module b/drupal/sites/default/boinc/modules/boinctranslate/boinctranslate.module index 950791e9c3..32cf098c2f 100644 --- a/drupal/sites/default/boinc/modules/boinctranslate/boinctranslate.module +++ b/drupal/sites/default/boinc/modules/boinctranslate/boinctranslate.module @@ -459,11 +459,11 @@ function boinctranslate_update_official_boinc_translations() { /** * */ -function boinctranslate_transifex_request($path, $post = NULL, $json = TRUE, $use_put = FALSE) { +function boinctranslate_transifex_request($path, $post = NULL, $json = TRUE, $use_put = FALSE, $username = '', $password = '') { // Transifex details $api_base_url = 'https://www.transifex.com/api/2'; - $username = variable_get('boinc_translate_transifex_user', ''); - $password = variable_get('boinc_translate_transifex_pass', ''); + if (!$username) $username = variable_get('boinc_translate_transifex_user', ''); + if (!$password) $password = variable_get('boinc_translate_transifex_pass', ''); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "{$api_base_url}/{$path}");