@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | */ |
23 | 23 | function zen_theme(&$existing, $type, $theme, $path) { |
24 | 24 | // When #341140 is fixed, replace _zen_path() with drupal_get_path(). |
25 | - include_once './' . _zen_path() . '/zen-internals/template.theme-registry.inc'; |
|
25 | + include_once './'._zen_path().'/zen-internals/template.theme-registry.inc'; |
|
26 | 26 | return _zen_theme($existing, $type, $theme, $path); |
27 | 27 | } |
28 | 28 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | elseif (theme_get_setting('zen_breadcrumb_trailing')) { |
58 | 58 | $trailing_separator = $breadcrumb_separator; |
59 | 59 | } |
60 | - return '<div class="breadcrumb">' . implode($breadcrumb_separator, $breadcrumb) . "$trailing_separator$title</div>"; |
|
60 | + return '<div class="breadcrumb">'.implode($breadcrumb_separator, $breadcrumb)."$trailing_separator$title</div>"; |
|
61 | 61 | } |
62 | 62 | } |
63 | 63 | // Otherwise, return an empty string. |
@@ -106,14 +106,14 @@ discard block |
||
106 | 106 | 'level' => 'h2', |
107 | 107 | ); |
108 | 108 | } |
109 | - $output .= '<' . $heading['level']; |
|
109 | + $output .= '<'.$heading['level']; |
|
110 | 110 | if (!empty($heading['class'])) { |
111 | 111 | $output .= drupal_attributes(array('class' => $heading['class'])); |
112 | 112 | } |
113 | - $output .= '>' . check_plain($heading['text']) . '</' . $heading['level'] . '>'; |
|
113 | + $output .= '>'.check_plain($heading['text']).'</'.$heading['level'].'>'; |
|
114 | 114 | } |
115 | 115 | |
116 | - $output .= '<ul'. drupal_attributes($attributes) .'>'; |
|
116 | + $output .= '<ul'.drupal_attributes($attributes).'>'; |
|
117 | 117 | |
118 | 118 | $num_links = count($links); |
119 | 119 | $i = 1; |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | && (empty($link['language']) || $link['language']->language == $language->language)) { |
133 | 133 | $class .= ' active'; |
134 | 134 | } |
135 | - $output .= '<li'. drupal_attributes(array('class' => $class)) .'>'; |
|
135 | + $output .= '<li'.drupal_attributes(array('class' => $class)).'>'; |
|
136 | 136 | |
137 | 137 | if (isset($link['href'])) { |
138 | 138 | // Pass in $link as $options, they share the same keys. |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | if (isset($link['attributes'])) { |
148 | 148 | $span_attributes = drupal_attributes($link['attributes']); |
149 | 149 | } |
150 | - $output .= '<span'. $span_attributes .'>'. $link['title'] .'</span>'; |
|
150 | + $output .= '<span'.$span_attributes.'>'.$link['title'].'</span>'; |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | $i++; |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | |
171 | 171 | // If an item is a LOCAL TASK, render it as a tab |
172 | 172 | if ($link['type'] & MENU_IS_LOCAL_TASK) { |
173 | - $link['title'] = '<span class="tab">' . check_plain($link['title']) . '</span>'; |
|
173 | + $link['title'] = '<span class="tab">'.check_plain($link['title']).'</span>'; |
|
174 | 174 | $link['localized_options']['html'] = TRUE; |
175 | 175 | } |
176 | 176 | |
@@ -195,10 +195,10 @@ discard block |
||
195 | 195 | } |
196 | 196 | |
197 | 197 | if ($primary) { |
198 | - $output .= '<ul class="tabs primary clearfix">' . $primary . '</ul>'; |
|
198 | + $output .= '<ul class="tabs primary clearfix">'.$primary.'</ul>'; |
|
199 | 199 | } |
200 | 200 | if ($secondary) { |
201 | - $output .= '<ul class="tabs secondary clearfix">' . $secondary . '</ul>'; |
|
201 | + $output .= '<ul class="tabs secondary clearfix">'.$secondary.'</ul>'; |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | return $output; |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | $elements['#region'] = $region; |
254 | 254 | |
255 | 255 | // Set the theme hook suggestions. |
256 | - $hook = array('region_' . $region); |
|
256 | + $hook = array('region_'.$region); |
|
257 | 257 | if (strpos($region, 'sidebar_') === 0) { |
258 | 258 | $hook[] = 'region_sidebar'; |
259 | 259 | } |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | // Views (and possibly other modules) have templates with a $classes |
296 | 296 | // variable that isn't a string, so we leave those variables alone. |
297 | 297 | if (is_string($vars[$key])) { |
298 | - $vars['classes_array'] = explode(' ', $hook . ' ' . $vars[$key]); |
|
298 | + $vars['classes_array'] = explode(' ', $hook.' '.$vars[$key]); |
|
299 | 299 | unset($vars[$key]); |
300 | 300 | } |
301 | 301 | } |
@@ -319,37 +319,37 @@ discard block |
||
319 | 319 | function zen_preprocess_page(&$vars, $hook) { |
320 | 320 | // If the user is silly and enables Zen as the theme, add some styles. |
321 | 321 | if ($GLOBALS['theme'] == 'zen') { |
322 | - include_once './' . _zen_path() . '/zen-internals/template.zen.inc'; |
|
322 | + include_once './'._zen_path().'/zen-internals/template.zen.inc'; |
|
323 | 323 | _zen_preprocess_page($vars, $hook); |
324 | 324 | } |
325 | 325 | // Add conditional stylesheets. |
326 | 326 | elseif (!module_exists('conditional_styles')) { |
327 | 327 | $language = $GLOBALS['language']->direction == LANGUAGE_RTL ? '_rtl' : ''; |
328 | - $vars['conditional_styles'] = variable_get('conditional_styles_' . $GLOBALS['theme'] . $language, ''); |
|
328 | + $vars['conditional_styles'] = variable_get('conditional_styles_'.$GLOBALS['theme'].$language, ''); |
|
329 | 329 | $vars['styles'] .= $vars['conditional_styles']; |
330 | 330 | } |
331 | 331 | |
332 | 332 | // Classes for body element. Allows advanced theming based on context |
333 | 333 | // (home page, node of certain type, etc.) |
334 | 334 | // Remove the mostly useless page-ARG0 class. |
335 | - if ($index = array_search(preg_replace('![^abcdefghijklmnopqrstuvwxyz0-9-_]+!s', '', 'page-'. drupal_strtolower(arg(0))), $vars['classes_array'])) { |
|
335 | + if ($index = array_search(preg_replace('![^abcdefghijklmnopqrstuvwxyz0-9-_]+!s', '', 'page-'.drupal_strtolower(arg(0))), $vars['classes_array'])) { |
|
336 | 336 | unset($vars['classes_array'][$index]); |
337 | 337 | } |
338 | 338 | if (!$vars['is_front']) { |
339 | 339 | // Add unique class for each page. |
340 | 340 | $path = drupal_get_path_alias($_GET['q']); |
341 | - $vars['classes_array'][] = drupal_html_class('page-' . $path); |
|
341 | + $vars['classes_array'][] = drupal_html_class('page-'.$path); |
|
342 | 342 | // Add unique class for each website section. |
343 | - list($section, ) = explode('/', $path, 2); |
|
343 | + list($section,) = explode('/', $path, 2); |
|
344 | 344 | if (arg(0) == 'node') { |
345 | 345 | if (arg(1) == 'add') { |
346 | 346 | $section = 'node-add'; |
347 | 347 | } |
348 | 348 | elseif (is_numeric(arg(1)) && (arg(2) == 'edit' || arg(2) == 'delete')) { |
349 | - $section = 'node-' . arg(2); |
|
349 | + $section = 'node-'.arg(2); |
|
350 | 350 | } |
351 | 351 | } |
352 | - $vars['classes_array'][] = drupal_html_class('section-' . $section); |
|
352 | + $vars['classes_array'][] = drupal_html_class('section-'.$section); |
|
353 | 353 | } |
354 | 354 | if (theme_get_setting('zen_wireframes')) { |
355 | 355 | $vars['classes_array'][] = 'with-wireframes'; // Optionally add the wireframes style. |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | } |
377 | 377 | else { |
378 | 378 | $vars['classes_array'][] = 'one-sidebar'; |
379 | - $vars['classes_array'][] = 'sidebar-' . $vars['layout']; |
|
379 | + $vars['classes_array'][] = 'sidebar-'.$vars['layout']; |
|
380 | 380 | } |
381 | 381 | } |
382 | 382 | // Store the menu item since it has some useful information. |
@@ -406,13 +406,13 @@ discard block |
||
406 | 406 | function zen_preprocess_maintenance_page(&$vars, $hook) { |
407 | 407 | // If Zen is the maintenance theme, add some styles. |
408 | 408 | if ($GLOBALS['theme'] == 'zen') { |
409 | - include_once './' . _zen_path() . '/zen-internals/template.zen.inc'; |
|
409 | + include_once './'._zen_path().'/zen-internals/template.zen.inc'; |
|
410 | 410 | _zen_preprocess_page($vars, $hook); |
411 | 411 | } |
412 | 412 | // Add conditional stylesheets. |
413 | 413 | elseif (!module_exists('conditional_styles')) { |
414 | 414 | $language = $GLOBALS['language']->direction == LANGUAGE_RTL ? '_rtl' : ''; |
415 | - $vars['conditional_styles'] = variable_get('conditional_styles_' . $GLOBALS['theme'] . $language, ''); |
|
415 | + $vars['conditional_styles'] = variable_get('conditional_styles_'.$GLOBALS['theme'].$language, ''); |
|
416 | 416 | $vars['styles'] .= $vars['conditional_styles']; |
417 | 417 | } |
418 | 418 | } |
@@ -459,11 +459,11 @@ discard block |
||
459 | 459 | $vars['user_picture'] = $vars['picture']; |
460 | 460 | |
461 | 461 | // Create the Drupal 7 $display_submitted variable. |
462 | - $vars['display_submitted'] = theme_get_setting('toggle_node_info_' . $vars['node']->type); |
|
462 | + $vars['display_submitted'] = theme_get_setting('toggle_node_info_'.$vars['node']->type); |
|
463 | 463 | |
464 | 464 | // Special classes for nodes. |
465 | 465 | // Class for node type: "node-type-page", "node-type-story", "node-type-my-custom-type", etc. |
466 | - $vars['classes_array'][] = drupal_html_class('node-type-' . $vars['type']); |
|
466 | + $vars['classes_array'][] = drupal_html_class('node-type-'.$vars['type']); |
|
467 | 467 | if ($vars['promote']) { |
468 | 468 | $vars['classes_array'][] = 'node-promoted'; |
469 | 469 | } |
@@ -486,7 +486,7 @@ discard block |
||
486 | 486 | if (isset($vars['preview'])) { |
487 | 487 | $vars['classes_array'][] = 'node-preview'; |
488 | 488 | } |
489 | - $vars['classes_array'][] = 'build-mode-' . $vars['build_mode'] ; |
|
489 | + $vars['classes_array'][] = 'build-mode-'.$vars['build_mode']; |
|
490 | 490 | } |
491 | 491 | |
492 | 492 | /** |
@@ -498,7 +498,7 @@ discard block |
||
498 | 498 | * The name of the template being rendered ("comment" in this case.) |
499 | 499 | */ |
500 | 500 | function zen_preprocess_comment(&$vars, $hook) { |
501 | - include_once './' . _zen_path() . '/zen-internals/template.comment.inc'; |
|
501 | + include_once './'._zen_path().'/zen-internals/template.comment.inc'; |
|
502 | 502 | _zen_preprocess_comment($vars, $hook); |
503 | 503 | } |
504 | 504 | |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | $vars['region'] = $vars['elements']['#region']; |
517 | 517 | |
518 | 518 | // Setup the default classes. |
519 | - $vars['classes_array'] = array('region', 'region-' . str_replace('_', '-', $vars['region'])); |
|
519 | + $vars['classes_array'] = array('region', 'region-'.str_replace('_', '-', $vars['region'])); |
|
520 | 520 | |
521 | 521 | // Sidebar regions get a couple extra classes. |
522 | 522 | if (strpos($vars['region'], 'sidebar_') === 0) { |
@@ -542,7 +542,7 @@ discard block |
||
542 | 542 | $vars['title'] = $block->subject; |
543 | 543 | |
544 | 544 | // Special classes for blocks. |
545 | - $vars['classes_array'][] = 'block-' . $block->module; |
|
545 | + $vars['classes_array'][] = 'block-'.$block->module; |
|
546 | 546 | // Classes describing the position of the block within the region. |
547 | 547 | if ($vars['block_id'] == 1) { |
548 | 548 | $vars['classes_array'][] = 'first'; |
@@ -550,17 +550,17 @@ discard block |
||
550 | 550 | if (!function_exists('context_blocks') && count(block_list($vars['block']->region)) == $vars['block_id']) { |
551 | 551 | $vars['classes_array'][] = 'last'; |
552 | 552 | } |
553 | - $vars['classes_array'][] = 'region-' . $vars['block_zebra']; |
|
553 | + $vars['classes_array'][] = 'region-'.$vars['block_zebra']; |
|
554 | 554 | $vars['classes_array'][] = $vars['zebra']; |
555 | - $vars['classes_array'][] = 'region-count-' . $vars['block_id']; |
|
556 | - $vars['classes_array'][] = 'count-' . $vars['id']; |
|
555 | + $vars['classes_array'][] = 'region-count-'.$vars['block_id']; |
|
556 | + $vars['classes_array'][] = 'count-'.$vars['id']; |
|
557 | 557 | |
558 | 558 | // Create the block ID. |
559 | - $vars['block_html_id'] = 'block-' . $block->module . '-' . $block->delta; |
|
559 | + $vars['block_html_id'] = 'block-'.$block->module.'-'.$block->delta; |
|
560 | 560 | |
561 | 561 | $vars['edit_links_array'] = array(); |
562 | 562 | if (theme_get_setting('zen_block_editing') && user_access('administer blocks')) { |
563 | - include_once './' . _zen_path() . '/zen-internals/template.block-editing.inc'; |
|
563 | + include_once './'._zen_path().'/zen-internals/template.block-editing.inc'; |
|
564 | 564 | zen_preprocess_block_editing($vars, $hook); |
565 | 565 | $vars['classes_array'][] = 'with-block-editing'; |
566 | 566 | } |
@@ -590,7 +590,7 @@ discard block |
||
590 | 590 | * The name of the template being rendered ("block" in this case.) |
591 | 591 | */ |
592 | 592 | function zen_process_block(&$vars, $hook) { |
593 | - $vars['edit_links'] = !empty($vars['edit_links_array']) ? '<div class="edit">' . implode(' ', $vars['edit_links_array']) . '</div>' : ''; |
|
593 | + $vars['edit_links'] = !empty($vars['edit_links_array']) ? '<div class="edit">'.implode(' ', $vars['edit_links_array']).'</div>' : ''; |
|
594 | 594 | } |
595 | 595 | |
596 | 596 | if (!function_exists('drupal_html_class')) { |
@@ -141,12 +141,12 @@ discard block |
||
141 | 141 | // prefix for links; needed for pages not in top dir |
142 | 142 | $user, |
143 | 143 | // logged-in user, if any |
144 | - $fixed=false, |
|
144 | + $fixed = false, |
|
145 | 145 | // if true, navbar is fixed at top of page. |
146 | 146 | // NOTE: if you do this, you must set a global var $fixed_navbar |
147 | 147 | // to true at compile time |
148 | 148 | // (it needs to be set when page_head() is called). |
149 | - $inverse=false |
|
149 | + $inverse = false |
|
150 | 150 | // white on black? |
151 | 151 | ) { |
152 | 152 | global $master_url; |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | // output a panel. |
215 | 215 | // $content_func is a function that generates the panel contents |
216 | 216 | // |
217 | -function panel($title, $content_func, $class="panel-primary", $body_class="") { |
|
217 | +function panel($title, $content_func, $class = "panel-primary", $body_class = "") { |
|
218 | 218 | echo sprintf('<div class="panel %s"> |
219 | 219 | ', $class |
220 | 220 | ); |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | // are functions that generate the top, left, and right content |
241 | 241 | // $left_width is the width of left column in 1/12 units. |
242 | 242 | // |
243 | -function grid($top_func, $left_func, $right_func, $left_width=6) { |
|
243 | +function grid($top_func, $left_func, $right_func, $left_width = 6) { |
|
244 | 244 | echo ' |
245 | 245 | <div class="container-fluid"> |
246 | 246 | '; |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | </div> |
256 | 256 | '; |
257 | 257 | } |
258 | - $right_width = 12-$left_width; |
|
258 | + $right_width = 12 - $left_width; |
|
259 | 259 | echo ' |
260 | 260 | <div class="row"> |
261 | 261 | <div class="col-sm-'.$left_width.'"> |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | // use extra = "name=x" |
280 | 280 | // call forum_focus(x, foo) after defining the field |
281 | 281 | // |
282 | -function form_start($action, $method='get', $extra='') { |
|
282 | +function form_start($action, $method = 'get', $extra = '') { |
|
283 | 283 | echo sprintf( |
284 | 284 | '<div class="container-fluid"> |
285 | 285 | <form class="form-horizontal" method="%s" action="%s" %s>' |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | // just the input field |
312 | 312 | // |
313 | 313 | function form_input_text_field( |
314 | - $name, $value='', $type='text', $attrs='', $extra='' |
|
314 | + $name, $value = '', $type = 'text', $attrs = '', $extra = '' |
|
315 | 315 | ) { |
316 | 316 | return sprintf( |
317 | 317 | '<input %s type="%s" class="form-control" name="%s" value="%s">%s', |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | // the whole row |
323 | 323 | // |
324 | 324 | function form_input_text( |
325 | - $label, $name, $value='', $type='text', $attrs='', $extra='' |
|
325 | + $label, $name, $value = '', $type = 'text', $attrs = '', $extra = '' |
|
326 | 326 | ) { |
327 | 327 | echo sprintf(' |
328 | 328 | <div class="form-group"> |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | ); |
351 | 351 | } |
352 | 352 | |
353 | -function form_input_textarea($label, $name, $value='', $nrows=4) { |
|
353 | +function form_input_textarea($label, $name, $value = '', $nrows = 4) { |
|
354 | 354 | echo sprintf(' |
355 | 355 | <div class="form-group"> |
356 | 356 | <label align=right class="%s" for="%s">%s</label> |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | ); |
401 | 401 | $n = 0; |
402 | 402 | foreach ($items as $i) { |
403 | - $s = ($flags && $flags[$n])?'selected':''; |
|
403 | + $s = ($flags && $flags[$n]) ? 'selected' : ''; |
|
404 | 404 | echo '<option '.$s.' value="'.$i[0].'">'.$i[1].'</option> |
405 | 405 | '; |
406 | 406 | $n++; |
@@ -410,12 +410,12 @@ discard block |
||
410 | 410 | |
411 | 411 | // return a list of string for checkbox items |
412 | 412 | // |
413 | -function checkbox_item_strings($items, $attrs='') { |
|
413 | +function checkbox_item_strings($items, $attrs = '') { |
|
414 | 414 | $x = []; |
415 | 415 | foreach ($items as $i) { |
416 | 416 | $x[] = sprintf('<input %s type="checkbox" name="%s" %s> %s |
417 | 417 | ', |
418 | - $attrs, $i[0], $i[2]?"checked":"", $i[1] |
|
418 | + $attrs, $i[0], $i[2] ? "checked" : "", $i[1] |
|
419 | 419 | ); |
420 | 420 | } |
421 | 421 | return $x; |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | |
424 | 424 | // $items is list of (name, label, checked) |
425 | 425 | // |
426 | -function form_checkboxes($label, $items, $attrs='') { |
|
426 | +function form_checkboxes($label, $items, $attrs = '') { |
|
427 | 427 | echo sprintf(' |
428 | 428 | <div class="form-group"> |
429 | 429 | <label align=right class="%s">%s</label> |
@@ -449,7 +449,7 @@ discard block |
||
449 | 449 | FORM_LEFT_CLASS, $label, FORM_RIGHT_CLASS |
450 | 450 | ); |
451 | 451 | foreach ($items as $i) { |
452 | - $checked = ($selected == $i[0])?"checked":""; |
|
452 | + $checked = ($selected == $i[0]) ? "checked" : ""; |
|
453 | 453 | echo sprintf('<input type="radio" name="%s" value="%s" %s> %s <br> |
454 | 454 | ', |
455 | 455 | $name, $i[0], $checked, $i[1] |
@@ -482,7 +482,7 @@ discard block |
||
482 | 482 | '; |
483 | 483 | } |
484 | 484 | |
485 | -function form_submit($text, $attrs='') { |
|
485 | +function form_submit($text, $attrs = '') { |
|
486 | 486 | form_general( |
487 | 487 | "", |
488 | 488 | sprintf('<button %s type="submit" class="btn btn-success">%s</button>', |
@@ -491,11 +491,11 @@ discard block |
||
491 | 491 | ); |
492 | 492 | } |
493 | 493 | |
494 | -function form_checkbox($label, $name, $checked=false) { |
|
494 | +function form_checkbox($label, $name, $checked = false) { |
|
495 | 495 | echo sprintf(' |
496 | 496 | <div class="form-group"> |
497 | 497 | <input type="checkbox" name="%s" %s> <span class="lead">%s</span> |
498 | 498 | </div> |
499 | - ', $name, $checked?"checked":"", $label |
|
499 | + ', $name, $checked ? "checked" : "", $label |
|
500 | 500 | ); |
501 | 501 | } |
@@ -24,72 +24,72 @@ |
||
24 | 24 | define('KW_CATEGORY_SCIENCE', 0); |
25 | 25 | define('KW_CATEGORY_LOC', 1); |
26 | 26 | |
27 | -define('KW_ASTRONOMY', 1); |
|
28 | -define('KW_SETI', 2); |
|
29 | -define('KW_PULSARS', 3); |
|
30 | -define('KW_GW', 4); |
|
31 | -define('KW_COSMOLOGY', 5); |
|
32 | -define('KW_PHYSICS', 6); |
|
27 | +define('KW_ASTRONOMY', 1); |
|
28 | +define('KW_SETI', 2); |
|
29 | +define('KW_PULSARS', 3); |
|
30 | +define('KW_GW', 4); |
|
31 | +define('KW_COSMOLOGY', 5); |
|
32 | +define('KW_PHYSICS', 6); |
|
33 | 33 | define('KW_PARTICLE_PHYSICS', 7); |
34 | -define('KW_NANOSCIENCE', 8); |
|
35 | -define('KW_BIOMED', 9); |
|
34 | +define('KW_NANOSCIENCE', 8); |
|
35 | +define('KW_BIOMED', 9); |
|
36 | 36 | define('KW_DRUG_DISCOVERY', 10); |
37 | -define('KW_PROTEINS', 11); |
|
38 | -define('KW_GENETICS', 12); |
|
39 | -define('KW_DISEASE', 13); |
|
40 | -define('KW_CANCER', 14); |
|
41 | -define('KW_MATH_CS', 15); |
|
42 | -define('KW_AI', 16); |
|
43 | -define('KW_OCEANIA', 17); |
|
44 | -define('KW_AUSTRALIA', 18); |
|
37 | +define('KW_PROTEINS', 11); |
|
38 | +define('KW_GENETICS', 12); |
|
39 | +define('KW_DISEASE', 13); |
|
40 | +define('KW_CANCER', 14); |
|
41 | +define('KW_MATH_CS', 15); |
|
42 | +define('KW_AI', 16); |
|
43 | +define('KW_OCEANIA', 17); |
|
44 | +define('KW_AUSTRALIA', 18); |
|
45 | 45 | |
46 | -define('KW_EUROPE', 20); |
|
47 | -define('KW_GERMANY', 21); |
|
48 | -define('KW_ASIA', 22); |
|
49 | -define('KW_AMERICAS', 23); |
|
50 | -define('KW_US', 24); |
|
51 | -define('KW_UCB', 25); |
|
52 | -define('KW_AEI', 26); |
|
53 | -define('KW_CERN', 27); |
|
54 | -define('KW_UW', 28); |
|
55 | -define('KW_EARTH_SCI', 29); |
|
56 | -define('KW_SPAIN', 30); |
|
57 | -define('KW_SAN_JORGE', 31); |
|
58 | -define('KW_NUMBER_THEORY', 32); |
|
59 | -define('KW_CRYPTO', 33); |
|
60 | -define('KW_ENV_RESEARCH', 34); |
|
61 | -define('KW_CLIMATE', 35); |
|
62 | -define('KW_CZECH', 36); |
|
46 | +define('KW_EUROPE', 20); |
|
47 | +define('KW_GERMANY', 21); |
|
48 | +define('KW_ASIA', 22); |
|
49 | +define('KW_AMERICAS', 23); |
|
50 | +define('KW_US', 24); |
|
51 | +define('KW_UCB', 25); |
|
52 | +define('KW_AEI', 26); |
|
53 | +define('KW_CERN', 27); |
|
54 | +define('KW_UW', 28); |
|
55 | +define('KW_EARTH_SCI', 29); |
|
56 | +define('KW_SPAIN', 30); |
|
57 | +define('KW_SAN_JORGE', 31); |
|
58 | +define('KW_NUMBER_THEORY', 32); |
|
59 | +define('KW_CRYPTO', 33); |
|
60 | +define('KW_ENV_RESEARCH', 34); |
|
61 | +define('KW_CLIMATE', 35); |
|
62 | +define('KW_CZECH', 36); |
|
63 | 63 | define('KW_CHARLES_PRAGUE', 37); |
64 | -define('KW_RECHENKRAFT', 38); |
|
65 | -define('KW_RHEINMAIN', 39); |
|
66 | -define('KW_HUNGARY', 40); |
|
67 | -define('KW_IRELAND', 41); |
|
68 | -define('KW_UC_DUBLIN', 42); |
|
69 | -define('KW_POLAND', 43); |
|
70 | -define('KW_RUSSIA', 44); |
|
64 | +define('KW_RECHENKRAFT', 38); |
|
65 | +define('KW_RHEINMAIN', 39); |
|
66 | +define('KW_HUNGARY', 40); |
|
67 | +define('KW_IRELAND', 41); |
|
68 | +define('KW_UC_DUBLIN', 42); |
|
69 | +define('KW_POLAND', 43); |
|
70 | +define('KW_RUSSIA', 44); |
|
71 | 71 | define('KW_SW_STATE_RUSSIA', 45); |
72 | -define('KW_RAS', 46); |
|
73 | -define('KW_PRBB', 47); |
|
74 | -define('KW_UK', 48); |
|
75 | -define('KW_OXFORD', 49); |
|
76 | -define('KW_CHINA', 50); |
|
77 | -define('KW_U_DAYTON', 51); |
|
78 | -define('KW_WRIGHT_STATE', 52); |
|
79 | -define('KW_USC', 53); |
|
80 | -define('KW_FULLERTON', 54); |
|
81 | -define('KW_ARIZONA_STATE', 55); |
|
82 | -define('KW_U_ILLINOIS', 56); |
|
83 | -define('KW_U_WARSAW', 57); |
|
84 | -define('KW_RPI', 58); |
|
85 | -define('KW_INTERNATIONAL', 59); |
|
86 | -define('KW_UND', 60); |
|
87 | -define('KW_HOLLAND', 61); |
|
88 | -define('KW_CHEMISTRY', 62); |
|
89 | -define('KW_GAMES', 63); |
|
90 | -define('KW_VIRUS', 64); |
|
91 | -define('KW_FRANCE', 65); |
|
92 | -define('KW_CANADA', 66); |
|
72 | +define('KW_RAS', 46); |
|
73 | +define('KW_PRBB', 47); |
|
74 | +define('KW_UK', 48); |
|
75 | +define('KW_OXFORD', 49); |
|
76 | +define('KW_CHINA', 50); |
|
77 | +define('KW_U_DAYTON', 51); |
|
78 | +define('KW_WRIGHT_STATE', 52); |
|
79 | +define('KW_USC', 53); |
|
80 | +define('KW_FULLERTON', 54); |
|
81 | +define('KW_ARIZONA_STATE', 55); |
|
82 | +define('KW_U_ILLINOIS', 56); |
|
83 | +define('KW_U_WARSAW', 57); |
|
84 | +define('KW_RPI', 58); |
|
85 | +define('KW_INTERNATIONAL', 59); |
|
86 | +define('KW_UND', 60); |
|
87 | +define('KW_HOLLAND', 61); |
|
88 | +define('KW_CHEMISTRY', 62); |
|
89 | +define('KW_GAMES', 63); |
|
90 | +define('KW_VIRUS', 64); |
|
91 | +define('KW_FRANCE', 65); |
|
92 | +define('KW_CANADA', 66); |
|
93 | 93 | |
94 | 94 | $job_keywords = array(); |
95 | 95 |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | if ($template) { |
62 | 62 | $t = (double)$template->workunit->rsc_fpops_est; |
63 | 63 | } |
64 | - foreach($r->batch->job as $job) { |
|
64 | + foreach ($r->batch->job as $job) { |
|
65 | 65 | $y = (double)$job->rsc_fpops_est; |
66 | 66 | if ($y) { |
67 | 67 | $x += $y; |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | function est_elapsed_time($r, $template) { |
88 | 88 | // crude estimate: batch FLOPs / project FLOPS |
89 | 89 | // |
90 | - return batch_flop_count($r, $template) / project_flops(); |
|
90 | + return batch_flop_count($r, $template)/project_flops(); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | // if batch-level input template filename was given, read it; |
@@ -97,9 +97,9 @@ discard block |
||
97 | 97 | // |
98 | 98 | function read_input_template($app, $r) { |
99 | 99 | if ((isset($r->batch)) && (isset($r->batch->workunit_template_file)) && ($r->batch->workunit_template_file)) { |
100 | - $path = project_dir() . "/templates/".$r->batch->workunit_template_file; |
|
100 | + $path = project_dir()."/templates/".$r->batch->workunit_template_file; |
|
101 | 101 | } else { |
102 | - $path = project_dir() . "/templates/$app->name"."_in"; |
|
102 | + $path = project_dir()."/templates/$app->name"."_in"; |
|
103 | 103 | } |
104 | 104 | if (file_exists($path)) { |
105 | 105 | $x = simplexml_load_file($path); |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | function validate_batch($jobs, $template) { |
145 | 145 | $i = 0; |
146 | 146 | $n = count($template->file_info); |
147 | - foreach($jobs as $job) { |
|
147 | + foreach ($jobs as $job) { |
|
148 | 148 | $m = count($job->input_files); |
149 | 149 | if ($n != $m) { |
150 | 150 | log_write("wrong # of input files for job $i: need $n, got $m"); |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | // stage all the files |
206 | 206 | // |
207 | 207 | function stage_files(&$jobs) { |
208 | - foreach($jobs as $job) { |
|
208 | + foreach ($jobs as $job) { |
|
209 | 209 | foreach ($job->input_files as $file) { |
210 | 210 | if ($file->mode != "remote") { |
211 | 211 | $file->name = stage_file($file); |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | // |
219 | 219 | function submit_jobs( |
220 | 220 | $jobs, $job_params, $app, $batch_id, $priority, $app_version_num, |
221 | - $input_template_filename, // batch-level; can also specify per job |
|
221 | + $input_template_filename, // batch-level; can also specify per job |
|
222 | 222 | $output_template_filename |
223 | 223 | ) { |
224 | 224 | global $input_templates, $output_templates; |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | // one line per job |
228 | 228 | // |
229 | 229 | $x = ""; |
230 | - foreach($jobs as $job) { |
|
230 | + foreach ($jobs as $job) { |
|
231 | 231 | if ($job->name) { |
232 | 232 | $x .= " --wu_name $job->name"; |
233 | 233 | } |
@@ -262,8 +262,8 @@ discard block |
||
262 | 262 | $x .= "\n"; |
263 | 263 | } |
264 | 264 | |
265 | - $errfile = "/tmp/create_work_" . getmypid() . ".err"; |
|
266 | - $cmd = "cd " . project_dir() . "; ./bin/create_work --appname $app->name --batch $batch_id"; |
|
265 | + $errfile = "/tmp/create_work_".getmypid().".err"; |
|
266 | + $cmd = "cd ".project_dir()."; ./bin/create_work --appname $app->name --batch $batch_id"; |
|
267 | 267 | if ($priority !== null) { |
268 | 268 | $cmd .= " --priority $priority"; |
269 | 269 | } |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | // |
364 | 364 | function xml_get_jobs($r) { |
365 | 365 | $jobs = array(); |
366 | - foreach($r->batch->job as $j) { |
|
366 | + foreach ($r->batch->job as $j) { |
|
367 | 367 | $job = new StdClass; |
368 | 368 | $job->input_files = array(); |
369 | 369 | $job->command_line = (string)$j->command_line; |
@@ -414,16 +414,16 @@ discard block |
||
414 | 414 | // |
415 | 415 | function logical_end_time($r, $jobs, $user, $app) { |
416 | 416 | $total_flops = 0; |
417 | - foreach($jobs as $job) { |
|
417 | + foreach ($jobs as $job) { |
|
418 | 418 | //print_r($job); |
419 | 419 | if ($job->rsc_fpops_est) { |
420 | 420 | $total_flops += $job->rsc_fpops_est; |
421 | 421 | } else if ($job->input_template && $job->input_template->workunit->rsc_fpops_est) { |
422 | - $total_flops += (double) $job->input_template->workunit->rsc_fpops_est; |
|
422 | + $total_flops += (double)$job->input_template->workunit->rsc_fpops_est; |
|
423 | 423 | } else if ($r->batch->job_params->rsc_fpops_est) { |
424 | - $total_flops += (double) $r->batch->job_params->rsc_fpops_est; |
|
424 | + $total_flops += (double)$r->batch->job_params->rsc_fpops_est; |
|
425 | 425 | } else { |
426 | - $x = (double) $template->workunit->rsc_fpops_est; |
|
426 | + $x = (double)$template->workunit->rsc_fpops_est; |
|
427 | 427 | if ($x) { |
428 | 428 | $total_flops += $x; |
429 | 429 | } else { |
@@ -431,7 +431,7 @@ discard block |
||
431 | 431 | } |
432 | 432 | } |
433 | 433 | } |
434 | - $cmd = "cd " . project_dir() . "/bin; ./adjust_user_priority --user $user->id --flops $total_flops --app $app->name"; |
|
434 | + $cmd = "cd ".project_dir()."/bin; ./adjust_user_priority --user $user->id --flops $total_flops --app $app->name"; |
|
435 | 435 | $x = exec($cmd); |
436 | 436 | if (!is_numeric($x) || (double)$x == 0) { |
437 | 437 | xml_error(-1, "$cmd returned $x"); |
@@ -509,15 +509,15 @@ discard block |
||
509 | 509 | } |
510 | 510 | |
511 | 511 | $job_params = new StdClass; |
512 | - $job_params->rsc_disk_bound = (double) $r->batch->job_params->rsc_disk_bound; |
|
513 | - $job_params->rsc_fpops_est = (double) $r->batch->job_params->rsc_fpops_est; |
|
514 | - $job_params->rsc_fpops_bound = (double) $r->batch->job_params->rsc_fpops_bound; |
|
515 | - $job_params->rsc_memory_bound = (double) $r->batch->job_params->rsc_memory_bound; |
|
516 | - $job_params->delay_bound = (double) $r->batch->job_params->delay_bound; |
|
512 | + $job_params->rsc_disk_bound = (double)$r->batch->job_params->rsc_disk_bound; |
|
513 | + $job_params->rsc_fpops_est = (double)$r->batch->job_params->rsc_fpops_est; |
|
514 | + $job_params->rsc_fpops_bound = (double)$r->batch->job_params->rsc_fpops_bound; |
|
515 | + $job_params->rsc_memory_bound = (double)$r->batch->job_params->rsc_memory_bound; |
|
516 | + $job_params->delay_bound = (double)$r->batch->job_params->delay_bound; |
|
517 | 517 | // could add quorum-related stuff |
518 | 518 | |
519 | - $input_template_filename = (string) $r->batch->input_template_filename; |
|
520 | - $output_template_filename = (string) $r->batch->output_template_filename; |
|
519 | + $input_template_filename = (string)$r->batch->input_template_filename; |
|
520 | + $output_template_filename = (string)$r->batch->output_template_filename; |
|
521 | 521 | // possibly empty |
522 | 522 | |
523 | 523 | submit_jobs( |
@@ -606,7 +606,7 @@ discard block |
||
606 | 606 | } |
607 | 607 | |
608 | 608 | function n_outfiles($wu) { |
609 | - $path = project_dir() . "/$wu->output_template_filename"; |
|
609 | + $path = project_dir()."/$wu->output_template_filename"; |
|
610 | 610 | $r = simplexml_load_file($path); |
611 | 611 | return count($r->file_info); |
612 | 612 | } |
@@ -813,7 +813,7 @@ discard block |
||
813 | 813 | "; |
814 | 814 | if ($result->server_state == 5) { // over? |
815 | 815 | $paths = get_outfile_paths($result); |
816 | - foreach($paths as $path) { |
|
816 | + foreach ($paths as $path) { |
|
817 | 817 | if (is_file($path)) { |
818 | 818 | $size = filesize($path); |
819 | 819 | echo " <outfile> |
@@ -857,7 +857,7 @@ discard block |
||
857 | 857 | } else { |
858 | 858 | $results = BoincResult::enum("workunitid=$job_id"); |
859 | 859 | foreach ($results as $r) { |
860 | - switch($r->outcome) { |
|
860 | + switch ($r->outcome) { |
|
861 | 861 | case 1: |
862 | 862 | case 3: |
863 | 863 | case 6: |
@@ -972,8 +972,8 @@ discard block |
||
972 | 972 | } |
973 | 973 | |
974 | 974 | list($user, $user_submit) = check_remote_submit_permissions($r, $app); |
975 | - $in = file_get_contents(project_dir() . "/templates/".$app->name."_in"); |
|
976 | - $out = file_get_contents(project_dir() . "/templates/".$app->name."_out"); |
|
975 | + $in = file_get_contents(project_dir()."/templates/".$app->name."_in"); |
|
976 | + $out = file_get_contents(project_dir()."/templates/".$app->name."_out"); |
|
977 | 977 | if ($in === false || $out === false) { |
978 | 978 | log_write("template file missing"); |
979 | 979 | xml_error(-1, "template file missing"); |
@@ -985,7 +985,7 @@ discard block |
||
985 | 985 | |
986 | 986 | function ping($r) { |
987 | 987 | xml_start_tag("ping"); |
988 | - BoincDb::get(); // errors out if DB down or web disabled |
|
988 | + BoincDb::get(); // errors out if DB down or web disabled |
|
989 | 989 | echo "<success>1</success> |
990 | 990 | </ping> |
991 | 991 | "; |
@@ -1052,9 +1052,9 @@ discard block |
||
1052 | 1052 | $request_log = parse_config(get_config(), "<remote_submit_request_log>"); |
1053 | 1053 | if ($request_log) { |
1054 | 1054 | $log_dir = parse_config(get_config(), "<log_dir>"); |
1055 | - $request_log = $log_dir . "/" . $request_log; |
|
1055 | + $request_log = $log_dir."/".$request_log; |
|
1056 | 1056 | if ($file = fopen($request_log, "a")) { |
1057 | - fwrite($file, "\n<submit_rpc_handler date=\"" . date(DATE_ATOM) . "\">\n" . $_POST['request'] . "\n</submit_rpc_handler>\n"); |
|
1057 | + fwrite($file, "\n<submit_rpc_handler date=\"".date(DATE_ATOM)."\">\n".$_POST['request']."\n</submit_rpc_handler>\n"); |
|
1058 | 1058 | fclose($file); |
1059 | 1059 | } |
1060 | 1060 | } |
@@ -46,10 +46,10 @@ discard block |
||
46 | 46 | "; |
47 | 47 | } |
48 | 48 | |
49 | -function xml_error($num=-1, $msg=null, $file=null, $line=null) { |
|
49 | +function xml_error($num = -1, $msg = null, $file = null, $line = null) { |
|
50 | 50 | global $xml_outer_tag; |
51 | 51 | if (!$msg) { |
52 | - switch($num) { |
|
52 | + switch ($num) { |
|
53 | 53 | case -112: $msg = "Invalid XML"; break; |
54 | 54 | case -136: $msg = "Not found"; break; |
55 | 55 | case -137: $msg = "Name or email address is not unique"; break; |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | // If it's a single-tag element, and it's present, just return the tag |
96 | 96 | // |
97 | 97 | function parse_element($xml, $tag) { |
98 | - $closetag = "</" . substr($tag,1); |
|
98 | + $closetag = "</".substr($tag, 1); |
|
99 | 99 | $x = strstr($xml, $tag); |
100 | 100 | if ($x) { |
101 | 101 | if (strstr($tag, "/>")) return $tag; |
@@ -111,8 +111,8 @@ discard block |
||
111 | 111 | |
112 | 112 | function parse_next_element($xml, $tag, &$cursor) { |
113 | 113 | $element = null; |
114 | - $closetag = "</" . substr($tag,1); |
|
115 | - $pos = substr($xml,$cursor); |
|
114 | + $closetag = "</".substr($tag, 1); |
|
115 | + $pos = substr($xml, $cursor); |
|
116 | 116 | $x = strstr($pos, $tag); |
117 | 117 | if ($x) { |
118 | 118 | if (strstr($tag, "/>")) return $tag; |
@@ -37,17 +37,17 @@ discard block |
||
37 | 37 | // |
38 | 38 | $config = get_config(); |
39 | 39 | global $master_url; |
40 | -$master_url = parse_config($config , "<master_url>"); |
|
40 | +$master_url = parse_config($config, "<master_url>"); |
|
41 | 41 | $recaptcha_public_key = parse_config($config, "<recaptcha_public_key>"); |
42 | 42 | $recaptcha_private_key = parse_config($config, "<recaptcha_private_key>"); |
43 | 43 | |
44 | 44 | // the following default to on |
45 | 45 | // |
46 | 46 | $x = parse_config($config, "<user_country>"); |
47 | -define('USER_COUNTRY', ($x===null)?1:(int)$x); |
|
47 | +define('USER_COUNTRY', ($x === null) ? 1 : (int)$x); |
|
48 | 48 | |
49 | 49 | $x = parse_config($config, "<user_url>"); |
50 | -define('USER_URL', ($x===null)?1:(int)$x); |
|
50 | +define('USER_URL', ($x === null) ? 1 : (int)$x); |
|
51 | 51 | |
52 | 52 | // don't allow /... at the end of URL |
53 | 53 | // |
@@ -141,10 +141,10 @@ discard block |
||
141 | 141 | } |
142 | 142 | |
143 | 143 | function url_base() { |
144 | - return is_https()?secure_url_base():URL_BASE; |
|
144 | + return is_https() ?secure_url_base() : URL_BASE; |
|
145 | 145 | } |
146 | 146 | |
147 | -function send_cookie($name, $value, $permanent, $ops=false) { |
|
147 | +function send_cookie($name, $value, $permanent, $ops = false) { |
|
148 | 148 | global $master_url; |
149 | 149 | |
150 | 150 | // the following allows independent login for projects on the same server |
@@ -155,11 +155,11 @@ discard block |
||
155 | 155 | $path = substr($path, 0, -1); |
156 | 156 | $path .= "_ops/"; |
157 | 157 | } |
158 | - $expire = $permanent?time()+3600*24*365:0; |
|
158 | + $expire = $permanent ?time() + 3600*24*365 : 0; |
|
159 | 159 | setcookie($name, $value, $expire, $path); |
160 | 160 | } |
161 | 161 | |
162 | -function clear_cookie($name, $ops=false) { |
|
162 | +function clear_cookie($name, $ops = false) { |
|
163 | 163 | global $master_url; |
164 | 164 | $url = parse_url($master_url); |
165 | 165 | $path = $url['path']; |
@@ -167,13 +167,13 @@ discard block |
||
167 | 167 | $path = substr($path, 0, -1); |
168 | 168 | $path .= "_ops/"; |
169 | 169 | } |
170 | - setcookie($name, '', time()-3600, $path); |
|
170 | + setcookie($name, '', time() - 3600, $path); |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | $g_logged_in_user = null; |
174 | 174 | $got_logged_in_user = false; |
175 | 175 | |
176 | -function get_logged_in_user($must_be_logged_in=true) { |
|
176 | +function get_logged_in_user($must_be_logged_in = true) { |
|
177 | 177 | global $g_logged_in_user, $got_logged_in_user; |
178 | 178 | if ($got_logged_in_user) { |
179 | 179 | // this could have been called earlier with $must_be_logged_in false |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | $next_url = $_SERVER['REQUEST_URI']; |
200 | 200 | $n = strrpos($next_url, "/"); |
201 | 201 | if ($n) { |
202 | - $next_url = substr($next_url, $n+1); |
|
202 | + $next_url = substr($next_url, $n + 1); |
|
203 | 203 | } |
204 | 204 | } |
205 | 205 | $next_url = urlencode($next_url); |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | return $g_logged_in_user; |
211 | 211 | } |
212 | 212 | |
213 | -function show_login_info($prefix="") { |
|
213 | +function show_login_info($prefix = "") { |
|
214 | 214 | $user = get_logged_in_user(false); |
215 | 215 | if ($user) { |
216 | 216 | $url_tokens = url_tokens($user->authenticator); |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | } |
221 | 221 | } |
222 | 222 | |
223 | -$cache_control_extra=""; |
|
223 | +$cache_control_extra = ""; |
|
224 | 224 | $is_login_page = false; |
225 | 225 | |
226 | 226 | // Call this to start pages. |
@@ -232,11 +232,11 @@ discard block |
||
232 | 232 | // with an existing web framework can more easily do so. |
233 | 233 | // To do so, define page_head() in the project include file. |
234 | 234 | // |
235 | -if (!function_exists("page_head")){ |
|
235 | +if (!function_exists("page_head")) { |
|
236 | 236 | function page_head( |
237 | 237 | $title, |
238 | 238 | // page title. Put in <title>, used as title for browser tab. |
239 | - $body_attrs=null, |
|
239 | + $body_attrs = null, |
|
240 | 240 | // <body XXXX> |
241 | 241 | // e.g. Javascript to put focus in an input field |
242 | 242 | // (onload="document.form.foo.focus()") |
@@ -245,10 +245,10 @@ discard block |
||
245 | 245 | // if set, include schedulers.txt. |
246 | 246 | // also pass to project_banner() in case you want a different |
247 | 247 | // header for your main page. |
248 | - $url_prefix="", |
|
248 | + $url_prefix = "", |
|
249 | 249 | // prepend this to links. |
250 | 250 | // Use for web pages not in the top directory |
251 | - $head_extra=null |
|
251 | + $head_extra = null |
|
252 | 252 | // extra stuff to put in <head>. E.g.: |
253 | 253 | // reCAPTCHA code (create_profile.php) |
254 | 254 | // bbcode javascript (forums) |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | header("Content-type: text/html; charset=utf-8"); |
271 | 271 | header("Expires: Mon, 26 Jul 1997 05:00:00 UTC"); |
272 | 272 | // Date in the past |
273 | - header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " UTC"); |
|
273 | + header("Last-Modified: ".gmdate("D, d M Y H:i:s")." UTC"); |
|
274 | 274 | // always modified |
275 | 275 | header("Cache-Control: $cache_control_extra no-cache, must-revalidate, post-check=0, pre-check=0"); |
276 | 276 | // for HTTP/1.1 |
@@ -291,11 +291,11 @@ discard block |
||
291 | 291 | if ($head_extra) { |
292 | 292 | echo "\n$head_extra\n"; |
293 | 293 | } |
294 | - if ($is_main && (!defined('NO_COMPUTING')||!NO_COMPUTING)) { |
|
294 | + if ($is_main && (!defined('NO_COMPUTING') || !NO_COMPUTING)) { |
|
295 | 295 | readfile("schedulers.txt"); |
296 | 296 | } |
297 | 297 | |
298 | - $t = $title?$title:PROJECT; |
|
298 | + $t = $title ? $title : PROJECT; |
|
299 | 299 | echo "<title>$t</title>\n"; |
300 | 300 | echo ' |
301 | 301 | <meta charset="utf-8"> |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | echo '<div class="container-fluid"> |
353 | 353 | '; |
354 | 354 | |
355 | - switch($title) { //kludge |
|
355 | + switch ($title) { //kludge |
|
356 | 356 | case tra("Log in"): |
357 | 357 | case tra("Create an account"): |
358 | 358 | case tra("Server status page"): |
@@ -367,13 +367,13 @@ discard block |
||
367 | 367 | |
368 | 368 | // See the comments for page_head() |
369 | 369 | // |
370 | -if (!function_exists("page_tail")){ |
|
370 | +if (!function_exists("page_tail")) { |
|
371 | 371 | function page_tail( |
372 | - $show_date=false, |
|
372 | + $show_date = false, |
|
373 | 373 | // true for pages that are generated periodically rather than on the fly |
374 | - $url_prefix="", |
|
374 | + $url_prefix = "", |
|
375 | 375 | // use for pages not at top level |
376 | - $is_main=false |
|
376 | + $is_main = false |
|
377 | 377 | // passed to project_footer; |
378 | 378 | ) { |
379 | 379 | echo "<br>\n"; |
@@ -388,10 +388,10 @@ discard block |
||
388 | 388 | } |
389 | 389 | } |
390 | 390 | |
391 | -function display_cvs_versions(){ |
|
391 | +function display_cvs_versions() { |
|
392 | 392 | global $cvs_version_tracker; |
393 | 393 | echo "\n<!-- SVN VERSIONS -->\n"; |
394 | - for ($i=0;$i<sizeof($cvs_version_tracker);$i++) { |
|
394 | + for ($i = 0; $i < sizeof($cvs_version_tracker); $i++) { |
|
395 | 395 | echo "<!-- ".$cvs_version_tracker[$i]." -->\n"; |
396 | 396 | } |
397 | 397 | } |
@@ -416,23 +416,23 @@ discard block |
||
416 | 416 | // takes argument in second and returns a human formatted time string |
417 | 417 | // in the form D days + h Hours + m Min + s sec. |
418 | 418 | |
419 | -function time_diff($x, $res=3) { |
|
419 | +function time_diff($x, $res = 3) { |
|
420 | 420 | $days = (int)($x/86400); |
421 | - $hours = (int)(($x-$days*86400)/3600); |
|
422 | - $minutes = (int)(($x-$days*86400-$hours*3600)/60); |
|
423 | - $seconds = (int)($x % 60); |
|
421 | + $hours = (int)(($x - $days*86400)/3600); |
|
422 | + $minutes = (int)(($x - $days*86400 - $hours*3600)/60); |
|
423 | + $seconds = (int)($x%60); |
|
424 | 424 | |
425 | 425 | $datestring = ""; |
426 | 426 | if ($days) { |
427 | 427 | $datestring .= "$days ".tra("days")." "; |
428 | 428 | } |
429 | - if ($res>0 && ($hours || strlen($datestring))) { |
|
429 | + if ($res > 0 && ($hours || strlen($datestring))) { |
|
430 | 430 | $datestring .= "$hours ".tra("hours")." "; |
431 | 431 | } |
432 | - if ($res>1 && ($minutes || strlen($datestring))) { |
|
432 | + if ($res > 1 && ($minutes || strlen($datestring))) { |
|
433 | 433 | $datestring .= "$minutes ".tra("min")." "; |
434 | 434 | } |
435 | - if ($res>2 && ($seconds)) { |
|
435 | + if ($res > 2 && ($seconds)) { |
|
436 | 436 | $datestring .= "$seconds ".tra("sec")." "; |
437 | 437 | } |
438 | 438 | |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | |
448 | 448 | function time_str($x) { |
449 | 449 | if ($x == 0) return "---"; |
450 | - return gmdate('j M Y, G:i:s', $x) . " UTC"; |
|
450 | + return gmdate('j M Y, G:i:s', $x)." UTC"; |
|
451 | 451 | } |
452 | 452 | |
453 | 453 | function local_time_str($x) { |
@@ -459,14 +459,14 @@ discard block |
||
459 | 459 | return time_str($x); |
460 | 460 | } |
461 | 461 | |
462 | -function start_table_str($class="", $style="") { |
|
463 | - $s = $style?'style="'.$style.'"':''; |
|
462 | +function start_table_str($class = "", $style = "") { |
|
463 | + $s = $style ? 'style="'.$style.'"' : ''; |
|
464 | 464 | return '<div class="table"> |
465 | 465 | <table '.$s.' width="100%" class="table table-condensed '.$class.'" > |
466 | 466 | '; |
467 | 467 | } |
468 | 468 | |
469 | -function start_table($class="", $style="") { |
|
469 | +function start_table($class = "", $style = "") { |
|
470 | 470 | echo start_table_str($class, $style); |
471 | 471 | } |
472 | 472 | |
@@ -511,7 +511,7 @@ discard block |
||
511 | 511 | echo "</tr>\n"; |
512 | 512 | } |
513 | 513 | |
514 | -function row1($x, $ncols=2, $class="heading") { |
|
514 | +function row1($x, $ncols = 2, $class = "heading") { |
|
515 | 515 | if ($class == "heading") { |
516 | 516 | echo "<tr><th class=\"bg-primary\" colspan=\"$ncols\">$x</th></tr>\n"; |
517 | 517 | } else { |
@@ -523,10 +523,10 @@ discard block |
||
523 | 523 | define('VALUE_ATTRS', 'style="padding-left:12px"'); |
524 | 524 | define('VALUE_ATTRS_ERR', 'class="danger" style="padding-left:12px"'); |
525 | 525 | |
526 | -function row2($x, $y, $show_error=false, $lwidth='40%') { |
|
527 | - if ($x==="") $x="<br>"; |
|
528 | - if ($y==="") $y="<br>"; |
|
529 | - $attrs = $show_error?VALUE_ATTRS_ERR:VALUE_ATTRS; |
|
526 | +function row2($x, $y, $show_error = false, $lwidth = '40%') { |
|
527 | + if ($x === "") $x = "<br>"; |
|
528 | + if ($y === "") $y = "<br>"; |
|
529 | + $attrs = $show_error ?VALUE_ATTRS_ERR:VALUE_ATTRS; |
|
530 | 530 | echo "<tr> |
531 | 531 | <td width=\"$lwidth\" ".NAME_ATTRS.">$x</td> |
532 | 532 | <td $attrs >$y</td> |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | "; |
535 | 535 | } |
536 | 536 | |
537 | -function row2_init($x, $y, $lwidth='40%') { |
|
537 | +function row2_init($x, $y, $lwidth = '40%') { |
|
538 | 538 | echo '<tr> |
539 | 539 | <td class="text-right " width="'.$lwidth.'" style="padding-right: 20px;">'.$x.'</td> |
540 | 540 | <td '.VALUE_ATTRS.'>'.$y.' |
@@ -557,20 +557,20 @@ discard block |
||
557 | 557 | echo "</tr>\n"; |
558 | 558 | } |
559 | 559 | |
560 | -define ('ALIGN_RIGHT', 'style="text-align:right;"'); |
|
560 | +define('ALIGN_RIGHT', 'style="text-align:right;"'); |
|
561 | 561 | |
562 | -function row_heading_array($x, $attrs=null, $class='bg-primary') { |
|
562 | +function row_heading_array($x, $attrs = null, $class = 'bg-primary') { |
|
563 | 563 | echo "<tr>"; |
564 | 564 | $i = 0; |
565 | 565 | foreach ($x as $h) { |
566 | - $a = $attrs?$attrs[$i]:""; |
|
566 | + $a = $attrs ? $attrs[$i] : ""; |
|
567 | 567 | echo "<th $a class=\"$class\">$h</th>"; |
568 | 568 | $i++; |
569 | 569 | } |
570 | 570 | echo "</tr>\n"; |
571 | 571 | } |
572 | 572 | |
573 | -function row_heading($x, $class='bg-primary') { |
|
573 | +function row_heading($x, $class = 'bg-primary') { |
|
574 | 574 | echo sprintf('<tr><th class="%s" colspan=99>%s</th></tr> |
575 | 575 | ', $class, $x |
576 | 576 | ); |
@@ -630,7 +630,7 @@ discard block |
||
630 | 630 | // If $ellipsis is true, then an ellipsis is added to any sentence which |
631 | 631 | // is cut short. |
632 | 632 | |
633 | -function sub_sentence($sentence, $delimiter, $max_chars, $ellipsis=false) { |
|
633 | +function sub_sentence($sentence, $delimiter, $max_chars, $ellipsis = false) { |
|
634 | 634 | $words = explode($delimiter, $sentence); |
635 | 635 | $total_chars = 0; |
636 | 636 | $trunc = false; |
@@ -713,8 +713,8 @@ discard block |
||
713 | 713 | |
714 | 714 | // returns null if the arg is optional and missing |
715 | 715 | // |
716 | -function get_int($name, $optional=false) { |
|
717 | - $x=null; |
|
716 | +function get_int($name, $optional = false) { |
|
717 | + $x = null; |
|
718 | 718 | if (isset($_GET[$name])) $x = $_GET[$name]; |
719 | 719 | if (!is_numeric($x)) { |
720 | 720 | if ($optional) { |
@@ -733,7 +733,7 @@ discard block |
||
733 | 733 | |
734 | 734 | // returns null if the arg is optional and missing |
735 | 735 | // |
736 | -function post_num($name, $optional=false) { |
|
736 | +function post_num($name, $optional = false) { |
|
737 | 737 | $x = null; |
738 | 738 | if (isset($_POST[$name])) $x = $_POST[$name]; |
739 | 739 | if (!is_numeric($x)) { |
@@ -748,7 +748,7 @@ discard block |
||
748 | 748 | |
749 | 749 | // returns null if the arg is optional and missing |
750 | 750 | // |
751 | -function post_int($name, $optional=false) { |
|
751 | +function post_int($name, $optional = false) { |
|
752 | 752 | $x = post_num($name, $optional); |
753 | 753 | if (is_null($x)) return null; |
754 | 754 | $y = (int)$x; |
@@ -766,7 +766,7 @@ discard block |
||
766 | 766 | } |
767 | 767 | } |
768 | 768 | |
769 | -function get_str($name, $optional=false) { |
|
769 | +function get_str($name, $optional = false) { |
|
770 | 770 | if (isset($_GET[$name])) { |
771 | 771 | $x = $_GET[$name]; |
772 | 772 | } else { |
@@ -778,7 +778,7 @@ discard block |
||
778 | 778 | return undo_magic_quotes($x); |
779 | 779 | } |
780 | 780 | |
781 | -function post_str($name, $optional=false) { |
|
781 | +function post_str($name, $optional = false) { |
|
782 | 782 | if (isset($_POST[$name])) { |
783 | 783 | $x = $_POST[$name]; |
784 | 784 | } else { |
@@ -790,7 +790,7 @@ discard block |
||
790 | 790 | return undo_magic_quotes($x); |
791 | 791 | } |
792 | 792 | |
793 | -function post_arr($name, $optional=false) { |
|
793 | +function post_arr($name, $optional = false) { |
|
794 | 794 | if (isset($_POST[$name]) && is_array($_POST[$name])) { |
795 | 795 | $x = $_POST[$name]; |
796 | 796 | } else { |
@@ -806,7 +806,7 @@ discard block |
||
806 | 806 | // the mb_* functions are not included by default |
807 | 807 | // return (mb_detect_encoding($passwd) -= 'ASCII'); |
808 | 808 | |
809 | - for ($i=0; $i<strlen($str); $i++) { |
|
809 | + for ($i = 0; $i < strlen($str); $i++) { |
|
810 | 810 | $c = ord(substr($str, $i)); |
811 | 811 | if ($c < 32 || $c > 127) return false; |
812 | 812 | } |
@@ -830,7 +830,7 @@ discard block |
||
830 | 830 | $number = str_replace(',', '.', $number); // replace the german decimal separator |
831 | 831 | // if no value was entered and this is ok |
832 | 832 | // |
833 | - if ($number=='' && !$low) return true; |
|
833 | + if ($number == '' && !$low) return true; |
|
834 | 834 | |
835 | 835 | // the supplied value contains alphabetic characters |
836 | 836 | // |
@@ -847,7 +847,7 @@ discard block |
||
847 | 847 | |
848 | 848 | // Generate a "select" element from an array of values |
849 | 849 | // |
850 | -function select_from_array($name, $array, $selection=null, $width=240) { |
|
850 | +function select_from_array($name, $array, $selection = null, $width = 240) { |
|
851 | 851 | $out = '<select style="color:#000;"class="form-control input-sm" style="width:'.$width.'px" name="'.$name.'">"'; |
852 | 852 | |
853 | 853 | foreach ($array as $key => $value) { |
@@ -872,8 +872,8 @@ discard block |
||
872 | 872 | return $str; |
873 | 873 | } |
874 | 874 | |
875 | -function strip_bbcode($string){ |
|
876 | - return preg_replace("/((\[.+\])+?)(.+?)((\[\/.+\])+?)/","",$string); |
|
875 | +function strip_bbcode($string) { |
|
876 | + return preg_replace("/((\[.+\])+?)(.+?)((\[\/.+\])+?)/", "", $string); |
|
877 | 877 | } |
878 | 878 | |
879 | 879 | function current_url() { |
@@ -901,7 +901,7 @@ discard block |
||
901 | 901 | // @param class The optional CSS class of the button. Defaults to a standard button |
902 | 902 | // |
903 | 903 | |
904 | -function button_text($url, $text, $desc=null, $class="btn-success btn-sm") { |
|
904 | +function button_text($url, $text, $desc = null, $class = "btn-success btn-sm") { |
|
905 | 905 | if (!$desc) { |
906 | 906 | $desc = $text; |
907 | 907 | } |
@@ -910,19 +910,19 @@ discard block |
||
910 | 910 | ); |
911 | 911 | } |
912 | 912 | |
913 | -function show_button($url, $text, $desc=null, $class="btn-success btn-sm") { |
|
913 | +function show_button($url, $text, $desc = null, $class = "btn-success btn-sm") { |
|
914 | 914 | echo button_text($url, $text, $desc, $class); |
915 | 915 | } |
916 | 916 | |
917 | 917 | // for places with a bunch of buttons, like forum posts |
918 | 918 | // |
919 | -function show_button_small($url, $text, $desc=null) { |
|
919 | +function show_button_small($url, $text, $desc = null) { |
|
920 | 920 | echo button_text($url, $text, $desc, "btn-primary btn-xs"); |
921 | 921 | } |
922 | 922 | |
923 | 923 | // used for showing icons |
924 | 924 | // |
925 | -function show_image($src, $title, $alt, $height=null) { |
|
925 | +function show_image($src, $title, $alt, $height = null) { |
|
926 | 926 | $h = ""; |
927 | 927 | if ($height) { |
928 | 928 | $h = "height=\"$height\""; |
@@ -959,7 +959,7 @@ discard block |
||
959 | 959 | // tries instead to connect to <replica_db_host> if tag exists. |
960 | 960 | // DEPRECATED - use boinc_db.inc |
961 | 961 | // |
962 | -function db_init($try_replica=false) { |
|
962 | +function db_init($try_replica = false) { |
|
963 | 963 | check_web_stopped(); |
964 | 964 | $retval = db_init_aux($try_replica); |
965 | 965 | if ($retval == 1) { |
@@ -1030,7 +1030,7 @@ discard block |
||
1030 | 1030 | function sanitize_numeric($x) { |
1031 | 1031 | if (is_numeric($x)) { |
1032 | 1032 | return $x; |
1033 | - } else if (trim($x) == '' ) { |
|
1033 | + } else if (trim($x) == '') { |
|
1034 | 1034 | return ''; |
1035 | 1035 | } else { |
1036 | 1036 | return "not numeric"; |
@@ -1053,9 +1053,9 @@ discard block |
||
1053 | 1053 | return $c/(200/24); |
1054 | 1054 | } |
1055 | 1055 | |
1056 | -function do_download($path,$name="") { |
|
1057 | - if (strcmp($name,"") == 0) { |
|
1058 | - $name=basename($path); |
|
1056 | +function do_download($path, $name = "") { |
|
1057 | + if (strcmp($name, "") == 0) { |
|
1058 | + $name = basename($path); |
|
1059 | 1059 | } |
1060 | 1060 | header('Content-Description: File Transfer'); |
1061 | 1061 | header('Content-Type: application/octet-stream'); |
@@ -1064,7 +1064,7 @@ discard block |
||
1064 | 1064 | header('Expires: 0'); |
1065 | 1065 | header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); |
1066 | 1066 | header('Pragma: public'); |
1067 | - header('Content-Length: ' . filesize($path)); |
|
1067 | + header('Content-Length: '.filesize($path)); |
|
1068 | 1068 | flush(); |
1069 | 1069 | readfile($path); |
1070 | 1070 | } |
@@ -1113,10 +1113,10 @@ discard block |
||
1113 | 1113 | // Otherwise return 0. |
1114 | 1114 | // Format of user agent string is "BOINC client (windows_x86_64 7.3.17)" |
1115 | 1115 | // |
1116 | -function boinc_client_version(){ |
|
1116 | +function boinc_client_version() { |
|
1117 | 1117 | if (!array_key_exists('HTTP_USER_AGENT', $_SERVER)) return 0; |
1118 | 1118 | $x = $_SERVER['HTTP_USER_AGENT']; |
1119 | - $e = "/BOINC client [^ ]* (\d+).(\d+).(\d+)\)/"; |
|
1119 | + $e = "/BOINC client [^ ]* (\d+).(\d+).(\d+)\)/"; |
|
1120 | 1120 | if (preg_match($e, $x, $matches)) { |
1121 | 1121 | return $matches[1]*10000 + $matches[2]*100 + $matches[3]; |
1122 | 1122 | } |
@@ -1145,7 +1145,7 @@ discard block |
||
1145 | 1145 | $rem_name = $name."_remaining"; |
1146 | 1146 | return "<textarea name=\"$name\" class=\"form-control\" rows=3 id=\"$name\" onkeydown=\"text_counter(this.form.$name, this.form.$rem_name, $maxlen);\" |
1147 | 1147 | onkeyup=\"text_counter(this.form.$name, this.form.$rem_name, $maxlen);\">".$text."</textarea> |
1148 | - <br><input name=\"$rem_name\" type=\"text\" id=\"$rem_name\" value=\"".($maxlen-strlen($text))."\" size=\"3\" maxlength=\"3\" readonly> ".tra("characters remaining") |
|
1148 | + <br><input name=\"$rem_name\" type=\"text\" id=\"$rem_name\" value=\"".($maxlen - strlen($text))."\" size=\"3\" maxlength=\"3\" readonly> ".tra("characters remaining") |
|
1149 | 1149 | ; |
1150 | 1150 | } |
1151 | 1151 | |
@@ -1175,7 +1175,7 @@ discard block |
||
1175 | 1175 | // use the following around text with long lines, |
1176 | 1176 | // to limit the width and make it more readable. |
1177 | 1177 | // |
1178 | -function text_start($width=640) { |
|
1178 | +function text_start($width = 640) { |
|
1179 | 1179 | echo sprintf("<div style=\"max-width: %dpx;\">\n", $width); |
1180 | 1180 | } |
1181 | 1181 | function text_end() { |
@@ -1192,7 +1192,7 @@ discard block |
||
1192 | 1192 | } |
1193 | 1193 | |
1194 | 1194 | function cert_filename() { |
1195 | - return defined("CERT_FILENAME")?CERT_FILENAME:"cert1.php"; |
|
1195 | + return defined("CERT_FILENAME") ?CERT_FILENAME:"cert1.php"; |
|
1196 | 1196 | } |
1197 | 1197 | |
1198 | 1198 | // if user hasn't validated their email addr, tell them to |
@@ -1209,6 +1209,6 @@ discard block |
||
1209 | 1209 | } |
1210 | 1210 | } |
1211 | 1211 | |
1212 | -$cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit |
|
1212 | +$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit |
|
1213 | 1213 | |
1214 | 1214 | ?> |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | $avg = round($app->info->avg, 2); |
181 | 181 | $min = round($app->info->min, 2); |
182 | 182 | $max = round($app->info->max, 2); |
183 | - $x = $max?"$avg ($min - $max)":"---"; |
|
183 | + $x = $max ? "$avg ($min - $max)" : "---"; |
|
184 | 184 | $u = $app->info->users; |
185 | 185 | } else { |
186 | 186 | $x = '---'; |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | $cmd = trim($cmd); |
274 | 274 | $x = explode(" ", $cmd); |
275 | 275 | $prog = $x[0]; |
276 | - $pidname = $prog . '.pid'; |
|
276 | + $pidname = $prog.'.pid'; |
|
277 | 277 | } |
278 | 278 | $path = "../../pid_$host/$pidname"; |
279 | 279 | if (is_file($path)) { |
@@ -314,12 +314,12 @@ discard block |
||
314 | 314 | } |
315 | 315 | $master_host = $u["host"]; |
316 | 316 | if ($config->www_host) { |
317 | - $web_host = trim((string) $config->www_host); |
|
317 | + $web_host = trim((string)$config->www_host); |
|
318 | 318 | } else { |
319 | 319 | $web_host = $main_host; |
320 | 320 | } |
321 | 321 | if ($config->sched_host) { |
322 | - $sched_host = trim((string) $config->sched_host); |
|
322 | + $sched_host = trim((string)$config->sched_host); |
|
323 | 323 | } else { |
324 | 324 | $sched_host = $main_host; |
325 | 325 | } |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | |
330 | 330 | // the upload and download servers are sort of daemons too |
331 | 331 | // |
332 | - $url = trim((string) $config->download_url); |
|
332 | + $url = trim((string)$config->download_url); |
|
333 | 333 | $u = parse_url($url); |
334 | 334 | $h = $u["host"]; |
335 | 335 | if ($h == $master_host) { |
@@ -341,14 +341,14 @@ discard block |
||
341 | 341 | } else { |
342 | 342 | $have_remote = true; |
343 | 343 | } |
344 | - $url = trim((string) $config->upload_url); |
|
344 | + $url = trim((string)$config->upload_url); |
|
345 | 345 | $u = parse_url($url); |
346 | 346 | $h = $u["host"]; |
347 | 347 | if ($h == $master_host) { |
348 | 348 | $y = new StdClass; |
349 | 349 | $y->cmd = "Upload server"; |
350 | 350 | $y->host = $h; |
351 | - $y->status = !file_exists("../../stop_upload");; |
|
351 | + $y->status = !file_exists("../../stop_upload"); ; |
|
352 | 352 | $local_daemons[] = $y; |
353 | 353 | } else { |
354 | 354 | $have_remote = true; |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | $y = new StdClass; |
361 | 361 | $y->cmd = "Scheduler"; |
362 | 362 | $y->host = $sched_host; |
363 | - $y->status = !file_exists("../../stop_sched");; |
|
363 | + $y->status = !file_exists("../../stop_sched"); ; |
|
364 | 364 | $local_daemons[] = $y; |
365 | 365 | } else { |
366 | 366 | $have_remote = true; |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | $disabled_daemons[] = $x; |
377 | 377 | continue; |
378 | 378 | } |
379 | - $host = $d->host?(string)$d->host:$main_host; |
|
379 | + $host = $d->host ? (string)$d->host : $main_host; |
|
380 | 380 | if ($host != $web_host) { |
381 | 381 | $have_remote = true; |
382 | 382 | continue; |
@@ -56,10 +56,10 @@ discard block |
||
56 | 56 | $preview = post_str("preview", true); |
57 | 57 | $warning = null; |
58 | 58 | |
59 | -if ($content && $title && (!$preview)){ |
|
60 | - if (post_str('add_signature', true) == "add_it"){ |
|
61 | - $add_signature = true; // set a flag and concatenate later |
|
62 | - } else { |
|
59 | +if ($content && $title && (!$preview)) { |
|
60 | + if (post_str('add_signature', true) == "add_it") { |
|
61 | + $add_signature = true; // set a flag and concatenate later |
|
62 | + } else { |
|
63 | 63 | $add_signature = false; |
64 | 64 | } |
65 | 65 | check_tokens($logged_in_user->authenticator); |
@@ -71,14 +71,14 @@ discard block |
||
71 | 71 | $title, $content, $logged_in_user, $forum, $add_signature, $export |
72 | 72 | ); |
73 | 73 | if ($thread) { |
74 | - header('Location: forum_thread.php?id=' . $thread->id); |
|
74 | + header('Location: forum_thread.php?id='.$thread->id); |
|
75 | 75 | } else { |
76 | 76 | error_page("Can't create thread. $forum_error"); |
77 | 77 | } |
78 | 78 | } |
79 | 79 | } |
80 | 80 | |
81 | -page_head(tra("Create new thread"),'','','', $bbcode_js); |
|
81 | +page_head(tra("Create new thread"), '', '', '', $bbcode_js); |
|
82 | 82 | show_forum_header($logged_in_user); |
83 | 83 | |
84 | 84 | if ($warning) { |
@@ -119,12 +119,12 @@ discard block |
||
119 | 119 | $submit_help = "<br /><font color=\"red\">".tra("Remember to add a title")."</font>"; |
120 | 120 | } |
121 | 121 | |
122 | -if ($force_title && $title){ |
|
122 | +if ($force_title && $title) { |
|
123 | 123 | row2(tra("Title"), htmlspecialchars($title)."<input type=\"hidden\" name=\"title\" value=\"".htmlspecialchars($title)."\">"); |
124 | 124 | } else { |
125 | 125 | row2(tra("Title").$submit_help, |
126 | 126 | sprintf('<input type="text" class="form-control" name="title" value="%s">', |
127 | - $title?htmlspecialchars($title):'' |
|
127 | + $title ?htmlspecialchars($title) : '' |
|
128 | 128 | ) |
129 | 129 | ); |
130 | 130 | } |
@@ -134,14 +134,14 @@ discard block |
||
134 | 134 | echo $bbcode_html; |
135 | 135 | end_table(); |
136 | 136 | echo sprintf('<textarea class="form-control" name="content" rows="12" cols="80">%s</textarea>', |
137 | - $content?htmlspecialchars($content):'' |
|
137 | + $content ?htmlspecialchars($content) : '' |
|
138 | 138 | ); |
139 | 139 | echo "</td></tr>"; |
140 | 140 | |
141 | 141 | if (!$logged_in_user->prefs->no_signature_by_default) { |
142 | - $enable_signature="checked=\"true\""; |
|
142 | + $enable_signature = "checked=\"true\""; |
|
143 | 143 | } else { |
144 | - $enable_signature=""; |
|
144 | + $enable_signature = ""; |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | if (is_news_forum($forum)) { |
@@ -157,5 +157,5 @@ discard block |
||
157 | 157 | |
158 | 158 | page_tail(); |
159 | 159 | |
160 | -$cvs_version_tracker[]="\$Id$"; |
|
160 | +$cvs_version_tracker[] = "\$Id$"; |
|
161 | 161 | ?> |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | new NUM_SPEC(tra("% of the CPUs"), 1, 100, 100) |
109 | 109 | ), |
110 | 110 | new PREF_NUM( |
111 | - tra("Use at most") ."<br><font size=-2>Requires BOINC 7.20.3+</font>", |
|
111 | + tra("Use at most")."<br><font size=-2>Requires BOINC 7.20.3+</font>", |
|
112 | 112 | // xgettext:no-php-format |
113 | 113 | tra("Suspend/resume computing every few seconds to reduce CPU temperature and energy usage. Example: 75% means compute for 3 seconds, wait for 1 second, and repeat."), |
114 | 114 | "niu_cpu_usage_limit", |
@@ -295,9 +295,9 @@ discard block |
||
295 | 295 | $dp->disk_max_used_pct = parse_config($config, "<default_disk_max_used_pct>"); |
296 | 296 | $dp->disk_min_free_gb = parse_config($config, "<default_disk_min_free_gb>"); |
297 | 297 | // set some defaults if not found |
298 | - if (!$dp->disk_max_used_gb) $dp->disk_max_used_gb = 0; // no limit |
|
298 | + if (!$dp->disk_max_used_gb) $dp->disk_max_used_gb = 0; // no limit |
|
299 | 299 | if (!$dp->disk_max_used_pct) $dp->disk_max_used_pct = 90; // 90 percent |
300 | - if (!$dp->disk_min_free_gb) $dp->disk_min_free_gb = 1; // 1 GB |
|
300 | + if (!$dp->disk_min_free_gb) $dp->disk_min_free_gb = 1; // 1 GB |
|
301 | 301 | // set mininimum free space scheduler allows |
302 | 302 | // - depends on which scheduler is running |
303 | 303 | $dp->new_sched_flag = 1; |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | global $text; |
324 | 324 | global $venue_name; |
325 | 325 | |
326 | - switch($name) { |
|
326 | + switch ($name) { |
|
327 | 327 | case "venue": |
328 | 328 | if (array_key_exists("name", $attrs)) { |
329 | 329 | $venue_name = $attrs["name"]; |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | return; |
374 | 374 | } |
375 | 375 | } |
376 | - switch($name) { |
|
376 | + switch ($name) { |
|
377 | 377 | case "venue": |
378 | 378 | $top_parse_result->$venue_name = $parse_result; |
379 | 379 | $parse_result = $top_parse_result; |
@@ -533,7 +533,7 @@ discard block |
||
533 | 533 | } |
534 | 534 | } |
535 | 535 | |
536 | -function print_prefs_display_global($user, $columns=false) { |
|
536 | +function print_prefs_display_global($user, $columns = false) { |
|
537 | 537 | $global_prefs = prefs_parse_global($user->global_prefs); |
538 | 538 | |
539 | 539 | echo tra("These settings apply to all computers using this account except") |
@@ -543,7 +543,7 @@ discard block |
||
543 | 543 | .tra("Android devices") |
544 | 544 | ."</ul> |
545 | 545 | "; |
546 | - $switch_link = " <font size=\"-1\"><a href=prefs.php?subset=global&cols=". (int)!$columns .">".tra("(Switch view)")."</a></font>"; |
|
546 | + $switch_link = " <font size=\"-1\"><a href=prefs.php?subset=global&cols=".(int)!$columns.">".tra("(Switch view)")."</a></font>"; |
|
547 | 547 | if ($columns) { |
548 | 548 | echo "<h3>".tra("Combined preferences").$switch_link."</h3>"; |
549 | 549 | start_table(); |
@@ -580,9 +580,9 @@ discard block |
||
580 | 580 | // otherwise false |
581 | 581 | // |
582 | 582 | function print_prefs_form( |
583 | - $action, $subset, $venue, $user, $prefs, $cols, $error=false, |
|
584 | - $project_error=false |
|
585 | -){ |
|
583 | + $action, $subset, $venue, $user, $prefs, $cols, $error = false, |
|
584 | + $project_error = false |
|
585 | +) { |
|
586 | 586 | if ($action == "add") { |
587 | 587 | $script = "add_venue.php"; |
588 | 588 | $submit_value = tra("Add preferences"); |
@@ -622,7 +622,7 @@ discard block |
||
622 | 622 | // |
623 | 623 | // Functions to display preference subsets as forms |
624 | 624 | // |
625 | -function prefs_form_global($user, $prefs, $error=false) { |
|
625 | +function prefs_form_global($user, $prefs, $error = false) { |
|
626 | 626 | global $in_use_prefs; |
627 | 627 | global $not_in_use_prefs; |
628 | 628 | global $job_prefs; |
@@ -659,9 +659,9 @@ discard block |
||
659 | 659 | // |
660 | 660 | function prefs_form_radio_buttons($name, $yesno) { |
661 | 661 | $rb = tra("yes")." <input type=radio name=$name value=yes " |
662 | - .($yesno?"checked":"") |
|
662 | + .($yesno ? "checked" : "") |
|
663 | 663 | ."> ".tra("no")." <input type=radio name=$name value=no " |
664 | - .($yesno?"":"checked") |
|
664 | + .($yesno ? "" : "checked") |
|
665 | 665 | .">\n"; |
666 | 666 | return $rb; |
667 | 667 | } |
@@ -680,12 +680,12 @@ discard block |
||
680 | 680 | } |
681 | 681 | function venue_show($user) { |
682 | 682 | $venue = $user->venue; |
683 | - if ($venue =='') $venue = '---'; |
|
683 | + if ($venue == '') $venue = '---'; |
|
684 | 684 | tooltip_row2(VENUE_TOOLTIP, VENUE_DESC, $venue); |
685 | 685 | } |
686 | 686 | |
687 | 687 | function venue_form($user) { |
688 | - $n=$h=$w=$s=$m=''; |
|
688 | + $n = $h = $w = $s = $m = ''; |
|
689 | 689 | if ($user->venue == '') $n = 'selected'; |
690 | 690 | if ($user->venue == 'home') $h = 'selected'; |
691 | 691 | if ($user->venue == 'work') $w = 'selected'; |
@@ -743,7 +743,7 @@ discard block |
||
743 | 743 | // |
744 | 744 | // convert prefs from structure to XML |
745 | 745 | // |
746 | -function global_prefs_make_xml($prefs, $primary=true) { |
|
746 | +function global_prefs_make_xml($prefs, $primary = true) { |
|
747 | 747 | global $in_use_prefs; |
748 | 748 | global $not_in_use_prefs; |
749 | 749 | global $job_prefs; |