@@ -430,8 +430,7 @@ discard block |
||
| 430 | 430 | $user_info .= ' <div class="picture">'; |
| 431 | 431 | if (is_array($user_image) AND $user_image['image']['filepath']) { |
| 432 | 432 | $user_info .= theme('imagefield_image', $user_image['image'], $user_image['alt'], $user_image['alt'], array(), false); |
| 433 | - } |
|
| 434 | - elseif (is_string($user_image)) { |
|
| 433 | + } elseif (is_string($user_image)) { |
|
| 435 | 434 | $user_info .= '<img src="' . $user_image . '"/>'; |
| 436 | 435 | } |
| 437 | 436 | $user_info .= ' </div>'; |
@@ -473,8 +472,7 @@ discard block |
||
| 473 | 472 | // If a specific comment is being referenced, go back to it on cancel |
| 474 | 473 | if ($comment_ref = $form['pid']['#value']) { |
| 475 | 474 | $cancel_url = "goto/comment/{$comment_ref}"; |
| 476 | - } |
|
| 477 | - else { |
|
| 475 | + } else { |
|
| 478 | 476 | $cancel_url = "node/{$form['nid']['#value']}"; |
| 479 | 477 | } |
| 480 | 478 | |
@@ -528,8 +526,7 @@ discard block |
||
| 528 | 526 | '#weight' => 1000, |
| 529 | 527 | ); |
| 530 | 528 | } |
| 531 | - } |
|
| 532 | - else { |
|
| 529 | + } else { |
|
| 533 | 530 | $form = NULL; |
| 534 | 531 | $form['from'] = array( |
| 535 | 532 | '#type' => 'item', |
@@ -626,8 +623,7 @@ discard block |
||
| 626 | 623 | 'title' => bts('Reply to this topic with a quote', array(), NULL, 'boinc:forum-reply-to-comment') |
| 627 | 624 | ); |
| 628 | 625 | } |
| 629 | - } |
|
| 630 | - else { |
|
| 626 | + } else { |
|
| 631 | 627 | // Standard EDIT, DELETE, and REPLY links are created by Drupal, but we want to alter them |
| 632 | 628 | if (isset($links['comment_delete'])) { |
| 633 | 629 | $links['comment_delete']['attributes'] = array( |
@@ -681,8 +677,7 @@ discard block |
||
| 681 | 677 | 'title' => bts('Remove sticky status from this topic', array(), NULL, 'boinc:forum-unsticky-comment') |
| 682 | 678 | ) |
| 683 | 679 | ); |
| 684 | - } |
|
| 685 | - else { |
|
| 680 | + } else { |
|
| 686 | 681 | $links['make_sticky'] = array( |
| 687 | 682 | 'title' => bts('Make sticky', array(), NULL, 'boinc:forum-sticky-comment'), |
| 688 | 683 | 'href' => "{$node_control}/sticky", |
@@ -699,8 +694,7 @@ discard block |
||
| 699 | 694 | 'title' => bts('Lock this thread for comments', array(), NULL, 'boinc:forum-lock-comment') |
| 700 | 695 | ) |
| 701 | 696 | ); |
| 702 | - } |
|
| 703 | - else { |
|
| 697 | + } else { |
|
| 704 | 698 | $links['unlock'] = array( |
| 705 | 699 | 'title' => bts('Unlock', array(), NULL, 'boinc:forum-unlock-comment'), |
| 706 | 700 | 'href' => "{$node_control}/unlock", |
@@ -717,8 +711,7 @@ discard block |
||
| 717 | 711 | 'title' => bts('Hide this topic', array(), NULL, 'boinc:forum-hide-comment') |
| 718 | 712 | ) |
| 719 | 713 | ); |
| 720 | - } |
|
| 721 | - else { |
|
| 714 | + } else { |
|
| 722 | 715 | $links['unhide'] = array( |
| 723 | 716 | 'title' => bts('Unhide', array(), NULL, 'boinc:forum-unhide-comment'), |
| 724 | 717 | 'href' => "{$node_control}/unhide", |
@@ -729,8 +722,7 @@ discard block |
||
| 729 | 722 | } |
| 730 | 723 | }// if user_access('edit any forum topic') |
| 731 | 724 | } |
| 732 | - } |
|
| 733 | - else if ($type=='comment') { |
|
| 725 | + } else if ($type=='comment') { |
|
| 734 | 726 | $node = node_load($object->nid); |
| 735 | 727 | $nid = $object->nid; |
| 736 | 728 | $cid = $object->cid; |
@@ -771,8 +763,7 @@ discard block |
||
| 771 | 763 | 'title' => bts('Hide this comment', array(), NULL, 'boinc:forum-hide-comment') |
| 772 | 764 | ) |
| 773 | 765 | ); |
| 774 | - } |
|
| 775 | - else { |
|
| 766 | + } else { |
|
| 776 | 767 | $links['unhide'] = array( |
| 777 | 768 | 'title' => bts('Unhide', array(), NULL, 'boinc:forum-unhide-comment'), |
| 778 | 769 | 'href' => "{$comment_control}/unhide", |
@@ -958,8 +949,7 @@ discard block |
||
| 958 | 949 | watchdog('am_set_info', "XML validation error in global_prefs: {$errors[0]->message} at line {$errors[0]->line}" . |
| 959 | 950 | ': <br/>' . htmlentities($lines[$errors[0]->line - 1]), array(), WATCHDOG_ERROR); |
| 960 | 951 | } |
| 961 | - } |
|
| 962 | - elseif ($project_prefs) { |
|
| 952 | + } elseif ($project_prefs) { |
|
| 963 | 953 | $xml->loadXML($project_prefs, LIBXML_NOBLANKS); |
| 964 | 954 | if ($errors = libxml_get_errors($xml)) { |
| 965 | 955 | $lines = explode("\r", $project_prefs); |
@@ -1002,8 +992,7 @@ discard block |
||
| 1002 | 992 | node_save($content_profile); |
| 1003 | 993 | } |
| 1004 | 994 | } |
| 1005 | - } |
|
| 1006 | - else { |
|
| 995 | + } else { |
|
| 1007 | 996 | $xml = array( |
| 1008 | 997 | 'error' => array( |
| 1009 | 998 | 'error_num' => -112, |
@@ -1138,8 +1127,7 @@ discard block |
||
| 1138 | 1127 | node_save($node); |
| 1139 | 1128 | // Save the team IDs to a BOINC <--> Drupal reference table. |
| 1140 | 1129 | db_query('INSERT INTO {boincteam} (team_id, nid) VALUES (%d, %d)', $boincteam_id, $node->nid); |
| 1141 | - } |
|
| 1142 | - else { |
|
| 1130 | + } else { |
|
| 1143 | 1131 | $xml['create_team_reply']['warning'] = t( |
| 1144 | 1132 | 'There was a problem integrating this team into Drupal. Please |
| 1145 | 1133 | contact @project administrators!', array('@project' => PROJECT) |
@@ -1154,8 +1142,7 @@ discard block |
||
| 1154 | 1142 | // Delete from the BOINC DB if we can't sync with Drupal |
| 1155 | 1143 | $boincteam::delete(); |
| 1156 | 1144 | } |
| 1157 | - } |
|
| 1158 | - else { |
|
| 1145 | + } else { |
|
| 1159 | 1146 | $xml['create_team_reply']['warning'] = t( |
| 1160 | 1147 | 'There was a problem integrating this team into Drupal. Please |
| 1161 | 1148 | contact @project administrators!', array('@project' => PROJECT) |
@@ -1169,8 +1156,7 @@ discard block |
||
| 1169 | 1156 | ); |
| 1170 | 1157 | } |
| 1171 | 1158 | } |
| 1172 | - } |
|
| 1173 | - else { |
|
| 1159 | + } else { |
|
| 1174 | 1160 | $xml = array( |
| 1175 | 1161 | 'error' => array( |
| 1176 | 1162 | 'error_num' => -1, |
@@ -1239,8 +1225,7 @@ discard block |
||
| 1239 | 1225 | ); |
| 1240 | 1226 | $xml['users']['user'][] = $team_member; |
| 1241 | 1227 | } |
| 1242 | - } |
|
| 1243 | - else { |
|
| 1228 | + } else { |
|
| 1244 | 1229 | // Query BOINC database user table |
| 1245 | 1230 | db_set_active('boinc_rw'); |
| 1246 | 1231 | $result = db_query(" |
@@ -1293,8 +1278,7 @@ discard block |
||
| 1293 | 1278 | $xml['users']['user'][] = $team_members[$member->boinc_id]; |
| 1294 | 1279 | } |
| 1295 | 1280 | } // end if credit_only |
| 1296 | - } |
|
| 1297 | - else { |
|
| 1281 | + } else { |
|
| 1298 | 1282 | $xml = array( |
| 1299 | 1283 | 'error' => array( |
| 1300 | 1284 | 'error_num' => -136, |
@@ -1343,24 +1327,19 @@ discard block |
||
| 1343 | 1327 | if ($avatar_image) { |
| 1344 | 1328 | $profile_node->field_image[0] = $avatar_image; |
| 1345 | 1329 | node_save($profile_node); |
| 1346 | - } |
|
| 1347 | - else { |
|
| 1330 | + } else { |
|
| 1348 | 1331 | $error = 'Error saving avatar to profile'; |
| 1349 | 1332 | } |
| 1350 | - } |
|
| 1351 | - else { |
|
| 1333 | + } else { |
|
| 1352 | 1334 | $error = 'Unable to load user profile'; |
| 1353 | 1335 | } |
| 1354 | - } |
|
| 1355 | - else { |
|
| 1336 | + } else { |
|
| 1356 | 1337 | $error = 'User has no profile, so avatar could not be added'; |
| 1357 | 1338 | } |
| 1358 | - } |
|
| 1359 | - else { |
|
| 1339 | + } else { |
|
| 1360 | 1340 | $error = 'Unable to save remote image'; |
| 1361 | 1341 | } |
| 1362 | - } |
|
| 1363 | - else { |
|
| 1342 | + } else { |
|
| 1364 | 1343 | $error = 'Could not find avatar image at URL'; |
| 1365 | 1344 | } |
| 1366 | 1345 | } |
@@ -1387,8 +1366,7 @@ discard block |
||
| 1387 | 1366 | 'success' => NULL, |
| 1388 | 1367 | ), |
| 1389 | 1368 | ); |
| 1390 | - } |
|
| 1391 | - else { |
|
| 1369 | + } else { |
|
| 1392 | 1370 | // Failure |
| 1393 | 1371 | $xml = array( |
| 1394 | 1372 | 'error' => array( |
@@ -1397,8 +1375,7 @@ discard block |
||
| 1397 | 1375 | ), |
| 1398 | 1376 | ); |
| 1399 | 1377 | } |
| 1400 | - } |
|
| 1401 | - else { |
|
| 1378 | + } else { |
|
| 1402 | 1379 | // Drupal user not found |
| 1403 | 1380 | $xml = array( |
| 1404 | 1381 | 'error' => array( |
@@ -1407,8 +1384,7 @@ discard block |
||
| 1407 | 1384 | ), |
| 1408 | 1385 | ); |
| 1409 | 1386 | } |
| 1410 | - } |
|
| 1411 | - else { |
|
| 1387 | + } else { |
|
| 1412 | 1388 | // BOINC user not found |
| 1413 | 1389 | $xml = array( |
| 1414 | 1390 | 'error' => array( |
@@ -1526,8 +1502,7 @@ discard block |
||
| 1526 | 1502 | ), |
| 1527 | 1503 | ); |
| 1528 | 1504 | } |
| 1529 | - } |
|
| 1530 | - else { |
|
| 1505 | + } else { |
|
| 1531 | 1506 | $xml = array( |
| 1532 | 1507 | 'error' => array( |
| 1533 | 1508 | 'error_num' => -136, |
@@ -1651,8 +1626,7 @@ discard block |
||
| 1651 | 1626 | // Get the number of comments per page |
| 1652 | 1627 | if ($user->comments_per_page) { |
| 1653 | 1628 | $comments_per_page = $user->comments_per_page; |
| 1654 | - } |
|
| 1655 | - else { |
|
| 1629 | + } else { |
|
| 1656 | 1630 | $node = node_load($object->nid); |
| 1657 | 1631 | $comments_per_page = variable_get( |
| 1658 | 1632 | "comment_default_per_page_{$node->type}", 50 |
@@ -1673,8 +1647,7 @@ discard block |
||
| 1673 | 1647 | // Check for a login, then redirect to the user's friend requests page |
| 1674 | 1648 | if ($user->uid) { |
| 1675 | 1649 | drupal_goto("account/{$user->uid}/friends/pending"); |
| 1676 | - } |
|
| 1677 | - else { |
|
| 1650 | + } else { |
|
| 1678 | 1651 | drupal_goto('user/login', array( |
| 1679 | 1652 | 'destination' => 'goto/friend-requests' |
| 1680 | 1653 | )); |
@@ -1950,8 +1923,7 @@ discard block |
||
| 1950 | 1923 | if ($moderator_rid !== FALSE) { |
| 1951 | 1924 | $settings['recipients'] = array($moderator_rid); |
| 1952 | 1925 | rules_action_mail_to_users_of_role($settings); |
| 1953 | - } |
|
| 1954 | - else { |
|
| 1926 | + } else { |
|
| 1955 | 1927 | watchdog( |
| 1956 | 1928 | 'boinccore', |
| 1957 | 1929 | 'Unable to identify members of the moderator role to send moderator notifications!', |
@@ -1982,8 +1954,7 @@ discard block |
||
| 1982 | 1954 | } |
| 1983 | 1955 | if (empty($args)) { |
| 1984 | 1956 | return $string; |
| 1985 | - } |
|
| 1986 | - else { |
|
| 1957 | + } else { |
|
| 1987 | 1958 | // Transform arguments before inserting them. |
| 1988 | 1959 | foreach ($args as $key => $value) { |
| 1989 | 1960 | switch ($key [0]) { |
@@ -53,8 +53,7 @@ |
||
| 53 | 53 | $boincusername = (!empty($account)) ? $account->boincuser_name : variable_get('anonymous', 'Anonymous'); |
| 54 | 54 | $replace = TRUE; |
| 55 | 55 | } |
| 56 | - } |
|
| 57 | - elseif ($nid && _quote_variable_get('node_link_display')) { |
|
| 56 | + } elseif ($nid && _quote_variable_get('node_link_display')) { |
|
| 58 | 57 | $node = node_load(array('nid' => $nid)); |
| 59 | 58 | if (in_array($node->type, _quote_variable_get('node_types'))) { |
| 60 | 59 | $account = user_load($node->uid); |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | /** |
| 146 | 146 | * Create BOINC account |
| 147 | 147 | */ |
| 148 | -function boincuser_register_make_user($params) { |
|
| 148 | +function boincuser_register_make_user($params) { |
|
| 149 | 149 | // Include BOINC user library |
| 150 | 150 | require_boinc('user_util'); |
| 151 | 151 | // Create the BOINC user |
@@ -343,8 +343,7 @@ discard block |
||
| 343 | 343 | if (!$account) { |
| 344 | 344 | global $user; |
| 345 | 345 | $account = user_load($user->id); |
| 346 | - } |
|
| 347 | - elseif (is_numeric($account)) { |
|
| 346 | + } elseif (is_numeric($account)) { |
|
| 348 | 347 | $account = user_load($account); |
| 349 | 348 | } |
| 350 | 349 | |
@@ -420,13 +419,11 @@ discard block |
||
| 420 | 419 | // (except in cases where password is being reset) |
| 421 | 420 | if (isset($_SESSION['reset_pass'])) { |
| 422 | 421 | unset($_SESSION['reset_pass']); |
| 423 | - } |
|
| 424 | - else { |
|
| 422 | + } else { |
|
| 425 | 423 | $given_hash = md5($edit['current_pass'] . strtolower($account->mail)); |
| 426 | 424 | if (!$edit['current_pass']) { |
| 427 | 425 | form_set_error('current_pass', bts('Authentication is required when changing E-mail address or setting new password.', array(), NULL, 'boinc:account-credentials-change')); |
| 428 | - } |
|
| 429 | - elseif ( (!password_verify($given_hash, $boinc_user->passwd_hash)) and ($given_hash != $boinc_user->passwd_hash) ) { |
|
| 426 | + } elseif ( (!password_verify($given_hash, $boinc_user->passwd_hash)) and ($given_hash != $boinc_user->passwd_hash) ) { |
|
| 430 | 427 | form_set_error('current_pass', bts('Password entered is not valid. Please verify that it is correct.', array(), NULL, 'boinc:account-credentials-change')); |
| 431 | 428 | } |
| 432 | 429 | |
@@ -418,11 +418,9 @@ discard block |
||
| 418 | 418 | |
| 419 | 419 | if ($edit['boincuser_name']) { |
| 420 | 420 | $myname = $edit['boincuser_name']; |
| 421 | - } |
|
| 422 | - else if ($edit['name']) { |
|
| 421 | + } else if ($edit['name']) { |
|
| 423 | 422 | $myname = $edit['name']; |
| 424 | - } |
|
| 425 | - else { |
|
| 423 | + } else { |
|
| 426 | 424 | $myname = 'noname'; |
| 427 | 425 | } |
| 428 | 426 | |
@@ -434,8 +432,7 @@ discard block |
||
| 434 | 432 | // If the 'pass' variable is already a hash, then don't hash it again. |
| 435 | 433 | if ($edit['boinchash_flag']) { |
| 436 | 434 | $user_params['passwd_hash'] = $edit['pass']; |
| 437 | - } |
|
| 438 | - else { |
|
| 435 | + } else { |
|
| 439 | 436 | // The passwd_hash here is only the md5() hash. This is |
| 440 | 437 | // because BOINC make_user(), called later, will run |
| 441 | 438 | // password_hash() on this md5 hash. |
@@ -506,8 +503,7 @@ discard block |
||
| 506 | 503 | $prev_email = $account->mail; |
| 507 | 504 | $mytime = (user_access('administer users')) ? $boinc_user->email_addr_change_time : time(); |
| 508 | 505 | $querypart = "email_addr='{$lower_email_addr}', passwd_hash='{$passwd_hash}', previous_email_addr = '{$prev_email}', email_addr_change_time = $mytime"; |
| 509 | - } |
|
| 510 | - else { |
|
| 506 | + } else { |
|
| 511 | 507 | $querypart = "email_addr='{$lower_email_addr}', passwd_hash='{$passwd_hash}'"; |
| 512 | 508 | } |
| 513 | 509 | |
@@ -750,8 +746,7 @@ discard block |
||
| 750 | 746 | case FLAG_FRIEND_APPROVAL: |
| 751 | 747 | if ($action == 'flag') { |
| 752 | 748 | $form['flag_friend_submit']['#value'] = bts('Approve request', array(), NULL, 'boinc:friends-page'); |
| 753 | - } |
|
| 754 | - elseif ($action == 'unflag') { |
|
| 749 | + } elseif ($action == 'unflag') { |
|
| 755 | 750 | unset($form['actions']); |
| 756 | 751 | $form['flag_friend_submit']['#value'] = bts('Deny request', array(), NULL, 'boinc:friends-page'); |
| 757 | 752 | } |
@@ -1527,8 +1522,7 @@ discard block |
||
| 1527 | 1522 | array( |
| 1528 | 1523 | '!boinccmd' => l('boinccmd --project_attach', 'http://boinc.berkeley.edu/wiki/Boinccmd_tool'), |
| 1529 | 1524 | ), NULL, 'boinc:join-page') . '</li>'; |
| 1530 | - } |
|
| 1531 | - else { |
|
| 1525 | + } else { |
|
| 1532 | 1526 | $output .= '<li>' . bts("If you're running a command-line version of BOINC, |
| 1533 | 1527 | please follow the <b>!instructionslink</b> to first <i>create an account</i>, and then <i>attach</i> to this project. Use the same project URL as above.", |
| 1534 | 1528 | array( |
@@ -1563,8 +1557,7 @@ discard block |
||
| 1563 | 1557 | '!create_an_account' => l(bts('create an account', array(), NULL, 'boinc:join-page'), 'user/registration'), |
| 1564 | 1558 | '@sitename' => $site_name, |
| 1565 | 1559 | ), NULL, 'boinc:join-page') . '</li>'; |
| 1566 | - } |
|
| 1567 | - else if ( menu_valid_path(array('link_path' => $ruleslink)) ) { |
|
| 1560 | + } else if ( menu_valid_path(array('link_path' => $ruleslink)) ) { |
|
| 1568 | 1561 | $output .= ' <li>' . bts("Read our !rules_and_policies.", array( |
| 1569 | 1562 | '!rules_and_policies' => l(bts('Rules and Policies', array(), NULL, 'boinc:join-page'), $ruleslink), |
| 1570 | 1563 | ), NULL, 'boinc:join-page') . '</li>'; |
@@ -1606,8 +1599,7 @@ discard block |
||
| 1606 | 1599 | )); |
| 1607 | 1600 | if ($current_uotd->uotd_time < strtotime('today midnight')) { |
| 1608 | 1601 | $uotd = boincuser_select_user_of_the_day(); |
| 1609 | - } |
|
| 1610 | - else { |
|
| 1602 | + } else { |
|
| 1611 | 1603 | $uotd = user_load($current_uotd->uid); |
| 1612 | 1604 | } |
| 1613 | 1605 | $uotd_image = boincuser_get_user_profile_image($uotd->uid, FALSE); |
@@ -1618,8 +1610,7 @@ discard block |
||
| 1618 | 1610 | $output .= ' <div>' . bts($site_message, array(), NULL, "project:front page") . ' ' . l(bts('Learn more', array(), NULL, 'boinc:front-page'), 'about') . '</div>'; |
| 1619 | 1611 | if ($user->uid) { |
| 1620 | 1612 | $output .= ' <div>' . l(bts('View account', array(), NULL, 'boinc:front-page'), 'dashboard', array('attributes' => array('class' => 'join button'))) . '</div>'; |
| 1621 | - } |
|
| 1622 | - else { |
|
| 1613 | + } else { |
|
| 1623 | 1614 | $output .= ' <div>' . l(bts('Join now', array(), NULL, 'boinc:front-page'), 'join', array('attributes' => array('class' => 'join button'))) . '</div>'; |
| 1624 | 1615 | } |
| 1625 | 1616 | $output .= '</div>'; |
@@ -1704,12 +1695,10 @@ discard block |
||
| 1704 | 1695 | if ( ($params['passwd_hash'] == $boinc_user->passwd_hash) or |
| 1705 | 1696 | password_verify($params['passwd_hash'], $boinc_user->passwd_hash) ) { |
| 1706 | 1697 | $output = array('authenticator' => $boinc_user->authenticator); |
| 1707 | - } |
|
| 1708 | - else { |
|
| 1698 | + } else { |
|
| 1709 | 1699 | xml_error(-137); |
| 1710 | 1700 | } |
| 1711 | - } |
|
| 1712 | - else { |
|
| 1701 | + } else { |
|
| 1713 | 1702 | // Verify that there isn't somehow a Drupal user already (not possible with proper function) |
| 1714 | 1703 | if ($existing_user = user_load(array('mail' => $params['email_addr']))) { |
| 1715 | 1704 | xml_error(-137, 'account error'); |
@@ -2193,7 +2182,9 @@ discard block |
||
| 2193 | 2182 | 'cpid' => $cpid |
| 2194 | 2183 | ); |
| 2195 | 2184 | $args = array(); |
| 2196 | - foreach ($get as $arg => $value) $args[] = "{$arg}=" . rawurlencode($value); |
|
| 2185 | + foreach ($get as $arg => $value) { |
|
| 2186 | + $args[] = "{$arg}=" . rawurlencode($value); |
|
| 2187 | + } |
|
| 2197 | 2188 | $query = '?' . implode('&', $args); |
| 2198 | 2189 | |
| 2199 | 2190 | // Load XML from RPC |
@@ -2324,8 +2315,7 @@ discard block |
||
| 2324 | 2315 | if ($node->uid == 0 || strlen($node->name) == 0) { |
| 2325 | 2316 | // @see user_validate_name(). !'0' === TRUE. |
| 2326 | 2317 | $document->ss_name = '0'; |
| 2327 | - } |
|
| 2328 | - else { |
|
| 2318 | + } else { |
|
| 2329 | 2319 | $document->ss_name = $account->boincuser_name; |
| 2330 | 2320 | // We want the name to be searchable for keywords. |
| 2331 | 2321 | $document->tos_name = $account->boincuser_name; |
@@ -64,8 +64,7 @@ discard block |
||
| 64 | 64 | $t->user_postal_code = decode($t->user_postal_code); |
| 65 | 65 | $t->user_url = decode($t->user_url); |
| 66 | 66 | return $t; |
| 67 | - } |
|
| 68 | - else if (strstr($s, '<name>')) $t->name = parse_element($s, '<name>'); |
|
| 67 | + } else if (strstr($s, '<name>')) $t->name = parse_element($s, '<name>'); |
|
| 69 | 68 | else if (strstr($s, '<url>')) $t->url = parse_element($s, '<url>'); |
| 70 | 69 | else if (strstr($s, '<type>')) $t->type = parse_element($s, '<type>'); |
| 71 | 70 | else if (strstr($s, '<name_html>')) $t->name_html = parse_element($s, '<name_html>'); |
@@ -74,14 +73,12 @@ discard block |
||
| 74 | 73 | if (strstr($s, '</description>')) break; |
| 75 | 74 | $t->description .= $s; |
| 76 | 75 | } |
| 77 | - } |
|
| 78 | - else if (strstr($s, '<country>')) $t->country = parse_element($s, '<country>'); |
|
| 76 | + } else if (strstr($s, '<country>')) $t->country = parse_element($s, '<country>'); |
|
| 79 | 77 | else if (strstr($s, '<id>')) $t->id = parse_element($s, '<id>'); |
| 80 | 78 | else if (strstr($s, '<user_email_munged>')) { |
| 81 | 79 | $user_email_munged = parse_element($s, '<user_email_munged>'); |
| 82 | 80 | $t->user_email = str_rot13($user_email_munged); |
| 83 | - } |
|
| 84 | - else if (strstr($s, '<user_name>')) $t->user_name = parse_element($s, '<user_name>'); |
|
| 81 | + } else if (strstr($s, '<user_name>')) $t->user_name = parse_element($s, '<user_name>'); |
|
| 85 | 82 | else if (strstr($s, '<user_country>')) $t->user_country = parse_element($s, '<user_country>'); |
| 86 | 83 | else if (strstr($s, '<user_postal_code>')) $t->user_postal_code = parse_element($s, '<user_postal_code>'); |
| 87 | 84 | else if (strstr($s, '<user_url>')) $t->user_url = parse_element($s, '<user_url>'); |
@@ -140,8 +137,7 @@ discard block |
||
| 140 | 137 | list($checkct, $ctid) = check_consent_type(CONSENT_TYPE_ENROLL); |
| 141 | 138 | if ($checkct) { |
| 142 | 139 | echo " cannot make user when an consent to terms of use is required\n"; |
| 143 | - } |
|
| 144 | - else { |
|
| 140 | + } else { |
|
| 145 | 141 | echo " making user $t->user_email\n"; |
| 146 | 142 | $user = make_user($t->user_email, $t->user_name, random_string()); |
| 147 | 143 | if (!$user) { |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | $name = substr($name, 0, $name_limit)."..."; |
| 344 | 344 | } |
| 345 | 345 | $x .= " <a href=\"".url_base()."show_user.php?userid=".$user->id."\">".$name."</a>"; |
| 346 | - if (function_exists("project_user_links")){ |
|
| 346 | + if (function_exists("project_user_links")) { |
|
| 347 | 347 | $x .= project_user_links($user); |
| 348 | 348 | } |
| 349 | 349 | if ($badge_height) { |
@@ -464,7 +464,7 @@ discard block |
||
| 464 | 464 | // Returns a cacheable community links data object |
| 465 | 465 | // @param user The user to produce a community links object for |
| 466 | 466 | |
| 467 | -function get_community_links_object($user){ |
|
| 467 | +function get_community_links_object($user) { |
|
| 468 | 468 | $cache_object = new StdClass; |
| 469 | 469 | $cache_object->post_count = total_posts($user); |
| 470 | 470 | $cache_object->user = $user; |
@@ -480,7 +480,7 @@ discard block |
||
| 480 | 480 | return $cache_object; |
| 481 | 481 | } |
| 482 | 482 | |
| 483 | -function community_links($clo, $logged_in_user){ |
|
| 483 | +function community_links($clo, $logged_in_user) { |
|
| 484 | 484 | $user = $clo->user; |
| 485 | 485 | $team = $clo->team; |
| 486 | 486 | $friends = $clo->friends; |
@@ -46,8 +46,7 @@ discard block |
||
| 46 | 46 | if ($toggle == "Click to Enable") { |
| 47 | 47 | $state = 1; |
| 48 | 48 | $action = "Enabled"; |
| 49 | - } |
|
| 50 | - else { |
|
| 49 | + } else { |
|
| 51 | 50 | $state = 0; |
| 52 | 51 | $action = "Disabled"; |
| 53 | 52 | } |
@@ -91,12 +90,10 @@ discard block |
||
| 91 | 90 | if (!in_rops()) { |
| 92 | 91 | if (!($ct->enabled)) { |
| 93 | 92 | echo " <td><input class=\"btn btn-default\" name=toggleenabled type=submit value=\"Click to Enable\"></td>"; |
| 94 | - } |
|
| 95 | - else { |
|
| 93 | + } else { |
|
| 96 | 94 | echo " <td><input class=\"btn btn-default\" name=toggleenabled type=submit value=\"Click to Disable\"></td>"; |
| 97 | 95 | } |
| 98 | - } |
|
| 99 | - else { |
|
| 96 | + } else { |
|
| 100 | 97 | echo " <td>$ct->enabled</td>"; |
| 101 | 98 | } |
| 102 | 99 | |
@@ -107,12 +104,10 @@ discard block |
||
| 107 | 104 | if (!in_rops()) { |
| 108 | 105 | if (!($ct->privacypref)) { |
| 109 | 106 | echo " <td><input class=\"btn btn-default\" name=toggleprivacypref type=submit value=\"Click to Enable\"></td>"; |
| 110 | - } |
|
| 111 | - else { |
|
| 107 | + } else { |
|
| 112 | 108 | echo " <td><input class=\"btn btn-default\" name=toggleprivacypref type=submit value=\"Click to Disable\"></td>"; |
| 113 | 109 | } |
| 114 | - } |
|
| 115 | - else { |
|
| 110 | + } else { |
|
| 116 | 111 | echo " <td>$ct->privacypref</td>"; |
| 117 | 112 | } |
| 118 | 113 | |
@@ -156,11 +151,9 @@ discard block |
||
| 156 | 151 | |
| 157 | 152 | if (post_str("add_consenttype", true)) { |
| 158 | 153 | add_consenttype(); |
| 159 | -} |
|
| 160 | -else if (post_str("toggleenabled", true)) { |
|
| 154 | +} else if (post_str("toggleenabled", true)) { |
|
| 161 | 155 | mct_toggle_field("enabled"); |
| 162 | -} |
|
| 163 | -else if (post_str("toggleprivacypref", true)) { |
|
| 156 | +} else if (post_str("toggleprivacypref", true)) { |
|
| 164 | 157 | mct_toggle_field("privacypref"); |
| 165 | 158 | } |
| 166 | 159 | |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | continue; |
| 69 | 69 | } |
| 70 | 70 | // only do files ending in .po |
| 71 | - if (substr($file,-3) != ".po"){ |
|
| 71 | + if (substr($file,-3) != ".po") { |
|
| 72 | 72 | //debug("File $file with unknown extension found in $info_dir"); |
| 73 | 73 | continue; |
| 74 | 74 | } |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | "-------------Compiling $transdir$file------------", 0 |
| 77 | 77 | ); |
| 78 | 78 | $language = parse_po_file($langdir.$transdir.$file); |
| 79 | - if (!$language){ |
|
| 79 | + if (!$language) { |
|
| 80 | 80 | language_log( |
| 81 | 81 | "WARNING: Could not parse language ".$file |
| 82 | 82 | ); |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | ); |
| 96 | 96 | exit; |
| 97 | 97 | } |
| 98 | - foreach ($language as $key => $value){ |
|
| 98 | + foreach ($language as $key => $value) { |
|
| 99 | 99 | if ($value !== "") { |
| 100 | 100 | // Skip if the msgstr is empty |
| 101 | 101 | fwrite($fh, "\$language_lookup_array[\"".str_replace("\"", "\\\"", substr($file,0,-3))."\"][\"".$key."\"] = \"".$value."\";\n"); |
@@ -121,13 +121,13 @@ discard block |
||
| 121 | 121 | $parsing_text = false; |
| 122 | 122 | $size = sizeof($translation_file); |
| 123 | 123 | $output = array(); |
| 124 | - for ($i=0; $i<$size; $i++){ |
|
| 124 | + for ($i=0; $i<$size; $i++) { |
|
| 125 | 125 | $entry = trim($translation_file[$i]); |
| 126 | 126 | //echo "line $i: $entry\n"; |
| 127 | 127 | if (substr($entry, 0, 1)=="#") { |
| 128 | 128 | continue; |
| 129 | 129 | } elseif (strpos($entry, "msgid") !== false) { |
| 130 | - if (!$first_entry){ |
|
| 130 | + if (!$first_entry) { |
|
| 131 | 131 | //If this is not the first, save the previous entry |
| 132 | 132 | $output[$current_token]=$current_token_text; |
| 133 | 133 | } |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | |
| 150 | 150 | // Get the last token |
| 151 | 151 | // |
| 152 | - if ($current_token && $current_token_text){ |
|
| 152 | + if ($current_token && $current_token_text) { |
|
| 153 | 153 | $output[$current_token] = $current_token_text; |
| 154 | 154 | } |
| 155 | 155 | return $output; |
@@ -180,11 +180,11 @@ discard block |
||
| 180 | 180 | |
| 181 | 181 | // Find the string in the user's language |
| 182 | 182 | // |
| 183 | - foreach ($languages_in_use as $language){ |
|
| 183 | + foreach ($languages_in_use as $language) { |
|
| 184 | 184 | if (isset($language_lookup_array[$language][$text])) { |
| 185 | 185 | $text = $language_lookup_array[$language][$text]; |
| 186 | 186 | break; |
| 187 | - } else if ($language=="en"){ |
|
| 187 | + } else if ($language=="en") { |
|
| 188 | 188 | // This language is defined in the code and is always available |
| 189 | 189 | break; |
| 190 | 190 | } |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | // Replace relevant substrings with given arguments. |
| 194 | 194 | // Use strtr to avoid problems if an argument contains %n. |
| 195 | 195 | $replacements = array(); |
| 196 | - for ($i=1; $i<func_num_args(); $i++){ |
|
| 196 | + for ($i=1; $i<func_num_args(); $i++) { |
|
| 197 | 197 | $replacements["%".$i] = func_get_arg($i); |
| 198 | 198 | } |
| 199 | 199 | |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | if ($loglevel==1) $msg = "[ Warning ]"; |
| 218 | 218 | if ($loglevel==2) $msg = "[ CRITICAL ]"; |
| 219 | 219 | |
| 220 | - if ($loglevel >= $lang_log_level){ |
|
| 220 | + if ($loglevel >= $lang_log_level) { |
|
| 221 | 221 | echo gmdate("Y-m-d H:i:s", time())." ".$msg." ".$message."\n"; |
| 222 | 222 | } |
| 223 | 223 | } |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | // (by looking at cookies and browser settings) |
| 227 | 227 | // cookies have highest priority. |
| 228 | 228 | |
| 229 | -if (isset($_COOKIE['lang'])){ |
|
| 229 | +if (isset($_COOKIE['lang'])) { |
|
| 230 | 230 | $language_string = $_COOKIE['lang'].","; |
| 231 | 231 | } else { |
| 232 | 232 | $language_string = ''; |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | for ($i=0; $i<$size; $i++) { |
| 261 | 261 | if ((strlen($client_languages[$i])>2) |
| 262 | 262 | && (substr($client_languages[$i], 2, 1) == "_" || substr($client_languages[$i], 2, 1) == "-") |
| 263 | - ){ |
|
| 263 | + ) { |
|
| 264 | 264 | // If this is defined as primary-secondary, represent it as xx_YY |
| 265 | 265 | // |
| 266 | 266 | $language = substr( |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | // |
| 288 | 288 | $file_name = $lang_language_dir.$lang_compiled_dir.$language.".po.inc"; |
| 289 | 289 | if (file_exists($file_name)) { |
| 290 | - if (!in_array($language, $languages_in_use)){ |
|
| 290 | + if (!in_array($language, $languages_in_use)) { |
|
| 291 | 291 | require_once($file_name); |
| 292 | 292 | $languages_in_use[] = $language; |
| 293 | 293 | } |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | if ($language2) { |
| 296 | 296 | $file_name = $lang_language_dir.$lang_compiled_dir.$language2.".po.inc"; |
| 297 | 297 | if (file_exists($file_name)) { |
| 298 | - if (!in_array($language2, $languages_in_use)){ |
|
| 298 | + if (!in_array($language2, $languages_in_use)) { |
|
| 299 | 299 | require_once($file_name); |
| 300 | 300 | $languages_in_use[] = $language2; |
| 301 | 301 | } |
@@ -127,8 +127,7 @@ discard block |
||
| 127 | 127 | if (isset($prefs[$name]['@value'])) { |
| 128 | 128 | $default[$name] = $prefs[$name]['@value']; |
| 129 | 129 | } |
| 130 | - } |
|
| 131 | - else { |
|
| 130 | + } else { |
|
| 132 | 131 | $default[$name] = $prefs[$name]; |
| 133 | 132 | } |
| 134 | 133 | } |
@@ -655,8 +654,7 @@ discard block |
||
| 655 | 654 | // Save the preset selection (or lack thereof) |
| 656 | 655 | if (!$preset OR $preset == 'custom') { |
| 657 | 656 | $prefs['preset'] = 'custom'; |
| 658 | - } |
|
| 659 | - else { |
|
| 657 | + } else { |
|
| 660 | 658 | $prefs['preset'] = $preset; |
| 661 | 659 | } |
| 662 | 660 | |
@@ -671,8 +669,7 @@ discard block |
||
| 671 | 669 | if (!$result) { |
| 672 | 670 | watchdog('boincwork', 'Error updating global prefs for user @id: @message', array('@id' => $account->id, '@message' => mysqli_error()), WATCHDOG_ERROR); |
| 673 | 671 | drupal_set_message(t('Your changes could not be saved. Please contact support!'), 'error'); |
| 674 | - } |
|
| 675 | - elseif (!drupal_get_messages('status', FALSE)) { |
|
| 672 | + } elseif (!drupal_get_messages('status', FALSE)) { |
|
| 676 | 673 | // Show this message if the set wasn't created automatically (in which case |
| 677 | 674 | // there is a message tailored to that) { |
| 678 | 675 | drupal_set_message(t('Your preferences have been updated. |
@@ -927,8 +924,7 @@ discard block |
||
| 927 | 924 | if (boincwork_host_merge($old_host, $current_host, $message)) { |
| 928 | 925 | $merged[$old_host->id] = $old_host->id; |
| 929 | 926 | $current_host = boincwork_host_get_info($current_host_id); |
| 930 | - } |
|
| 931 | - else { |
|
| 927 | + } else { |
|
| 932 | 928 | $errors[$old_host->id] = $message; |
| 933 | 929 | } |
| 934 | 930 | } |
@@ -944,8 +940,7 @@ discard block |
||
| 944 | 940 | $oxford_comma = ''; |
| 945 | 941 | } |
| 946 | 942 | $list = implode(', ', $list) . $oxford_comma . ' ' . $conjunction . ' ' . $last; |
| 947 | - } |
|
| 948 | - else { |
|
| 943 | + } else { |
|
| 949 | 944 | $list = $last; |
| 950 | 945 | } |
| 951 | 946 | if (count($merged) == 1) { |
@@ -956,8 +951,7 @@ discard block |
||
| 956 | 951 | '@id' => $current_host_id |
| 957 | 952 | ), |
| 958 | 953 | NULL, 'boinc:account-host-merge')); |
| 959 | - } |
|
| 960 | - else { |
|
| 954 | + } else { |
|
| 961 | 955 | drupal_set_message(bts( |
| 962 | 956 | 'Computers @old_ids have been merged successfully into @id.', |
| 963 | 957 | array( |
@@ -1023,11 +1017,9 @@ discard block |
||
| 1023 | 1017 | if ($account->boincuser_default_pref_set == $venue) { |
| 1024 | 1018 | $venue_is_default = TRUE; |
| 1025 | 1019 | } |
| 1026 | - } |
|
| 1027 | - elseif (!$venue OR $venue == 'generic') { |
|
| 1020 | + } elseif (!$venue OR $venue == 'generic') { |
|
| 1028 | 1021 | $venue_is_default = TRUE; |
| 1029 | - } |
|
| 1030 | - else { |
|
| 1022 | + } else { |
|
| 1031 | 1023 | $venue_is_default = FALSE; |
| 1032 | 1024 | } |
| 1033 | 1025 | |
@@ -1047,8 +1039,7 @@ discard block |
||
| 1047 | 1039 | if (isset($prefs[$name]['@value'])) { |
| 1048 | 1040 | $default[$name] = $prefs[$name]['@value']; |
| 1049 | 1041 | } |
| 1050 | - } |
|
| 1051 | - else { |
|
| 1042 | + } else { |
|
| 1052 | 1043 | $default[$name] = $prefs[$name]; |
| 1053 | 1044 | } |
| 1054 | 1045 | } |
@@ -1232,16 +1223,13 @@ discard block |
||
| 1232 | 1223 | foreach ($element as $ordered_element) { |
| 1233 | 1224 | if (isset($ordered_element['@position'])) { |
| 1234 | 1225 | $ordered_array[$ordered_element['@position']] = array($type => $ordered_element); |
| 1235 | - } |
|
| 1236 | - else { |
|
| 1226 | + } else { |
|
| 1237 | 1227 | $unordered_array[] = array($type => $ordered_element); |
| 1238 | 1228 | } |
| 1239 | 1229 | } |
| 1240 | - } |
|
| 1241 | - elseif (isset($element['@position'])) { |
|
| 1230 | + } elseif (isset($element['@position'])) { |
|
| 1242 | 1231 | $ordered_array[$element['@position']] = array($type => $element); |
| 1243 | - } |
|
| 1244 | - else { |
|
| 1232 | + } else { |
|
| 1245 | 1233 | $unordered_array[] = array($type => $element); |
| 1246 | 1234 | } |
| 1247 | 1235 | } |
@@ -1356,8 +1344,7 @@ discard block |
||
| 1356 | 1344 | // Update the user's default preference set |
| 1357 | 1345 | if ($edit['default_set']['default_venue']) { |
| 1358 | 1346 | boincwork_set_default_venue($venue); |
| 1359 | - } |
|
| 1360 | - elseif ($venue == $account->boincuser_default_pref_set) { |
|
| 1347 | + } elseif ($venue == $account->boincuser_default_pref_set) { |
|
| 1361 | 1348 | // User has cleared out the default venue setting |
| 1362 | 1349 | boincwork_set_default_venue(); |
| 1363 | 1350 | } |
@@ -1365,8 +1352,7 @@ discard block |
||
| 1365 | 1352 | if (!$result) { |
| 1366 | 1353 | watchdog('boincwork', 'Error updating project prefs for user @id: @message', array('@id' => $user->id, '@message' => mysqli_error()), WATCHDOG_ERROR); |
| 1367 | 1354 | drupal_set_message(t('Your changes could not be saved. Please contact support!'), 'error'); |
| 1368 | - } |
|
| 1369 | - elseif (!drupal_get_messages('status', FALSE)) { |
|
| 1355 | + } elseif (!drupal_get_messages('status', FALSE)) { |
|
| 1370 | 1356 | // Show this message if the set wasn't created automatically (in which case |
| 1371 | 1357 | // there is a message tailored to that) |
| 1372 | 1358 | drupal_set_message(t('Your preferences have been updated. |
@@ -1519,8 +1505,7 @@ discard block |
||
| 1519 | 1505 | // Upload an avatar (pulled from profile_node_form): |
| 1520 | 1506 | if (!empty($profile_form['field_image'])) { |
| 1521 | 1507 | $form['field_image'] = $profile_form['field_image']; |
| 1522 | - } |
|
| 1523 | - else { |
|
| 1508 | + } else { |
|
| 1524 | 1509 | $form['field_image'] = array( |
| 1525 | 1510 | '#value' => '<div class="form-item">' |
| 1526 | 1511 | . '<label class="placeholder">' |
@@ -1690,8 +1675,7 @@ discard block |
||
| 1690 | 1675 | global $base_url; |
| 1691 | 1676 | if ($edit['language'] != language_default('language')) { |
| 1692 | 1677 | $form_state['redirect'] = $base_url . '/' . $edit['language'] . '/' . $_GET['q']; |
| 1693 | - } |
|
| 1694 | - else { |
|
| 1678 | + } else { |
|
| 1695 | 1679 | $form_state['redirect'] = $base_url . '/' . $_GET['q']; |
| 1696 | 1680 | } |
| 1697 | 1681 | } |
@@ -1882,8 +1866,7 @@ discard block |
||
| 1882 | 1866 | $row[] = drupal_render($form['ignoreblock']['delete'][$key]); |
| 1883 | 1867 | $rows[] = $row; |
| 1884 | 1868 | } |
| 1885 | - } |
|
| 1886 | - else { |
|
| 1869 | + } else { |
|
| 1887 | 1870 | $rows[] = array( |
| 1888 | 1871 | array( |
| 1889 | 1872 | 'data' => bts('You have not added any users to your Ignore List.', array(), NULL, 'boinc:ignore-user-list'), |