@@ -38,8 +38,7 @@ |
||
| 38 | 38 | * |
| 39 | 39 | * @return string |
| 40 | 40 | */ |
| 41 | - function random_bytes($bytes) |
|
| 42 | - { |
|
| 41 | + function random_bytes($bytes) { |
|
| 43 | 42 | try { |
| 44 | 43 | $bytes = RandomCompat_intval($bytes); |
| 45 | 44 | } catch (TypeError $ex) { |
@@ -38,8 +38,7 @@ |
||
| 38 | 38 | * |
| 39 | 39 | * @return string |
| 40 | 40 | */ |
| 41 | - function random_bytes($bytes) |
|
| 42 | - { |
|
| 41 | + function random_bytes($bytes) { |
|
| 43 | 42 | try { |
| 44 | 43 | $bytes = RandomCompat_intval($bytes); |
| 45 | 44 | } catch (TypeError $ex) { |
@@ -99,8 +99,7 @@ |
||
| 99 | 99 | ); |
| 100 | 100 | |
| 101 | 101 | $form['#redirect'] = 'account'; |
| 102 | - } |
|
| 103 | - else { |
|
| 102 | + } else { |
|
| 104 | 103 | $form['noaccount'] = array( |
| 105 | 104 | '#value' => t('No such user with UID: %uid', array('%uid' => $uid)), |
| 106 | 105 | ); |
@@ -94,8 +94,7 @@ discard block |
||
| 94 | 94 | '#prefix' => '<li class="tab">', |
| 95 | 95 | '#suffix' => '</li>', |
| 96 | 96 | ); |
| 97 | - } |
|
| 98 | - else if ( user_access('administer users') ) { |
|
| 97 | + } else if ( user_access('administer users') ) { |
|
| 99 | 98 | $form['delete'] = array( |
| 100 | 99 | '#type' => 'submit', |
| 101 | 100 | '#value' => bts('Delete Account', array(), null, 'boinc:delete-user-account'), |
@@ -104,8 +103,7 @@ discard block |
||
| 104 | 103 | '#prefix' => '<li class="tab">', |
| 105 | 104 | '#suffix' => '</li>', |
| 106 | 105 | ); |
| 107 | - } |
|
| 108 | - else { |
|
| 106 | + } else { |
|
| 109 | 107 | unset($form['delete']); |
| 110 | 108 | } |
| 111 | 109 | break; |
@@ -295,8 +293,7 @@ discard block |
||
| 295 | 293 | // Redirect |
| 296 | 294 | if (!empty($redirect)) { |
| 297 | 295 | drupal_goto($redirect); |
| 298 | - } |
|
| 299 | - else { |
|
| 296 | + } else { |
|
| 300 | 297 | drupal_goto(); |
| 301 | 298 | } |
| 302 | 299 | } |
@@ -429,8 +426,7 @@ discard block |
||
| 429 | 426 | // Redirect |
| 430 | 427 | if (!empty($redirect)) { |
| 431 | 428 | drupal_goto($redirect); |
| 432 | - } |
|
| 433 | - else { |
|
| 429 | + } else { |
|
| 434 | 430 | drupal_goto(); |
| 435 | 431 | } |
| 436 | 432 | |
@@ -174,8 +174,7 @@ |
||
| 174 | 174 | array("agree_to_terms_of_use", "", false), |
| 175 | 175 | ); |
| 176 | 176 | form_checkboxes(tra("Do you agree to the terms of use above?"), $myitems, 'tabindex="0"'); |
| 177 | - } |
|
| 178 | - else { |
|
| 177 | + } else { |
|
| 179 | 178 | // error - no terms of use for user to agree to! |
| 180 | 179 | } |
| 181 | 180 | |
@@ -58,7 +58,7 @@ |
||
| 58 | 58 | //panel(null, 'panel_contents'); |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | -function left(){ |
|
| 61 | +function left() { |
|
| 62 | 62 | global $user, $no_web_account_creation, $master_url, $project_id; |
| 63 | 63 | panel( |
| 64 | 64 | $user?tra("Welcome, %1", $user->name):tra("What is %1?", PROJECT), |
@@ -104,7 +104,7 @@ |
||
| 104 | 104 | // set to 1. |
| 105 | 105 | if ($consent_flag==0) { |
| 106 | 106 | $rc = consent_to_a_policy($user, $ctid, 0, 1, $source); |
| 107 | - } else { |
|
| 107 | + } else { |
|
| 108 | 108 | $rc = consent_to_a_policy($user, $ctid, 1, 0, $source); |
| 109 | 109 | } |
| 110 | 110 | if (!$rc) { |
@@ -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); |