@@ -643,9 +643,9 @@ discard block |
||
| 643 | 643 | } |
| 644 | 644 | break; |
| 645 | 645 | |
| 646 | - default: |
|
| 647 | - // Don't generate form elements for things that aren't explicitly form |
|
| 648 | - // elements (i.e. 'title', '@attributes' keys, and the like) |
|
| 646 | + default: |
|
| 647 | + // Don't generate form elements for things that aren't explicitly form |
|
| 648 | + // elements (i.e. 'title', '@attributes' keys, and the like) |
|
| 649 | 649 | } |
| 650 | 650 | } |
| 651 | 651 | |
@@ -1990,31 +1990,31 @@ discard block |
||
| 1990 | 1990 | */ |
| 1991 | 1991 | function pretty_application_version($appverid, $vernum, $plan_class, $plfm) { |
| 1992 | 1992 | switch ($appverid) { |
| 1993 | - case ANON_PLATFORM_UNKNOWN: |
|
| 1994 | - return "Anonymous platform"; |
|
| 1995 | - case ANON_PLATFORM_CPU: |
|
| 1996 | - return "Anonymous platform CPU"; |
|
| 1997 | - case ANON_PLATFORM_NVIDIA: |
|
| 1998 | - return "Anonymous platform NVIDIA GPU"; |
|
| 1999 | - case ANON_PLATFORM_ATI: |
|
| 2000 | - return "Anonymous platform AMD GPU"; |
|
| 2001 | - case ANON_PLATFORM_INTEL_GPU: |
|
| 2002 | - return "Anonymous platform Intel GPU"; |
|
| 2003 | - case ANON_PLATFORM_APPLE_GPU: |
|
| 2004 | - return "Anonymous platform Apple GPU"; |
|
| 2005 | - case 0: |
|
| 2006 | - return "---"; |
|
| 2007 | - default: |
|
| 2008 | - // Handle the case where the appversid is still negative. This |
|
| 2009 | - // may be cause BOINC has introduced a new anonymous platform |
|
| 2010 | - // that is not handled by the above case statements. |
|
| 2011 | - if ($appverid < 0) { |
|
| 2012 | - return "Unknown Anonymous platform"; |
|
| 2013 | - } |
|
| 2014 | - else { |
|
| 2015 | - $prettyv = sprintf("%d.%02d", $vernum/100, $vernum%100); |
|
| 2016 | - $prettyc = ($plan_class) ? "($plan_class)" : ''; |
|
| 2017 | - return "v$prettyv $prettyc $plfm"; |
|
| 2018 | - } |
|
| 1993 | + case ANON_PLATFORM_UNKNOWN: |
|
| 1994 | + return "Anonymous platform"; |
|
| 1995 | + case ANON_PLATFORM_CPU: |
|
| 1996 | + return "Anonymous platform CPU"; |
|
| 1997 | + case ANON_PLATFORM_NVIDIA: |
|
| 1998 | + return "Anonymous platform NVIDIA GPU"; |
|
| 1999 | + case ANON_PLATFORM_ATI: |
|
| 2000 | + return "Anonymous platform AMD GPU"; |
|
| 2001 | + case ANON_PLATFORM_INTEL_GPU: |
|
| 2002 | + return "Anonymous platform Intel GPU"; |
|
| 2003 | + case ANON_PLATFORM_APPLE_GPU: |
|
| 2004 | + return "Anonymous platform Apple GPU"; |
|
| 2005 | + case 0: |
|
| 2006 | + return "---"; |
|
| 2007 | + default: |
|
| 2008 | + // Handle the case where the appversid is still negative. This |
|
| 2009 | + // may be cause BOINC has introduced a new anonymous platform |
|
| 2010 | + // that is not handled by the above case statements. |
|
| 2011 | + if ($appverid < 0) { |
|
| 2012 | + return "Unknown Anonymous platform"; |
|
| 2013 | + } |
|
| 2014 | + else { |
|
| 2015 | + $prettyv = sprintf("%d.%02d", $vernum/100, $vernum%100); |
|
| 2016 | + $prettyc = ($plan_class) ? "($plan_class)" : ''; |
|
| 2017 | + return "v$prettyv $prettyc $plfm"; |
|
| 2018 | + } |
|
| 2019 | 2019 | } |
| 2020 | 2020 | } |
@@ -332,8 +332,7 @@ discard block |
||
| 332 | 332 | $name = $element['@attributes']['name']; |
| 333 | 333 | if (isset($element['@attributes']['entitytype']) AND $element['@attributes']['entitytype'] == 'attribute') { |
| 334 | 334 | $defaults['@attributes'][$name] = $values[$name]; |
| 335 | - } |
|
| 336 | - else { |
|
| 335 | + } else { |
|
| 337 | 336 | $defaults[$name] = $values[$name]; |
| 338 | 337 | } |
| 339 | 338 | } |
@@ -384,8 +383,7 @@ discard block |
||
| 384 | 383 | if (isset($user_pref[$name])) { |
| 385 | 384 | if (is_array($user_pref[$name]) AND isset($user_pref[$name]['@value'])) { |
| 386 | 385 | $value = $user_pref[$name]['@value']; |
| 387 | - } |
|
| 388 | - else { |
|
| 386 | + } else { |
|
| 389 | 387 | $value = $user_pref[$name]; |
| 390 | 388 | } |
| 391 | 389 | } |
@@ -447,8 +445,7 @@ discard block |
||
| 447 | 445 | if (isset($user_pref[$name])) { |
| 448 | 446 | if (is_array($user_pref[$name]) AND isset($user_pref[$name]['@value'])) { |
| 449 | 447 | $value = $user_pref[$name]['@value']; |
| 450 | - } |
|
| 451 | - else { |
|
| 448 | + } else { |
|
| 452 | 449 | $value = $user_pref[$name]; |
| 453 | 450 | } |
| 454 | 451 | } |
@@ -492,8 +489,7 @@ discard block |
||
| 492 | 489 | isset($item['@attributes']['selected'])) { |
| 493 | 490 | $default = ($item['@attributes']['selected'] == 'true') ? $item['@value'] : null; |
| 494 | 491 | } |
| 495 | - } |
|
| 496 | - else { |
|
| 492 | + } else { |
|
| 497 | 493 | $value = $item; |
| 498 | 494 | } |
| 499 | 495 | $options[$value] = $value; |
@@ -696,8 +692,7 @@ discard block |
||
| 696 | 692 | ); |
| 697 | 693 | if ($top_level) { |
| 698 | 694 | $uncategorized[$key] = $prefs_element; |
| 699 | - } |
|
| 700 | - else { |
|
| 695 | + } else { |
|
| 701 | 696 | $prefs_table[$key] = $prefs_element; |
| 702 | 697 | } |
| 703 | 698 | break; |
@@ -711,8 +706,7 @@ discard block |
||
| 711 | 706 | 'name' => bts('Other settings', array(), NULL, 'boinc:account-preferences'), |
| 712 | 707 | 'elements' => $uncategorized, |
| 713 | 708 | ); |
| 714 | - } |
|
| 715 | - elseif ($uncategorized) { |
|
| 709 | + } elseif ($uncategorized) { |
|
| 716 | 710 | // If nothing is categorized, output all prefs under a general "settings" |
| 717 | 711 | $prefs_table['settings'] = array( |
| 718 | 712 | 'name' => bts('Settings', array(), NULL, 'boinc:account-preferences'), |
@@ -745,8 +739,7 @@ discard block |
||
| 745 | 739 | $main_prefs = load_configuration($boincuser->project_prefs); |
| 746 | 740 | $main_prefs = (array) $main_prefs['project_preferences']; |
| 747 | 741 | } |
| 748 | - } |
|
| 749 | - else { |
|
| 742 | + } else { |
|
| 750 | 743 | if ($boincuser->global_prefs) { |
| 751 | 744 | $main_prefs = load_configuration($boincuser->global_prefs); |
| 752 | 745 | $main_prefs = (array) $main_prefs['global_preferences']; |
@@ -762,8 +755,7 @@ discard block |
||
| 762 | 755 | if (count($main_prefs) < 3) |
| 763 | 756 | $main_prefs['@attributes'] = array('cleared' => 1); |
| 764 | 757 | return $main_prefs; |
| 765 | - } |
|
| 766 | - else { |
|
| 758 | + } else { |
|
| 767 | 759 | if (isset($main_prefs['venue'])) { |
| 768 | 760 | if (!is_numeric(key($main_prefs['venue']))) { |
| 769 | 761 | $main_prefs['venue'] = array($main_prefs['venue']); |
@@ -803,8 +795,7 @@ discard block |
||
| 803 | 795 | $main_prefs = load_configuration($boincuser->project_prefs); |
| 804 | 796 | $main_prefs = (array) $main_prefs['project_preferences']; |
| 805 | 797 | } |
| 806 | - } |
|
| 807 | - else { |
|
| 798 | + } else { |
|
| 808 | 799 | if ($boincuser->global_prefs) { |
| 809 | 800 | $main_prefs = load_configuration($boincuser->global_prefs); |
| 810 | 801 | $main_prefs = (array) $main_prefs['global_preferences']; |
@@ -817,8 +808,7 @@ discard block |
||
| 817 | 808 | if (!$venue OR $venue == 'generic') { |
| 818 | 809 | //$main_prefs = $prefs; |
| 819 | 810 | $main_prefs = $prefs + $main_prefs; |
| 820 | - } |
|
| 821 | - else { |
|
| 811 | + } else { |
|
| 822 | 812 | if (isset($main_prefs['venue'])) { |
| 823 | 813 | if (!is_numeric(key($main_prefs['venue']))) { |
| 824 | 814 | $main_prefs['venue'] = array($main_prefs['venue']); |
@@ -827,8 +817,7 @@ discard block |
||
| 827 | 817 | if (isset($prefs_venue['@attributes']['name']) AND $prefs_venue['@attributes']['name'] == $venue) { |
| 828 | 818 | if ($prefs) { |
| 829 | 819 | $main_prefs['venue'][$key] = $prefs; |
| 830 | - } |
|
| 831 | - else { |
|
| 820 | + } else { |
|
| 832 | 821 | // If prefs is null, clear out this preference set |
| 833 | 822 | unset($main_prefs['venue'][$key]); |
| 834 | 823 | if (count($main_prefs['venue']) == 0) { |
@@ -875,8 +864,7 @@ discard block |
||
| 875 | 864 | db_set_active('boinc_rw'); |
| 876 | 865 | $result = db_query("UPDATE user SET project_prefs = '{$boincuser->project_prefs}' WHERE id = '{$boincuser->id}'"); |
| 877 | 866 | db_set_active('default'); |
| 878 | - } |
|
| 879 | - else { |
|
| 867 | + } else { |
|
| 880 | 868 | $main_prefs = array('global_preferences' => $main_prefs); |
| 881 | 869 | $boincuser->global_prefs = save_configuration($main_prefs); |
| 882 | 870 | db_set_active('boinc_rw'); |
@@ -963,8 +951,7 @@ discard block |
||
| 963 | 951 | NULL, 'boinc:ignore-user-add'), |
| 964 | 952 | 'status'); |
| 965 | 953 | drupal_goto(); |
| 966 | - } |
|
| 967 | - else { |
|
| 954 | + } else { |
|
| 968 | 955 | drupal_not_found(); |
| 969 | 956 | }// endif iuid |
| 970 | 957 | } |
@@ -1052,15 +1039,13 @@ discard block |
||
| 1052 | 1039 | // Process nested form elements |
| 1053 | 1040 | $parents[] = $field; |
| 1054 | 1041 | boincwork_validate_form($rules, $values[$field], $parents); |
| 1055 | - } |
|
| 1056 | - else { |
|
| 1042 | + } else { |
|
| 1057 | 1043 | if ($parents) { |
| 1058 | 1044 | // form_set_error() identifies nested form elements with '][' as a |
| 1059 | 1045 | // delimiter between each parent and child element |
| 1060 | 1046 | $parents[] = $field; |
| 1061 | 1047 | $form_field = implode('][', $parents); |
| 1062 | - } |
|
| 1063 | - else { |
|
| 1048 | + } else { |
|
| 1064 | 1049 | $form_field = $field; |
| 1065 | 1050 | } |
| 1066 | 1051 | if (isset($rules['datatype']) AND !boincwork_validate_datatype($values[$field], $rules['datatype'])) { |
@@ -1142,8 +1127,7 @@ discard block |
||
| 1142 | 1127 | // load_configuration(): Convert structured text/xml to array |
| 1143 | 1128 | //------------------------------------------------------------------------------------------------ |
| 1144 | 1129 | |
| 1145 | - function load_configuration($text) |
|
| 1146 | - { |
|
| 1130 | + function load_configuration($text) { |
|
| 1147 | 1131 | if (preg_match('/^\<\?xml .*\?\>$/i', $text)) return null; |
| 1148 | 1132 | if ($xml = text_to_xml($text)) return xml_to_array($xml); |
| 1149 | 1133 | return false; |
@@ -1153,8 +1137,7 @@ discard block |
||
| 1153 | 1137 | // save_configuration(): Convert array to structured text/xml |
| 1154 | 1138 | //------------------------------------------------------------------------------------------------ |
| 1155 | 1139 | |
| 1156 | - function save_configuration($array) |
|
| 1157 | - { |
|
| 1140 | + function save_configuration($array) { |
|
| 1158 | 1141 | if ($xml = array_to_xml($array)) return xml_to_text($xml, false, true); |
| 1159 | 1142 | return false; |
| 1160 | 1143 | } |
@@ -1186,26 +1169,22 @@ discard block |
||
| 1186 | 1169 | $ordered_array[$item['@position']] = array( |
| 1187 | 1170 | $name => $item |
| 1188 | 1171 | ); |
| 1189 | - } |
|
| 1190 | - else { |
|
| 1172 | + } else { |
|
| 1191 | 1173 | $unordered_array[] = array( |
| 1192 | 1174 | $name => $item |
| 1193 | 1175 | ); |
| 1194 | 1176 | } |
| 1195 | 1177 | } |
| 1196 | - } |
|
| 1197 | - elseif (isset($value['@position'])) { |
|
| 1178 | + } elseif (isset($value['@position'])) { |
|
| 1198 | 1179 | $ordered_array[$value['@position']] = array( |
| 1199 | 1180 | $name => $value |
| 1200 | 1181 | ); |
| 1201 | - } |
|
| 1202 | - else { |
|
| 1182 | + } else { |
|
| 1203 | 1183 | $unordered_array[] = array( |
| 1204 | 1184 | $name => $value |
| 1205 | 1185 | ); |
| 1206 | 1186 | } |
| 1207 | - } |
|
| 1208 | - else { |
|
| 1187 | + } else { |
|
| 1209 | 1188 | $unordered_array[] = array( |
| 1210 | 1189 | $name => $value |
| 1211 | 1190 | ); |
@@ -1291,8 +1270,7 @@ discard block |
||
| 1291 | 1270 | // xml_to_text(): Convert an XML DOM object to string format |
| 1292 | 1271 | //------------------------------------------------------------------------------------------------ |
| 1293 | 1272 | |
| 1294 | - function xml_to_text($xml, $include_xml_declaration = true, $add_carriage_returns = false) |
|
| 1295 | - { |
|
| 1273 | + function xml_to_text($xml, $include_xml_declaration = true, $add_carriage_returns = false) { |
|
| 1296 | 1274 | $xml->formatOutput = true; |
| 1297 | 1275 | $text = $xml->saveXML(); |
| 1298 | 1276 | if (!$include_xml_declaration) { |
@@ -1335,10 +1313,14 @@ discard block |
||
| 1335 | 1313 | $sibling = $node->nextSibling; |
| 1336 | 1314 | |
| 1337 | 1315 | // Determine if this node forms a set with siblings (share a node name) |
| 1338 | - while (($sibling) AND (($sibling->nodeType != XML_ELEMENT_NODE) OR ($sibling->nodeName != $node->nodeName))) $sibling = $sibling->nextSibling; |
|
| 1316 | + while (($sibling) AND (($sibling->nodeType != XML_ELEMENT_NODE) OR ($sibling->nodeName != $node->nodeName))) { |
|
| 1317 | + $sibling = $sibling->nextSibling; |
|
| 1318 | + } |
|
| 1339 | 1319 | if (!$sibling) { |
| 1340 | 1320 | $sibling = $node->previousSibling; |
| 1341 | - while (($sibling) AND (($sibling->nodeType != XML_ELEMENT_NODE) OR ($sibling->nodeName != $node->nodeName))) $sibling = $sibling->previousSibling; |
|
| 1321 | + while (($sibling) AND (($sibling->nodeType != XML_ELEMENT_NODE) OR ($sibling->nodeName != $node->nodeName))) { |
|
| 1322 | + $sibling = $sibling->previousSibling; |
|
| 1323 | + } |
|
| 1342 | 1324 | } |
| 1343 | 1325 | |
| 1344 | 1326 | if ($sibling) { |
@@ -1433,8 +1415,7 @@ discard block |
||
| 1433 | 1415 | . ' computers. Computers will be displayed when they have earned their' |
| 1434 | 1416 | . ' first credits.', array(), NULL, 'boinc:host-list') . '</p>'; |
| 1435 | 1417 | } |
| 1436 | - } |
|
| 1437 | - else { |
|
| 1418 | + } else { |
|
| 1438 | 1419 | $output .= '<h2>' . bts('Computers hidden', array(), NULL, 'boinc:host-list') . '</h2>'; |
| 1439 | 1420 | $output .= '<p>' . bts('This user has chosen not to show information' |
| 1440 | 1421 | . ' about their computers.', array(), NULL, 'boinc:host-list') . '</p>'; |
@@ -1594,8 +1575,7 @@ discard block |
||
| 1594 | 1575 | if (!$received_time) { |
| 1595 | 1576 | if (time() < $deadline) { |
| 1596 | 1577 | $output = '<span class="on-time">' . $output . '</span>'; |
| 1597 | - } |
|
| 1598 | - else { |
|
| 1578 | + } else { |
|
| 1599 | 1579 | $output = '<span class="past-due">' . $output . '</span>'; |
| 1600 | 1580 | } |
| 1601 | 1581 | } |
@@ -1690,11 +1670,9 @@ discard block |
||
| 1690 | 1670 | // Use userid, hostid, or workunitid |
| 1691 | 1671 | if ($category==0) { |
| 1692 | 1672 | $sqlall .= " WHERE r.userid='%s' "; |
| 1693 | - } |
|
| 1694 | - elseif ($category==1) { |
|
| 1673 | + } elseif ($category==1) { |
|
| 1695 | 1674 | $sqlall .= " WHERE r.workunitid='%s' "; |
| 1696 | - } |
|
| 1697 | - elseif ($category==2) { |
|
| 1675 | + } elseif ($category==2) { |
|
| 1698 | 1676 | $sqlall .= " WHERE r.hostid='%s' "; |
| 1699 | 1677 | } |
| 1700 | 1678 | $sqlall .= " ORDER BY user_friendly_name"; |
@@ -1734,8 +1712,7 @@ discard block |
||
| 1734 | 1712 | }// if mystate |
| 1735 | 1713 | |
| 1736 | 1714 | }// while |
| 1737 | - } |
|
| 1738 | - else { |
|
| 1715 | + } else { |
|
| 1739 | 1716 | } |
| 1740 | 1717 | |
| 1741 | 1718 | // Entry for all applications. |
@@ -1829,11 +1806,9 @@ discard block |
||
| 1829 | 1806 | // Use userid, hostid, or workunitid |
| 1830 | 1807 | if ($category==0) { |
| 1831 | 1808 | $sqlwhere[] = "r.userid = '%s'"; |
| 1832 | - } |
|
| 1833 | - elseif ($category==1) { |
|
| 1809 | + } elseif ($category==1) { |
|
| 1834 | 1810 | $sqlwhere[] = "r.workunitid = '%s'"; |
| 1835 | - } |
|
| 1836 | - elseif ($category==2) { |
|
| 1811 | + } elseif ($category==2) { |
|
| 1837 | 1812 | $sqlwhere[] = "r.hostid = '%s'"; |
| 1838 | 1813 | } |
| 1839 | 1814 | |
@@ -1861,8 +1836,7 @@ discard block |
||
| 1861 | 1836 | $sqlwhere[] = "r.appid = '%s'"; |
| 1862 | 1837 | if ($sqlwhere) $sqlsub .= " WHERE " . implode(' AND ', $sqlwhere); |
| 1863 | 1838 | $dbres_sub = pager_query( $sqlsub . tablesort_sql($resultheader), $tablerows, 0, NULL, $queryid, $app_id); |
| 1864 | - } |
|
| 1865 | - else { |
|
| 1839 | + } else { |
|
| 1866 | 1840 | if ($sqlwhere) $sqlsub .= " WHERE " . implode(' AND ', $sqlwhere); |
| 1867 | 1841 | $dbres_sub = pager_query( $sqlsub . tablesort_sql($resultheader), $tablerows, 0, NULL, $queryid); |
| 1868 | 1842 | } |
@@ -1897,19 +1871,16 @@ discard block |
||
| 1897 | 1871 | $resultdata[] = array_values($prettyresult); |
| 1898 | 1872 | } |
| 1899 | 1873 | }// while |
| 1900 | - } |
|
| 1901 | - else { |
|
| 1874 | + } else { |
|
| 1902 | 1875 | } |
| 1903 | 1876 | // Begin result navigation |
| 1904 | 1877 | |
| 1905 | 1878 | // Set pathprefix based on type |
| 1906 | 1879 | if ($category==0) { |
| 1907 | 1880 | $pathprefix = 'account/tasks'; |
| 1908 | - } |
|
| 1909 | - elseif ($category==1) { |
|
| 1881 | + } elseif ($category==1) { |
|
| 1910 | 1882 | $pathprefix = 'workunit/' . $queryid . '/tasks'; |
| 1911 | - } |
|
| 1912 | - elseif ($category==2) { |
|
| 1883 | + } elseif ($category==2) { |
|
| 1913 | 1884 | $pathprefix = 'host/' . $queryid . '/tasks'; |
| 1914 | 1885 | } |
| 1915 | 1886 | // Need an "All" tab as well, maps to app_id of zero. |
@@ -1919,8 +1890,7 @@ discard block |
||
| 1919 | 1890 | $mypath = $pathprefix . '/' . $state . '/' . $app_id; |
| 1920 | 1891 | if ($state==STATE_ALL) { |
| 1921 | 1892 | $ltext = '<span class="tab task-app-name">' . bts('All', array(), NULL, 'boinc:task-table') . ' (' . $numstates . ')</span>'; |
| 1922 | - } |
|
| 1923 | - else { |
|
| 1893 | + } else { |
|
| 1924 | 1894 | $ltext = '<span class="tab">' . bts($state_hnames[$state], array(), NULL, 'boinc:task-table') . ' (' . $numstates . ')</span>'; |
| 1925 | 1895 | } |
| 1926 | 1896 | $myitem = array( |
@@ -2010,8 +1980,7 @@ discard block |
||
| 2010 | 1980 | // that is not handled by the above case statements. |
| 2011 | 1981 | if ($appverid < 0) { |
| 2012 | 1982 | return "Unknown Anonymous platform"; |
| 2013 | - } |
|
| 2014 | - else { |
|
| 1983 | + } else { |
|
| 2015 | 1984 | $prettyv = sprintf("%d.%02d", $vernum/100, $vernum%100); |
| 2016 | 1985 | $prettyc = ($plan_class) ? "($plan_class)" : ''; |
| 2017 | 1986 | return "v$prettyv $prettyc $plfm"; |