@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | // show list of BUDA apps and variants, |
| 37 | 37 | // w/ buttons for adding and deleting |
| 38 | 38 | // |
| 39 | -function app_list($notice=null) { |
|
| 39 | +function app_list($notice = null) { |
|
| 40 | 40 | global $buda_root; |
| 41 | 41 | if (!is_dir($buda_root)) { |
| 42 | 42 | mkdir($buda_root); |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | // |
| 225 | 225 | $x = "<input_template>\n"; |
| 226 | 226 | $ninfiles = count($desc->input_file_names); |
| 227 | - for ($i=0; $i<$ninfiles; $i++) { |
|
| 227 | + for ($i = 0; $i < $ninfiles; $i++) { |
|
| 228 | 228 | $x .= " <file_info>\n <sticky/>\n <no_delete/>\n <executable/>\n </file_info>\n"; |
| 229 | 229 | } |
| 230 | 230 | $x .= " <workunit>\n"; |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | ); |
| 246 | 246 | |
| 247 | 247 | $x .= sprintf(" <max_delay>%f</max_delay>\n", |
| 248 | - $desc->max_delay_days * 86400. |
|
| 248 | + $desc->max_delay_days*86400. |
|
| 249 | 249 | ); |
| 250 | 250 | |
| 251 | 251 | $x .= " <buda_app_name>$app</buda_app_name>\n"; |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | } else { |
| 319 | 319 | $creating = true; |
| 320 | 320 | } |
| 321 | - $variant = sprintf('%s_%s', $cpu_type, $plan_class?$plan_class:'cpu'); |
|
| 321 | + $variant = sprintf('%s_%s', $cpu_type, $plan_class ? $plan_class : 'cpu'); |
|
| 322 | 322 | if (!is_valid_filename($variant)) { |
| 323 | 323 | error_page(filename_rules()); |
| 324 | 324 | } |
@@ -463,8 +463,8 @@ discard block |
||
| 463 | 463 | } |
| 464 | 464 | } |
| 465 | 465 | |
| 466 | -function app_form($desc=null) { |
|
| 467 | - page_head_select2($desc?"Edit BUDA app $desc->name":'Create BUDA app'); |
|
| 466 | +function app_form($desc = null) { |
|
| 467 | + page_head_select2($desc ? "Edit BUDA app $desc->name" : 'Create BUDA app'); |
|
| 468 | 468 | form_start('buda.php'); |
| 469 | 469 | form_input_hidden('action', 'app_action'); |
| 470 | 470 | if ($desc) { |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | // |
| 83 | 83 | function unzip_batch_file($user, $batch_file) { |
| 84 | 84 | @mkdir("../../buda_batches"); |
| 85 | - for ($i=0; $i<1000; $i++) { |
|
| 85 | + for ($i = 0; $i < 1000; $i++) { |
|
| 86 | 86 | $batch_dir = "../../buda_batches/$i"; |
| 87 | 87 | $batch_dir_name = $i; |
| 88 | 88 | $ret = @mkdir($batch_dir); |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | } |
| 134 | 134 | $job_files = []; |
| 135 | 135 | $cmdline = ''; |
| 136 | - foreach(scandir("$batch_dir/$fname") as $f2) { |
|
| 136 | + foreach (scandir("$batch_dir/$fname") as $f2) { |
|
| 137 | 137 | if ($f2[0] == '.') continue; |
| 138 | 138 | if ($f2 == 'cmdline') { |
| 139 | 139 | $cmdline = trim(file_get_contents("$batch_dir/$fname/cmdline")); |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | function stage_input_files($batch_dir, $batch_desc, $batch_id) { |
| 188 | 188 | $n = count($batch_desc->shared_files); |
| 189 | 189 | $batch_desc->shared_files_phys_names = []; |
| 190 | - for ($i=0; $i<$n; $i++) { |
|
| 190 | + for ($i = 0; $i < $n; $i++) { |
|
| 191 | 191 | $path = sprintf('%s/%s', $batch_dir, $batch_desc->shared_files[$i]); |
| 192 | 192 | [$md5, $size] = $batch_desc->shared_file_infos[$i]; |
| 193 | 193 | $phys_name = sprintf('batch_%d_%s', $batch_id, $md5); |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | foreach ($batch_desc->jobs as $job) { |
| 198 | 198 | $n = count($batch_desc->unshared_files); |
| 199 | 199 | $job->phys_names = []; |
| 200 | - for ($i=0; $i<$n; $i++) { |
|
| 200 | + for ($i = 0; $i < $n; $i++) { |
|
| 201 | 201 | $path = sprintf('%s/%s/%s', |
| 202 | 202 | $batch_dir, $job->dir, $batch_desc->unshared_files[$i] |
| 203 | 203 | ); |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | $job_cmds .= "$job_cmd\n"; |
| 237 | 237 | } |
| 238 | 238 | $wrapper_cmdline = sprintf('"%s %s"', |
| 239 | - $wrapper_verbose?'--verbose':'', |
|
| 239 | + $wrapper_verbose ? '--verbose' : '', |
|
| 240 | 240 | $cmdline |
| 241 | 241 | ); |
| 242 | 242 | $cmd = sprintf( |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | $max_runtime_days = (double)$max_runtime_days; |
| 284 | 284 | if ($max_runtime_days <= 0) error_page('bad runtime limit'); |
| 285 | 285 | if ($max_runtime_days > 100) error_page('bad runtime limit'); |
| 286 | - $max_fpops = $max_runtime_days * 4.3e9 * 86400; |
|
| 286 | + $max_fpops = $max_runtime_days*4.3e9*86400; |
|
| 287 | 287 | |
| 288 | 288 | $exp_runtime_days = get_str('exp_runtime_days'); |
| 289 | 289 | if (!is_numeric($exp_runtime_days)) error_page('bad expected runtime'); |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | if ($exp_runtime_days > $max_runtime_days) { |
| 294 | 294 | error_page('exp must be < max runtime'); |
| 295 | 295 | } |
| 296 | - $exp_fpops = $exp_runtime_days * 4.3e9 * 86400; |
|
| 296 | + $exp_fpops = $exp_runtime_days*4.3e9*86400; |
|
| 297 | 297 | |
| 298 | 298 | $app_desc = get_buda_app_desc($app); |
| 299 | 299 | |
@@ -346,7 +346,7 @@ |
||
| 346 | 346 | handle_get_info(); |
| 347 | 347 | } else { |
| 348 | 348 | $dev = get_str("dev", true); |
| 349 | - $user_agent = get_str("user_agent", true); // for debugging |
|
| 349 | + $user_agent = get_str("user_agent", true); // for debugging |
|
| 350 | 350 | if (!$user_agent) { |
| 351 | 351 | $user_agent = $_SERVER['HTTP_USER_AGENT']; |
| 352 | 352 | } |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | $app = BoincApp::lookup_id($ua->app_id); |
| 39 | 39 | $names[] = $app->name; |
| 40 | 40 | } |
| 41 | - $sub = $names?implode(', ', $names):'---'; |
|
| 41 | + $sub = $names ?implode(', ', $names) : '---'; |
|
| 42 | 42 | } |
| 43 | 43 | if ($u->manage_all) { |
| 44 | 44 | $admin = 'All applications'; |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | $app = BoincApp::lookup_id($ua->app_id); |
| 50 | 50 | $names[] = $app->name; |
| 51 | 51 | } |
| 52 | - $admin = $names?implode(', ', $names):'---'; |
|
| 52 | + $admin = $names ?implode(', ', $names) : '---'; |
|
| 53 | 53 | } |
| 54 | 54 | [$yes, $no] = read_kw_prefs($user); |
| 55 | 55 | global $job_keywords; |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | implode('<br>', $kws), |
| 70 | 70 | $u->quota, |
| 71 | 71 | $u->max_jobs_in_progress, |
| 72 | - ($u->logical_start_time > time())?local_time_str($u->logical_start_time):'---' |
|
| 72 | + ($u->logical_start_time > time()) ?local_time_str($u->logical_start_time) : '---' |
|
| 73 | 73 | ); |
| 74 | 74 | } |
| 75 | 75 | |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | 'max_jobs_in_progress', $usub->max_jobs_in_progress |
| 149 | 149 | ); |
| 150 | 150 | form_general('Run jobs only on own computers?', |
| 151 | - $user->seti_id?'yes':'no' |
|
| 151 | + $user->seti_id ? 'yes' : 'no' |
|
| 152 | 152 | ); |
| 153 | 153 | form_submit('Update'); |
| 154 | 154 | form_end(); |
@@ -204,18 +204,18 @@ discard block |
||
| 204 | 204 | $manage_apps = array_map('intval', $manage_apps); |
| 205 | 205 | foreach ($apps as $app) { |
| 206 | 206 | $s = in_array($app->id, $submit_apps); |
| 207 | - $m = in_array($app->id, $manage_apps)?1:0; |
|
| 207 | + $m = in_array($app->id, $manage_apps) ? 1 : 0; |
|
| 208 | 208 | if ($s || $m) { |
| 209 | 209 | BoincUserSubmitApp::insert( |
| 210 | 210 | "(user_id, app_id, manage) values ($user_id, $app->id, $m)" |
| 211 | 211 | ); |
| 212 | 212 | } |
| 213 | 213 | } |
| 214 | - $quota = (double) get_str('quota'); |
|
| 214 | + $quota = (double)get_str('quota'); |
|
| 215 | 215 | if ($quota != $us->quota) { |
| 216 | 216 | $us->update("quota=$quota"); |
| 217 | 217 | } |
| 218 | - $mj = (int) get_str('max_jobs_in_progress'); |
|
| 218 | + $mj = (int)get_str('max_jobs_in_progress'); |
|
| 219 | 219 | if ($mj != $us->max_jobs_in_progress) { |
| 220 | 220 | $us->update("max_jobs_in_progress=$mj"); |
| 221 | 221 | } |
@@ -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 | $master_url = master_url(); |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | // output a panel. |
| 247 | 247 | // $content_func is a function that generates the panel contents |
| 248 | 248 | // |
| 249 | -function panel($title, $content_func, $class="panel-primary", $body_class="") { |
|
| 249 | +function panel($title, $content_func, $class = "panel-primary", $body_class = "") { |
|
| 250 | 250 | echo sprintf('<div class="panel %s"> |
| 251 | 251 | ', $class |
| 252 | 252 | ); |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | // $left_width is the width of left column in 1/12 units. |
| 274 | 274 | // $arg is passed to the functions. |
| 275 | 275 | // |
| 276 | -function grid($top_func, $left_func, $right_func, $left_width=6, $arg=null) { |
|
| 276 | +function grid($top_func, $left_func, $right_func, $left_width = 6, $arg = null) { |
|
| 277 | 277 | echo ' |
| 278 | 278 | <div class="container-fluid"> |
| 279 | 279 | '; |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | </div> |
| 289 | 289 | '; |
| 290 | 290 | } |
| 291 | - $right_width = 12-$left_width; |
|
| 291 | + $right_width = 12 - $left_width; |
|
| 292 | 292 | echo ' |
| 293 | 293 | <div class="row"> |
| 294 | 294 | <div class="col-sm-'.$left_width.'"> |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | // use extra = "name=x" |
| 313 | 313 | // call forum_focus(x, foo) after defining the field |
| 314 | 314 | // |
| 315 | -function form_start($action, $method='get', $extra='') { |
|
| 315 | +function form_start($action, $method = 'get', $extra = '') { |
|
| 316 | 316 | echo sprintf( |
| 317 | 317 | '<div class="container-fluid"> |
| 318 | 318 | <form class="form-horizontal" method="%s" action="%s" %s>' |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | // just the input field |
| 347 | 347 | // |
| 348 | 348 | function form_input_text_field( |
| 349 | - $name, $value='', $type='text', $attrs='', $extra='' |
|
| 349 | + $name, $value = '', $type = 'text', $attrs = '', $extra = '' |
|
| 350 | 350 | ) { |
| 351 | 351 | return sprintf( |
| 352 | 352 | '<input %s type="%s" class="form-control" name="%s" value="%s">%s', |
@@ -357,7 +357,7 @@ discard block |
||
| 357 | 357 | // the whole row |
| 358 | 358 | // |
| 359 | 359 | function form_input_text( |
| 360 | - $label, $name, $value='', $type='text', $attrs='', $extra='' |
|
| 360 | + $label, $name, $value = '', $type = 'text', $attrs = '', $extra = '' |
|
| 361 | 361 | ) { |
| 362 | 362 | echo sprintf(' |
| 363 | 363 | <div class="form-group"> |
@@ -385,7 +385,7 @@ discard block |
||
| 385 | 385 | ); |
| 386 | 386 | } |
| 387 | 387 | |
| 388 | -function form_input_textarea($label, $name, $value='', $nrows=4) { |
|
| 388 | +function form_input_textarea($label, $name, $value = '', $nrows = 4) { |
|
| 389 | 389 | echo sprintf(' |
| 390 | 390 | <div class="form-group"> |
| 391 | 391 | <label align=right class="%s" for="%s">%s</label> |
@@ -402,7 +402,7 @@ discard block |
||
| 402 | 402 | // $items is either a string of <option> elements, |
| 403 | 403 | // or an array of [value, name] pairs |
| 404 | 404 | // |
| 405 | -function form_select($label, $name, $items, $selected=null) { |
|
| 405 | +function form_select($label, $name, $items, $selected = null) { |
|
| 406 | 406 | echo sprintf(' |
| 407 | 407 | <div class="form-group"> |
| 408 | 408 | <label align=right class="%s" for="%s">%s</label> |
@@ -415,7 +415,7 @@ discard block |
||
| 415 | 415 | foreach ($items as $i) { |
| 416 | 416 | echo sprintf( |
| 417 | 417 | '<option %s value="%s">%s</option>', |
| 418 | - ($i[0]==$selected)?'selected':'', |
|
| 418 | + ($i[0] == $selected) ? 'selected' : '', |
|
| 419 | 419 | $i[0], $i[1] |
| 420 | 420 | ); |
| 421 | 421 | } |
@@ -428,7 +428,7 @@ discard block |
||
| 428 | 428 | // same, for multiple select. |
| 429 | 429 | // $selected, if non-null, is a list of selected values |
| 430 | 430 | // |
| 431 | -function form_select_multiple($label, $name, $items, $selected=null, $size=0) { |
|
| 431 | +function form_select_multiple($label, $name, $items, $selected = null, $size = 0) { |
|
| 432 | 432 | echo sprintf(' |
| 433 | 433 | <div class="form-group"> |
| 434 | 434 | <label align=right class="%s" for="%s">%s</label> |
@@ -440,7 +440,7 @@ discard block |
||
| 440 | 440 | foreach ($items as $i) { |
| 441 | 441 | echo sprintf( |
| 442 | 442 | '<option %s value="%s">%s</option>', |
| 443 | - ($selected && in_array($i[0], $selected))?'selected':'', |
|
| 443 | + ($selected && in_array($i[0], $selected)) ? 'selected' : '', |
|
| 444 | 444 | $i[0], $i[1] |
| 445 | 445 | ); |
| 446 | 446 | } |
@@ -449,12 +449,12 @@ discard block |
||
| 449 | 449 | |
| 450 | 450 | // return a list of strings for checkbox items |
| 451 | 451 | // |
| 452 | -function checkbox_item_strings($items, $attrs='') { |
|
| 452 | +function checkbox_item_strings($items, $attrs = '') { |
|
| 453 | 453 | $x = []; |
| 454 | 454 | foreach ($items as $i) { |
| 455 | 455 | $x[] = sprintf('<input %s type="checkbox" name="%s" %s> %s |
| 456 | 456 | ', |
| 457 | - $attrs, $i[0], $i[2]?"checked":"", $i[1] |
|
| 457 | + $attrs, $i[0], $i[2] ? "checked" : "", $i[1] |
|
| 458 | 458 | ); |
| 459 | 459 | } |
| 460 | 460 | return $x; |
@@ -462,7 +462,7 @@ discard block |
||
| 462 | 462 | |
| 463 | 463 | // $items is list of (name, label, checked) |
| 464 | 464 | // |
| 465 | -function form_checkboxes($label, $items, $attrs='') { |
|
| 465 | +function form_checkboxes($label, $items, $attrs = '') { |
|
| 466 | 466 | echo sprintf(' |
| 467 | 467 | <div class="form-group"> |
| 468 | 468 | <label align=right class="%s">%s</label> |
@@ -481,7 +481,7 @@ discard block |
||
| 481 | 481 | // |
| 482 | 482 | function form_radio_buttons( |
| 483 | 483 | $label, $name, $items, $selected, |
| 484 | - $assign_ids=false // assign IDs to buttons based on names |
|
| 484 | + $assign_ids = false // assign IDs to buttons based on names |
|
| 485 | 485 | ) { |
| 486 | 486 | echo sprintf(' |
| 487 | 487 | <div class="form-group"> |
@@ -491,7 +491,7 @@ discard block |
||
| 491 | 491 | FORM_LEFT_CLASS, $label, FORM_RIGHT_CLASS |
| 492 | 492 | ); |
| 493 | 493 | foreach ($items as $i) { |
| 494 | - $checked = ($selected == $i[0])?"checked":""; |
|
| 494 | + $checked = ($selected == $i[0]) ? "checked" : ""; |
|
| 495 | 495 | if ($assign_ids) { |
| 496 | 496 | $id = sprintf('id="%s_%s"', $name, $i[0]); |
| 497 | 497 | } else { |
@@ -529,7 +529,7 @@ discard block |
||
| 529 | 529 | '; |
| 530 | 530 | } |
| 531 | 531 | |
| 532 | -function form_submit($text, $attrs='') { |
|
| 532 | +function form_submit($text, $attrs = '') { |
|
| 533 | 533 | form_general( |
| 534 | 534 | "", |
| 535 | 535 | sprintf( |
@@ -539,7 +539,7 @@ discard block |
||
| 539 | 539 | ); |
| 540 | 540 | } |
| 541 | 541 | |
| 542 | -function form_checkbox($label, $name, $checked=false) { |
|
| 542 | +function form_checkbox($label, $name, $checked = false) { |
|
| 543 | 543 | echo sprintf(' |
| 544 | 544 | <div class="form-group"> |
| 545 | 545 | <label align=right class="%s">%s</label> |
@@ -551,7 +551,7 @@ discard block |
||
| 551 | 551 | <input type="checkbox" name="%s" %s> |
| 552 | 552 | </div> |
| 553 | 553 | </div> |
| 554 | - ', $name, $checked?"checked":"" |
|
| 554 | + ', $name, $checked ? "checked" : "" |
|
| 555 | 555 | ); |
| 556 | 556 | } |
| 557 | 557 | |
@@ -579,7 +579,7 @@ discard block |
||
| 579 | 579 | // $selected is the list of selected values. |
| 580 | 580 | // $extra is e.g. id=foo |
| 581 | 581 | // |
| 582 | -function form_select2_multi($label, $name, $items, $selected=null, $extra='') { |
|
| 582 | +function form_select2_multi($label, $name, $items, $selected = null, $extra = '') { |
|
| 583 | 583 | echo sprintf(' |
| 584 | 584 | <div class="form-group"> |
| 585 | 585 | <label align=right class="%s" for="%s">%s</label> |
@@ -591,7 +591,7 @@ discard block |
||
| 591 | 591 | foreach ($items as $i) { |
| 592 | 592 | echo sprintf( |
| 593 | 593 | '<option %s value="%s">%s</option>', |
| 594 | - ($selected && in_array($i[0], $selected))?'selected':'', |
|
| 594 | + ($selected && in_array($i[0], $selected)) ? 'selected' : '', |
|
| 595 | 595 | $i[0], $i[1] |
| 596 | 596 | ); |
| 597 | 597 | } |
@@ -674,7 +674,7 @@ discard block |
||
| 674 | 674 | ); |
| 675 | 675 | } |
| 676 | 676 | row2("Submitted", time_str($batch->create_time)); |
| 677 | - row2("Application", $app?$app->name:'---'); |
|
| 677 | + row2("Application", $app ? $app->name : '---'); |
|
| 678 | 678 | row2("State", batch_state_string($batch->state)); |
| 679 | 679 | //row2("# jobs", $batch->njobs); |
| 680 | 680 | //row2("# error jobs", $batch->nerror_jobs); |
@@ -764,11 +764,11 @@ discard block |
||
| 764 | 764 | "GFLOPS-hours" |
| 765 | 765 | ]; |
| 766 | 766 | row_heading_array($x); |
| 767 | - foreach($wus as $wu) { |
|
| 767 | + foreach ($wus as $wu) { |
|
| 768 | 768 | if ($status && $wu->status != $status) continue; |
| 769 | 769 | $y = ''; |
| 770 | 770 | $c = '---'; |
| 771 | - switch($wu->status) { |
|
| 771 | + switch ($wu->status) { |
|
| 772 | 772 | case WU_SUCCESS: |
| 773 | 773 | $resultid = $wu->canonical_resultid; |
| 774 | 774 | $y = sprintf('<font color="%s">completed</font>', COLOR_SUCCESS); |
@@ -859,7 +859,7 @@ discard block |
||
| 859 | 859 | if ($result->id == $wu->canonical_resultid) { |
| 860 | 860 | $log_names = get_outfile_log_names($result); |
| 861 | 861 | $nfiles = count($log_names); |
| 862 | - for ($i=0; $i<$nfiles; $i++) { |
|
| 862 | + for ($i = 0; $i < $nfiles; $i++) { |
|
| 863 | 863 | $name = $log_names[$i]; |
| 864 | 864 | // don't show 'view' link if it's a .zip |
| 865 | 865 | $y = "$name: "; |
@@ -883,7 +883,7 @@ discard block |
||
| 883 | 883 | $phys_names = get_outfile_phys_names($result); |
| 884 | 884 | $log_names = get_outfile_log_names($result); |
| 885 | 885 | $nfiles = count($log_names); |
| 886 | - for ($i=0; $i<$nfiles; $i++) { |
|
| 886 | + for ($i = 0; $i < $nfiles; $i++) { |
|
| 887 | 887 | $path = dir_hier_path( |
| 888 | 888 | $phys_names[$i], $upload_dir, $fanout |
| 889 | 889 | ); |
@@ -56,10 +56,10 @@ discard block |
||
| 56 | 56 | return file_exists("$d/stop_sched"); |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | -function xml_error($num=-1, $msg=null, $file=null, $line=null) { |
|
| 59 | +function xml_error($num = -1, $msg = null, $file = null, $line = null) { |
|
| 60 | 60 | global $xml_outer_tag; |
| 61 | 61 | if (!$msg) { |
| 62 | - switch($num) { |
|
| 62 | + switch ($num) { |
|
| 63 | 63 | case -112: $msg = "Invalid XML"; break; |
| 64 | 64 | case -136: $msg = "Not found"; break; |
| 65 | 65 | case -137: $msg = "Name or email address is not unique"; break; |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | // If it's a single-tag element, and it's present, just return the tag |
| 105 | 105 | // |
| 106 | 106 | function parse_element($xml, $tag) { |
| 107 | - $closetag = "</" . substr($tag,1); |
|
| 107 | + $closetag = "</".substr($tag, 1); |
|
| 108 | 108 | $x = strstr($xml, $tag); |
| 109 | 109 | if ($x) { |
| 110 | 110 | if (strstr($tag, "/>")) return $tag; |
@@ -120,8 +120,8 @@ discard block |
||
| 120 | 120 | |
| 121 | 121 | function parse_next_element($xml, $tag, &$cursor) { |
| 122 | 122 | $element = null; |
| 123 | - $closetag = "</" . substr($tag,1); |
|
| 124 | - $pos = substr($xml,$cursor); |
|
| 123 | + $closetag = "</".substr($tag, 1); |
|
| 124 | + $pos = substr($xml, $cursor); |
|
| 125 | 125 | $x = strstr($pos, $tag); |
| 126 | 126 | if ($x) { |
| 127 | 127 | if (strstr($tag, "/>")) return $tag; |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | // ALSO: allow spaces. |
| 223 | 223 | // |
| 224 | 224 | function is_valid_filename($x) { |
| 225 | - if (strlen($x)>255) return false; |
|
| 225 | + if (strlen($x) > 255) return false; |
|
| 226 | 226 | // \w means A-Za-z0-9_ |
| 227 | 227 | return preg_match('/^[\w\-. ]+$/', $x); |
| 228 | 228 | } |