@@ -239,8 +239,7 @@ discard block |
||
239 | 239 | ), WATCHDOG_NOTICE |
240 | 240 | ); |
241 | 241 | } |
242 | - } |
|
243 | - else { |
|
242 | + } else { |
|
244 | 243 | drupal_set_message(t('You are not allowed to assume foundership of this |
245 | 244 | team.' |
246 | 245 | )); |
@@ -265,8 +264,7 @@ discard block |
||
265 | 264 | drupal_set_message(t('@team has been removed.', |
266 | 265 | array('@team' => $boincteam->name))); |
267 | 266 | drupal_goto('community/teams'); |
268 | - } |
|
269 | - else { |
|
267 | + } else { |
|
270 | 268 | drupal_set_message(t('All members must be removed from @team before the |
271 | 269 | team can be deleted.', array('@team' => $boincteam->name)), 'error'); |
272 | 270 | drupal_goto(strstr($_GET['q'], '/delete', TRUE)); |
@@ -500,8 +498,7 @@ discard block |
||
500 | 498 | array('@team' => $boincteam->name))); |
501 | 499 | watchdog('boincteam', 'added user @uid to team @nid', |
502 | 500 | array('@uid' => $user->uid, '@nid' => $team_id), WATCHDOG_NOTICE); |
503 | - } |
|
504 | - else { |
|
501 | + } else { |
|
505 | 502 | drupal_set_message(t('There was a problem joining @team, please try again |
506 | 503 | later', array('@team' => $boincteam->name))); |
507 | 504 | watchdog('boincteam', 'error adding user @uid to team @nid', |
@@ -528,8 +525,7 @@ discard block |
||
528 | 525 | array('@team' => $boincteam->name))); |
529 | 526 | watchdog('boincteam', 'removed user @uid from team @nid', |
530 | 527 | array('@uid' => $user->uid, '@nid' => $team_id), WATCHDOG_NOTICE); |
531 | - } |
|
532 | - else { |
|
528 | + } else { |
|
533 | 529 | drupal_set_message(t('You are not a member of @team, so you cannot revoke |
534 | 530 | your membership to it.', array('@team' => $boincteam->name))); |
535 | 531 | } |
@@ -598,8 +594,7 @@ discard block |
||
598 | 594 | '@uid' => $account->uid, |
599 | 595 | '@nid' => $team_id |
600 | 596 | ), WATCHDOG_NOTICE); |
601 | - } |
|
602 | - else { |
|
597 | + } else { |
|
603 | 598 | drupal_set_message(t('@user is not a member of @team, so you cannot |
604 | 599 | revoke the membership.', array( |
605 | 600 | '@user' => $account->boincuser_name, |
@@ -628,14 +623,12 @@ discard block |
||
628 | 623 | '@user' => $account->boincuser_name |
629 | 624 | ) |
630 | 625 | ), 'warning'); |
631 | - } |
|
632 | - elseif (!boincteam_new_foundership_transfer_request_ok($team_id)) { |
|
626 | + } elseif (!boincteam_new_foundership_transfer_request_ok($team_id)) { |
|
633 | 627 | // It hasn't been long enough since the last transfer request |
634 | 628 | drupal_set_message(t('A foundership change was requested during the last 90 |
635 | 629 | days, so new requests are not allowed. Please try again later.' |
636 | 630 | ), 'warning'); |
637 | - } |
|
638 | - elseif (boincteam_is_member($team_id, $account->uid)) { |
|
631 | + } elseif (boincteam_is_member($team_id, $account->uid)) { |
|
639 | 632 | // Log the transfer request |
640 | 633 | db_set_active('boinc_rw'); |
641 | 634 | db_query(" |
@@ -841,8 +834,7 @@ discard block |
||
841 | 834 | $output .= '['; |
842 | 835 | if ($credit_needed == 1) { |
843 | 836 | $output .= bts('You must earn 1 more credit!', array(), NULL, 'boinc:create-team-panel'); |
844 | - } |
|
845 | - else { |
|
837 | + } else { |
|
846 | 838 | $output .= bts('You must earn @count more credits!', |
847 | 839 | array('@count' => $credit_needed), |
848 | 840 | NULL, 'boinc:create-team-panel' |
@@ -895,8 +887,7 @@ discard block |
||
895 | 887 | $output .= ' <label>' . bts('Total credit', array(), NULL, 'boinc:user-or-team-total-credits') . ': </label>'; |
896 | 888 | $output .= ' <span>' . number_format($team->total_credit, 0) . '</span>'; |
897 | 889 | $output .= '</div>' . "\n"; |
898 | - } |
|
899 | - else if ($user->uid == $account->uid) { |
|
890 | + } else if ($user->uid == $account->uid) { |
|
900 | 891 | $output .= '<h2 class="pane-title">' . bts('Team (None)', array(), NULL, 'boinc:team-dashboard') . '</h2>'; |
901 | 892 | $output .= '<ul class="tab-list action-list">'; |
902 | 893 | $output .= '<li class="tab primary">'; |
@@ -1110,8 +1101,7 @@ discard block |
||
1110 | 1101 | if ($request_age == 1) { |
1111 | 1102 | $output .= bts('1 day has elapsed since your request and' |
1112 | 1103 | . ' the founder has not responded.', array(), NULL, 'boinc:team-request-foundership'); |
1113 | - } |
|
1114 | - else { |
|
1104 | + } else { |
|
1115 | 1105 | $output .= bts('@count days have elapsed since your request and' |
1116 | 1106 | . ' the founder has not responded.', |
1117 | 1107 | array('@count' => $request_age), |
@@ -1121,8 +1111,7 @@ discard block |
||
1121 | 1111 | if ($days_to_respond == 1) { |
1122 | 1112 | $output .= bts('You now have 1 day to assume foundership before' |
1123 | 1113 | . ' another team member may submit a request.', array(), NULL, 'boinc:team-request-foundership'); |
1124 | - } |
|
1125 | - else { |
|
1114 | + } else { |
|
1126 | 1115 | $output .= bts('You now have @count days to assume foundership before' |
1127 | 1116 | . ' another team member may submit a request.', |
1128 | 1117 | array('@count' => $days_to_respond), |
@@ -1133,23 +1122,20 @@ discard block |
||
1133 | 1122 | $output .= ' <li class="first last tab">' . |
1134 | 1123 | l(bts('Assume foundership', array(), NULL, 'boinc:team-request-foundership'), "community/teams/{$team_id}/assume-foundership") . '</li>'; |
1135 | 1124 | $output .= '</ul>'; |
1136 | - } |
|
1137 | - else { |
|
1125 | + } else { |
|
1138 | 1126 | $output .= '<p>'; |
1139 | 1127 | if ($days_to_deadline == 1) { |
1140 | 1128 | $output .= bts('The team founder has 1 day to respond to your' |
1141 | 1129 | . ' transfer request.', |
1142 | 1130 | NULL, 'boinc:team-request-foundership'); |
1143 | - } |
|
1144 | - else { |
|
1131 | + } else { |
|
1145 | 1132 | $output .= bts('The team founder has @count days to respond to your' |
1146 | 1133 | . ' transfer request.', array('@count' => $days_to_deadline), |
1147 | 1134 | NULL, 'boinc:team-request-foundership'); |
1148 | 1135 | } |
1149 | 1136 | $output .= '</p>'; |
1150 | 1137 | } |
1151 | - } |
|
1152 | - elseif (!boincteam_new_foundership_transfer_request_ok($team_id)) { |
|
1138 | + } elseif (!boincteam_new_foundership_transfer_request_ok($team_id)) { |
|
1153 | 1139 | // If this user does not have a transfer request pending, but new requests |
1154 | 1140 | // are not allowed, set the deadline to 90 days instead of 60 (as the user |
1155 | 1141 | // who made the request has 30 additional days to assume foundership if |
@@ -1162,15 +1148,13 @@ discard block |
||
1162 | 1148 | NULL, 'boinc:team-request-foundership'); |
1163 | 1149 | if ($days_to_deadline == 1) { |
1164 | 1150 | $output .= ' (' . bts('1 day remaining', array(), NULL, 'boinc:team-request-foundership') . ')'; |
1165 | - } |
|
1166 | - else { |
|
1151 | + } else { |
|
1167 | 1152 | $output .= ' (' . bts('@count days remaining', |
1168 | 1153 | array('@count' => $days_to_deadline), |
1169 | 1154 | NULL, 'boinc:team-request-foundership') . ')'; |
1170 | 1155 | } |
1171 | 1156 | $output .= '</p>'; |
1172 | - } |
|
1173 | - else { |
|
1157 | + } else { |
|
1174 | 1158 | $output .= '<p>' . bts('If the team founder is not active and you want to' |
1175 | 1159 | . ' assume the role of founder, click below to request foundership of' |
1176 | 1160 | . ' @this_team.', |
@@ -1216,8 +1200,7 @@ discard block |
||
1216 | 1200 | $boincteam_id |
1217 | 1201 | ); |
1218 | 1202 | db_set_active('default'); |
1219 | - } |
|
1220 | - else { |
|
1203 | + } else { |
|
1221 | 1204 | $member = user_load(boincuser_lookup_uid($boincteam->ping_user)); |
1222 | 1205 | $output .= '<h2 class="pane-title">' . bts('Respond to transfer request', array(), NULL, 'boinc:team-request-foundership-response') |
1223 | 1206 | . '</h2>'; |
@@ -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), |
@@ -28,10 +28,10 @@ discard block |
||
28 | 28 | // |
29 | 29 | function show_platforms() { |
30 | 30 | $xmlFragment = unserialize(get_cached_data(3600, "project_config_platform_xml")); |
31 | - if ($xmlFragment==false){ |
|
31 | + if ($xmlFragment==false) { |
|
32 | 32 | $platforms = BoincDB::get()->enum_fields("platform, DBNAME.app_version, DBNAME.app", "BoincPlatform", "platform.name, platform.user_friendly_name, plan_class", "app_version.platformid = platform.id and app_version.appid = app.id and app_version.deprecated=0 and app.deprecated=0 group by platform.name, plan_class", ""); |
33 | 33 | $xmlFragment = " <platforms>"; |
34 | - foreach ($platforms as $platform){ |
|
34 | + foreach ($platforms as $platform) { |
|
35 | 35 | $xmlFragment .= " |
36 | 36 | <platform> |
37 | 37 | <platform_name>$platform->name</platform_name> |
@@ -108,8 +108,7 @@ discard block |
||
108 | 108 | // the terms_of_use.txt file in the project base directory. |
109 | 109 | if (defined('TERMSOFUSE_FILE')) { |
110 | 110 | $tou_file = TERMSOFUSE_FILE; |
111 | -} |
|
112 | -else { |
|
111 | +} else { |
|
113 | 112 | $tou_file = "../../terms_of_use.txt"; |
114 | 113 | } |
115 | 114 | if (file_exists($tou_file)) { |
@@ -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) { |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | if ($host->last_ip_addr != $host->external_ip_addr) { |
91 | 91 | row2(tra("External IP address"), $host->external_ip_addr); |
92 | 92 | } |
93 | - } else { |
|
93 | + } else { |
|
94 | 94 | row2(tra("IP address"), "<a href=show_host_detail.php?hostid=$host->id&ipprivate=1>".tra("Show IP address")."</a>"); |
95 | 95 | } |
96 | 96 | row2(tra("Domain name"), $host->domain_name); |
@@ -258,10 +258,10 @@ discard block |
||
258 | 258 | // "[vbox|5.0.0|1|1]", where now two additional flags give information about |
259 | 259 | // hardware virtualization support. Older clients may have the old-style |
260 | 260 | // serialnum in the DB despite the server being upgraded. |
261 | -function vbox_desc($x){ |
|
262 | - if (preg_match("/\[vbox\|(.*?)(\|([01])\|([01]))?\]/",$x,$matches)){ |
|
261 | +function vbox_desc($x) { |
|
262 | + if (preg_match("/\[vbox\|(.*?)(\|([01])\|([01]))?\]/",$x,$matches)) { |
|
263 | 263 | $desc = "Virtualbox (".$matches[1].") ".tra("installed"); |
264 | - if (sizeof($matches)>2){ |
|
264 | + if (sizeof($matches)>2) { |
|
265 | 265 | if ($matches[3]=="1" and $matches[4]=="1") { |
266 | 266 | return $desc.tra(", CPU has hardware virtualization support and it is enabled"); |
267 | 267 | } elseif ($matches[3]=="1" and $matches[4]=="0") { |
@@ -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; |