@@ -301,8 +301,7 @@ discard block |
||
301 | 301 | } |
302 | 302 | if (!$special) { |
303 | 303 | $output .= "<td>{$value} {$pref_setting['#field_suffix']}</td>"; |
304 | - } |
|
305 | - else { |
|
304 | + } else { |
|
306 | 305 | // The "very special" case where we merge two prefs |
307 | 306 | $second_pref = $special_map[$name]; |
308 | 307 | $second_pref_setting = $prefs[$pref_set]['prefs']['advanced'][$category][$second_pref]; |
@@ -310,8 +309,7 @@ discard block |
||
310 | 309 | $output .= "<td>{$value} {$pref_setting['#field_suffix']} {$special_delimiter[$name]}" . |
311 | 310 | " {$second_value} {$second_pref_setting['#field_suffix']} </td>"; |
312 | 311 | } |
313 | - } |
|
314 | - else { |
|
312 | + } else { |
|
315 | 313 | $output .= '<td>---</td>'; |
316 | 314 | } |
317 | 315 | } |
@@ -475,10 +473,16 @@ discard block |
||
475 | 473 | isset($prefs[$pref_set][$category])) { |
476 | 474 | $pref_setting = $prefs[$pref_set][$category][$name]; |
477 | 475 | $value = isset($pref_setting['#options']) ? $pref_setting['#options'][$pref_setting['#default_value']] : $pref_setting['#default_value']; |
478 | - if ($value == '') $value = '---'; |
|
479 | - if (!isset($pref_setting['#field_suffix'])) $pref_setting['#field_suffix'] = ''; |
|
476 | + if ($value == '') { |
|
477 | + $value = '---'; |
|
478 | + } |
|
479 | + if (!isset($pref_setting['#field_suffix'])) { |
|
480 | + $pref_setting['#field_suffix'] = ''; |
|
481 | + } |
|
480 | 482 | $output .= "<td>{$value} {$pref_setting['#field_suffix']}</td>"; |
481 | - } else $output .= '<td>---</td>'; |
|
483 | + } else { |
|
484 | + $output .= '<td>---</td>'; |
|
485 | + } |
|
482 | 486 | } |
483 | 487 | $output .= '</tr>'; |
484 | 488 | } |
@@ -618,13 +622,24 @@ discard block |
||
618 | 622 | $output .= '<tr class="section-heading">'; |
619 | 623 | $output .= "<td>{$section['#title']}</td></tr>"; |
620 | 624 | foreach ($section as $name => $setting) { |
621 | - if ($name{0} == '#') continue; |
|
625 | + if ($name{0} == '#') { |
|
626 | + continue; |
|
627 | + } |
|
622 | 628 | $value = isset($setting['#default_value']) ? $setting['#default_value'] : ''; |
623 | - if ($value AND isset($setting['#options'])) $value = $setting['#options'][$value]; |
|
624 | - elseif ($value == '') $value = '---'; |
|
625 | - if (!isset($setting['#title'])) $setting['#title'] = ''; |
|
626 | - if (!isset($setting['#description'])) $setting['#description'] = ''; |
|
627 | - if (!isset($setting['#field_suffix'])) $setting['#field_suffix'] = ''; |
|
629 | + if ($value AND isset($setting['#options'])) { |
|
630 | + $value = $setting['#options'][$value]; |
|
631 | + } elseif ($value == '') { |
|
632 | + $value = '---'; |
|
633 | + } |
|
634 | + if (!isset($setting['#title'])) { |
|
635 | + $setting['#title'] = ''; |
|
636 | + } |
|
637 | + if (!isset($setting['#description'])) { |
|
638 | + $setting['#description'] = ''; |
|
639 | + } |
|
640 | + if (!isset($setting['#field_suffix'])) { |
|
641 | + $setting['#field_suffix'] = ''; |
|
642 | + } |
|
628 | 643 | $output .= '<tr>'; |
629 | 644 | $output .= "<td>{$setting['#title']}<br/>{$setting['#description']}</td>"; |
630 | 645 | $output .= "<td>{$value} {$setting['#field_suffix']}</td>"; |
@@ -722,7 +737,9 @@ discard block |
||
722 | 737 | <tr><th align=left>Project</th><th align=left>Cobblestones</th><th align=left>Joined</th></tr> |
723 | 738 | "; |
724 | 739 | foreach ($boincuser->projects as $p) { |
725 | - if ($p->total_credit<100) continue; |
|
740 | + if ($p->total_credit<100) { |
|
741 | + continue; |
|
742 | + } |
|
726 | 743 | show_proj($p); |
727 | 744 | } |
728 | 745 | echo " |
@@ -836,22 +853,19 @@ discard block |
||
836 | 853 | drupal_set_message(t('Host @id has been removed from your account.', |
837 | 854 | array('@id' => $host_id))); |
838 | 855 | drupal_goto('account/computers'); |
839 | - } |
|
840 | - else { |
|
856 | + } else { |
|
841 | 857 | drupal_set_message(t('Host @id could not be deleted. Not sure why...', |
842 | 858 | array('@id' => $host_id)), 'error' |
843 | 859 | ); |
844 | 860 | } |
845 | - } |
|
846 | - else { |
|
861 | + } else { |
|
847 | 862 | drupal_set_message(t('Host @id cannot be deleted because it still has |
848 | 863 | tasks associated with it. These tasks should be processed within the |
849 | 864 | next few days, after which the host can be deleted.', |
850 | 865 | array('@id' => $host_id)), 'warning' |
851 | 866 | ); |
852 | 867 | } |
853 | - } |
|
854 | - else { |
|
868 | + } else { |
|
855 | 869 | drupal_set_message(t('You are not the owner of host @id, so you cannot |
856 | 870 | delete it.', |
857 | 871 | array('@id' => $host_id)), 'error' |
@@ -896,15 +910,13 @@ discard block |
||
896 | 910 | bts('The location for this host has been updated.') |
897 | 911 | . bts('This will take effect next time the host contacts the project.') |
898 | 912 | ); |
899 | - } |
|
900 | - else { |
|
913 | + } else { |
|
901 | 914 | drupal_set_message( |
902 | 915 | bts('Unable to save changes to this host for some reason!'), |
903 | 916 | 'error' |
904 | 917 | ); |
905 | 918 | } |
906 | - } |
|
907 | - else { |
|
919 | + } else { |
|
908 | 920 | drupal_set_message( |
909 | 921 | bts('You are not allowed to make changes to this host.'), |
910 | 922 | 'warning' |
@@ -996,8 +1008,7 @@ discard block |
||
996 | 1008 | $venue = $active_venue; |
997 | 1009 | //unset($_SESSION['prefs venue']); |
998 | 1010 | } |
999 | - } |
|
1000 | - else { |
|
1011 | + } else { |
|
1001 | 1012 | // Set the active venue to keep it selected between computing and project |
1002 | 1013 | // preference pages |
1003 | 1014 | $_SESSION['prefs venue'] = $venue; |
@@ -378,8 +378,7 @@ discard block |
||
378 | 378 | $user_info .= ' <div class="picture">'; |
379 | 379 | if (is_array($user_image) AND $user_image['image']['filepath']) { |
380 | 380 | $user_info .= theme('imagefield_image', $user_image['image'], $user_image['alt'], $user_image['alt'], array(), false); |
381 | - } |
|
382 | - elseif (is_string($user_image)) { |
|
381 | + } elseif (is_string($user_image)) { |
|
383 | 382 | $user_info .= '<img src="' . $user_image . '"/>'; |
384 | 383 | } |
385 | 384 | $user_info .= ' </div>'; |
@@ -421,8 +420,7 @@ discard block |
||
421 | 420 | // If a specific comment is being referenced, go back to it on cancel |
422 | 421 | if ($comment_ref = $form['pid']['#value']) { |
423 | 422 | $cancel_url = "goto/comment/{$comment_ref}"; |
424 | - } |
|
425 | - else { |
|
423 | + } else { |
|
426 | 424 | $cancel_url = "node/{$form['nid']['#value']}"; |
427 | 425 | } |
428 | 426 | |
@@ -525,8 +523,7 @@ discard block |
||
525 | 523 | 'title' => bts('Reply to this topic with a quote') |
526 | 524 | ); |
527 | 525 | } |
528 | - } |
|
529 | - else { |
|
526 | + } else { |
|
530 | 527 | // Standard EDIT, DELETE, and REPLY links are created by Drupal, but we want to alter them |
531 | 528 | if (isset($links['comment_delete'])) { |
532 | 529 | $links['comment_delete']['attributes'] = array( |
@@ -580,8 +577,7 @@ discard block |
||
580 | 577 | 'title' => bts('Remove sticky status from this topic') |
581 | 578 | ) |
582 | 579 | ); |
583 | - } |
|
584 | - else { |
|
580 | + } else { |
|
585 | 581 | $links['make_sticky'] = array( |
586 | 582 | 'title' => bts('Make sticky'), |
587 | 583 | 'href' => "{$node_control}/sticky", |
@@ -598,8 +594,7 @@ discard block |
||
598 | 594 | 'title' => bts('Lock this thread for comments') |
599 | 595 | ) |
600 | 596 | ); |
601 | - } |
|
602 | - else { |
|
597 | + } else { |
|
603 | 598 | $links['unlock'] = array( |
604 | 599 | 'title' => bts('Unlock'), |
605 | 600 | 'href' => "{$node_control}/unlock", |
@@ -616,8 +611,7 @@ discard block |
||
616 | 611 | 'title' => bts('Hide this topic') |
617 | 612 | ) |
618 | 613 | ); |
619 | - } |
|
620 | - else { |
|
614 | + } else { |
|
621 | 615 | $links['unhide'] = array( |
622 | 616 | 'title' => bts('Unhide'), |
623 | 617 | 'href' => "{$node_control}/unhide", |
@@ -628,8 +622,7 @@ discard block |
||
628 | 622 | } |
629 | 623 | }// if user_access('edit any forum topic') |
630 | 624 | } |
631 | - } |
|
632 | - else if ($type=='comment') { |
|
625 | + } else if ($type=='comment') { |
|
633 | 626 | $node = node_load($object->nid); |
634 | 627 | $nid = $object->nid; |
635 | 628 | $cid = $object->cid; |
@@ -670,8 +663,7 @@ discard block |
||
670 | 663 | 'title' => bts('Hide this comment') |
671 | 664 | ) |
672 | 665 | ); |
673 | - } |
|
674 | - else { |
|
666 | + } else { |
|
675 | 667 | $links['unhide'] = array( |
676 | 668 | 'title' => bts('Unhide'), |
677 | 669 | 'href' => "{$comment_control}/unhide", |
@@ -853,8 +845,7 @@ discard block |
||
853 | 845 | watchdog('am_set_info', "XML validation error in global_prefs: {$errors[0]->message} at line {$errors[0]->line}" . |
854 | 846 | ': <br/>' . htmlentities($lines[$errors[0]->line - 1]), array(), WATCHDOG_ERROR); |
855 | 847 | } |
856 | - } |
|
857 | - elseif ($project_prefs) { |
|
848 | + } elseif ($project_prefs) { |
|
858 | 849 | $xml->loadXML($project_prefs, LIBXML_NOBLANKS); |
859 | 850 | if ($errors = libxml_get_errors($xml)) { |
860 | 851 | $lines = explode("\r", $project_prefs); |
@@ -892,13 +883,16 @@ discard block |
||
892 | 883 | } |
893 | 884 | if ($country OR $url) { |
894 | 885 | $content_profile = content_profile_load('profile', $uid); |
895 | - if ($country) $content_profile->field_country[0]['value'] = $country; |
|
896 | - if ($url) $content_profile->field_url[0]['value'] = $url; |
|
886 | + if ($country) { |
|
887 | + $content_profile->field_country[0]['value'] = $country; |
|
888 | + } |
|
889 | + if ($url) { |
|
890 | + $content_profile->field_url[0]['value'] = $url; |
|
891 | + } |
|
897 | 892 | node_save($content_profile); |
898 | 893 | } |
899 | 894 | } |
900 | - } |
|
901 | - else { |
|
895 | + } else { |
|
902 | 896 | $xml = array( |
903 | 897 | 'error' => array( |
904 | 898 | 'error_num' => -112, |
@@ -978,7 +972,9 @@ discard block |
||
978 | 972 | module_load_include('module', 'boincteam', 'boincteam'); |
979 | 973 | |
980 | 974 | $input_format = !empty($values['format']) ? $values['format'] : 4; |
981 | - if (!empty($_GET['description'])) $_GET['description'] = check_markup($_GET['description'], $input_format); |
|
975 | + if (!empty($_GET['description'])) { |
|
976 | + $_GET['description'] = check_markup($_GET['description'], $input_format); |
|
977 | + } |
|
982 | 978 | |
983 | 979 | // Try to add the team to BOINC and capture the XML output of the RPC |
984 | 980 | ob_start(); |
@@ -1033,8 +1029,7 @@ discard block |
||
1033 | 1029 | node_save($node); |
1034 | 1030 | // Save the team IDs to a BOINC <--> Drupal reference table. |
1035 | 1031 | db_query('INSERT INTO {boincteam} (team_id, nid) VALUES (%d, %d)', $boincteam_id, $node->nid); |
1036 | - } |
|
1037 | - else { |
|
1032 | + } else { |
|
1038 | 1033 | $xml['create_team_reply']['warning'] = t( |
1039 | 1034 | 'There was a problem integrating this team into Drupal. Please |
1040 | 1035 | contact @project administrators!', array('@project' => PROJECT) |
@@ -1049,8 +1044,7 @@ discard block |
||
1049 | 1044 | // Delete from the BOINC DB if we can't sync with Drupal |
1050 | 1045 | $boincteam::delete(); |
1051 | 1046 | } |
1052 | - } |
|
1053 | - else { |
|
1047 | + } else { |
|
1054 | 1048 | $xml['create_team_reply']['warning'] = t( |
1055 | 1049 | 'There was a problem integrating this team into Drupal. Please |
1056 | 1050 | contact @project administrators!', array('@project' => PROJECT) |
@@ -1064,8 +1058,7 @@ discard block |
||
1064 | 1058 | ); |
1065 | 1059 | } |
1066 | 1060 | } |
1067 | - } |
|
1068 | - else { |
|
1061 | + } else { |
|
1069 | 1062 | $xml = array( |
1070 | 1063 | 'error' => array( |
1071 | 1064 | 'error_num' => -1, |
@@ -1159,8 +1152,7 @@ discard block |
||
1159 | 1152 | } |
1160 | 1153 | $xml['users']['user'][] = $team_member; |
1161 | 1154 | } |
1162 | - } |
|
1163 | - else { |
|
1155 | + } else { |
|
1164 | 1156 | $xml = array( |
1165 | 1157 | 'error' => array( |
1166 | 1158 | 'error_num' => -136, |
@@ -1209,24 +1201,19 @@ discard block |
||
1209 | 1201 | if ($avatar_image) { |
1210 | 1202 | $profile_node->field_image[0] = $avatar_image; |
1211 | 1203 | node_save($profile_node); |
1212 | - } |
|
1213 | - else { |
|
1204 | + } else { |
|
1214 | 1205 | $error = 'Error saving avatar to profile'; |
1215 | 1206 | } |
1216 | - } |
|
1217 | - else { |
|
1207 | + } else { |
|
1218 | 1208 | $error = 'Unable to load user profile'; |
1219 | 1209 | } |
1220 | - } |
|
1221 | - else { |
|
1210 | + } else { |
|
1222 | 1211 | $error = 'User has no profile, so avatar could not be added'; |
1223 | 1212 | } |
1224 | - } |
|
1225 | - else { |
|
1213 | + } else { |
|
1226 | 1214 | $error = 'Unable to save remote image'; |
1227 | 1215 | } |
1228 | - } |
|
1229 | - else { |
|
1216 | + } else { |
|
1230 | 1217 | $error = 'Could not find avatar image at URL'; |
1231 | 1218 | } |
1232 | 1219 | } |
@@ -1253,8 +1240,7 @@ discard block |
||
1253 | 1240 | 'success' => NULL, |
1254 | 1241 | ), |
1255 | 1242 | ); |
1256 | - } |
|
1257 | - else { |
|
1243 | + } else { |
|
1258 | 1244 | // Failure |
1259 | 1245 | $xml = array( |
1260 | 1246 | 'error' => array( |
@@ -1263,8 +1249,7 @@ discard block |
||
1263 | 1249 | ), |
1264 | 1250 | ); |
1265 | 1251 | } |
1266 | - } |
|
1267 | - else { |
|
1252 | + } else { |
|
1268 | 1253 | // Drupal user not found |
1269 | 1254 | $xml = array( |
1270 | 1255 | 'error' => array( |
@@ -1273,8 +1258,7 @@ discard block |
||
1273 | 1258 | ), |
1274 | 1259 | ); |
1275 | 1260 | } |
1276 | - } |
|
1277 | - else { |
|
1261 | + } else { |
|
1278 | 1262 | // BOINC user not found |
1279 | 1263 | $xml = array( |
1280 | 1264 | 'error' => array( |
@@ -1301,7 +1285,9 @@ discard block |
||
1301 | 1285 | if ($uid) { |
1302 | 1286 | $method = !empty($_POST['method']) ? $_POST['method'] : (!empty($_GET['method']) ? $_GET['method'] : NULL); |
1303 | 1287 | $count = !empty($_POST['count']) ? $_POST['count'] : (!empty($_GET['count']) ? $_GET['count'] : NULL); |
1304 | - if (!$count) $count = 10; |
|
1288 | + if (!$count) { |
|
1289 | + $count = 10; |
|
1290 | + } |
|
1305 | 1291 | |
1306 | 1292 | switch ($method) { |
1307 | 1293 | case 'user_posts': |
@@ -1392,8 +1378,7 @@ discard block |
||
1392 | 1378 | ), |
1393 | 1379 | ); |
1394 | 1380 | } |
1395 | - } |
|
1396 | - else { |
|
1381 | + } else { |
|
1397 | 1382 | $xml = array( |
1398 | 1383 | 'error' => array( |
1399 | 1384 | 'error_num' => -136, |
@@ -1517,8 +1502,7 @@ discard block |
||
1517 | 1502 | // Get the number of comments per page |
1518 | 1503 | if ($user->comments_per_page) { |
1519 | 1504 | $comments_per_page = $user->comments_per_page; |
1520 | - } |
|
1521 | - else { |
|
1505 | + } else { |
|
1522 | 1506 | $node = node_load($object->nid); |
1523 | 1507 | $comments_per_page = variable_get( |
1524 | 1508 | "comment_default_per_page_{$node->type}", 50 |
@@ -1539,8 +1523,7 @@ discard block |
||
1539 | 1523 | // Check for a login, then redirect to the user's friend requests page |
1540 | 1524 | if ($user->uid) { |
1541 | 1525 | drupal_goto("account/{$user->uid}/friends/pending"); |
1542 | - } |
|
1543 | - else { |
|
1526 | + } else { |
|
1544 | 1527 | drupal_goto('user/login', array( |
1545 | 1528 | 'destination' => 'goto/friend-requests' |
1546 | 1529 | )); |
@@ -1816,8 +1799,7 @@ discard block |
||
1816 | 1799 | if ($moderator_rid !== FALSE) { |
1817 | 1800 | $settings['recipients'] = array($moderator_rid); |
1818 | 1801 | rules_action_mail_to_users_of_role($settings); |
1819 | - } |
|
1820 | - else { |
|
1802 | + } else { |
|
1821 | 1803 | watchdog( |
1822 | 1804 | 'boinccore', |
1823 | 1805 | 'Unable to identify members of the moderator role to send moderator notifications!', |
@@ -1848,8 +1830,7 @@ discard block |
||
1848 | 1830 | } |
1849 | 1831 | if (empty($args)) { |
1850 | 1832 | return $string; |
1851 | - } |
|
1852 | - else { |
|
1833 | + } else { |
|
1853 | 1834 | // Transform arguments before inserting them. |
1854 | 1835 | foreach ($args as $key => $value) { |
1855 | 1836 | switch ($key [0]) { |
@@ -144,13 +144,11 @@ discard block |
||
144 | 144 | '@pages' => format_plural($pages_generated, 'page', 'pages'), |
145 | 145 | ) |
146 | 146 | )); |
147 | - } |
|
148 | - else { |
|
147 | + } else { |
|
149 | 148 | if ($option) { |
150 | 149 | drupal_set_message(t('The @specified page already exists.', |
151 | 150 | array('@specified' => $option)), 'warning'); |
152 | - } |
|
153 | - else { |
|
151 | + } else { |
|
154 | 152 | drupal_set_message(t('All pages already exist, so none can be recreated |
155 | 153 | automatically.'), 'warning'); |
156 | 154 | } |
@@ -169,8 +167,7 @@ discard block |
||
169 | 167 | 'help', |
170 | 168 | // 'about', |
171 | 169 | ); |
172 | - } |
|
173 | - elseif (!is_array($pages)) { |
|
170 | + } elseif (!is_array($pages)) { |
|
174 | 171 | $pages = array($pages); |
175 | 172 | } |
176 | 173 | $pages_generated = array(); |
@@ -57,8 +57,7 @@ discard block |
||
57 | 57 | if (module_exists('pathauto')) { |
58 | 58 | module_load_include('inc', 'pathauto', 'pathauto'); |
59 | 59 | $node['path'] = pathauto_cleanstring($boincteam->name); |
60 | - } |
|
61 | - else { |
|
60 | + } else { |
|
62 | 61 | echo 'Pathauto module is required!'; |
63 | 62 | exit; |
64 | 63 | } |
@@ -77,7 +76,9 @@ discard block |
||
77 | 76 | // Determine team membership |
78 | 77 | db_set_active('boinc'); |
79 | 78 | $boincteam_member_ids = array(); |
80 | - while ($boincuser = db_fetch_object($boincteam_members)) $boincteam_member_ids[] = $boincuser->id; |
|
79 | + while ($boincuser = db_fetch_object($boincteam_members)) { |
|
80 | + $boincteam_member_ids[] = $boincuser->id; |
|
81 | + } |
|
81 | 82 | db_set_active('default'); |
82 | 83 | if ($boincteam_member_ids) { |
83 | 84 | $team_members = db_query('SELECT uid FROM {boincuser} WHERE boinc_id IN(%s)', implode(',', $boincteam_member_ids)); |
@@ -172,8 +172,7 @@ discard block |
||
172 | 172 | $out['result'] = $result; |
173 | 173 | if ($result == 1) { |
174 | 174 | $out['html'] .= '<li>'. t('Module %module is enabled. OK!', array('%module' => $module)) .'</li>'; |
175 | - } |
|
176 | - else { |
|
175 | + } else { |
|
177 | 176 | $out['html'] .= '<li><span class="marker">'. t('Module %module is disabled.', array('%module' => $module)) .'</span></li>'; |
178 | 177 | } |
179 | 178 | $out['html'] .= '</ul>'; |
@@ -201,16 +200,14 @@ discard block |
||
201 | 200 | if ($GLOBALS['db_type'] == 'pgsql') { |
202 | 201 | // adapt from db_table_exists in database.pgsql.inc |
203 | 202 | $result = (bool) db_result(db_query("SELECT COUNT(*) FROM pg_class WHERE relname = '%s'", $table)); |
204 | - } |
|
205 | - else { |
|
203 | + } else { |
|
206 | 204 | // adapt from db_table_exists in database.mysql.inc |
207 | 205 | $result = (bool) db_fetch_object(db_query("SHOW TABLES LIKE '%s'", $table)); |
208 | 206 | } |
209 | 207 | db_set_active('default'); |
210 | 208 | if ($result) { |
211 | 209 | $out['html'] .= '<li>'. t('Table %table: OK!', array('%table' => $table)) .'</li>'; |
212 | - } |
|
213 | - else { |
|
210 | + } else { |
|
214 | 211 | $out['html'] .= '<li><span class="marker">'. t('Table <strong>%table</strong> does not exist!', array('%table' => $table)) .'</span></li>'; |
215 | 212 | $out['result']= 0; |
216 | 213 | } |
@@ -257,8 +254,7 @@ discard block |
||
257 | 254 | array('!unlock_it' => l(t('release the lock'), |
258 | 255 | 'admin/boinc/import/unlock') |
259 | 256 | ), WATCHDOG_WARNING); |
260 | - } |
|
261 | - else { |
|
257 | + } else { |
|
262 | 258 | $boincimport_functions = array( |
263 | 259 | 'users' => t('Import users'), |
264 | 260 | 'teams' => t('Import teams'), |
@@ -293,8 +289,7 @@ discard block |
||
293 | 289 | // Lock the import process |
294 | 290 | if (!variable_get('boincimport_process_locked', 0)) { |
295 | 291 | variable_set('boincimport_process_locked', 1); |
296 | - } |
|
297 | - else { |
|
292 | + } else { |
|
298 | 293 | watchdog('boincimport', 'The import process is locked, but another process |
299 | 294 | is trying to access it...', array(), WATCHDOG_WARNING); |
300 | 295 | } |
@@ -308,8 +303,7 @@ discard block |
||
308 | 303 | boincimport_teams(); |
309 | 304 | if (!variable_get('boincimport_import_team_successful', 0)) { |
310 | 305 | $_SESSION['boincimport_stage_selected'] = 'teams'; |
311 | - } |
|
312 | - else { |
|
306 | + } else { |
|
313 | 307 | $_SESSION['boincimport_stage_selected'] = 'friends'; |
314 | 308 | } |
315 | 309 | break; |
@@ -318,8 +312,7 @@ discard block |
||
318 | 312 | boincimport_friends(); |
319 | 313 | if (!variable_get('boincimport_import_friend_successful', 0)) { |
320 | 314 | $_SESSION['boincimport_stage_selected'] = 'friends'; |
321 | - } |
|
322 | - else { |
|
315 | + } else { |
|
323 | 316 | $_SESSION['boincimport_stage_selected'] = 'preferences'; |
324 | 317 | } |
325 | 318 | break; |
@@ -328,8 +321,7 @@ discard block |
||
328 | 321 | boincimport_preferences(); |
329 | 322 | if (!variable_get('boincimport_import_preferences_successful', 0)) { |
330 | 323 | $_SESSION['boincimport_stage_selected'] = 'preferences'; |
331 | - } |
|
332 | - else { |
|
324 | + } else { |
|
333 | 325 | $_SESSION['boincimport_stage_selected'] = 'private messages'; |
334 | 326 | } |
335 | 327 | break; |
@@ -338,8 +330,7 @@ discard block |
||
338 | 330 | boincimport_private_msgs(); |
339 | 331 | if (!variable_get('boincimport_import_private_msg_successful', 0)) { |
340 | 332 | $_SESSION['boincimport_stage_selected'] = 'private messages'; |
341 | - } |
|
342 | - else { |
|
333 | + } else { |
|
343 | 334 | $_SESSION['boincimport_stage_selected'] = 'categories'; |
344 | 335 | } |
345 | 336 | break; |
@@ -348,8 +339,7 @@ discard block |
||
348 | 339 | boincimport_forum_categories(); |
349 | 340 | if (!variable_get('boincimport_import_category_successful', 0)) { |
350 | 341 | $_SESSION['boincimport_stage_selected'] = 'categories'; |
351 | - } |
|
352 | - else { |
|
342 | + } else { |
|
353 | 343 | $_SESSION['boincimport_stage_selected'] = 'topics'; |
354 | 344 | } |
355 | 345 | break; |
@@ -358,8 +348,7 @@ discard block |
||
358 | 348 | boincimport_forum_topics(); |
359 | 349 | if (!variable_get('boincimport_import_topic_successful', 0)) { |
360 | 350 | $_SESSION['boincimport_stage_selected'] = 'topics'; |
361 | - } |
|
362 | - else { |
|
351 | + } else { |
|
363 | 352 | $_SESSION['boincimport_stage_selected'] = 'posts'; |
364 | 353 | } |
365 | 354 | break; |
@@ -368,8 +357,7 @@ discard block |
||
368 | 357 | boincimport_forum_posts(); |
369 | 358 | if (!variable_get('boincimport_import_post_successful', 0)) { |
370 | 359 | $_SESSION['boincimport_stage_selected'] = 'posts'; |
371 | - } |
|
372 | - else { |
|
360 | + } else { |
|
373 | 361 | $_SESSION['boincimport_stage_selected'] = 'url'; |
374 | 362 | } |
375 | 363 | break; |
@@ -378,8 +366,7 @@ discard block |
||
378 | 366 | boincimport_team_forums(); |
379 | 367 | if (!variable_get('boincimport_team_forum_successful', 0)) { |
380 | 368 | $_SESSION['boincimport_stage_selected'] = 'team forums'; |
381 | - } |
|
382 | - else { |
|
369 | + } else { |
|
383 | 370 | $_SESSION['boincimport_stage_selected'] = 'team topics'; |
384 | 371 | } |
385 | 372 | break; |
@@ -388,8 +375,7 @@ discard block |
||
388 | 375 | boincimport_team_forum_topics(); |
389 | 376 | if (!variable_get('boincimport_team_topic_successful', 0)) { |
390 | 377 | $_SESSION['boincimport_stage_selected'] = 'team topics'; |
391 | - } |
|
392 | - else { |
|
378 | + } else { |
|
393 | 379 | $_SESSION['boincimport_stage_selected'] = 'team posts'; |
394 | 380 | } |
395 | 381 | break; |
@@ -398,8 +384,7 @@ discard block |
||
398 | 384 | boincimport_team_forum_posts(); |
399 | 385 | if (!variable_get('boincimport_team_post_successful', 0)) { |
400 | 386 | $_SESSION['boincimport_stage_selected'] = 'team posts'; |
401 | - } |
|
402 | - else { |
|
387 | + } else { |
|
403 | 388 | $_SESSION['boincimport_stage_selected'] = 'url'; |
404 | 389 | } |
405 | 390 | break; |
@@ -408,8 +393,7 @@ discard block |
||
408 | 393 | boincimport_replace_urls(); |
409 | 394 | if (!variable_get('boincimport_replace_url_successful', 0)) { |
410 | 395 | $_SESSION['boincimport_stage_selected'] = 'url'; |
411 | - } |
|
412 | - else { |
|
396 | + } else { |
|
413 | 397 | drupal_set_message('Congratulations. Import Finished'); |
414 | 398 | drupal_set_message('Please visit the '. l('Post migration configuration', 'admin/boinc/import/post_configuration') .' page'); |
415 | 399 | watchdog('boincimport', 'Import process is complete', array(), WATCHDOG_INFO); |
@@ -478,8 +462,7 @@ discard block |
||
478 | 462 | ORDER BY id ASC' |
479 | 463 | ); |
480 | 464 | $user_count = mysql_num_rows($boinc_accounts); |
481 | - } |
|
482 | - else { |
|
465 | + } else { |
|
483 | 466 | // Need to import any user who is currently ignored in order to keep them |
484 | 467 | // ignored... not particularly clean (ignored users are stored in a string) |
485 | 468 | $ignored_user_list = array(0); |
@@ -555,8 +538,7 @@ discard block |
||
555 | 538 | if (isset($existing_users[$boinc_account->id])) { |
556 | 539 | // This user has already been imported |
557 | 540 | $duplicates[] = $boinc_account->id; |
558 | - } |
|
559 | - else { |
|
541 | + } else { |
|
560 | 542 | $operations[] = array( |
561 | 543 | 'boincimport_users_op', array( |
562 | 544 | $boinc_account->id |
@@ -612,8 +594,7 @@ discard block |
||
612 | 594 | // Store some result for post-processing in the finished callback. |
613 | 595 | $context['results']['success'][] = $boinc_id; |
614 | 596 | $message = "Successfully imported user {$boinc_id}"; |
615 | - } |
|
616 | - else { |
|
597 | + } else { |
|
617 | 598 | $context['results']['failure'][] = $boinc_id; |
618 | 599 | $message = "Failed to import user {$boinc_id}!"; |
619 | 600 | watchdog('boincimport', |
@@ -630,8 +611,7 @@ discard block |
||
630 | 611 | // Update the progress for the batch engine |
631 | 612 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
632 | 613 | $context['finished'] = 1; |
633 | - } |
|
634 | - else { |
|
614 | + } else { |
|
635 | 615 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
636 | 616 | } |
637 | 617 | } |
@@ -656,8 +636,7 @@ discard block |
||
656 | 636 | // Set the user import successful flag in the variable table |
657 | 637 | variable_set('boincimport_import_user_successful', '1'); |
658 | 638 | $_SESSION['boincimport_stage_selected'] = 'teams'; |
659 | - } |
|
660 | - else { |
|
639 | + } else { |
|
661 | 640 | // An error occurred. |
662 | 641 | // $operations contains the operations that remained unprocessed. |
663 | 642 | $error_operation = reset($operations); |
@@ -719,9 +698,10 @@ discard block |
||
719 | 698 | $team_type = array( |
720 | 699 | 'tid' => $team_type_id |
721 | 700 | ); |
722 | - } |
|
723 | - else { |
|
724 | - if (!$name) continue; |
|
701 | + } else { |
|
702 | + if (!$name) { |
|
703 | + continue; |
|
704 | + } |
|
725 | 705 | $team_type = array( |
726 | 706 | 'name' => strip_tags($name), |
727 | 707 | 'vid' => $team_vid, |
@@ -783,8 +763,7 @@ discard block |
||
783 | 763 | if (isset($existing_teams[$boinc_team->id])) { |
784 | 764 | // This team has already been imported |
785 | 765 | $duplicates[] = $boinc_team->id; |
786 | - } |
|
787 | - else { |
|
766 | + } else { |
|
788 | 767 | $operations[] = array( |
789 | 768 | 'boincimport_teams_op', array( |
790 | 769 | $boinc_team |
@@ -825,8 +804,7 @@ discard block |
||
825 | 804 | // Store some result for post-processing in the finished callback. |
826 | 805 | $context['results']['success'][] = $boincteam->id; |
827 | 806 | $message = "Successfully imported team {$boincteam->id}"; |
828 | - } |
|
829 | - else { |
|
807 | + } else { |
|
830 | 808 | $context['results']['failure'][] = $boincteam->id; |
831 | 809 | $message = "Failed to import team {$boincteam->id}!"; |
832 | 810 | watchdog('boincimport', |
@@ -843,8 +821,7 @@ discard block |
||
843 | 821 | // Update the progress for the batch engine |
844 | 822 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
845 | 823 | $context['finished'] = 1; |
846 | - } |
|
847 | - else { |
|
824 | + } else { |
|
848 | 825 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
849 | 826 | } |
850 | 827 | } |
@@ -867,8 +844,7 @@ discard block |
||
867 | 844 | // Set the team import successful flag in the variable table |
868 | 845 | variable_set('boincimport_import_team_successful', '1'); |
869 | 846 | $_SESSION['boincimport_stage_selected'] = 'friends'; |
870 | - } |
|
871 | - else { |
|
847 | + } else { |
|
872 | 848 | // An error occurred. |
873 | 849 | // $operations contains the operations that remained unprocessed. |
874 | 850 | $error_operation = reset($operations); |
@@ -989,8 +965,7 @@ discard block |
||
989 | 965 | SET uid = '%d', friend_uid = '%d', created = '%d'", |
990 | 966 | $uid, $friend_uid, $friendship->create_time |
991 | 967 | ); |
992 | - } |
|
993 | - else { |
|
968 | + } else { |
|
994 | 969 | $boinc_id = ($uid) ? $friendship->user_dest : $friendship->user_src; |
995 | 970 | $message = "No Drupal account exists for BOINC user {$boinc_id}!"; |
996 | 971 | } |
@@ -999,8 +974,7 @@ discard block |
||
999 | 974 | // Store some result for post-processing in the finished callback. |
1000 | 975 | $context['results']['success'][] = $uid; |
1001 | 976 | $message = "Successfully made users {$uid} and {$friend_uid} friends"; |
1002 | - } |
|
1003 | - else { |
|
977 | + } else { |
|
1004 | 978 | $context['results']['failure'][] = $uid; |
1005 | 979 | if (!$message) { |
1006 | 980 | $message = "Failed to make users {$uid} and {$friend_uid} friends!"; |
@@ -1016,8 +990,7 @@ discard block |
||
1016 | 990 | // Update the progress for the batch engine |
1017 | 991 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
1018 | 992 | $context['finished'] = 1; |
1019 | - } |
|
1020 | - else { |
|
993 | + } else { |
|
1021 | 994 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
1022 | 995 | } |
1023 | 996 | } |
@@ -1041,8 +1014,7 @@ discard block |
||
1041 | 1014 | // Set the friend import successful flag in the variable table |
1042 | 1015 | variable_set('boincimport_import_friend_successful', '1'); |
1043 | 1016 | $_SESSION['boincimport_stage_selected'] = 'preferences'; |
1044 | - } |
|
1045 | - else { |
|
1017 | + } else { |
|
1046 | 1018 | // An error occurred. |
1047 | 1019 | // $operations contains the operations that remained unprocessed. |
1048 | 1020 | $error_operation = reset($operations); |
@@ -1166,8 +1138,7 @@ discard block |
||
1166 | 1138 | ); |
1167 | 1139 | if ($user_ignored) { |
1168 | 1140 | $success = TRUE; |
1169 | - } |
|
1170 | - else { |
|
1141 | + } else { |
|
1171 | 1142 | $context['results']['warning'][] = "{$uid}:{$ignored_user_uid}"; |
1172 | 1143 | watchdog('boincimport', |
1173 | 1144 | 'Could not add user @ignored_uid to the ignore list of user @uid', |
@@ -1182,8 +1153,7 @@ discard block |
||
1182 | 1153 | // Store some result for post-processing in the finished callback. |
1183 | 1154 | $context['results']['success'][] = $uid; |
1184 | 1155 | $message = "Successfully imported ignored users for user {$uid}"; |
1185 | - } |
|
1186 | - else { |
|
1156 | + } else { |
|
1187 | 1157 | $context['results']['failure'][] = $uid; |
1188 | 1158 | $message = "Failed to import any user filter preferences for user {$uid}!"; |
1189 | 1159 | watchdog('boincimport', |
@@ -1200,8 +1170,7 @@ discard block |
||
1200 | 1170 | // Update the progress for the batch engine |
1201 | 1171 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
1202 | 1172 | $context['finished'] = 1; |
1203 | - } |
|
1204 | - else { |
|
1173 | + } else { |
|
1205 | 1174 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
1206 | 1175 | } |
1207 | 1176 | } |
@@ -1226,8 +1195,7 @@ discard block |
||
1226 | 1195 | // Set the preference import successful flag in the variable table |
1227 | 1196 | variable_set('boincimport_import_preferences_successful', '1'); |
1228 | 1197 | $_SESSION['boincimport_stage_selected'] = 'private messages'; |
1229 | - } |
|
1230 | - else { |
|
1198 | + } else { |
|
1231 | 1199 | // An error occurred. |
1232 | 1200 | // $operations contains the operations that remained unprocessed. |
1233 | 1201 | $error_operation = reset($operations); |
@@ -1361,8 +1329,7 @@ discard block |
||
1361 | 1329 | // Store some result for post-processing in the finished callback. |
1362 | 1330 | $context['results']['success'][] = $pm->id; |
1363 | 1331 | $message = "Successfully imported private message {$pm->id}"; |
1364 | - } |
|
1365 | - else { |
|
1332 | + } else { |
|
1366 | 1333 | $context['results']['failure'][] = $pm->id; |
1367 | 1334 | $message = "Failed to import private message {$pm->id}!"; |
1368 | 1335 | watchdog('boincimport', |
@@ -1379,8 +1346,7 @@ discard block |
||
1379 | 1346 | // Update the progress for the batch engine |
1380 | 1347 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
1381 | 1348 | $context['finished'] = 1; |
1382 | - } |
|
1383 | - else { |
|
1349 | + } else { |
|
1384 | 1350 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
1385 | 1351 | } |
1386 | 1352 | } |
@@ -1403,8 +1369,7 @@ discard block |
||
1403 | 1369 | // Set the private message import successful flag in the variable table |
1404 | 1370 | variable_set('boincimport_import_private_msg_successful', '1'); |
1405 | 1371 | $_SESSION['boincimport_stage_selected'] = 'categories'; |
1406 | - } |
|
1407 | - else { |
|
1372 | + } else { |
|
1408 | 1373 | // An error occurred. |
1409 | 1374 | // $operations contains the operations that remained unprocessed. |
1410 | 1375 | $error_operation = reset($operations); |
@@ -1557,8 +1522,7 @@ discard block |
||
1557 | 1522 | if (in_array($boinc_forum_category->name, $existing_categories)) { |
1558 | 1523 | // This category has already been imported |
1559 | 1524 | $duplicate_categories[] = $boinc_forum_category->name; |
1560 | - } |
|
1561 | - else { |
|
1525 | + } else { |
|
1562 | 1526 | $operations[] = array( |
1563 | 1527 | 'boincimport_forum_categories_op', array( |
1564 | 1528 | $boinc_forum_category, $forum_vid, $pre, FALSE |
@@ -1572,8 +1536,7 @@ discard block |
||
1572 | 1536 | if (isset($existing_forums[$boinc_forum->id])) { |
1573 | 1537 | // This forum has already been imported |
1574 | 1538 | $duplicates[] = $boinc_forum->id; |
1575 | - } |
|
1576 | - else { |
|
1539 | + } else { |
|
1577 | 1540 | $operations[] = array( |
1578 | 1541 | 'boincimport_forums_op', array( |
1579 | 1542 | $boinc_forum, $forum_vid, $pre |
@@ -1640,8 +1603,7 @@ discard block |
||
1640 | 1603 | $category->name = 'Hidden'; |
1641 | 1604 | $category->id = 0; |
1642 | 1605 | $hidden = TRUE; |
1643 | - } |
|
1644 | - else { |
|
1606 | + } else { |
|
1645 | 1607 | // If this container is empty, put it into the hidden container |
1646 | 1608 | db_set_active('boinc'); |
1647 | 1609 | $forums_contained = db_result(db_query(' |
@@ -1684,13 +1646,11 @@ discard block |
||
1684 | 1646 | // Store some result for post-processing in the finished callback. |
1685 | 1647 | if (!$category AND $create_hidden) { |
1686 | 1648 | $message = "Created special hidden container"; |
1687 | - } |
|
1688 | - else { |
|
1649 | + } else { |
|
1689 | 1650 | $context['results']['categories']['success'][] = $category->id; |
1690 | 1651 | $message = "Successfully imported container {$category->id}"; |
1691 | 1652 | } |
1692 | - } |
|
1693 | - else { |
|
1653 | + } else { |
|
1694 | 1654 | $context['results']['categories']['failure'][] = $category->id; |
1695 | 1655 | $message = "Failed to import container {$category->id}!"; |
1696 | 1656 | watchdog('boincimport', |
@@ -1707,8 +1667,7 @@ discard block |
||
1707 | 1667 | // Update the progress for the batch engine |
1708 | 1668 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
1709 | 1669 | $context['finished'] = 1; |
1710 | - } |
|
1711 | - else { |
|
1670 | + } else { |
|
1712 | 1671 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
1713 | 1672 | } |
1714 | 1673 | } |
@@ -1744,8 +1703,7 @@ discard block |
||
1744 | 1703 | // Save the ID of the News forum for later import |
1745 | 1704 | variable_set('boincimport_news_forum_id', $forum_id); |
1746 | 1705 | $success = TRUE; |
1747 | - } |
|
1748 | - else { |
|
1706 | + } else { |
|
1749 | 1707 | // Save all other forums as taxonomy terms |
1750 | 1708 | $forum = array( |
1751 | 1709 | 'name' => $name, |
@@ -1771,8 +1729,7 @@ discard block |
||
1771 | 1729 | // Store some result for post-processing in the finished callback. |
1772 | 1730 | $context['results']['forums']['success'][] = $forum_id; |
1773 | 1731 | $message = "Successfully imported forum {$forum_id}"; |
1774 | - } |
|
1775 | - else { |
|
1732 | + } else { |
|
1776 | 1733 | $context['results']['forums']['failure'][] = $forum_id; |
1777 | 1734 | $message = "Failed to import forum {$forum_id}!"; |
1778 | 1735 | } |
@@ -1785,8 +1742,7 @@ discard block |
||
1785 | 1742 | // Update the progress for the batch engine |
1786 | 1743 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
1787 | 1744 | $context['finished'] = 1; |
1788 | - } |
|
1789 | - else { |
|
1745 | + } else { |
|
1790 | 1746 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
1791 | 1747 | } |
1792 | 1748 | } |
@@ -1887,8 +1843,7 @@ discard block |
||
1887 | 1843 | // Set the forum import successful flag in the variable table |
1888 | 1844 | variable_set('boincimport_import_forum_successful', '1'); |
1889 | 1845 | $_SESSION['boincimport_stage_selected'] = 'topics'; |
1890 | - } |
|
1891 | - else { |
|
1846 | + } else { |
|
1892 | 1847 | // An error occurred. |
1893 | 1848 | // $operations contains the operations that remained unprocessed. |
1894 | 1849 | $error_operation = reset($operations); |
@@ -2042,9 +1997,7 @@ discard block |
||
2042 | 1997 | |
2043 | 1998 | if ($duplicate OR !$post) { |
2044 | 1999 | $success = FALSE; |
2045 | - } |
|
2046 | - |
|
2047 | - else { |
|
2000 | + } else { |
|
2048 | 2001 | // Get the user and term IDs along with other data to define the topic |
2049 | 2002 | $uid = boincuser_lookup_uid($topic->owner); |
2050 | 2003 | $tid = db_result(db_query(' |
@@ -2108,12 +2061,10 @@ discard block |
||
2108 | 2061 | if (!$success) { |
2109 | 2062 | $error_detail = 'topic imported, but failed to set last comment timestamp'; |
2110 | 2063 | } |
2111 | - } |
|
2112 | - else { |
|
2064 | + } else { |
|
2113 | 2065 | $error_detail = 'topic node saved, but failed to link in boincimport_temp_topic table'; |
2114 | 2066 | } |
2115 | - } |
|
2116 | - else { |
|
2067 | + } else { |
|
2117 | 2068 | $error_detail = 'failed to save topic node to database'; |
2118 | 2069 | } |
2119 | 2070 | } |
@@ -2124,16 +2075,13 @@ discard block |
||
2124 | 2075 | // Store some result for post-processing in the finished callback. |
2125 | 2076 | $context['results']['success'][] = $topic->id; |
2126 | 2077 | $message = "Successfully imported topic {$topic->id}"; |
2127 | - } |
|
2128 | - elseif ($duplicate) { |
|
2078 | + } elseif ($duplicate) { |
|
2129 | 2079 | $context['results']['duplicate'][] = $topic->id; |
2130 | 2080 | $message = "Topic {$topic->id} was already imported"; |
2131 | - } |
|
2132 | - elseif (!$post) { |
|
2081 | + } elseif (!$post) { |
|
2133 | 2082 | $context['results']['empty'][] = $topic->id; |
2134 | 2083 | $message = "Skipping topic {$topic->id} as empty"; |
2135 | - } |
|
2136 | - else { |
|
2084 | + } else { |
|
2137 | 2085 | $context['results']['failure'][] = $topic->id; |
2138 | 2086 | $message = "Failed to import topic {$topic->id}!"; |
2139 | 2087 | watchdog('boincimport', |
@@ -2154,8 +2102,7 @@ discard block |
||
2154 | 2102 | // Update the progress for the batch engine |
2155 | 2103 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
2156 | 2104 | $context['finished'] = 1; |
2157 | - } |
|
2158 | - else { |
|
2105 | + } else { |
|
2159 | 2106 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
2160 | 2107 | } |
2161 | 2108 | } |
@@ -2189,8 +2136,7 @@ discard block |
||
2189 | 2136 | // Set the topic import successful flag in the variable table |
2190 | 2137 | variable_set('boincimport_import_topic_successful', '1'); |
2191 | 2138 | $_SESSION['boincimport_stage_selected'] = 'posts'; |
2192 | - } |
|
2193 | - else { |
|
2139 | + } else { |
|
2194 | 2140 | // An error occurred. |
2195 | 2141 | // $operations contains the operations that remained unprocessed. |
2196 | 2142 | $error_operation = reset($operations); |
@@ -2383,8 +2329,12 @@ discard block |
||
2383 | 2329 | FROM {boincimport_temp_post} |
2384 | 2330 | WHERE post_id = %d', |
2385 | 2331 | $post->parent_post)); |
2386 | - if (is_null($pid)) $pid = 0; |
|
2387 | - if (!$uid) $uid = 0; |
|
2332 | + if (is_null($pid)) { |
|
2333 | + $pid = 0; |
|
2334 | + } |
|
2335 | + if (!$uid) { |
|
2336 | + $uid = 0; |
|
2337 | + } |
|
2388 | 2338 | |
2389 | 2339 | $post->content = _boincimport_strip_bbcode($post->content); |
2390 | 2340 | $post->content = _boincimport_text_sanitize($post->content); |
@@ -2409,8 +2359,9 @@ discard block |
||
2409 | 2359 | $subject = str_replace('Quote:', 'RE: ', $subject); |
2410 | 2360 | // Fringe cases where the comment body is populated only by HTML tags |
2411 | 2361 | // will require a default subject... |
2412 | - if ($subject === '') |
|
2413 | - $subject = "RE: {$node->title}"; |
|
2362 | + if ($subject === '') { |
|
2363 | + $subject = "RE: {$node->title}"; |
|
2364 | + } |
|
2414 | 2365 | } else { |
2415 | 2366 | // This is the first post in the topic |
2416 | 2367 | $subject = $node->title; |
@@ -2438,18 +2389,15 @@ discard block |
||
2438 | 2389 | if ($success) { |
2439 | 2390 | $posts_imported++; |
2440 | 2391 | $context['results']['posts']['success'][] = $post->id; |
2441 | - } |
|
2442 | - else { |
|
2392 | + } else { |
|
2443 | 2393 | $context['results']['posts']['failure'][] = $post->id; |
2444 | 2394 | $error_posts++; |
2445 | 2395 | } |
2446 | - } |
|
2447 | - else { |
|
2396 | + } else { |
|
2448 | 2397 | $context['results']['posts']['failure'][] = $post->id; |
2449 | 2398 | $error_posts++; |
2450 | 2399 | } |
2451 | - } |
|
2452 | - else { |
|
2400 | + } else { |
|
2453 | 2401 | $context['results']['posts']['empty'][] = $post->id; |
2454 | 2402 | $empty_posts++; |
2455 | 2403 | } |
@@ -2460,8 +2408,7 @@ discard block |
||
2460 | 2408 | // Store some result for post-processing in the finished callback. |
2461 | 2409 | $context['results']['success'][] = $boinc_topic->id; |
2462 | 2410 | $message = "Imported {$posts_imported} post(s) for topic {$boinc_topic->id}"; |
2463 | - } |
|
2464 | - else { |
|
2411 | + } else { |
|
2465 | 2412 | $context['results']['failure'][] = $boinc_topic->id; |
2466 | 2413 | $message = "Failed to import any posts for topic {$boinc_topic->id} (excluded {$error_posts} errors, {$duplicate_posts} duplicates, and {$empty_posts} empty)"; |
2467 | 2414 | watchdog('boincimport', 'Failed to import any posts for topic @id (excluded @error_posts errors, @duplicate_posts duplicates, and @empty_posts empty)', |
@@ -2482,8 +2429,7 @@ discard block |
||
2482 | 2429 | // Update the progress for the batch engine |
2483 | 2430 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
2484 | 2431 | $context['finished'] = 1; |
2485 | - } |
|
2486 | - else { |
|
2432 | + } else { |
|
2487 | 2433 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
2488 | 2434 | } |
2489 | 2435 | } |
@@ -2523,8 +2469,7 @@ discard block |
||
2523 | 2469 | // Set the post import successful flag in the variable table |
2524 | 2470 | variable_set('boincimport_import_post_successful', '1'); |
2525 | 2471 | $_SESSION['boincimport_stage_selected'] = 'team forums'; |
2526 | - } |
|
2527 | - else { |
|
2472 | + } else { |
|
2528 | 2473 | // An error occurred. |
2529 | 2474 | // $operations contains the operations that remained unprocessed. |
2530 | 2475 | $error_operation = reset($operations); |
@@ -2611,8 +2556,7 @@ discard block |
||
2611 | 2556 | if (isset($existing_team_forums[$boincteam_forum->id])) { |
2612 | 2557 | // This team has already been imported |
2613 | 2558 | $duplicates[] = $boincteam_forum->id; |
2614 | - } |
|
2615 | - else { |
|
2559 | + } else { |
|
2616 | 2560 | $operations[] = array( |
2617 | 2561 | 'boincimport_team_forums_op', array( |
2618 | 2562 | $boincteam_forum |
@@ -2678,8 +2622,7 @@ discard block |
||
2678 | 2622 | // Store some result for post-processing in the finished callback. |
2679 | 2623 | $context['results']['success'][] = $forum_id; |
2680 | 2624 | $message = "Successfully imported team forum {$forum_id}"; |
2681 | - } |
|
2682 | - else { |
|
2625 | + } else { |
|
2683 | 2626 | $context['results']['failure'][] = $forum_id; |
2684 | 2627 | $message = "Failed to import team forum {$forum_id}!"; |
2685 | 2628 | watchdog('boincimport', |
@@ -2696,8 +2639,7 @@ discard block |
||
2696 | 2639 | // Update the progress for the batch engine |
2697 | 2640 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
2698 | 2641 | $context['finished'] = 1; |
2699 | - } |
|
2700 | - else { |
|
2642 | + } else { |
|
2701 | 2643 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
2702 | 2644 | } |
2703 | 2645 | } |
@@ -2720,8 +2662,7 @@ discard block |
||
2720 | 2662 | // Set the team forum import successful flag in the variable table |
2721 | 2663 | variable_set('boincimport_import_team_forum_successful', '1'); |
2722 | 2664 | $_SESSION['boincimport_stage_selected'] = 'team topics'; |
2723 | - } |
|
2724 | - else { |
|
2665 | + } else { |
|
2725 | 2666 | // An error occurred. |
2726 | 2667 | // $operations contains the operations that remained unprocessed. |
2727 | 2668 | $error_operation = reset($operations); |
@@ -2816,8 +2757,7 @@ discard block |
||
2816 | 2757 | if (isset($existing_team_topics[$boincteam_topic->id])) { |
2817 | 2758 | // This team topic has already been imported |
2818 | 2759 | $duplicates[] = $boincteam_topic->id; |
2819 | - } |
|
2820 | - else { |
|
2760 | + } else { |
|
2821 | 2761 | $operations[] = array( |
2822 | 2762 | 'boincimport_team_topics_op', array( |
2823 | 2763 | $boincteam_topic |
@@ -2864,8 +2804,7 @@ discard block |
||
2864 | 2804 | )); |
2865 | 2805 | if (!$team_forum_id) { |
2866 | 2806 | $missing_parent[] = $topic->id; |
2867 | - } |
|
2868 | - else { |
|
2807 | + } else { |
|
2869 | 2808 | // Get the content of the post that started the topic |
2870 | 2809 | db_set_active('boinc'); |
2871 | 2810 | $query = db_query(' |
@@ -2882,8 +2821,7 @@ discard block |
||
2882 | 2821 | // Empty topics should have already been filtered out of the import, so |
2883 | 2822 | // consider this an error condition |
2884 | 2823 | $empty_topics[] = $topic->id; |
2885 | - } |
|
2886 | - else { |
|
2824 | + } else { |
|
2887 | 2825 | // Get the user ID along with other data to define the topic |
2888 | 2826 | $uid = boincuser_lookup_uid($topic->owner); |
2889 | 2827 | if (!$topic->owner) { |
@@ -2947,8 +2885,7 @@ discard block |
||
2947 | 2885 | // Store some result for post-processing in the finished callback. |
2948 | 2886 | $context['results']['success'][] = $topic->id; |
2949 | 2887 | $message = "Successfully imported team topic {$topic->id}"; |
2950 | - } |
|
2951 | - else { |
|
2888 | + } else { |
|
2952 | 2889 | $context['results']['failure'][] = $topic->id; |
2953 | 2890 | $message = "Failed to import team topic {$topic->id}!"; |
2954 | 2891 | watchdog('boincimport', |
@@ -2965,8 +2902,7 @@ discard block |
||
2965 | 2902 | // Update the progress for the batch engine |
2966 | 2903 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
2967 | 2904 | $context['finished'] = 1; |
2968 | - } |
|
2969 | - else { |
|
2905 | + } else { |
|
2970 | 2906 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
2971 | 2907 | } |
2972 | 2908 | } |
@@ -2989,8 +2925,7 @@ discard block |
||
2989 | 2925 | // Set the BLAH import successful flag in the variable table |
2990 | 2926 | variable_set('boincimport_import_team_topic_successful', '1'); |
2991 | 2927 | $_SESSION['boincimport_stage_selected'] = 'team posts'; |
2992 | - } |
|
2993 | - else { |
|
2928 | + } else { |
|
2994 | 2929 | // An error occurred. |
2995 | 2930 | // $operations contains the operations that remained unprocessed. |
2996 | 2931 | $error_operation = reset($operations); |
@@ -3112,8 +3047,7 @@ discard block |
||
3112 | 3047 | if (isset($existing_posts[$boincteam_post->id])) { |
3113 | 3048 | // This post has already been imported |
3114 | 3049 | $duplicates[] = $boincteam_post->id; |
3115 | - } |
|
3116 | - else { |
|
3050 | + } else { |
|
3117 | 3051 | $operations[] = array( |
3118 | 3052 | 'boincimport_team_posts_op', array( |
3119 | 3053 | $boincteam_post |
@@ -3169,8 +3103,12 @@ discard block |
||
3169 | 3103 | FROM {boincimport_temp_post} |
3170 | 3104 | WHERE post_id = %d', |
3171 | 3105 | $post->parent_post)); |
3172 | - if (is_null($pid)) $pid = 0; |
|
3173 | - if (!$uid) $uid = 0; |
|
3106 | + if (is_null($pid)) { |
|
3107 | + $pid = 0; |
|
3108 | + } |
|
3109 | + if (!$uid) { |
|
3110 | + $uid = 0; |
|
3111 | + } |
|
3174 | 3112 | |
3175 | 3113 | $post->content = _boincimport_strip_bbcode($post->content); |
3176 | 3114 | $post->content = _boincimport_text_sanitize($post->content); |
@@ -3195,8 +3133,9 @@ discard block |
||
3195 | 3133 | $subject = str_replace('Quote:', 'RE: ', $subject); |
3196 | 3134 | // Fringe cases where the comment body is populated only by HTML tags |
3197 | 3135 | // will require a default subject... |
3198 | - if ($subject === '') |
|
3199 | - $subject = "RE: {$node->title}"; |
|
3136 | + if ($subject === '') { |
|
3137 | + $subject = "RE: {$node->title}"; |
|
3138 | + } |
|
3200 | 3139 | } else { |
3201 | 3140 | // This is the first post in the topic |
3202 | 3141 | $subject = $node->title; |
@@ -3229,8 +3168,7 @@ discard block |
||
3229 | 3168 | // Store some result for post-processing in the finished callback. |
3230 | 3169 | $context['results']['success'][] = $post->id; |
3231 | 3170 | $message = "Successfully imported team post {$post->id}"; |
3232 | - } |
|
3233 | - else { |
|
3171 | + } else { |
|
3234 | 3172 | $context['results']['failure'][] = $post->id; |
3235 | 3173 | $message = "Failed to import team post {$post->id}!"; |
3236 | 3174 | watchdog('boincimport', |
@@ -3247,8 +3185,7 @@ discard block |
||
3247 | 3185 | // Update the progress for the batch engine |
3248 | 3186 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
3249 | 3187 | $context['finished'] = 1; |
3250 | - } |
|
3251 | - else { |
|
3188 | + } else { |
|
3252 | 3189 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
3253 | 3190 | } |
3254 | 3191 | } |
@@ -3271,8 +3208,7 @@ discard block |
||
3271 | 3208 | // Set the team post import successful flag in the variable table |
3272 | 3209 | variable_set('boincimport_import_team_post_successful', '1'); |
3273 | 3210 | $_SESSION['boincimport_stage_selected'] = 'url'; |
3274 | - } |
|
3275 | - else { |
|
3211 | + } else { |
|
3276 | 3212 | // An error occurred. |
3277 | 3213 | // $operations contains the operations that remained unprocessed. |
3278 | 3214 | $error_operation = reset($operations); |
@@ -3378,8 +3314,7 @@ discard block |
||
3378 | 3314 | $context['results']['success'][] = $boincuser_id; |
3379 | 3315 | $context['results']['subscriptions'][$boincuser_id] = $count; |
3380 | 3316 | $message = "Successfully imported {$count} subscriptions for user {$boincuser_id}"; |
3381 | - } |
|
3382 | - else { |
|
3317 | + } else { |
|
3383 | 3318 | $context['results']['failure'][] = $boincuser_id; |
3384 | 3319 | $message = "Failed to import subscriptions for user {$boincuser_id}!"; |
3385 | 3320 | watchdog('boincimport', |
@@ -3396,8 +3331,7 @@ discard block |
||
3396 | 3331 | // Update the progress for the batch engine |
3397 | 3332 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
3398 | 3333 | $context['finished'] = 1; |
3399 | - } |
|
3400 | - else { |
|
3334 | + } else { |
|
3401 | 3335 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
3402 | 3336 | } |
3403 | 3337 | } |
@@ -3422,8 +3356,7 @@ discard block |
||
3422 | 3356 | // Set the subscription import successful flag in the variable table |
3423 | 3357 | variable_set('boincimport_import_subscription_successful', '1'); |
3424 | 3358 | $_SESSION['boincimport_stage_selected'] = 'url'; |
3425 | - } |
|
3426 | - else { |
|
3359 | + } else { |
|
3427 | 3360 | // An error occurred. |
3428 | 3361 | // $operations contains the operations that remained unprocessed. |
3429 | 3362 | $error_operation = reset($operations); |
@@ -3601,8 +3534,7 @@ discard block |
||
3601 | 3534 | // Store some result for post-processing in the finished callback. |
3602 | 3535 | $context['results']['nodes']['updated'][] = $node->nid; |
3603 | 3536 | $message = "Successfully updated node {$node->nid}"; |
3604 | - } |
|
3605 | - else { |
|
3537 | + } else { |
|
3606 | 3538 | $message = "No changes made to node {$node->nid}!"; |
3607 | 3539 | } |
3608 | 3540 | |
@@ -3614,8 +3546,7 @@ discard block |
||
3614 | 3546 | // Update the progress for the batch engine |
3615 | 3547 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
3616 | 3548 | $context['finished'] = 1; |
3617 | - } |
|
3618 | - else { |
|
3549 | + } else { |
|
3619 | 3550 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
3620 | 3551 | } |
3621 | 3552 | } |
@@ -3665,8 +3596,7 @@ discard block |
||
3665 | 3596 | // Store some result for post-processing in the finished callback. |
3666 | 3597 | $context['results']['comments']['updated'][] = $comment->cid; |
3667 | 3598 | $message = "Successfully updated comment {$comment->cid}"; |
3668 | - } |
|
3669 | - else { |
|
3599 | + } else { |
|
3670 | 3600 | $message = "No changes made to comment {$comment->cid}!"; |
3671 | 3601 | } |
3672 | 3602 | |
@@ -3678,8 +3608,7 @@ discard block |
||
3678 | 3608 | // Update the progress for the batch engine |
3679 | 3609 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
3680 | 3610 | $context['finished'] = 1; |
3681 | - } |
|
3682 | - else { |
|
3611 | + } else { |
|
3683 | 3612 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
3684 | 3613 | } |
3685 | 3614 | } |
@@ -3728,8 +3657,7 @@ discard block |
||
3728 | 3657 | // Store some result for post-processing in the finished callback. |
3729 | 3658 | $context['results']['pm']['updated'][] = $pm->mid; |
3730 | 3659 | $message = "Successfully updated private message {$pm->mid}"; |
3731 | - } |
|
3732 | - else { |
|
3660 | + } else { |
|
3733 | 3661 | $message = "No changes made to private message {$pm->mid}!"; |
3734 | 3662 | } |
3735 | 3663 | |
@@ -3741,8 +3669,7 @@ discard block |
||
3741 | 3669 | // Update the progress for the batch engine |
3742 | 3670 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
3743 | 3671 | $context['finished'] = 1; |
3744 | - } |
|
3745 | - else { |
|
3672 | + } else { |
|
3746 | 3673 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
3747 | 3674 | } |
3748 | 3675 | } |
@@ -3807,8 +3734,7 @@ discard block |
||
3807 | 3734 | // Set the replace URLs successful flag in the variable table |
3808 | 3735 | variable_set('boincimport_replace_urls_successful', '1'); |
3809 | 3736 | $_SESSION['boincimport_stage_selected'] = 'users'; |
3810 | - } |
|
3811 | - else { |
|
3737 | + } else { |
|
3812 | 3738 | // An error occurred. |
3813 | 3739 | // $operations contains the operations that remained unprocessed. |
3814 | 3740 | $error_operation = reset($operations); |
@@ -4028,13 +3954,11 @@ discard block |
||
4028 | 3954 | if (isset($this->boincDomains[$domain])) { |
4029 | 3955 | // This is a URL configured to be transformed |
4030 | 3956 | return "{$http}://{$this->drupalDomain}{$this->basePath}"; |
4031 | - } |
|
4032 | - else { |
|
3957 | + } else { |
|
4033 | 3958 | // This URL should not be transformed |
4034 | 3959 | return NULL; |
4035 | 3960 | } |
4036 | - } |
|
4037 | - else { |
|
3961 | + } else { |
|
4038 | 3962 | // This is a relative URL |
4039 | 3963 | return $this->basePath; |
4040 | 3964 | } |
@@ -4056,8 +3980,7 @@ discard block |
||
4056 | 3980 | )); |
4057 | 3981 | if ($id) { |
4058 | 3982 | $link = "{$newBaseUrl}goto/comment/{$id}"; |
4059 | - } |
|
4060 | - else { |
|
3983 | + } else { |
|
4061 | 3984 | // This post is not in the post import table, so it's probably a topic |
4062 | 3985 | $link = $this->transformTopicLinks($matches); |
4063 | 3986 | } |
@@ -4081,8 +4004,7 @@ discard block |
||
4081 | 4004 | )); |
4082 | 4005 | if ($id) { |
4083 | 4006 | $link = "{$newBaseUrl}goto/comment/{$id}"; |
4084 | - } |
|
4085 | - else { |
|
4007 | + } else { |
|
4086 | 4008 | // This post is not in the post import table, so it's probably a topic |
4087 | 4009 | $link = $this->transformTopicLinks($matches); |
4088 | 4010 | } |
@@ -183,7 +183,9 @@ |
||
183 | 183 | // By default, use the format named "Rich text"; fall back to Filtered HTML |
184 | 184 | $default_input_format = db_result(db_query(" |
185 | 185 | SELECT format FROM {filter_formats} WHERE name = '%s'", 'Rich text')); |
186 | - if (!$default_input_format) $default_input_format = 1; |
|
186 | + if (!$default_input_format) { |
|
187 | + $default_input_format = 1; |
|
188 | + } |
|
187 | 189 | |
188 | 190 | $input_format = variable_get('boincimport_input_format', $default_input_format); |
189 | 191 | $form['input']['boincimport_input_format'] = array( |
@@ -120,8 +120,7 @@ discard block |
||
120 | 120 | 'Updated translation source strings for node @nid.', |
121 | 121 | array('@nid' => $node->nid) |
122 | 122 | ); |
123 | - } |
|
124 | - else { |
|
123 | + } else { |
|
125 | 124 | drupal_set_message( |
126 | 125 | t('Unable to update translation source strings.'), 'error' |
127 | 126 | ); |
@@ -132,8 +131,7 @@ discard block |
||
132 | 131 | WATCHDOG_ERROR |
133 | 132 | ); |
134 | 133 | } |
135 | - } |
|
136 | - else { |
|
134 | + } else { |
|
137 | 135 | $result = db_query(" |
138 | 136 | INSERT INTO {locales_source} |
139 | 137 | SET location = '%s', textgroup = '%s', source = '%s'", |
@@ -145,8 +143,7 @@ discard block |
||
145 | 143 | 'Added translation source strings for node @nid.', |
146 | 144 | array('@nid' => $node->nid) |
147 | 145 | ); |
148 | - } |
|
149 | - else { |
|
146 | + } else { |
|
150 | 147 | drupal_set_message( |
151 | 148 | t('Unable to add translation source strings.'), 'error' |
152 | 149 | ); |
@@ -230,8 +227,7 @@ discard block |
||
230 | 227 | ) |
231 | 228 | ), 'warning' |
232 | 229 | ); |
233 | - } |
|
234 | - elseif ($response) { |
|
230 | + } elseif ($response) { |
|
235 | 231 | if (is_array($response)) { |
236 | 232 | |
237 | 233 | $installed_languages = language_list(); |
@@ -261,8 +257,7 @@ discard block |
||
261 | 257 | 'Added predefined language: '.$available_languages[$rfc_code][0] |
262 | 258 | ); |
263 | 259 | db_query("UPDATE {languages} SET enabled = 1 WHERE language = '%s'", $rfc_code); |
264 | - } |
|
265 | - else { |
|
260 | + } else { |
|
266 | 261 | // Retrieve language details from Transifex |
267 | 262 | $path = "language/{$posix_code}"; |
268 | 263 | $response = boinctranslate_transifex_request($path); |
@@ -275,8 +270,7 @@ discard block |
||
275 | 270 | ) |
276 | 271 | ), 'warning' |
277 | 272 | ); |
278 | - } |
|
279 | - elseif ($response) { |
|
273 | + } elseif ($response) { |
|
280 | 274 | if (!empty($response['name'])) { |
281 | 275 | // Add a custom language to Drupal and enable |
282 | 276 | locale_add_language( |
@@ -291,8 +285,7 @@ discard block |
||
291 | 285 | drupal_set_message( |
292 | 286 | 'Added new language: '.$response['name'] |
293 | 287 | ); |
294 | - } |
|
295 | - else { |
|
288 | + } else { |
|
296 | 289 | $variables = array( |
297 | 290 | '%code' => $posix_code, |
298 | 291 | ); |
@@ -307,8 +300,7 @@ discard block |
||
307 | 300 | WATCHDOG_ERROR |
308 | 301 | ); |
309 | 302 | } |
310 | - } |
|
311 | - else { |
|
303 | + } else { |
|
312 | 304 | $variables = array( |
313 | 305 | '%code' => $posix_code, |
314 | 306 | ); |
@@ -349,8 +341,7 @@ discard block |
||
349 | 341 | batch_set($batch); |
350 | 342 | batch_process('admin/boinc/translation'); |
351 | 343 | } |
352 | - } |
|
353 | - else { |
|
344 | + } else { |
|
354 | 345 | $variables = array( |
355 | 346 | '%project' => $project, |
356 | 347 | ); |
@@ -365,8 +356,7 @@ discard block |
||
365 | 356 | WATCHDOG_ERROR |
366 | 357 | ); |
367 | 358 | } |
368 | - } |
|
369 | - else { |
|
359 | + } else { |
|
370 | 360 | $variables = array( |
371 | 361 | '%project' => $project, |
372 | 362 | ); |
@@ -423,8 +413,7 @@ discard block |
||
423 | 413 | 'content' => boinctranslate_get_po('en', 'project'), |
424 | 414 | ); |
425 | 415 | $result = boinctranslate_transifex_request($path, $post); |
426 | - } |
|
427 | - else { |
|
416 | + } else { |
|
428 | 417 | // Update the source |
429 | 418 | $path = "project/{$project_name}/resource/{$primary_resource}/content"; |
430 | 419 | $post = array( |
@@ -438,8 +427,7 @@ discard block |
||
438 | 427 | $enabled_languages = locale_language_list(); |
439 | 428 | if ($source_exists) { |
440 | 429 | drupal_set_message('Updated source translation strings at Transifex'); |
441 | - } |
|
442 | - else { |
|
430 | + } else { |
|
443 | 431 | drupal_set_message('Established new translation resource at Transifex'); |
444 | 432 | } |
445 | 433 | // Try to export translations for all enabled languages |
@@ -460,25 +448,21 @@ discard block |
||
460 | 448 | "Unable to update {$language_name} translations: {$result}", |
461 | 449 | 'warning' |
462 | 450 | ); |
463 | - } |
|
464 | - else { |
|
451 | + } else { |
|
465 | 452 | drupal_set_message("Updated {$language_name} translations"); |
466 | 453 | //drupal_set_message('DEBUG: <pre>'.print_r($result,1).'</pre>'); |
467 | 454 | } |
468 | - } |
|
469 | - else { |
|
455 | + } else { |
|
470 | 456 | drupal_set_message("No translations to export for {$language_name}"); |
471 | 457 | } |
472 | 458 | } |
473 | - } |
|
474 | - else { |
|
459 | + } else { |
|
475 | 460 | drupal_set_message( |
476 | 461 | "Unable to update the translation source: {$result}", |
477 | 462 | 'warning' |
478 | 463 | ); |
479 | 464 | } |
480 | - } |
|
481 | - else { |
|
465 | + } else { |
|
482 | 466 | drupal_set_message( |
483 | 467 | 'Failed to export translations: Transifex settings are not intiailized.', |
484 | 468 | 'error' |
@@ -534,42 +518,35 @@ discard block |
||
534 | 518 | "Unable to update {$language_name} official BOINC translations: {$result}", |
535 | 519 | 'warning' |
536 | 520 | ); |
537 | - } |
|
538 | - elseif ($result == '401 UNAUTHORIZED') { |
|
521 | + } elseif ($result == '401 UNAUTHORIZED') { |
|
539 | 522 | drupal_set_message( |
540 | 523 | 'Not authorized to update official BOINC translations', |
541 | 524 | 'warning' |
542 | 525 | ); |
543 | 526 | break; |
544 | - } |
|
545 | - elseif ($result == 'success') { |
|
527 | + } elseif ($result == 'success') { |
|
546 | 528 | drupal_set_message("Updated {$language_name} official BOINC translations"); |
547 | - } |
|
548 | - else { |
|
529 | + } else { |
|
549 | 530 | drupal_set_message( |
550 | 531 | "Unexpected response for {$language_name}: {$result}", |
551 | 532 | 'warning' |
552 | 533 | ); |
553 | 534 | } |
554 | - } |
|
555 | - else { |
|
535 | + } else { |
|
556 | 536 | drupal_set_message("Updated {$language_name} official BOINC translations"); |
557 | 537 | //drupal_set_message('DEBUG: <pre>'.print_r($result,1).'</pre>'); |
558 | 538 | } |
559 | - } |
|
560 | - else { |
|
539 | + } else { |
|
561 | 540 | drupal_set_message("No official BOINC translations to export for {$language_name}"); |
562 | 541 | } |
563 | 542 | } |
564 | - } |
|
565 | - else { |
|
543 | + } else { |
|
566 | 544 | drupal_set_message( |
567 | 545 | "The {$drupal_resource} resource does not exist in the {$project_name} project at Transifex", |
568 | 546 | 'warning' |
569 | 547 | ); |
570 | 548 | } |
571 | - } |
|
572 | - else { |
|
549 | + } else { |
|
573 | 550 | drupal_set_message( |
574 | 551 | 'Failed to export official BOINC translations: Transifex settings are not intiailized.', |
575 | 552 | 'error' |
@@ -594,8 +571,12 @@ discard block |
||
594 | 571 | |
595 | 572 | // Transifex details |
596 | 573 | $api_base_url = 'https://www.transifex.com/api/2'; |
597 | - if (!$username) $username = variable_get('boinc_translate_transifex_user', ''); |
|
598 | - if (!$password) $password = variable_get('boinc_translate_transifex_pass', ''); |
|
574 | + if (!$username) { |
|
575 | + $username = variable_get('boinc_translate_transifex_user', ''); |
|
576 | + } |
|
577 | + if (!$password) { |
|
578 | + $password = variable_get('boinc_translate_transifex_pass', ''); |
|
579 | + } |
|
599 | 580 | |
600 | 581 | $url = "{$api_base_url}/{$path}"; |
601 | 582 | $headers = array( |
@@ -607,13 +588,11 @@ discard block |
||
607 | 588 | if ($json) { |
608 | 589 | $headers['Content-Type'] = 'application/json'; |
609 | 590 | $data = json_encode($post); |
610 | - } |
|
611 | - else { |
|
591 | + } else { |
|
612 | 592 | $data = drupal_query_string_encode($post); |
613 | 593 | } |
614 | 594 | $method = ($use_put) ? 'PUT' : 'POST'; |
615 | - } |
|
616 | - else { |
|
595 | + } else { |
|
617 | 596 | $method = 'GET'; |
618 | 597 | } |
619 | 598 | |
@@ -625,8 +604,7 @@ discard block |
||
625 | 604 | if ($json) { |
626 | 605 | // Process as JSON |
627 | 606 | return json_decode($response->data, TRUE); |
628 | - } |
|
629 | - else { |
|
607 | + } else { |
|
630 | 608 | return (string) $response->data; |
631 | 609 | } |
632 | 610 | break; |
@@ -635,10 +613,14 @@ discard block |
||
635 | 613 | case 401: |
636 | 614 | return '401 UNAUTHORIZED'; |
637 | 615 | case 400: |
638 | - if ($debug_mode) watchdog('boinctranslate', "The following response was received when trying to communicate with the Transifex system: \n{$response}", array(), WATCHDOG_WARNING); |
|
616 | + if ($debug_mode) { |
|
617 | + watchdog('boinctranslate', "The following response was received when trying to communicate with the Transifex system: \n{$response}", array(), WATCHDOG_WARNING); |
|
618 | + } |
|
639 | 619 | return "ERROR: {$response->data}"; |
640 | 620 | case 405: |
641 | - if ($debug_mode) watchdog('boinctranslate', "The following response was received when trying to communicate with the Transifex system: \n{$response}", array(), WATCHDOG_WARNING); |
|
621 | + if ($debug_mode) { |
|
622 | + watchdog('boinctranslate', "The following response was received when trying to communicate with the Transifex system: \n{$response}", array(), WATCHDOG_WARNING); |
|
623 | + } |
|
642 | 624 | return "ERROR: User not allowed to perform this action"; |
643 | 625 | } |
644 | 626 | |
@@ -776,18 +758,15 @@ discard block |
||
776 | 758 | if ($plural) { |
777 | 759 | $translation = _locale_export_remove_plural($strings[$plural]['translation']); |
778 | 760 | $plural = isset($strings[$plural]['plural']) ? $strings[$plural]['plural'] : 0; |
779 | - } |
|
780 | - else { |
|
761 | + } else { |
|
781 | 762 | $translation = ''; |
782 | 763 | } |
783 | 764 | } |
784 | - } |
|
785 | - else { |
|
765 | + } else { |
|
786 | 766 | $output .= 'msgstr[0] ""' . "\n"; |
787 | 767 | $output .= 'msgstr[1] ""' . "\n"; |
788 | 768 | } |
789 | - } |
|
790 | - else { |
|
769 | + } else { |
|
791 | 770 | $output .= 'msgstr ' . _locale_export_string($string['translation']); |
792 | 771 | } |
793 | 772 | $output .= "\n"; |
@@ -934,8 +913,7 @@ discard block |
||
934 | 913 | |
935 | 914 | if ($response == '404 NOT FOUND') { |
936 | 915 | $message = "Project resource {$project}:{$resource} not found in {$language}."; |
937 | - } |
|
938 | - elseif ($response) { |
|
916 | + } elseif ($response) { |
|
939 | 917 | if (!empty($response['content'])) { |
940 | 918 | $po_text = $response['content']; |
941 | 919 | |
@@ -956,23 +934,19 @@ discard block |
||
956 | 934 | . " {$project}:{$resource} failed."; |
957 | 935 | $success = FALSE; |
958 | 936 | break; |
959 | - } |
|
960 | - else { |
|
937 | + } else { |
|
961 | 938 | $success = TRUE; |
962 | 939 | } |
963 | 940 | } |
964 | - } |
|
965 | - else { |
|
941 | + } else { |
|
966 | 942 | $message = "Unable to read response for {$language} translation import" |
967 | 943 | . " of {$project}:{$resource}."; |
968 | 944 | } |
969 | - } |
|
970 | - else { |
|
945 | + } else { |
|
971 | 946 | $message = "Translation data not found in response for {$language}" |
972 | 947 | . " translation import of {$project}:{$resource}."; |
973 | 948 | } |
974 | - } |
|
975 | - else { |
|
949 | + } else { |
|
976 | 950 | // If project isn't specified, import as a local Drupal resource |
977 | 951 | $project = 'drupal.local'; |
978 | 952 | $file = new stdClass(); |
@@ -983,8 +957,7 @@ discard block |
||
983 | 957 | . " local file {$resource} failed."; |
984 | 958 | $success = FALSE; |
985 | 959 | break; |
986 | - } |
|
987 | - else { |
|
960 | + } else { |
|
988 | 961 | $success = TRUE; |
989 | 962 | } |
990 | 963 | } |
@@ -1002,8 +975,7 @@ discard block |
||
1002 | 975 | WATCHDOG_INFO |
1003 | 976 | ); |
1004 | 977 | } |
1005 | - } |
|
1006 | - else { |
|
978 | + } else { |
|
1007 | 979 | $context['results']['failure'][] = "{$langcode}:{$textgroup}"; |
1008 | 980 | watchdog( |
1009 | 981 | 'boinctranslate', |
@@ -1021,8 +993,7 @@ discard block |
||
1021 | 993 | // Update the progress for the batch engine |
1022 | 994 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
1023 | 995 | $context['finished'] = 1; |
1024 | - } |
|
1025 | - else { |
|
996 | + } else { |
|
1026 | 997 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
1027 | 998 | } |
1028 | 999 | } |
@@ -1041,8 +1012,7 @@ discard block |
||
1041 | 1012 | array('@count' => $count), |
1042 | 1013 | WATCHDOG_INFO |
1043 | 1014 | ); |
1044 | - } |
|
1045 | - else { |
|
1015 | + } else { |
|
1046 | 1016 | // An error occurred. |
1047 | 1017 | // $operations contains the operations that remained unprocessed. |
1048 | 1018 | $error_operation = reset($operations); |
@@ -1140,14 +1110,12 @@ discard block |
||
1140 | 1110 | if (!strncmp("#", $line, 1)) { // A comment |
1141 | 1111 | if ($context == "COMMENT") { // Already in comment context: add |
1142 | 1112 | $current["#"][] = substr($line, 1); |
1143 | - } |
|
1144 | - elseif (($context == "MSGSTR") || ($context == "MSGSTR_ARR")) { // End current entry, start a new one |
|
1113 | + } elseif (($context == "MSGSTR") || ($context == "MSGSTR_ARR")) { // End current entry, start a new one |
|
1145 | 1114 | _boinctranslate_locale_import_one_string($op, $current, $mode, $lang, $file, $group); |
1146 | 1115 | $current = array(); |
1147 | 1116 | $current["#"][] = substr($line, 1); |
1148 | 1117 | $context = "COMMENT"; |
1149 | - } |
|
1150 | - else { // Parse error |
|
1118 | + } else { // Parse error |
|
1151 | 1119 | watchdog( |
1152 | 1120 | 'boinctranslate', |
1153 | 1121 | 'The translation file %filename for %lang contains an error: "msgstr" was expected but not found on line %line.', |
@@ -1157,13 +1125,11 @@ discard block |
||
1157 | 1125 | _locale_import_message('The translation file %filename contains an error: "msgstr" was expected but not found on line %line.', $file, $lineno); |
1158 | 1126 | return FALSE; |
1159 | 1127 | } |
1160 | - } |
|
1161 | - elseif (!strncmp("msgctxt", $line, 7)) { |
|
1128 | + } elseif (!strncmp("msgctxt", $line, 7)) { |
|
1162 | 1129 | if (($context == "MSGSTR") || ($context == "MSGSTR_ARR")) { // End current entry, start a new one |
1163 | 1130 | _boinctranslate_locale_import_one_string($op, $current, $mode, $lang, $file, $group); |
1164 | 1131 | $current = array(); |
1165 | - } |
|
1166 | - elseif (($context == "MSGID") || ($context == "MSGCTXT")) { // Already in this context? Parse error |
|
1132 | + } elseif (($context == "MSGID") || ($context == "MSGCTXT")) { // Already in this context? Parse error |
|
1167 | 1133 | watchdog( |
1168 | 1134 | 'boinctranslate', |
1169 | 1135 | 'The translation file %filename for %lang contains an error: "msgctxt" is unexpected on line %line.', |
@@ -1187,8 +1153,7 @@ discard block |
||
1187 | 1153 | } |
1188 | 1154 | $current["msgctxt"] = $quoted; |
1189 | 1155 | $context = "MSGCTXT"; |
1190 | - } |
|
1191 | - elseif (!strncmp("msgid_plural", $line, 12)) { |
|
1156 | + } elseif (!strncmp("msgid_plural", $line, 12)) { |
|
1192 | 1157 | if ($context != "MSGID") { // Must be plural form for current entry |
1193 | 1158 | watchdog( |
1194 | 1159 | 'boinctranslate', |
@@ -1213,13 +1178,11 @@ discard block |
||
1213 | 1178 | } |
1214 | 1179 | $current["msgid"] = $current["msgid"] . "\0" . $quoted; |
1215 | 1180 | $context = "MSGID_PLURAL"; |
1216 | - } |
|
1217 | - elseif (!strncmp("msgid", $line, 5)) { |
|
1181 | + } elseif (!strncmp("msgid", $line, 5)) { |
|
1218 | 1182 | if (($context == "MSGSTR") || ($context == "MSGSTR_ARR")) { // End current entry, start a new one |
1219 | 1183 | _boinctranslate_locale_import_one_string($op, $current, $mode, $lang, $file, $group); |
1220 | 1184 | $current = array(); |
1221 | - } |
|
1222 | - elseif ($context == "MSGID") { // Already in this context? Parse error |
|
1185 | + } elseif ($context == "MSGID") { // Already in this context? Parse error |
|
1223 | 1186 | watchdog( |
1224 | 1187 | 'boinctranslate', |
1225 | 1188 | 'The translation file %filename for %lang contains an error: "msgid" is unexpected on line %line.', |
@@ -1243,8 +1206,7 @@ discard block |
||
1243 | 1206 | } |
1244 | 1207 | $current["msgid"] = $quoted; |
1245 | 1208 | $context = "MSGID"; |
1246 | - } |
|
1247 | - elseif (!strncmp("msgstr[", $line, 7)) { |
|
1209 | + } elseif (!strncmp("msgstr[", $line, 7)) { |
|
1248 | 1210 | if (($context != "MSGID") && ($context != "MSGID_PLURAL") && ($context != "MSGSTR_ARR")) { // Must come after msgid, msgid_plural, or msgstr[] |
1249 | 1211 | watchdog( |
1250 | 1212 | 'boinctranslate', |
@@ -1281,8 +1243,7 @@ discard block |
||
1281 | 1243 | } |
1282 | 1244 | $current["msgstr"][$plural] = $quoted; |
1283 | 1245 | $context = "MSGSTR_ARR"; |
1284 | - } |
|
1285 | - elseif (!strncmp("msgstr", $line, 6)) { |
|
1246 | + } elseif (!strncmp("msgstr", $line, 6)) { |
|
1286 | 1247 | if ($context != "MSGID") { // Should come just after a msgid block |
1287 | 1248 | watchdog( |
1288 | 1249 | 'boinctranslate', |
@@ -1307,8 +1268,7 @@ discard block |
||
1307 | 1268 | } |
1308 | 1269 | $current["msgstr"] = $quoted; |
1309 | 1270 | $context = "MSGSTR"; |
1310 | - } |
|
1311 | - elseif ($line != "") { |
|
1271 | + } elseif ($line != "") { |
|
1312 | 1272 | $quoted = _locale_import_parse_quoted($line); |
1313 | 1273 | if ($quoted === FALSE) { |
1314 | 1274 | watchdog( |
@@ -1322,14 +1282,11 @@ discard block |
||
1322 | 1282 | } |
1323 | 1283 | if (($context == "MSGID") || ($context == "MSGID_PLURAL")) { |
1324 | 1284 | $current["msgid"] .= $quoted; |
1325 | - } |
|
1326 | - elseif ($context == "MSGSTR") { |
|
1285 | + } elseif ($context == "MSGSTR") { |
|
1327 | 1286 | $current["msgstr"] .= $quoted; |
1328 | - } |
|
1329 | - elseif ($context == "MSGSTR_ARR") { |
|
1287 | + } elseif ($context == "MSGSTR_ARR") { |
|
1330 | 1288 | $current["msgstr"][$plural] .= $quoted; |
1331 | - } |
|
1332 | - else { |
|
1289 | + } else { |
|
1333 | 1290 | watchdog( |
1334 | 1291 | 'boinctranslate', |
1335 | 1292 | 'The translation file %filename for %lang contains an error: there is an unexpected string on line %line.', |
@@ -1345,8 +1302,7 @@ discard block |
||
1345 | 1302 | // End of PO file, flush last entry |
1346 | 1303 | if (($context == "MSGSTR") || ($context == "MSGSTR_ARR")) { |
1347 | 1304 | _boinctranslate_locale_import_one_string($op, $current, $mode, $lang, $file, $group); |
1348 | - } |
|
1349 | - elseif ($context != "COMMENT") { |
|
1305 | + } elseif ($context != "COMMENT") { |
|
1350 | 1306 | watchdog( |
1351 | 1307 | 'boinctranslate', |
1352 | 1308 | 'The translation file %filename for %lang ended unexpectedly at line %line.', |
@@ -1413,9 +1369,7 @@ discard block |
||
1413 | 1369 | } |
1414 | 1370 | } |
1415 | 1371 | $headerdone = TRUE; |
1416 | - } |
|
1417 | - |
|
1418 | - else { |
|
1372 | + } else { |
|
1419 | 1373 | // Some real string to import. |
1420 | 1374 | $comments = _locale_import_shorten_comments(empty($value['#']) ? array() : $value['#']); |
1421 | 1375 | |
@@ -1434,9 +1388,7 @@ discard block |
||
1434 | 1388 | } |
1435 | 1389 | $plid = _boinctranslate_locale_import_one_string_db($report, $lang, $english[$key], $trans, $group, $comments, $mode, $plid, $key); |
1436 | 1390 | } |
1437 | - } |
|
1438 | - |
|
1439 | - else { |
|
1391 | + } else { |
|
1440 | 1392 | // A simple string to import. |
1441 | 1393 | $english = $value['msgid']; |
1442 | 1394 | $translation = $value['msgstr']; |
@@ -1460,8 +1412,7 @@ discard block |
||
1460 | 1412 | if ($textgroup == "default" && !locale_string_is_safe($translation)) { |
1461 | 1413 | $report['skips']++; |
1462 | 1414 | $lid = 0; |
1463 | - } |
|
1464 | - elseif ($lid) { |
|
1415 | + } elseif ($lid) { |
|
1465 | 1416 | // We have this source string saved already. |
1466 | 1417 | // Don't update location, that just makes Drupal add the same strings |
1467 | 1418 | // over and over |
@@ -1471,14 +1422,12 @@ discard block |
||
1471 | 1422 | // No translation in this language. |
1472 | 1423 | db_query("INSERT INTO {locales_target} (lid, language, translation, plid, plural) VALUES (%d, '%s', '%s', %d, %d)", $lid, $langcode, $translation, $plid, $plural); |
1473 | 1424 | $report['additions']++; |
1474 | - } |
|
1475 | - else if ($mode == LOCALE_IMPORT_OVERWRITE) { |
|
1425 | + } else if ($mode == LOCALE_IMPORT_OVERWRITE) { |
|
1476 | 1426 | // Translation exists, only overwrite if instructed. |
1477 | 1427 | db_query("UPDATE {locales_target} SET translation = '%s', plid = %d, plural = %d WHERE language = '%s' AND lid = %d", $translation, $plid, $plural, $langcode, $lid); |
1478 | 1428 | $report['updates']++; |
1479 | 1429 | } |
1480 | - } |
|
1481 | - else { |
|
1430 | + } else { |
|
1482 | 1431 | // No such source string in the database yet. |
1483 | 1432 | // Do not insert the source string if it does not belong on the site! |
1484 | 1433 | /* |
@@ -1488,16 +1437,14 @@ discard block |
||
1488 | 1437 | $report['additions']++; |
1489 | 1438 | */ |
1490 | 1439 | } |
1491 | - } |
|
1492 | - elseif ($mode == LOCALE_IMPORT_OVERWRITE AND $lid) { |
|
1440 | + } elseif ($mode == LOCALE_IMPORT_OVERWRITE AND $lid) { |
|
1493 | 1441 | $exists = (bool) db_result(db_query("SELECT lid FROM {locales_target} WHERE lid = %d AND language = '%s'", $lid, $langcode)); |
1494 | 1442 | if ($exists) { |
1495 | 1443 | // Empty translation, remove existing if instructed. |
1496 | 1444 | db_query("DELETE FROM {locales_target} WHERE language = '%s' AND lid = %d AND plid = %d AND plural = %d", $langcode, $lid, $plid, $plural); |
1497 | 1445 | $report['deletes']++; |
1498 | 1446 | } |
1499 | - } |
|
1500 | - else { |
|
1447 | + } else { |
|
1501 | 1448 | $report['skips']++; |
1502 | 1449 | } |
1503 | 1450 |
@@ -220,8 +220,7 @@ discard block |
||
220 | 220 | if (!$values['boinc_translate_transifex_pass']) { |
221 | 221 | if (!variable_get('boinc_translate_transifex_pass', '')) { |
222 | 222 | form_set_error('boinc_translate_transifex_pass', t('Password is required.')); |
223 | - } |
|
224 | - else { |
|
223 | + } else { |
|
225 | 224 | unset($form_state['values']['boinc_translate_transifex_pass']); |
226 | 225 | } |
227 | 226 | } |
@@ -260,8 +259,7 @@ discard block |
||
260 | 259 | 'boinc_translate_transifex_pass', |
261 | 260 | t('Transifex authentication failed.') |
262 | 261 | ); |
263 | - } |
|
264 | - else { |
|
262 | + } else { |
|
265 | 263 | $authenticated = TRUE; |
266 | 264 | } |
267 | 265 | } |
@@ -278,14 +276,12 @@ discard block |
||
278 | 276 | ); |
279 | 277 | if ($project_name AND $project_resources) { |
280 | 278 | $transifex_resources[$project_name] = $project_resources; |
281 | - } |
|
282 | - elseif ($project_name AND !$project_resources) { |
|
279 | + } elseif ($project_name AND !$project_resources) { |
|
283 | 280 | drupal_set_message( |
284 | 281 | t('No project-specific resources were provided'), |
285 | 282 | 'warning' |
286 | 283 | ); |
287 | - } |
|
288 | - elseif ($project_resources AND !$project_name) { |
|
284 | + } elseif ($project_resources AND !$project_name) { |
|
289 | 285 | drupal_set_message( |
290 | 286 | t('No project-specific Transifex project name was provided'), |
291 | 287 | 'warning' |
@@ -303,8 +303,7 @@ discard block |
||
303 | 303 | if (!boincuser_register_validate($edit)) { |
304 | 304 | // BOINC user validation failed for registration; set an error accordingly |
305 | 305 | form_set_error('mail', bts('An account already exists for @email. Log in or request password assistance to access your @project account.', array('@email' => $edit['mail'], '@project' => PROJECT))); |
306 | - } |
|
307 | - else { |
|
306 | + } else { |
|
308 | 307 | // Save profile information for use during Insert |
309 | 308 | $_SESSION['profileInfo'] = array( |
310 | 309 | 'country' => $edit['field_country'][0]['value'], |
@@ -557,8 +556,7 @@ discard block |
||
557 | 556 | case FLAG_FRIEND_APPROVAL: |
558 | 557 | if ($action == 'flag') { |
559 | 558 | $form['flag_friend_submit']['#value'] = bts('Approve request'); |
560 | - } |
|
561 | - elseif ($action == 'unflag') { |
|
559 | + } elseif ($action == 'unflag') { |
|
562 | 560 | unset($form['actions']); |
563 | 561 | $form['flag_friend_submit']['#value'] = bts('Deny request'); |
564 | 562 | } |
@@ -1211,8 +1209,7 @@ discard block |
||
1211 | 1209 | $output .= '<p>' . bts("If you're running a command-line or pre-5.0 version |
1212 | 1210 | of BOINC, !create_an_account first.", array('!create_an_account' => |
1213 | 1211 | l(bts('create an account'), 'user/registration'))) . '</p>'; |
1214 | - } |
|
1215 | - else { |
|
1212 | + } else { |
|
1216 | 1213 | $output .= '<p>' . bts("If you're running a command-line version of BOINC, |
1217 | 1214 | first use the BOINC Manager software (elsewhere if necessary) to create an |
1218 | 1215 | an account at this project, then use that account to connect with the |
@@ -1264,8 +1261,7 @@ discard block |
||
1264 | 1261 | )); |
1265 | 1262 | if ($current_uotd->uotd_time < strtotime('today midnight')) { |
1266 | 1263 | $uotd = boincuser_select_user_of_the_day(); |
1267 | - } |
|
1268 | - else { |
|
1264 | + } else { |
|
1269 | 1265 | $uotd = user_load($current_uotd->uid); |
1270 | 1266 | } |
1271 | 1267 | $uotd_image = boincuser_get_user_profile_image($uotd->uid, FALSE); |
@@ -1276,8 +1272,7 @@ discard block |
||
1276 | 1272 | $output .= ' <div>' . bts($site_message, array(), NULL, "project:front page") . ' ' . l(bts('Learn more'), 'about') . '</div>'; |
1277 | 1273 | if ($user->uid) { |
1278 | 1274 | $output .= ' <div>' . l(bts('View account'), 'dashboard', array('attributes' => array('class' => 'join button'))) . '</div>'; |
1279 | - } |
|
1280 | - else { |
|
1275 | + } else { |
|
1281 | 1276 | $output .= ' <div>' . l(bts('Join now'), 'join', array('attributes' => array('class' => 'join button'))) . '</div>'; |
1282 | 1277 | } |
1283 | 1278 | $output .= '</div>'; |
@@ -1649,7 +1644,9 @@ discard block |
||
1649 | 1644 | $account = user_load($account); |
1650 | 1645 | } |
1651 | 1646 | $projects = boincuser_get_projects($account); |
1652 | - if (!$projects) return bts('no projects...'); |
|
1647 | + if (!$projects) { |
|
1648 | + return bts('no projects...'); |
|
1649 | + } |
|
1653 | 1650 | |
1654 | 1651 | $output = ''; |
1655 | 1652 | $output .= '<table class="user-projects">' . "\n"; |
@@ -1690,7 +1687,9 @@ discard block |
||
1690 | 1687 | 'cpid' => $cpid |
1691 | 1688 | ); |
1692 | 1689 | $args = array(); |
1693 | - foreach ($get as $arg => $value) $args[] = "{$arg}=" . rawurlencode($value); |
|
1690 | + foreach ($get as $arg => $value) { |
|
1691 | + $args[] = "{$arg}=" . rawurlencode($value); |
|
1692 | + } |
|
1694 | 1693 | $query = '?' . implode('&', $args); |
1695 | 1694 | |
1696 | 1695 | // Load XML from RPC |
@@ -1821,8 +1820,7 @@ discard block |
||
1821 | 1820 | if ($node->uid == 0 || strlen($node->name) == 0) { |
1822 | 1821 | // @see user_validate_name(). !'0' === TRUE. |
1823 | 1822 | $document->ss_name = '0'; |
1824 | - } |
|
1825 | - else { |
|
1823 | + } else { |
|
1826 | 1824 | $document->ss_name = $account->boincuser_name; |
1827 | 1825 | // We want the name to be searchable for keywords. |
1828 | 1826 | $document->tos_name = $account->boincuser_name; |