@@ -258,8 +258,7 @@ discard block |
||
| 258 | 258 | ), WATCHDOG_NOTICE |
| 259 | 259 | ); |
| 260 | 260 | } |
| 261 | - } |
|
| 262 | - else { |
|
| 261 | + } else { |
|
| 263 | 262 | drupal_set_message(t('You are not allowed to assume foundership of this |
| 264 | 263 | team.' |
| 265 | 264 | )); |
@@ -284,8 +283,7 @@ discard block |
||
| 284 | 283 | drupal_set_message(t('@team has been removed.', |
| 285 | 284 | array('@team' => $boincteam->name))); |
| 286 | 285 | drupal_goto('community/teams'); |
| 287 | - } |
|
| 288 | - else { |
|
| 286 | + } else { |
|
| 289 | 287 | drupal_set_message(t('All members must be removed from @team before the |
| 290 | 288 | team can be deleted.', array('@team' => $boincteam->name)), 'error'); |
| 291 | 289 | drupal_goto(strstr($_GET['q'], '/delete', TRUE)); |
@@ -519,8 +517,7 @@ discard block |
||
| 519 | 517 | array('@team' => $boincteam->name))); |
| 520 | 518 | watchdog('boincteam', 'added user @uid to team @nid', |
| 521 | 519 | array('@uid' => $user->uid, '@nid' => $team_id), WATCHDOG_NOTICE); |
| 522 | - } |
|
| 523 | - else { |
|
| 520 | + } else { |
|
| 524 | 521 | // @todo - consider another rule/error event here |
| 525 | 522 | drupal_set_message(t('There was a problem joining @team, please try again |
| 526 | 523 | later', array('@team' => $boincteam->name))); |
@@ -548,8 +545,7 @@ discard block |
||
| 548 | 545 | array('@team' => $boincteam->name))); |
| 549 | 546 | watchdog('boincteam', 'removed user @uid from team @nid', |
| 550 | 547 | array('@uid' => $user->uid, '@nid' => $team_id), WATCHDOG_NOTICE); |
| 551 | - } |
|
| 552 | - else { |
|
| 548 | + } else { |
|
| 553 | 549 | drupal_set_message(t('You are not a member of @team, so you cannot revoke |
| 554 | 550 | your membership to it.', array('@team' => $boincteam->name))); |
| 555 | 551 | } |
@@ -618,8 +614,7 @@ discard block |
||
| 618 | 614 | '@uid' => $account->uid, |
| 619 | 615 | '@nid' => $team_id |
| 620 | 616 | ), WATCHDOG_NOTICE); |
| 621 | - } |
|
| 622 | - else { |
|
| 617 | + } else { |
|
| 623 | 618 | drupal_set_message(t('@user is not a member of @team, so you cannot |
| 624 | 619 | revoke the membership.', array( |
| 625 | 620 | '@user' => $account->boincuser_name, |
@@ -648,14 +643,12 @@ discard block |
||
| 648 | 643 | '@user' => $account->boincuser_name |
| 649 | 644 | ) |
| 650 | 645 | ), 'warning'); |
| 651 | - } |
|
| 652 | - elseif (!boincteam_new_foundership_transfer_request_ok($team_id)) { |
|
| 646 | + } elseif (!boincteam_new_foundership_transfer_request_ok($team_id)) { |
|
| 653 | 647 | // It hasn't been long enough since the last transfer request |
| 654 | 648 | drupal_set_message(t('A foundership change was requested during the last 90 |
| 655 | 649 | days, so new requests are not allowed. Please try again later.' |
| 656 | 650 | ), 'warning'); |
| 657 | - } |
|
| 658 | - elseif (boincteam_is_member($team_id, $account->uid)) { |
|
| 651 | + } elseif (boincteam_is_member($team_id, $account->uid)) { |
|
| 659 | 652 | // Log the transfer request |
| 660 | 653 | db_set_active('boinc_rw'); |
| 661 | 654 | db_query(" |
@@ -861,8 +854,7 @@ discard block |
||
| 861 | 854 | $output .= '['; |
| 862 | 855 | if ($credit_needed == 1) { |
| 863 | 856 | $output .= bts('You must earn 1 more credit!', array(), NULL, 'boinc:create-team-panel'); |
| 864 | - } |
|
| 865 | - else { |
|
| 857 | + } else { |
|
| 866 | 858 | $output .= bts('You must earn @count more credits!', |
| 867 | 859 | array('@count' => $credit_needed), |
| 868 | 860 | NULL, 'boinc:create-team-panel' |
@@ -915,8 +907,7 @@ discard block |
||
| 915 | 907 | $output .= ' <label>' . bts('Total credit', array(), NULL, 'boinc:user-or-team-total-credits') . ': </label>'; |
| 916 | 908 | $output .= ' <span>' . number_format($team->total_credit, 0) . '</span>'; |
| 917 | 909 | $output .= '</div>' . "\n"; |
| 918 | - } |
|
| 919 | - else if ($user->uid == $account->uid) { |
|
| 910 | + } else if ($user->uid == $account->uid) { |
|
| 920 | 911 | $output .= '<h2 class="pane-title">' . bts('Team (None)', array(), NULL, 'boinc:team-dashboard') . '</h2>'; |
| 921 | 912 | $output .= '<ul class="tab-list action-list">'; |
| 922 | 913 | $output .= '<li class="tab primary">'; |
@@ -1123,8 +1114,7 @@ discard block |
||
| 1123 | 1114 | if ($request_age == 1) { |
| 1124 | 1115 | $output .= bts('1 day has elapsed since your request and' |
| 1125 | 1116 | . ' the founder has not responded.', array(), NULL, 'boinc:team-request-foundership'); |
| 1126 | - } |
|
| 1127 | - else { |
|
| 1117 | + } else { |
|
| 1128 | 1118 | $output .= bts('@count days have elapsed since your request and' |
| 1129 | 1119 | . ' the founder has not responded.', |
| 1130 | 1120 | array('@count' => $request_age), |
@@ -1134,8 +1124,7 @@ discard block |
||
| 1134 | 1124 | if ($days_to_respond == 1) { |
| 1135 | 1125 | $output .= bts('You now have 1 day to assume foundership before' |
| 1136 | 1126 | . ' another team member may submit a request.', array(), NULL, 'boinc:team-request-foundership'); |
| 1137 | - } |
|
| 1138 | - else { |
|
| 1127 | + } else { |
|
| 1139 | 1128 | $output .= bts('You now have @count days to assume foundership before' |
| 1140 | 1129 | . ' another team member may submit a request.', |
| 1141 | 1130 | array('@count' => $days_to_respond), |
@@ -1146,23 +1135,20 @@ discard block |
||
| 1146 | 1135 | $output .= ' <li class="first last tab">' . |
| 1147 | 1136 | l(bts('Assume foundership', array(), NULL, 'boinc:team-request-foundership'), "community/teams/{$team_id}/assume-foundership") . '</li>'; |
| 1148 | 1137 | $output .= '</ul>'; |
| 1149 | - } |
|
| 1150 | - else { |
|
| 1138 | + } else { |
|
| 1151 | 1139 | $output .= '<p>'; |
| 1152 | 1140 | if ($days_to_deadline == 1) { |
| 1153 | 1141 | $output .= bts('The team founder has 1 day to respond to your' |
| 1154 | 1142 | . ' transfer request.', |
| 1155 | 1143 | NULL, 'boinc:team-request-foundership'); |
| 1156 | - } |
|
| 1157 | - else { |
|
| 1144 | + } else { |
|
| 1158 | 1145 | $output .= bts('The team founder has @count days to respond to your' |
| 1159 | 1146 | . ' transfer request.', array('@count' => $days_to_deadline), |
| 1160 | 1147 | NULL, 'boinc:team-request-foundership'); |
| 1161 | 1148 | } |
| 1162 | 1149 | $output .= '</p>'; |
| 1163 | 1150 | } |
| 1164 | - } |
|
| 1165 | - elseif (!boincteam_new_foundership_transfer_request_ok($team_id)) { |
|
| 1151 | + } elseif (!boincteam_new_foundership_transfer_request_ok($team_id)) { |
|
| 1166 | 1152 | // If this user does not have a transfer request pending, but new requests |
| 1167 | 1153 | // are not allowed, set the deadline to 90 days instead of 60 (as the user |
| 1168 | 1154 | // who made the request has 30 additional days to assume foundership if |
@@ -1175,15 +1161,13 @@ discard block |
||
| 1175 | 1161 | NULL, 'boinc:team-request-foundership'); |
| 1176 | 1162 | if ($days_to_deadline == 1) { |
| 1177 | 1163 | $output .= ' (' . bts('1 day remaining', array(), NULL, 'boinc:team-request-foundership') . ')'; |
| 1178 | - } |
|
| 1179 | - else { |
|
| 1164 | + } else { |
|
| 1180 | 1165 | $output .= ' (' . bts('@count days remaining', |
| 1181 | 1166 | array('@count' => $days_to_deadline), |
| 1182 | 1167 | NULL, 'boinc:team-request-foundership') . ')'; |
| 1183 | 1168 | } |
| 1184 | 1169 | $output .= '</p>'; |
| 1185 | - } |
|
| 1186 | - else { |
|
| 1170 | + } else { |
|
| 1187 | 1171 | $output .= '<p>' . bts('If the team founder is not active and you want to' |
| 1188 | 1172 | . ' assume the role of founder, click below to request foundership of' |
| 1189 | 1173 | . ' @this_team.', |
@@ -1229,8 +1213,7 @@ discard block |
||
| 1229 | 1213 | $boincteam_id |
| 1230 | 1214 | ); |
| 1231 | 1215 | db_set_active('default'); |
| 1232 | - } |
|
| 1233 | - else { |
|
| 1216 | + } else { |
|
| 1234 | 1217 | $member = user_load(boincuser_lookup_uid($boincteam->ping_user)); |
| 1235 | 1218 | $output .= '<h2 class="pane-title">' . bts('Respond to transfer request', array(), NULL, 'boinc:team-request-foundership-response') |
| 1236 | 1219 | . '</h2>'; |
@@ -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 | |
@@ -130,8 +130,7 @@ discard block |
||
| 130 | 130 | AND strpos($link, 'Edit Panel')) { |
| 131 | 131 | // Remove Edit Panel tab |
| 132 | 132 | return ''; |
| 133 | - } |
|
| 134 | - else { |
|
| 133 | + } else { |
|
| 135 | 134 | return '<li '. ($active ? 'class="active" ' : '') .'>'. $link ."</li>\n"; |
| 136 | 135 | } |
| 137 | 136 | } |
@@ -218,17 +217,13 @@ discard block |
||
| 218 | 217 | // See: https://dev.gridrepublic.org/browse/DBOINC-65 |
| 219 | 218 | if (arg(0) == 'search') { |
| 220 | 219 | unset($vars['title']); |
| 221 | - } |
|
| 222 | - else if ( (arg(0)=='account') AND (is_numeric(arg(1))) AND (empty(arg(2))) ) { |
|
| 220 | + } else if ( (arg(0)=='account') AND (is_numeric(arg(1))) AND (empty(arg(2))) ) { |
|
| 223 | 221 | unset($vars['title']); |
| 224 | - } |
|
| 225 | - else if ( (arg(0)=='account') AND (arg(1)=='profile') ) { |
|
| 222 | + } else if ( (arg(0)=='account') AND (arg(1)=='profile') ) { |
|
| 226 | 223 | unset($vars['title']); |
| 227 | - } |
|
| 228 | - else if ( (arg(0)=='dashboard') ) { |
|
| 224 | + } else if ( (arg(0)=='dashboard') ) { |
|
| 229 | 225 | unset($vars['title']); |
| 230 | - } |
|
| 231 | - else if ( (arg(0)=='community') AND ( (arg(1)=='teams') OR (arg(1)=='stats') ) ) { |
|
| 226 | + } else if ( (arg(0)=='community') AND ( (arg(1)=='teams') OR (arg(1)=='stats') ) ) { |
|
| 232 | 227 | unset($vars['title']); |
| 233 | 228 | } |
| 234 | 229 | |
@@ -246,8 +241,7 @@ discard block |
||
| 246 | 241 | if ($key == $last_key) { |
| 247 | 242 | $tab = str_replace('li class="', 'li class="last ', $tab) . '</ul>'; |
| 248 | 243 | } |
| 249 | - } |
|
| 250 | - elseif (strpos($tab, 'li ')) { |
|
| 244 | + } elseif (strpos($tab, 'li ')) { |
|
| 251 | 245 | if ($key == 0) { |
| 252 | 246 | $tab = str_replace('li ', 'li class="first" ', $tab); |
| 253 | 247 | } |
@@ -400,8 +394,7 @@ discard block |
||
| 400 | 394 | $cid = boincuser_get_first_unread_comment_id($topic->nid); |
| 401 | 395 | if ($cid) { |
| 402 | 396 | $variables['topics'][$id]->new_url = url("goto/comment/{$cid}"); |
| 403 | - } |
|
| 404 | - else { |
|
| 397 | + } else { |
|
| 405 | 398 | // User hasn't visited this topic before, so all replies are new... |
| 406 | 399 | $topic->new_replies = NULL; |
| 407 | 400 | } |
@@ -458,8 +451,7 @@ discard block |
||
| 458 | 451 | case 'boinc_host_list': |
| 459 | 452 | if ($vars['display_id'] == 'page_2') { |
| 460 | 453 | $vars['empty'] = boincwork_views_host_list_empty_text(); |
| 461 | - } |
|
| 462 | - elseif ($vars['display_id'] == 'page_1') { |
|
| 454 | + } elseif ($vars['display_id'] == 'page_1') { |
|
| 463 | 455 | $vars['empty'] = boincwork_views_host_list_empty_text('active'); |
| 464 | 456 | } |
| 465 | 457 | break; |
@@ -515,8 +507,7 @@ discard block |
||
| 515 | 507 | if ($user_image) { |
| 516 | 508 | if (is_array($user_image) AND $user_image['image']['filepath']) { |
| 517 | 509 | $author_picture .= theme('imagefield_image', $user_image['image'], $user_image['alt'], $user_image['alt'], array(), false); |
| 518 | - } |
|
| 519 | - elseif (is_string($user_image)) { |
|
| 510 | + } elseif (is_string($user_image)) { |
|
| 520 | 511 | $author_picture .= '<img src="' . $user_image . '"/>'; |
| 521 | 512 | } |
| 522 | 513 | } |
@@ -620,26 +611,22 @@ discard block |
||
| 620 | 611 | |
| 621 | 612 | if (user_access('access user profiles')) { |
| 622 | 613 | $output = l($name, 'account/' . $object->uid, array('attributes' => array('title' => bts('View user profile.', array(), NULL, 'boinc:users-table')))); |
| 623 | - } |
|
| 624 | - else { |
|
| 614 | + } else { |
|
| 625 | 615 | $output = check_plain($name); |
| 626 | 616 | } |
| 627 | - } |
|
| 628 | - else if ($object->name) { |
|
| 617 | + } else if ($object->name) { |
|
| 629 | 618 | // Sometimes modules display content composed by people who are |
| 630 | 619 | // not registered members of the site (e.g. mailing list or news |
| 631 | 620 | // aggregator modules). This clause enables modules to display |
| 632 | 621 | // the true author of the content. |
| 633 | 622 | if (!empty($object->homepage)) { |
| 634 | 623 | $output = l($object->name, $object->homepage, array('attributes' => array('rel' => 'nofollow'))); |
| 635 | - } |
|
| 636 | - else { |
|
| 624 | + } else { |
|
| 637 | 625 | $output = check_plain($object->name); |
| 638 | 626 | } |
| 639 | 627 | |
| 640 | 628 | $output .= ' (' . bts('not verified', array(), NULL, 'boinc:user-not-found') . ')'; |
| 641 | - } |
|
| 642 | - else { |
|
| 629 | + } else { |
|
| 643 | 630 | $output = check_plain(variable_get('anonymous', bts('Anonymous', array(), NULL, 'boinc:anonymous-user'))); |
| 644 | 631 | } |
| 645 | 632 | |
@@ -724,7 +711,7 @@ discard block |
||
| 724 | 711 | * Edit action links |
| 725 | 712 | */ |
| 726 | 713 | function phptemplate_links($links, $attributes = array('class' => 'links')) { |
| 727 | - if ($links){ |
|
| 714 | + if ($links) { |
|
| 728 | 715 | // Remove flag-subscriptions link. It will be placed elsewhere. |
| 729 | 716 | if (isset($links['flag-subscriptions'])) { |
| 730 | 717 | unset($links['flag-subscriptions']); |
@@ -913,8 +900,7 @@ discard block |
||
| 913 | 900 | ), |
| 914 | 901 | ); |
| 915 | 902 | } |
| 916 | - } |
|
| 917 | - else if ($type == 'comment' && $user->uid != $object->uid && $object->uid != 0 && user_access('ignore user')) { |
|
| 903 | + } else if ($type == 'comment' && $user->uid != $object->uid && $object->uid != 0 && user_access('ignore user')) { |
|
| 918 | 904 | if (!isset($ignored[$object->uid])) { |
| 919 | 905 | $ignored[$object->uid] = db_result(db_query('SELECT COUNT(*) FROM {ignore_user} WHERE uid = %d AND iuid = %d', $user->uid, $object->uid)); |
| 920 | 906 | } |
@@ -43,14 +43,15 @@ |
||
| 43 | 43 | $profiles = _mysql_query("select * from profile where userid>$start_id order by userid"); |
| 44 | 44 | echo _mysql_error(); |
| 45 | 45 | $i=0; |
| 46 | - while ($profile = _mysql_fetch_object($profiles)){ |
|
| 46 | + while ($profile = _mysql_fetch_object($profiles)) { |
|
| 47 | 47 | $i++; |
| 48 | - if ($i%100 == 0) { //For every 100 profiles |
|
| 48 | + if ($i%100 == 0) { |
|
| 49 | +//For every 100 profiles |
|
| 49 | 50 | echo $profile->userid.". "; flush(); // print out where we are |
| 50 | 51 | //usleep(200000); |
| 51 | 52 | } |
| 52 | 53 | |
| 53 | - if ($profile->userid > $start_id){ |
|
| 54 | + if ($profile->userid > $start_id) { |
|
| 54 | 55 | fix_profile($profile); |
| 55 | 56 | } |
| 56 | 57 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | |
| 43 | 43 | // returns formatted data size |
| 44 | -function size_format($size){ |
|
| 44 | +function size_format($size) { |
|
| 45 | 45 | $retval = 0; |
| 46 | 46 | |
| 47 | 47 | $KB = 1024; |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | echo "<th>Avg. Size per Row</th>"; |
| 127 | 127 | echo "</tr>"; |
| 128 | 128 | |
| 129 | - for ($i = 0; $i < sizeof($db_rec)-1; $i++){ |
|
| 129 | + for ($i = 0; $i < sizeof($db_rec)-1; $i++) { |
|
| 130 | 130 | echo "<tr>"; |
| 131 | 131 | echo "<td align=left valign=top class=fieldname>" . $db_rec[$i]->name . "</td>"; |
| 132 | 132 | echo "<td align=left valign=top class=fieldname>" . size_format($db_rec[$i]->data_size) . "</td>"; |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | } |
| 173 | 173 | if (empty($r)) $r=0; |
| 174 | 174 | |
| 175 | - for ($i=0; $i < sizeof($db_rec)-1; $i++){ |
|
| 175 | + for ($i=0; $i < sizeof($db_rec)-1; $i++) { |
|
| 176 | 176 | $file_details["name"] = $db_rec[$i]->name; |
| 177 | 177 | $file_details["data_size"] = $db_rec[$i]->data_size; |
| 178 | 178 | $file_details["index_size"] = $db_rec[$i]->index_size; |
@@ -242,7 +242,7 @@ |
||
| 242 | 242 | $users = BoincUser::enum( |
| 243 | 243 | sprintf("name like '%s%%'", $new_name) |
| 244 | 244 | ); |
| 245 | - foreach ($users as $u){ |
|
| 245 | + foreach ($users as $u) { |
|
| 246 | 246 | echo "<p>$u->name\n"; |
| 247 | 247 | } |
| 248 | 248 | page_tail(); |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | } |
| 30 | 30 | BoincForumPrefs::lookup($user); |
| 31 | 31 | |
| 32 | -if (post_str("action", true)=="reset_confirm"){ |
|
| 32 | +if (post_str("action", true)=="reset_confirm") { |
|
| 33 | 33 | page_head(tra("Confirm reset")); |
| 34 | 34 | echo tra("This action will erase any changes you have made in your community preferences. To cancel, click your browser's Back button.")." |
| 35 | 35 | <p> |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | // If the user has requested a reset of preferences; |
| 46 | 46 | // preserve a few fields. |
| 47 | 47 | // |
| 48 | -if (post_str("action", true)=="reset"){ |
|
| 48 | +if (post_str("action", true)=="reset") { |
|
| 49 | 49 | $posts = $user->prefs->posts; |
| 50 | 50 | $last_post = $user->prefs->last_post; |
| 51 | 51 | $rated_posts = $user->prefs->rated_posts; |
@@ -71,8 +71,8 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | // Update the user avatar |
| 73 | 73 | if ($avatar_type<0 or $avatar_type>3) $avatar_type=0; |
| 74 | -if ($avatar_type==0){ |
|
| 75 | - if (file_exists($newfile)){ |
|
| 74 | +if ($avatar_type==0) { |
|
| 75 | + if (file_exists($newfile)) { |
|
| 76 | 76 | // Delete the file on the server if the user |
| 77 | 77 | // decides not to use an avatar |
| 78 | 78 | // |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | $avatar_url=""; |
| 82 | 82 | } elseif ($avatar_type == 1) { |
| 83 | 83 | $avatar_url = "//www.gravatar.com/avatar/".md5($user->email_addr)."?s=100&d=identicon"; |
| 84 | -} elseif ($avatar_type==2){ |
|
| 84 | +} elseif ($avatar_type==2) { |
|
| 85 | 85 | if (($rpc && (post_str("avatar_url", true) != null)) || ($_FILES['picture']['tmp_name']!="")) { |
| 86 | 86 | if ($_FILES['picture']['tmp_name']!="") { |
| 87 | 87 | $file = $_FILES['picture']['tmp_name']; |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | $file = post_str("avatar_url"); |
| 91 | 91 | } |
| 92 | 92 | $size = getImageSize($file); |
| 93 | - if ($size[2]!=2 and $size[2]!=3){ |
|
| 93 | + if ($size[2]!=2 and $size[2]!=3) { |
|
| 94 | 94 | //Not the right kind of file |
| 95 | 95 | error_page(tra("Error: Not the right kind of file, only PNG and JPEG are supported.")); |
| 96 | 96 | } |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | $image2 = intelligently_scale_image($file, 100, 100); |
| 100 | 100 | ImageJPEG($image2, $newfile); |
| 101 | 101 | } |
| 102 | - if (file_exists($newfile)){ |
|
| 102 | + if (file_exists($newfile)) { |
|
| 103 | 103 | $avatar_url=IMAGE_URL.$user->id."_avatar.jpg"; //$newfile; |
| 104 | 104 | } else { |
| 105 | 105 | //User didn't upload a compatible file or it went lost on the server |
@@ -142,9 +142,9 @@ discard block |
||
| 142 | 142 | } else { |
| 143 | 143 | // todo: clean up the following |
| 144 | 144 | $add_user_to_filter = (isset($_POST["add_user_to_filter"]) && $_POST["add_user_to_filter"]!=""); |
| 145 | - if ($add_user_to_filter){ |
|
| 145 | + if ($add_user_to_filter) { |
|
| 146 | 146 | $user_to_add = trim($_POST["forum_filter_user"]); |
| 147 | - if ($user_to_add!="" and $user_to_add==strval(intval($user_to_add))){ |
|
| 147 | + if ($user_to_add!="" and $user_to_add==strval(intval($user_to_add))) { |
|
| 148 | 148 | $other_user = BoincUser::lookup_id($user_to_add); |
| 149 | 149 | if (!$other_user) { |
| 150 | 150 | echo tra("No such user:")." ".$user_to_add; |
@@ -159,9 +159,9 @@ discard block |
||
| 159 | 159 | // |
| 160 | 160 | $ignored_users = get_ignored_list($user); |
| 161 | 161 | // todo: use foreach |
| 162 | -for ($i=0;$i<sizeof($ignored_users);$i++){ |
|
| 162 | +for ($i=0;$i<sizeof($ignored_users);$i++) { |
|
| 163 | 163 | $remove = "remove".trim($ignored_users[$i]); |
| 164 | - if (isset($_POST[$remove]) && $_POST[$remove]!=""){ |
|
| 164 | + if (isset($_POST[$remove]) && $_POST[$remove]!="") { |
|
| 165 | 165 | $other_user = BoincUser::lookup_id($ignored_users[$i]); |
| 166 | 166 | if (!$other_user) { |
| 167 | 167 | echo tra("No such user:")." ".$ignored_users[$j]; |
@@ -53,8 +53,9 @@ discard block |
||
| 53 | 53 | // ------------ Forum identity ----------- |
| 54 | 54 | |
| 55 | 55 | $select_0 = $select_1 = $select_2 = ""; |
| 56 | -if (strlen($user->prefs->avatar)){ |
|
| 57 | - if (substr($user->prefs->avatar, 0, 23) == 'http://www.gravatar.com' || substr($user->prefs->avatar, 0, 18)=="//www.gravatar.com") { // Gravatar |
|
| 56 | +if (strlen($user->prefs->avatar)) { |
|
| 57 | + if (substr($user->prefs->avatar, 0, 23) == 'http://www.gravatar.com' || substr($user->prefs->avatar, 0, 18)=="//www.gravatar.com") { |
|
| 58 | +// Gravatar |
|
| 58 | 59 | $select_1 = "checked=\"true\""; |
| 59 | 60 | } else { |
| 60 | 61 | $select_2 = "checked=\"true\""; |
@@ -73,7 +74,7 @@ discard block |
||
| 73 | 74 | <input type=\"radio\" id=\"avatar_select_2\" name=\"avatar_select\" value=\"2\" ".$select_2."> |
| 74 | 75 | <label for=\"avatar_select_2\">".tra("Use this uploaded avatar:")."</label> <input type=\"file\" name=\"picture\">" |
| 75 | 76 | ); |
| 76 | -if (strlen($user->prefs->avatar)){ |
|
| 77 | +if (strlen($user->prefs->avatar)) { |
|
| 77 | 78 | row2(tra("Avatar preview")."<br><p class=\"text-muted\">".tra("This is how your avatar will look")."</p>", |
| 78 | 79 | "<img src=\"".$user->prefs->avatar."\" width=\"100\" height=\"100\">"); |
| 79 | 80 | } |
@@ -103,7 +104,7 @@ discard block |
||
| 103 | 104 | tra("Attach signature by default") |
| 104 | 105 | ) |
| 105 | 106 | ); |
| 106 | -if ($user->prefs->signature!=""){ |
|
| 107 | +if ($user->prefs->signature!="") { |
|
| 107 | 108 | row2(tra("Signature preview"). |
| 108 | 109 | "<br><p class=\"text-muted\">".tra("This is how your signature will look in the forums")."</p>", |
| 109 | 110 | output_transform($user->prefs->signature) |
@@ -407,7 +407,7 @@ discard block |
||
| 407 | 407 | $user->id, |
| 408 | 408 | $name |
| 409 | 409 | ); |
| 410 | - if (function_exists("project_user_links")){ |
|
| 410 | + if (function_exists("project_user_links")) { |
|
| 411 | 411 | $x .= project_user_links($user); |
| 412 | 412 | } |
| 413 | 413 | if ($badge_height) { |
@@ -530,7 +530,7 @@ discard block |
||
| 530 | 530 | |
| 531 | 531 | // return an object with data to show the user's community links |
| 532 | 532 | // |
| 533 | -function get_community_links_object($user){ |
|
| 533 | +function get_community_links_object($user) { |
|
| 534 | 534 | $cache_object = new StdClass; |
| 535 | 535 | $cache_object->post_count = total_posts($user); |
| 536 | 536 | $cache_object->user = $user; |
@@ -548,7 +548,7 @@ discard block |
||
| 548 | 548 | |
| 549 | 549 | // show community links of another user (described by $clo) |
| 550 | 550 | // |
| 551 | -function community_links($clo, $logged_in_user){ |
|
| 551 | +function community_links($clo, $logged_in_user) { |
|
| 552 | 552 | $user = $clo->user; |
| 553 | 553 | if (!$user) { |
| 554 | 554 | error_log("community_links(): null user\n"); |