@@ -387,8 +387,7 @@ |
||
| 387 | 387 | $team = node_load($nid); |
| 388 | 388 | $output .= '<p>' . bts('You may create a message board for use by @team', |
| 389 | 389 | array('@team' => $team->title), NULL, 'boinc:team-forum') . ':</p>'; |
| 390 | - } |
|
| 391 | - else { |
|
| 390 | + } else { |
|
| 392 | 391 | $output .= '<p>' . bts('This is a team-only message board', array(), NULL, 'boinc:team-forum') . ':</p>'; |
| 393 | 392 | } |
| 394 | 393 | $output .= '<ul>'; |
@@ -136,8 +136,7 @@ discard block |
||
| 136 | 136 | $lidkey = array_search($chunk['hash'], $nodehashtable); |
| 137 | 137 | if ($lidkey) { |
| 138 | 138 | unset($nodehashtable[$lidkey]); |
| 139 | - } |
|
| 140 | - else { |
|
| 139 | + } else { |
|
| 141 | 140 | |
| 142 | 141 | $result = db_query(" |
| 143 | 142 | INSERT INTO {locales_source} |
@@ -150,8 +149,7 @@ discard block |
||
| 150 | 149 | 'Added translation source strings for node @nid chunk @chunk.', |
| 151 | 150 | array('@nid' => $node->nid, '@chunk' => $idx) |
| 152 | 151 | ); |
| 153 | - } |
|
| 154 | - else { |
|
| 152 | + } else { |
|
| 155 | 153 | drupal_set_message( |
| 156 | 154 | t('ERROR: Unable to add translation source strings.'), 'error' |
| 157 | 155 | ); |
@@ -248,12 +246,10 @@ discard block |
||
| 248 | 246 | $mess = 'DEBUG ' . l('BOINC translate', "filter/tips/$format") .' parsed on '.date('r').'<br />Execution time: '.$elapsed.' seconds.'; |
| 249 | 247 | drupal_set_message($mess, 'warning'); |
| 250 | 248 | return $ret; |
| 251 | - } |
|
| 252 | - else { |
|
| 249 | + } else { |
|
| 253 | 250 | return _boinctranslate_filter_process($text, $format, $mynid); |
| 254 | 251 | }// if debug |
| 255 | - } |
|
| 256 | - else { |
|
| 252 | + } else { |
|
| 257 | 253 | return $text; |
| 258 | 254 | }// if type |
| 259 | 255 | break; |
@@ -309,8 +305,7 @@ discard block |
||
| 309 | 305 | foreach ($parts as $key => $value) { |
| 310 | 306 | if (preg_match('/(#SPLIT_TOKEN#)/', $value)) { |
| 311 | 307 | $chunks[] = array ('delimiter' => $value,); |
| 312 | - } |
|
| 313 | - else { |
|
| 308 | + } else { |
|
| 314 | 309 | $cleaned = preg_replace('/\s|\n/', '', $value); |
| 315 | 310 | if (!empty($cleaned)) { |
| 316 | 311 | $chunks[] = array( |
@@ -36,8 +36,7 @@ discard block |
||
| 36 | 36 | ) |
| 37 | 37 | ), 'warning' |
| 38 | 38 | ); |
| 39 | - } |
|
| 40 | - elseif ($response) { |
|
| 39 | + } elseif ($response) { |
|
| 41 | 40 | if (is_array($response)) { |
| 42 | 41 | |
| 43 | 42 | $installed_languages = language_list(); |
@@ -67,8 +66,7 @@ discard block |
||
| 67 | 66 | 'Added predefined language: '.$available_languages[$rfc_code][0] |
| 68 | 67 | ); |
| 69 | 68 | db_query("UPDATE {languages} SET enabled = 1 WHERE language = '%s'", $rfc_code); |
| 70 | - } |
|
| 71 | - else { |
|
| 69 | + } else { |
|
| 72 | 70 | // Retrieve language details from Transifex |
| 73 | 71 | $path = "language/{$posix_code}"; |
| 74 | 72 | $response = boinctranslate_transifex_request($path); |
@@ -81,8 +79,7 @@ discard block |
||
| 81 | 79 | ) |
| 82 | 80 | ), 'warning' |
| 83 | 81 | ); |
| 84 | - } |
|
| 85 | - elseif ($response) { |
|
| 82 | + } elseif ($response) { |
|
| 86 | 83 | if (!empty($response['name'])) { |
| 87 | 84 | // Add a custom language to Drupal and enable |
| 88 | 85 | locale_add_language( |
@@ -97,8 +94,7 @@ discard block |
||
| 97 | 94 | drupal_set_message( |
| 98 | 95 | 'Added new language: '.$response['name'] |
| 99 | 96 | ); |
| 100 | - } |
|
| 101 | - else { |
|
| 97 | + } else { |
|
| 102 | 98 | $variables = array( |
| 103 | 99 | '%code' => $posix_code, |
| 104 | 100 | ); |
@@ -113,8 +109,7 @@ discard block |
||
| 113 | 109 | WATCHDOG_ERROR |
| 114 | 110 | ); |
| 115 | 111 | } |
| 116 | - } |
|
| 117 | - else { |
|
| 112 | + } else { |
|
| 118 | 113 | $variables = array( |
| 119 | 114 | '%code' => $posix_code, |
| 120 | 115 | ); |
@@ -155,8 +150,7 @@ discard block |
||
| 155 | 150 | batch_set($batch); |
| 156 | 151 | batch_process('admin/boinc/translation'); |
| 157 | 152 | } |
| 158 | - } |
|
| 159 | - else { |
|
| 153 | + } else { |
|
| 160 | 154 | $variables = array( |
| 161 | 155 | '%project' => $project_name, |
| 162 | 156 | ); |
@@ -171,8 +165,7 @@ discard block |
||
| 171 | 165 | WATCHDOG_ERROR |
| 172 | 166 | ); |
| 173 | 167 | } |
| 174 | - } |
|
| 175 | - else { |
|
| 168 | + } else { |
|
| 176 | 169 | $variables = array( |
| 177 | 170 | '%project' => $project_name, |
| 178 | 171 | ); |
@@ -229,8 +222,7 @@ discard block |
||
| 229 | 222 | 'content' => boinctranslate_get_po('en', 'project'), |
| 230 | 223 | ); |
| 231 | 224 | $result = boinctranslate_transifex_request($path, $post); |
| 232 | - } |
|
| 233 | - else { |
|
| 225 | + } else { |
|
| 234 | 226 | // Update the source |
| 235 | 227 | $path = "project/{$project_name}/resource/{$primary_resource}/content"; |
| 236 | 228 | $post = array( |
@@ -244,8 +236,7 @@ discard block |
||
| 244 | 236 | $enabled_languages = locale_language_list(); |
| 245 | 237 | if ($source_exists) { |
| 246 | 238 | drupal_set_message('Updated source translation strings at Transifex'); |
| 247 | - } |
|
| 248 | - else { |
|
| 239 | + } else { |
|
| 249 | 240 | drupal_set_message('Established new translation resource at Transifex'); |
| 250 | 241 | } |
| 251 | 242 | // Try to export translations for all enabled languages |
@@ -266,25 +257,21 @@ discard block |
||
| 266 | 257 | "Unable to update {$language_name} translations: {$result}", |
| 267 | 258 | 'warning' |
| 268 | 259 | ); |
| 269 | - } |
|
| 270 | - else { |
|
| 260 | + } else { |
|
| 271 | 261 | drupal_set_message("Updated {$language_name} translations"); |
| 272 | 262 | //drupal_set_message('DEBUG: <pre>'.print_r($result,1).'</pre>'); |
| 273 | 263 | } |
| 274 | - } |
|
| 275 | - else { |
|
| 264 | + } else { |
|
| 276 | 265 | drupal_set_message("No translations to export for {$language_name}"); |
| 277 | 266 | } |
| 278 | 267 | } |
| 279 | - } |
|
| 280 | - else { |
|
| 268 | + } else { |
|
| 281 | 269 | drupal_set_message( |
| 282 | 270 | "Unable to update the translation source: {$result}", |
| 283 | 271 | 'warning' |
| 284 | 272 | ); |
| 285 | 273 | } |
| 286 | - } |
|
| 287 | - else { |
|
| 274 | + } else { |
|
| 288 | 275 | drupal_set_message( |
| 289 | 276 | 'Failed to export translations: Transifex settings are not intiailized.', |
| 290 | 277 | 'error' |
@@ -340,42 +327,35 @@ discard block |
||
| 340 | 327 | "Unable to update {$language_name} official BOINC translations: {$result}", |
| 341 | 328 | 'warning' |
| 342 | 329 | ); |
| 343 | - } |
|
| 344 | - elseif ($result == '401 UNAUTHORIZED') { |
|
| 330 | + } elseif ($result == '401 UNAUTHORIZED') { |
|
| 345 | 331 | drupal_set_message( |
| 346 | 332 | 'Not authorized to update official BOINC translations', |
| 347 | 333 | 'warning' |
| 348 | 334 | ); |
| 349 | 335 | break; |
| 350 | - } |
|
| 351 | - elseif ($result == 'success') { |
|
| 336 | + } elseif ($result == 'success') { |
|
| 352 | 337 | drupal_set_message("Updated {$language_name} official BOINC translations"); |
| 353 | - } |
|
| 354 | - else { |
|
| 338 | + } else { |
|
| 355 | 339 | drupal_set_message( |
| 356 | 340 | "Unexpected response for {$language_name}: {$result}", |
| 357 | 341 | 'warning' |
| 358 | 342 | ); |
| 359 | 343 | } |
| 360 | - } |
|
| 361 | - else { |
|
| 344 | + } else { |
|
| 362 | 345 | drupal_set_message("Updated {$language_name} official BOINC translations"); |
| 363 | 346 | //drupal_set_message('DEBUG: <pre>'.print_r($result,1).'</pre>'); |
| 364 | 347 | } |
| 365 | - } |
|
| 366 | - else { |
|
| 348 | + } else { |
|
| 367 | 349 | drupal_set_message("No official BOINC translations to export for {$language_name}"); |
| 368 | 350 | } |
| 369 | 351 | } |
| 370 | - } |
|
| 371 | - else { |
|
| 352 | + } else { |
|
| 372 | 353 | drupal_set_message( |
| 373 | 354 | "The {$drupal_resource} resource does not exist in the {$project_name} project at Transifex", |
| 374 | 355 | 'warning' |
| 375 | 356 | ); |
| 376 | 357 | } |
| 377 | - } |
|
| 378 | - else { |
|
| 358 | + } else { |
|
| 379 | 359 | drupal_set_message( |
| 380 | 360 | 'Failed to export official BOINC translations: Transifex settings are not intiailized.', |
| 381 | 361 | 'error' |
@@ -413,13 +393,11 @@ discard block |
||
| 413 | 393 | if ($json) { |
| 414 | 394 | $headers['Content-Type'] = 'application/json'; |
| 415 | 395 | $data = json_encode($post); |
| 416 | - } |
|
| 417 | - else { |
|
| 396 | + } else { |
|
| 418 | 397 | $data = drupal_query_string_encode($post); |
| 419 | 398 | } |
| 420 | 399 | $method = ($use_put) ? 'PUT' : 'POST'; |
| 421 | - } |
|
| 422 | - else { |
|
| 400 | + } else { |
|
| 423 | 401 | $method = 'GET'; |
| 424 | 402 | } |
| 425 | 403 | |
@@ -431,8 +409,7 @@ discard block |
||
| 431 | 409 | if ($json) { |
| 432 | 410 | // Process as JSON |
| 433 | 411 | return json_decode($response->data, TRUE); |
| 434 | - } |
|
| 435 | - else { |
|
| 412 | + } else { |
|
| 436 | 413 | return (string) $response->data; |
| 437 | 414 | } |
| 438 | 415 | break; |
@@ -582,18 +559,15 @@ discard block |
||
| 582 | 559 | if ($plural) { |
| 583 | 560 | $translation = _locale_export_remove_plural($strings[$plural]['translation']); |
| 584 | 561 | $plural = isset($strings[$plural]['plural']) ? $strings[$plural]['plural'] : 0; |
| 585 | - } |
|
| 586 | - else { |
|
| 562 | + } else { |
|
| 587 | 563 | $translation = ''; |
| 588 | 564 | } |
| 589 | 565 | } |
| 590 | - } |
|
| 591 | - else { |
|
| 566 | + } else { |
|
| 592 | 567 | $output .= 'msgstr[0] ""' . "\n"; |
| 593 | 568 | $output .= 'msgstr[1] ""' . "\n"; |
| 594 | 569 | } |
| 595 | - } |
|
| 596 | - else { |
|
| 570 | + } else { |
|
| 597 | 571 | $output .= 'msgstr ' . _locale_export_string($string['translation']); |
| 598 | 572 | } |
| 599 | 573 | $output .= "\n"; |
@@ -671,8 +645,7 @@ discard block |
||
| 671 | 645 | if ($tl0) { |
| 672 | 646 | bts($tl0); |
| 673 | 647 | } |
| 674 | - } |
|
| 675 | - elseif (count($line)>1) { |
|
| 648 | + } elseif (count($line)>1) { |
|
| 676 | 649 | $tl0 = trim($line[0]); |
| 677 | 650 | $tl1 = trim($line[1]); |
| 678 | 651 | if ($tl0 and $tl1) { |
@@ -761,8 +734,7 @@ discard block |
||
| 761 | 734 | |
| 762 | 735 | if ($response == '404 NOT FOUND') { |
| 763 | 736 | $message = "Project resource {$project}:{$resource} not found in {$language}."; |
| 764 | - } |
|
| 765 | - elseif ($response) { |
|
| 737 | + } elseif ($response) { |
|
| 766 | 738 | if (!empty($response['content'])) { |
| 767 | 739 | $po_text = $response['content']; |
| 768 | 740 | |
@@ -783,23 +755,19 @@ discard block |
||
| 783 | 755 | . " {$project}:{$resource} failed."; |
| 784 | 756 | $success = FALSE; |
| 785 | 757 | break; |
| 786 | - } |
|
| 787 | - else { |
|
| 758 | + } else { |
|
| 788 | 759 | $success = TRUE; |
| 789 | 760 | } |
| 790 | 761 | } |
| 791 | - } |
|
| 792 | - else { |
|
| 762 | + } else { |
|
| 793 | 763 | $message = "Unable to read response for {$language} translation import" |
| 794 | 764 | . " of {$project}:{$resource}."; |
| 795 | 765 | } |
| 796 | - } |
|
| 797 | - else { |
|
| 766 | + } else { |
|
| 798 | 767 | $message = "Translation data not found in response for {$language}" |
| 799 | 768 | . " translation import of {$project}:{$resource}."; |
| 800 | 769 | } |
| 801 | - } |
|
| 802 | - else { |
|
| 770 | + } else { |
|
| 803 | 771 | // If project isn't specified, import as a local Drupal resource |
| 804 | 772 | $project = 'drupal.local'; |
| 805 | 773 | $file = new stdClass(); |
@@ -809,8 +777,7 @@ discard block |
||
| 809 | 777 | $message = "The {$language} translation import of" |
| 810 | 778 | . " local file {$resource} failed."; |
| 811 | 779 | $success = FALSE; |
| 812 | - } |
|
| 813 | - else { |
|
| 780 | + } else { |
|
| 814 | 781 | $success = TRUE; |
| 815 | 782 | } |
| 816 | 783 | } |
@@ -828,8 +795,7 @@ discard block |
||
| 828 | 795 | WATCHDOG_INFO |
| 829 | 796 | ); |
| 830 | 797 | } |
| 831 | - } |
|
| 832 | - else { |
|
| 798 | + } else { |
|
| 833 | 799 | $context['results']['failure'][] = "{$langcode}:{$textgroup}"; |
| 834 | 800 | watchdog( |
| 835 | 801 | 'boinctranslate', |
@@ -847,8 +813,7 @@ discard block |
||
| 847 | 813 | // Update the progress for the batch engine |
| 848 | 814 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
| 849 | 815 | $context['finished'] = 1; |
| 850 | - } |
|
| 851 | - else { |
|
| 816 | + } else { |
|
| 852 | 817 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
| 853 | 818 | } |
| 854 | 819 | } |
@@ -867,8 +832,7 @@ discard block |
||
| 867 | 832 | array('@count' => $count), |
| 868 | 833 | WATCHDOG_INFO |
| 869 | 834 | ); |
| 870 | - } |
|
| 871 | - else { |
|
| 835 | + } else { |
|
| 872 | 836 | // An error occurred. |
| 873 | 837 | // $operations contains the operations that remained unprocessed. |
| 874 | 838 | $error_operation = reset($operations); |
@@ -963,17 +927,19 @@ discard block |
||
| 963 | 927 | $lineno++; |
| 964 | 928 | $line = trim(strtr($line, array("\\\n" => ""))); |
| 965 | 929 | |
| 966 | - if (!strncmp("#", $line, 1)) { // A comment |
|
| 967 | - if ($context == "COMMENT") { // Already in comment context: add |
|
| 930 | + if (!strncmp("#", $line, 1)) { |
|
| 931 | +// A comment |
|
| 932 | + if ($context == "COMMENT") { |
|
| 933 | +// Already in comment context: add |
|
| 968 | 934 | $current["#"][] = substr($line, 1); |
| 969 | - } |
|
| 970 | - elseif (($context == "MSGSTR") || ($context == "MSGSTR_ARR")) { // End current entry, start a new one |
|
| 935 | + } elseif (($context == "MSGSTR") || ($context == "MSGSTR_ARR")) { |
|
| 936 | +// End current entry, start a new one |
|
| 971 | 937 | _boinctranslate_locale_import_one_string($op, $current, $mode, $lang, $file, $group); |
| 972 | 938 | $current = array(); |
| 973 | 939 | $current["#"][] = substr($line, 1); |
| 974 | 940 | $context = "COMMENT"; |
| 975 | - } |
|
| 976 | - else { // Parse error |
|
| 941 | + } else { |
|
| 942 | +// Parse error |
|
| 977 | 943 | watchdog( |
| 978 | 944 | 'boinctranslate', |
| 979 | 945 | 'The translation file %filename for %lang contains an error: "msgstr" was expected but not found on line %line.', |
@@ -983,13 +949,13 @@ discard block |
||
| 983 | 949 | _locale_import_message('The translation file %filename contains an error: "msgstr" was expected but not found on line %line.', $file, $lineno); |
| 984 | 950 | return FALSE; |
| 985 | 951 | } |
| 986 | - } |
|
| 987 | - elseif (!strncmp("msgctxt", $line, 7)) { |
|
| 988 | - if (($context == "MSGSTR") || ($context == "MSGSTR_ARR")) { // End current entry, start a new one |
|
| 952 | + } elseif (!strncmp("msgctxt", $line, 7)) { |
|
| 953 | + if (($context == "MSGSTR") || ($context == "MSGSTR_ARR")) { |
|
| 954 | +// End current entry, start a new one |
|
| 989 | 955 | _boinctranslate_locale_import_one_string($op, $current, $mode, $lang, $file, $group); |
| 990 | 956 | $current = array(); |
| 991 | - } |
|
| 992 | - elseif (($context == "MSGID") || ($context == "MSGCTXT")) { // Already in this context? Parse error |
|
| 957 | + } elseif (($context == "MSGID") || ($context == "MSGCTXT")) { |
|
| 958 | +// Already in this context? Parse error |
|
| 993 | 959 | watchdog( |
| 994 | 960 | 'boinctranslate', |
| 995 | 961 | 'The translation file %filename for %lang contains an error: "msgctxt" is unexpected on line %line.', |
@@ -1013,9 +979,9 @@ discard block |
||
| 1013 | 979 | } |
| 1014 | 980 | $current["msgctxt"] = $quoted; |
| 1015 | 981 | $context = "MSGCTXT"; |
| 1016 | - } |
|
| 1017 | - elseif (!strncmp("msgid_plural", $line, 12)) { |
|
| 1018 | - if ($context != "MSGID") { // Must be plural form for current entry |
|
| 982 | + } elseif (!strncmp("msgid_plural", $line, 12)) { |
|
| 983 | + if ($context != "MSGID") { |
|
| 984 | +// Must be plural form for current entry |
|
| 1019 | 985 | watchdog( |
| 1020 | 986 | 'boinctranslate', |
| 1021 | 987 | 'The translation file %filename for %lang contains an error: "msgid_plural" was expected but not found on line %line.', |
@@ -1039,13 +1005,13 @@ discard block |
||
| 1039 | 1005 | } |
| 1040 | 1006 | $current["msgid"] = $current["msgid"] . "\0" . $quoted; |
| 1041 | 1007 | $context = "MSGID_PLURAL"; |
| 1042 | - } |
|
| 1043 | - elseif (!strncmp("msgid", $line, 5)) { |
|
| 1044 | - if (($context == "MSGSTR") || ($context == "MSGSTR_ARR")) { // End current entry, start a new one |
|
| 1008 | + } elseif (!strncmp("msgid", $line, 5)) { |
|
| 1009 | + if (($context == "MSGSTR") || ($context == "MSGSTR_ARR")) { |
|
| 1010 | +// End current entry, start a new one |
|
| 1045 | 1011 | _boinctranslate_locale_import_one_string($op, $current, $mode, $lang, $file, $group); |
| 1046 | 1012 | $current = array(); |
| 1047 | - } |
|
| 1048 | - elseif ($context == "MSGID") { // Already in this context? Parse error |
|
| 1013 | + } elseif ($context == "MSGID") { |
|
| 1014 | +// Already in this context? Parse error |
|
| 1049 | 1015 | watchdog( |
| 1050 | 1016 | 'boinctranslate', |
| 1051 | 1017 | 'The translation file %filename for %lang contains an error: "msgid" is unexpected on line %line.', |
@@ -1069,9 +1035,9 @@ discard block |
||
| 1069 | 1035 | } |
| 1070 | 1036 | $current["msgid"] = $quoted; |
| 1071 | 1037 | $context = "MSGID"; |
| 1072 | - } |
|
| 1073 | - elseif (!strncmp("msgstr[", $line, 7)) { |
|
| 1074 | - if (($context != "MSGID") && ($context != "MSGID_PLURAL") && ($context != "MSGSTR_ARR")) { // Must come after msgid, msgid_plural, or msgstr[] |
|
| 1038 | + } elseif (!strncmp("msgstr[", $line, 7)) { |
|
| 1039 | + if (($context != "MSGID") && ($context != "MSGID_PLURAL") && ($context != "MSGSTR_ARR")) { |
|
| 1040 | +// Must come after msgid, msgid_plural, or msgstr[] |
|
| 1075 | 1041 | watchdog( |
| 1076 | 1042 | 'boinctranslate', |
| 1077 | 1043 | 'The translation file %filename for %lang contains an error: "msgstr[]" is unexpected on line %line.', |
@@ -1107,9 +1073,9 @@ discard block |
||
| 1107 | 1073 | } |
| 1108 | 1074 | $current["msgstr"][$plural] = $quoted; |
| 1109 | 1075 | $context = "MSGSTR_ARR"; |
| 1110 | - } |
|
| 1111 | - elseif (!strncmp("msgstr", $line, 6)) { |
|
| 1112 | - if ($context != "MSGID") { // Should come just after a msgid block |
|
| 1076 | + } elseif (!strncmp("msgstr", $line, 6)) { |
|
| 1077 | + if ($context != "MSGID") { |
|
| 1078 | +// Should come just after a msgid block |
|
| 1113 | 1079 | watchdog( |
| 1114 | 1080 | 'boinctranslate', |
| 1115 | 1081 | 'The translation file %filename for %lang contains an error: "msgstr" is unexpected on line %line.', |
@@ -1133,8 +1099,7 @@ discard block |
||
| 1133 | 1099 | } |
| 1134 | 1100 | $current["msgstr"] = $quoted; |
| 1135 | 1101 | $context = "MSGSTR"; |
| 1136 | - } |
|
| 1137 | - elseif ($line != "") { |
|
| 1102 | + } elseif ($line != "") { |
|
| 1138 | 1103 | $quoted = _locale_import_parse_quoted($line); |
| 1139 | 1104 | if ($quoted === FALSE) { |
| 1140 | 1105 | watchdog( |
@@ -1148,14 +1113,11 @@ discard block |
||
| 1148 | 1113 | } |
| 1149 | 1114 | if (($context == "MSGID") || ($context == "MSGID_PLURAL")) { |
| 1150 | 1115 | $current["msgid"] .= $quoted; |
| 1151 | - } |
|
| 1152 | - elseif ($context == "MSGSTR") { |
|
| 1116 | + } elseif ($context == "MSGSTR") { |
|
| 1153 | 1117 | $current["msgstr"] .= $quoted; |
| 1154 | - } |
|
| 1155 | - elseif ($context == "MSGSTR_ARR") { |
|
| 1118 | + } elseif ($context == "MSGSTR_ARR") { |
|
| 1156 | 1119 | $current["msgstr"][$plural] .= $quoted; |
| 1157 | - } |
|
| 1158 | - else { |
|
| 1120 | + } else { |
|
| 1159 | 1121 | watchdog( |
| 1160 | 1122 | 'boinctranslate', |
| 1161 | 1123 | 'The translation file %filename for %lang contains an error: there is an unexpected string on line %line.', |
@@ -1171,8 +1133,7 @@ discard block |
||
| 1171 | 1133 | // End of PO file, flush last entry |
| 1172 | 1134 | if (($context == "MSGSTR") || ($context == "MSGSTR_ARR")) { |
| 1173 | 1135 | _boinctranslate_locale_import_one_string($op, $current, $mode, $lang, $file, $group); |
| 1174 | - } |
|
| 1175 | - elseif ($context != "COMMENT") { |
|
| 1136 | + } elseif ($context != "COMMENT") { |
|
| 1176 | 1137 | watchdog( |
| 1177 | 1138 | 'boinctranslate', |
| 1178 | 1139 | 'The translation file %filename for %lang ended unexpectedly at line %line.', |
@@ -1239,9 +1200,7 @@ discard block |
||
| 1239 | 1200 | } |
| 1240 | 1201 | } |
| 1241 | 1202 | $headerdone = TRUE; |
| 1242 | - } |
|
| 1243 | - |
|
| 1244 | - else { |
|
| 1203 | + } else { |
|
| 1245 | 1204 | // Some real string to import. |
| 1246 | 1205 | $comments = _locale_import_shorten_comments(empty($value['#']) ? array() : $value['#']); |
| 1247 | 1206 | |
@@ -1260,9 +1219,7 @@ discard block |
||
| 1260 | 1219 | } |
| 1261 | 1220 | $plid = _boinctranslate_locale_import_one_string_db($report, $lang, $english[$key], $trans, $group, $comments, $mode, $plid, $key); |
| 1262 | 1221 | } |
| 1263 | - } |
|
| 1264 | - |
|
| 1265 | - else { |
|
| 1222 | + } else { |
|
| 1266 | 1223 | // A simple string to import. |
| 1267 | 1224 | $english = $value['msgid']; |
| 1268 | 1225 | $translation = $value['msgstr']; |
@@ -1293,8 +1250,7 @@ discard block |
||
| 1293 | 1250 | $uselocation = array("boinc", "project"); |
| 1294 | 1251 | if (in_array($textgroup, $uselocation)) { |
| 1295 | 1252 | $resource = db_query("SELECT lid FROM {locales_source} WHERE location = '%s' AND source = '%s' AND textgroup = '%s'", $location, $source, $textgroup); |
| 1296 | - } |
|
| 1297 | - else { |
|
| 1253 | + } else { |
|
| 1298 | 1254 | $resource = db_query("SELECT lid FROM {locales_source} WHERE source = '%s' AND textgroup = '%s'", $source, $textgroup); |
| 1299 | 1255 | |
| 1300 | 1256 | // Parse the location string for the string ignoreoverwrite, which |
@@ -1316,8 +1272,7 @@ discard block |
||
| 1316 | 1272 | if ($textgroup == "default" && !locale_string_is_safe($translation)) { |
| 1317 | 1273 | $report['skips']++; |
| 1318 | 1274 | $lid = 0; |
| 1319 | - } |
|
| 1320 | - elseif ($resource) { |
|
| 1275 | + } elseif ($resource) { |
|
| 1321 | 1276 | // We have this source string saved already. Loop over the db results from locales_source table. |
| 1322 | 1277 | while ($row = db_fetch_array($resource)) { |
| 1323 | 1278 | |
@@ -1328,20 +1283,17 @@ discard block |
||
| 1328 | 1283 | // No translation in this language, insert translation into locales_target table. |
| 1329 | 1284 | db_query("INSERT INTO {locales_target} (lid, language, translation, plid, plural) VALUES (%d, '%s', '%s', %d, %d)", $lid, $langcode, $translation, $plid, $plural); |
| 1330 | 1285 | $report['additions']++; |
| 1331 | - } |
|
| 1332 | - else if ( ($mode == LOCALE_IMPORT_OVERWRITE) and (!$ignoreoverwrite) ) { |
|
| 1286 | + } else if ( ($mode == LOCALE_IMPORT_OVERWRITE) and (!$ignoreoverwrite) ) { |
|
| 1333 | 1287 | // Translation exists, only overwrite if instructed. |
| 1334 | 1288 | db_query("UPDATE {locales_target} SET translation = '%s', plid = %d, plural = %d WHERE language = '%s' AND lid = %d", $translation, $plid, $plural, $langcode, $lid); |
| 1335 | 1289 | $report['updates']++; |
| 1336 | - } |
|
| 1337 | - else { |
|
| 1290 | + } else { |
|
| 1338 | 1291 | $report['skips']++; |
| 1339 | 1292 | }// end if !$exists |
| 1340 | 1293 | |
| 1341 | 1294 | }// while |
| 1342 | 1295 | } |
| 1343 | - } |
|
| 1344 | - elseif ($mode == LOCALE_IMPORT_OVERWRITE AND $resource) { |
|
| 1296 | + } elseif ($mode == LOCALE_IMPORT_OVERWRITE AND $resource) { |
|
| 1345 | 1297 | // Loop over db results from locales_source table. |
| 1346 | 1298 | while ($row = db_fetch_array($resource)) { |
| 1347 | 1299 | $lid = $row['lid']; |
@@ -1352,8 +1304,7 @@ discard block |
||
| 1352 | 1304 | $report['deletes']++; |
| 1353 | 1305 | }// if $exists |
| 1354 | 1306 | }// while |
| 1355 | - } |
|
| 1356 | - else { |
|
| 1307 | + } else { |
|
| 1357 | 1308 | $report['skips']++; |
| 1358 | 1309 | } |
| 1359 | 1310 | |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | $postid = get_int('postid', true); |
| 31 | 31 | $filter = get_str('filter', true); |
| 32 | 32 | |
| 33 | -if ($filter != "false"){ |
|
| 33 | +if ($filter != "false") { |
|
| 34 | 34 | $filter = true; |
| 35 | 35 | } else { |
| 36 | 36 | $filter = false; |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | $sort_style = $temp_sort_style; |
| 81 | 81 | } else if ($sort_style) { |
| 82 | 82 | $forum_style = 0; // this is deprecated |
| 83 | - if ($logged_in_user){ |
|
| 83 | + if ($logged_in_user) { |
|
| 84 | 84 | $logged_in_user->prefs->thread_sorting = $sort_style; |
| 85 | 85 | $logged_in_user->prefs->update("thread_sorting=$sort_style"); |
| 86 | 86 | } else { |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | ); |
| 93 | 93 | } else { |
| 94 | 94 | // get the sorting style from the user or a cookie |
| 95 | - if ($logged_in_user){ |
|
| 95 | + if ($logged_in_user) { |
|
| 96 | 96 | $sort_style = $logged_in_user->prefs->thread_sorting; |
| 97 | 97 | } else { |
| 98 | 98 | list($forum_style, $sort_style) = parse_forum_cookie(); |
@@ -120,9 +120,9 @@ discard block |
||
| 120 | 120 | |
| 121 | 121 | if (false) { |
| 122 | 122 | if ($forum->parent_type == 0) { |
| 123 | - if ($category->is_helpdesk && !$thread->status){ |
|
| 124 | - if ($logged_in_user){ |
|
| 125 | - if ($thread->owner == $logged_in_user->id){ |
|
| 123 | + if ($category->is_helpdesk && !$thread->status) { |
|
| 124 | + if ($logged_in_user) { |
|
| 125 | + if ($thread->owner == $logged_in_user->id) { |
|
| 126 | 126 | if ($thread->replies !=0) { |
| 127 | 127 | // Show a "this question has been answered" to the author |
| 128 | 128 | echo "<p>"; |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | // If logged in user is moderator, enable some extra features |
| 190 | 190 | // |
| 191 | 191 | if (is_moderator($logged_in_user, $forum)) { |
| 192 | - if ($thread->hidden){ |
|
| 192 | + if ($thread->hidden) { |
|
| 193 | 193 | show_button_small( |
| 194 | 194 | "forum_moderate_thread_action.php?action=unhide&thread=".$thread->id."$tokens", |
| 195 | 195 | tra("Unhide"), |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | tra("Hide this thread") |
| 203 | 203 | ); |
| 204 | 204 | } |
| 205 | - if ($thread->sticky){ |
|
| 205 | + if ($thread->sticky) { |
|
| 206 | 206 | show_button_small( |
| 207 | 207 | "forum_moderate_thread_action.php?action=desticky&thread=".$thread->id."$tokens", |
| 208 | 208 | tra("Make unsticky"), |
@@ -7,8 +7,7 @@ |
||
| 7 | 7 | list($module, $api) = func_get_args(); |
| 8 | 8 | if ($module == "panels_mini" && $api == "panels_default") { |
| 9 | 9 | return array("version" => 1); |
| 10 | - } |
|
| 11 | - else if ($module == "strongarm" && $api == "strongarm") { |
|
| 10 | + } else if ($module == "strongarm" && $api == "strongarm") { |
|
| 12 | 11 | return array("version" => 1); |
| 13 | 12 | } |
| 14 | 13 | } |
@@ -147,13 +147,11 @@ discard block |
||
| 147 | 147 | '@pages' => format_plural($pages_generated, 'page', 'pages'), |
| 148 | 148 | ) |
| 149 | 149 | )); |
| 150 | - } |
|
| 151 | - else { |
|
| 150 | + } else { |
|
| 152 | 151 | if ($option) { |
| 153 | 152 | drupal_set_message(t('The @specified page already exists.', |
| 154 | 153 | array('@specified' => $option)), 'warning'); |
| 155 | - } |
|
| 156 | - else { |
|
| 154 | + } else { |
|
| 157 | 155 | drupal_set_message(t('All pages already exist, so none can be recreated |
| 158 | 156 | automatically.'), 'warning'); |
| 159 | 157 | } |
@@ -174,8 +172,7 @@ discard block |
||
| 174 | 172 | 'rules', |
| 175 | 173 | 'moderation', |
| 176 | 174 | ); |
| 177 | - } |
|
| 178 | - elseif (!is_array($pages)) { |
|
| 175 | + } elseif (!is_array($pages)) { |
|
| 179 | 176 | $pages = array($pages); |
| 180 | 177 | } |
| 181 | 178 | |
@@ -44,8 +44,7 @@ discard block |
||
| 44 | 44 | $nid = $existing_teams[$boinc_team->id]; |
| 45 | 45 | $success = boincteam_import($boinc_team, $nid); |
| 46 | 46 | } |
| 47 | - } |
|
| 48 | - else { |
|
| 47 | + } else { |
|
| 49 | 48 | // Import new teams created by RPC or ops/team_import.php |
| 50 | 49 | $success = boincteam_import($boinc_team); |
| 51 | 50 | } |
@@ -77,8 +76,7 @@ discard block |
||
| 77 | 76 | $node->body = $boincteam->description; |
| 78 | 77 | $node->teaser = $teaser; |
| 79 | 78 | $node->uid = boincuser_lookup_uid($boincteam->userid); |
| 80 | - } |
|
| 81 | - else { |
|
| 79 | + } else { |
|
| 82 | 80 | // Construct the team as a new node |
| 83 | 81 | $node = array( |
| 84 | 82 | 'type' => 'team', |
@@ -132,8 +130,7 @@ discard block |
||
| 132 | 130 | } |
| 133 | 131 | if ($boincid) { |
| 134 | 132 | return $ids; |
| 135 | - } |
|
| 136 | - else { |
|
| 133 | + } else { |
|
| 137 | 134 | return array_map('boincuser_lookup_uid', $ids); |
| 138 | 135 | } |
| 139 | 136 | } |
@@ -129,8 +129,7 @@ discard block |
||
| 129 | 129 | AND strpos($link, 'Edit Panel')) { |
| 130 | 130 | // Remove Edit Panel tab |
| 131 | 131 | return ''; |
| 132 | - } |
|
| 133 | - else { |
|
| 132 | + } else { |
|
| 134 | 133 | return '<li '. ($active ? 'class="active" ' : '') .'>'. $link ."</li>\n"; |
| 135 | 134 | } |
| 136 | 135 | } |
@@ -211,19 +210,15 @@ discard block |
||
| 211 | 210 | // "head_title" which is placed in the HTML <head> section. Most of |
| 212 | 211 | // these pages are defined in the Page Manager module. |
| 213 | 212 | // See: https://dev.gridrepublic.org/browse/DBOINC-65 |
| 214 | - if (arg(0) == 'search') { |
|
| 213 | + if (arg(0) == 'search') { |
|
| 215 | 214 | unset($vars['title']); |
| 216 | - } |
|
| 217 | - else if ( (arg(0)=='account') AND (is_numeric(arg(1))) AND (empty(arg(2))) ) { |
|
| 215 | + } else if ( (arg(0)=='account') AND (is_numeric(arg(1))) AND (empty(arg(2))) ) { |
|
| 218 | 216 | unset($vars['title']); |
| 219 | - } |
|
| 220 | - else if ( (arg(0)=='account') AND (arg(1)=='profile') ) { |
|
| 217 | + } else if ( (arg(0)=='account') AND (arg(1)=='profile') ) { |
|
| 221 | 218 | unset($vars['title']); |
| 222 | - } |
|
| 223 | - else if ( (arg(0)=='dashboard') ) { |
|
| 219 | + } else if ( (arg(0)=='dashboard') ) { |
|
| 224 | 220 | unset($vars['title']); |
| 225 | - } |
|
| 226 | - else if ( (arg(0)=='community') AND ( (arg(1)=='teams') OR (arg(1)=='stats') ) ) { |
|
| 221 | + } else if ( (arg(0)=='community') AND ( (arg(1)=='teams') OR (arg(1)=='stats') ) ) { |
|
| 227 | 222 | unset($vars['title']); |
| 228 | 223 | } |
| 229 | 224 | |
@@ -241,8 +236,7 @@ discard block |
||
| 241 | 236 | if ($key == $last_key) { |
| 242 | 237 | $tab = str_replace('li class="', 'li class="last ', $tab) . '</ul>'; |
| 243 | 238 | } |
| 244 | - } |
|
| 245 | - elseif (strpos($tab, 'li ')) { |
|
| 239 | + } elseif (strpos($tab, 'li ')) { |
|
| 246 | 240 | if ($key == 0) { |
| 247 | 241 | $tab = str_replace('li ', 'li class="first" ', $tab); |
| 248 | 242 | } |
@@ -395,8 +389,7 @@ discard block |
||
| 395 | 389 | $cid = boincuser_get_first_unread_comment_id($topic->nid); |
| 396 | 390 | if ($cid) { |
| 397 | 391 | $variables['topics'][$id]->new_url = url("goto/comment/{$cid}"); |
| 398 | - } |
|
| 399 | - else { |
|
| 392 | + } else { |
|
| 400 | 393 | // User hasn't visited this topic before, so all replies are new... |
| 401 | 394 | $topic->new_replies = NULL; |
| 402 | 395 | } |
@@ -453,8 +446,7 @@ discard block |
||
| 453 | 446 | case 'boinc_host_list': |
| 454 | 447 | if ($vars['display_id'] == 'page_2') { |
| 455 | 448 | $vars['empty'] = boincwork_views_host_list_empty_text(); |
| 456 | - } |
|
| 457 | - elseif ($vars['display_id'] == 'page_1') { |
|
| 449 | + } elseif ($vars['display_id'] == 'page_1') { |
|
| 458 | 450 | $vars['empty'] = boincwork_views_host_list_empty_text('active'); |
| 459 | 451 | } |
| 460 | 452 | break; |
@@ -510,8 +502,7 @@ discard block |
||
| 510 | 502 | if ($user_image) { |
| 511 | 503 | if (is_array($user_image) AND $user_image['image']['filepath']) { |
| 512 | 504 | $author_picture .= theme('imagefield_image', $user_image['image'], $user_image['alt'], $user_image['alt'], array(), false); |
| 513 | - } |
|
| 514 | - elseif (is_string($user_image)) { |
|
| 505 | + } elseif (is_string($user_image)) { |
|
| 515 | 506 | $author_picture .= '<img src="' . $user_image . '"/>'; |
| 516 | 507 | } |
| 517 | 508 | } |
@@ -615,26 +606,22 @@ discard block |
||
| 615 | 606 | |
| 616 | 607 | if (user_access('access user profiles')) { |
| 617 | 608 | $output = l($name, 'account/' . $object->uid, array('attributes' => array('title' => bts('View user profile.', array(), NULL, 'boinc:users-table')))); |
| 618 | - } |
|
| 619 | - else { |
|
| 609 | + } else { |
|
| 620 | 610 | $output = check_plain($name); |
| 621 | 611 | } |
| 622 | - } |
|
| 623 | - else if ($object->name) { |
|
| 612 | + } else if ($object->name) { |
|
| 624 | 613 | // Sometimes modules display content composed by people who are |
| 625 | 614 | // not registered members of the site (e.g. mailing list or news |
| 626 | 615 | // aggregator modules). This clause enables modules to display |
| 627 | 616 | // the true author of the content. |
| 628 | 617 | if (!empty($object->homepage)) { |
| 629 | 618 | $output = l($object->name, $object->homepage, array('attributes' => array('rel' => 'nofollow'))); |
| 630 | - } |
|
| 631 | - else { |
|
| 619 | + } else { |
|
| 632 | 620 | $output = check_plain($object->name); |
| 633 | 621 | } |
| 634 | 622 | |
| 635 | 623 | $output .= ' (' . bts('not verified', array(), NULL, 'boinc:user-not-found') . ')'; |
| 636 | - } |
|
| 637 | - else { |
|
| 624 | + } else { |
|
| 638 | 625 | $output = check_plain(variable_get('anonymous', bts('Anonymous', array(), NULL, 'boinc:anonymous-user'))); |
| 639 | 626 | } |
| 640 | 627 | |
@@ -719,7 +706,7 @@ discard block |
||
| 719 | 706 | * Edit action links |
| 720 | 707 | */ |
| 721 | 708 | function phptemplate_links($links, $attributes = array('class' => 'links')) { |
| 722 | - if ($links){ |
|
| 709 | + if ($links) { |
|
| 723 | 710 | // Remove flag-subscriptions link. It will be placed elsewhere. |
| 724 | 711 | if (isset($links['flag-subscriptions'])) { |
| 725 | 712 | unset($links['flag-subscriptions']); |
@@ -908,8 +895,7 @@ discard block |
||
| 908 | 895 | ), |
| 909 | 896 | ); |
| 910 | 897 | } |
| 911 | - } |
|
| 912 | - else if ($type == 'comment' && $user->uid != $object->uid && $object->uid != 0 && user_access('ignore user')) { |
|
| 898 | + } else if ($type == 'comment' && $user->uid != $object->uid && $object->uid != 0 && user_access('ignore user')) { |
|
| 913 | 899 | if (!isset($ignored[$object->uid])) { |
| 914 | 900 | $ignored[$object->uid] = db_result(db_query('SELECT COUNT(*) FROM {ignore_user} WHERE uid = %d AND iuid = %d', $user->uid, $object->uid)); |
| 915 | 901 | } |
@@ -279,8 +279,7 @@ discard block |
||
| 279 | 279 | 'href' => 'account/prefs/privacy/ignore_user/remove/'. $author->uid, |
| 280 | 280 | 'query' => 'destination=messages/view/' . $thread_id, |
| 281 | 281 | ); |
| 282 | - } |
|
| 283 | - else { |
|
| 282 | + } else { |
|
| 284 | 283 | $vars['message_actions']['ignore_user'] = array( |
| 285 | 284 | 'title' => bts('Ignore User', array(), NULL, 'boinc:ignore-user-add'), |
| 286 | 285 | 'href' => 'account/prefs/privacy/ignore_user/add/'. $author->uid, |
@@ -387,8 +386,7 @@ discard block |
||
| 387 | 386 | } |
| 388 | 387 | if (!$special) { |
| 389 | 388 | $output .= "<td>{$value} {$pref_setting['#field_suffix']}</td>"; |
| 390 | - } |
|
| 391 | - else { |
|
| 389 | + } else { |
|
| 392 | 390 | // The "very special" case where we merge two prefs |
| 393 | 391 | $second_pref = $special_map[$name]; |
| 394 | 392 | $second_pref_setting = $prefs[$pref_set]['prefs']['advanced'][$category][$second_pref]; |
@@ -396,8 +394,7 @@ discard block |
||
| 396 | 394 | $output .= "<td>{$value} {$pref_setting['#field_suffix']} {$special_delimiter[$name]}" . |
| 397 | 395 | " {$second_value} {$second_pref_setting['#field_suffix']} </td>"; |
| 398 | 396 | } |
| 399 | - } |
|
| 400 | - else { |
|
| 397 | + } else { |
|
| 401 | 398 | $output .= '<td>---</td>'; |
| 402 | 399 | } |
| 403 | 400 | } |
@@ -923,22 +920,19 @@ discard block |
||
| 923 | 920 | drupal_set_message(t('Host @id has been removed from your account.', |
| 924 | 921 | array('@id' => $host_id))); |
| 925 | 922 | drupal_goto('account/computers'); |
| 926 | - } |
|
| 927 | - else { |
|
| 923 | + } else { |
|
| 928 | 924 | drupal_set_message(t('Host @id could not be deleted. Not sure why...', |
| 929 | 925 | array('@id' => $host_id)), 'error' |
| 930 | 926 | ); |
| 931 | 927 | } |
| 932 | - } |
|
| 933 | - else { |
|
| 928 | + } else { |
|
| 934 | 929 | drupal_set_message(t('Host @id cannot be deleted because it still has |
| 935 | 930 | tasks associated with it. These tasks should be processed within the |
| 936 | 931 | next few days, after which the host can be deleted.', |
| 937 | 932 | array('@id' => $host_id)), 'warning' |
| 938 | 933 | ); |
| 939 | 934 | } |
| 940 | - } |
|
| 941 | - else { |
|
| 935 | + } else { |
|
| 942 | 936 | drupal_set_message(t('You are not the owner of host @id, so you cannot |
| 943 | 937 | delete it.', |
| 944 | 938 | array('@id' => $host_id)), 'error' |
@@ -986,15 +980,13 @@ discard block |
||
| 986 | 980 | bts('The location for this host has been updated.', array(), NULL, 'boinc:account-host-details') |
| 987 | 981 | . bts('This will take effect next time the host contacts the project.', array(), NULL, 'boinc:account-host-details') |
| 988 | 982 | ); |
| 989 | - } |
|
| 990 | - else { |
|
| 983 | + } else { |
|
| 991 | 984 | drupal_set_message( |
| 992 | 985 | bts('Unable to save changes to this host for some reason!', array(), NULL, 'boinc:account-host-details'), |
| 993 | 986 | 'error' |
| 994 | 987 | ); |
| 995 | 988 | } |
| 996 | - } |
|
| 997 | - else { |
|
| 989 | + } else { |
|
| 998 | 990 | drupal_set_message( |
| 999 | 991 | bts('You are not allowed to make changes to this host.', array(), NULL, 'boinc:account-host-details'), |
| 1000 | 992 | 'warning' |
@@ -1129,8 +1121,7 @@ discard block |
||
| 1129 | 1121 | $venue = $active_venue; |
| 1130 | 1122 | //unset($_SESSION['prefs venue']); |
| 1131 | 1123 | } |
| 1132 | - } |
|
| 1133 | - else { |
|
| 1124 | + } else { |
|
| 1134 | 1125 | // Set the active venue to keep it selected between computing and project |
| 1135 | 1126 | // preference pages |
| 1136 | 1127 | $_SESSION['prefs venue'] = $venue; |