@@ -40,22 +40,22 @@ discard block |
||
| 40 | 40 | // Should fix at some point. |
| 41 | 41 | // |
| 42 | 42 | function mysqltime_str($x) { |
| 43 | - if(strpos($x,"-")==4) { |
|
| 43 | + if (strpos($x, "-") == 4) { |
|
| 44 | 44 | // Syntax of supplied mysql-timestamp is YYYY-MM-DD HH:MM:SS |
| 45 | - $year = substr($x,0,4); |
|
| 46 | - $month = substr($x,5,2); |
|
| 47 | - $day = substr($x,8,2); |
|
| 48 | - $hour = substr($x,11,2); |
|
| 49 | - $minute = substr($x,14,2); |
|
| 50 | - $second = substr($x,17,2); |
|
| 45 | + $year = substr($x, 0, 4); |
|
| 46 | + $month = substr($x, 5, 2); |
|
| 47 | + $day = substr($x, 8, 2); |
|
| 48 | + $hour = substr($x, 11, 2); |
|
| 49 | + $minute = substr($x, 14, 2); |
|
| 50 | + $second = substr($x, 17, 2); |
|
| 51 | 51 | } else { |
| 52 | 52 | // Syntax of supplied mysql-timestamp is YYYYMMDDHHMMSS |
| 53 | - $year = substr($x,0,4); |
|
| 54 | - $month = substr($x,4,2); |
|
| 55 | - $day = substr($x,6,2); |
|
| 56 | - $hour = substr($x,8,2); |
|
| 57 | - $minute = substr($x,10,2); |
|
| 58 | - $second = substr($x,12,2); |
|
| 53 | + $year = substr($x, 0, 4); |
|
| 54 | + $month = substr($x, 4, 2); |
|
| 55 | + $day = substr($x, 6, 2); |
|
| 56 | + $hour = substr($x, 8, 2); |
|
| 57 | + $minute = substr($x, 10, 2); |
|
| 58 | + $second = substr($x, 12, 2); |
|
| 59 | 59 | |
| 60 | 60 | } |
| 61 | 61 | $time = mktime($hour, $minute, $second, $month, $day, $year); |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | if (preg_match('/^MYSQLI_TYPE_(.*)/', $c, $m)) $types[$n] = $m[1]; |
| 99 | 99 | } |
| 100 | 100 | } |
| 101 | - return array_key_exists($type_id, $types)? strtolower($types[$type_id]) : "unknown"; |
|
| 101 | + return array_key_exists($type_id, $types) ? strtolower($types[$type_id]) : "unknown"; |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | // print a description of $table |
@@ -108,38 +108,38 @@ discard block |
||
| 108 | 108 | $result = $db->do_query("SELECT * from $table LIMIT 1"); |
| 109 | 109 | $fields = $result->field_count; |
| 110 | 110 | |
| 111 | - $avgnum=(int)($fields/$columns); |
|
| 112 | - if ($avgnum*$columns<$fields) { |
|
| 111 | + $avgnum = (int)($fields/$columns); |
|
| 112 | + if ($avgnum*$columns < $fields) { |
|
| 113 | 113 | $avgnum++; |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | - $actualcolumns=0; |
|
| 117 | - while ($avgnum*$actualcolumns<$fields) { |
|
| 116 | + $actualcolumns = 0; |
|
| 117 | + while ($avgnum*$actualcolumns < $fields) { |
|
| 118 | 118 | $actualcolumns++; |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | - if ($which>$actualcolumns) { |
|
| 121 | + if ($which > $actualcolumns) { |
|
| 122 | 122 | return 0; |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | - $bot=($which-1)*$avgnum; |
|
| 126 | - $top=$which*$avgnum; |
|
| 125 | + $bot = ($which - 1)*$avgnum; |
|
| 126 | + $top = $which*$avgnum; |
|
| 127 | 127 | |
| 128 | - $width=100.0/$actualcolumns; |
|
| 128 | + $width = 100.0/$actualcolumns; |
|
| 129 | 129 | |
| 130 | 130 | echo "<td>"; |
| 131 | 131 | start_table('table-striped'); |
| 132 | 132 | echo "<tr><th align=\"left\">NAME</th><th align=\"left\">Type</th><th align=\"left\">Bytes</th>\n"; |
| 133 | - for ($count=$bot; $count<$top; $count++) { |
|
| 134 | - if ($count<$fields) { |
|
| 133 | + for ($count = $bot; $count < $top; $count++) { |
|
| 134 | + if ($count < $fields) { |
|
| 135 | 135 | $x = $result->fetch_field_direct($count); |
| 136 | 136 | $name = $x->name; |
| 137 | 137 | $type = mysql_fieldtype_str($x->type); |
| 138 | 138 | $length = $x->length; |
| 139 | 139 | } else { |
| 140 | - $name="<br/> "; |
|
| 141 | - $type="<br/>"; |
|
| 142 | - $length="<br/>"; |
|
| 140 | + $name = "<br/> "; |
|
| 141 | + $type = "<br/>"; |
|
| 142 | + $length = "<br/>"; |
|
| 143 | 143 | } |
| 144 | 144 | echo "\t<tr><td><b>$name</b></td><td>$type</td><td>$length</td></tr>\n"; |
| 145 | 145 | } |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | echo "<h2>Description of <b>$table</b> table fields:</h2>\n"; |
| 155 | 155 | start_table(); |
| 156 | 156 | echo "<tr>"; |
| 157 | - for ($i=1; $i<=$how_many_columns; $i++) { |
|
| 157 | + for ($i = 1; $i <= $how_many_columns; $i++) { |
|
| 158 | 158 | print_describe_table_onecol($table, $i, $how_many_columns); |
| 159 | 159 | } |
| 160 | 160 | echo "</tr>"; |
@@ -173,10 +173,10 @@ discard block |
||
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | function print_query_field() { |
| 176 | - $currenttime=time(); |
|
| 177 | - $hourago=$currenttime-3600; |
|
| 178 | - $dayago=$currenttime-24*3600; |
|
| 179 | - $weekago=$currenttime-7*24*3600; |
|
| 176 | + $currenttime = time(); |
|
| 177 | + $hourago = $currenttime - 3600; |
|
| 178 | + $dayago = $currenttime - 24*3600; |
|
| 179 | + $weekago = $currenttime - 7*24*3600; |
|
| 180 | 180 | echo " |
| 181 | 181 | <tr> |
| 182 | 182 | <td align=\"right\">Additional clauses</td> |
@@ -200,11 +200,11 @@ discard block |
||
| 200 | 200 | } |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | -function append_sql_query($original,$addition,$first) { |
|
| 203 | +function append_sql_query($original, $addition, $first) { |
|
| 204 | 204 | if ($first == 1) { |
| 205 | - return $original . " where " . $addition; |
|
| 205 | + return $original." where ".$addition; |
|
| 206 | 206 | } else { |
| 207 | - return $original . " and " . $addition; |
|
| 207 | + return $original." and ".$addition; |
|
| 208 | 208 | } |
| 209 | 209 | } |
| 210 | 210 | |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | if (isset($_GET[$name])) { |
| 306 | 306 | $value = $_GET[$name]; |
| 307 | 307 | } else { |
| 308 | - $value=null; |
|
| 308 | + $value = null; |
|
| 309 | 309 | } |
| 310 | 310 | if (isset($_GET[$order])) { |
| 311 | 311 | $order = $_GET[$order]; |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | } |
| 347 | 347 | |
| 348 | 348 | function get_url($base = "db_action.php") { |
| 349 | - $s = $base . "?table=$this->table$this->urlquery"; |
|
| 349 | + $s = $base."?table=$this->table$this->urlquery"; |
|
| 350 | 350 | return $s; |
| 351 | 351 | } |
| 352 | 352 | |
@@ -361,7 +361,7 @@ discard block |
||
| 361 | 361 | $this->addeq('app_version_id'); |
| 362 | 362 | $this->addeq('exit_status'); |
| 363 | 363 | if (isset($_GET['nsecs'])) { |
| 364 | - $_GET['mod_time'] = date("YmdHis",time() - $_GET['nsecs']); |
|
| 364 | + $_GET['mod_time'] = date("YmdHis", time() - $_GET['nsecs']); |
|
| 365 | 365 | } |
| 366 | 366 | $this->addgt('mod_time'); |
| 367 | 367 | $this->addeq_not_CHOOSE_ALL('server_state'); |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | if ($n == '0') { // intentional compare by string |
| 383 | 383 | return "0"; |
| 384 | 384 | } else { |
| 385 | - if(strlen($clauses)) { |
|
| 385 | + if (strlen($clauses)) { |
|
| 386 | 386 | return "<a href=\"db_action.php?table=result&query=$mq&$query&clauses=".urlencode($clauses)."&sort_by=mod_time&detail=low\">$n</a>"; |
| 387 | 387 | } else { |
| 388 | 388 | return "<a href=\"db_action.php?table=result&query=$mq&$query&sort_by=mod_time&detail=low\">$n</a>"; |
@@ -395,13 +395,13 @@ discard block |
||
| 395 | 395 | // @return String A human readable string if error otherwise FALSE |
| 396 | 396 | // @param String $stderr_out the stderr_out value to parse |
| 397 | 397 | // |
| 398 | -function stderr_error_string($stderr_out){ |
|
| 398 | +function stderr_error_string($stderr_out) { |
|
| 399 | 399 | $y = parse_element($stderr_out, "<error_code>"); |
| 400 | 400 | $x = 0; |
| 401 | 401 | if ($y) { |
| 402 | 402 | $x = (int)$y; |
| 403 | 403 | } |
| 404 | - if (0<=$x && $x<=9) { |
|
| 404 | + if (0 <= $x && $x <= 9) { |
|
| 405 | 405 | return FALSE; |
| 406 | 406 | } else { |
| 407 | 407 | return "$x ".error_code_str($x); |
@@ -409,8 +409,8 @@ discard block |
||
| 409 | 409 | } |
| 410 | 410 | |
| 411 | 411 | function admin_show_result_summary() { |
| 412 | - $ntotal =0; // TODO: how to count $result? |
|
| 413 | - $nvalid = 0; // for SUCCESS results |
|
| 412 | + $ntotal = 0; // TODO: how to count $result? |
|
| 413 | + $nvalid = 0; // for SUCCESS results |
|
| 414 | 414 | $ninvalid = 0; |
| 415 | 415 | $nfile_deleted = 0; |
| 416 | 416 | |
@@ -418,20 +418,20 @@ discard block |
||
| 418 | 418 | $outcome = array(); |
| 419 | 419 | $client_state = array(); |
| 420 | 420 | |
| 421 | - for ($ss=1; $ss<6; $ss++) { |
|
| 421 | + for ($ss = 1; $ss < 6; $ss++) { |
|
| 422 | 422 | $server_state[$ss] = 0; |
| 423 | 423 | } |
| 424 | - for ($ro=0; $ro<8; $ro++) { |
|
| 424 | + for ($ro = 0; $ro < 8; $ro++) { |
|
| 425 | 425 | $outcome[$ro] = 0; |
| 426 | 426 | } |
| 427 | - for ($cs=1; $cs<7; $cs++) { |
|
| 427 | + for ($cs = 1; $cs < 7; $cs++) { |
|
| 428 | 428 | $client_state[$cs] = 0; |
| 429 | 429 | } |
| 430 | - for ($fds=0; $fds<4; $fds++) { |
|
| 430 | + for ($fds = 0; $fds < 4; $fds++) { |
|
| 431 | 431 | $delete_state[$fds] = 0; |
| 432 | 432 | } |
| 433 | - for ($vs=0; $vs<NVALIDATE_STATES; $vs++) { |
|
| 434 | - $validate_state[$vs]=0; |
|
| 433 | + for ($vs = 0; $vs < NVALIDATE_STATES; $vs++) { |
|
| 434 | + $validate_state[$vs] = 0; |
|
| 435 | 435 | } |
| 436 | 436 | |
| 437 | 437 | $_GET['table'] = 'result'; |
@@ -506,7 +506,7 @@ discard block |
||
| 506 | 506 | // |
| 507 | 507 | $delay = parse_config(get_config(), "<delete_delay_hours>"); |
| 508 | 508 | if ($delay) { |
| 509 | - $start2 = $start - $delay*3600;; |
|
| 509 | + $start2 = $start - $delay*3600; ; |
|
| 510 | 510 | $main_query .= " and ((file_delete_state>1 and mod_time>FROM_UNIXTIME($start2)) or (mod_time>FROM_UNIXTIME($start)))"; |
| 511 | 511 | } else { |
| 512 | 512 | $main_query .= " and mod_time > FROM_UNIXTIME($start)"; |
@@ -565,21 +565,21 @@ discard block |
||
| 565 | 565 | |
| 566 | 566 | start_table(); |
| 567 | 567 | echo "<tr valign=\"top\">"; |
| 568 | - echo "<td><h2>" . link_results("$ntotal results", $urlquery, '', '') . "</h2></td>"; |
|
| 569 | - echo "<td><h2>" . link_results("'Over' results", $urlquery, sprintf('server_state=%d', RESULT_SERVER_STATE_OVER), '') . "</h2></td>"; |
|
| 570 | - echo "<td><h2>" . link_results("'Success' results", $urlquery, sprintf('outcome=%d', RESULT_OUTCOME_SUCCESS), '') . "</h2></td>"; |
|
| 571 | - echo "<td><h2>" . link_results("'Client error' results", $urlquery, sprintf('outcome=%d', RESULT_OUTCOME_CLIENT_ERROR), '') . "</h2></td>"; |
|
| 568 | + echo "<td><h2>".link_results("$ntotal results", $urlquery, '', '')."</h2></td>"; |
|
| 569 | + echo "<td><h2>".link_results("'Over' results", $urlquery, sprintf('server_state=%d', RESULT_SERVER_STATE_OVER), '')."</h2></td>"; |
|
| 570 | + echo "<td><h2>".link_results("'Success' results", $urlquery, sprintf('outcome=%d', RESULT_OUTCOME_SUCCESS), '')."</h2></td>"; |
|
| 571 | + echo "<td><h2>".link_results("'Client error' results", $urlquery, sprintf('outcome=%d', RESULT_OUTCOME_CLIENT_ERROR), '')."</h2></td>"; |
|
| 572 | 572 | echo "</tr>"; |
| 573 | 573 | echo "<tr valign=\"top\">"; |
| 574 | 574 | echo "<td>"; |
| 575 | 575 | start_table('table-striped'); |
| 576 | 576 | echo "<tr><th>Server state</th><th># results</th></tr>\n"; |
| 577 | - for ($ss=1; $ss<6; $ss++) { |
|
| 577 | + for ($ss = 1; $ss < 6; $ss++) { |
|
| 578 | 578 | $res = new StdClass; |
| 579 | 579 | $res->server_state = $ss; |
| 580 | 580 | row2(result_server_state_string($res), |
| 581 | 581 | link_results( |
| 582 | - "$server_state[$ss]", $urlquery, "server_state=$ss", '' |
|
| 582 | + "$server_state[$ss]", $urlquery, "server_state=$ss", '' |
|
| 583 | 583 | ) |
| 584 | 584 | ); |
| 585 | 585 | } |
@@ -590,12 +590,12 @@ discard block |
||
| 590 | 590 | start_table('table-striped'); |
| 591 | 591 | echo "<tr><th>Outcome</th><th># results</th></tr>\n"; |
| 592 | 592 | |
| 593 | - for ($ro=0; $ro<8; $ro++) { |
|
| 593 | + for ($ro = 0; $ro < 8; $ro++) { |
|
| 594 | 594 | $res = new StdClass; |
| 595 | 595 | $res->outcome = $ro; |
| 596 | 596 | $res->exit_status = 0; |
| 597 | 597 | c_row2( |
| 598 | - $outcome[$ro]?outcome_color($ro):'', |
|
| 598 | + $outcome[$ro] ?outcome_color($ro) : '', |
|
| 599 | 599 | result_outcome_string($res), |
| 600 | 600 | link_results("$outcome[$ro]", $urlquery, "outcome=$ro", '') |
| 601 | 601 | ); |
@@ -606,12 +606,12 @@ discard block |
||
| 606 | 606 | echo "<td>"; |
| 607 | 607 | start_table('table-striped'); |
| 608 | 608 | echo "<tr><th>Validate state</th><th># results</th></tr>\n"; |
| 609 | - for ($vs=0; $vs<NVALIDATE_STATES; $vs++) { |
|
| 609 | + for ($vs = 0; $vs < NVALIDATE_STATES; $vs++) { |
|
| 610 | 610 | $res = new StdClass; |
| 611 | 611 | $res->validate_state = $vs; |
| 612 | 612 | $res->exit_status = 0; |
| 613 | 613 | c_row2( |
| 614 | - $validate_state[$vs]?validate_color($vs):'', |
|
| 614 | + $validate_state[$vs] ?validate_color($vs) : '', |
|
| 615 | 615 | validate_state_str($res), |
| 616 | 616 | link_results( |
| 617 | 617 | "$validate_state[$vs]", |
@@ -625,7 +625,7 @@ discard block |
||
| 625 | 625 | start_table('table-striped'); |
| 626 | 626 | echo "<tr><th>File Delete state</th><th># results</th></tr>\n"; |
| 627 | 627 | |
| 628 | - for ($fds=0; $fds<4; $fds++) { |
|
| 628 | + for ($fds = 0; $fds < 4; $fds++) { |
|
| 629 | 629 | row2( |
| 630 | 630 | file_delete_state_str($fds), |
| 631 | 631 | link_results( |
@@ -654,7 +654,7 @@ discard block |
||
| 654 | 654 | echo "<td>"; |
| 655 | 655 | start_table('table-striped'); |
| 656 | 656 | echo "<tr><th>Client state</th><th># results</th></tr>\n"; |
| 657 | - for ($cs=1; $cs<7; $cs++) { |
|
| 657 | + for ($cs = 1; $cs < 7; $cs++) { |
|
| 658 | 658 | $res = new StdClass; |
| 659 | 659 | $res->client_state = $cs; |
| 660 | 660 | $res->exit_status = 0; |
@@ -677,9 +677,9 @@ discard block |
||
| 677 | 677 | <select name=\"server_state\"> |
| 678 | 678 | <option value=\"CHOOSE_ALL\" selected=\"selected\"> Any </option> |
| 679 | 679 | "; |
| 680 | - for ($i=1; $i<6; $i++) { |
|
| 680 | + for ($i = 1; $i < 6; $i++) { |
|
| 681 | 681 | $res = new StdClass; |
| 682 | - $res->server_state=$i; |
|
| 682 | + $res->server_state = $i; |
|
| 683 | 683 | echo "<option value=\"$i\"> "."[$i] ".' '.result_server_state_string($res)."</option>\n"; |
| 684 | 684 | } |
| 685 | 685 | echo "</select>\n"; |
@@ -690,7 +690,7 @@ discard block |
||
| 690 | 690 | <select name=\"outcome\"> |
| 691 | 691 | <option value=\"CHOOSE_ALL\" selected=\"selected\"> Any </option> |
| 692 | 692 | "; |
| 693 | - for ($i=0; $i<8; $i++) { |
|
| 693 | + for ($i = 0; $i < 8; $i++) { |
|
| 694 | 694 | $res = new StdClass; |
| 695 | 695 | $res->outcome = $i; |
| 696 | 696 | $res->exit_status = 0; |
@@ -704,7 +704,7 @@ discard block |
||
| 704 | 704 | <select name=\"validate_state\"> |
| 705 | 705 | <option value=\"CHOOSE_ALL\" selected=\"selected\"> Any </option> |
| 706 | 706 | "; |
| 707 | - for ($vs=0; $vs<NVALIDATE_STATES; $vs++) { |
|
| 707 | + for ($vs = 0; $vs < NVALIDATE_STATES; $vs++) { |
|
| 708 | 708 | $res = new StdClass; |
| 709 | 709 | $res->validate_state = $vs; |
| 710 | 710 | $res->exit_status = 0; |
@@ -718,7 +718,7 @@ discard block |
||
| 718 | 718 | <select name=\"client_state\"> |
| 719 | 719 | <option value=\"CHOOSE_ALL\" selected=\"selected\"> Any </option> |
| 720 | 720 | "; |
| 721 | - for ($i=0; $i<7; $i++) { |
|
| 721 | + for ($i = 0; $i < 7; $i++) { |
|
| 722 | 722 | $res = new StdClass; |
| 723 | 723 | $res->client_state = $i; |
| 724 | 724 | $res->exit_status = 0; |
@@ -755,7 +755,7 @@ discard block |
||
| 755 | 755 | } |
| 756 | 756 | |
| 757 | 757 | function table_title($table) { |
| 758 | - switch($table) { |
|
| 758 | + switch ($table) { |
|
| 759 | 759 | case "platform": return "Platforms"; |
| 760 | 760 | case "app": return "Applications"; |
| 761 | 761 | case "app_version": return "Application Versions"; |
@@ -775,7 +775,7 @@ discard block |
||
| 775 | 775 | row("Created", time_str($platform->create_time)); |
| 776 | 776 | row("Name", $platform->name); |
| 777 | 777 | row("User friendly name", $platform->user_friendly_name); |
| 778 | - row("","<a href=\"db_action.php?table=app_version&platformid=$platform->id\">App versions for this platform</a>"); |
|
| 778 | + row("", "<a href=\"db_action.php?table=app_version&platformid=$platform->id\">App versions for this platform</a>"); |
|
| 779 | 779 | end_table(); |
| 780 | 780 | } |
| 781 | 781 | |
@@ -787,8 +787,8 @@ discard block |
||
| 787 | 787 | row("User-friendly name", $app->user_friendly_name); |
| 788 | 788 | row("Deprecated", $app->deprecated); |
| 789 | 789 | row("Homogeneous redundancy", $app->homogeneous_redundancy); |
| 790 | - row("","<a href=\"db_action.php?table=app_version&appid=$app->id\">App Versions for this application</a>"); |
|
| 791 | - row("","<a href=\"db_action.php?table=workunit&appid=$app->id&detail=low\">Workunits for this application</a>"); |
|
| 790 | + row("", "<a href=\"db_action.php?table=app_version&appid=$app->id\">App Versions for this application</a>"); |
|
| 791 | + row("", "<a href=\"db_action.php?table=workunit&appid=$app->id&detail=low\">Workunits for this application</a>"); |
|
| 792 | 792 | end_table(); |
| 793 | 793 | } |
| 794 | 794 | |
@@ -796,9 +796,9 @@ discard block |
||
| 796 | 796 | start_table(); |
| 797 | 797 | row("ID", $app_version->id); |
| 798 | 798 | row("Created", time_str($app_version->create_time)); |
| 799 | - row("Application", "<a href=\"db_action.php?table=app&id=$app_version->appid\">" . app_name_by_id($app_version->appid) . "</a>"); |
|
| 799 | + row("Application", "<a href=\"db_action.php?table=app&id=$app_version->appid\">".app_name_by_id($app_version->appid)."</a>"); |
|
| 800 | 800 | row("Version num", $app_version->version_num); |
| 801 | - row("Platform", "<a href=\"db_action.php?table=platform&id=$app_version->platformid\">" . platform_name_by_id($app_version->platformid) . "</a>" ); |
|
| 801 | + row("Platform", "<a href=\"db_action.php?table=platform&id=$app_version->platformid\">".platform_name_by_id($app_version->platformid)."</a>"); |
|
| 802 | 802 | row("Plan Class", $app_version->plan_class); |
| 803 | 803 | row("XML doc", "<pre>".htmlspecialchars($app_version->xml_doc)."</pre>"); |
| 804 | 804 | row("min_core_version", $app_version->min_core_version); |
@@ -932,7 +932,7 @@ discard block |
||
| 932 | 932 | row("External IP address", "$host->external_ip_addr<br>"); |
| 933 | 933 | row("Domain name", $host->domain_name); |
| 934 | 934 | $x = $host->timezone/3600; |
| 935 | - if ($x >= 0) $x="+$x"; |
|
| 935 | + if ($x >= 0) $x = "+$x"; |
|
| 936 | 936 | row("Local Standard Time", "UTC $x hours"); |
| 937 | 937 | row("Number of CPUs", $host->p_ncpus); |
| 938 | 938 | row("CPU", "$host->p_vendor $host->p_model"); |
@@ -987,7 +987,7 @@ discard block |
||
| 987 | 987 | row("Last time modified", mysqltime_str($wu->mod_time)); |
| 988 | 988 | row("Name", $wu->name); |
| 989 | 989 | row("XML doc", "<pre>".htmlspecialchars($wu->xml_doc)."</pre>"); |
| 990 | - row("Application", "<a href=\"db_action.php?table=app&id=$wu->appid\">" . app_name_by_id($wu->appid) . " [".$wu->appid."]</a>"); |
|
| 990 | + row("Application", "<a href=\"db_action.php?table=app&id=$wu->appid\">".app_name_by_id($wu->appid)." [".$wu->appid."]</a>"); |
|
| 991 | 991 | row("Application version number", $wu->app_version_num); |
| 992 | 992 | row("Batch", $wu->batch); |
| 993 | 993 | $x = number_format($wu->rsc_fpops_est/1e9, 2); |
@@ -1000,12 +1000,12 @@ discard block |
||
| 1000 | 1000 | $x = $wu->rsc_disk_bound/(1024*1024); |
| 1001 | 1001 | $y = number_format($x, 2); |
| 1002 | 1002 | row("Max Disk Usage", "$y MB"); |
| 1003 | - row("Need validate?", ($wu->need_validate?"yes [":"no [").$wu->need_validate."]"); |
|
| 1003 | + row("Need validate?", ($wu->need_validate ? "yes [" : "no [").$wu->need_validate."]"); |
|
| 1004 | 1004 | row("Canonical resultid", |
| 1005 | 1005 | "<a href=\"db_action.php?table=result&id=$wu->canonical_resultid\">".$wu->canonical_resultid."</a>"); |
| 1006 | 1006 | row("Canonical credit", $wu->canonical_credit); |
| 1007 | 1007 | //row("Timeout check time", time_str($wu->timeout_check_time)); |
| 1008 | - row("Delay bound", "$wu->delay_bound" . " = " . time_diff($wu->delay_bound) ); |
|
| 1008 | + row("Delay bound", "$wu->delay_bound"." = ".time_diff($wu->delay_bound)); |
|
| 1009 | 1009 | row("Error mask", wu_error_mask_str($wu->error_mask, true)); |
| 1010 | 1010 | row("File delete state", file_delete_state_str($wu->file_delete_state)." [".$wu->file_delete_state."]"); |
| 1011 | 1011 | row("Assimilation state", assimilate_state_str($wu->assimilate_state)." [".$wu->assimilate_state."]"); |
@@ -1015,7 +1015,7 @@ discard block |
||
| 1015 | 1015 | row("max error results", $wu->max_error_results); |
| 1016 | 1016 | row("max total results", $wu->max_total_results); |
| 1017 | 1017 | row("max success results", $wu->max_success_results); |
| 1018 | - row("result template file",$wu->result_template_file); |
|
| 1018 | + row("result template file", $wu->result_template_file); |
|
| 1019 | 1019 | row("hr_class", $wu->hr_class); |
| 1020 | 1020 | row("opaque", $wu->opaque); |
| 1021 | 1021 | row("Priority", $wu->priority); |
@@ -1093,7 +1093,7 @@ discard block |
||
| 1093 | 1093 | } |
| 1094 | 1094 | |
| 1095 | 1095 | function outcome_color($outcome) { |
| 1096 | - switch($outcome) { |
|
| 1096 | + switch ($outcome) { |
|
| 1097 | 1097 | case 0: return '9900cc'; // "Init", purple |
| 1098 | 1098 | case 1: return '33cc33'; // "Success", green |
| 1099 | 1099 | case 3: return 'ff3333'; // "Client error", red |
@@ -1122,16 +1122,16 @@ discard block |
||
| 1122 | 1122 | row("Received", time_str($result->received_time)); |
| 1123 | 1123 | row("Last time modified", mysqltime_str($result->mod_time)); |
| 1124 | 1124 | row("Name", $result->name); |
| 1125 | - row("Workunit", "<a href=\"db_action.php?table=workunit&id=$result->workunitid\">" . wu_name_by_id($result->workunitid) . "</a> [$result->workunitid]" ); |
|
| 1125 | + row("Workunit", "<a href=\"db_action.php?table=workunit&id=$result->workunitid\">".wu_name_by_id($result->workunitid)."</a> [$result->workunitid]"); |
|
| 1126 | 1126 | row("Server state", result_server_state_string($result)." [$result->server_state]"); |
| 1127 | 1127 | row("Outcome", result_outcome_string($result)." [$result->outcome]"); |
| 1128 | 1128 | row("Client state", result_client_state_string($result)." [$result->client_state]"); |
| 1129 | 1129 | row("Exit status", exit_status_string($result->exit_status)); |
| 1130 | - row("Host ID", "<a href=\"db_action.php?table=host&id=$result->hostid\">" . host_name_by_id($result->hostid) . "</a> [$result->hostid]"); |
|
| 1131 | - row("User ID", "<a href=\"db_action.php?table=user&id=$result->userid\">" . user_name_by_id($result->userid) . "</a> [$result->userid]"); |
|
| 1130 | + row("Host ID", "<a href=\"db_action.php?table=host&id=$result->hostid\">".host_name_by_id($result->hostid)."</a> [$result->hostid]"); |
|
| 1131 | + row("User ID", "<a href=\"db_action.php?table=user&id=$result->userid\">".user_name_by_id($result->userid)."</a> [$result->userid]"); |
|
| 1132 | 1132 | row("CPU time", $result->cpu_time); |
| 1133 | 1133 | row("Elapsed time", $result->elapsed_time); |
| 1134 | - if($error=stderr_error_string($result->stderr_out)) { |
|
| 1134 | + if ($error = stderr_error_string($result->stderr_out)) { |
|
| 1135 | 1135 | row("error in stderr out", $error); |
| 1136 | 1136 | } |
| 1137 | 1137 | row("Batch", $result->batch); |
@@ -1148,16 +1148,16 @@ discard block |
||
| 1148 | 1148 | row("App version", $x1.app_version_string($result).$x2); |
| 1149 | 1149 | row("App version ID", $result->app_version_id); |
| 1150 | 1150 | row("Estimated GFLOPS", number_format($result->flops_estimate/1e9, 2)); |
| 1151 | - row("Random",$result->random); |
|
| 1152 | - row("Opaque",$result->opaque); |
|
| 1153 | - row("Teamid",$result->teamid); |
|
| 1154 | - row("Priority",$result->priority); |
|
| 1151 | + row("Random", $result->random); |
|
| 1152 | + row("Opaque", $result->opaque); |
|
| 1153 | + row("Teamid", $result->teamid); |
|
| 1154 | + row("Priority", $result->priority); |
|
| 1155 | 1155 | row("XML doc in", "<pre>".htmlspecialchars($result->xml_doc_in)."</pre>"); |
| 1156 | 1156 | row("XML doc out", "<pre>".htmlspecialchars($result->xml_doc_out)."</pre>"); |
| 1157 | 1157 | row("stderr out", "<pre>" |
| 1158 | 1158 | .htmlspecialchars( |
| 1159 | 1159 | $result->stderr_out, |
| 1160 | - ENT_QUOTES | (defined('ENT_SUBSTITUTE')?ENT_SUBSTITUTE:0), |
|
| 1160 | + ENT_QUOTES|(defined('ENT_SUBSTITUTE') ?ENT_SUBSTITUTE:0), |
|
| 1161 | 1161 | 'utf-8' |
| 1162 | 1162 | ) |
| 1163 | 1163 | ."</pre>" |
@@ -1205,23 +1205,23 @@ discard block |
||
| 1205 | 1205 | } else { |
| 1206 | 1206 | // result has not been received yet, so show report deadline either |
| 1207 | 1207 | // in green if in the future or in red if in the past. |
| 1208 | - $timenow=time(); |
|
| 1209 | - if ($result->report_deadline==0) { |
|
| 1208 | + $timenow = time(); |
|
| 1209 | + if ($result->report_deadline == 0) { |
|
| 1210 | 1210 | // not sent -- show create time in purple |
| 1211 | - $received = "<font color=\"9900cc\">". time_str($result->create_time) . "</font>"; |
|
| 1212 | - } else if ($result->report_deadline>=$timenow) { |
|
| 1211 | + $received = "<font color=\"9900cc\">".time_str($result->create_time)."</font>"; |
|
| 1212 | + } else if ($result->report_deadline >= $timenow) { |
|
| 1213 | 1213 | // overdue -- show deadline in red |
| 1214 | - $received = "<font color=\"#33cc33\">". time_str($result->report_deadline) . "</font>"; |
|
| 1214 | + $received = "<font color=\"#33cc33\">".time_str($result->report_deadline)."</font>"; |
|
| 1215 | 1215 | } else { |
| 1216 | 1216 | // in progress and not overdue -- show deadline in green |
| 1217 | - $received = "<font color=\"#ff3333\">". time_str($result->report_deadline) . "</font>"; |
|
| 1217 | + $received = "<font color=\"#ff3333\">".time_str($result->report_deadline)."</font>"; |
|
| 1218 | 1218 | } |
| 1219 | 1219 | } |
| 1220 | 1220 | $version = app_version_string($result)." (<a href=\"db_action.php?table=app_version&id=$result->app_version_id\">$result->app_version_id</a>)"; |
| 1221 | 1221 | $outcome_color = outcome_color($result->outcome); |
| 1222 | 1222 | $validate_color = validate_color($result->validate_state); |
| 1223 | 1223 | $host_user = host_user_link($result->hostid); |
| 1224 | - $cpu_hours = sprintf("%.1f",$result->cpu_time / 3600); |
|
| 1224 | + $cpu_hours = sprintf("%.1f", $result->cpu_time/3600); |
|
| 1225 | 1225 | $granted_credit = "<a href=credit.php?wu_id=$result->workunitid>".credit_str($result->granted_credit)."</a>"; |
| 1226 | 1226 | $delete_state = file_delete_state_str($result->file_delete_state); |
| 1227 | 1227 | |
@@ -1249,7 +1249,7 @@ discard block |
||
| 1249 | 1249 | row("ID", $user->id); |
| 1250 | 1250 | row("Created", time_str($user->create_time)); |
| 1251 | 1251 | row("Name", $user->name); |
| 1252 | - if(!in_rops()) { |
|
| 1252 | + if (!in_rops()) { |
|
| 1253 | 1253 | row("Authenticator", $user->authenticator); |
| 1254 | 1254 | } |
| 1255 | 1255 | row("Email address", $user->email_addr); |
@@ -1264,7 +1264,7 @@ discard block |
||
| 1264 | 1264 | row("Default venue", $user->venue); |
| 1265 | 1265 | row("Hosts", "<a href=\"db_action.php?table=host&userid=$user->id&detail=low\">click</a>"); |
| 1266 | 1266 | row("Cross project ID", $user->cross_project_id); |
| 1267 | - if(!in_rops()) { |
|
| 1267 | + if (!in_rops()) { |
|
| 1268 | 1268 | row("Password Hash", $user->passwd_hash); |
| 1269 | 1269 | } |
| 1270 | 1270 | row("Donated", $user->donated); |
@@ -1315,7 +1315,7 @@ discard block |
||
| 1315 | 1315 | echo "</table></td>"; |
| 1316 | 1316 | echo "<td><table border=\"2\">\n"; |
| 1317 | 1317 | echo "<tr><th>User</th><th># posts</th></tr>\n"; |
| 1318 | - for ($p=1; $p<=10; $p++) { |
|
| 1318 | + for ($p = 1; $p <= 10; $p++) { |
|
| 1319 | 1319 | row2_plain(user_links_ops($top10poster[$p]), $top10poster[$p]->posts); |
| 1320 | 1320 | } |
| 1321 | 1321 | echo "</table></td>"; |
@@ -1354,10 +1354,10 @@ discard block |
||
| 1354 | 1354 | function admin_show_team($team) { |
| 1355 | 1355 | start_table(); |
| 1356 | 1356 | row("ID", $team->id); |
| 1357 | - row("Team Founder", "<a href=\"db_action.php?table=user&id=$team->userid\">" . user_name_by_id($team->userid) . "</a>"); |
|
| 1357 | + row("Team Founder", "<a href=\"db_action.php?table=user&id=$team->userid\">".user_name_by_id($team->userid)."</a>"); |
|
| 1358 | 1358 | row("Name", $team->name); |
| 1359 | - row("Name (HTML Formatted)", "<pre>" . htmlspecialchars($team->name_html) . "</pre>" ); |
|
| 1360 | - row("Url", "<a href=\"http://$team->url\">" . $team->url . "</a>"); |
|
| 1359 | + row("Name (HTML Formatted)", "<pre>".htmlspecialchars($team->name_html)."</pre>"); |
|
| 1360 | + row("Url", "<a href=\"http://$team->url\">".$team->url."</a>"); |
|
| 1361 | 1361 | row("Type", team_type_string($team->type)); |
| 1362 | 1362 | row("Description", $team->description); |
| 1363 | 1363 | row("", "<a href=\"db_action.php?table=user&teamid=$team->id\">List All Members</a>"); |
@@ -1400,7 +1400,7 @@ discard block |
||
| 1400 | 1400 | if (!strlen($host->domain_name) && !strlen($host->last_ip_addr)) { |
| 1401 | 1401 | return "(blank)"; |
| 1402 | 1402 | } else { |
| 1403 | - return $host->domain_name . " (" . $host->last_ip_addr . ")"; |
|
| 1403 | + return $host->domain_name." (".$host->last_ip_addr.")"; |
|
| 1404 | 1404 | } |
| 1405 | 1405 | } |
| 1406 | 1406 | |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | return $x; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | -function pm_team_form($user, $teamid, $error=null) { |
|
| 54 | +function pm_team_form($user, $teamid, $error = null) { |
|
| 55 | 55 | global $bbcode_html, $bbcode_js; |
| 56 | 56 | $team = BoincTeam::lookup_id($teamid); |
| 57 | 57 | if (!$team) { |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | error_page("not admin"); |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - page_head(tra("Send message to team"),'','','', $bbcode_js); |
|
| 64 | + page_head(tra("Send message to team"), '', '', '', $bbcode_js); |
|
| 65 | 65 | |
| 66 | 66 | $subject = post_str("subject", true); |
| 67 | 67 | $content = post_str("content", true); |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | function pm_form_page($replyto, $userid, $error = null) { |
| 114 | 114 | global $bbcode_html, $bbcode_js; |
| 115 | 115 | global $g_logged_in_user; |
| 116 | - page_head(tra("Send private message"),'','','', $bbcode_js); |
|
| 116 | + page_head(tra("Send private message"), '', '', '', $bbcode_js); |
|
| 117 | 117 | |
| 118 | 118 | if (post_str("preview", true) == tra("Preview")) { |
| 119 | 119 | $content = post_str("content", true); |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | if (!$user) { |
| 138 | 138 | error_page("Sender no longer exists"); |
| 139 | 139 | } |
| 140 | - $writeto = UNIQUE_USER_NAME?$user->name:$userid." (".$user->name.")"; |
|
| 140 | + $writeto = UNIQUE_USER_NAME ? $user->name : $userid." (".$user->name.")"; |
|
| 141 | 141 | $subject = $message->subject; |
| 142 | 142 | if (substr($subject, 0, 3) != "re:") { |
| 143 | 143 | $subject = "re: ".$subject; |
@@ -156,15 +156,15 @@ discard block |
||
| 156 | 156 | time_str($user->prefs->banished_until) |
| 157 | 157 | ); |
| 158 | 158 | } |
| 159 | - $writeto = UNIQUE_USER_NAME?$user->name:$userid." (".$user->name.")"; |
|
| 159 | + $writeto = UNIQUE_USER_NAME ? $user->name : $userid." (".$user->name.")"; |
|
| 160 | 160 | } else { |
| 161 | 161 | $writeto = sanitize_tags(post_str("to", true)); |
| 162 | 162 | $subject = post_str("subject", true); |
| 163 | 163 | $content = post_str("content", true); |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - $content = $content?htmlspecialchars($content):''; |
|
| 167 | - $subject = $subject?htmlspecialchars($subject):''; |
|
| 166 | + $content = $content ?htmlspecialchars($content) : ''; |
|
| 167 | + $subject = $subject ?htmlspecialchars($subject) : ''; |
|
| 168 | 168 | |
| 169 | 169 | if ($error != null) { |
| 170 | 170 | echo "<p class=\"text-danger\">".$error."</p>\n"; |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | function send_pm_notification_email( |
| 221 | 221 | $logged_in_user, $to_user, $subject, $content |
| 222 | 222 | ) { |
| 223 | - $message = " |
|
| 223 | + $message = " |
|
| 224 | 224 | You have received a new private message at ".PROJECT.". |
| 225 | 225 | |
| 226 | 226 | From: $logged_in_user->name (ID $logged_in_user->id) |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | $pm = BoincPrivateMessage::lookup_id($notify->opaque); |
| 251 | 251 | $from_user = BoincUser::lookup_id($pm->senderid); |
| 252 | 252 | if (!$pm || !$from_user) return null; |
| 253 | - return "<a href=pm.php>".tra("Private message%1 from %2, subject:" , "</a>", $from_user->name )." $pm->subject"; |
|
| 253 | + return "<a href=pm.php>".tra("Private message%1 from %2, subject:", "</a>", $from_user->name)." $pm->subject"; |
|
| 254 | 254 | } |
| 255 | 255 | |
| 256 | 256 | function pm_send_msg($from_user, $to_user, $subject, $content, $send_email) { |
@@ -314,11 +314,11 @@ discard block |
||
| 314 | 314 | |
| 315 | 315 | function pm_email_remind($user) { |
| 316 | 316 | if (!$user->prefs->pm_notification) { |
| 317 | - return "<br><small>" . |
|
| 317 | + return "<br><small>". |
|
| 318 | 318 | tra( |
| 319 | 319 | "For email notification, %1 edit community prefs %2", |
| 320 | 320 | '<a href="edit_forum_preferences_form.php">', '</a>' |
| 321 | - ) . |
|
| 321 | + ). |
|
| 322 | 322 | "</small>" |
| 323 | 323 | ; |
| 324 | 324 | } |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | page_tail(); |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | -function list_files($user, $notice=null) { |
|
| 87 | +function list_files($user, $notice = null) { |
|
| 88 | 88 | $dir = sandbox_dir($user); |
| 89 | 89 | if (!is_dir($dir)) error_page("Can't open sandbox directory"); |
| 90 | 90 | page_head("File sandbox"); |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | $notice = ""; |
| 169 | 169 | $dir = sandbox_dir($user); |
| 170 | 170 | $count = count($_FILES['new_file']['tmp_name']); |
| 171 | - for ($i=0; $i<$count; $i++) { |
|
| 171 | + for ($i = 0; $i < $count; $i++) { |
|
| 172 | 172 | $tmp_name = $_FILES['new_file']['tmp_name'][$i]; |
| 173 | 173 | if (!is_uploaded_file($tmp_name)) { |
| 174 | 174 | error_page("$tmp_name is not uploaded file"); |
@@ -45,14 +45,14 @@ discard block |
||
| 45 | 45 | //define("STYLESHEET", "aaa.css"); |
| 46 | 46 | //define("STYLESHEET2", "bbb.css"); |
| 47 | 47 | //define("SHORTCUT_ICON", "f.gif"); // browser tab icon |
| 48 | -define('DARK_MODE', true); // enable dark mode if selected by user |
|
| 48 | +define('DARK_MODE', true); // enable dark mode if selected by user |
|
| 49 | 49 | |
| 50 | 50 | //-------------- enable/disable web features |
| 51 | 51 | |
| 52 | 52 | define('UNIQUE_USER_NAME', true); |
| 53 | 53 | define("FORUM_QA_MERGED_MODE", true); |
| 54 | 54 | // Set to true to merge Message boards and Q&A section |
| 55 | -define ("DISABLE_PROFILES", true); |
|
| 55 | +define("DISABLE_PROFILES", true); |
|
| 56 | 56 | // enable profiles only after enabling reCAPTCHA |
| 57 | 57 | // https://github.com/BOINC/boinc/wiki/ProtectionFromSpam |
| 58 | 58 | define("USE_STOPFORUMSPAM", true); |
@@ -193,15 +193,15 @@ discard block |
||
| 193 | 193 | </ol>", PROJECT); |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | -function project_workunit($wu){ |
|
| 196 | +function project_workunit($wu) { |
|
| 197 | 197 | // shown in the workunit page |
| 198 | 198 | } |
| 199 | 199 | |
| 200 | -function project_user_summary($user){ |
|
| 200 | +function project_user_summary($user) { |
|
| 201 | 201 | // shown in the user summary page |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | -function project_user_page_private($user){ |
|
| 204 | +function project_user_page_private($user) { |
|
| 205 | 205 | // shown in the private account page |
| 206 | 206 | } |
| 207 | 207 | |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | array("name" => "Uppercase", "short_name" => "UC", "appids" => array(1, 25)), |
| 285 | 285 | ); |
| 286 | 286 | |
| 287 | -function project_user_credit($user){ |
|
| 287 | +function project_user_credit($user) { |
|
| 288 | 288 | global $sub_projects; |
| 289 | 289 | foreach ($sub_projects as $sp) { |
| 290 | 290 | show_app_credit_user($user, $sp["name"], $sp["appids"]); |
@@ -53,9 +53,9 @@ discard block |
||
| 53 | 53 | return $platforms[$id]; |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | -function anon_platform_string($result, $rsc_name=null) { |
|
| 56 | +function anon_platform_string($result, $rsc_name = null) { |
|
| 57 | 57 | $app = get_app($result->appid); |
| 58 | - $n = $app->user_friendly_name."<br>". tra("Anonymous platform"); |
|
| 58 | + $n = $app->user_friendly_name."<br>".tra("Anonymous platform"); |
|
| 59 | 59 | if ($rsc_name) { |
| 60 | 60 | $n .= " ($rsc_name)"; |
| 61 | 61 | } |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | return $string_to_show; |
| 103 | 103 | } |
| 104 | 104 | if ($result->server_state <> RESULT_SERVER_STATE_OVER) return "---"; |
| 105 | - switch($result->outcome) { |
|
| 105 | + switch ($result->outcome) { |
|
| 106 | 106 | case RESULT_OUTCOME_SUCCESS: |
| 107 | 107 | switch ($result->validate_state) { |
| 108 | 108 | case VALIDATE_STATE_INIT: |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | ) { |
| 241 | 241 | return tra("Not started by deadline - canceled"); |
| 242 | 242 | } |
| 243 | - switch($result->client_state) { |
|
| 243 | + switch ($result->client_state) { |
|
| 244 | 244 | case RESULT_FILES_DOWNLOADING: return tra("Error while downloading"); |
| 245 | 245 | case RESULT_FILES_DOWNLOADED: |
| 246 | 246 | case RESULT_COMPUTE_ERROR: return tra("Error while computing"); |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | function result_server_state_string($result) { |
| 262 | - switch($result->server_state) { |
|
| 262 | + switch ($result->server_state) { |
|
| 263 | 263 | case RESULT_SERVER_STATE_INACTIVE: return tra("Inactive"); |
| 264 | 264 | case RESULT_SERVER_STATE_UNSENT: return tra("Unsent"); |
| 265 | 265 | case RESULT_SERVER_STATE_IN_PROGRESS: return tra("In progress"); |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | function result_outcome_string($result) { |
| 272 | - switch($result->outcome) { |
|
| 272 | + switch ($result->outcome) { |
|
| 273 | 273 | case RESULT_OUTCOME_INIT: return "---"; |
| 274 | 274 | case RESULT_OUTCOME_SUCCESS: return tra("Success"); |
| 275 | 275 | case RESULT_OUTCOME_COULDNT_SEND: return tra("Couldn't send"); |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | function result_client_state_string($result) { |
| 290 | - switch($result->client_state) { |
|
| 290 | + switch ($result->client_state) { |
|
| 291 | 291 | case RESULT_NEW: return tra("New"); |
| 292 | 292 | case RESULT_FILES_DOWNLOADING: return tra("Downloading"); |
| 293 | 293 | case RESULT_FILES_DOWNLOADED: return tra("Processing"); |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | } |
| 306 | 306 | |
| 307 | 307 | function validate_state_str($result) { |
| 308 | - switch($result->validate_state) { |
|
| 308 | + switch ($result->validate_state) { |
|
| 309 | 309 | case VALIDATE_STATE_INIT: return tra("Initial"); |
| 310 | 310 | case VALIDATE_STATE_VALID: return tra("Valid"); |
| 311 | 311 | case VALIDATE_STATE_INVALID: |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | } |
| 322 | 322 | |
| 323 | 323 | function assimilate_state_str($s) { |
| 324 | - switch($s) { |
|
| 324 | + switch ($s) { |
|
| 325 | 325 | case ASSIMILATE_INIT: return "Initial"; |
| 326 | 326 | case ASSIMILATE_READY: return "Ready to assimilate"; |
| 327 | 327 | case ASSIMILATE_DONE: return "Assimilated"; |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | } |
| 331 | 331 | |
| 332 | 332 | function file_delete_state_str($s) { |
| 333 | - switch($s) { |
|
| 333 | + switch ($s) { |
|
| 334 | 334 | case FILE_DELETE_INIT: return "Initial"; |
| 335 | 335 | case FILE_DELETE_READY: return "Ready to delete"; |
| 336 | 336 | case FILE_DELETE_DONE: return "Deleted"; |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | // convert WU error bitmask to str. |
| 343 | 343 | // If $color, add HTML red color |
| 344 | 344 | // |
| 345 | -function wu_error_mask_str($s, $color=false) { |
|
| 345 | +function wu_error_mask_str($s, $color = false) { |
|
| 346 | 346 | $x = ""; |
| 347 | 347 | if ($s & WU_ERROR_COULDNT_SEND_RESULT) { |
| 348 | 348 | $x = $x." ".tra("Couldn't send result"); |
@@ -456,10 +456,10 @@ discard block |
||
| 456 | 456 | if ($result->received_time) { |
| 457 | 457 | $r = time_str($result->received_time); |
| 458 | 458 | } else if ($result->report_deadline) { |
| 459 | - if ($result->report_deadline>time()) { |
|
| 460 | - $r = "<font color='#33cc33'>" . time_str($result->report_deadline) . "</font>"; |
|
| 459 | + if ($result->report_deadline > time()) { |
|
| 460 | + $r = "<font color='#33cc33'>".time_str($result->report_deadline)."</font>"; |
|
| 461 | 461 | } else { |
| 462 | - $r = "<font color='#ff3333'>" . time_str($result->report_deadline) . "</font>"; |
|
| 462 | + $r = "<font color='#ff3333'>".time_str($result->report_deadline)."</font>"; |
|
| 463 | 463 | } |
| 464 | 464 | } else { |
| 465 | 465 | $r = "---"; |
@@ -520,7 +520,7 @@ discard block |
||
| 520 | 520 | // @param Integer $dec A signed integer |
| 521 | 521 | // |
| 522 | 522 | function int2hex($dec) { |
| 523 | - return "0x".strtoupper(substr(sprintf("%08x",$dec), -8)); |
|
| 523 | + return "0x".strtoupper(substr(sprintf("%08x", $dec), -8)); |
|
| 524 | 524 | } |
| 525 | 525 | |
| 526 | 526 | // Decode a windows error number into semi-human-readable, |
@@ -530,9 +530,9 @@ discard block |
||
| 530 | 530 | // @return String A human readable error message |
| 531 | 531 | // @param Integer $x An error number |
| 532 | 532 | // |
| 533 | -function windows_error_code_str($x){ |
|
| 534 | - $h=int2hex($x); |
|
| 535 | - switch($h){ |
|
| 533 | +function windows_error_code_str($x) { |
|
| 534 | + $h = int2hex($x); |
|
| 535 | + switch ($h) { |
|
| 536 | 536 | case "0xC0000005": return "STATUS_ACCESS_VIOLATION"; |
| 537 | 537 | case "0xC000001D": return "STATUS_ILLEGAL_INSTRUCTION"; |
| 538 | 538 | case "0xC0000094": return "STATUS_INTEGER_DIVIDE_BY_ZERO"; |
@@ -553,10 +553,10 @@ discard block |
||
| 553 | 553 | // @return String A human readable error message |
| 554 | 554 | // @param Integer $x An error number |
| 555 | 555 | // |
| 556 | -function error_code_str($x){ |
|
| 556 | +function error_code_str($x) { |
|
| 557 | 557 | // severe Windows error numbers are always large negative integers |
| 558 | - if ($x<-400) return windows_error_code_str($x); |
|
| 559 | - switch($x){ |
|
| 558 | + if ($x < -400) return windows_error_code_str($x); |
|
| 559 | + switch ($x) { |
|
| 560 | 560 | case 0: return ""; |
| 561 | 561 | case 192: return "EXIT_STATEFILE_WRITE"; |
| 562 | 562 | case 193: return "EXIT_SIGNAL"; |
@@ -717,7 +717,7 @@ discard block |
||
| 717 | 717 | return $x." (".int2hex($x).") ".error_code_str($x); |
| 718 | 718 | } |
| 719 | 719 | |
| 720 | -function show_result($result, $show_outfile_links=false) { |
|
| 720 | +function show_result($result, $show_outfile_links = false) { |
|
| 721 | 721 | start_table(); |
| 722 | 722 | row2(tra("Name"), $result->name); |
| 723 | 723 | row2(tra("Workunit"), "<a href=\"workunit.php?wuid=$result->workunitid\">$result->workunitid</a>"); |
@@ -769,7 +769,7 @@ discard block |
||
| 769 | 769 | echo "<h3>".tra("Stderr output")."</h3> <pre>" |
| 770 | 770 | .htmlspecialchars( |
| 771 | 771 | $result->stderr_out, |
| 772 | - ENT_QUOTES | (defined('ENT_SUBSTITUTE')?ENT_SUBSTITUTE:0), |
|
| 772 | + ENT_QUOTES|(defined('ENT_SUBSTITUTE') ?ENT_SUBSTITUTE:0), |
|
| 773 | 773 | 'utf-8' |
| 774 | 774 | ) |
| 775 | 775 | ."</pre>" |
@@ -785,7 +785,7 @@ discard block |
||
| 785 | 785 | |
| 786 | 786 | $apps = BoincApp::enum('deprecated=0 ORDER BY user_friendly_name'); |
| 787 | 787 | |
| 788 | - for ($i=0; $i<NSTATES; $i++) { |
|
| 788 | + for ($i = 0; $i < NSTATES; $i++) { |
|
| 789 | 789 | $state_count[$i] = 0; |
| 790 | 790 | } |
| 791 | 791 | foreach ($apps as $app) { |
@@ -828,7 +828,7 @@ discard block |
||
| 828 | 828 | $x .= "<a href=$url>".tra("Next")." ".$info->results_per_page."</a>"; |
| 829 | 829 | } |
| 830 | 830 | $x .= "<br>".tra("State").": "; |
| 831 | - for ($i=0; $i<NSTATES; $i++) { |
|
| 831 | + for ($i = 0; $i < NSTATES; $i++) { |
|
| 832 | 832 | if ($i) $x .= " · "; |
| 833 | 833 | if ($info->state == $i) { |
| 834 | 834 | $x .= $state_name[$i]; |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | $desc->long_name, |
| 38 | 38 | $desc->description, |
| 39 | 39 | kw_array_to_str($desc->sci_kw), |
| 40 | - empty($desc->url)?'':"<a href=$desc->url>View</a>", |
|
| 40 | + empty($desc->url) ? '' : "<a href=$desc->url>View</a>", |
|
| 41 | 41 | 'Yes' |
| 42 | 42 | ); |
| 43 | 43 | } |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | $host = BoincHost::lookup_id($res->hostid); |
| 36 | 36 | $hosts[$res->hostid] = $host; |
| 37 | 37 | } |
| 38 | - $fpops = $res->cpu_time * $host->p_fpops; |
|
| 38 | + $fpops = $res->cpu_time*$host->p_fpops; |
|
| 39 | 39 | $samples[] = $res->cpu_time; |
| 40 | 40 | //$fpops /= 1e9; |
| 41 | 41 | //echo "$res->cpu_time $fpops\n"; |
@@ -45,11 +45,11 @@ discard block |
||
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | function show($samples) { |
| 48 | - $x = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]; |
|
| 48 | + $x = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; |
|
| 49 | 49 | foreach ($samples as $s) { |
| 50 | 50 | $x[(int)log10($s)] += 1; |
| 51 | 51 | } |
| 52 | - for ($i=0; $i<16; $i++) { |
|
| 52 | + for ($i = 0; $i < 16; $i++) { |
|
| 53 | 53 | echo sprintf("%d: %d\n", $i, $x[$i]); |
| 54 | 54 | } |
| 55 | 55 | } |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | $user_submit = BoincUserSubmit::lookup_userid($user->id); |
| 159 | 159 | if (!$user_submit) return null; |
| 160 | 160 | $a = array(); |
| 161 | - foreach($apps as $app) { |
|
| 161 | + foreach ($apps as $app) { |
|
| 162 | 162 | if ($user_submit->submit_all) { |
| 163 | 163 | $a[] = $app; |
| 164 | 164 | } else { |
@@ -235,9 +235,9 @@ discard block |
||
| 235 | 235 | $input_url = get_str('input_url'); |
| 236 | 236 | if (!$input_url) error_page("missing input URL"); |
| 237 | 237 | $param_lo = (double)get_str('param_lo'); |
| 238 | - if ($param_lo<0 || $param_lo>60) error_page("param lo must be in 0..60"); |
|
| 238 | + if ($param_lo < 0 || $param_lo > 60) error_page("param lo must be in 0..60"); |
|
| 239 | 239 | $param_hi = (double)get_str('param_hi'); |
| 240 | - if ($param_hi<0 || $param_hi>60 || $param_hi <= $param_lo) { |
|
| 240 | + if ($param_hi < 0 || $param_hi > 60 || $param_hi <= $param_lo) { |
|
| 241 | 241 | error_page("param hi must be in 0..60 and > param lo"); |
| 242 | 242 | } |
| 243 | 243 | $param_inc = (double)get_str('param_inc'); |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | $f->source = $input_url; |
| 255 | 255 | $f->mode = 'semilocal'; |
| 256 | 256 | |
| 257 | - for ($x=$param_lo; $x<$param_hi; $x += $param_inc) { |
|
| 257 | + for ($x = $param_lo; $x < $param_hi; $x += $param_inc) { |
|
| 258 | 258 | $job = new StdClass; |
| 259 | 259 | $job->rsc_fpops_est = $x*1e9; |
| 260 | 260 | $job->command_line = "--t $x"; |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | "status", |
| 344 | 344 | "Canonical instance<br><p class=\"text-muted\">click to see result page on BOINC server</p>" |
| 345 | 345 | ); |
| 346 | - foreach($batch->jobs as $job) { |
|
| 346 | + foreach ($batch->jobs as $job) { |
|
| 347 | 347 | $id = (int)$job->id; |
| 348 | 348 | $resultid = (int)$job->canonical_instance_id; |
| 349 | 349 | if ($resultid) { |
@@ -386,7 +386,7 @@ discard block |
||
| 386 | 386 | "Instance ID<br><p class=\"text-muted\">click for result page on BOINC server</p>", |
| 387 | 387 | "State", "Output files" |
| 388 | 388 | ); |
| 389 | - foreach($reply->instances as $inst) { |
|
| 389 | + foreach ($reply->instances as $inst) { |
|
| 390 | 390 | echo "<tr> |
| 391 | 391 | <td><a href=result.php?resultid=$inst->id>$inst->id</a></td> |
| 392 | 392 | <td>$inst->state</td> |
@@ -31,7 +31,7 @@ |
||
| 31 | 31 | function reg_form() { |
| 32 | 32 | $config = get_config(); |
| 33 | 33 | $disable_acct = parse_bool($config, "disable_account_creation"); |
| 34 | - page_head("Register", null, null, null, boinc_recaptcha_get_head_extra()); |
|
| 34 | + page_head("Register", null, null, null, boinc_recaptcha_get_head_extra()); |
|
| 35 | 35 | echo "<h3>Create an account</h3>"; |
| 36 | 36 | form_start("create_account_action.php", "post"); |
| 37 | 37 | create_account_form(0, "download_software.php"); |