Passed
Push — dpa_admin2 ( 78687b )
by David
31:26 queued 20:11
created
html/inc/db_ops.inc 2 patches
Spacing   +102 added lines, -102 removed lines patch added patch discarded remove patch
@@ -40,22 +40,22 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
         }
388 388
         else {
@@ -396,13 +396,13 @@  discard block
 block discarded – undo
396 396
 // @return String A human readable string if error otherwise FALSE
397 397
 // @param String $stderr_out the stderr_out value to parse
398 398
 //
399
-function stderr_error_string($stderr_out){
399
+function stderr_error_string($stderr_out) {
400 400
     $y = parse_element($stderr_out, "<error_code>");
401 401
     $x = 0;
402 402
     if ($y) {
403 403
         $x = (int)$y;
404 404
     }
405
-    if (0<=$x && $x<=9) {
405
+    if (0 <= $x && $x <= 9) {
406 406
         return FALSE;
407 407
     } else {
408 408
         return "$x ".error_code_str($x);
@@ -410,8 +410,8 @@  discard block
 block discarded – undo
410 410
 }
411 411
 
412 412
 function admin_show_result_summary() {
413
-    $ntotal =0;     // TODO: how to count $result?
414
-    $nvalid = 0;    // for SUCCESS results
413
+    $ntotal = 0; // TODO: how to count $result?
414
+    $nvalid = 0; // for SUCCESS results
415 415
     $ninvalid = 0;
416 416
     $nfile_deleted = 0;
417 417
 
@@ -419,20 +419,20 @@  discard block
 block discarded – undo
419 419
     $outcome = array();
420 420
     $client_state = array();
421 421
 
422
-    for ($ss=1; $ss<6; $ss++) {
422
+    for ($ss = 1; $ss < 6; $ss++) {
423 423
         $server_state[$ss] = 0;
424 424
     }
425
-    for ($ro=0; $ro<8; $ro++) {
425
+    for ($ro = 0; $ro < 8; $ro++) {
426 426
         $outcome[$ro] = 0;
427 427
     }
428
-    for ($cs=1; $cs<7; $cs++) {
428
+    for ($cs = 1; $cs < 7; $cs++) {
429 429
         $client_state[$cs] = 0;
430 430
     }
431
-    for ($fds=0; $fds<4; $fds++) {
431
+    for ($fds = 0; $fds < 4; $fds++) {
432 432
         $delete_state[$fds] = 0;
433 433
     }
434
-    for ($vs=0; $vs<NVALIDATE_STATES; $vs++) {
435
-        $validate_state[$vs]=0;
434
+    for ($vs = 0; $vs < NVALIDATE_STATES; $vs++) {
435
+        $validate_state[$vs] = 0;
436 436
     }
437 437
 
438 438
     $_GET['table'] = 'result';
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
         //
508 508
         $delay = parse_config(get_config(), "<delete_delay_hours>");
509 509
         if ($delay) {
510
-            $start2 = $start - $delay*3600;;
510
+            $start2 = $start - $delay*3600; ;
511 511
             $main_query .= " and ((file_delete_state>1 and mod_time>FROM_UNIXTIME($start2)) or (mod_time>FROM_UNIXTIME($start)))";
512 512
         } else {
513 513
             $main_query .= " and mod_time > FROM_UNIXTIME($start)";
@@ -566,20 +566,20 @@  discard block
 block discarded – undo
566 566
 
567 567
     start_table();
568 568
     echo "<tr valign=\"top\">";
569
-    echo "<td><h2>" . link_results("$ntotal results", $urlquery, '', '') . "</h2></td>";
570
-    echo "<td><h2>" . link_results("'Over' results", $urlquery, "server_state=5", '') . "</h2></td>";
571
-    echo "<td><h2>" . link_results("'Success' results", $urlquery, "outcome=1", '') . "</h2></td>";
572
-    echo "<td><h2>" . link_results("'Client error' results", $urlquery, "outcome=3", '') . "</h2></td>";
569
+    echo "<td><h2>".link_results("$ntotal results", $urlquery, '', '')."</h2></td>";
570
+    echo "<td><h2>".link_results("'Over' results", $urlquery, "server_state=5", '')."</h2></td>";
571
+    echo "<td><h2>".link_results("'Success' results", $urlquery, "outcome=1", '')."</h2></td>";
572
+    echo "<td><h2>".link_results("'Client error' results", $urlquery, "outcome=3", '')."</h2></td>";
573 573
     echo "</tr>";
574 574
     echo "<tr valign=\"top\">";
575 575
     echo "<td>";
576 576
     start_table('table-striped');
577 577
     echo "<tr><th>Server state</th><th># results</th></tr>\n";
578
-    for ($ss=1; $ss<6; $ss++) {
578
+    for ($ss = 1; $ss < 6; $ss++) {
579 579
         $res = new StdClass;
580 580
         $res->server_state = $ss;
581 581
         row2(result_server_state_string($res),
582
-             link_results("$server_state[$ss]",  $urlquery,"server_state=$ss", '')
582
+             link_results("$server_state[$ss]", $urlquery, "server_state=$ss", '')
583 583
         );
584 584
     }
585 585
     end_table();
@@ -589,11 +589,11 @@  discard block
 block discarded – undo
589 589
     start_table('table-striped');
590 590
     echo "<tr><th>Outcome</th><th># results</th></tr>\n";
591 591
 
592
-    for ($ro=0; $ro<8; $ro++) {
592
+    for ($ro = 0; $ro < 8; $ro++) {
593 593
         $res = new StdClass;
594 594
         $res->outcome = $ro;
595 595
         $res->exit_status = 0;
596
-        c_row2($outcome[$ro]?outcome_color($ro):'', result_outcome_string($res),
596
+        c_row2($outcome[$ro] ?outcome_color($ro) : '', result_outcome_string($res),
597 597
             link_results("$outcome[$ro]", $urlquery, "outcome=$ro", '')
598 598
         );
599 599
     }
@@ -603,18 +603,18 @@  discard block
 block discarded – undo
603 603
     echo "<td>";
604 604
     start_table('table-striped');
605 605
     echo "<tr><th>Validate state</th><th># results</th></tr>\n";
606
-    for ($vs=0; $vs<NVALIDATE_STATES; $vs++) {
606
+    for ($vs = 0; $vs < NVALIDATE_STATES; $vs++) {
607 607
         $res = new StdClass;
608 608
         $res->validate_state = $vs;
609 609
         $res->exit_status = 0;
610
-        c_row2($validate_state[$vs]?validate_color($vs):'', validate_state_str($res),
610
+        c_row2($validate_state[$vs] ?validate_color($vs) : '', validate_state_str($res),
611 611
         link_results("$validate_state[$vs]", $urlquery, "validate_state=$vs", "outcome=1"));
612 612
     }
613 613
     end_table();
614 614
     start_table('table-striped');
615 615
     echo "<tr><th>File Delete state</th><th># results</th></tr>\n";
616 616
 
617
-    for ($fds=0; $fds<4; $fds++) {
617
+    for ($fds = 0; $fds < 4; $fds++) {
618 618
         row2(file_delete_state_str($fds),
619 619
         link_results("$file_delete[$fds]", $urlquery, "outcome=1", "file_delete_state=$fds"));
620 620
     }
@@ -626,7 +626,7 @@  discard block
 block discarded – undo
626 626
     echo "<td>";
627 627
     start_table('table-striped');
628 628
     echo "<tr><th>Client state</th><th># results</th></tr>\n";
629
-    for ($cs=1; $cs<7; $cs++) {
629
+    for ($cs = 1; $cs < 7; $cs++) {
630 630
         $res = new StdClass;
631 631
         $res->client_state = $cs;
632 632
         $res->exit_status = 0;
@@ -645,9 +645,9 @@  discard block
 block discarded – undo
645 645
         <select name=\"server_state\">
646 646
         <option value=\"CHOOSE_ALL\" selected=\"selected\"> Any </option>
647 647
     ";
648
-    for ($i=1; $i<6; $i++) {
648
+    for ($i = 1; $i < 6; $i++) {
649 649
         $res = new StdClass;
650
-        $res->server_state=$i;
650
+        $res->server_state = $i;
651 651
         echo "<option value=\"$i\"> "."[$i]&nbsp;&nbsp;".'   '.result_server_state_string($res)."</option>\n";
652 652
     }
653 653
     echo "</select>\n";
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
         <select name=\"outcome\">
659 659
         <option value=\"CHOOSE_ALL\" selected=\"selected\"> Any </option>
660 660
     ";
661
-    for ($i=0; $i<8; $i++) {
661
+    for ($i = 0; $i < 8; $i++) {
662 662
         $res = new StdClass;
663 663
         $res->outcome = $i;
664 664
         $res->exit_status = 0;
@@ -672,7 +672,7 @@  discard block
 block discarded – undo
672 672
         <select name=\"validate_state\">
673 673
         <option value=\"CHOOSE_ALL\" selected=\"selected\"> Any </option>
674 674
         ";
675
-    for ($vs=0; $vs<NVALIDATE_STATES; $vs++) {
675
+    for ($vs = 0; $vs < NVALIDATE_STATES; $vs++) {
676 676
         $res = new StdClass;
677 677
         $res->validate_state = $vs;
678 678
         $res->exit_status = 0;
@@ -686,7 +686,7 @@  discard block
 block discarded – undo
686 686
         <select name=\"client_state\">
687 687
         <option value=\"CHOOSE_ALL\" selected=\"selected\"> Any </option>
688 688
     ";
689
-    for ($i=0; $i<7; $i++) {
689
+    for ($i = 0; $i < 7; $i++) {
690 690
         $res = new StdClass;
691 691
         $res->client_state = $i;
692 692
         $res->exit_status = 0;
@@ -723,7 +723,7 @@  discard block
 block discarded – undo
723 723
 }
724 724
 
725 725
 function table_title($table) {
726
-    switch($table) {
726
+    switch ($table) {
727 727
     case "platform": return "Platforms";
728 728
     case "app": return "Applications";
729 729
     case "app_version": return "Application Versions";
@@ -743,7 +743,7 @@  discard block
 block discarded – undo
743 743
     row("Created", time_str($platform->create_time));
744 744
     row("Name", $platform->name);
745 745
     row("User friendly name", $platform->user_friendly_name);
746
-    row("","<a href=\"db_action.php?table=app_version&platformid=$platform->id\">App versions for this platform</a>");
746
+    row("", "<a href=\"db_action.php?table=app_version&platformid=$platform->id\">App versions for this platform</a>");
747 747
     end_table();
748 748
 }
749 749
 
@@ -755,8 +755,8 @@  discard block
 block discarded – undo
755 755
     row("User-friendly name", $app->user_friendly_name);
756 756
     row("Deprecated", $app->deprecated);
757 757
     row("Homogeneous redundancy", $app->homogeneous_redundancy);
758
-    row("","<a href=\"db_action.php?table=app_version&appid=$app->id\">App Versions for this application</a>");
759
-    row("","<a href=\"db_action.php?table=workunit&appid=$app->id&detail=low\">Workunits for this application</a>");
758
+    row("", "<a href=\"db_action.php?table=app_version&appid=$app->id\">App Versions for this application</a>");
759
+    row("", "<a href=\"db_action.php?table=workunit&appid=$app->id&detail=low\">Workunits for this application</a>");
760 760
     end_table();
761 761
 }
762 762
 
@@ -764,9 +764,9 @@  discard block
 block discarded – undo
764 764
     start_table();
765 765
     row("ID", $app_version->id);
766 766
     row("Created", time_str($app_version->create_time));
767
-    row("Application", "<a href=\"db_action.php?table=app&id=$app_version->appid\">" . app_name_by_id($app_version->appid) . "</a>");
767
+    row("Application", "<a href=\"db_action.php?table=app&id=$app_version->appid\">".app_name_by_id($app_version->appid)."</a>");
768 768
     row("Version num", $app_version->version_num);
769
-    row("Platform", "<a href=\"db_action.php?table=platform&id=$app_version->platformid\">" . platform_name_by_id($app_version->platformid) . "</a>" );
769
+    row("Platform", "<a href=\"db_action.php?table=platform&id=$app_version->platformid\">".platform_name_by_id($app_version->platformid)."</a>");
770 770
     row("Plan Class", $app_version->plan_class);
771 771
     row("XML doc", "<pre>".htmlspecialchars($app_version->xml_doc)."</pre>");
772 772
     row("min_core_version", $app_version->min_core_version);
@@ -900,7 +900,7 @@  discard block
 block discarded – undo
900 900
     row("External IP address", "$host->external_ip_addr<br>");
901 901
     row("Domain name", $host->domain_name);
902 902
     $x = $host->timezone/3600;
903
-    if ($x >= 0) $x="+$x";
903
+    if ($x >= 0) $x = "+$x";
904 904
     row("Local Standard Time", "UTC $x hours");
905 905
     row("Number of CPUs", $host->p_ncpus);
906 906
     row("CPU", "$host->p_vendor $host->p_model");
@@ -955,7 +955,7 @@  discard block
 block discarded – undo
955 955
     row("Last time modified", mysqltime_str($wu->mod_time));
956 956
     row("Name", $wu->name);
957 957
     row("XML doc", "<pre>".htmlspecialchars($wu->xml_doc)."</pre>");
958
-    row("Application", "<a href=\"db_action.php?table=app&id=$wu->appid\">" . app_name_by_id($wu->appid) . " [".$wu->appid."]</a>");
958
+    row("Application", "<a href=\"db_action.php?table=app&id=$wu->appid\">".app_name_by_id($wu->appid)." [".$wu->appid."]</a>");
959 959
     row("Application version number", $wu->app_version_num);
960 960
     row("Batch", $wu->batch);
961 961
     $x = number_format($wu->rsc_fpops_est/1e9, 2);
@@ -968,12 +968,12 @@  discard block
 block discarded – undo
968 968
     $x = $wu->rsc_disk_bound/(1024*1024);
969 969
     $y = number_format($x, 2);
970 970
     row("Max Disk Usage", "$y MB");
971
-    row("Need validate?", ($wu->need_validate?"yes [":"no [").$wu->need_validate."]");
971
+    row("Need validate?", ($wu->need_validate ? "yes [" : "no [").$wu->need_validate."]");
972 972
     row("Canonical resultid",
973 973
             "<a href=\"db_action.php?table=result&id=$wu->canonical_resultid\">".$wu->canonical_resultid."</a>");
974 974
     row("Canonical credit", $wu->canonical_credit);
975 975
     //row("Timeout check time", time_str($wu->timeout_check_time));
976
-    row("Delay bound", "$wu->delay_bound" . " =  " . time_diff($wu->delay_bound) );
976
+    row("Delay bound", "$wu->delay_bound"." =  ".time_diff($wu->delay_bound));
977 977
     row("Error mask", wu_error_mask_str($wu->error_mask, true));
978 978
     row("File delete state", file_delete_state_str($wu->file_delete_state)." [".$wu->file_delete_state."]");
979 979
     row("Assimilation state", assimilate_state_str($wu->assimilate_state)." [".$wu->assimilate_state."]");
@@ -983,7 +983,7 @@  discard block
 block discarded – undo
983 983
     row("max error results", $wu->max_error_results);
984 984
     row("max total results", $wu->max_total_results);
985 985
     row("max success results", $wu->max_success_results);
986
-    row("result template file",$wu->result_template_file);
986
+    row("result template file", $wu->result_template_file);
987 987
     row("hr_class", $wu->hr_class);
988 988
     row("opaque", $wu->opaque);
989 989
     row("Priority", $wu->priority);
@@ -1061,7 +1061,7 @@  discard block
 block discarded – undo
1061 1061
 }
1062 1062
 
1063 1063
 function outcome_color($outcome) {
1064
-    switch($outcome) {
1064
+    switch ($outcome) {
1065 1065
     case 0: return '9900cc'; // "Init", purple
1066 1066
     case 1: return '33cc33'; // "Success", green
1067 1067
     case 3: return 'ff3333'; // "Client error", red
@@ -1090,16 +1090,16 @@  discard block
 block discarded – undo
1090 1090
     row("Received", time_str($result->received_time));
1091 1091
     row("Last time modified", mysqltime_str($result->mod_time));
1092 1092
     row("Name", $result->name);
1093
-    row("Workunit", "<a href=\"db_action.php?table=workunit&id=$result->workunitid\">" . wu_name_by_id($result->workunitid) . "</a> [$result->workunitid]" );
1093
+    row("Workunit", "<a href=\"db_action.php?table=workunit&id=$result->workunitid\">".wu_name_by_id($result->workunitid)."</a> [$result->workunitid]");
1094 1094
     row("Server state", result_server_state_string($result)." [$result->server_state]");
1095 1095
     row("Outcome", result_outcome_string($result)." [$result->outcome]");
1096 1096
     row("Client state", result_client_state_string($result)." [$result->client_state]");
1097 1097
     row("Exit status", exit_status_string($result->exit_status));
1098
-    row("Host ID", "<a href=\"db_action.php?table=host&id=$result->hostid\">" . host_name_by_id($result->hostid) . "</a> [$result->hostid]");
1099
-    row("User ID", "<a href=\"db_action.php?table=user&id=$result->userid\">" . user_name_by_id($result->userid) . "</a> [$result->userid]");
1098
+    row("Host ID", "<a href=\"db_action.php?table=host&id=$result->hostid\">".host_name_by_id($result->hostid)."</a> [$result->hostid]");
1099
+    row("User ID", "<a href=\"db_action.php?table=user&id=$result->userid\">".user_name_by_id($result->userid)."</a> [$result->userid]");
1100 1100
     row("CPU time", $result->cpu_time);
1101 1101
     row("Elapsed time", $result->elapsed_time);
1102
-    if($error=stderr_error_string($result->stderr_out)) {
1102
+    if ($error = stderr_error_string($result->stderr_out)) {
1103 1103
         row("error in stderr out", $error);
1104 1104
     }
1105 1105
     row("Batch", $result->batch);
@@ -1116,16 +1116,16 @@  discard block
 block discarded – undo
1116 1116
     row("App version", $x1.app_version_string($result).$x2);
1117 1117
     row("App version ID", $result->app_version_id);
1118 1118
     row("Estimated GFLOPS", number_format($result->flops_estimate/1e9, 2));
1119
-    row("Random",$result->random);
1120
-    row("Opaque",$result->opaque);
1121
-    row("Teamid",$result->teamid);
1122
-    row("Priority",$result->priority);
1119
+    row("Random", $result->random);
1120
+    row("Opaque", $result->opaque);
1121
+    row("Teamid", $result->teamid);
1122
+    row("Priority", $result->priority);
1123 1123
     row("XML doc in", "<pre>".htmlspecialchars($result->xml_doc_in)."</pre>");
1124 1124
     row("XML doc out", "<pre>".htmlspecialchars($result->xml_doc_out)."</pre>");
1125 1125
     row("stderr out", "<pre>"
1126 1126
         .htmlspecialchars(
1127 1127
             $result->stderr_out,
1128
-            ENT_QUOTES | (defined('ENT_SUBSTITUTE')?ENT_SUBSTITUTE:0),
1128
+            ENT_QUOTES|(defined('ENT_SUBSTITUTE') ?ENT_SUBSTITUTE:0),
1129 1129
             'utf-8'
1130 1130
         )
1131 1131
         ."</pre>"
@@ -1173,23 +1173,23 @@  discard block
 block discarded – undo
1173 1173
     } else {
1174 1174
         // result has not been received yet, so show report deadline either
1175 1175
         // in green if in the future or in red if in the past.
1176
-        $timenow=time();
1177
-        if ($result->report_deadline==0)  {
1176
+        $timenow = time();
1177
+        if ($result->report_deadline == 0) {
1178 1178
             // not sent -- show create time in purple
1179
-            $received = "<font color=\"9900cc\">". time_str($result->create_time) . "</font>";
1180
-        } else if ($result->report_deadline>=$timenow) {
1179
+            $received = "<font color=\"9900cc\">".time_str($result->create_time)."</font>";
1180
+        } else if ($result->report_deadline >= $timenow) {
1181 1181
             // overdue -- show deadline in red
1182
-            $received = "<font color=\"#33cc33\">". time_str($result->report_deadline) . "</font>";
1182
+            $received = "<font color=\"#33cc33\">".time_str($result->report_deadline)."</font>";
1183 1183
         } else {
1184 1184
             // in progress and not overdue -- show deadline in green
1185
-            $received = "<font color=\"#ff3333\">". time_str($result->report_deadline) . "</font>";
1185
+            $received = "<font color=\"#ff3333\">".time_str($result->report_deadline)."</font>";
1186 1186
         }
1187 1187
     }
1188 1188
     $version = app_version_string($result)." (<a href=\"db_action.php?table=app_version&id=$result->app_version_id\">$result->app_version_id</a>)";
1189 1189
     $outcome_color = outcome_color($result->outcome);
1190 1190
     $validate_color = validate_color($result->validate_state);
1191 1191
     $host_user = host_user_link($result->hostid);
1192
-    $cpu_hours = sprintf("%.1f",$result->cpu_time / 3600);
1192
+    $cpu_hours = sprintf("%.1f", $result->cpu_time/3600);
1193 1193
     $granted_credit = "<a href=credit.php?wu_id=$result->workunitid>".credit_str($result->granted_credit)."</a>";
1194 1194
     $delete_state = file_delete_state_str($result->file_delete_state);
1195 1195
 
@@ -1217,7 +1217,7 @@  discard block
 block discarded – undo
1217 1217
     row("ID", $user->id);
1218 1218
     row("Created", time_str($user->create_time));
1219 1219
     row("Name", $user->name);
1220
-    if(!in_rops()) {
1220
+    if (!in_rops()) {
1221 1221
         row("Authenticator", $user->authenticator);
1222 1222
     }
1223 1223
     row("Email address", $user->email_addr);
@@ -1232,7 +1232,7 @@  discard block
 block discarded – undo
1232 1232
     row("Default venue", $user->venue);
1233 1233
     row("Hosts", "<a href=\"db_action.php?table=host&userid=$user->id&detail=low\">click</a>");
1234 1234
     row("Cross project ID", $user->cross_project_id);
1235
-    if(!in_rops()) {
1235
+    if (!in_rops()) {
1236 1236
         row("Password Hash", $user->passwd_hash);
1237 1237
     }
1238 1238
     row("Donated", $user->donated);
@@ -1283,7 +1283,7 @@  discard block
 block discarded – undo
1283 1283
     echo "</table></td>";
1284 1284
     echo "<td><table border=\"2\">\n";
1285 1285
     echo "<tr><th>User</th><th># posts</th></tr>\n";
1286
-    for ($p=1; $p<=10; $p++) {
1286
+    for ($p = 1; $p <= 10; $p++) {
1287 1287
         row2_plain(user_links_ops($top10poster[$p]), $top10poster[$p]->posts);
1288 1288
     }
1289 1289
     echo "</table></td>";
@@ -1322,10 +1322,10 @@  discard block
 block discarded – undo
1322 1322
 function admin_show_team($team) {
1323 1323
     start_table();
1324 1324
     row("ID", $team->id);
1325
-    row("Team Founder", "<a href=\"db_action.php?table=user&id=$team->userid\">" . user_name_by_id($team->userid) . "</a>");
1325
+    row("Team Founder", "<a href=\"db_action.php?table=user&id=$team->userid\">".user_name_by_id($team->userid)."</a>");
1326 1326
     row("Name", $team->name);
1327
-    row("Name (HTML Formatted)", "<pre>" . htmlspecialchars($team->name_html) . "</pre>" );
1328
-    row("Url", "<a href=\"http://$team->url\">" . $team->url . "</a>");
1327
+    row("Name (HTML Formatted)", "<pre>".htmlspecialchars($team->name_html)."</pre>");
1328
+    row("Url", "<a href=\"http://$team->url\">".$team->url."</a>");
1329 1329
     row("Type", team_type_string($team->type));
1330 1330
     row("Description", $team->description);
1331 1331
     row("", "<a href=\"db_action.php?table=user&teamid=$team->id\">List All Members</a>");
@@ -1368,7 +1368,7 @@  discard block
 block discarded – undo
1368 1368
     if (!strlen($host->domain_name) && !strlen($host->last_ip_addr)) {
1369 1369
         return "(blank)";
1370 1370
     } else {
1371
-        return $host->domain_name . " (" . $host->last_ip_addr . ")";
1371
+        return $host->domain_name." (".$host->last_ip_addr.")";
1372 1372
     }
1373 1373
 }
1374 1374
 
Please login to merge, or discard this patch.
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -379,13 +379,13 @@  discard block
 block discarded – undo
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)) {
386 387
             return "<a href=\"db_action.php?table=result&query=$mq&$query&clauses=".urlencode($clauses)."&sort_by=mod_time&detail=low\">$n</a>";
387
-        }
388
-        else {
388
+        } else {
389 389
             return "<a href=\"db_action.php?table=result&query=$mq&$query&sort_by=mod_time&detail=low\">$n</a>";
390 390
         }
391 391
 
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 // @return String A human readable string if error otherwise FALSE
397 397
 // @param String $stderr_out the stderr_out value to parse
398 398
 //
399
-function stderr_error_string($stderr_out){
399
+function stderr_error_string($stderr_out) {
400 400
     $y = parse_element($stderr_out, "<error_code>");
401 401
     $x = 0;
402 402
     if ($y) {
@@ -1174,7 +1174,7 @@  discard block
 block discarded – undo
1174 1174
         // result has not been received yet, so show report deadline either
1175 1175
         // in green if in the future or in red if in the past.
1176 1176
         $timenow=time();
1177
-        if ($result->report_deadline==0)  {
1177
+        if ($result->report_deadline==0) {
1178 1178
             // not sent -- show create time in purple
1179 1179
             $received = "<font color=\"9900cc\">". time_str($result->create_time) . "</font>";
1180 1180
         } else if ($result->report_deadline>=$timenow) {
Please login to merge, or discard this patch.