Passed
Pull Request — master (#3196)
by Christian
10:54
created
drupal/sites/default/boinc/modules/boincwork/includes/boincwork.forms.inc 1 patch
Braces   +17 added lines, -34 removed lines patch added patch discarded remove patch
@@ -127,8 +127,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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'),
Please login to merge, or discard this patch.
drupal/sites/default/boinc/modules/boincimport/boincimport.module 1 patch
Braces   +91 added lines, -180 removed lines patch added patch discarded remove patch
@@ -172,8 +172,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
     }
@@ -252,8 +249,7 @@  discard block
 block discarded – undo
252 249
       array('!unlock_it' => l(t('release the lock'),
253 250
         'admin/boinc/import/unlock')
254 251
       ), WATCHDOG_WARNING); 
255
-  }
256
-  else {
252
+  } else {
257 253
     $boincimport_functions = array(
258 254
       'users' => t('Import users'),
259 255
       'teams' => t('Import teams'),
@@ -288,8 +284,7 @@  discard block
 block discarded – undo
288 284
   // Lock the import process
289 285
   if (!variable_get('boincimport_process_locked', 0)) {
290 286
     variable_set('boincimport_process_locked', 1);
291
-  }
292
-  else {
287
+  } else {
293 288
     watchdog('boincimport', 'The import process is locked, but another process
294 289
       is trying to access it...', array(), WATCHDOG_WARNING); 
295 290
   }
@@ -303,8 +298,7 @@  discard block
 block discarded – undo
303 298
       boincimport_teams();
304 299
       if (!variable_get('boincimport_import_team_successful', 0)) {
305 300
         $_SESSION['boincimport_stage_selected'] = 'teams';
306
-      }
307
-      else {
301
+      } else {
308 302
         $_SESSION['boincimport_stage_selected'] = 'friends';
309 303
       }
310 304
       break;
@@ -313,8 +307,7 @@  discard block
 block discarded – undo
313 307
       boincimport_friends();
314 308
       if (!variable_get('boincimport_import_friend_successful', 0)) {
315 309
         $_SESSION['boincimport_stage_selected'] = 'friends';
316
-      }
317
-      else {
310
+      } else {
318 311
         $_SESSION['boincimport_stage_selected'] = 'preferences';
319 312
       }
320 313
       break;
@@ -323,8 +316,7 @@  discard block
 block discarded – undo
323 316
       boincimport_preferences();
324 317
       if (!variable_get('boincimport_import_preferences_successful', 0)) {
325 318
         $_SESSION['boincimport_stage_selected'] = 'preferences';
326
-      }
327
-      else {
319
+      } else {
328 320
         $_SESSION['boincimport_stage_selected'] = 'private messages';
329 321
       }
330 322
       break;
@@ -333,8 +325,7 @@  discard block
 block discarded – undo
333 325
       boincimport_private_msgs();
334 326
       if (!variable_get('boincimport_import_private_msg_successful', 0)) {
335 327
         $_SESSION['boincimport_stage_selected'] = 'private messages';
336
-      }
337
-      else {
328
+      } else {
338 329
         $_SESSION['boincimport_stage_selected'] = 'categories';
339 330
       }
340 331
       break;
@@ -343,8 +334,7 @@  discard block
 block discarded – undo
343 334
       boincimport_forum_categories();
344 335
       if (!variable_get('boincimport_import_category_successful', 0)) {
345 336
         $_SESSION['boincimport_stage_selected'] = 'categories';
346
-      }
347
-      else {
337
+      } else {
348 338
         $_SESSION['boincimport_stage_selected'] = 'topics';
349 339
       }
350 340
       break;
@@ -353,8 +343,7 @@  discard block
 block discarded – undo
353 343
       boincimport_forum_topics();
354 344
       if (!variable_get('boincimport_import_topic_successful', 0)) {
355 345
         $_SESSION['boincimport_stage_selected'] = 'topics';
356
-      }
357
-      else {
346
+      } else {
358 347
         $_SESSION['boincimport_stage_selected'] = 'posts';
359 348
       }
360 349
       break;
@@ -363,8 +352,7 @@  discard block
 block discarded – undo
363 352
       boincimport_forum_posts();
364 353
       if (!variable_get('boincimport_import_post_successful', 0)) {
365 354
         $_SESSION['boincimport_stage_selected'] = 'posts';
366
-      }
367
-      else {
355
+      } else {
368 356
         $_SESSION['boincimport_stage_selected'] = 'url';
369 357
       }
370 358
       break;
@@ -373,8 +361,7 @@  discard block
 block discarded – undo
373 361
       boincimport_team_forums();
374 362
       if (!variable_get('boincimport_team_forum_successful', 0)) {
375 363
         $_SESSION['boincimport_stage_selected'] = 'team forums';
376
-      }
377
-      else {
364
+      } else {
378 365
         $_SESSION['boincimport_stage_selected'] = 'team topics';
379 366
       }
380 367
       break;
@@ -383,8 +370,7 @@  discard block
 block discarded – undo
383 370
       boincimport_team_forum_topics();
384 371
       if (!variable_get('boincimport_team_topic_successful', 0)) {
385 372
         $_SESSION['boincimport_stage_selected'] = 'team topics';
386
-      }
387
-      else {
373
+      } else {
388 374
         $_SESSION['boincimport_stage_selected'] = 'team posts';
389 375
       }
390 376
       break;
@@ -393,8 +379,7 @@  discard block
 block discarded – undo
393 379
       boincimport_team_forum_posts();
394 380
       if (!variable_get('boincimport_team_post_successful', 0)) {
395 381
         $_SESSION['boincimport_stage_selected'] = 'team posts';
396
-      }
397
-      else {
382
+      } else {
398 383
         $_SESSION['boincimport_stage_selected'] = 'url';
399 384
       }
400 385
       break;
@@ -403,8 +388,7 @@  discard block
 block discarded – undo
403 388
       boincimport_replace_urls();
404 389
       if (!variable_get('boincimport_replace_url_successful', 0)) {
405 390
         $_SESSION['boincimport_stage_selected'] = 'url';
406
-      }
407
-      else {
391
+      } else {
408 392
         drupal_set_message('Congratulations.  Import Finished');
409 393
         drupal_set_message('Please visit the '. l('Post migration configuration', 'admin/boinc/import/post_configuration') .' page');
410 394
         watchdog('boincimport', 'Import process is complete', array(), WATCHDOG_INFO); 
@@ -473,8 +457,7 @@  discard block
 block discarded – undo
473 457
       ORDER BY id ASC'
474 458
     );
475 459
     $user_count = mysqli_num_rows($boinc_accounts);
476
-  }
477
-  else {
460
+  } else {
478 461
     // Need to import any user who is currently ignored in order to keep them
479 462
     // ignored... not particularly clean (ignored users are stored in a string)
480 463
     $ignored_user_list = array(0);
@@ -550,8 +533,7 @@  discard block
 block discarded – undo
550 533
      if (isset($existing_users[$boinc_account->id])) {
551 534
       // This user has already been imported
552 535
       $duplicates[] = $boinc_account->id;
553
-    }
554
-    else {
536
+    } else {
555 537
       $operations[] = array(
556 538
         'boincimport_users_op', array(
557 539
           $boinc_account->id
@@ -607,8 +589,7 @@  discard block
 block discarded – undo
607 589
     // Store some result for post-processing in the finished callback.
608 590
     $context['results']['success'][] = $boinc_id;
609 591
     $message = "Successfully imported user {$boinc_id}";
610
-  }
611
-  else {
592
+  } else {
612 593
     $context['results']['failure'][] = $boinc_id;
613 594
     $message = "Failed to import user {$boinc_id}!";
614 595
     watchdog('boincimport',
@@ -625,8 +606,7 @@  discard block
 block discarded – undo
625 606
   // Update the progress for the batch engine
626 607
   if ($context['sandbox']['progress'] >= $context['sandbox']['max']) {
627 608
     $context['finished'] = 1;
628
-  }
629
-  else {
609
+  } else {
630 610
     $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
631 611
   }
632 612
 }
@@ -651,8 +631,7 @@  discard block
 block discarded – undo
651 631
     // Set the user import successful flag in the variable table
652 632
     variable_set('boincimport_import_user_successful', '1');
653 633
     $_SESSION['boincimport_stage_selected'] = 'teams';
654
-  }
655
-  else {
634
+  } else {
656 635
     // An error occurred.
657 636
     // $operations contains the operations that remained unprocessed.
658 637
     $error_operation = reset($operations);
@@ -714,8 +693,7 @@  discard block
 block discarded – undo
714 693
         $team_type = array(
715 694
           'tid' => $team_type_id
716 695
         );
717
-      }
718
-      else {
696
+      } else {
719 697
         if (!$name) continue;
720 698
         $team_type = array(
721 699
           'name' => strip_tags($name),
@@ -778,8 +756,7 @@  discard block
 block discarded – undo
778 756
      if (isset($existing_teams[$boinc_team->id])) {
779 757
       // This team has already been imported
780 758
       $duplicates[] = $boinc_team->id;
781
-    }
782
-    else {
759
+    } else {
783 760
       $operations[] = array(
784 761
         'boincimport_teams_op', array(
785 762
           $boinc_team
@@ -820,8 +797,7 @@  discard block
 block discarded – undo
820 797
     // Store some result for post-processing in the finished callback.
821 798
     $context['results']['success'][] = $boincteam->id;
822 799
     $message = "Successfully imported team {$boincteam->id}";
823
-  }
824
-  else {
800
+  } else {
825 801
     $context['results']['failure'][] = $boincteam->id;
826 802
     $message = "Failed to import team {$boincteam->id}!";
827 803
     watchdog('boincimport',
@@ -838,8 +814,7 @@  discard block
 block discarded – undo
838 814
   // Update the progress for the batch engine
839 815
   if ($context['sandbox']['progress'] >= $context['sandbox']['max']) {
840 816
     $context['finished'] = 1;
841
-  }
842
-  else {
817
+  } else {
843 818
     $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
844 819
   }
845 820
 }
@@ -862,8 +837,7 @@  discard block
 block discarded – undo
862 837
     // Set the team import successful flag in the variable table
863 838
     variable_set('boincimport_import_team_successful', '1');
864 839
     $_SESSION['boincimport_stage_selected'] = 'friends';
865
-  }
866
-  else {
840
+  } else {
867 841
     // An error occurred.
868 842
     // $operations contains the operations that remained unprocessed.
869 843
     $error_operation = reset($operations);
@@ -984,8 +958,7 @@  discard block
 block discarded – undo
984 958
       SET uid = '%d', friend_uid = '%d', created = '%d'",
985 959
       $uid, $friend_uid, $friendship->create_time
986 960
     );
987
-  }
988
-  else {
961
+  } else {
989 962
     $boinc_id = ($uid) ? $friendship->user_dest : $friendship->user_src;
990 963
     $message = "No Drupal account exists for BOINC user {$boinc_id}!";
991 964
   }
@@ -994,8 +967,7 @@  discard block
 block discarded – undo
994 967
     // Store some result for post-processing in the finished callback.
995 968
     $context['results']['success'][] = $uid;
996 969
     $message = "Successfully made users {$uid} and {$friend_uid} friends";
997
-  }
998
-  else {
970
+  } else {
999 971
     $context['results']['failure'][] = $uid;
1000 972
     if (!$message) {
1001 973
       $message = "Failed to make users {$uid} and {$friend_uid} friends!";
@@ -1011,8 +983,7 @@  discard block
 block discarded – undo
1011 983
   // Update the progress for the batch engine
1012 984
   if ($context['sandbox']['progress'] >= $context['sandbox']['max']) {
1013 985
     $context['finished'] = 1;
1014
-  }
1015
-  else {
986
+  } else {
1016 987
     $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
1017 988
   }
1018 989
 }
@@ -1036,8 +1007,7 @@  discard block
 block discarded – undo
1036 1007
     // Set the friend import successful flag in the variable table
1037 1008
     variable_set('boincimport_import_friend_successful', '1');
1038 1009
     $_SESSION['boincimport_stage_selected'] = 'preferences';
1039
-  }
1040
-  else {
1010
+  } else {
1041 1011
     // An error occurred.
1042 1012
     // $operations contains the operations that remained unprocessed.
1043 1013
     $error_operation = reset($operations);
@@ -1161,8 +1131,7 @@  discard block
 block discarded – undo
1161 1131
     );
1162 1132
     if ($user_ignored) {
1163 1133
       $success = TRUE;
1164
-    }
1165
-    else {
1134
+    } else {
1166 1135
       $context['results']['warning'][] = "{$uid}:{$ignored_user_uid}";
1167 1136
       watchdog('boincimport',
1168 1137
         'Could not add user @ignored_uid to the ignore list of user @uid',
@@ -1177,8 +1146,7 @@  discard block
 block discarded – undo
1177 1146
     // Store some result for post-processing in the finished callback.
1178 1147
     $context['results']['success'][] = $uid;
1179 1148
     $message = "Successfully imported ignored users for user {$uid}";
1180
-  }
1181
-  else {
1149
+  } else {
1182 1150
     $context['results']['failure'][] = $uid;
1183 1151
     $message = "Failed to import any user filter preferences for user {$uid}!";
1184 1152
     watchdog('boincimport',
@@ -1195,8 +1163,7 @@  discard block
 block discarded – undo
1195 1163
   // Update the progress for the batch engine
1196 1164
   if ($context['sandbox']['progress'] >= $context['sandbox']['max']) {
1197 1165
     $context['finished'] = 1;
1198
-  }
1199
-  else {
1166
+  } else {
1200 1167
     $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
1201 1168
   }
1202 1169
 }
@@ -1221,8 +1188,7 @@  discard block
 block discarded – undo
1221 1188
     // Set the preference import successful flag in the variable table
1222 1189
     variable_set('boincimport_import_preferences_successful', '1');
1223 1190
     $_SESSION['boincimport_stage_selected'] = 'private messages';
1224
-  }
1225
-  else {
1191
+  } else {
1226 1192
     // An error occurred.
1227 1193
     // $operations contains the operations that remained unprocessed.
1228 1194
     $error_operation = reset($operations);
@@ -1356,8 +1322,7 @@  discard block
 block discarded – undo
1356 1322
     // Store some result for post-processing in the finished callback.
1357 1323
     $context['results']['success'][] = $pm->id;
1358 1324
     $message = "Successfully imported private message {$pm->id}";
1359
-  }
1360
-  else {
1325
+  } else {
1361 1326
     $context['results']['failure'][] = $pm->id;
1362 1327
     $message = "Failed to import private message {$pm->id}!";
1363 1328
     watchdog('boincimport',
@@ -1374,8 +1339,7 @@  discard block
 block discarded – undo
1374 1339
   // Update the progress for the batch engine
1375 1340
   if ($context['sandbox']['progress'] >= $context['sandbox']['max']) {
1376 1341
     $context['finished'] = 1;
1377
-  }
1378
-  else {
1342
+  } else {
1379 1343
     $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
1380 1344
   }
1381 1345
 }
@@ -1398,8 +1362,7 @@  discard block
 block discarded – undo
1398 1362
     // Set the private message import successful flag in the variable table
1399 1363
     variable_set('boincimport_import_private_msg_successful', '1');
1400 1364
     $_SESSION['boincimport_stage_selected'] = 'categories';
1401
-  }
1402
-  else {
1365
+  } else {
1403 1366
     // An error occurred.
1404 1367
     // $operations contains the operations that remained unprocessed.
1405 1368
     $error_operation = reset($operations);
@@ -1552,8 +1515,7 @@  discard block
 block discarded – undo
1552 1515
     if (in_array($boinc_forum_category->name, $existing_categories)) {
1553 1516
       // This category has already been imported
1554 1517
       $duplicate_categories[] = $boinc_forum_category->name;
1555
-    }
1556
-    else {
1518
+    } else {
1557 1519
       $operations[] = array(
1558 1520
         'boincimport_forum_categories_op', array(
1559 1521
           $boinc_forum_category, $forum_vid, $pre, FALSE
@@ -1567,8 +1529,7 @@  discard block
 block discarded – undo
1567 1529
      if (isset($existing_forums[$boinc_forum->id])) {
1568 1530
       // This forum has already been imported
1569 1531
       $duplicates[] = $boinc_forum->id;
1570
-    }
1571
-    else {
1532
+    } else {
1572 1533
       $operations[] = array(
1573 1534
         'boincimport_forums_op', array(
1574 1535
           $boinc_forum, $forum_vid, $pre
@@ -1635,8 +1596,7 @@  discard block
 block discarded – undo
1635 1596
     $category->name = 'Hidden';
1636 1597
     $category->id = 0;
1637 1598
     $hidden = TRUE;
1638
-  }
1639
-  else {
1599
+  } else {
1640 1600
     // If this container is empty, put it into the hidden container
1641 1601
     db_set_active('boinc_rw');
1642 1602
     $forums_contained = db_result(db_query('
@@ -1679,13 +1639,11 @@  discard block
 block discarded – undo
1679 1639
     // Store some result for post-processing in the finished callback.
1680 1640
     if (!$category AND $create_hidden) {
1681 1641
       $message = "Created special hidden container";
1682
-    }
1683
-    else {
1642
+    } else {
1684 1643
       $context['results']['categories']['success'][] = $category->id;
1685 1644
       $message = "Successfully imported container {$category->id}";
1686 1645
     }
1687
-  }
1688
-  else {
1646
+  } else {
1689 1647
     $context['results']['categories']['failure'][] = $category->id;
1690 1648
     $message = "Failed to import container {$category->id}!";
1691 1649
     watchdog('boincimport',
@@ -1702,8 +1660,7 @@  discard block
 block discarded – undo
1702 1660
   // Update the progress for the batch engine
1703 1661
   if ($context['sandbox']['progress'] >= $context['sandbox']['max']) {
1704 1662
     $context['finished'] = 1;
1705
-  }
1706
-  else {
1663
+  } else {
1707 1664
     $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
1708 1665
   }
1709 1666
 }
@@ -1739,8 +1696,7 @@  discard block
 block discarded – undo
1739 1696
     // Save the ID of the News forum for later import
1740 1697
     variable_set('boincimport_news_forum_id', $forum_id);
1741 1698
     $success = TRUE;
1742
-  }
1743
-  else {
1699
+  } else {
1744 1700
     // Save all other forums as taxonomy terms
1745 1701
     $forum = array(
1746 1702
       'name' => $name,
@@ -1766,8 +1722,7 @@  discard block
 block discarded – undo
1766 1722
     // Store some result for post-processing in the finished callback.
1767 1723
     $context['results']['forums']['success'][] = $forum_id;
1768 1724
     $message = "Successfully imported forum {$forum_id}";
1769
-  }
1770
-  else {
1725
+  } else {
1771 1726
     $context['results']['forums']['failure'][] = $forum_id;
1772 1727
     $message = "Failed to import forum {$forum_id}!";
1773 1728
   }
@@ -1780,8 +1735,7 @@  discard block
 block discarded – undo
1780 1735
   // Update the progress for the batch engine
1781 1736
   if ($context['sandbox']['progress'] >= $context['sandbox']['max']) {
1782 1737
     $context['finished'] = 1;
1783
-  }
1784
-  else {
1738
+  } else {
1785 1739
     $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
1786 1740
   }
1787 1741
 }
@@ -1882,8 +1836,7 @@  discard block
 block discarded – undo
1882 1836
     // Set the forum import successful flag in the variable table
1883 1837
     variable_set('boincimport_import_forum_successful', '1');
1884 1838
     $_SESSION['boincimport_stage_selected'] = 'topics';
1885
-  }
1886
-  else {
1839
+  } else {
1887 1840
     // An error occurred.
1888 1841
     // $operations contains the operations that remained unprocessed.
1889 1842
     $error_operation = reset($operations);
@@ -2037,9 +1990,7 @@  discard block
 block discarded – undo
2037 1990
     
2038 1991
     if ($duplicate OR !$post) {
2039 1992
       $success = FALSE;
2040
-    }
2041
-    
2042
-    else {
1993
+    } else {
2043 1994
       // Get the user and term IDs along with other data to define the topic
2044 1995
       $uid = boincuser_lookup_uid($topic->owner);
2045 1996
       $tid = db_result(db_query('
@@ -2103,12 +2054,10 @@  discard block
 block discarded – undo
2103 2054
           if (!$success) {
2104 2055
             $error_detail = 'topic imported, but failed to set last comment timestamp';
2105 2056
           }
2106
-        }
2107
-        else {
2057
+        } else {
2108 2058
           $error_detail = 'topic node saved, but failed to link in boincimport_temp_topic table';
2109 2059
         }
2110
-      }
2111
-      else {
2060
+      } else {
2112 2061
         $error_detail = 'failed to save topic node to database';
2113 2062
       }
2114 2063
     }
@@ -2119,16 +2068,13 @@  discard block
 block discarded – undo
2119 2068
       // Store some result for post-processing in the finished callback.
2120 2069
       $context['results']['success'][] = $topic->id;
2121 2070
       $message = "Successfully imported topic {$topic->id}";
2122
-    }
2123
-    elseif ($duplicate) {
2071
+    } elseif ($duplicate) {
2124 2072
       $context['results']['duplicate'][] = $topic->id;
2125 2073
       $message = "Topic {$topic->id} was already imported";
2126
-    }
2127
-    elseif (!$post) {
2074
+    } elseif (!$post) {
2128 2075
       $context['results']['empty'][] = $topic->id;
2129 2076
       $message = "Skipping topic {$topic->id} as empty";
2130
-    }
2131
-    else {
2077
+    } else {
2132 2078
       $context['results']['failure'][] = $topic->id;
2133 2079
       $message = "Failed to import topic {$topic->id}!";
2134 2080
       watchdog('boincimport',
@@ -2149,8 +2095,7 @@  discard block
 block discarded – undo
2149 2095
     // Update the progress for the batch engine
2150 2096
     if ($context['sandbox']['progress'] >= $context['sandbox']['max']) {
2151 2097
       $context['finished'] = 1;
2152
-    }
2153
-    else {
2098
+    } else {
2154 2099
       $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
2155 2100
     }
2156 2101
   }
@@ -2184,8 +2129,7 @@  discard block
 block discarded – undo
2184 2129
     // Set the topic import successful flag in the variable table
2185 2130
     variable_set('boincimport_import_topic_successful', '1');
2186 2131
     $_SESSION['boincimport_stage_selected'] = 'posts';
2187
-  }
2188
-  else {
2132
+  } else {
2189 2133
     // An error occurred.
2190 2134
     // $operations contains the operations that remained unprocessed.
2191 2135
     $error_operation = reset($operations);
@@ -2433,18 +2377,15 @@  discard block
 block discarded – undo
2433 2377
           if ($success) {
2434 2378
             $posts_imported++;
2435 2379
             $context['results']['posts']['success'][] = $post->id;
2436
-          }
2437
-          else {
2380
+          } else {
2438 2381
             $context['results']['posts']['failure'][] = $post->id;
2439 2382
             $error_posts++;
2440 2383
           }
2441
-        }
2442
-        else {
2384
+        } else {
2443 2385
           $context['results']['posts']['failure'][] = $post->id;
2444 2386
           $error_posts++;
2445 2387
         }
2446
-      }
2447
-      else {
2388
+      } else {
2448 2389
         $context['results']['posts']['empty'][] = $post->id;
2449 2390
         $empty_posts++;
2450 2391
       }
@@ -2455,8 +2396,7 @@  discard block
 block discarded – undo
2455 2396
       // Store some result for post-processing in the finished callback.
2456 2397
       $context['results']['success'][] = $boinc_topic->id;
2457 2398
       $message = "Imported {$posts_imported} post(s) for topic {$boinc_topic->id}";
2458
-    }
2459
-    else {
2399
+    } else {
2460 2400
       $context['results']['failure'][] = $boinc_topic->id;
2461 2401
       $message = "Failed to import any posts for topic {$boinc_topic->id} (excluded {$error_posts} errors, {$duplicate_posts} duplicates, and {$empty_posts} empty)";
2462 2402
       watchdog('boincimport', 'Failed to import any posts for topic @id (excluded @error_posts errors, @duplicate_posts duplicates, and @empty_posts empty)', 
@@ -2477,8 +2417,7 @@  discard block
 block discarded – undo
2477 2417
     // Update the progress for the batch engine
2478 2418
     if ($context['sandbox']['progress'] >= $context['sandbox']['max']) {
2479 2419
       $context['finished'] = 1;
2480
-    }
2481
-    else {
2420
+    } else {
2482 2421
       $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
2483 2422
     }
2484 2423
   }
@@ -2518,8 +2457,7 @@  discard block
 block discarded – undo
2518 2457
     // Set the post import successful flag in the variable table
2519 2458
     variable_set('boincimport_import_post_successful', '1');
2520 2459
     $_SESSION['boincimport_stage_selected'] = 'team forums';
2521
-  }
2522
-  else {
2460
+  } else {
2523 2461
     // An error occurred.
2524 2462
     // $operations contains the operations that remained unprocessed.
2525 2463
     $error_operation = reset($operations);
@@ -2606,8 +2544,7 @@  discard block
 block discarded – undo
2606 2544
      if (isset($existing_team_forums[$boincteam_forum->id])) {
2607 2545
       // This team has already been imported
2608 2546
       $duplicates[] = $boincteam_forum->id;
2609
-    }
2610
-    else {
2547
+    } else {
2611 2548
       $operations[] = array(
2612 2549
         'boincimport_team_forums_op', array(
2613 2550
           $boincteam_forum
@@ -2673,8 +2610,7 @@  discard block
 block discarded – undo
2673 2610
     // Store some result for post-processing in the finished callback.
2674 2611
     $context['results']['success'][] = $forum_id;
2675 2612
     $message = "Successfully imported team forum {$forum_id}";
2676
-  }
2677
-  else {
2613
+  } else {
2678 2614
     $context['results']['failure'][] = $forum_id;
2679 2615
     $message = "Failed to import team forum {$forum_id}!";
2680 2616
     watchdog('boincimport',
@@ -2691,8 +2627,7 @@  discard block
 block discarded – undo
2691 2627
   // Update the progress for the batch engine
2692 2628
   if ($context['sandbox']['progress'] >= $context['sandbox']['max']) {
2693 2629
     $context['finished'] = 1;
2694
-  }
2695
-  else {
2630
+  } else {
2696 2631
     $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
2697 2632
   }
2698 2633
 }
@@ -2715,8 +2650,7 @@  discard block
 block discarded – undo
2715 2650
     // Set the team forum import successful flag in the variable table
2716 2651
     variable_set('boincimport_import_team_forum_successful', '1');
2717 2652
     $_SESSION['boincimport_stage_selected'] = 'team topics';
2718
-  }
2719
-  else {
2653
+  } else {
2720 2654
     // An error occurred.
2721 2655
     // $operations contains the operations that remained unprocessed.
2722 2656
     $error_operation = reset($operations);
@@ -2811,8 +2745,7 @@  discard block
 block discarded – undo
2811 2745
      if (isset($existing_team_topics[$boincteam_topic->id])) {
2812 2746
       // This team topic has already been imported
2813 2747
       $duplicates[] = $boincteam_topic->id;
2814
-    }
2815
-    else {
2748
+    } else {
2816 2749
       $operations[] = array(
2817 2750
         'boincimport_team_topics_op', array(
2818 2751
           $boincteam_topic
@@ -2859,8 +2792,7 @@  discard block
 block discarded – undo
2859 2792
   ));
2860 2793
   if (!$team_forum_id) {
2861 2794
     $missing_parent[] = $topic->id;
2862
-  }
2863
-  else {
2795
+  } else {
2864 2796
     // Get the content of the post that started the topic
2865 2797
     db_set_active('boinc_rw');
2866 2798
     $query = db_query('
@@ -2877,8 +2809,7 @@  discard block
 block discarded – undo
2877 2809
       // Empty topics should have already been filtered out of the import, so
2878 2810
       // consider this an error condition
2879 2811
       $empty_topics[] = $topic->id;
2880
-    }
2881
-    else {
2812
+    } else {
2882 2813
       // Get the user ID along with other data to define the topic
2883 2814
       $uid = boincuser_lookup_uid($topic->owner);
2884 2815
        if (!$topic->owner) {
@@ -2942,8 +2873,7 @@  discard block
 block discarded – undo
2942 2873
     // Store some result for post-processing in the finished callback.
2943 2874
     $context['results']['success'][] = $topic->id;
2944 2875
     $message = "Successfully imported team topic {$topic->id}";
2945
-  }
2946
-  else {
2876
+  } else {
2947 2877
     $context['results']['failure'][] = $topic->id;
2948 2878
     $message = "Failed to import team topic {$topic->id}!";
2949 2879
     watchdog('boincimport',
@@ -2960,8 +2890,7 @@  discard block
 block discarded – undo
2960 2890
   // Update the progress for the batch engine
2961 2891
   if ($context['sandbox']['progress'] >= $context['sandbox']['max']) {
2962 2892
     $context['finished'] = 1;
2963
-  }
2964
-  else {
2893
+  } else {
2965 2894
     $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
2966 2895
   }
2967 2896
 }
@@ -2984,8 +2913,7 @@  discard block
 block discarded – undo
2984 2913
     // Set the BLAH import successful flag in the variable table
2985 2914
     variable_set('boincimport_import_team_topic_successful', '1');
2986 2915
     $_SESSION['boincimport_stage_selected'] = 'team posts';
2987
-  }
2988
-  else {
2916
+  } else {
2989 2917
     // An error occurred.
2990 2918
     // $operations contains the operations that remained unprocessed.
2991 2919
     $error_operation = reset($operations);
@@ -3107,8 +3035,7 @@  discard block
 block discarded – undo
3107 3035
       if (isset($existing_posts[$boincteam_post->id])) {
3108 3036
         // This post has already been imported
3109 3037
         $duplicates[] = $boincteam_post->id;
3110
-      }
3111
-      else {
3038
+      } else {
3112 3039
         $operations[] = array(
3113 3040
           'boincimport_team_posts_op', array(
3114 3041
             $boincteam_post
@@ -3224,8 +3151,7 @@  discard block
 block discarded – undo
3224 3151
     // Store some result for post-processing in the finished callback.
3225 3152
     $context['results']['success'][] = $post->id;
3226 3153
     $message = "Successfully imported team post {$post->id}";
3227
-  }
3228
-  else {
3154
+  } else {
3229 3155
     $context['results']['failure'][] = $post->id;
3230 3156
     $message = "Failed to import team post {$post->id}!";
3231 3157
     watchdog('boincimport',
@@ -3242,8 +3168,7 @@  discard block
 block discarded – undo
3242 3168
   // Update the progress for the batch engine
3243 3169
   if ($context['sandbox']['progress'] >= $context['sandbox']['max']) {
3244 3170
     $context['finished'] = 1;
3245
-  }
3246
-  else {
3171
+  } else {
3247 3172
     $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
3248 3173
   }
3249 3174
 }
@@ -3266,8 +3191,7 @@  discard block
 block discarded – undo
3266 3191
     // Set the team post import successful flag in the variable table
3267 3192
     variable_set('boincimport_import_team_post_successful', '1');
3268 3193
     $_SESSION['boincimport_stage_selected'] = 'url';
3269
-  }
3270
-  else {
3194
+  } else {
3271 3195
     // An error occurred.
3272 3196
     // $operations contains the operations that remained unprocessed.
3273 3197
     $error_operation = reset($operations);
@@ -3373,8 +3297,7 @@  discard block
 block discarded – undo
3373 3297
     $context['results']['success'][] = $boincuser_id;
3374 3298
     $context['results']['subscriptions'][$boincuser_id] = $count;
3375 3299
     $message = "Successfully imported {$count} subscriptions for user {$boincuser_id}";
3376
-  }
3377
-  else {
3300
+  } else {
3378 3301
     $context['results']['failure'][] = $boincuser_id;
3379 3302
     $message = "Failed to import subscriptions for user {$boincuser_id}!";
3380 3303
     watchdog('boincimport',
@@ -3391,8 +3314,7 @@  discard block
 block discarded – undo
3391 3314
   // Update the progress for the batch engine
3392 3315
   if ($context['sandbox']['progress'] >= $context['sandbox']['max']) {
3393 3316
     $context['finished'] = 1;
3394
-  }
3395
-  else {
3317
+  } else {
3396 3318
     $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
3397 3319
   }
3398 3320
 }
@@ -3417,8 +3339,7 @@  discard block
 block discarded – undo
3417 3339
     // Set the subscription import successful flag in the variable table
3418 3340
     variable_set('boincimport_import_subscription_successful', '1');
3419 3341
     $_SESSION['boincimport_stage_selected'] = 'url';
3420
-  }
3421
-  else {
3342
+  } else {
3422 3343
     // An error occurred.
3423 3344
     // $operations contains the operations that remained unprocessed.
3424 3345
     $error_operation = reset($operations);
@@ -3596,8 +3517,7 @@  discard block
 block discarded – undo
3596 3517
       // Store some result for post-processing in the finished callback.
3597 3518
       $context['results']['nodes']['updated'][] = $node->nid;
3598 3519
       $message = "Successfully updated node {$node->nid}";
3599
-    }
3600
-    else {
3520
+    } else {
3601 3521
       $message = "No changes made to node {$node->nid}!";
3602 3522
     }
3603 3523
     
@@ -3609,8 +3529,7 @@  discard block
 block discarded – undo
3609 3529
     // Update the progress for the batch engine
3610 3530
     if ($context['sandbox']['progress'] >= $context['sandbox']['max']) {
3611 3531
       $context['finished'] = 1;
3612
-    }
3613
-    else {
3532
+    } else {
3614 3533
       $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
3615 3534
     }
3616 3535
   }
@@ -3660,8 +3579,7 @@  discard block
 block discarded – undo
3660 3579
       // Store some result for post-processing in the finished callback.
3661 3580
       $context['results']['comments']['updated'][] = $comment->cid;
3662 3581
       $message = "Successfully updated comment {$comment->cid}";
3663
-    }
3664
-    else {
3582
+    } else {
3665 3583
       $message = "No changes made to comment {$comment->cid}!";
3666 3584
     }
3667 3585
     
@@ -3673,8 +3591,7 @@  discard block
 block discarded – undo
3673 3591
     // Update the progress for the batch engine
3674 3592
     if ($context['sandbox']['progress'] >= $context['sandbox']['max']) {
3675 3593
       $context['finished'] = 1;
3676
-    }
3677
-    else {
3594
+    } else {
3678 3595
       $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
3679 3596
     }
3680 3597
   }
@@ -3723,8 +3640,7 @@  discard block
 block discarded – undo
3723 3640
       // Store some result for post-processing in the finished callback.
3724 3641
       $context['results']['pm']['updated'][] = $pm->mid;
3725 3642
       $message = "Successfully updated private message {$pm->mid}";
3726
-    }
3727
-    else {
3643
+    } else {
3728 3644
       $message = "No changes made to private message {$pm->mid}!";
3729 3645
     }
3730 3646
     
@@ -3736,8 +3652,7 @@  discard block
 block discarded – undo
3736 3652
     // Update the progress for the batch engine
3737 3653
     if ($context['sandbox']['progress'] >= $context['sandbox']['max']) {
3738 3654
       $context['finished'] = 1;
3739
-    }
3740
-    else {
3655
+    } else {
3741 3656
       $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
3742 3657
     }
3743 3658
   }
@@ -3802,8 +3717,7 @@  discard block
 block discarded – undo
3802 3717
     // Set the replace URLs successful flag in the variable table
3803 3718
     variable_set('boincimport_replace_urls_successful', '1');
3804 3719
     $_SESSION['boincimport_stage_selected'] = 'users';
3805
-  }
3806
-  else {
3720
+  } else {
3807 3721
     // An error occurred.
3808 3722
     // $operations contains the operations that remained unprocessed.
3809 3723
     $error_operation = reset($operations);
@@ -3905,7 +3819,8 @@  discard block
 block discarded – undo
3905 3819
   $score = 0; // 0 default value, comments get higher score depending on the author's roles
3906 3820
   $users = serialize(array(0 => 1));  // default value for everybody!!
3907 3821
   
3908
-  if ($edit['uid'] === $user->uid) { // '===' because we want to modify anonymous users too
3822
+  if ($edit['uid'] === $user->uid) {
3823
+// '===' because we want to modify anonymous users too
3909 3824
     $edit['name'] = $user->name;
3910 3825
   }
3911 3826
 
@@ -4028,13 +3943,11 @@  discard block
 block discarded – undo
4028 3943
       if (isset($this->boincDomains[$domain])) {
4029 3944
         // This is a URL configured to be transformed
4030 3945
         return "{$http}://{$this->drupalDomain}{$this->basePath}";
4031
-      }
4032
-      else {
3946
+      } else {
4033 3947
         // This URL should not be transformed
4034 3948
         return NULL;
4035 3949
       }
4036
-    }
4037
-    else {
3950
+    } else {
4038 3951
       // This is a relative URL
4039 3952
       return $this->basePath;
4040 3953
     }
@@ -4056,8 +3969,7 @@  discard block
 block discarded – undo
4056 3969
       ));
4057 3970
       if ($id) {
4058 3971
         $link = "{$newBaseUrl}goto/comment/{$id}";
4059
-      }
4060
-      else {
3972
+      } else {
4061 3973
         // This post is not in the post import table, so it's probably a topic
4062 3974
         $link = $this->transformTopicLinks($matches);
4063 3975
       }
@@ -4081,8 +3993,7 @@  discard block
 block discarded – undo
4081 3993
       ));
4082 3994
       if ($id) {
4083 3995
         $link = "{$newBaseUrl}goto/comment/{$id}";
4084
-      }
4085
-      else {
3996
+      } else {
4086 3997
         // This post is not in the post import table, so it's probably a topic
4087 3998
         $link = $this->transformTopicLinks($matches);
4088 3999
       }
Please login to merge, or discard this patch.
drupal/sites/default/boinc/modules/boincteam/boincteam.module 1 patch
Braces   +17 added lines, -34 removed lines patch added patch discarded remove patch
@@ -258,8 +258,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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>';
Please login to merge, or discard this patch.
drupal/sites/default/boinc/modules/boincteam/includes/boincteam.forms.inc 1 patch
Braces   +11 added lines, -22 removed lines patch added patch discarded remove patch
@@ -135,8 +135,7 @@  discard block
 block discarded – undo
135 135
   
136 136
   if (!$name) {
137 137
     form_set_error('name', bts('Team name is required.', array(), NULL, 'boinc:team-create/edit'));
138
-  }
139
-  else {
138
+  } else {
140 139
     require_boinc('boinc_db');
141 140
     if (BoincTeam::lookup_name($name)) {
142 141
       form_set_error('name', bts('A team named "@name" already exists.',
@@ -177,8 +176,7 @@  discard block
 block discarded – undo
177 176
   if ($boinc_team) {
178 177
     $boinc_user = BoincUser::lookup_id($account->boincuser_id);
179 178
     user_join_team($boinc_team, $boinc_user);
180
-  }
181
-  else {
179
+  } else {
182 180
     drupal_set_message(t('Teams cannot be created at this time. The @project administrators have been notified.', array('@project' => PROJECT)));
183 181
     rules_invoke_event('boincteam_create_team_error', $values['name'], variable_get('boinc_admin_mailing_list_subject_tag', ''));
184 182
     watchdog('BOINC team', 'BOINC teams cannot be created for an unknown
@@ -212,8 +210,7 @@  discard block
 block discarded – undo
212 210
   if (module_exists('pathauto')) {
213 211
     module_load_include('inc', 'pathauto', 'pathauto');
214 212
     $node['path'] = pathauto_cleanstring($values['name']);
215
-  }
216
-  else {
213
+  } else {
217 214
     drupal_set_message(t('Teams cannot be created at this time. The @project administrators have been notified.', array('@project' => PROJECT)));
218 215
     rules_invoke_event('boincteam_create_team_nopathauto_error', $values['name'], variable_get('boinc_admin_mailing_list_subject_tag', ''));
219 216
     watchdog('BOINC team', 'BOINC teams require the Pathauto module. Teams
@@ -381,8 +378,7 @@  discard block
 block discarded – undo
381 378
     $form['form control tabs'] = array(
382 379
       '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), strstr($_GET['q'], '/edit', TRUE)) . '</li>'
383 380
     );
384
-  }
385
-  else {
381
+  } else {
386 382
     $form['description'] = array(
387 383
       '#prefix' => '<div class="form-item"><label>' . bts('Description', array(), NULL, 'boinc:team-description') . ':</label></div><div class="form-item">',
388 384
       '#value' => $default['description'],
@@ -412,12 +408,10 @@  discard block
 block discarded – undo
412 408
   
413 409
   if ($form_state['storage']['is_boinc_wide']) {
414 410
     form_set_error('none', bts('This team is managed by the BOINC-wide teams system and cannot be updated here.', array(), NULL, 'boinc:team-create/edit'));
415
-  }
416
-  else {
411
+  } else {
417 412
     if (!$name) {
418 413
       form_set_error('name', bts('Team name is required.', array(), NULL, 'boinc:team-create/edit'));
419
-    }
420
-    else {
414
+    } else {
421 415
       $team = node_load($form_state['storage']['team_id']);
422 416
       if ($name != $team->title) {
423 417
         // If changing the name ("title" in Drupal terms), check that the new name is available
@@ -559,8 +553,7 @@  discard block
 block discarded – undo
559 553
   
560 554
   if (!$values['username']) {
561 555
     form_set_error('username', bts('BOINC username is required.', array(), NULL, 'boinc:team-add-admin'));
562
-  }
563
-  else {
556
+  } else {
564 557
     // Load user account associated with username
565 558
     $account = boincuser_privatemsg_name_lookup($values['username']);
566 559
     // Validate the account
@@ -570,24 +563,21 @@  discard block
 block discarded – undo
570 563
           '@username' => $account->boincuser_name
571 564
         ),
572 565
       NULL, 'boinc:team-add-admin'));
573
-    }
574
-    elseif (boincteam_is_founder($team_id, $account->uid)) {
566
+    } elseif (boincteam_is_founder($team_id, $account->uid)) {
575 567
       form_set_error('username', bts('@user is the founder of @team! Team founder already have all admin privileges.',
576 568
         array(
577 569
           '@user' => $account->boincuser_name,
578 570
           '@team' => $team->title,
579 571
         ),
580 572
         NULL, 'boinc:team-add-admin'));
581
-    }
582
-    elseif (boincteam_is_admin($team_id, $account->uid)) {
573
+    } elseif (boincteam_is_admin($team_id, $account->uid)) {
583 574
       form_set_error('username', bts('@user is already an admin of @team.',
584 575
         array(
585 576
           '@user' => $account->boincuser_name,
586 577
           '@team' => $team->title,
587 578
         ),
588 579
         NULL, 'boinc:team-add-admin'));
589
-    }
590
-    else {
580
+    } else {
591 581
       $form_state['storage']['boincuser_id'] = $account->boincuser_id;
592 582
       $form_state['storage']['boincuser_name'] = $account->boincuser_name;
593 583
     }
@@ -645,8 +635,7 @@  discard block
 block discarded – undo
645 635
   if (isset($form_state['values'])) {
646 636
     $subject   = $form_state['values']['subject'];
647 637
     $body      = $form_state['values']['body'];
648
-  }
649
-  else {
638
+  } else {
650 639
     $subject   = '';
651 640
     $body      = '';
652 641
   }
Please login to merge, or discard this patch.
drupal/sites/default/boinc/modules/boincuser/includes/boincuser.helpers.inc 1 patch
Braces   +11 added lines, -22 removed lines patch added patch discarded remove patch
@@ -71,8 +71,7 @@  discard block
 block discarded – undo
71 71
       unset($account->roles[$unrestricted_role]);
72 72
     }
73 73
     user_save($account, array('roles' => $account->roles));
74
-  }
75
-  else {
74
+  } else {
76 75
     if (!isset($account->roles[$community_role])) {
77 76
       // The user should be a 'community member' role. If the user was
78 77
       // previously banned, this will restore that role.
@@ -88,8 +87,7 @@  discard block
 block discarded – undo
88 87
         $account->roles[$unrestricted_role] = 'verified contributor';
89 88
         user_save($account, array('roles' => $account->roles));
90 89
       }
91
-    }
92
-    else {
90
+    } else {
93 91
       drupal_set_message(bts(
94 92
         'You must earn @count more credits to be able to post comments on this site and create or modify your user profile.',
95 93
         array('@count' => $min_credit_to_post - $account->boincuser_total_credit)
@@ -175,12 +173,10 @@  discard block
 block discarded – undo
175 173
       if ($never_been_picked) {
176 174
         // Allow users who have been previously selected
177 175
         $never_been_picked = FALSE;
178
-      }
179
-      elseif ($active_users) {
176
+      } elseif ($active_users) {
180 177
         // Allow users who are not even active (getting desperate)
181 178
         $active_users = FALSE;
182
-      }
183
-      else {
179
+      } else {
184 180
         // Process failed...
185 181
         return FALSE;
186 182
       }
@@ -235,8 +231,7 @@  discard block
 block discarded – undo
235 231
     $graf1 = "Your email address was changed from {$prev_email} to {$new_email} "
236 232
       . "on {$changedate}. If you need to reverse this change, please look for "
237 233
       . "an email send to the email address: {$prev_email}.\n";
238
-  }
239
-  else {
234
+  } else {
240 235
     $graf1 = "Your email address was changed from {$prev_email} to {$new_email} "
241 236
       . "on {$changedate}. You will not be able to change your email address "
242 237
       . "until {$newdate}. If you need to reverse this change, please look for "
@@ -357,8 +352,7 @@  discard block
 block discarded – undo
357 352
       rules_invoke_event('boincuser_general_consent_error', variable_get('boinc_admin_mailing_list_subject_tag', ''));
358 353
     }
359 354
     return $rc1;
360
-  }
361
-  else {
355
+  } else {
362 356
     drupal_set_message(
363 357
       bts('ERROR: Consent type for enrollment not found. The @project administrators have been nofitifed.',
364 358
         array('@project' => variable_get('site_name', 'Drupal-BOINC')), NULL, 'boinc:consent-termsofuse'),
@@ -399,8 +393,7 @@  discard block
 block discarded – undo
399 393
   // If boincid or token is not present, then go to the home page.
400 394
   if (empty($params['boincid']) or empty($params['token'])) {
401 395
     $redirect = '';
402
-  }
403
-  else {
396
+  } else {
404 397
     $uid = boincuser_lookup_uid($params['boincid']);
405 398
     $redirect = "/user/${uid}/recoveremail/${params['token']}";
406 399
   }
@@ -451,8 +444,7 @@  discard block
 block discarded – undo
451 444
   $dir = "boinc_{$type}_dir";
452 445
   if ($include_dir = variable_get("boinc_{$type}_dir", '')) {
453 446
     return $include_dir;
454
-  }
455
-  else {
447
+  } else {
456 448
     // Don't show errors on blacklisted pages
457 449
     $page_blacklist = array(
458 450
       'admin/boinc/environment'
@@ -465,8 +457,7 @@  discard block
 block discarded – undo
465 457
         drupal_set_message(t('The BOINC environment is not configured. Please
466 458
           !configure_it', array('!configure_it' => l(t('configure it now'),
467 459
             'admin/boinc/environment'))), 'warning', FALSE);
468
-      }
469
-      else {
460
+      } else {
470 461
         drupal_set_message(t('There is a problem with the site. Please contact
471 462
           the system administrator.'), 'error', FALSE);
472 463
       }
@@ -481,8 +472,7 @@  discard block
 block discarded – undo
481 472
       if (!in_array($_GET['q'], $redirect_blacklist)) {
482 473
         drupal_goto('');
483 474
       }
484
-    }
485
-    else {
475
+    } else {
486 476
       // Clear the messages on the environment config page
487 477
       drupal_get_messages();
488 478
     }
@@ -501,8 +491,7 @@  discard block
 block discarded – undo
501 491
   );
502 492
   if ($url_config = variable_get('boinc_scheduler_urls', '')) {
503 493
     return explode("\r\n", $url_config);
504
-  }
505
-  elseif (!in_array($_GET['q'], $page_blacklist)) {
494
+  } elseif (!in_array($_GET['q'], $page_blacklist)) {
506 495
     watchdog('boincuser', 'The BOINC scheduling server settings are not yet
507 496
         configured. Please !verify for the settings to become effective.',
508 497
           array('!verify' => l(t('verify the default values') . ' <strong>' . 
Please login to merge, or discard this patch.
html/user/account_ownership.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -120,7 +120,8 @@
 block discarded – undo
120 120
   // GET request - the user has navigated to the page.
121 121
   page_head(tra("Generate proof of account ownership"), null, null, null, boinc_recaptcha_get_head_extra());
122 122
 
123
-  if ($user) { // Verify the user is logged in
123
+  if ($user) {
124
+// Verify the user is logged in
124 125
       require_once("../inc/account_ownership.inc");
125 126
 
126 127
       if (!file_exists($account_ownership_private_key_file_path)) {
Please login to merge, or discard this patch.