@@ -308,9 +308,9 @@ discard block |
||
308 | 308 | $value=null; |
309 | 309 | } |
310 | 310 | if (isset($_GET[$order])) { |
311 | - $order = $_GET[$order]; |
|
311 | + $order = $_GET[$order]; |
|
312 | 312 | } else { |
313 | - $order = null; |
|
313 | + $order = null; |
|
314 | 314 | } |
315 | 315 | if ($value) { |
316 | 316 | if ($order == 'asc') { |
@@ -1086,8 +1086,8 @@ discard block |
||
1086 | 1086 | |
1087 | 1087 | function validate_color($validate_state) { |
1088 | 1088 | switch ($validate_state) { |
1089 | - case 1: return '33cc33'; // valid, green |
|
1090 | - case 2: return 'ffa500'; // invalid result, orange |
|
1089 | + case 1: return '33cc33'; // valid, green |
|
1090 | + case 2: return 'ffa500'; // invalid result, orange |
|
1091 | 1091 | } |
1092 | 1092 | return ''; |
1093 | 1093 | } |
@@ -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 |
@@ -379,7 +379,8 @@ discard block |
||
379 | 379 | |
380 | 380 | |
381 | 381 | function link_results($n, $mq, $query, $clauses) { |
382 | - if ($n == '0') { // intentional compare by string |
|
382 | + if ($n == '0') { |
|
383 | +// intentional compare by string |
|
383 | 384 | return "0"; |
384 | 385 | } else { |
385 | 386 | if(strlen($clauses)) { |
@@ -395,7 +396,7 @@ discard block |
||
395 | 396 | // @return String A human readable string if error otherwise FALSE |
396 | 397 | // @param String $stderr_out the stderr_out value to parse |
397 | 398 | // |
398 | -function stderr_error_string($stderr_out){ |
|
399 | +function stderr_error_string($stderr_out) { |
|
399 | 400 | $y = parse_element($stderr_out, "<error_code>"); |
400 | 401 | $x = 0; |
401 | 402 | if ($y) { |
@@ -1206,7 +1207,7 @@ discard block |
||
1206 | 1207 | // result has not been received yet, so show report deadline either |
1207 | 1208 | // in green if in the future or in red if in the past. |
1208 | 1209 | $timenow=time(); |
1209 | - if ($result->report_deadline==0) { |
|
1210 | + if ($result->report_deadline==0) { |
|
1210 | 1211 | // not sent -- show create time in purple |
1211 | 1212 | $received = "<font color=\"9900cc\">". time_str($result->create_time) . "</font>"; |
1212 | 1213 | } else if ($result->report_deadline>=$timenow) { |