Passed
Push — Mac_fix_after_mac_update ( 2c222c...fd535a )
by
unknown
10:46
created
html/inc/db_ops.inc 4 patches
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
         $x = (int)$y;
400 400
     }
401 401
     if (0<=$x && $x<=9) {
402
-        return FALSE;
402
+        return false;
403 403
     } else {
404 404
         return "$x ".error_code_str($x);
405 405
     }
@@ -891,7 +891,7 @@  discard block
 block discarded – undo
891 891
     row("Domain name", $host->domain_name);
892 892
     $x = $host->timezone/3600;
893 893
     if ($x >= 0) $x="+$x";
894
-    row("Local Standard Time", "UTC $x hours");
894
+    row("Local Standard Time", "utc $x hours");
895 895
     row("Number of CPUs", $host->p_ncpus);
896 896
     row("CPU", "$host->p_vendor $host->p_model");
897 897
     row("GFLOPS", number_format($host->p_fpops/1e9, 2));
Please login to merge, or discard this patch.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -310,9 +310,9 @@  discard block
 block discarded – undo
310 310
             $value=null;
311 311
         }
312 312
         if (isset($_GET[$order])) {
313
-             $order = $_GET[$order];
313
+                $order = $_GET[$order];
314 314
         } else {
315
-             $order = null;
315
+                $order = null;
316 316
         }
317 317
         if ($value) {
318 318
             if ($order == 'asc') {
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
         $res = new StdClass;
581 581
         $res->server_state = $ss;
582 582
         row2(result_server_state_string($res),
583
-             link_results("$server_state[$ss]",  $urlquery,"server_state=$ss", '')
583
+                link_results("$server_state[$ss]",  $urlquery,"server_state=$ss", '')
584 584
         );
585 585
     }
586 586
     end_table();
@@ -1056,8 +1056,8 @@  discard block
 block discarded – undo
1056 1056
 
1057 1057
 function validate_color($validate_state) {
1058 1058
     switch ($validate_state) {
1059
-   case 1: return '33cc33'; // valid, green
1060
-   case 2: return 'ffa500'; // invalid result, orange
1059
+    case 1: return '33cc33'; // valid, green
1060
+    case 2: return 'ffa500'; // invalid result, orange
1061 1061
     }
1062 1062
     return '';
1063 1063
 }
Please login to merge, or discard this patch.
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.
html/inc/cache.inc 3 patches
Braces   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 
108 108
 // check cache size every once in a while, purge if too big
109 109
 //
110
-function cache_check_diskspace(){
110
+function cache_check_diskspace() {
111 111
     if ((rand() % CACHE_SIZE_CHECK_FREQ)) return;
112 112
     if (disk_usage("../cache") < MAX_CACHE_USAGE) return;
113 113
     $x = max(TEAM_PAGE_TTL, USER_PAGE_TTL, USER_HOST_TTL,
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
     clean_cache($x, "../cache");
117 117
 }
118 118
 
119
-function cache_need_to_regenerate($path, $max_age){
119
+function cache_need_to_regenerate($path, $max_age) {
120 120
     $regenerate = false;
121 121
     $request = apache_request_headers();
122 122
 
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 }
140 140
 
141 141
 // Returns cached data or false if nothing was found
142
-function get_cached_data($max_age, $params=""){
142
+function get_cached_data($max_age, $params="") {
143 143
     global $no_cache;
144 144
 
145 145
     if ($no_cache) return;
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 }
166 166
 
167 167
 // DEPRECATED
168
-function start_cache($max_age, $params=""){
168
+function start_cache($max_age, $params="") {
169 169
     global $no_cache, $caching, $memcache;
170 170
 
171 171
     if ($no_cache) return;
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
             $regenerate = cache_need_to_regenerate($path, $max_age);
189 189
         }
190 190
         //Is the stored version too old, do we need to regenerate it?
191
-        if ($regenerate){
191
+        if ($regenerate) {
192 192
             // If cached version is too old (or non-existent)
193 193
             // generate the page and write to cache
194 194
             //
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 
229 229
 // write output buffer both to client and to cache
230 230
 // DEPRECATED
231
-function end_cache($max_age,$params=""){
231
+function end_cache($max_age,$params="") {
232 232
     global $no_cache;
233 233
     if ($no_cache) return;
234 234
 
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
     }
254 254
 }
255 255
 
256
-function set_cached_data($max_age, $data, $params=""){
256
+function set_cached_data($max_age, $data, $params="") {
257 257
     // for the benefit of hackers
258 258
     if (strstr($params, "..")) {
259 259
         return "bad params";
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@
 block discarded – undo
99 99
                 }
100 100
             }
101 101
         }
102
-       @closedir($handle);
102
+        @closedir($handle);
103 103
     }
104 104
     chdir($start_dir);
105 105
 }
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -32,8 +32,8 @@  discard block
 block discarded – undo
32 32
         mkdir("../cache", 0770);
33 33
         chmod("../cache", 0770);
34 34
     }
35
-    for ($i=0;$i<256;$i++) {
36
-        $j=sprintf("%02x",$i);
35
+    for ($i = 0; $i < 256; $i++) {
36
+        $j = sprintf("%02x", $i);
37 37
         if (!@filemtime("../cache/$j")) {
38 38
             mkdir("../cache/$j", 0770);
39 39
             chmod("../cache/$j", 0770);
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
     }
42 42
 }
43 43
 
44
-function get_path($params, $phpfile=null) {
44
+function get_path($params, $phpfile = null) {
45 45
     if (!@filemtime("../cache/00")) make_cache_dirs();
46 46
     if ($phpfile) {
47 47
         $z = $phpfile;
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
     }
52 52
 
53 53
     // add a layer of subdirectories for reducing file lookup time
54
-    $sz = substr(md5($z."_".urlencode($params)),1,2);
54
+    $sz = substr(md5($z."_".urlencode($params)), 1, 2);
55 55
     $path = "../cache/".$sz."/".$z;
56 56
     if ($params) {
57 57
         $path = $path."_".urlencode($params);
@@ -60,14 +60,14 @@  discard block
 block discarded – undo
60 60
 }
61 61
 
62 62
 function disk_usage($dir) {
63
-    $usage=0;
64
-    if ($handle=@opendir($dir)) {
65
-        while ($file=readdir($handle)) {
63
+    $usage = 0;
64
+    if ($handle = @opendir($dir)) {
65
+        while ($file = readdir($handle)) {
66 66
             if (($file != ".") && ($file != "..")) {
67 67
                 if (@is_dir($dir."/".$file)) {
68
-                    $usage+=disk_usage($dir."/".$file);
68
+                    $usage += disk_usage($dir."/".$file);
69 69
                 } else {
70
-                    $usage+=@filesize($dir."/".$file);
70
+                    $usage += @filesize($dir."/".$file);
71 71
                 }
72 72
             }
73 73
         }
@@ -81,8 +81,8 @@  discard block
 block discarded – undo
81 81
     if (!chdir($dir)) {
82 82
         return;
83 83
     }
84
-    if ($handle=@opendir(".")) {
85
-        while ($file=readdir($handle)) {
84
+    if ($handle = @opendir(".")) {
85
+        while ($file = readdir($handle)) {
86 86
             if ($file == ".") continue;
87 87
             if ($file == "..") continue;
88 88
 
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
             if (@is_dir($file)) {
94 94
                 clean_cache($max_age, $file);
95 95
             } else {
96
-                if ((time()-@filemtime($file))>$max_age) {
96
+                if ((time() - @filemtime($file)) > $max_age) {
97 97
                     //echo "unlinking ".getcwd()."/$file\n";
98 98
                     @unlink($file);
99 99
                 }
@@ -107,8 +107,8 @@  discard block
 block discarded – undo
107 107
 
108 108
 // check cache size every once in a while, purge if too big
109 109
 //
110
-function cache_check_diskspace(){
111
-    if ((rand() % CACHE_SIZE_CHECK_FREQ)) return;
110
+function cache_check_diskspace() {
111
+    if ((rand()%CACHE_SIZE_CHECK_FREQ)) return;
112 112
     if (disk_usage("../cache") < MAX_CACHE_USAGE) return;
113 113
     $x = max(TEAM_PAGE_TTL, USER_PAGE_TTL, USER_HOST_TTL,
114 114
         USER_PROFILE_TTL, TOP_PAGES_TTL, INDEX_PAGE_TTL
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
     clean_cache($x, "../cache");
117 117
 }
118 118
 
119
-function cache_need_to_regenerate($path, $max_age){
119
+function cache_need_to_regenerate($path, $max_age) {
120 120
     $regenerate = false;
121 121
     $request = apache_request_headers();
122 122
 
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
         // and touch the cached copy so other processes
129 129
         // don't regenerate at the same time
130 130
         //
131
-        if ($lastmodified<time()-$max_age) {
131
+        if ($lastmodified < time() - $max_age) {
132 132
             $regenerate = true;
133 133
             @touch($path);
134 134
         }
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 }
140 140
 
141 141
 // Returns cached data or false if nothing was found
142
-function get_cached_data($max_age, $params=""){
142
+function get_cached_data($max_age, $params = "") {
143 143
     global $no_cache;
144 144
 
145 145
     if ($no_cache) return;
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
             }
156 156
         } else {
157 157
             cache_check_diskspace();
158
-            $regenerate=cache_need_to_regenerate($path, $max_age);
158
+            $regenerate = cache_need_to_regenerate($path, $max_age);
159 159
             if (!$regenerate) {
160 160
                 return file_get_contents($path);
161 161
             }
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 }
166 166
 
167 167
 // DEPRECATED
168
-function start_cache($max_age, $params=""){
168
+function start_cache($max_age, $params = "") {
169 169
     global $no_cache, $caching, $memcache;
170 170
 
171 171
     if ($no_cache) return;
@@ -188,15 +188,15 @@  discard block
 block discarded – undo
188 188
             $regenerate = cache_need_to_regenerate($path, $max_age);
189 189
         }
190 190
         //Is the stored version too old, do we need to regenerate it?
191
-        if ($regenerate){
191
+        if ($regenerate) {
192 192
             // If cached version is too old (or non-existent)
193 193
             // generate the page and write to cache
194 194
             //
195 195
             ob_start();
196 196
             ob_implicit_flush(0);
197
-            Header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
198
-            Header("Expires: " . gmdate("D, d M Y H:i:s",time()+$max_age) . " GMT");
199
-            Header("Cache-Control: public, max-age=" . $max_age);
197
+            Header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
198
+            Header("Expires: ".gmdate("D, d M Y H:i:s", time() + $max_age)." GMT");
199
+            Header("Cache-Control: public, max-age=".$max_age);
200 200
 
201 201
             // allow the calling page to see cache period
202 202
             //
@@ -208,9 +208,9 @@  discard block
 block discarded – undo
208 208
             if (strstr($params, "format=xml")) {
209 209
                 header('Content-type: text/xml');
210 210
             }
211
-            Header("Last-Modified: " . gmdate("D, d M Y H:i:s",$lastmodified) . " GMT");
212
-            Header("Expires: " . gmdate("D, d M Y H:i:s",$lastmodified+$max_age) . " GMT");
213
-            Header("Cache-Control: public, max-age=" . $max_age );
211
+            Header("Last-Modified: ".gmdate("D, d M Y H:i:s", $lastmodified)." GMT");
212
+            Header("Expires: ".gmdate("D, d M Y H:i:s", $lastmodified + $max_age)." GMT");
213
+            Header("Cache-Control: public, max-age=".$max_age);
214 214
             if ($cache && $cache->content) {
215 215
                 echo $cache->content;
216 216
                 exit;
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 
229 229
 // write output buffer both to client and to cache
230 230
 // DEPRECATED
231
-function end_cache($max_age,$params=""){
231
+function end_cache($max_age, $params = "") {
232 232
     global $no_cache;
233 233
     if ($no_cache) return;
234 234
 
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
     }
254 254
 }
255 255
 
256
-function set_cached_data($max_age, $data, $params=""){
256
+function set_cached_data($max_age, $data, $params = "") {
257 257
     // for the benefit of hackers
258 258
     if (strstr($params, "..")) {
259 259
         return "bad params";
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
         }
296 296
         $server_arr = array();
297 297
         $servers = explode('|', MEMCACHE_SERVERS);
298
-        foreach($servers as &$server) {
298
+        foreach ($servers as &$server) {
299 299
             list($ip, $port, $weight) = explode(':', $server);
300 300
             if (!$port) { $port = 11211; }
301 301
             $server_arr[] = array($ip, $port, $weight);
Please login to merge, or discard this patch.
html/inc/text_transform.inc 3 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@
 block discarded – undo
62 62
 // Do the actual transformation of the text.
63 63
 // TODO: Make this part of the above class.
64 64
 
65
-function output_transform($text, $options = NULL) {
65
+function output_transform($text, $options = null) {
66 66
     // Options is a output_options object, defined above
67 67
     if (!$options) {
68 68
         $options = new output_options; // Defaults in the class definition
Please login to merge, or discard this patch.
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 // for example inside <pre> containers
285 285
 // The original \n was retained after the br when it was added
286 286
 //
287
-function remove_br($text){
287
+function remove_br($text) {
288 288
     return str_replace("<br />", "", $text);
289 289
 }
290 290
 
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
     $i=0;
296 296
     $linkpos=true;
297 297
     $out = "";
298
-    while (true){
298
+    while (true) {
299 299
         // Find a link
300 300
         //
301 301
         $linkpos=strpos($text, "<a ", $i);
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 
313 313
 // Converts image tags to links to the images.
314 314
 //
315
-function image_as_link($text){
315
+function image_as_link($text) {
316 316
     $pattern = '@<img([\S\s]+?)src=([^>]+?)>@si';
317 317
     $replacement = '<a href=${2}>[Image link]</a>';
318 318
     return preg_replace($pattern, $replacement, $text);
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -26,13 +26,13 @@  discard block
 block discarded – undo
26 26
 require_once('../inc/sanitize_html.inc');
27 27
 
28 28
 class output_options {
29
-    var $bb2html;            // BBCode as HTML? (on)
30
-    var $images_as_links;    // Images as hyperlinks? (off)
31
-    var $link_popup;        // Links in new windows? (off)
32
-    var $nl2br;                // Convert newlines to <br>'s? (on)
33
-    var $htmlitems;            // Convert special chars to HTML entities? (on)
34
-    var $htmlscrub;            // Scrub "bad" HTML tags? (off)
35
-    var $highlight_terms;// Array of terms to be highlighted (off)
29
+    var $bb2html; // BBCode as HTML? (on)
30
+    var $images_as_links; // Images as hyperlinks? (off)
31
+    var $link_popup; // Links in new windows? (off)
32
+    var $nl2br; // Convert newlines to <br>'s? (on)
33
+    var $htmlitems; // Convert special chars to HTML entities? (on)
34
+    var $htmlscrub; // Scrub "bad" HTML tags? (off)
35
+    var $highlight_terms; // Array of terms to be highlighted (off)
36 36
 
37 37
     // Constructor - set the defaults.
38 38
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
         $options = new output_options; // Defaults in the class definition
69 69
     }
70 70
     if ($options->htmlitems) {
71
-        $text = htmlspecialchars($text, ENT_COMPAT | ENT_HTML401 | ENT_SUBSTITUTE);
71
+        $text = htmlspecialchars($text, ENT_COMPAT|ENT_HTML401|ENT_SUBSTITUTE);
72 72
     }
73 73
     if (is_array($options->highlight_terms)) {
74 74
         $text = highlight_terms($text, $options->highlight_terms);
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 // If $export is true, don't use BOINC CSS
105 105
 
106 106
 function substr2($s, $n1, $n2) {
107
-    return substr($s, $n1, $n2-$n1);
107
+    return substr($s, $n1, $n2 - $n1);
108 108
 }
109 109
 
110 110
 // process non-nestable constructs: [pre] and [code]
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 
178 178
     $httpsregex = "(?:\"?)https\:\/\/([^\[\"<\ ]+)(?:\"?)";
179 179
     // List of allowable tags
180
-    $bbtags = array (
180
+    $bbtags = array(
181 181
         "@\[b\](.*?)\[/b\]@is",
182 182
         "@\[i\](.*?)\[/i\]@is",
183 183
         "@\[u\](.*?)\[/u\]@is",
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 
207 207
     // What the above tags are turned in to
208 208
     if ($export) {
209
-        $htmltags = array (
209
+        $htmltags = array(
210 210
             "<b>\\1</b>",
211 211
             "<i>\\1</i>",
212 212
             "<u>\\1</u>",
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
             "<a href=\"https://github.com/BOINC/boinc/wiki/\\1\">\\1</a>",
234 234
         );
235 235
     } else {
236
-        $htmltags = array (
236
+        $htmltags = array(
237 237
             "<b>\\1</b>",
238 238
             "<i>\\1</i>",
239 239
             "<u>\\1</u>",
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
     $lasttext = "";
266 266
     $i = 0;
267 267
     // $i<1000 to prevent DoS
268
-    while ($text != $lasttext && $i<1000) {
268
+    while ($text != $lasttext && $i < 1000) {
269 269
         $lasttext = $text;
270 270
         $text = preg_replace($bbtags, $htmltags, $text);
271 271
         $i = $i + 1;
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
     return $text;
276 276
 }
277 277
 
278
-function bb2html($text, $export=false) {
278
+function bb2html($text, $export = false) {
279 279
     $text = replace_pre_code($text, $export);
280 280
     return bb2html_aux($text, $export);
281 281
 }
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 // for example inside <pre> containers
285 285
 // The original \n was retained after the br when it was added
286 286
 //
287
-function remove_br($text){
287
+function remove_br($text) {
288 288
     return str_replace("<br />", "", $text);
289 289
 }
290 290
 
@@ -292,19 +292,19 @@  discard block
 block discarded – undo
292 292
 //
293 293
 function externalize_links($text) {
294 294
     // TODO:  Convert this to PCRE
295
-    $i=0;
296
-    $linkpos=true;
295
+    $i = 0;
296
+    $linkpos = true;
297 297
     $out = "";
298
-    while (true){
298
+    while (true) {
299 299
         // Find a link
300 300
         //
301
-        $linkpos=strpos($text, "<a ", $i);
302
-        if ($linkpos===false) break;
301
+        $linkpos = strpos($text, "<a ", $i);
302
+        if ($linkpos === false) break;
303 303
 
304 304
         // Replace with target='_new'
305 305
         //
306
-        $out .= substr($text, $i, $linkpos-$i)."<a target=\"_new\" ";
307
-        $i = $linkpos+3;
306
+        $out .= substr($text, $i, $linkpos - $i)."<a target=\"_new\" ";
307
+        $i = $linkpos + 3;
308 308
     }
309 309
     $out .= substr($text, $i);
310 310
     return $out;
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 
313 313
 // Converts image tags to links to the images.
314 314
 //
315
-function image_as_link($text){
315
+function image_as_link($text) {
316 316
     $pattern = '@<img([\S\s]+?)src=([^>]+?)>@si';
317 317
     $replacement = '<a href=${2}>[Image link]</a>';
318 318
     return preg_replace($pattern, $replacement, $text);
Please login to merge, or discard this patch.
html/inc/ReCaptcha/ReCaptcha.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -29,8 +29,7 @@  discard block
 block discarded – undo
29 29
 /**
30 30
  * reCAPTCHA client.
31 31
  */
32
-class ReCaptcha
33
-{
32
+class ReCaptcha {
34 33
     /**
35 34
      * Version of this client library.
36 35
      * @const string
@@ -55,8 +54,7 @@  discard block
 block discarded – undo
55 54
      * @param string $secret shared secret between site and reCAPTCHA server.
56 55
      * @param RequestMethod $requestMethod method used to send the request. Defaults to POST.
57 56
      */
58
-    public function __construct($secret, RequestMethod $requestMethod = null)
59
-    {
57
+    public function __construct($secret, RequestMethod $requestMethod = null) {
60 58
         if (empty($secret)) {
61 59
             throw new \RuntimeException('No secret provided');
62 60
         }
@@ -82,8 +80,7 @@  discard block
 block discarded – undo
82 80
      * @param string $remoteIp The end user's IP address.
83 81
      * @return Response Response from the service.
84 82
      */
85
-    public function verify($response, $remoteIp = null)
86
-    {
83
+    public function verify($response, $remoteIp = null) {
87 84
         // Discard empty solution submissions
88 85
         if (empty($response)) {
89 86
             $recaptchaResponse = new Response(false, array('missing-input-response'));
Please login to merge, or discard this patch.
html/inc/ReCaptcha/RequestMethod.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,8 +29,7 @@
 block discarded – undo
29 29
 /**
30 30
  * Method used to send the request to the service.
31 31
  */
32
-interface RequestMethod
33
-{
32
+interface RequestMethod {
34 33
 
35 34
     /**
36 35
      * Submit the request with the specified parameters.
Please login to merge, or discard this patch.
html/inc/ReCaptcha/RequestMethod/CurlPost.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -34,8 +34,7 @@  discard block
 block discarded – undo
34 34
  * Note: this requires the cURL extension to be enabled in PHP
35 35
  * @see http://php.net/manual/en/book.curl.php
36 36
  */
37
-class CurlPost implements RequestMethod
38
-{
37
+class CurlPost implements RequestMethod {
39 38
     /**
40 39
      * URL to which requests are sent via cURL.
41 40
      * @const string
@@ -48,8 +47,7 @@  discard block
 block discarded – undo
48 47
      */
49 48
     private $curl;
50 49
 
51
-    public function __construct(Curl $curl = null)
52
-    {
50
+    public function __construct(Curl $curl = null) {
53 51
         if (!is_null($curl)) {
54 52
             $this->curl = $curl;
55 53
         } else {
@@ -63,8 +61,7 @@  discard block
 block discarded – undo
63 61
      * @param RequestParameters $params Request parameters
64 62
      * @return string Body of the reCAPTCHA response
65 63
      */
66
-    public function submit(RequestParameters $params)
67
-    {
64
+    public function submit(RequestParameters $params) {
68 65
         $handle = $this->curl->init(self::SITE_VERIFY_URL);
69 66
 
70 67
         $options = array(
Please login to merge, or discard this patch.
html/inc/ReCaptcha/RequestMethod/Post.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -32,8 +32,7 @@  discard block
 block discarded – undo
32 32
 /**
33 33
  * Sends POST requests to the reCAPTCHA service.
34 34
  */
35
-class Post implements RequestMethod
36
-{
35
+class Post implements RequestMethod {
37 36
     /**
38 37
      * URL to which requests are POSTed.
39 38
      * @const string
@@ -46,8 +45,7 @@  discard block
 block discarded – undo
46 45
      * @param RequestParameters $params Request parameters
47 46
      * @return string Body of the reCAPTCHA response
48 47
      */
49
-    public function submit(RequestParameters $params)
50
-    {
48
+    public function submit(RequestParameters $params) {
51 49
         /**
52 50
          * PHP 5.6.0 changed the way you specify the peer name for SSL context options.
53 51
          * Using "CN_name" will still work, but it will raise deprecated errors.
Please login to merge, or discard this patch.
html/inc/ReCaptcha/RequestMethod/Socket.php 1 patch
Braces   +6 added lines, -12 removed lines patch added patch discarded remove patch
@@ -30,8 +30,7 @@  discard block
 block discarded – undo
30 30
  * Convenience wrapper around native socket and file functions to allow for
31 31
  * mocking.
32 32
  */
33
-class Socket
34
-{
33
+class Socket {
35 34
     private $handle = null;
36 35
 
37 36
     /**
@@ -45,8 +44,7 @@  discard block
 block discarded – undo
45 44
      * @param float $timeout
46 45
      * @return resource
47 46
      */
48
-    public function fsockopen($hostname, $port = -1, &$errno = 0, &$errstr = '', $timeout = null)
49
-    {
47
+    public function fsockopen($hostname, $port = -1, &$errno = 0, &$errstr = '', $timeout = null) {
50 48
         $this->handle = fsockopen($hostname, $port, $errno, $errstr, (is_null($timeout) ? ini_get("default_socket_timeout") : $timeout));
51 49
 
52 50
         if ($this->handle != false && $errno === 0 && $errstr === '') {
@@ -63,8 +61,7 @@  discard block
 block discarded – undo
63 61
      * @param int $length
64 62
      * @return int | bool
65 63
      */
66
-    public function fwrite($string, $length = null)
67
-    {
64
+    public function fwrite($string, $length = null) {
68 65
         return fwrite($this->handle, $string, (is_null($length) ? strlen($string) : $length));
69 66
     }
70 67
 
@@ -75,8 +72,7 @@  discard block
 block discarded – undo
75 72
      * @param int $length
76 73
      * @return string
77 74
      */
78
-    public function fgets($length = null)
79
-    {
75
+    public function fgets($length = null) {
80 76
         return fgets($this->handle, $length);
81 77
     }
82 78
 
@@ -86,8 +82,7 @@  discard block
 block discarded – undo
86 82
      * @see http://php.net/feof
87 83
      * @return bool
88 84
      */
89
-    public function feof()
90
-    {
85
+    public function feof() {
91 86
         return feof($this->handle);
92 87
     }
93 88
 
@@ -97,8 +92,7 @@  discard block
 block discarded – undo
97 92
      * @see http://php.net/fclose
98 93
      * @return bool
99 94
      */
100
-    public function fclose()
101
-    {
95
+    public function fclose() {
102 96
         return fclose($this->handle);
103 97
     }
104 98
 }
Please login to merge, or discard this patch.
html/inc/ReCaptcha/RequestMethod/Curl.php 1 patch
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -29,16 +29,14 @@  discard block
 block discarded – undo
29 29
 /**
30 30
  * Convenience wrapper around the cURL functions to allow mocking.
31 31
  */
32
-class Curl
33
-{
32
+class Curl {
34 33
 
35 34
     /**
36 35
      * @see http://php.net/curl_init
37 36
      * @param string $url
38 37
      * @return resource cURL handle
39 38
      */
40
-    public function init($url = null)
41
-    {
39
+    public function init($url = null) {
42 40
         return curl_init($url);
43 41
     }
44 42
 
@@ -48,8 +46,7 @@  discard block
 block discarded – undo
48 46
      * @param array $options
49 47
      * @return bool
50 48
      */
51
-    public function setoptArray($ch, array $options)
52
-    {
49
+    public function setoptArray($ch, array $options) {
53 50
         return curl_setopt_array($ch, $options);
54 51
     }
55 52
 
@@ -58,8 +55,7 @@  discard block
 block discarded – undo
58 55
      * @param resource $ch
59 56
      * @return mixed
60 57
      */
61
-    public function exec($ch)
62
-    {
58
+    public function exec($ch) {
63 59
         return curl_exec($ch);
64 60
     }
65 61
 
@@ -67,8 +63,7 @@  discard block
 block discarded – undo
67 63
      * @see http://php.net/curl_close
68 64
      * @param resource $ch
69 65
      */
70
-    public function close($ch)
71
-    {
66
+    public function close($ch) {
72 67
         curl_close($ch);
73 68
     }
74 69
 }
Please login to merge, or discard this patch.