@@ -172,8 +172,7 @@ discard block |
||
| 172 | 172 | $out['result'] = $result; |
| 173 | 173 | if ($result == 1) { |
| 174 | 174 | $out['html'] .= '<li>'. t('Module %module is enabled. OK!', array('%module' => $module)) .'</li>'; |
| 175 | - } |
|
| 176 | - else { |
|
| 175 | + } else { |
|
| 177 | 176 | $out['html'] .= '<li><span class="marker">'. t('Module %module is disabled.', array('%module' => $module)) .'</span></li>'; |
| 178 | 177 | } |
| 179 | 178 | $out['html'] .= '</ul>'; |
@@ -201,16 +200,14 @@ discard block |
||
| 201 | 200 | if ($GLOBALS['db_type'] == 'pgsql') { |
| 202 | 201 | // adapt from db_table_exists in database.pgsql.inc |
| 203 | 202 | $result = (bool) db_result(db_query("SELECT COUNT(*) FROM pg_class WHERE relname = '%s'", $table)); |
| 204 | - } |
|
| 205 | - else { |
|
| 203 | + } else { |
|
| 206 | 204 | // adapt from db_table_exists in database.mysql.inc |
| 207 | 205 | $result = (bool) db_fetch_object(db_query("SHOW TABLES LIKE '%s'", $table)); |
| 208 | 206 | } |
| 209 | 207 | db_set_active('default'); |
| 210 | 208 | if ($result) { |
| 211 | 209 | $out['html'] .= '<li>'. t('Table %table: OK!', array('%table' => $table)) .'</li>'; |
| 212 | - } |
|
| 213 | - else { |
|
| 210 | + } else { |
|
| 214 | 211 | $out['html'] .= '<li><span class="marker">'. t('Table <strong>%table</strong> does not exist!', array('%table' => $table)) .'</span></li>'; |
| 215 | 212 | $out['result']= 0; |
| 216 | 213 | } |
@@ -258,8 +255,7 @@ discard block |
||
| 258 | 255 | array('!unlock_it' => l(t('release the lock'), |
| 259 | 256 | 'admin/boinc/import/unlock') |
| 260 | 257 | ), WATCHDOG_WARNING); |
| 261 | - } |
|
| 262 | - else { |
|
| 258 | + } else { |
|
| 263 | 259 | $boincimport_functions = array( |
| 264 | 260 | 'users' => t('Import users'), |
| 265 | 261 | 'teams' => t('Import teams'), |
@@ -294,8 +290,7 @@ discard block |
||
| 294 | 290 | // Lock the import process |
| 295 | 291 | if (!variable_get('boincimport_process_locked', 0)) { |
| 296 | 292 | variable_set('boincimport_process_locked', 1); |
| 297 | - } |
|
| 298 | - else { |
|
| 293 | + } else { |
|
| 299 | 294 | watchdog('boincimport', 'The import process is locked, but another process |
| 300 | 295 | is trying to access it...', array(), WATCHDOG_WARNING); |
| 301 | 296 | } |
@@ -309,8 +304,7 @@ discard block |
||
| 309 | 304 | boincimport_teams(); |
| 310 | 305 | if (!variable_get('boincimport_import_team_successful', 0)) { |
| 311 | 306 | $_SESSION['boincimport_stage_selected'] = 'teams'; |
| 312 | - } |
|
| 313 | - else { |
|
| 307 | + } else { |
|
| 314 | 308 | $_SESSION['boincimport_stage_selected'] = 'friends'; |
| 315 | 309 | } |
| 316 | 310 | break; |
@@ -319,8 +313,7 @@ discard block |
||
| 319 | 313 | boincimport_friends(); |
| 320 | 314 | if (!variable_get('boincimport_import_friend_successful', 0)) { |
| 321 | 315 | $_SESSION['boincimport_stage_selected'] = 'friends'; |
| 322 | - } |
|
| 323 | - else { |
|
| 316 | + } else { |
|
| 324 | 317 | $_SESSION['boincimport_stage_selected'] = 'preferences'; |
| 325 | 318 | } |
| 326 | 319 | break; |
@@ -329,8 +322,7 @@ discard block |
||
| 329 | 322 | boincimport_preferences(); |
| 330 | 323 | if (!variable_get('boincimport_import_preferences_successful', 0)) { |
| 331 | 324 | $_SESSION['boincimport_stage_selected'] = 'preferences'; |
| 332 | - } |
|
| 333 | - else { |
|
| 325 | + } else { |
|
| 334 | 326 | $_SESSION['boincimport_stage_selected'] = 'private messages'; |
| 335 | 327 | } |
| 336 | 328 | break; |
@@ -339,8 +331,7 @@ discard block |
||
| 339 | 331 | boincimport_private_msgs(); |
| 340 | 332 | if (!variable_get('boincimport_import_private_msg_successful', 0)) { |
| 341 | 333 | $_SESSION['boincimport_stage_selected'] = 'private messages'; |
| 342 | - } |
|
| 343 | - else { |
|
| 334 | + } else { |
|
| 344 | 335 | $_SESSION['boincimport_stage_selected'] = 'categories'; |
| 345 | 336 | } |
| 346 | 337 | break; |
@@ -349,8 +340,7 @@ discard block |
||
| 349 | 340 | boincimport_forum_categories(); |
| 350 | 341 | if (!variable_get('boincimport_import_category_successful', 0)) { |
| 351 | 342 | $_SESSION['boincimport_stage_selected'] = 'categories'; |
| 352 | - } |
|
| 353 | - else { |
|
| 343 | + } else { |
|
| 354 | 344 | $_SESSION['boincimport_stage_selected'] = 'topics'; |
| 355 | 345 | } |
| 356 | 346 | break; |
@@ -359,8 +349,7 @@ discard block |
||
| 359 | 349 | boincimport_forum_topics(); |
| 360 | 350 | if (!variable_get('boincimport_import_topic_successful', 0)) { |
| 361 | 351 | $_SESSION['boincimport_stage_selected'] = 'topics'; |
| 362 | - } |
|
| 363 | - else { |
|
| 352 | + } else { |
|
| 364 | 353 | $_SESSION['boincimport_stage_selected'] = 'posts'; |
| 365 | 354 | } |
| 366 | 355 | break; |
@@ -369,8 +358,7 @@ discard block |
||
| 369 | 358 | boincimport_forum_posts(); |
| 370 | 359 | if (!variable_get('boincimport_import_post_successful', 0)) { |
| 371 | 360 | $_SESSION['boincimport_stage_selected'] = 'posts'; |
| 372 | - } |
|
| 373 | - else { |
|
| 361 | + } else { |
|
| 374 | 362 | $_SESSION['boincimport_stage_selected'] = 'url'; |
| 375 | 363 | } |
| 376 | 364 | break; |
@@ -379,8 +367,7 @@ discard block |
||
| 379 | 367 | boincimport_team_forums(); |
| 380 | 368 | if (!variable_get('boincimport_team_forum_successful', 0)) { |
| 381 | 369 | $_SESSION['boincimport_stage_selected'] = 'team forums'; |
| 382 | - } |
|
| 383 | - else { |
|
| 370 | + } else { |
|
| 384 | 371 | $_SESSION['boincimport_stage_selected'] = 'team topics'; |
| 385 | 372 | } |
| 386 | 373 | break; |
@@ -389,8 +376,7 @@ discard block |
||
| 389 | 376 | boincimport_team_forum_topics(); |
| 390 | 377 | if (!variable_get('boincimport_team_topic_successful', 0)) { |
| 391 | 378 | $_SESSION['boincimport_stage_selected'] = 'team topics'; |
| 392 | - } |
|
| 393 | - else { |
|
| 379 | + } else { |
|
| 394 | 380 | $_SESSION['boincimport_stage_selected'] = 'team posts'; |
| 395 | 381 | } |
| 396 | 382 | break; |
@@ -399,8 +385,7 @@ discard block |
||
| 399 | 385 | boincimport_team_forum_posts(); |
| 400 | 386 | if (!variable_get('boincimport_team_post_successful', 0)) { |
| 401 | 387 | $_SESSION['boincimport_stage_selected'] = 'team posts'; |
| 402 | - } |
|
| 403 | - else { |
|
| 388 | + } else { |
|
| 404 | 389 | $_SESSION['boincimport_stage_selected'] = 'url'; |
| 405 | 390 | } |
| 406 | 391 | break; |
@@ -409,8 +394,7 @@ discard block |
||
| 409 | 394 | boincimport_replace_urls(); |
| 410 | 395 | if (!variable_get('boincimport_replace_url_successful', 0)) { |
| 411 | 396 | $_SESSION['boincimport_stage_selected'] = 'url'; |
| 412 | - } |
|
| 413 | - else { |
|
| 397 | + } else { |
|
| 414 | 398 | drupal_set_message('Congratulations. Import Finished'); |
| 415 | 399 | drupal_set_message('Please visit the '. l('Post migration configuration', 'admin/boinc/import/post_configuration') .' page'); |
| 416 | 400 | watchdog('boincimport', 'Import process is complete', array(), WATCHDOG_INFO); |
@@ -479,8 +463,7 @@ discard block |
||
| 479 | 463 | ORDER BY id ASC' |
| 480 | 464 | ); |
| 481 | 465 | $user_count = mysqli_num_rows($boinc_accounts); |
| 482 | - } |
|
| 483 | - else { |
|
| 466 | + } else { |
|
| 484 | 467 | // Need to import any user who is currently ignored in order to keep them |
| 485 | 468 | // ignored... not particularly clean (ignored users are stored in a string) |
| 486 | 469 | $ignored_user_list = array(0); |
@@ -556,8 +539,7 @@ discard block |
||
| 556 | 539 | if (isset($existing_users[$boinc_account->id])) { |
| 557 | 540 | // This user has already been imported |
| 558 | 541 | $duplicates[] = $boinc_account->id; |
| 559 | - } |
|
| 560 | - else { |
|
| 542 | + } else { |
|
| 561 | 543 | $operations[] = array( |
| 562 | 544 | 'boincimport_users_op', array( |
| 563 | 545 | $boinc_account->id |
@@ -613,8 +595,7 @@ discard block |
||
| 613 | 595 | // Store some result for post-processing in the finished callback. |
| 614 | 596 | $context['results']['success'][] = $boinc_id; |
| 615 | 597 | $message = "Successfully imported user {$boinc_id}"; |
| 616 | - } |
|
| 617 | - else { |
|
| 598 | + } else { |
|
| 618 | 599 | $context['results']['failure'][] = $boinc_id; |
| 619 | 600 | $message = "Failed to import user {$boinc_id}!"; |
| 620 | 601 | watchdog('boincimport', |
@@ -631,8 +612,7 @@ discard block |
||
| 631 | 612 | // Update the progress for the batch engine |
| 632 | 613 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
| 633 | 614 | $context['finished'] = 1; |
| 634 | - } |
|
| 635 | - else { |
|
| 615 | + } else { |
|
| 636 | 616 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
| 637 | 617 | } |
| 638 | 618 | } |
@@ -657,8 +637,7 @@ discard block |
||
| 657 | 637 | // Set the user import successful flag in the variable table |
| 658 | 638 | variable_set('boincimport_import_user_successful', '1'); |
| 659 | 639 | $_SESSION['boincimport_stage_selected'] = 'teams'; |
| 660 | - } |
|
| 661 | - else { |
|
| 640 | + } else { |
|
| 662 | 641 | // An error occurred. |
| 663 | 642 | // $operations contains the operations that remained unprocessed. |
| 664 | 643 | $error_operation = reset($operations); |
@@ -720,8 +699,7 @@ discard block |
||
| 720 | 699 | $team_type = array( |
| 721 | 700 | 'tid' => $team_type_id |
| 722 | 701 | ); |
| 723 | - } |
|
| 724 | - else { |
|
| 702 | + } else { |
|
| 725 | 703 | if (!$name) continue; |
| 726 | 704 | $team_type = array( |
| 727 | 705 | 'name' => strip_tags($name), |
@@ -784,8 +762,7 @@ discard block |
||
| 784 | 762 | if (isset($existing_teams[$boinc_team->id])) { |
| 785 | 763 | // This team has already been imported |
| 786 | 764 | $duplicates[] = $boinc_team->id; |
| 787 | - } |
|
| 788 | - else { |
|
| 765 | + } else { |
|
| 789 | 766 | $operations[] = array( |
| 790 | 767 | 'boincimport_teams_op', array( |
| 791 | 768 | $boinc_team |
@@ -826,8 +803,7 @@ discard block |
||
| 826 | 803 | // Store some result for post-processing in the finished callback. |
| 827 | 804 | $context['results']['success'][] = $boincteam->id; |
| 828 | 805 | $message = "Successfully imported team {$boincteam->id}"; |
| 829 | - } |
|
| 830 | - else { |
|
| 806 | + } else { |
|
| 831 | 807 | $context['results']['failure'][] = $boincteam->id; |
| 832 | 808 | $message = "Failed to import team {$boincteam->id}!"; |
| 833 | 809 | watchdog('boincimport', |
@@ -844,8 +820,7 @@ discard block |
||
| 844 | 820 | // Update the progress for the batch engine |
| 845 | 821 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
| 846 | 822 | $context['finished'] = 1; |
| 847 | - } |
|
| 848 | - else { |
|
| 823 | + } else { |
|
| 849 | 824 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
| 850 | 825 | } |
| 851 | 826 | } |
@@ -868,8 +843,7 @@ discard block |
||
| 868 | 843 | // Set the team import successful flag in the variable table |
| 869 | 844 | variable_set('boincimport_import_team_successful', '1'); |
| 870 | 845 | $_SESSION['boincimport_stage_selected'] = 'friends'; |
| 871 | - } |
|
| 872 | - else { |
|
| 846 | + } else { |
|
| 873 | 847 | // An error occurred. |
| 874 | 848 | // $operations contains the operations that remained unprocessed. |
| 875 | 849 | $error_operation = reset($operations); |
@@ -990,8 +964,7 @@ discard block |
||
| 990 | 964 | SET uid = '%d', friend_uid = '%d', created = '%d'", |
| 991 | 965 | $uid, $friend_uid, $friendship->create_time |
| 992 | 966 | ); |
| 993 | - } |
|
| 994 | - else { |
|
| 967 | + } else { |
|
| 995 | 968 | $boinc_id = ($uid) ? $friendship->user_dest : $friendship->user_src; |
| 996 | 969 | $message = "No Drupal account exists for BOINC user {$boinc_id}!"; |
| 997 | 970 | } |
@@ -1000,8 +973,7 @@ discard block |
||
| 1000 | 973 | // Store some result for post-processing in the finished callback. |
| 1001 | 974 | $context['results']['success'][] = $uid; |
| 1002 | 975 | $message = "Successfully made users {$uid} and {$friend_uid} friends"; |
| 1003 | - } |
|
| 1004 | - else { |
|
| 976 | + } else { |
|
| 1005 | 977 | $context['results']['failure'][] = $uid; |
| 1006 | 978 | if (!$message) { |
| 1007 | 979 | $message = "Failed to make users {$uid} and {$friend_uid} friends!"; |
@@ -1017,8 +989,7 @@ discard block |
||
| 1017 | 989 | // Update the progress for the batch engine |
| 1018 | 990 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
| 1019 | 991 | $context['finished'] = 1; |
| 1020 | - } |
|
| 1021 | - else { |
|
| 992 | + } else { |
|
| 1022 | 993 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
| 1023 | 994 | } |
| 1024 | 995 | } |
@@ -1042,8 +1013,7 @@ discard block |
||
| 1042 | 1013 | // Set the friend import successful flag in the variable table |
| 1043 | 1014 | variable_set('boincimport_import_friend_successful', '1'); |
| 1044 | 1015 | $_SESSION['boincimport_stage_selected'] = 'preferences'; |
| 1045 | - } |
|
| 1046 | - else { |
|
| 1016 | + } else { |
|
| 1047 | 1017 | // An error occurred. |
| 1048 | 1018 | // $operations contains the operations that remained unprocessed. |
| 1049 | 1019 | $error_operation = reset($operations); |
@@ -1167,8 +1137,7 @@ discard block |
||
| 1167 | 1137 | ); |
| 1168 | 1138 | if ($user_ignored) { |
| 1169 | 1139 | $success = TRUE; |
| 1170 | - } |
|
| 1171 | - else { |
|
| 1140 | + } else { |
|
| 1172 | 1141 | $context['results']['warning'][] = "{$uid}:{$ignored_user_uid}"; |
| 1173 | 1142 | watchdog('boincimport', |
| 1174 | 1143 | 'Could not add user @ignored_uid to the ignore list of user @uid', |
@@ -1183,8 +1152,7 @@ discard block |
||
| 1183 | 1152 | // Store some result for post-processing in the finished callback. |
| 1184 | 1153 | $context['results']['success'][] = $uid; |
| 1185 | 1154 | $message = "Successfully imported ignored users for user {$uid}"; |
| 1186 | - } |
|
| 1187 | - else { |
|
| 1155 | + } else { |
|
| 1188 | 1156 | $context['results']['failure'][] = $uid; |
| 1189 | 1157 | $message = "Failed to import any user filter preferences for user {$uid}!"; |
| 1190 | 1158 | watchdog('boincimport', |
@@ -1201,8 +1169,7 @@ discard block |
||
| 1201 | 1169 | // Update the progress for the batch engine |
| 1202 | 1170 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
| 1203 | 1171 | $context['finished'] = 1; |
| 1204 | - } |
|
| 1205 | - else { |
|
| 1172 | + } else { |
|
| 1206 | 1173 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
| 1207 | 1174 | } |
| 1208 | 1175 | } |
@@ -1227,8 +1194,7 @@ discard block |
||
| 1227 | 1194 | // Set the preference import successful flag in the variable table |
| 1228 | 1195 | variable_set('boincimport_import_preferences_successful', '1'); |
| 1229 | 1196 | $_SESSION['boincimport_stage_selected'] = 'private messages'; |
| 1230 | - } |
|
| 1231 | - else { |
|
| 1197 | + } else { |
|
| 1232 | 1198 | // An error occurred. |
| 1233 | 1199 | // $operations contains the operations that remained unprocessed. |
| 1234 | 1200 | $error_operation = reset($operations); |
@@ -1362,8 +1328,7 @@ discard block |
||
| 1362 | 1328 | // Store some result for post-processing in the finished callback. |
| 1363 | 1329 | $context['results']['success'][] = $pm->id; |
| 1364 | 1330 | $message = "Successfully imported private message {$pm->id}"; |
| 1365 | - } |
|
| 1366 | - else { |
|
| 1331 | + } else { |
|
| 1367 | 1332 | $context['results']['failure'][] = $pm->id; |
| 1368 | 1333 | $message = "Failed to import private message {$pm->id}!"; |
| 1369 | 1334 | watchdog('boincimport', |
@@ -1380,8 +1345,7 @@ discard block |
||
| 1380 | 1345 | // Update the progress for the batch engine |
| 1381 | 1346 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
| 1382 | 1347 | $context['finished'] = 1; |
| 1383 | - } |
|
| 1384 | - else { |
|
| 1348 | + } else { |
|
| 1385 | 1349 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
| 1386 | 1350 | } |
| 1387 | 1351 | } |
@@ -1404,8 +1368,7 @@ discard block |
||
| 1404 | 1368 | // Set the private message import successful flag in the variable table |
| 1405 | 1369 | variable_set('boincimport_import_private_msg_successful', '1'); |
| 1406 | 1370 | $_SESSION['boincimport_stage_selected'] = 'categories'; |
| 1407 | - } |
|
| 1408 | - else { |
|
| 1371 | + } else { |
|
| 1409 | 1372 | // An error occurred. |
| 1410 | 1373 | // $operations contains the operations that remained unprocessed. |
| 1411 | 1374 | $error_operation = reset($operations); |
@@ -1558,8 +1521,7 @@ discard block |
||
| 1558 | 1521 | if (in_array($boinc_forum_category->name, $existing_categories)) { |
| 1559 | 1522 | // This category has already been imported |
| 1560 | 1523 | $duplicate_categories[] = $boinc_forum_category->name; |
| 1561 | - } |
|
| 1562 | - else { |
|
| 1524 | + } else { |
|
| 1563 | 1525 | $operations[] = array( |
| 1564 | 1526 | 'boincimport_forum_categories_op', array( |
| 1565 | 1527 | $boinc_forum_category, $forum_vid, $pre, FALSE |
@@ -1573,8 +1535,7 @@ discard block |
||
| 1573 | 1535 | if (isset($existing_forums[$boinc_forum->id])) { |
| 1574 | 1536 | // This forum has already been imported |
| 1575 | 1537 | $duplicates[] = $boinc_forum->id; |
| 1576 | - } |
|
| 1577 | - else { |
|
| 1538 | + } else { |
|
| 1578 | 1539 | $operations[] = array( |
| 1579 | 1540 | 'boincimport_forums_op', array( |
| 1580 | 1541 | $boinc_forum, $forum_vid, $pre |
@@ -1641,8 +1602,7 @@ discard block |
||
| 1641 | 1602 | $category->name = 'Hidden'; |
| 1642 | 1603 | $category->id = 0; |
| 1643 | 1604 | $hidden = TRUE; |
| 1644 | - } |
|
| 1645 | - else { |
|
| 1605 | + } else { |
|
| 1646 | 1606 | // If this container is empty, put it into the hidden container |
| 1647 | 1607 | db_set_active('boinc_rw'); |
| 1648 | 1608 | $forums_contained = db_result(db_query(' |
@@ -1685,13 +1645,11 @@ discard block |
||
| 1685 | 1645 | // Store some result for post-processing in the finished callback. |
| 1686 | 1646 | if (!$category AND $create_hidden) { |
| 1687 | 1647 | $message = "Created special hidden container"; |
| 1688 | - } |
|
| 1689 | - else { |
|
| 1648 | + } else { |
|
| 1690 | 1649 | $context['results']['categories']['success'][] = $category->id; |
| 1691 | 1650 | $message = "Successfully imported container {$category->id}"; |
| 1692 | 1651 | } |
| 1693 | - } |
|
| 1694 | - else { |
|
| 1652 | + } else { |
|
| 1695 | 1653 | $context['results']['categories']['failure'][] = $category->id; |
| 1696 | 1654 | $message = "Failed to import container {$category->id}!"; |
| 1697 | 1655 | watchdog('boincimport', |
@@ -1708,8 +1666,7 @@ discard block |
||
| 1708 | 1666 | // Update the progress for the batch engine |
| 1709 | 1667 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
| 1710 | 1668 | $context['finished'] = 1; |
| 1711 | - } |
|
| 1712 | - else { |
|
| 1669 | + } else { |
|
| 1713 | 1670 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
| 1714 | 1671 | } |
| 1715 | 1672 | } |
@@ -1745,8 +1702,7 @@ discard block |
||
| 1745 | 1702 | // Save the ID of the News forum for later import |
| 1746 | 1703 | variable_set('boincimport_news_forum_id', $forum_id); |
| 1747 | 1704 | $success = TRUE; |
| 1748 | - } |
|
| 1749 | - else { |
|
| 1705 | + } else { |
|
| 1750 | 1706 | // Save all other forums as taxonomy terms |
| 1751 | 1707 | $forum = array( |
| 1752 | 1708 | 'name' => $name, |
@@ -1772,8 +1728,7 @@ discard block |
||
| 1772 | 1728 | // Store some result for post-processing in the finished callback. |
| 1773 | 1729 | $context['results']['forums']['success'][] = $forum_id; |
| 1774 | 1730 | $message = "Successfully imported forum {$forum_id}"; |
| 1775 | - } |
|
| 1776 | - else { |
|
| 1731 | + } else { |
|
| 1777 | 1732 | $context['results']['forums']['failure'][] = $forum_id; |
| 1778 | 1733 | $message = "Failed to import forum {$forum_id}!"; |
| 1779 | 1734 | } |
@@ -1786,8 +1741,7 @@ discard block |
||
| 1786 | 1741 | // Update the progress for the batch engine |
| 1787 | 1742 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
| 1788 | 1743 | $context['finished'] = 1; |
| 1789 | - } |
|
| 1790 | - else { |
|
| 1744 | + } else { |
|
| 1791 | 1745 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
| 1792 | 1746 | } |
| 1793 | 1747 | } |
@@ -1888,8 +1842,7 @@ discard block |
||
| 1888 | 1842 | // Set the forum import successful flag in the variable table |
| 1889 | 1843 | variable_set('boincimport_import_forum_successful', '1'); |
| 1890 | 1844 | $_SESSION['boincimport_stage_selected'] = 'topics'; |
| 1891 | - } |
|
| 1892 | - else { |
|
| 1845 | + } else { |
|
| 1893 | 1846 | // An error occurred. |
| 1894 | 1847 | // $operations contains the operations that remained unprocessed. |
| 1895 | 1848 | $error_operation = reset($operations); |
@@ -2043,9 +1996,7 @@ discard block |
||
| 2043 | 1996 | |
| 2044 | 1997 | if ($duplicate OR !$post) { |
| 2045 | 1998 | $success = FALSE; |
| 2046 | - } |
|
| 2047 | - |
|
| 2048 | - else { |
|
| 1999 | + } else { |
|
| 2049 | 2000 | // Get the user and term IDs along with other data to define the topic |
| 2050 | 2001 | $uid = boincuser_lookup_uid($topic->owner); |
| 2051 | 2002 | $tid = db_result(db_query(' |
@@ -2109,12 +2060,10 @@ discard block |
||
| 2109 | 2060 | if (!$success) { |
| 2110 | 2061 | $error_detail = 'topic imported, but failed to set last comment timestamp'; |
| 2111 | 2062 | } |
| 2112 | - } |
|
| 2113 | - else { |
|
| 2063 | + } else { |
|
| 2114 | 2064 | $error_detail = 'topic node saved, but failed to link in boincimport_temp_topic table'; |
| 2115 | 2065 | } |
| 2116 | - } |
|
| 2117 | - else { |
|
| 2066 | + } else { |
|
| 2118 | 2067 | $error_detail = 'failed to save topic node to database'; |
| 2119 | 2068 | } |
| 2120 | 2069 | } |
@@ -2125,16 +2074,13 @@ discard block |
||
| 2125 | 2074 | // Store some result for post-processing in the finished callback. |
| 2126 | 2075 | $context['results']['success'][] = $topic->id; |
| 2127 | 2076 | $message = "Successfully imported topic {$topic->id}"; |
| 2128 | - } |
|
| 2129 | - elseif ($duplicate) { |
|
| 2077 | + } elseif ($duplicate) { |
|
| 2130 | 2078 | $context['results']['duplicate'][] = $topic->id; |
| 2131 | 2079 | $message = "Topic {$topic->id} was already imported"; |
| 2132 | - } |
|
| 2133 | - elseif (!$post) { |
|
| 2080 | + } elseif (!$post) { |
|
| 2134 | 2081 | $context['results']['empty'][] = $topic->id; |
| 2135 | 2082 | $message = "Skipping topic {$topic->id} as empty"; |
| 2136 | - } |
|
| 2137 | - else { |
|
| 2083 | + } else { |
|
| 2138 | 2084 | $context['results']['failure'][] = $topic->id; |
| 2139 | 2085 | $message = "Failed to import topic {$topic->id}!"; |
| 2140 | 2086 | watchdog('boincimport', |
@@ -2155,8 +2101,7 @@ discard block |
||
| 2155 | 2101 | // Update the progress for the batch engine |
| 2156 | 2102 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
| 2157 | 2103 | $context['finished'] = 1; |
| 2158 | - } |
|
| 2159 | - else { |
|
| 2104 | + } else { |
|
| 2160 | 2105 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
| 2161 | 2106 | } |
| 2162 | 2107 | } |
@@ -2190,8 +2135,7 @@ discard block |
||
| 2190 | 2135 | // Set the topic import successful flag in the variable table |
| 2191 | 2136 | variable_set('boincimport_import_topic_successful', '1'); |
| 2192 | 2137 | $_SESSION['boincimport_stage_selected'] = 'posts'; |
| 2193 | - } |
|
| 2194 | - else { |
|
| 2138 | + } else { |
|
| 2195 | 2139 | // An error occurred. |
| 2196 | 2140 | // $operations contains the operations that remained unprocessed. |
| 2197 | 2141 | $error_operation = reset($operations); |
@@ -2439,18 +2383,15 @@ discard block |
||
| 2439 | 2383 | if ($success) { |
| 2440 | 2384 | $posts_imported++; |
| 2441 | 2385 | $context['results']['posts']['success'][] = $post->id; |
| 2442 | - } |
|
| 2443 | - else { |
|
| 2386 | + } else { |
|
| 2444 | 2387 | $context['results']['posts']['failure'][] = $post->id; |
| 2445 | 2388 | $error_posts++; |
| 2446 | 2389 | } |
| 2447 | - } |
|
| 2448 | - else { |
|
| 2390 | + } else { |
|
| 2449 | 2391 | $context['results']['posts']['failure'][] = $post->id; |
| 2450 | 2392 | $error_posts++; |
| 2451 | 2393 | } |
| 2452 | - } |
|
| 2453 | - else { |
|
| 2394 | + } else { |
|
| 2454 | 2395 | $context['results']['posts']['empty'][] = $post->id; |
| 2455 | 2396 | $empty_posts++; |
| 2456 | 2397 | } |
@@ -2461,8 +2402,7 @@ discard block |
||
| 2461 | 2402 | // Store some result for post-processing in the finished callback. |
| 2462 | 2403 | $context['results']['success'][] = $boinc_topic->id; |
| 2463 | 2404 | $message = "Imported {$posts_imported} post(s) for topic {$boinc_topic->id}"; |
| 2464 | - } |
|
| 2465 | - else { |
|
| 2405 | + } else { |
|
| 2466 | 2406 | $context['results']['failure'][] = $boinc_topic->id; |
| 2467 | 2407 | $message = "Failed to import any posts for topic {$boinc_topic->id} (excluded {$error_posts} errors, {$duplicate_posts} duplicates, and {$empty_posts} empty)"; |
| 2468 | 2408 | watchdog('boincimport', 'Failed to import any posts for topic @id (excluded @error_posts errors, @duplicate_posts duplicates, and @empty_posts empty)', |
@@ -2483,8 +2423,7 @@ discard block |
||
| 2483 | 2423 | // Update the progress for the batch engine |
| 2484 | 2424 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
| 2485 | 2425 | $context['finished'] = 1; |
| 2486 | - } |
|
| 2487 | - else { |
|
| 2426 | + } else { |
|
| 2488 | 2427 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
| 2489 | 2428 | } |
| 2490 | 2429 | } |
@@ -2524,8 +2463,7 @@ discard block |
||
| 2524 | 2463 | // Set the post import successful flag in the variable table |
| 2525 | 2464 | variable_set('boincimport_import_post_successful', '1'); |
| 2526 | 2465 | $_SESSION['boincimport_stage_selected'] = 'team forums'; |
| 2527 | - } |
|
| 2528 | - else { |
|
| 2466 | + } else { |
|
| 2529 | 2467 | // An error occurred. |
| 2530 | 2468 | // $operations contains the operations that remained unprocessed. |
| 2531 | 2469 | $error_operation = reset($operations); |
@@ -2612,8 +2550,7 @@ discard block |
||
| 2612 | 2550 | if (isset($existing_team_forums[$boincteam_forum->id])) { |
| 2613 | 2551 | // This team has already been imported |
| 2614 | 2552 | $duplicates[] = $boincteam_forum->id; |
| 2615 | - } |
|
| 2616 | - else { |
|
| 2553 | + } else { |
|
| 2617 | 2554 | $operations[] = array( |
| 2618 | 2555 | 'boincimport_team_forums_op', array( |
| 2619 | 2556 | $boincteam_forum |
@@ -2679,8 +2616,7 @@ discard block |
||
| 2679 | 2616 | // Store some result for post-processing in the finished callback. |
| 2680 | 2617 | $context['results']['success'][] = $forum_id; |
| 2681 | 2618 | $message = "Successfully imported team forum {$forum_id}"; |
| 2682 | - } |
|
| 2683 | - else { |
|
| 2619 | + } else { |
|
| 2684 | 2620 | $context['results']['failure'][] = $forum_id; |
| 2685 | 2621 | $message = "Failed to import team forum {$forum_id}!"; |
| 2686 | 2622 | watchdog('boincimport', |
@@ -2697,8 +2633,7 @@ discard block |
||
| 2697 | 2633 | // Update the progress for the batch engine |
| 2698 | 2634 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
| 2699 | 2635 | $context['finished'] = 1; |
| 2700 | - } |
|
| 2701 | - else { |
|
| 2636 | + } else { |
|
| 2702 | 2637 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
| 2703 | 2638 | } |
| 2704 | 2639 | } |
@@ -2721,8 +2656,7 @@ discard block |
||
| 2721 | 2656 | // Set the team forum import successful flag in the variable table |
| 2722 | 2657 | variable_set('boincimport_import_team_forum_successful', '1'); |
| 2723 | 2658 | $_SESSION['boincimport_stage_selected'] = 'team topics'; |
| 2724 | - } |
|
| 2725 | - else { |
|
| 2659 | + } else { |
|
| 2726 | 2660 | // An error occurred. |
| 2727 | 2661 | // $operations contains the operations that remained unprocessed. |
| 2728 | 2662 | $error_operation = reset($operations); |
@@ -2817,8 +2751,7 @@ discard block |
||
| 2817 | 2751 | if (isset($existing_team_topics[$boincteam_topic->id])) { |
| 2818 | 2752 | // This team topic has already been imported |
| 2819 | 2753 | $duplicates[] = $boincteam_topic->id; |
| 2820 | - } |
|
| 2821 | - else { |
|
| 2754 | + } else { |
|
| 2822 | 2755 | $operations[] = array( |
| 2823 | 2756 | 'boincimport_team_topics_op', array( |
| 2824 | 2757 | $boincteam_topic |
@@ -2865,8 +2798,7 @@ discard block |
||
| 2865 | 2798 | )); |
| 2866 | 2799 | if (!$team_forum_id) { |
| 2867 | 2800 | $missing_parent[] = $topic->id; |
| 2868 | - } |
|
| 2869 | - else { |
|
| 2801 | + } else { |
|
| 2870 | 2802 | // Get the content of the post that started the topic |
| 2871 | 2803 | db_set_active('boinc_rw'); |
| 2872 | 2804 | $query = db_query(' |
@@ -2883,8 +2815,7 @@ discard block |
||
| 2883 | 2815 | // Empty topics should have already been filtered out of the import, so |
| 2884 | 2816 | // consider this an error condition |
| 2885 | 2817 | $empty_topics[] = $topic->id; |
| 2886 | - } |
|
| 2887 | - else { |
|
| 2818 | + } else { |
|
| 2888 | 2819 | // Get the user ID along with other data to define the topic |
| 2889 | 2820 | $uid = boincuser_lookup_uid($topic->owner); |
| 2890 | 2821 | if (!$topic->owner) { |
@@ -2948,8 +2879,7 @@ discard block |
||
| 2948 | 2879 | // Store some result for post-processing in the finished callback. |
| 2949 | 2880 | $context['results']['success'][] = $topic->id; |
| 2950 | 2881 | $message = "Successfully imported team topic {$topic->id}"; |
| 2951 | - } |
|
| 2952 | - else { |
|
| 2882 | + } else { |
|
| 2953 | 2883 | $context['results']['failure'][] = $topic->id; |
| 2954 | 2884 | $message = "Failed to import team topic {$topic->id}!"; |
| 2955 | 2885 | watchdog('boincimport', |
@@ -2966,8 +2896,7 @@ discard block |
||
| 2966 | 2896 | // Update the progress for the batch engine |
| 2967 | 2897 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
| 2968 | 2898 | $context['finished'] = 1; |
| 2969 | - } |
|
| 2970 | - else { |
|
| 2899 | + } else { |
|
| 2971 | 2900 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
| 2972 | 2901 | } |
| 2973 | 2902 | } |
@@ -2990,8 +2919,7 @@ discard block |
||
| 2990 | 2919 | // Set the BLAH import successful flag in the variable table |
| 2991 | 2920 | variable_set('boincimport_import_team_topic_successful', '1'); |
| 2992 | 2921 | $_SESSION['boincimport_stage_selected'] = 'team posts'; |
| 2993 | - } |
|
| 2994 | - else { |
|
| 2922 | + } else { |
|
| 2995 | 2923 | // An error occurred. |
| 2996 | 2924 | // $operations contains the operations that remained unprocessed. |
| 2997 | 2925 | $error_operation = reset($operations); |
@@ -3113,8 +3041,7 @@ discard block |
||
| 3113 | 3041 | if (isset($existing_posts[$boincteam_post->id])) { |
| 3114 | 3042 | // This post has already been imported |
| 3115 | 3043 | $duplicates[] = $boincteam_post->id; |
| 3116 | - } |
|
| 3117 | - else { |
|
| 3044 | + } else { |
|
| 3118 | 3045 | $operations[] = array( |
| 3119 | 3046 | 'boincimport_team_posts_op', array( |
| 3120 | 3047 | $boincteam_post |
@@ -3230,8 +3157,7 @@ discard block |
||
| 3230 | 3157 | // Store some result for post-processing in the finished callback. |
| 3231 | 3158 | $context['results']['success'][] = $post->id; |
| 3232 | 3159 | $message = "Successfully imported team post {$post->id}"; |
| 3233 | - } |
|
| 3234 | - else { |
|
| 3160 | + } else { |
|
| 3235 | 3161 | $context['results']['failure'][] = $post->id; |
| 3236 | 3162 | $message = "Failed to import team post {$post->id}!"; |
| 3237 | 3163 | watchdog('boincimport', |
@@ -3248,8 +3174,7 @@ discard block |
||
| 3248 | 3174 | // Update the progress for the batch engine |
| 3249 | 3175 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
| 3250 | 3176 | $context['finished'] = 1; |
| 3251 | - } |
|
| 3252 | - else { |
|
| 3177 | + } else { |
|
| 3253 | 3178 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
| 3254 | 3179 | } |
| 3255 | 3180 | } |
@@ -3272,8 +3197,7 @@ discard block |
||
| 3272 | 3197 | // Set the team post import successful flag in the variable table |
| 3273 | 3198 | variable_set('boincimport_import_team_post_successful', '1'); |
| 3274 | 3199 | $_SESSION['boincimport_stage_selected'] = 'url'; |
| 3275 | - } |
|
| 3276 | - else { |
|
| 3200 | + } else { |
|
| 3277 | 3201 | // An error occurred. |
| 3278 | 3202 | // $operations contains the operations that remained unprocessed. |
| 3279 | 3203 | $error_operation = reset($operations); |
@@ -3379,8 +3303,7 @@ discard block |
||
| 3379 | 3303 | $context['results']['success'][] = $boincuser_id; |
| 3380 | 3304 | $context['results']['subscriptions'][$boincuser_id] = $count; |
| 3381 | 3305 | $message = "Successfully imported {$count} subscriptions for user {$boincuser_id}"; |
| 3382 | - } |
|
| 3383 | - else { |
|
| 3306 | + } else { |
|
| 3384 | 3307 | $context['results']['failure'][] = $boincuser_id; |
| 3385 | 3308 | $message = "Failed to import subscriptions for user {$boincuser_id}!"; |
| 3386 | 3309 | watchdog('boincimport', |
@@ -3397,8 +3320,7 @@ discard block |
||
| 3397 | 3320 | // Update the progress for the batch engine |
| 3398 | 3321 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
| 3399 | 3322 | $context['finished'] = 1; |
| 3400 | - } |
|
| 3401 | - else { |
|
| 3323 | + } else { |
|
| 3402 | 3324 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
| 3403 | 3325 | } |
| 3404 | 3326 | } |
@@ -3423,8 +3345,7 @@ discard block |
||
| 3423 | 3345 | // Set the subscription import successful flag in the variable table |
| 3424 | 3346 | variable_set('boincimport_import_subscription_successful', '1'); |
| 3425 | 3347 | $_SESSION['boincimport_stage_selected'] = 'url'; |
| 3426 | - } |
|
| 3427 | - else { |
|
| 3348 | + } else { |
|
| 3428 | 3349 | // An error occurred. |
| 3429 | 3350 | // $operations contains the operations that remained unprocessed. |
| 3430 | 3351 | $error_operation = reset($operations); |
@@ -3602,8 +3523,7 @@ discard block |
||
| 3602 | 3523 | // Store some result for post-processing in the finished callback. |
| 3603 | 3524 | $context['results']['nodes']['updated'][] = $node->nid; |
| 3604 | 3525 | $message = "Successfully updated node {$node->nid}"; |
| 3605 | - } |
|
| 3606 | - else { |
|
| 3526 | + } else { |
|
| 3607 | 3527 | $message = "No changes made to node {$node->nid}!"; |
| 3608 | 3528 | } |
| 3609 | 3529 | |
@@ -3615,8 +3535,7 @@ discard block |
||
| 3615 | 3535 | // Update the progress for the batch engine |
| 3616 | 3536 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
| 3617 | 3537 | $context['finished'] = 1; |
| 3618 | - } |
|
| 3619 | - else { |
|
| 3538 | + } else { |
|
| 3620 | 3539 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
| 3621 | 3540 | } |
| 3622 | 3541 | } |
@@ -3666,8 +3585,7 @@ discard block |
||
| 3666 | 3585 | // Store some result for post-processing in the finished callback. |
| 3667 | 3586 | $context['results']['comments']['updated'][] = $comment->cid; |
| 3668 | 3587 | $message = "Successfully updated comment {$comment->cid}"; |
| 3669 | - } |
|
| 3670 | - else { |
|
| 3588 | + } else { |
|
| 3671 | 3589 | $message = "No changes made to comment {$comment->cid}!"; |
| 3672 | 3590 | } |
| 3673 | 3591 | |
@@ -3679,8 +3597,7 @@ discard block |
||
| 3679 | 3597 | // Update the progress for the batch engine |
| 3680 | 3598 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
| 3681 | 3599 | $context['finished'] = 1; |
| 3682 | - } |
|
| 3683 | - else { |
|
| 3600 | + } else { |
|
| 3684 | 3601 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
| 3685 | 3602 | } |
| 3686 | 3603 | } |
@@ -3729,8 +3646,7 @@ discard block |
||
| 3729 | 3646 | // Store some result for post-processing in the finished callback. |
| 3730 | 3647 | $context['results']['pm']['updated'][] = $pm->mid; |
| 3731 | 3648 | $message = "Successfully updated private message {$pm->mid}"; |
| 3732 | - } |
|
| 3733 | - else { |
|
| 3649 | + } else { |
|
| 3734 | 3650 | $message = "No changes made to private message {$pm->mid}!"; |
| 3735 | 3651 | } |
| 3736 | 3652 | |
@@ -3742,8 +3658,7 @@ discard block |
||
| 3742 | 3658 | // Update the progress for the batch engine |
| 3743 | 3659 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
| 3744 | 3660 | $context['finished'] = 1; |
| 3745 | - } |
|
| 3746 | - else { |
|
| 3661 | + } else { |
|
| 3747 | 3662 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
| 3748 | 3663 | } |
| 3749 | 3664 | } |
@@ -3808,8 +3723,7 @@ discard block |
||
| 3808 | 3723 | // Set the replace URLs successful flag in the variable table |
| 3809 | 3724 | variable_set('boincimport_replace_urls_successful', '1'); |
| 3810 | 3725 | $_SESSION['boincimport_stage_selected'] = 'users'; |
| 3811 | - } |
|
| 3812 | - else { |
|
| 3726 | + } else { |
|
| 3813 | 3727 | // An error occurred. |
| 3814 | 3728 | // $operations contains the operations that remained unprocessed. |
| 3815 | 3729 | $error_operation = reset($operations); |
@@ -3911,7 +3825,8 @@ discard block |
||
| 3911 | 3825 | $score = 0; // 0 default value, comments get higher score depending on the author's roles |
| 3912 | 3826 | $users = serialize(array(0 => 1)); // default value for everybody!! |
| 3913 | 3827 | |
| 3914 | - if ($edit['uid'] === $user->uid) { // '===' because we want to modify anonymous users too |
|
| 3828 | + if ($edit['uid'] === $user->uid) { |
|
| 3829 | +// '===' because we want to modify anonymous users too |
|
| 3915 | 3830 | $edit['name'] = $user->name; |
| 3916 | 3831 | } |
| 3917 | 3832 | |
@@ -4034,13 +3949,11 @@ discard block |
||
| 4034 | 3949 | if (isset($this->boincDomains[$domain])) { |
| 4035 | 3950 | // This is a URL configured to be transformed |
| 4036 | 3951 | return "{$http}://{$this->drupalDomain}{$this->basePath}"; |
| 4037 | - } |
|
| 4038 | - else { |
|
| 3952 | + } else { |
|
| 4039 | 3953 | // This URL should not be transformed |
| 4040 | 3954 | return NULL; |
| 4041 | 3955 | } |
| 4042 | - } |
|
| 4043 | - else { |
|
| 3956 | + } else { |
|
| 4044 | 3957 | // This is a relative URL |
| 4045 | 3958 | return $this->basePath; |
| 4046 | 3959 | } |
@@ -4062,8 +3975,7 @@ discard block |
||
| 4062 | 3975 | )); |
| 4063 | 3976 | if ($id) { |
| 4064 | 3977 | $link = "{$newBaseUrl}goto/comment/{$id}"; |
| 4065 | - } |
|
| 4066 | - else { |
|
| 3978 | + } else { |
|
| 4067 | 3979 | // This post is not in the post import table, so it's probably a topic |
| 4068 | 3980 | $link = $this->transformTopicLinks($matches); |
| 4069 | 3981 | } |
@@ -4087,8 +3999,7 @@ discard block |
||
| 4087 | 3999 | )); |
| 4088 | 4000 | if ($id) { |
| 4089 | 4001 | $link = "{$newBaseUrl}goto/comment/{$id}"; |
| 4090 | - } |
|
| 4091 | - else { |
|
| 4002 | + } else { |
|
| 4092 | 4003 | // This post is not in the post import table, so it's probably a topic |
| 4093 | 4004 | $link = $this->transformTopicLinks($matches); |
| 4094 | 4005 | } |
@@ -280,8 +280,7 @@ discard block |
||
| 280 | 280 | 'href' => 'account/prefs/privacy/ignore_user/remove/'. $author->uid, |
| 281 | 281 | 'query' => 'destination=messages/view/' . $thread_id, |
| 282 | 282 | ); |
| 283 | - } |
|
| 284 | - else { |
|
| 283 | + } else { |
|
| 285 | 284 | $vars['message_actions']['ignore_user'] = array( |
| 286 | 285 | 'title' => bts('Ignore User', array(), NULL, 'boinc:ignore-user-add'), |
| 287 | 286 | 'href' => 'account/prefs/privacy/ignore_user/add/'. $author->uid, |
@@ -400,8 +399,7 @@ discard block |
||
| 400 | 399 | } |
| 401 | 400 | if (!$special) { |
| 402 | 401 | $output .= "<td>{$value} {$pref_setting['#field_suffix']}</td>"; |
| 403 | - } |
|
| 404 | - else { |
|
| 402 | + } else { |
|
| 405 | 403 | // The "very special" case where we merge two prefs |
| 406 | 404 | $second_pref = $special_map[$name]; |
| 407 | 405 | $second_pref_setting = $prefs[$pref_set]['prefs']['advanced'][$category][$second_pref]; |
@@ -409,8 +407,7 @@ discard block |
||
| 409 | 407 | $output .= "<td>{$value} {$pref_setting['#field_suffix']} {$special_delimiter[$name]}" . |
| 410 | 408 | " {$second_value} {$second_pref_setting['#field_suffix']} </td>"; |
| 411 | 409 | } |
| 412 | - } |
|
| 413 | - else { |
|
| 410 | + } else { |
|
| 414 | 411 | $output .= '<td>---</td>'; |
| 415 | 412 | } |
| 416 | 413 | } |
@@ -936,22 +933,19 @@ discard block |
||
| 936 | 933 | drupal_set_message(t('Host @id has been removed from your account.', |
| 937 | 934 | array('@id' => $host_id))); |
| 938 | 935 | drupal_goto('account/computers'); |
| 939 | - } |
|
| 940 | - else { |
|
| 936 | + } else { |
|
| 941 | 937 | drupal_set_message(t('Host @id could not be deleted. Not sure why...', |
| 942 | 938 | array('@id' => $host_id)), 'error' |
| 943 | 939 | ); |
| 944 | 940 | } |
| 945 | - } |
|
| 946 | - else { |
|
| 941 | + } else { |
|
| 947 | 942 | drupal_set_message(t('Host @id cannot be deleted because it still has |
| 948 | 943 | tasks associated with it. These tasks should be processed within the |
| 949 | 944 | next few days, after which the host can be deleted.', |
| 950 | 945 | array('@id' => $host_id)), 'warning' |
| 951 | 946 | ); |
| 952 | 947 | } |
| 953 | - } |
|
| 954 | - else { |
|
| 948 | + } else { |
|
| 955 | 949 | drupal_set_message(t('You are not the owner of host @id, so you cannot |
| 956 | 950 | delete it.', |
| 957 | 951 | array('@id' => $host_id)), 'error' |
@@ -999,15 +993,13 @@ discard block |
||
| 999 | 993 | bts('The location for this host has been updated.', array(), NULL, 'boinc:account-host-details') |
| 1000 | 994 | . bts('This will take effect next time the host contacts the project.', array(), NULL, 'boinc:account-host-details') |
| 1001 | 995 | ); |
| 1002 | - } |
|
| 1003 | - else { |
|
| 996 | + } else { |
|
| 1004 | 997 | drupal_set_message( |
| 1005 | 998 | bts('Unable to save changes to this host for some reason!', array(), NULL, 'boinc:account-host-details'), |
| 1006 | 999 | 'error' |
| 1007 | 1000 | ); |
| 1008 | 1001 | } |
| 1009 | - } |
|
| 1010 | - else { |
|
| 1002 | + } else { |
|
| 1011 | 1003 | drupal_set_message( |
| 1012 | 1004 | bts('You are not allowed to make changes to this host.', array(), NULL, 'boinc:account-host-details'), |
| 1013 | 1005 | 'warning' |
@@ -1164,8 +1156,7 @@ discard block |
||
| 1164 | 1156 | $venue = $active_venue; |
| 1165 | 1157 | //unset($_SESSION['prefs venue']); |
| 1166 | 1158 | } |
| 1167 | - } |
|
| 1168 | - else { |
|
| 1159 | + } else { |
|
| 1169 | 1160 | // Set the active venue to keep it selected between computing and project |
| 1170 | 1161 | // preference pages |
| 1171 | 1162 | $_SESSION['prefs venue'] = $venue; |
@@ -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 | } |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | $s = stat($tmp_name); |
| 118 | 118 | $size = $s['size']; |
| 119 | 119 | [$exists, $elf] = sandbox_lf_exists($user, $md5); |
| 120 | - if (!$exists){ |
|
| 120 | + if (!$exists) { |
|
| 121 | 121 | // move file to download dir |
| 122 | 122 | // |
| 123 | 123 | $phys_path = sandbox_physical_path($user, $md5); |
@@ -150,9 +150,9 @@ discard block |
||
| 150 | 150 | error_page("physical file is missing"); |
| 151 | 151 | } |
| 152 | 152 | $bused = sandbox_file_in_use($user, $name); |
| 153 | - if ($bused){ |
|
| 153 | + if ($bused) { |
|
| 154 | 154 | $notice = "<strong>$name</strong> is being used by batch(es), you can not delete it now!<br/>"; |
| 155 | - } else{ |
|
| 155 | + } else { |
|
| 156 | 156 | unlink("$dir/$name"); |
| 157 | 157 | $notice = "<strong>$name</strong> was deleted from your sandbox<br/>"; |
| 158 | 158 | [$exists, $elf] = sandbox_lf_exists($user, $md5); |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | // Return path of sandbox directory for the given user. |
| 33 | 33 | // Create dir if not present. |
| 34 | 34 | // |
| 35 | -if (!function_exists("sandbox_dir")){ |
|
| 35 | +if (!function_exists("sandbox_dir")) { |
|
| 36 | 36 | function sandbox_dir($user) { |
| 37 | 37 | $dir = parse_config(get_config(), "<sandbox_dir>"); |
| 38 | 38 | if (!$dir) { |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | foreach ($files as $file) { |
| 64 | 64 | $path = "$dir/$file"; |
| 65 | 65 | [$err, $file_size, $file_md5] = sandbox_parse_link_file($path); |
| 66 | - if (!$err){ |
|
| 66 | + if (!$err) { |
|
| 67 | 67 | if (strcmp($md5, $file_md5) == 0) { |
| 68 | 68 | $exist = true; |
| 69 | 69 | $elf = $file; |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | // TODO: this is a kludge. |
| 153 | 153 | // Should we use the job_file and batch_file_assoc tables instead? |
| 154 | 154 | // |
| 155 | -function sandbox_file_in_use($user, $file){ |
|
| 155 | +function sandbox_file_in_use($user, $file) { |
|
| 156 | 156 | $ufiles = array(); |
| 157 | 157 | |
| 158 | 158 | $pbatches = BoincBatch::enum( |
@@ -162,16 +162,16 @@ discard block |
||
| 162 | 162 | ); |
| 163 | 163 | if (!$pbatches) return false; |
| 164 | 164 | |
| 165 | - foreach ($pbatches as $batch){ |
|
| 165 | + foreach ($pbatches as $batch) { |
|
| 166 | 166 | $wus = BoincWorkUnit::enum("batch = $batch->id limit 1" ); |
| 167 | - if ($wus == null){ |
|
| 167 | + if ($wus == null) { |
|
| 168 | 168 | continue; |
| 169 | 169 | } |
| 170 | - foreach($wus as $wu){ |
|
| 170 | + foreach($wus as $wu) { |
|
| 171 | 171 | $x = "<in>".$wu->xml_doc."</in>"; |
| 172 | 172 | $x = simplexml_load_string($x); |
| 173 | 173 | global $fanout; |
| 174 | - foreach($x->workunit->file_ref as $fr){ |
|
| 174 | + foreach($x->workunit->file_ref as $fr) { |
|
| 175 | 175 | $pname = (string)$fr->file_name; |
| 176 | 176 | $ufiles[] = $pname; |
| 177 | 177 | } |
@@ -180,10 +180,10 @@ discard block |
||
| 180 | 180 | $dir = sandbox_dir($user); |
| 181 | 181 | $path = $dir."/".$file; |
| 182 | 182 | list($err, $size, $md5) = sandbox_parse_link_file($path); |
| 183 | - if (!$err){ |
|
| 183 | + if (!$err) { |
|
| 184 | 184 | $f = sandbox_file_name($user, $md5); |
| 185 | 185 | foreach($ufiles as $uf) { |
| 186 | - if (strcmp($f,$uf) == 0){ |
|
| 186 | + if (strcmp($f,$uf) == 0) { |
|
| 187 | 187 | return true; |
| 188 | 188 | } |
| 189 | 189 | |
@@ -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; |