@@ -182,7 +182,8 @@ discard block |
||
182 | 182 | break; |
183 | 183 | } |
184 | 184 | |
185 | - if ($step < 3) { // Omit submit button on the textarea block to display the export data. |
|
185 | + if ($step < 3) { |
|
186 | +// Omit submit button on the textarea block to display the export data. |
|
186 | 187 | $form['submit'] = array( |
187 | 188 | '#type' => 'submit', |
188 | 189 | '#value' => t('Export'), |
@@ -374,8 +375,7 @@ discard block |
||
374 | 375 | $imported_groups = array(); |
375 | 376 | if (isset($content['groups']) && module_exists('fieldgroup')) { |
376 | 377 | $imported_groups = (array) $content['groups']; |
377 | - } |
|
378 | - elseif (isset($content['groups']) && is_array($content['groups'])) { |
|
378 | + } elseif (isset($content['groups']) && is_array($content['groups'])) { |
|
379 | 379 | $not_enabled[] = 'fieldgroup'; |
380 | 380 | } |
381 | 381 | |
@@ -384,8 +384,7 @@ discard block |
||
384 | 384 | $field = content_field_instance_collapse($import); |
385 | 385 | if (empty($field['module']) || empty($field['widget_module'])) { |
386 | 386 | $not_enabled[] = $field['field_name']; |
387 | - } |
|
388 | - else { |
|
387 | + } else { |
|
389 | 388 | if (!module_exists($field['module'])) { |
390 | 389 | $not_enabled[] = $field['module']; |
391 | 390 | } |
@@ -466,8 +465,7 @@ discard block |
||
466 | 465 | if (!empty($field['field_name']) && isset($content_info['content types'][$type_name]['fields'][$field_name])) { |
467 | 466 | drupal_set_message(t('The imported field %field_label (%field_name) was not added to %type because that field already exists in %type.', array( |
468 | 467 | '%field_label' => $field['label'], '%field_name' => $field_name, '%type' => $type_label))); |
469 | - } |
|
470 | - else { |
|
468 | + } else { |
|
471 | 469 | $field = content_field_instance_create($field, FALSE); |
472 | 470 | $rebuild = TRUE; |
473 | 471 | drupal_set_message(t('The field %field_label (%field_name) was added to the content type %type.', array( |
@@ -573,8 +571,7 @@ discard block |
||
573 | 571 | if (isset($edit['field_widget_type'])) { |
574 | 572 | $tmp = explode('-', $edit['field_widget_type']); |
575 | 573 | $field_name = $tmp[0]; |
576 | - } |
|
577 | - else { |
|
574 | + } else { |
|
578 | 575 | $field_name = isset($edit['field_name']) ? $edit['field_name'] : ''; |
579 | 576 | } |
580 | 577 | |
@@ -590,8 +587,7 @@ discard block |
||
590 | 587 | '%field_name' => $field_name, |
591 | 588 | '%db_err' => $db_err |
592 | 589 | ))); |
593 | - } |
|
594 | - else { |
|
590 | + } else { |
|
595 | 591 | // The db fetch occurred successfully, unserialize the data blob and |
596 | 592 | // insert it into a new "display_settings" field of the data. |
597 | 593 | if ($display_settings = unserialize($row_info['display_settings'])) { |
@@ -242,8 +242,7 @@ discard block |
||
242 | 242 | foreach ($cached->data as $key => $value) { |
243 | 243 | $node->$key = $value; |
244 | 244 | } |
245 | - } |
|
246 | - else { |
|
245 | + } else { |
|
247 | 246 | $default_additions = _content_field_invoke_default('load', $node); |
248 | 247 | if ($default_additions) { |
249 | 248 | foreach ($default_additions as $key => $value) { |
@@ -458,8 +457,7 @@ discard block |
||
458 | 457 | // render arrays. Check we're not on a form first. |
459 | 458 | if (!isset($elements['#build_id']) && isset($value['view']) && isset($elements[$value['view']])) { |
460 | 459 | $elements[$value['view']]['#weight'] = $value['weight']; |
461 | - } |
|
462 | - elseif (isset($elements[$key])) { |
|
460 | + } elseif (isset($elements[$key])) { |
|
463 | 461 | $elements[$key]['#weight'] = $value['weight']; |
464 | 462 | } |
465 | 463 | } |
@@ -530,8 +528,7 @@ discard block |
||
530 | 528 | $output .= drupal_render($element[$element['#field_name'] .'_add_more']); |
531 | 529 | |
532 | 530 | drupal_add_tabledrag($table_id, 'order', 'sibling', $order_class); |
533 | - } |
|
534 | - else { |
|
531 | + } else { |
|
535 | 532 | foreach (element_children($element) as $key) { |
536 | 533 | $output .= drupal_render($element[$key]); |
537 | 534 | } |
@@ -744,8 +741,7 @@ discard block |
||
744 | 741 | // NODE_BUILD_NORMAL is 0, and ('whatever' == 0) is TRUE, so we need a ===. |
745 | 742 | if ($node->build_mode === NODE_BUILD_NORMAL || $node->build_mode == NODE_BUILD_PREVIEW) { |
746 | 743 | $context = $teaser ? 'teaser' : 'full'; |
747 | - } |
|
748 | - else { |
|
744 | + } else { |
|
749 | 745 | $context = $node->build_mode; |
750 | 746 | } |
751 | 747 | // The field may be missing info for $contexts added by modules |
@@ -797,8 +793,7 @@ discard block |
||
797 | 793 | $element['items'][$delta] += $format_info; |
798 | 794 | $element['items'][$delta]['#item']['#delta'] = $delta; |
799 | 795 | } |
800 | - } |
|
801 | - else { |
|
796 | + } else { |
|
802 | 797 | $element['items'] += $format_info; |
803 | 798 | } |
804 | 799 | |
@@ -829,8 +824,7 @@ discard block |
||
829 | 824 | $wrapper = NULL; |
830 | 825 | if (isset($node->content[$field['field_name']])) { |
831 | 826 | $wrapper = $node->content[$field['field_name']]; |
832 | - } |
|
833 | - elseif (module_exists('fieldgroup') && ($group_name = fieldgroup_get_group($node->type, $field['field_name'])) && isset($node->content[$group_name]['group'][$field['field_name']])) { |
|
827 | + } elseif (module_exists('fieldgroup') && ($group_name = fieldgroup_get_group($node->type, $field['field_name'])) && isset($node->content[$group_name]['group'][$field['field_name']])) { |
|
834 | 828 | $wrapper = $node->content[$group_name]['group'][$field['field_name']]; |
835 | 829 | } |
836 | 830 | |
@@ -844,13 +838,11 @@ discard block |
||
844 | 838 | // '#chilren' is not set if the field is empty. |
845 | 839 | $items[$delta]['view'] = isset($element['items'][$delta]['#children']) ? $element['items'][$delta]['#children'] : ''; |
846 | 840 | } |
847 | - } |
|
848 | - elseif (isset($element['items']['#children'])) { |
|
841 | + } elseif (isset($element['items']['#children'])) { |
|
849 | 842 | // Multiple values formatter. |
850 | 843 | $items[0]['view'] = $element['items']['#children']; |
851 | 844 | } |
852 | - } |
|
853 | - else { |
|
845 | + } else { |
|
854 | 846 | // Hidden or inaccessible field. |
855 | 847 | $items[0]['view'] = ''; |
856 | 848 | } |
@@ -866,8 +858,7 @@ discard block |
||
866 | 858 | $wrapper = NULL; |
867 | 859 | if (isset($node->content[$field['field_name']])) { |
868 | 860 | $wrapper = $node->content[$field['field_name']]; |
869 | - } |
|
870 | - elseif (module_exists('fieldgroup') && ($group_name = fieldgroup_get_group($node->type, $field['field_name'])) && isset($node->content[$group_name]['group'][$field['field_name']])) { |
|
861 | + } elseif (module_exists('fieldgroup') && ($group_name = fieldgroup_get_group($node->type, $field['field_name'])) && isset($node->content[$group_name]['group'][$field['field_name']])) { |
|
871 | 862 | $wrapper = $node->content[$group_name]['group'][$field['field_name']]; |
872 | 863 | } |
873 | 864 | |
@@ -1050,8 +1041,7 @@ discard block |
||
1050 | 1041 | // how to handle that. |
1051 | 1042 | if (db_result(db_query("SELECT COUNT(*) FROM {". $table ."} WHERE vid = %d", $node->vid))) { |
1052 | 1043 | content_write_record($table, $record, array('vid')); |
1053 | - } |
|
1054 | - else { |
|
1044 | + } else { |
|
1055 | 1045 | content_write_record($table, $record); |
1056 | 1046 | } |
1057 | 1047 | } |
@@ -1134,8 +1124,7 @@ discard block |
||
1134 | 1124 | if (is_array($object)) { |
1135 | 1125 | $object = (object) $object; |
1136 | 1126 | $array = TRUE; |
1137 | - } |
|
1138 | - else { |
|
1127 | + } else { |
|
1139 | 1128 | $array = FALSE; |
1140 | 1129 | } |
1141 | 1130 | |
@@ -1174,12 +1163,10 @@ discard block |
||
1174 | 1163 | |
1175 | 1164 | if (empty($info['serialize'])) { |
1176 | 1165 | $values[] = $object->$field; |
1177 | - } |
|
1178 | - else { |
|
1166 | + } else { |
|
1179 | 1167 | $values[] = serialize($object->$field); |
1180 | 1168 | } |
1181 | - } |
|
1182 | - else { |
|
1169 | + } else { |
|
1183 | 1170 | $placeholders[] = 'NULL'; |
1184 | 1171 | } |
1185 | 1172 | } |
@@ -1190,8 +1177,7 @@ discard block |
||
1190 | 1177 | if (!count($update)) { |
1191 | 1178 | $query = "INSERT INTO {". $table ."} (". implode(', ', $fields) .') VALUES ('. implode(', ', $placeholders) .')'; |
1192 | 1179 | $return = SAVED_NEW; |
1193 | - } |
|
1194 | - else { |
|
1180 | + } else { |
|
1195 | 1181 | $query = ''; |
1196 | 1182 | foreach ($fields as $id => $field) { |
1197 | 1183 | if ($query) { |
@@ -1253,8 +1239,7 @@ discard block |
||
1253 | 1239 | $result = $function($op, $node, $field, $items, $teaser, $page); |
1254 | 1240 | if (is_array($result)) { |
1255 | 1241 | $return = array_merge($return, $result); |
1256 | - } |
|
1257 | - else if (isset($result)) { |
|
1242 | + } else if (isset($result)) { |
|
1258 | 1243 | $return[] = $result; |
1259 | 1244 | } |
1260 | 1245 | } |
@@ -1279,15 +1264,13 @@ discard block |
||
1279 | 1264 | // rather than by field. |
1280 | 1265 | if (in_array($op, array('load', 'insert', 'update', 'delete', 'delete revision'))) { |
1281 | 1266 | return content_storage($op, $node); |
1282 | - } |
|
1283 | - else { |
|
1267 | + } else { |
|
1284 | 1268 | foreach ($type['fields'] as $field) { |
1285 | 1269 | $items = isset($node->$field['field_name']) ? $node->$field['field_name'] : array(); |
1286 | 1270 | $result = content_field($op, $node, $field, $items, $teaser, $page); |
1287 | 1271 | if (is_array($result)) { |
1288 | 1272 | $return = array_merge($return, $result); |
1289 | - } |
|
1290 | - else if (isset($result)) { |
|
1273 | + } else if (isset($result)) { |
|
1291 | 1274 | $return[] = $result; |
1292 | 1275 | } |
1293 | 1276 | if (isset($node->$field['field_name'])) { |
@@ -1410,8 +1393,7 @@ discard block |
||
1410 | 1393 | |
1411 | 1394 | if (!$reset && $cached = cache_get('content_type_info:'. $language->language, content_cache_tablename())) { |
1412 | 1395 | $info = $cached->data; |
1413 | - } |
|
1414 | - else { |
|
1396 | + } else { |
|
1415 | 1397 | $info = array( |
1416 | 1398 | 'field types' => array(), |
1417 | 1399 | 'widget types' => array(), |
@@ -1580,8 +1562,7 @@ discard block |
||
1580 | 1562 | $db_info = array(); |
1581 | 1563 | if ($field['db_storage'] == CONTENT_DB_STORAGE_PER_FIELD) { |
1582 | 1564 | $db_info['table'] = _content_tablename($field['field_name'], CONTENT_DB_STORAGE_PER_FIELD); |
1583 | - } |
|
1584 | - else { |
|
1565 | + } else { |
|
1585 | 1566 | $db_info['table'] = _content_tablename($field['type_name'], CONTENT_DB_STORAGE_PER_CONTENT_TYPE); |
1586 | 1567 | } |
1587 | 1568 | |
@@ -1600,8 +1581,7 @@ discard block |
||
1600 | 1581 | function content_storage_type($field) { |
1601 | 1582 | if ($field['multiple'] > 0) { |
1602 | 1583 | return CONTENT_DB_STORAGE_PER_FIELD; |
1603 | - } |
|
1604 | - else { |
|
1584 | + } else { |
|
1605 | 1585 | module_load_include('inc', 'content', 'includes/content.crud'); |
1606 | 1586 | $instances = content_field_instance_read(array('field_name' => $field['field_name'])); |
1607 | 1587 | if (count($instances) > 1) { |
@@ -1655,8 +1635,7 @@ discard block |
||
1655 | 1635 | foreach ($array as $key => $value) { |
1656 | 1636 | if (is_array($value)) { |
1657 | 1637 | $result += content_array_flatten($value); |
1658 | - } |
|
1659 | - else { |
|
1638 | + } else { |
|
1660 | 1639 | $result[$key] = $value; |
1661 | 1640 | } |
1662 | 1641 | } |
@@ -1711,8 +1690,7 @@ discard block |
||
1711 | 1690 | if (strpos($opt, '|') !== FALSE) { |
1712 | 1691 | list($key, $value) = explode('|', $opt); |
1713 | 1692 | $allowed_values[$cid][$key] = (isset($value) && $value !=='') ? $value : $key; |
1714 | - } |
|
1715 | - else { |
|
1693 | + } else { |
|
1716 | 1694 | $allowed_values[$cid][$opt] = $opt; |
1717 | 1695 | } |
1718 | 1696 | } |
@@ -1733,8 +1711,7 @@ discard block |
||
1733 | 1711 | foreach ($options as $key => $opt) { |
1734 | 1712 | if (is_array($opt)) { |
1735 | 1713 | content_allowed_values_filter_html($options[$key]); |
1736 | - } |
|
1737 | - else { |
|
1714 | + } else { |
|
1738 | 1715 | $options[$key] = html_entity_decode(strip_tags($opt), ENT_QUOTES); |
1739 | 1716 | } |
1740 | 1717 | } |
@@ -1817,8 +1794,7 @@ discard block |
||
1817 | 1794 | } |
1818 | 1795 | |
1819 | 1796 | $element['#item'] = $items[0]; |
1820 | - } |
|
1821 | - else { |
|
1797 | + } else { |
|
1822 | 1798 | // Multiple values formatter. |
1823 | 1799 | $items = $item; |
1824 | 1800 | $function = $field['module'] .'_field'; |
@@ -1869,11 +1845,9 @@ discard block |
||
1869 | 1845 | |
1870 | 1846 | if ($selector === '_tabs') { |
1871 | 1847 | return $info['tabs']; |
1872 | - } |
|
1873 | - elseif (isset($selector) && isset($info['tabs'][$selector])) { |
|
1848 | + } elseif (isset($selector) && isset($info['tabs'][$selector])) { |
|
1874 | 1849 | return isset($info['tabs'][$selector]) ? $info['tabs'][$selector]['build modes'] : array(); |
1875 | - } |
|
1876 | - else { |
|
1850 | + } else { |
|
1877 | 1851 | return $info['build modes']; |
1878 | 1852 | } |
1879 | 1853 | } |
@@ -1987,8 +1961,7 @@ discard block |
||
1987 | 1961 | |
1988 | 1962 | if ($version < 1003) { |
1989 | 1963 | $version = 0; |
1990 | - } |
|
1991 | - else { |
|
1964 | + } else { |
|
1992 | 1965 | $version = 1003; |
1993 | 1966 | } |
1994 | 1967 | |
@@ -2042,8 +2015,7 @@ discard block |
||
2042 | 2015 | function content_cache_tablename() { |
2043 | 2016 | if (variable_get('content_schema_version', -1) < 6000) { |
2044 | 2017 | return 'cache'; |
2045 | - } |
|
2046 | - else { |
|
2018 | + } else { |
|
2047 | 2019 | return 'cache_content'; |
2048 | 2020 | } |
2049 | 2021 | } |
@@ -2125,8 +2097,7 @@ discard block |
||
2125 | 2097 | return FALSE; |
2126 | 2098 | } |
2127 | 2099 | return (bool)db_result(db_query("SHOW INDEX FROM {". $table ."} WHERE key_name = '$name'")); |
2128 | - } |
|
2129 | - elseif ($db_type == 'pgsql') { |
|
2100 | + } elseif ($db_type == 'pgsql') { |
|
2130 | 2101 | // Note that the index names in Schema API for PostgreSQL are prefixed by |
2131 | 2102 | // the table name and suffixed by '_idx'. |
2132 | 2103 | return (bool)db_result(db_query("SELECT COUNT(indexname) FROM pg_indexes WHERE indexname = '{". $table ."}_{$name}_idx'")); |
@@ -2222,8 +2193,7 @@ discard block |
||
2222 | 2193 | if (is_array($result)) { |
2223 | 2194 | $default_value = $result; |
2224 | 2195 | } |
2225 | - } |
|
2226 | - elseif (!empty($field['widget']['default_value'])) { |
|
2196 | + } elseif (!empty($field['widget']['default_value'])) { |
|
2227 | 2197 | $default_value = $field['widget']['default_value']; |
2228 | 2198 | } |
2229 | 2199 | return (array) $default_value; |
@@ -2336,8 +2306,7 @@ discard block |
||
2336 | 2306 | || !is_array($object['display_settings'][$context]) |
2337 | 2307 | || empty($object['display_settings'][$context]['exclude'])) { |
2338 | 2308 | return FALSE; |
2339 | - } |
|
2340 | - else { |
|
2309 | + } else { |
|
2341 | 2310 | return TRUE; |
2342 | 2311 | } |
2343 | 2312 | } |
@@ -2372,8 +2341,7 @@ discard block |
||
2372 | 2341 | // Use isset() to avoid undefined index message on #children when field values are empty. |
2373 | 2342 | $variables['items'][$delta]['view'] = isset($element['items'][$delta]['#children']) ? $element['items'][$delta]['#children'] : ''; |
2374 | 2343 | } |
2375 | - } |
|
2376 | - else { |
|
2344 | + } else { |
|
2377 | 2345 | // Multiple values formatter. |
2378 | 2346 | // We display the 'all items' output as $items[0], as if it was the |
2379 | 2347 | // output of a single valued field. |
@@ -2392,8 +2360,7 @@ discard block |
||
2392 | 2360 | foreach ($variables['items'] as $delta => $item) { |
2393 | 2361 | if (!isset($item['view']) || (empty($item['view']) && (string)$item['view'] !== '0')) { |
2394 | 2362 | $variables['items'][$delta]['empty'] = TRUE; |
2395 | - } |
|
2396 | - else { |
|
2363 | + } else { |
|
2397 | 2364 | $field_empty = FALSE; |
2398 | 2365 | $variables['items'][$delta]['empty'] = FALSE; |
2399 | 2366 | } |
@@ -2643,8 +2610,7 @@ discard block |
||
2643 | 2610 | $db_info = content_database_info($field); |
2644 | 2611 | if (!empty($type_name)) { |
2645 | 2612 | $delta = db_result(db_query("SELECT MAX(delta) FROM {". $db_info['table'] ."} f LEFT JOIN {node} n ON f.vid = n.vid WHERE n.type = '%s'", $type_name)); |
2646 | - } |
|
2647 | - else { |
|
2613 | + } else { |
|
2648 | 2614 | $delta = db_result(db_query("SELECT MAX(delta) FROM {". $db_info['table'] ."}")); |
2649 | 2615 | } |
2650 | 2616 | if ($delta >= 0) { |
@@ -2663,8 +2629,7 @@ discard block |
||
2663 | 2629 | if (!empty($type_name)) { |
2664 | 2630 | $param = array('type_name' => $type_name); |
2665 | 2631 | $inactive = array($type_name => array()); |
2666 | - } |
|
2667 | - else { |
|
2632 | + } else { |
|
2668 | 2633 | $param = array(); |
2669 | 2634 | $inactive = array(); |
2670 | 2635 | } |
@@ -2693,8 +2658,7 @@ discard block |
||
2693 | 2658 | if (!empty($type_name)) { |
2694 | 2659 | $param = array('type_name' => $type_name); |
2695 | 2660 | $inactive = array($type_name => array()); |
2696 | - } |
|
2697 | - else { |
|
2661 | + } else { |
|
2698 | 2662 | $param = array(); |
2699 | 2663 | $inactive = array(); |
2700 | 2664 | } |
@@ -94,8 +94,7 @@ discard block |
||
94 | 94 | // Use the menu label as the default block subject |
95 | 95 | $menus = menu_get_menus(); |
96 | 96 | $subject = $menus[$jumpmenu_name]; |
97 | - } |
|
98 | - else if ($jumpmenu_type == 'taxo') { |
|
97 | + } else if ($jumpmenu_type == 'taxo') { |
|
99 | 98 | $form = jump_quickly($jumpmenu_name, 'taxo', $active); |
100 | 99 | |
101 | 100 | // Use the vocabulary name as the default block subject |
@@ -137,13 +136,11 @@ discard block |
||
137 | 136 | |
138 | 137 | if (is_array($name)) { |
139 | 138 | $options = $name; |
140 | - } |
|
141 | - else { |
|
139 | + } else { |
|
142 | 140 | $options = array(); |
143 | 141 | if ($type == 'menu') { |
144 | 142 | jump_menu_get_menu_options($options, $name); |
145 | - } |
|
146 | - elseif ($type == 'taxo') { |
|
143 | + } elseif ($type == 'taxo') { |
|
147 | 144 | jump_menu_get_taxo_options($options, $name); |
148 | 145 | } |
149 | 146 | } |
@@ -215,8 +212,7 @@ discard block |
||
215 | 212 | $fragment = explode('#', $form_state['values']['jump_goto']); |
216 | 213 | if (isset($fragment[1])) { |
217 | 214 | drupal_goto($fragment[0], NULL, $fragment[1]); |
218 | - } |
|
219 | - else { |
|
215 | + } else { |
|
220 | 216 | drupal_goto($form_state['values']['jump_goto']); |
221 | 217 | } |
222 | 218 | } |
@@ -43,14 +43,15 @@ |
||
43 | 43 | $profiles = _mysql_query("select * from profile where userid>$start_id order by userid"); |
44 | 44 | echo _mysql_error(); |
45 | 45 | $i=0; |
46 | - while ($profile = _mysql_fetch_object($profiles)){ |
|
46 | + while ($profile = _mysql_fetch_object($profiles)) { |
|
47 | 47 | $i++; |
48 | - if ($i%100 == 0) { //For every 100 profiles |
|
48 | + if ($i%100 == 0) { |
|
49 | +//For every 100 profiles |
|
49 | 50 | echo $profile->userid.". "; flush(); // print out where we are |
50 | 51 | //usleep(200000); |
51 | 52 | } |
52 | 53 | |
53 | - if ($profile->userid > $start_id){ |
|
54 | + if ($profile->userid > $start_id) { |
|
54 | 55 | fix_profile($profile); |
55 | 56 | } |
56 | 57 | } |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | |
62 | 62 | $cache_args = "sort_by=$sort_by&offset=$offset"; |
63 | 63 | $cacheddata = get_cached_data(TOP_PAGES_TTL, $cache_args); |
64 | -if ($cacheddata){ |
|
64 | +if ($cacheddata) { |
|
65 | 65 | $data = unserialize($cacheddata); |
66 | 66 | } else { |
67 | 67 | $data = get_top_hosts($offset,$sort_by); |
@@ -87,7 +87,8 @@ discard block |
||
87 | 87 | |
88 | 88 | } |
89 | 89 | |
90 | -if ($n==$hosts_per_page){ //If we aren't on the last page |
|
90 | +if ($n==$hosts_per_page) { |
|
91 | +//If we aren't on the last page |
|
91 | 92 | $new_offset = $offset + $hosts_per_page; |
92 | 93 | echo "<a href=top_hosts.php?sort_by=$sort_by&offset=$new_offset>".tra("Next %1", $hosts_per_page)."</a>"; |
93 | 94 | } |
@@ -32,11 +32,11 @@ discard block |
||
32 | 32 | } |
33 | 33 | define('ITEM_LIMIT', 10000); |
34 | 34 | |
35 | -function get_top_teams($offset, $sort_by, $type){ |
|
35 | +function get_top_teams($offset, $sort_by, $type) { |
|
36 | 36 | global $teams_per_page; |
37 | 37 | $db = BoincDb::get(true); |
38 | 38 | $type_clause = null; |
39 | - if ($type){ |
|
39 | + if ($type) { |
|
40 | 40 | $type_clause = "type=$type"; |
41 | 41 | } |
42 | 42 | if ($sort_by == "total_credit") { |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | $cache_args = "sort_by=$sort_by&offset=$offset$type_url"; |
76 | 76 | $cacheddata = get_cached_data(TOP_PAGES_TTL,$cache_args); |
77 | 77 | //If we have got the data in cache |
78 | - if ($cacheddata){ |
|
78 | + if ($cacheddata) { |
|
79 | 79 | $data = unserialize($cacheddata); // use the cached data |
80 | 80 | } else { |
81 | 81 | //if not do queries etc to generate new data |
@@ -115,7 +115,8 @@ discard block |
||
115 | 115 | echo "<a href=top_teams.php?sort_by=$sort_by&offset=$new_offset".$type_url.">".tra("Previous %1", $teams_per_page)."</a> · "; |
116 | 116 | |
117 | 117 | } |
118 | - if ($n==$teams_per_page){ //If we aren't on the last page |
|
118 | + if ($n==$teams_per_page) { |
|
119 | +//If we aren't on the last page |
|
119 | 120 | $new_offset = $offset + $teams_per_page; |
120 | 121 | echo "<a href=top_teams.php?sort_by=$sort_by&offset=$new_offset".$type_url.">".tra("Next %1", $teams_per_page)."</a>"; |
121 | 122 | } |
@@ -368,7 +368,8 @@ |
||
368 | 368 | $min_days = $argv[++$i]; |
369 | 369 | } else if ($argv[$i] == "--max_days") { |
370 | 370 | $max_days = $argv[++$i]; |
371 | - } else if ($argv[$i] == "--days") { // deprecated |
|
371 | + } else if ($argv[$i] == "--days") { |
|
372 | +// deprecated |
|
372 | 373 | $max_days = $argv[++$i]; |
373 | 374 | } |
374 | 375 | } |
@@ -104,8 +104,7 @@ discard block |
||
104 | 104 | |
105 | 105 | if ($myCache->isInCache($cache_name)) { |
106 | 106 | $myCache->strokeFromCache($cache_name); |
107 | - } |
|
108 | - else { |
|
107 | + } else { |
|
109 | 108 | // Initialize dataset |
110 | 109 | $dataset = array(); |
111 | 110 | $stats_xml = boincstats_get_project_stats('daily', $cpid); |
@@ -114,9 +113,10 @@ discard block |
||
114 | 113 | for ($j = 30; $j < 90; $j++) { |
115 | 114 | $dataset[] = (int) $stats_xml->records->record[$j]; |
116 | 115 | } |
117 | - } |
|
118 | - else { |
|
119 | - for ($i = 0; $i <= $dataset_size; $i++) $dataset[] = 0; |
|
116 | + } else { |
|
117 | + for ($i = 0; $i <= $dataset_size; $i++) { |
|
118 | + $dataset[] = 0; |
|
119 | + } |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | // Get color configuration |
@@ -226,8 +226,7 @@ discard block |
||
226 | 226 | |
227 | 227 | if ($myCache->isInCache($cache_name)) { |
228 | 228 | $myCache->strokeFromCache($cache_name); |
229 | - } |
|
230 | - else { |
|
229 | + } else { |
|
231 | 230 | // Initialize dataset |
232 | 231 | $dataset = array(); |
233 | 232 | $stats_xml = boincstats_get_project_stats('daily'); |
@@ -236,9 +235,10 @@ discard block |
||
236 | 235 | for ($j = 30; $j < 90; $j++) { |
237 | 236 | $dataset[] = (int) $stats_xml->records->record[$j]; |
238 | 237 | } |
239 | - } |
|
240 | - else { |
|
241 | - for ($i = 0; $i <= 30; $i++) $dataset[] = 0; |
|
238 | + } else { |
|
239 | + for ($i = 0; $i <= 30; $i++) { |
|
240 | + $dataset[] = 0; |
|
241 | + } |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | // Create and populate the pData object |
@@ -316,8 +316,7 @@ discard block |
||
316 | 316 | directory must be writeable by the web server.', |
317 | 317 | array('@parent_dir' => dirname($cache_dir)), WATCHDOG_ERROR); |
318 | 318 | return FALSE; |
319 | - } |
|
320 | - else { |
|
319 | + } else { |
|
321 | 320 | // Create the cache dir |
322 | 321 | if (!mkdir($cache_dir, 0775)) { |
323 | 322 | watchdog('boincstats', 'Failed to create @cache_dir directory. Check |
@@ -326,8 +325,7 @@ discard block |
||
326 | 325 | return FALSE; |
327 | 326 | } |
328 | 327 | } |
329 | - } |
|
330 | - else { |
|
328 | + } else { |
|
331 | 329 | watchdog('boincstats', 'Cache directory at @cache_dir is not writeable. |
332 | 330 | Please allow webserver write access.', |
333 | 331 | array('@cache_dir' => $cache_dir), WATCHDOG_ERROR); |
@@ -370,8 +368,7 @@ discard block |
||
370 | 368 | foreach ($get as $arg => $value) { |
371 | 369 | if ($value !== NULL) { |
372 | 370 | $args[] = "{$arg}=" . rawurlencode($value); |
373 | - } |
|
374 | - else { |
|
371 | + } else { |
|
375 | 372 | $args[] = $arg; |
376 | 373 | } |
377 | 374 | } |
@@ -467,8 +464,7 @@ discard block |
||
467 | 464 | drupal_set_message(t('The BOINC stats system is not configured. Please |
468 | 465 | !configure_it', array('!configure_it' => l(t('configure it now'), |
469 | 466 | 'admin/boinc/stats'))), 'error', FALSE); |
470 | - } |
|
471 | - else { |
|
467 | + } else { |
|
472 | 468 | drupal_set_message(t('There is a problem with the site. Please contact |
473 | 469 | the system administrator.'), 'error', FALSE); |
474 | 470 | } |
@@ -110,8 +110,7 @@ discard block |
||
110 | 110 | function _cronT($time, $d = -1, $h = -1, $m = -1) { |
111 | 111 | if ($d < 0) { |
112 | 112 | return date('n', $time) * 31 * 24 * 60 + date('j', $time) * 24 * 60 + date('H', $time) * 60 + date('i', $time); |
113 | - } |
|
114 | - else { |
|
113 | + } else { |
|
115 | 114 | return $time * 31 * 24 * 60 + $d * 24 * 60 + $h * 60 + $m; |
116 | 115 | } |
117 | 116 | } |
@@ -138,15 +137,13 @@ discard block |
||
138 | 137 | foreach (explode(',', $rule) as $token) { |
139 | 138 | if (preg_match('/^([0-9]+)-([0-9]+)$/', $token, $r)) { |
140 | 139 | $result = array_merge($result, range($r[1], $r[2])); |
141 | - } |
|
142 | - elseif (preg_match('/^\*\/([0-9]+)$/', $token, $r)) { |
|
140 | + } elseif (preg_match('/^\*\/([0-9]+)$/', $token, $r)) { |
|
143 | 141 | for ($i = $min; $i <= $max; $i++) { |
144 | 142 | if ($i % $r[1] == 0) { |
145 | 143 | $result[] = $i; |
146 | 144 | } |
147 | 145 | } |
148 | - } |
|
149 | - elseif (is_numeric($token)) { |
|
146 | + } elseif (is_numeric($token)) { |
|
150 | 147 | $result[] = $token; |
151 | 148 | } |
152 | 149 | } |