@@ -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; |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | // output a panel. |
| 216 | 216 | // $content_func is a function that generates the panel contents |
| 217 | 217 | // |
| 218 | -function panel($title, $content_func, $class="panel-primary", $body_class="") { |
|
| 218 | +function panel($title, $content_func, $class = "panel-primary", $body_class = "") { |
|
| 219 | 219 | echo sprintf('<div class="panel %s"> |
| 220 | 220 | ', $class |
| 221 | 221 | ); |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | // $left_width is the width of left column in 1/12 units. |
| 243 | 243 | // $arg is passed to the functions. |
| 244 | 244 | // |
| 245 | -function grid($top_func, $left_func, $right_func, $left_width=6, $arg=null) { |
|
| 245 | +function grid($top_func, $left_func, $right_func, $left_width = 6, $arg = null) { |
|
| 246 | 246 | echo ' |
| 247 | 247 | <div class="container-fluid"> |
| 248 | 248 | '; |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | </div> |
| 258 | 258 | '; |
| 259 | 259 | } |
| 260 | - $right_width = 12-$left_width; |
|
| 260 | + $right_width = 12 - $left_width; |
|
| 261 | 261 | echo ' |
| 262 | 262 | <div class="row"> |
| 263 | 263 | <div class="col-sm-'.$left_width.'"> |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | // use extra = "name=x" |
| 282 | 282 | // call forum_focus(x, foo) after defining the field |
| 283 | 283 | // |
| 284 | -function form_start($action, $method='get', $extra='') { |
|
| 284 | +function form_start($action, $method = 'get', $extra = '') { |
|
| 285 | 285 | echo sprintf( |
| 286 | 286 | '<div class="container-fluid"> |
| 287 | 287 | <form class="form-horizontal" method="%s" action="%s" %s>' |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | // just the input field |
| 314 | 314 | // |
| 315 | 315 | function form_input_text_field( |
| 316 | - $name, $value='', $type='text', $attrs='', $extra='' |
|
| 316 | + $name, $value = '', $type = 'text', $attrs = '', $extra = '' |
|
| 317 | 317 | ) { |
| 318 | 318 | return sprintf( |
| 319 | 319 | '<input %s type="%s" class="form-control" name="%s" value="%s">%s', |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | // the whole row |
| 325 | 325 | // |
| 326 | 326 | function form_input_text( |
| 327 | - $label, $name, $value='', $type='text', $attrs='', $extra='' |
|
| 327 | + $label, $name, $value = '', $type = 'text', $attrs = '', $extra = '' |
|
| 328 | 328 | ) { |
| 329 | 329 | echo sprintf(' |
| 330 | 330 | <div class="form-group"> |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | ); |
| 353 | 353 | } |
| 354 | 354 | |
| 355 | -function form_input_textarea($label, $name, $value='', $nrows=4) { |
|
| 355 | +function form_input_textarea($label, $name, $value = '', $nrows = 4) { |
|
| 356 | 356 | echo sprintf(' |
| 357 | 357 | <div class="form-group"> |
| 358 | 358 | <label align=right class="%s" for="%s">%s</label> |
@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | |
| 369 | 369 | // $items is either a string of <option> elements, or an array |
| 370 | 370 | // |
| 371 | -function form_select($label, $name, $items, $selected=null) { |
|
| 371 | +function form_select($label, $name, $items, $selected = null) { |
|
| 372 | 372 | echo sprintf(' |
| 373 | 373 | <div class="form-group"> |
| 374 | 374 | <label align=right class="%s" for="%s">%s</label> |
@@ -381,7 +381,7 @@ discard block |
||
| 381 | 381 | foreach ($items as $i) { |
| 382 | 382 | echo sprintf( |
| 383 | 383 | '<option %s value=%s>%s</option>', |
| 384 | - ($i[0]==$selected)?'selected':'', |
|
| 384 | + ($i[0] == $selected) ? 'selected' : '', |
|
| 385 | 385 | $i[0], $i[1] |
| 386 | 386 | ); |
| 387 | 387 | } |
@@ -394,7 +394,7 @@ discard block |
||
| 394 | 394 | // same, for multiple select. |
| 395 | 395 | // $selected, if non-null, is a list of selected values |
| 396 | 396 | // |
| 397 | -function form_select_multiple($label, $name, $items, $selected=null) { |
|
| 397 | +function form_select_multiple($label, $name, $items, $selected = null) { |
|
| 398 | 398 | echo sprintf(' |
| 399 | 399 | <div class="form-group"> |
| 400 | 400 | <label align=right class="%s" for="%s">%s</label> |
@@ -406,7 +406,7 @@ discard block |
||
| 406 | 406 | foreach ($items as $i) { |
| 407 | 407 | echo sprintf( |
| 408 | 408 | '<option %s value=%s>%s</option>', |
| 409 | - ($selected && in_array($i[0], $selected))?'selected':'', |
|
| 409 | + ($selected && in_array($i[0], $selected)) ? 'selected' : '', |
|
| 410 | 410 | $i[0], $i[1] |
| 411 | 411 | ); |
| 412 | 412 | } |
@@ -415,12 +415,12 @@ discard block |
||
| 415 | 415 | |
| 416 | 416 | // return a list of string for checkbox items |
| 417 | 417 | // |
| 418 | -function checkbox_item_strings($items, $attrs='') { |
|
| 418 | +function checkbox_item_strings($items, $attrs = '') { |
|
| 419 | 419 | $x = []; |
| 420 | 420 | foreach ($items as $i) { |
| 421 | 421 | $x[] = sprintf('<input %s type="checkbox" name="%s" %s> %s |
| 422 | 422 | ', |
| 423 | - $attrs, $i[0], $i[2]?"checked":"", $i[1] |
|
| 423 | + $attrs, $i[0], $i[2] ? "checked" : "", $i[1] |
|
| 424 | 424 | ); |
| 425 | 425 | } |
| 426 | 426 | return $x; |
@@ -428,7 +428,7 @@ discard block |
||
| 428 | 428 | |
| 429 | 429 | // $items is list of (name, label, checked) |
| 430 | 430 | // |
| 431 | -function form_checkboxes($label, $items, $attrs='') { |
|
| 431 | +function form_checkboxes($label, $items, $attrs = '') { |
|
| 432 | 432 | echo sprintf(' |
| 433 | 433 | <div class="form-group"> |
| 434 | 434 | <label align=right class="%s">%s</label> |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | FORM_LEFT_CLASS, $label, FORM_RIGHT_CLASS |
| 455 | 455 | ); |
| 456 | 456 | foreach ($items as $i) { |
| 457 | - $checked = ($selected == $i[0])?"checked":""; |
|
| 457 | + $checked = ($selected == $i[0]) ? "checked" : ""; |
|
| 458 | 458 | echo sprintf('<input type="radio" name="%s" value="%s" %s> %s <br> |
| 459 | 459 | ', |
| 460 | 460 | $name, $i[0], $checked, $i[1] |
@@ -487,7 +487,7 @@ discard block |
||
| 487 | 487 | '; |
| 488 | 488 | } |
| 489 | 489 | |
| 490 | -function form_submit($text, $attrs='') { |
|
| 490 | +function form_submit($text, $attrs = '') { |
|
| 491 | 491 | form_general( |
| 492 | 492 | "", |
| 493 | 493 | sprintf( |
@@ -497,7 +497,7 @@ discard block |
||
| 497 | 497 | ); |
| 498 | 498 | } |
| 499 | 499 | |
| 500 | -function form_checkbox($label, $name, $checked=false) { |
|
| 500 | +function form_checkbox($label, $name, $checked = false) { |
|
| 501 | 501 | echo sprintf(' |
| 502 | 502 | <div class="form-group"> |
| 503 | 503 | <label align=right class="%s">%s</label> |
@@ -508,6 +508,6 @@ discard block |
||
| 508 | 508 | echo sprintf(' |
| 509 | 509 | <input type="checkbox" name="%s" %s> |
| 510 | 510 | </div> |
| 511 | - ', $name, $checked?"checked":"" |
|
| 511 | + ', $name, $checked ? "checked" : "" |
|
| 512 | 512 | ); |
| 513 | 513 | } |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | if (!is_valid_filename($app)) die('bad arg'); |
| 93 | 93 | $variant = get_str('variant'); |
| 94 | 94 | if (!is_valid_filename($variant)) die('bad arg'); |
| 95 | - page_head("App $app variant $variant"); |
|
| 95 | + page_head("app $app variant $variant"); |
|
| 96 | 96 | $dir = "$buda_root/$app/$variant"; |
| 97 | 97 | start_table(); |
| 98 | 98 | table_header('name', 'size', 'md5'); |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | form_input_hidden('app', $app); |
| 137 | 137 | form_input_hidden('action', 'variant_action'); |
| 138 | 138 | form_input_text('Plan class', 'variant'); |
| 139 | - form_select("Dockerfile$sb", 'dockerfile', $sbitems); |
|
| 139 | + form_select("dockerfile$sb", 'dockerfile', $sbitems); |
|
| 140 | 140 | form_select_multiple("Application files$sb", 'app_files', $sbitems); |
| 141 | 141 | form_input_text( |
| 142 | 142 | 'Input file names<br><small>Space-separated</small>', |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | // Note: we don't currently allow indirect file access. |
| 223 | 223 | // If we did, we'd need to create job.toml to mount project dir |
| 224 | 224 | |
| 225 | - app_list("Variant $variant added for app $app."); |
|
| 225 | + app_list("variant $variant added for app $app."); |
|
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | function variant_delete() { |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | if ($ret) { |
| 250 | 250 | error_page("delete failed"); |
| 251 | 251 | } |
| 252 | - $notice = "Variant $variant of app $app removed."; |
|
| 252 | + $notice = "variant $variant of app $app removed."; |
|
| 253 | 253 | app_list($notice); |
| 254 | 254 | } else { |
| 255 | 255 | page_head("Confirm"); |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | if ($ret) { |
| 279 | 279 | error_page('delete failed'); |
| 280 | 280 | } |
| 281 | - $notice = "App $app removed."; |
|
| 281 | + $notice = "app $app removed."; |
|
| 282 | 282 | app_list($notice); |
| 283 | 283 | } else { |
| 284 | 284 | page_head('Confirm'); |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | if (!is_valid_filename($name)) die("bad arg: $name"); |
| 308 | 308 | $dir = "$buda_root/$name"; |
| 309 | 309 | if (file_exists($dir)) { |
| 310 | - error_page("App $name already exists."); |
|
| 310 | + error_page("app $name already exists."); |
|
| 311 | 311 | } |
| 312 | 312 | mkdir($dir); |
| 313 | 313 | header("Location: buda.php"); |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | // show list of BUDA apps and variants, |
| 33 | 33 | // w/ buttons for adding and deleting |
| 34 | 34 | // |
| 35 | -function app_list($notice=null) { |
|
| 35 | +function app_list($notice = null) { |
|
| 36 | 36 | global $buda_root; |
| 37 | 37 | if (!is_dir($buda_root)) { |
| 38 | 38 | mkdir($buda_root); |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | $dir = "$buda_root/$app/$variant"; |
| 97 | 97 | start_table(); |
| 98 | 98 | table_header('name', 'size', 'md5'); |
| 99 | - foreach(scandir($dir) as $f) { |
|
| 99 | + foreach (scandir($dir) as $f) { |
|
| 100 | 100 | if ($f[0] == '.') continue; |
| 101 | 101 | [$md5, $size] = parse_info_file("$dir/.md5/$f"); |
| 102 | 102 | table_row( |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | // |
| 173 | 173 | $x = "<input_template>\n"; |
| 174 | 174 | $ninfiles = 1 + count($variant_desc->input_file_names) + count($variant_desc->app_files); |
| 175 | - for ($i=0; $i<$ninfiles; $i++) { |
|
| 175 | + for ($i = 0; $i < $ninfiles; $i++) { |
|
| 176 | 176 | $x .= " <file_info>\n <no_delete/>\n </file_info>\n"; |
| 177 | 177 | } |
| 178 | 178 | $x .= " <workunit>\n"; |
@@ -169,7 +169,7 @@ |
||
| 169 | 169 | $notice = ""; |
| 170 | 170 | $dir = sandbox_dir($user); |
| 171 | 171 | $count = count($_FILES['new_file']['tmp_name']); |
| 172 | - for ($i=0; $i<$count; $i++) { |
|
| 172 | + for ($i = 0; $i < $count; $i++) { |
|
| 173 | 173 | $tmp_name = $_FILES['new_file']['tmp_name'][$i]; |
| 174 | 174 | if (!is_uploaded_file($tmp_name)) { |
| 175 | 175 | error_page("$tmp_name is not uploaded file"); |
@@ -218,13 +218,13 @@ |
||
| 218 | 218 | function get_file($user) { |
| 219 | 219 | $dir = sandbox_dir($user); |
| 220 | 220 | $url = post_str('url'); |
| 221 | - if (filter_var($url, FILTER_VALIDATE_URL) === FALSE) { |
|
| 221 | + if (filter_var($url, FILTER_VALIDATE_URL) === false) { |
|
| 222 | 222 | error_page('Not a valid URL'); |
| 223 | 223 | } |
| 224 | 224 | $fname = basename($url); |
| 225 | 225 | $path = "$dir/$fname"; |
| 226 | 226 | if (file_exists($path)) { |
| 227 | - error_page("File $fname exists; delete it first."); |
|
| 227 | + error_page("file $fname exists; delete it first."); |
|
| 228 | 228 | } |
| 229 | 229 | copy($url, $path); |
| 230 | 230 | $notice = "Fetched file from <strong>$url</strong><br/>"; |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | // return list of files matching given pattern, |
| 92 | 92 | // in the format used for form_select() and form_select_multiple() |
| 93 | 93 | // |
| 94 | -function sandbox_select_items($user, $pattern=null) { |
|
| 94 | +function sandbox_select_items($user, $pattern = null) { |
|
| 95 | 95 | $sbfiles = sandbox_file_names($user); |
| 96 | 96 | $sbitems = []; |
| 97 | 97 | foreach ($sbfiles as $f) { |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | } |
| 113 | 113 | $files = sandbox_file_names($user); |
| 114 | 114 | foreach ($files as $f) { |
| 115 | - if ($regexp && !preg_match("/$regexp/",$f)) continue; |
|
| 115 | + if ($regexp && !preg_match("/$regexp/", $f)) continue; |
|
| 116 | 116 | $x .= "<option value=\"$f\">$f</option>\n"; |
| 117 | 117 | } |
| 118 | 118 | $x .= "</select>\n"; |
@@ -160,8 +160,8 @@ discard block |
||
| 160 | 160 | '%s <a href="%s&sort_field=%s&sort_rev=%d">%s</a>', |
| 161 | 161 | $title, |
| 162 | 162 | $url, $sort_field, |
| 163 | - $sort_rev?0:1, |
|
| 164 | - $sort_rev?'↑':'↓' |
|
| 163 | + $sort_rev ? 0 : 1, |
|
| 164 | + $sort_rev ? '↑' : '↓' |
|
| 165 | 165 | ); |
| 166 | 166 | } else { |
| 167 | 167 | return sprintf( |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | // |
| 62 | 62 | function unzip_batch_file($user, $batch_file) { |
| 63 | 63 | @mkdir("../../buda_batches"); |
| 64 | - for ($i=0; $i<1000; $i++) { |
|
| 64 | + for ($i = 0; $i < 1000; $i++) { |
|
| 65 | 65 | $batch_dir = "../../buda_batches/$i"; |
| 66 | 66 | $batch_dir_name = $i; |
| 67 | 67 | $ret = @mkdir($batch_dir); |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | } |
| 113 | 113 | $job_files = []; |
| 114 | 114 | $cmdline = ''; |
| 115 | - foreach(scandir("$batch_dir/$fname") as $f2) { |
|
| 115 | + foreach (scandir("$batch_dir/$fname") as $f2) { |
|
| 116 | 116 | if ($f2[0] == '.') continue; |
| 117 | 117 | if ($f2 == 'cmdline') { |
| 118 | 118 | $cmdline = trim(file_get_contents("$batch_dir/$fname/cmdline")); |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | function stage_input_files($batch_dir, $batch_desc, $batch_id) { |
| 163 | 163 | $n = count($batch_desc->shared_files); |
| 164 | 164 | $batch_desc->shared_files_phys_names = []; |
| 165 | - for ($i=0; $i<$n; $i++) { |
|
| 165 | + for ($i = 0; $i < $n; $i++) { |
|
| 166 | 166 | $path = sprintf('%s/%s', $batch_dir, $batch_desc->shared_files[$i]); |
| 167 | 167 | [$md5, $size] = $batch_desc->shared_file_infos[$i]; |
| 168 | 168 | $phys_name = sprintf('batch_%d_%s', $batch_id, $md5); |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | foreach ($batch_desc->jobs as $job) { |
| 173 | 173 | $n = count($batch_desc->unshared_files); |
| 174 | 174 | $job->phys_names = []; |
| 175 | - for ($i=0; $i<$n; $i++) { |
|
| 175 | + for ($i = 0; $i < $n; $i++) { |
|
| 176 | 176 | $path = sprintf('%s/%s/%s', |
| 177 | 177 | $batch_dir, $job->dir, $batch_desc->unshared_files[$i] |
| 178 | 178 | ); |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | } |
| 221 | 221 | $cw_cmdline = sprintf('"--dockerfile %s %s %s"', |
| 222 | 222 | $variant_desc->dockerfile, |
| 223 | - $wrapper_verbose?'--verbose':'', |
|
| 223 | + $wrapper_verbose ? '--verbose' : '', |
|
| 224 | 224 | $cmdline |
| 225 | 225 | ); |
| 226 | 226 | $cmd = sprintf( |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | if ($app_types->cpu) { |
| 73 | - $project_pref_descs[] = new PREF_BOOL ( |
|
| 73 | + $project_pref_descs[] = new PREF_BOOL( |
|
| 74 | 74 | tra("Allow CPU-only tasks"), |
| 75 | 75 | "Request CPU-only tasks from this project.", |
| 76 | 76 | "no_cpu", |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | ); |
| 80 | 80 | } |
| 81 | 81 | if ($app_types->ati) { |
| 82 | - $project_pref_descs[] = new PREF_BOOL ( |
|
| 82 | + $project_pref_descs[] = new PREF_BOOL( |
|
| 83 | 83 | tra("Use AMD GPU"), |
| 84 | 84 | "Request AMD GPU tasks from this project.", |
| 85 | 85 | "no_ati", |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | ); |
| 89 | 89 | } |
| 90 | 90 | if ($app_types->cuda) { |
| 91 | - $project_pref_descs[] = new PREF_BOOL ( |
|
| 91 | + $project_pref_descs[] = new PREF_BOOL( |
|
| 92 | 92 | tra("Use NVIDIA GPU"), |
| 93 | 93 | "Request NVIDIA GPU tasks from this project.", |
| 94 | 94 | "no_cuda", |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | ); |
| 98 | 98 | } |
| 99 | 99 | if ($app_types->intel_gpu) { |
| 100 | - $project_pref_descs[] = new PREF_BOOL ( |
|
| 100 | + $project_pref_descs[] = new PREF_BOOL( |
|
| 101 | 101 | tra("Use Intel GPU"), |
| 102 | 102 | "Request Intel GPU tasks from this project.", |
| 103 | 103 | "no_intel_gpu", |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | ); |
| 107 | 107 | } |
| 108 | 108 | if ($app_types->apple_gpu) { |
| 109 | - $project_pref_descs[] = new PREF_BOOL ( |
|
| 109 | + $project_pref_descs[] = new PREF_BOOL( |
|
| 110 | 110 | tra("Use Apple GPU"), |
| 111 | 111 | "Request Apple GPU tasks from this project.", |
| 112 | 112 | "no_apple_gpu", |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | $x = ""; |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | -$privacy_pref_descs = array ( |
|
| 134 | +$privacy_pref_descs = array( |
|
| 135 | 135 | new PREF_BOOL( |
| 136 | 136 | tra("Is it OK for %1 and your team (if any) to email you?", PROJECT).$x, |
| 137 | 137 | "", |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | global $in_project_specific; |
| 180 | 180 | global $venue_name; |
| 181 | 181 | |
| 182 | - switch($name) { |
|
| 182 | + switch ($name) { |
|
| 183 | 183 | case "venue": |
| 184 | 184 | $venue_name = $attrs["name"]; |
| 185 | 185 | $top_parse_result = $parse_result; |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | break; |
| 192 | 192 | default: |
| 193 | 193 | if ($in_project_specific) { |
| 194 | - $text= $text."<$name>"; |
|
| 194 | + $text = $text."<$name>"; |
|
| 195 | 195 | } else { |
| 196 | 196 | $text = ""; |
| 197 | 197 | } |
@@ -206,12 +206,12 @@ discard block |
||
| 206 | 206 | global $venue_name; |
| 207 | 207 | global $project_pref_descs; |
| 208 | 208 | |
| 209 | - foreach($project_pref_descs as $p) { |
|
| 209 | + foreach ($project_pref_descs as $p) { |
|
| 210 | 210 | if ($p->xml_parse($parse_result, $name, $text)) { |
| 211 | 211 | return; |
| 212 | 212 | } |
| 213 | 213 | } |
| 214 | - switch($name) { |
|
| 214 | + switch ($name) { |
|
| 215 | 215 | case "venue": |
| 216 | 216 | $top_parse_result->$venue_name = $parse_result; |
| 217 | 217 | $parse_result = $top_parse_result; |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | return $parse_result; |
| 256 | 256 | } |
| 257 | 257 | |
| 258 | -function prefs_show_project($prefs, $columns=false) { |
|
| 258 | +function prefs_show_project($prefs, $columns = false) { |
|
| 259 | 259 | global $project_pref_descs; |
| 260 | 260 | if ($columns) { |
| 261 | 261 | foreach ($project_pref_descs as $p) { |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | } |
| 295 | 295 | } |
| 296 | 296 | |
| 297 | -function prefs_show_project_specific($prefs, $columns=false) { |
|
| 297 | +function prefs_show_project_specific($prefs, $columns = false) { |
|
| 298 | 298 | if ($columns) { |
| 299 | 299 | $project_specific_prefs = project_specific_prefs_parse($prefs->project_specific); |
| 300 | 300 | $project_specific_prefs->home = isset($prefs->home) ? project_specific_prefs_parse($prefs->home->project_specific) : ""; |
@@ -306,10 +306,10 @@ discard block |
||
| 306 | 306 | project_specific_prefs_show($project_specific_prefs, $columns); |
| 307 | 307 | } |
| 308 | 308 | |
| 309 | -function print_prefs_display_project($user, $columns=false) { |
|
| 309 | +function print_prefs_display_project($user, $columns = false) { |
|
| 310 | 310 | $project_prefs = prefs_parse_project($user->project_prefs); |
| 311 | 311 | |
| 312 | - $switch_link = " <font size=\"-1\"><a href=prefs.php?subset=project&cols=". (int)!$columns .">".tra("(Switch View)")."</a></font>"; |
|
| 312 | + $switch_link = " <font size=\"-1\"><a href=prefs.php?subset=project&cols=".(int)!$columns.">".tra("(Switch View)")."</a></font>"; |
|
| 313 | 313 | if ($columns) { |
| 314 | 314 | start_table(); |
| 315 | 315 | row_heading(tra("Combined preferences").$switch_link); |
@@ -360,14 +360,14 @@ discard block |
||
| 360 | 360 | } |
| 361 | 361 | } |
| 362 | 362 | |
| 363 | -function prefs_form_project($prefs, $error=false) { |
|
| 363 | +function prefs_form_project($prefs, $error = false) { |
|
| 364 | 364 | global $project_pref_descs; |
| 365 | 365 | foreach ($project_pref_descs as $p) { |
| 366 | 366 | $p->show_form_row($prefs, $error); |
| 367 | 367 | } |
| 368 | 368 | } |
| 369 | 369 | |
| 370 | -function prefs_form_project_specific($prefs_xml, $error=false) { |
|
| 370 | +function prefs_form_project_specific($prefs_xml, $error = false) { |
|
| 371 | 371 | $prefs = project_specific_prefs_parse($prefs_xml); |
| 372 | 372 | project_specific_prefs_edit($prefs, $error); |
| 373 | 373 | } |
@@ -415,7 +415,7 @@ discard block |
||
| 415 | 415 | |
| 416 | 416 | // given a prefs structure, return the corresponding XML string |
| 417 | 417 | // |
| 418 | -function project_prefs_make_xml($prefs, $primary=true) { |
|
| 418 | +function project_prefs_make_xml($prefs, $primary = true) { |
|
| 419 | 419 | global $project_pref_descs; |
| 420 | 420 | $xml = ""; |
| 421 | 421 | if ($primary) { |
@@ -450,8 +450,8 @@ discard block |
||
| 450 | 450 | // |
| 451 | 451 | function project_prefs_update(&$user, $prefs) { |
| 452 | 452 | $prefs_xml = BoincDb::escape_string(project_prefs_make_xml($prefs)); |
| 453 | - $send_email = $user->send_email?1:0; |
|
| 454 | - $show_hosts = $user->show_hosts?1:0; |
|
| 453 | + $send_email = $user->send_email ? 1 : 0; |
|
| 454 | + $show_hosts = $user->show_hosts ? 1 : 0; |
|
| 455 | 455 | $retval = $user->update("project_prefs='$prefs_xml', send_email=$send_email, show_hosts=$show_hosts"); |
| 456 | 456 | if (!$retval) { |
| 457 | 457 | return 1; |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | $wuid2 = get_int('wuid2'); |
| 31 | 31 | $unsent_only = get_str('unsent_only', true); |
| 32 | 32 | |
| 33 | -if ($wuid1<1 || $wuid2<$wuid1) { |
|
| 33 | +if ($wuid1 < 1 || $wuid2 < $wuid1) { |
|
| 34 | 34 | admin_error_page( |
| 35 | 35 | "<h2>Workunit IDs fail to satisfy the conditions:<p> 0 < ID1 <= ID2" |
| 36 | 36 | ); |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | db_init(); |
| 25 | 25 | |
| 26 | 26 | admin_page_head("screen profile action"); |
| 27 | -for ($i=0; $i<$n; $i++) { |
|
| 27 | +for ($i = 0; $i < $n; $i++) { |
|
| 28 | 28 | $y = "user".$i; |
| 29 | 29 | $val = $_GET[$y]; |
| 30 | 30 | $x = "userid".$i; |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | $apps = BoincApp::enum(""); |
| 156 | 156 | foreach ($apps as $app) { |
| 157 | 157 | if (in_array($app->id, $show_only) |
| 158 | - || ( in_array("all", $show_only) |
|
| 158 | + || (in_array("all", $show_only) |
|
| 159 | 159 | && (!$app->deprecated || $show_deprecated) |
| 160 | 160 | )) { |
| 161 | 161 | |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | <b>Results for <tt>$app->name</tt>:</b> |
| 164 | 164 | <ul> |
| 165 | 165 | "; |
| 166 | - for ($i=0; $i<2; $i++) { |
|
| 166 | + for ($i = 0; $i < 2; $i++) { |
|
| 167 | 167 | if ($i) { |
| 168 | 168 | $secs = 7*86400; |
| 169 | 169 | $period = " 7 days"; |