Fixed bug preventing changes to Transifex auth settings

(DBOINCP-141)
This commit is contained in:
Tristan Olive 2015-04-22 10:40:33 -04:00
parent 042ccc9faa
commit e0c1a257ec
2 changed files with 4 additions and 4 deletions

View File

@ -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') {

View File

@ -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}");