Passed
Push — master ( 3b3a7b...0ff5f1 )
by Vitalii
01:09 queued 19s
created
html/user/submit_status.php 1 patch
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
     if (!$batch || $batch->user_id != $user->id) {
33 33
         error_page("no batch");
34 34
     }
35
-    page_head("Batch $batch->id");
35
+    page_head("batch $batch->id");
36 36
     $results = BoincResult::enum("batch=$batch->id order by workunitid");
37 37
     result_table_start(true, true, null);
38 38
     foreach ($results as $result) {
Please login to merge, or discard this patch.
html/user/submit_rpc_handler.php 4 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -691,7 +691,8 @@
 block discarded – undo
691 691
         <id>$result->id</id>
692 692
         <state>".state_string($result)."</state>
693 693
 ";
694
-        if ($result->server_state == 5) {   // over?
694
+        if ($result->server_state == 5) {
695
+// over?
695 696
             $paths = get_outfile_paths($result);
696 697
             foreach($paths as $path) {
697 698
                 if (is_file($path)) {
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -595,7 +595,7 @@
 block discarded – undo
595 595
 // return a batch specified by the command, using either ID or name
596 596
 //
597 597
 function get_batch($r) {
598
-    $batch = NULL;
598
+    $batch = null;
599 599
     if (!empty($r->batch_id)) {
600 600
         $batch_id = (int)($r->batch_id);
601 601
         $batch = BoincBatch::lookup_id($batch_id);
Please login to merge, or discard this patch.
Switch Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -1049,24 +1049,24 @@
 block discarded – undo
1049 1049
 log_write("----- Handling RPC; command ".$r->getName());
1050 1050
 
1051 1051
 switch ($r->getName()) {
1052
-    case 'abort_batch': handle_abort_batch($r); break;
1053
-    case 'abort_jobs': handle_abort_jobs($r); break;
1054
-    case 'create_batch': create_batch($r); break;
1055
-    case 'estimate_batch': estimate_batch($r); break;
1056
-    case 'get_templates': get_templates($r); break;
1057
-    case 'ping': ping($r); break;
1058
-    case 'query_batch': query_batch($r); break;
1059
-    case 'query_batch2': query_batch2($r); break;
1060
-    case 'query_batches': query_batches($r); break;
1061
-    case 'query_job': query_job($r); break;
1062
-    case 'query_completed_job': query_completed_job($r); break;
1063
-    case 'retire_batch': handle_retire_batch($r); break;
1064
-    case 'set_expire_time': handle_set_expire_time($r); break;
1065
-    case 'submit_batch': submit_batch($r); break;
1066
-    default:
1067
-        log_write("bad command");
1068
-        xml_error(-1, "bad command: ".$r->getName());
1069
-        break;
1052
+case 'abort_batch': handle_abort_batch($r); break;
1053
+case 'abort_jobs': handle_abort_jobs($r); break;
1054
+case 'create_batch': create_batch($r); break;
1055
+case 'estimate_batch': estimate_batch($r); break;
1056
+case 'get_templates': get_templates($r); break;
1057
+case 'ping': ping($r); break;
1058
+case 'query_batch': query_batch($r); break;
1059
+case 'query_batch2': query_batch2($r); break;
1060
+case 'query_batches': query_batches($r); break;
1061
+case 'query_job': query_job($r); break;
1062
+case 'query_completed_job': query_completed_job($r); break;
1063
+case 'retire_batch': handle_retire_batch($r); break;
1064
+case 'set_expire_time': handle_set_expire_time($r); break;
1065
+case 'submit_batch': submit_batch($r); break;
1066
+default:
1067
+    log_write("bad command");
1068
+    xml_error(-1, "bad command: ".$r->getName());
1069
+    break;
1070 1070
 }
1071 1071
 
1072 1072
 log_write("RPC done");
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
     if ($template) {
59 59
         $t = (double)$template->workunit->rsc_fpops_est;
60 60
     }
61
-    foreach($r->batch->job as $job) {
61
+    foreach ($r->batch->job as $job) {
62 62
         $y = (double)$job->rsc_fpops_est;
63 63
         if ($y) {
64 64
             $x += $y;
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 function est_elapsed_time($r, $template) {
85 85
     // crude estimate: batch FLOPs / project FLOPS
86 86
     //
87
-    return batch_flop_count($r, $template) / project_flops();
87
+    return batch_flop_count($r, $template)/project_flops();
88 88
 }
89 89
 
90 90
 // if batch-level input template filename was given, read it;
@@ -94,9 +94,9 @@  discard block
 block discarded – undo
94 94
 //
95 95
 function read_input_template($app, $r) {
96 96
     if ((isset($r->batch)) && (isset($r->batch->workunit_template_file)) && ($r->batch->workunit_template_file)) {
97
-        $path = project_dir() . "/templates/".$r->batch->workunit_template_file;
97
+        $path = project_dir()."/templates/".$r->batch->workunit_template_file;
98 98
     } else {
99
-        $path = project_dir() . "/templates/$app->name"."_in";
99
+        $path = project_dir()."/templates/$app->name"."_in";
100 100
     }
101 101
     if (file_exists($path)) {
102 102
         $x = simplexml_load_file($path);
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 function validate_batch($jobs, $template) {
142 142
     $i = 0;
143 143
     $n = count($template->file_info);
144
-    foreach($jobs as $job) {
144
+    foreach ($jobs as $job) {
145 145
         $m = count($job->input_files);
146 146
         if ($n != $m) {
147 147
             log_write("wrong # of input files for job $i: need $n, got $m");
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 // stage all the files
203 203
 //
204 204
 function stage_files(&$jobs) {
205
-    foreach($jobs as $job) {
205
+    foreach ($jobs as $job) {
206 206
         foreach ($job->input_files as $file) {
207 207
             if ($file->mode != "remote") {
208 208
                 $file->name = stage_file($file);
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 //
216 216
 function submit_jobs(
217 217
     $jobs, $job_params, $app, $batch_id, $priority, $app_version_num,
218
-    $input_template_filename,        // batch-level; can also specify per job
218
+    $input_template_filename, // batch-level; can also specify per job
219 219
     $output_template_filename,
220 220
     $user
221 221
 ) {
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
     // one line per job
226 226
     //
227 227
     $x = "";
228
-    foreach($jobs as $job) {
228
+    foreach ($jobs as $job) {
229 229
         if ($job->name) {
230 230
             $x .= " --wu_name $job->name";
231 231
         }
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
         $x .= "\n";
261 261
     }
262 262
 
263
-    $cmd = "cd " . project_dir() . "; ./bin/create_work --appname $app->name --batch $batch_id";
263
+    $cmd = "cd ".project_dir()."; ./bin/create_work --appname $app->name --batch $batch_id";
264 264
 
265 265
     if ($user->seti_id) {
266 266
         $cmd .= " --target_user $user->id ";
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
 
297 297
     // send stdin/stderr to a temp file
298 298
     $cmd .= sprintf(' >%s 2>&1',
299
-        "/tmp/create_work_" . getmypid() . ".err"
299
+        "/tmp/create_work_".getmypid().".err"
300 300
     );
301 301
 
302 302
     $h = popen($cmd, "w");
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
 //
370 370
 function xml_get_jobs($r) {
371 371
     $jobs = array();
372
-    foreach($r->batch->job as $j) {
372
+    foreach ($r->batch->job as $j) {
373 373
         $job = new StdClass;
374 374
         $job->input_files = array();
375 375
         $job->command_line = (string)$j->command_line;
@@ -420,16 +420,16 @@  discard block
 block discarded – undo
420 420
 //
421 421
 function logical_end_time($r, $jobs, $user, $app) {
422 422
     $total_flops = 0;
423
-    foreach($jobs as $job) {
423
+    foreach ($jobs as $job) {
424 424
         //print_r($job);
425 425
         if ($job->rsc_fpops_est) {
426 426
             $total_flops += $job->rsc_fpops_est;
427 427
         } else if ($job->input_template && $job->input_template->workunit->rsc_fpops_est) {
428
-            $total_flops += (double) $job->input_template->workunit->rsc_fpops_est;
428
+            $total_flops += (double)$job->input_template->workunit->rsc_fpops_est;
429 429
         } else if ($r->batch->job_params->rsc_fpops_est) {
430
-            $total_flops += (double) $r->batch->job_params->rsc_fpops_est;
430
+            $total_flops += (double)$r->batch->job_params->rsc_fpops_est;
431 431
         } else {
432
-            $x = (double) $template->workunit->rsc_fpops_est;
432
+            $x = (double)$template->workunit->rsc_fpops_est;
433 433
             if ($x) {
434 434
                 $total_flops += $x;
435 435
             } else {
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
             }
438 438
         }
439 439
     }
440
-    $cmd = "cd " . project_dir() . "/bin; ./adjust_user_priority --user $user->id --flops $total_flops --app $app->name";
440
+    $cmd = "cd ".project_dir()."/bin; ./adjust_user_priority --user $user->id --flops $total_flops --app $app->name";
441 441
     $x = exec($cmd);
442 442
     if (!is_numeric($x) || (double)$x == 0) {
443 443
         xml_error(-1, "$cmd returned $x");
@@ -515,15 +515,15 @@  discard block
 block discarded – undo
515 515
     }
516 516
 
517 517
     $job_params = new StdClass;
518
-    $job_params->rsc_disk_bound = (double) $r->batch->job_params->rsc_disk_bound;
519
-    $job_params->rsc_fpops_est = (double) $r->batch->job_params->rsc_fpops_est;
520
-    $job_params->rsc_fpops_bound = (double) $r->batch->job_params->rsc_fpops_bound;
521
-    $job_params->rsc_memory_bound = (double) $r->batch->job_params->rsc_memory_bound;
522
-    $job_params->delay_bound = (double) $r->batch->job_params->delay_bound;
518
+    $job_params->rsc_disk_bound = (double)$r->batch->job_params->rsc_disk_bound;
519
+    $job_params->rsc_fpops_est = (double)$r->batch->job_params->rsc_fpops_est;
520
+    $job_params->rsc_fpops_bound = (double)$r->batch->job_params->rsc_fpops_bound;
521
+    $job_params->rsc_memory_bound = (double)$r->batch->job_params->rsc_memory_bound;
522
+    $job_params->delay_bound = (double)$r->batch->job_params->delay_bound;
523 523
         // could add quorum-related stuff
524 524
 
525
-    $input_template_filename = (string) $r->batch->input_template_filename;
526
-    $output_template_filename = (string) $r->batch->output_template_filename;
525
+    $input_template_filename = (string)$r->batch->input_template_filename;
526
+    $output_template_filename = (string)$r->batch->output_template_filename;
527 527
         // possibly empty
528 528
 
529 529
     submit_jobs(
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
 }
614 614
 
615 615
 function n_outfiles($wu) {
616
-    $path = project_dir() . "/$wu->output_template_filename";
616
+    $path = project_dir()."/$wu->output_template_filename";
617 617
     $r = simplexml_load_file($path);
618 618
     return count($r->file_info);
619 619
 }
@@ -820,7 +820,7 @@  discard block
 block discarded – undo
820 820
 ";
821 821
         if ($result->server_state == 5) {   // over?
822 822
             $paths = get_outfile_paths($result);
823
-            foreach($paths as $path) {
823
+            foreach ($paths as $path) {
824 824
                 if (is_file($path)) {
825 825
                     $size = filesize($path);
826 826
                     echo "        <outfile>
@@ -864,7 +864,7 @@  discard block
 block discarded – undo
864 864
     } else {
865 865
         $results = BoincResult::enum("workunitid=$job_id");
866 866
         foreach ($results as $r) {
867
-            switch($r->outcome) {
867
+            switch ($r->outcome) {
868 868
             case 1:
869 869
             case 3:
870 870
             case 6:
@@ -979,8 +979,8 @@  discard block
 block discarded – undo
979 979
     }
980 980
 
981 981
     list($user, $user_submit) = check_remote_submit_permissions($r, $app);
982
-    $in = file_get_contents(project_dir() . "/templates/".$app->name."_in");
983
-    $out = file_get_contents(project_dir() . "/templates/".$app->name."_out");
982
+    $in = file_get_contents(project_dir()."/templates/".$app->name."_in");
983
+    $out = file_get_contents(project_dir()."/templates/".$app->name."_out");
984 984
     if ($in === false || $out === false) {
985 985
         log_write("template file missing");
986 986
         xml_error(-1, "template file missing");
@@ -992,7 +992,7 @@  discard block
 block discarded – undo
992 992
 
993 993
 function ping($r) {
994 994
     xml_start_tag("ping");
995
-    BoincDb::get();     // errors out if DB down or web disabled
995
+    BoincDb::get(); // errors out if DB down or web disabled
996 996
     echo "<success>1</success>
997 997
         </ping>
998 998
     ";
@@ -1059,9 +1059,9 @@  discard block
 block discarded – undo
1059 1059
 $request_log = parse_config(get_config(), "<remote_submit_request_log>");
1060 1060
 if ($request_log) {
1061 1061
     $log_dir = parse_config(get_config(), "<log_dir>");
1062
-    $request_log = $log_dir . "/" . $request_log;
1062
+    $request_log = $log_dir."/".$request_log;
1063 1063
     if ($file = fopen($request_log, "a")) {
1064
-        fwrite($file, "\n<submit_rpc_handler date=\"" . date(DATE_ATOM) . "\">\n" . $_POST['request'] . "\n</submit_rpc_handler>\n");
1064
+        fwrite($file, "\n<submit_rpc_handler date=\"".date(DATE_ATOM)."\">\n".$_POST['request']."\n</submit_rpc_handler>\n");
1065 1065
         fclose($file);
1066 1066
     }
1067 1067
 }
Please login to merge, or discard this patch.
html/user/get_project_config.php 3 patches
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,10 +28,10 @@
 block discarded – undo
28 28
 //
29 29
 function show_platforms() {
30 30
     $xmlFragment = unserialize(get_cached_data(3600, "project_config_platform_xml"));
31
-    if ($xmlFragment==false){
31
+    if ($xmlFragment==false) {
32 32
         $platforms = BoincDB::get()->enum_fields("platform, DBNAME.app_version, DBNAME.app", "BoincPlatform", "platform.name, platform.user_friendly_name, plan_class", "app_version.platformid = platform.id and app_version.appid = app.id and app_version.deprecated=0 and app.deprecated=0 group by platform.name, plan_class", "");
33 33
         $xmlFragment = "    <platforms>";
34
-        foreach ($platforms as $platform){
34
+        foreach ($platforms as $platform) {
35 35
             $xmlFragment .= "
36 36
             <platform>
37 37
                 <platform_name>$platform->name</platform_name>
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -86,11 +86,11 @@  discard block
 block discarded – undo
86 86
 }
87 87
 
88 88
 if ($disable_account_creation || defined('INVITE_CODES')) {
89
-	echo "    <account_creation_disabled/>\n";
89
+    echo "    <account_creation_disabled/>\n";
90 90
 }
91 91
 
92 92
 if (defined('INVITE_CODES')) {
93
-	echo "    <invite_code_required/>\n";
93
+    echo "    <invite_code_required/>\n";
94 94
 }
95 95
 
96 96
 echo "    <min_passwd_length>$min_passwd_length</min_passwd_length>\n";
@@ -113,9 +113,9 @@  discard block
 block discarded – undo
113 113
 // the terms_of_use.txt file in the project base directory.
114 114
 //
115 115
 if (defined('TERMSOFUSE_FILE')) {
116
-  $tou_file = TERMSOFUSE_FILE;
116
+    $tou_file = TERMSOFUSE_FILE;
117 117
 } else {
118
-  $tou_file =  "../../terms_of_use.txt";
118
+    $tou_file =  "../../terms_of_use.txt";
119 119
 }
120 120
 if (file_exists($tou_file)) {
121 121
     $terms_of_use = trim(file_get_contents($tou_file));
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -30,10 +30,10 @@  discard block
 block discarded – undo
30 30
 //
31 31
 function show_platforms() {
32 32
     $xmlFragment = unserialize(get_cached_data(3600, "project_config_platform_xml"));
33
-    if ($xmlFragment==false){
33
+    if ($xmlFragment == false) {
34 34
         $platforms = BoincDB::get()->enum_fields("platform, DBNAME.app_version, DBNAME.app", "BoincPlatform", "platform.name, platform.user_friendly_name, plan_class", "app_version.platformid = platform.id and app_version.appid = app.id and app_version.deprecated=0 and app.deprecated=0 group by platform.name, plan_class", "");
35 35
         $xmlFragment = "    <platforms>";
36
-        foreach ($platforms as $platform){
36
+        foreach ($platforms as $platform) {
37 37
             $xmlFragment .= "
38 38
             <platform>
39 39
                 <platform_name>$platform->name</platform_name>
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 if (defined('TERMSOFUSE_FILE')) {
116 116
   $tou_file = TERMSOFUSE_FILE;
117 117
 } else {
118
-  $tou_file =  "../../terms_of_use.txt";
118
+  $tou_file = "../../terms_of_use.txt";
119 119
 }
120 120
 if (file_exists($tou_file)) {
121 121
     $terms_of_use = trim(file_get_contents($tou_file));
Please login to merge, or discard this patch.
html/user/forum_search.php 2 patches
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
     </select>");
57 57
 
58 58
 $forumid = null;
59
-if (get_str("forumid",true)){
59
+if (get_str("forumid",true)) {
60 60
     $forumid = get_str("forumid");
61 61
 }
62 62
 $forumlist="<option value=\"-1\">".tra("All")."</option>";
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 foreach ($categories as $category) {
65 65
     $forums = BoincForum::enum("parent_type=0 and category=$category->id");
66 66
     foreach ($forums as $forum) {
67
-        if ($forum->id==$forumid){
67
+        if ($forum->id==$forumid) {
68 68
             $forumlist.="<option selected value=\"".$forum->id."\">".$forum->title."</option>";
69 69
         } else {
70 70
             $forumlist.="<option value=\"".$forum->id."\">".$forum->title."</option>";
@@ -76,8 +76,8 @@  discard block
 block discarded – undo
76 76
     '<select class="form-control" name="search_forum">'.$forumlist.'</select');
77 77
 
78 78
 $sortlist = null;
79
-foreach ($thread_sort_styles as $id => $style){
80
-    if ($id == CREATE_TIME_NEW){
79
+foreach ($thread_sort_styles as $id => $style) {
80
+    if ($id == CREATE_TIME_NEW) {
81 81
         $sortlist.="<option selected value=\"".$id."\">".$style."</option>";
82 82
     } else {
83 83
         $sortlist.="<option value=\"".$id."\">".$style."</option>";
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -56,18 +56,18 @@  discard block
 block discarded – undo
56 56
     </select>");
57 57
 
58 58
 $forumid = null;
59
-if (get_str("forumid",true)){
59
+if (get_str("forumid", true)) {
60 60
     $forumid = get_str("forumid");
61 61
 }
62
-$forumlist="<option value=\"-1\">".tra("All")."</option>";
62
+$forumlist = "<option value=\"-1\">".tra("All")."</option>";
63 63
 $categories = BoincCategory::enum();
64 64
 foreach ($categories as $category) {
65 65
     $forums = BoincForum::enum("parent_type=0 and category=$category->id");
66 66
     foreach ($forums as $forum) {
67
-        if ($forum->id==$forumid){
68
-            $forumlist.="<option selected value=\"".$forum->id."\">".$forum->title."</option>";
67
+        if ($forum->id == $forumid) {
68
+            $forumlist .= "<option selected value=\"".$forum->id."\">".$forum->title."</option>";
69 69
         } else {
70
-            $forumlist.="<option value=\"".$forum->id."\">".$forum->title."</option>";
70
+            $forumlist .= "<option value=\"".$forum->id."\">".$forum->title."</option>";
71 71
         }
72 72
     }
73 73
 }
@@ -76,22 +76,22 @@  discard block
 block discarded – undo
76 76
     '<select class="form-control" name="search_forum">'.$forumlist.'</select');
77 77
 
78 78
 $sortlist = null;
79
-foreach ($thread_sort_styles as $id => $style){
80
-    if ($id == CREATE_TIME_NEW){
81
-        $sortlist.="<option selected value=\"".$id."\">".$style."</option>";
79
+foreach ($thread_sort_styles as $id => $style) {
80
+    if ($id == CREATE_TIME_NEW) {
81
+        $sortlist .= "<option selected value=\"".$id."\">".$style."</option>";
82 82
     } else {
83
-        $sortlist.="<option value=\"".$id."\">".$style."</option>";
83
+        $sortlist .= "<option value=\"".$id."\">".$style."</option>";
84 84
     }
85 85
 }
86 86
 row2(tra("Sort by"),
87 87
     '<select class="form-control" name="search_sort">'.$sortlist.'</select');
88 88
 
89 89
 row1("&nbsp;");
90
-row2("","<input class=\"btn btn-success\" type=\"submit\" value=\"".tra("Start the search")."\">");
90
+row2("", "<input class=\"btn btn-success\" type=\"submit\" value=\"".tra("Start the search")."\">");
91 91
 echo "</form>";
92 92
 end_table();
93 93
 
94 94
 page_tail();
95 95
 
96
-$cvs_version_tracker[]="\$Id$";  //Generated automatically - do not edit
96
+$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit
97 97
 ?>
Please login to merge, or discard this patch.
html/user/create_account_form.php 2 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@
 block discarded – undo
57 57
     $team = BoincTeam::lookup_id($teamid);
58 58
     $user = BoincUser::lookup_id($team->userid);
59 59
     if (!$user) {
60
-        error_page("Team $team->name has no founder");
60
+        error_page("team $team->name has no founder");
61 61
         $teamid = 0;
62 62
     } else {
63 63
         echo "<b>".tra("This account will belong to the team %1 and will have the project preferences of its founder.", "<a href=\"team_display.php?teamid=$team->id\">$team->name</a>")."</b><p>";
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
     }
67 67
 }
68 68
 
69
-form_start("create_account_action.php","post");
69
+form_start("create_account_action.php", "post");
70 70
 create_account_form($teamid, $next_url);
71 71
 global $recaptcha_public_key;
72 72
 if ($recaptcha_public_key) {
@@ -77,5 +77,5 @@  discard block
 block discarded – undo
77 77
 
78 78
 page_tail();
79 79
 
80
-$cvs_version_tracker[]="\$Id$";  //Generated automatically - do not edit
80
+$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit
81 81
 ?>
Please login to merge, or discard this patch.
html/user/forum_edit.php 2 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@
 block discarded – undo
70 70
         $now = time();
71 71
         $post->update("signature=$add_signature, content='$content', modified=$now");
72 72
     
73
-        if ($can_edit_title){
73
+        if ($can_edit_title) {
74 74
             $title = trim($title);
75 75
             $title = sanitize_tags($title);
76 76
             $title = BoincDb::escape_string($title);
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 
45 45
 $post_owner = BoincUser::lookup_id($post->user);
46 46
 if (($logged_in_user->id != $post_owner->id) || (can_reply($thread, $forum, $logged_in_user) == false)) {
47
-    error_page (tra("You are not authorized to edit this post."));
47
+    error_page(tra("You are not authorized to edit this post."));
48 48
 }
49 49
 
50 50
 $thread_owner = BoincUser::lookup_id($thread->owner);
@@ -53,13 +53,13 @@  discard block
 block discarded – undo
53 53
 // (ie. not a response to another post)
54 54
 // allow the user to modify the thread title
55 55
 //
56
-$can_edit_title = ($post->parent_post==0 && $thread_owner->id==$logged_in_user->id && !is_banished($logged_in_user));
56
+$can_edit_title = ($post->parent_post == 0 && $thread_owner->id == $logged_in_user->id && !is_banished($logged_in_user));
57 57
 
58 58
 $content = post_str("content", true);
59 59
 $title = post_str("title", true);
60 60
 $preview = post_str("preview", true);
61 61
 
62
-if (post_str('submit',true) && (!$preview)) {
62
+if (post_str('submit', true) && (!$preview)) {
63 63
     if (POST_MAX_LINKS
64 64
         && link_count($content) > POST_MAX_LINKS
65 65
         && !is_moderator($logged_in_user, $forum)
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     }
69 69
     check_tokens($logged_in_user->authenticator);
70 70
     
71
-    $add_signature = (post_str('add_signature', true) == "1")?1:0;
71
+    $add_signature = (post_str('add_signature', true) == "1") ? 1 : 0;
72 72
     $content = substr($content, 0, 64000);
73 73
     $content = trim($content);
74 74
     if (strlen($content)) {
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
         $now = time();
77 77
         $post->update("signature=$add_signature, content='$content', modified=$now");
78 78
     
79
-        if ($can_edit_title){
79
+        if ($can_edit_title) {
80 80
             $title = trim($title);
81 81
             $title = sanitize_tags($title);
82 82
             $title = BoincDb::escape_string($title);
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
     }
90 90
 }
91 91
 
92
-page_head(tra("Edit post"),'','','', $bbcode_js);
92
+page_head(tra("Edit post"), '', '', '', $bbcode_js);
93 93
 
94 94
 show_forum_header($logged_in_user);
95 95
 switch ($forum->parent_type) {
@@ -144,9 +144,9 @@  discard block
 block discarded – undo
144 144
 }
145 145
 
146 146
 if ($post->signature) {
147
-    $enable_signature="checked=\"true\"";
147
+    $enable_signature = "checked=\"true\"";
148 148
 } else {
149
-    $enable_signature="";
149
+    $enable_signature = "";
150 150
 }
151 151
 row2("", "<input id=\"add_signature\" name=\"add_signature\" value=\"1\" ".$enable_signature." type=\"checkbox\">
152 152
     <label for=\"add_signature\">".tra("Add my signature to this post")."</label>");
@@ -159,5 +159,5 @@  discard block
 block discarded – undo
159 159
 
160 160
 page_tail();
161 161
 
162
-$cvs_version_tracker[]="\$Id$";  //Generated automatically - do not edit
162
+$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit
163 163
 ?>
Please login to merge, or discard this patch.
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.
Braces   +8 added lines, -6 removed lines patch added patch discarded remove patch
@@ -98,7 +98,9 @@  discard block
 block discarded – undo
98 98
     if (!isset($types)) {
99 99
         $types = array();
100 100
         $constants = get_defined_constants(true);
101
-        foreach ($constants['mysqli'] as $c => $n) if (preg_match('/^MYSQLI_TYPE_(.*)/', $c, $m)) $types[$n] = $m[1];
101
+        foreach ($constants['mysqli'] as $c => $n) {
102
+            if (preg_match('/^MYSQLI_TYPE_(.*)/', $c, $m)) $types[$n] = $m[1];
103
+        }
102 104
     }
103 105
     return array_key_exists($type_id, $types)? strtolower($types[$type_id]) : "unknown";
104 106
 }
@@ -381,13 +383,13 @@  discard block
 block discarded – undo
381 383
 
382 384
 
383 385
 function link_results($n, $mq, $query, $clauses) {
384
-    if ($n == '0') { // intentional compare by string
386
+    if ($n == '0') {
387
+// intentional compare by string
385 388
         return "0";
386 389
     } else {
387 390
         if(strlen($clauses)) {
388 391
             return "<a href=\"db_action.php?table=result&query=$mq&$query&clauses=".urlencode($clauses)."&sort_by=mod_time&detail=low\">$n</a>";
389
-        }
390
-        else {
392
+        } else {
391 393
             return "<a href=\"db_action.php?table=result&query=$mq&$query&sort_by=mod_time&detail=low\">$n</a>";
392 394
         }
393 395
 
@@ -397,7 +399,7 @@  discard block
 block discarded – undo
397 399
 // Determines if in stderr_out is an error reported and prints as human readable String
398 400
 // @return String A human readable string if error otherwise FALSE
399 401
 // @param String $stderr_out the stderr_out value to parse
400
-function stderr_error_string($stderr_out){
402
+function stderr_error_string($stderr_out) {
401 403
     $y = parse_element($stderr_out, "<error_code>");
402 404
     $x = 0;
403 405
     if ($y) {
@@ -1176,7 +1178,7 @@  discard block
 block discarded – undo
1176 1178
         // result has not been received yet, so show report deadline either
1177 1179
         // in green if in the future or in red if in the past.
1178 1180
         $timenow=time();
1179
-        if ($result->report_deadline==0)  {
1181
+        if ($result->report_deadline==0) {
1180 1182
             // not sent -- show create time in purple
1181 1183
             $received = "<font color=\"9900cc\">". time_str($result->create_time) . "</font>";
1182 1184
         } else if ($result->report_deadline>=$timenow) {
Please login to merge, or discard this patch.
Spacing   +105 added lines, -105 removed lines patch added patch discarded remove patch
@@ -42,27 +42,27 @@  discard block
 block discarded – undo
42 42
 // @return String A user readable DateTime-String in UTC
43 43
 // @param Integer $x The mysql-Timestamp to convert
44 44
 function mysqltime_str($x) {
45
-    if(strpos($x,"-")==4) {
45
+    if (strpos($x, "-") == 4) {
46 46
         // Syntax of supplied mysql-timestamp is YYYY-MM-DD HH:MM:SS
47
-        $year = substr($x,0,4);
48
-        $month = substr($x,5,2);
49
-        $day = substr($x,8,2);
50
-        $hour = substr($x,11,2);
51
-        $minute = substr($x,14,2);
52
-        $second = substr($x,17,2);
47
+        $year = substr($x, 0, 4);
48
+        $month = substr($x, 5, 2);
49
+        $day = substr($x, 8, 2);
50
+        $hour = substr($x, 11, 2);
51
+        $minute = substr($x, 14, 2);
52
+        $second = substr($x, 17, 2);
53 53
     } else {
54 54
         // Syntax of supplied mysql-timestamp is YYYYMMDDHHMMSS
55
-        $year = substr($x,0,4);
56
-        $month = substr($x,4,2);
57
-        $day = substr($x,6,2);
58
-        $hour = substr($x,8,2);
59
-        $minute = substr($x,10,2);
60
-        $second = substr($x,12,2);
55
+        $year = substr($x, 0, 4);
56
+        $month = substr($x, 4, 2);
57
+        $day = substr($x, 6, 2);
58
+        $hour = substr($x, 8, 2);
59
+        $minute = substr($x, 10, 2);
60
+        $second = substr($x, 12, 2);
61 61
 
62 62
     }
63 63
     //make a Unix-Timestamp
64 64
     // echo "Time string is " . "$x";
65
-    $time = mktime($hour,$minute,$second,$month,$day,$year);
65
+    $time = mktime($hour, $minute, $second, $month, $day, $year);
66 66
     return time_str($time);
67 67
 }
68 68
 
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
         $constants = get_defined_constants(true);
101 101
         foreach ($constants['mysqli'] as $c => $n) if (preg_match('/^MYSQLI_TYPE_(.*)/', $c, $m)) $types[$n] = $m[1];
102 102
     }
103
-    return array_key_exists($type_id, $types)? strtolower($types[$type_id]) : "unknown";
103
+    return array_key_exists($type_id, $types) ? strtolower($types[$type_id]) : "unknown";
104 104
 }
105 105
 
106 106
 // Function prints a description of $table
@@ -110,38 +110,38 @@  discard block
 block discarded – undo
110 110
     $result = $db->do_query("SELECT * from $table LIMIT 1");
111 111
     $fields = $result->field_count;
112 112
 
113
-    $avgnum=(int)($fields/$columns);
114
-    if ($avgnum*$columns<$fields) {
113
+    $avgnum = (int)($fields/$columns);
114
+    if ($avgnum*$columns < $fields) {
115 115
         $avgnum++;
116 116
     }
117 117
 
118
-    $actualcolumns=0;
119
-    while ($avgnum*$actualcolumns<$fields) {
118
+    $actualcolumns = 0;
119
+    while ($avgnum*$actualcolumns < $fields) {
120 120
         $actualcolumns++;
121 121
     }
122 122
 
123
-    if ($which>$actualcolumns) {
123
+    if ($which > $actualcolumns) {
124 124
         return 0;
125 125
     }
126 126
 
127
-    $bot=($which-1)*$avgnum;
128
-    $top=$which*$avgnum;
127
+    $bot = ($which - 1)*$avgnum;
128
+    $top = $which*$avgnum;
129 129
 
130
-    $width=100.0/$actualcolumns;
130
+    $width = 100.0/$actualcolumns;
131 131
 
132 132
     echo "<td>";
133 133
     start_table('table-striped');
134 134
     echo "<tr><th align=\"left\">NAME</th><th align=\"left\">Type</th><th align=\"left\">Bytes</th>\n";
135
-    for ($count=$bot; $count<$top; $count++) {
136
-        if ($count<$fields) {
135
+    for ($count = $bot; $count < $top; $count++) {
136
+        if ($count < $fields) {
137 137
             $x = $result->fetch_field_direct($count);
138 138
             $name = $x->name;
139 139
             $type = mysql_fieldtype_str($x->type);
140 140
             $length = $x->length;
141 141
         } else {
142
-            $name="<br/> ";
143
-            $type="<br/>";
144
-            $length="<br/>";
142
+            $name = "<br/> ";
143
+            $type = "<br/>";
144
+            $length = "<br/>";
145 145
         }
146 146
         echo "\t<tr><td><b>$name</b></td><td>$type</td><td>$length</td></tr>\n";
147 147
     }
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
     echo "<h2>Description of <b>$table</b> table fields:</h2>\n";
157 157
     start_table();
158 158
     echo "<tr>";
159
-    for ($i=1; $i<=$how_many_columns; $i++) {
159
+    for ($i = 1; $i <= $how_many_columns; $i++) {
160 160
         print_describe_table_onecol($table, $i, $how_many_columns);
161 161
     }
162 162
     echo "</tr>";
@@ -175,10 +175,10 @@  discard block
 block discarded – undo
175 175
 }
176 176
 
177 177
 function print_query_field() {
178
-    $currenttime=time();
179
-    $hourago=$currenttime-3600;
180
-    $dayago=$currenttime-24*3600;
181
-    $weekago=$currenttime-7*24*3600;
178
+    $currenttime = time();
179
+    $hourago = $currenttime - 3600;
180
+    $dayago = $currenttime - 24*3600;
181
+    $weekago = $currenttime - 7*24*3600;
182 182
     echo "
183 183
         <tr>
184 184
         <td align=\"right\">Additional clauses</td>
@@ -202,11 +202,11 @@  discard block
 block discarded – undo
202 202
     }
203 203
 }
204 204
 
205
-function append_sql_query($original,$addition,$first) {
205
+function append_sql_query($original, $addition, $first) {
206 206
     if ($first == 1) {
207
-        return $original . " where " . $addition;
207
+        return $original." where ".$addition;
208 208
     } else {
209
-        return $original . " and " . $addition;
209
+        return $original." and ".$addition;
210 210
     }
211 211
 }
212 212
 
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
         if (isset($_GET[$name])) {
308 308
             $value = $_GET[$name];
309 309
         } else {
310
-            $value=null;
310
+            $value = null;
311 311
         }
312 312
         if (isset($_GET[$order])) {
313 313
              $order = $_GET[$order];
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
     }
349 349
 
350 350
     function get_url($base = "db_action.php") {
351
-        $s = $base . "?table=$this->table$this->urlquery";
351
+        $s = $base."?table=$this->table$this->urlquery";
352 352
         return $s;
353 353
     }
354 354
 
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
         $this->addeq('app_version_id');
364 364
         $this->addeq('exit_status');
365 365
         if (isset($_GET['nsecs'])) {
366
-            $_GET['mod_time'] = date("YmdHis",time() - $_GET['nsecs']);
366
+            $_GET['mod_time'] = date("YmdHis", time() - $_GET['nsecs']);
367 367
         }
368 368
         $this->addgt('mod_time');
369 369
         $this->addeq_not_CHOOSE_ALL('server_state');
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
     if ($n == '0') { // intentional compare by string
385 385
         return "0";
386 386
     } else {
387
-        if(strlen($clauses)) {
387
+        if (strlen($clauses)) {
388 388
             return "<a href=\"db_action.php?table=result&query=$mq&$query&clauses=".urlencode($clauses)."&sort_by=mod_time&detail=low\">$n</a>";
389 389
         }
390 390
         else {
@@ -397,13 +397,13 @@  discard block
 block discarded – undo
397 397
 // Determines if in stderr_out is an error reported and prints as human readable String
398 398
 // @return String A human readable string if error otherwise FALSE
399 399
 // @param String $stderr_out the stderr_out value to parse
400
-function stderr_error_string($stderr_out){
400
+function stderr_error_string($stderr_out) {
401 401
     $y = parse_element($stderr_out, "<error_code>");
402 402
     $x = 0;
403 403
     if ($y) {
404 404
         $x = (int)$y;
405 405
     }
406
-    if (0<=$x && $x<=9) {
406
+    if (0 <= $x && $x <= 9) {
407 407
         return FALSE;
408 408
     } else {
409 409
         return "$x ".error_code_str($x);
@@ -411,8 +411,8 @@  discard block
 block discarded – undo
411 411
 }
412 412
 
413 413
 function admin_show_result_summary() {
414
-    $ntotal =0;     // TODO: how to count $result?
415
-    $nvalid = 0;    // for SUCCESS results
414
+    $ntotal = 0; // TODO: how to count $result?
415
+    $nvalid = 0; // for SUCCESS results
416 416
     $ninvalid = 0;
417 417
     $nfile_deleted = 0;
418 418
 
@@ -420,20 +420,20 @@  discard block
 block discarded – undo
420 420
     $outcome = array();
421 421
     $client_state = array();
422 422
 
423
-    for ($ss=1; $ss<6; $ss++) {
423
+    for ($ss = 1; $ss < 6; $ss++) {
424 424
         $server_state[$ss] = 0;
425 425
     }
426
-    for ($ro=0; $ro<8; $ro++) {
426
+    for ($ro = 0; $ro < 8; $ro++) {
427 427
         $outcome[$ro] = 0;
428 428
     }
429
-    for ($cs=1; $cs<7; $cs++) {
429
+    for ($cs = 1; $cs < 7; $cs++) {
430 430
         $client_state[$cs] = 0;
431 431
     }
432
-    for ($fds=0; $fds<4; $fds++) {
432
+    for ($fds = 0; $fds < 4; $fds++) {
433 433
         $delete_state[$fds] = 0;
434 434
     }
435
-    for ($vs=0; $vs<NVALIDATE_STATES; $vs++) {
436
-        $validate_state[$vs]=0;
435
+    for ($vs = 0; $vs < NVALIDATE_STATES; $vs++) {
436
+        $validate_state[$vs] = 0;
437 437
     }
438 438
 
439 439
     $_GET['table'] = 'result';
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
         //
509 509
         $delay = parse_config(get_config(), "<delete_delay_hours>");
510 510
         if ($delay) {
511
-            $start2 = $start - $delay*3600;;
511
+            $start2 = $start - $delay*3600; ;
512 512
             $main_query .= " and ((file_delete_state>1 and mod_time>FROM_UNIXTIME($start2)) or (mod_time>FROM_UNIXTIME($start)))";
513 513
         } else {
514 514
             $main_query .= " and mod_time > FROM_UNIXTIME($start)";
@@ -567,20 +567,20 @@  discard block
 block discarded – undo
567 567
 
568 568
     start_table();
569 569
     echo "<tr valign=\"top\">";
570
-    echo "<td><h2>" . link_results("$ntotal results", $urlquery, '', '') . "</h2></td>";
571
-    echo "<td><h2>" . link_results("'Over' results", $urlquery, "server_state=5", '') . "</h2></td>";
572
-    echo "<td><h2>" . link_results("'Success' results", $urlquery, "outcome=1", '') . "</h2></td>";
573
-    echo "<td><h2>" . link_results("'Client error' results", $urlquery, "outcome=3", '') . "</h2></td>";
570
+    echo "<td><h2>".link_results("$ntotal results", $urlquery, '', '')."</h2></td>";
571
+    echo "<td><h2>".link_results("'Over' results", $urlquery, "server_state=5", '')."</h2></td>";
572
+    echo "<td><h2>".link_results("'Success' results", $urlquery, "outcome=1", '')."</h2></td>";
573
+    echo "<td><h2>".link_results("'Client error' results", $urlquery, "outcome=3", '')."</h2></td>";
574 574
     echo "</tr>";
575 575
     echo "<tr valign=\"top\">";
576 576
     echo "<td>";
577 577
     start_table('table-striped');
578 578
     echo "<tr><th>Server state</th><th># results</th></tr>\n";
579
-    for ($ss=1; $ss<6; $ss++) {
579
+    for ($ss = 1; $ss < 6; $ss++) {
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();
@@ -590,11 +590,11 @@  discard block
 block discarded – undo
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
-        c_row2($outcome[$ro]?outcome_color($ro):'', result_outcome_string($res),
597
+        c_row2($outcome[$ro] ?outcome_color($ro) : '', result_outcome_string($res),
598 598
             link_results("$outcome[$ro]", $urlquery, "outcome=$ro", '')
599 599
         );
600 600
     }
@@ -604,18 +604,18 @@  discard block
 block discarded – undo
604 604
     echo "<td>";
605 605
     start_table('table-striped');
606 606
     echo "<tr><th>Validate state</th><th># results</th></tr>\n";
607
-    for ($vs=0; $vs<NVALIDATE_STATES; $vs++) {
607
+    for ($vs = 0; $vs < NVALIDATE_STATES; $vs++) {
608 608
         $res = new StdClass;
609 609
         $res->validate_state = $vs;
610 610
         $res->exit_status = 0;
611
-        c_row2($validate_state[$vs]?validate_color($vs):'', validate_state_str($res),
611
+        c_row2($validate_state[$vs] ?validate_color($vs) : '', validate_state_str($res),
612 612
         link_results("$validate_state[$vs]", $urlquery, "validate_state=$vs", "outcome=1"));
613 613
     }
614 614
     end_table();
615 615
     start_table('table-striped');
616 616
     echo "<tr><th>File Delete state</th><th># results</th></tr>\n";
617 617
 
618
-    for ($fds=0; $fds<4; $fds++) {
618
+    for ($fds = 0; $fds < 4; $fds++) {
619 619
         row2(file_delete_state_str($fds),
620 620
         link_results("$file_delete[$fds]", $urlquery, "outcome=1", "file_delete_state=$fds"));
621 621
     }
@@ -627,7 +627,7 @@  discard block
 block discarded – undo
627 627
     echo "<td>";
628 628
     start_table('table-striped');
629 629
     echo "<tr><th>Client state</th><th># results</th></tr>\n";
630
-    for ($cs=1; $cs<7; $cs++) {
630
+    for ($cs = 1; $cs < 7; $cs++) {
631 631
         $res = new StdClass;
632 632
         $res->client_state = $cs;
633 633
         $res->exit_status = 0;
@@ -646,9 +646,9 @@  discard block
 block discarded – undo
646 646
         <select name=\"server_state\">
647 647
         <option value=\"CHOOSE_ALL\" selected=\"selected\"> Any </option>
648 648
     ";
649
-    for ($i=1; $i<6; $i++) {
649
+    for ($i = 1; $i < 6; $i++) {
650 650
         $res = new StdClass;
651
-        $res->server_state=$i;
651
+        $res->server_state = $i;
652 652
         echo "<option value=\"$i\"> "."[$i]&nbsp;&nbsp;".'   '.result_server_state_string($res)."</option>\n";
653 653
     }
654 654
     echo "</select>\n";
@@ -659,7 +659,7 @@  discard block
 block discarded – undo
659 659
         <select name=\"outcome\">
660 660
         <option value=\"CHOOSE_ALL\" selected=\"selected\"> Any </option>
661 661
     ";
662
-    for ($i=0; $i<8; $i++) {
662
+    for ($i = 0; $i < 8; $i++) {
663 663
         $res = new StdClass;
664 664
         $res->outcome = $i;
665 665
         $res->exit_status = 0;
@@ -673,7 +673,7 @@  discard block
 block discarded – undo
673 673
         <select name=\"validate_state\">
674 674
         <option value=\"CHOOSE_ALL\" selected=\"selected\"> Any </option>
675 675
         ";
676
-    for ($vs=0; $vs<NVALIDATE_STATES; $vs++) {
676
+    for ($vs = 0; $vs < NVALIDATE_STATES; $vs++) {
677 677
         $res = new StdClass;
678 678
         $res->validate_state = $vs;
679 679
         $res->exit_status = 0;
@@ -687,7 +687,7 @@  discard block
 block discarded – undo
687 687
         <select name=\"client_state\">
688 688
         <option value=\"CHOOSE_ALL\" selected=\"selected\"> Any </option>
689 689
     ";
690
-    for ($i=0; $i<7; $i++) {
690
+    for ($i = 0; $i < 7; $i++) {
691 691
         $res = new StdClass;
692 692
         $res->client_state = $i;
693 693
         $res->exit_status = 0;
@@ -724,7 +724,7 @@  discard block
 block discarded – undo
724 724
 }
725 725
 
726 726
 function table_title($table) {
727
-    switch($table) {
727
+    switch ($table) {
728 728
     case "platform": return "Platforms";
729 729
     case "app": return "Applications";
730 730
     case "app_version": return "Application Versions";
@@ -744,7 +744,7 @@  discard block
 block discarded – undo
744 744
     row("Created", time_str($platform->create_time));
745 745
     row("Name", $platform->name);
746 746
     row("User friendly name", $platform->user_friendly_name);
747
-    row("","<a href=\"db_action.php?table=app_version&platformid=$platform->id\">App versions for this platform</a>");
747
+    row("", "<a href=\"db_action.php?table=app_version&platformid=$platform->id\">App versions for this platform</a>");
748 748
     end_table();
749 749
 }
750 750
 
@@ -756,8 +756,8 @@  discard block
 block discarded – undo
756 756
     row("User-friendly name", $app->user_friendly_name);
757 757
     row("Deprecated", $app->deprecated);
758 758
     row("Homogeneous redundancy", $app->homogeneous_redundancy);
759
-    row("","<a href=\"db_action.php?table=app_version&appid=$app->id\">App Versions for this application</a>");
760
-    row("","<a href=\"db_action.php?table=workunit&appid=$app->id&detail=low\">Workunits for this application</a>");
759
+    row("", "<a href=\"db_action.php?table=app_version&appid=$app->id\">App Versions for this application</a>");
760
+    row("", "<a href=\"db_action.php?table=workunit&appid=$app->id&detail=low\">Workunits for this application</a>");
761 761
     end_table();
762 762
 }
763 763
 
@@ -765,9 +765,9 @@  discard block
 block discarded – undo
765 765
     start_table();
766 766
     row("ID", $app_version->id);
767 767
     row("Created", time_str($app_version->create_time));
768
-    row("Application", "<a href=\"db_action.php?table=app&id=$app_version->appid\">" . app_name_by_id($app_version->appid) . "</a>");
768
+    row("Application", "<a href=\"db_action.php?table=app&id=$app_version->appid\">".app_name_by_id($app_version->appid)."</a>");
769 769
     row("Version num", $app_version->version_num);
770
-    row("Platform", "<a href=\"db_action.php?table=platform&id=$app_version->platformid\">" . platform_name_by_id($app_version->platformid) . "</a>" );
770
+    row("Platform", "<a href=\"db_action.php?table=platform&id=$app_version->platformid\">".platform_name_by_id($app_version->platformid)."</a>");
771 771
     row("Plan Class", $app_version->plan_class);
772 772
     row("XML doc", "<pre>".htmlspecialchars($app_version->xml_doc)."</pre>");
773 773
     row("min_core_version", $app_version->min_core_version);
@@ -901,7 +901,7 @@  discard block
 block discarded – undo
901 901
     row("External IP address", "$host->external_ip_addr<br>");
902 902
     row("Domain name", $host->domain_name);
903 903
     $x = $host->timezone/3600;
904
-    if ($x >= 0) $x="+$x";
904
+    if ($x >= 0) $x = "+$x";
905 905
     row("Local Standard Time", "UTC $x hours");
906 906
     row("Number of CPUs", $host->p_ncpus);
907 907
     row("CPU", "$host->p_vendor $host->p_model");
@@ -953,10 +953,10 @@  discard block
 block discarded – undo
953 953
     start_table();
954 954
     row("Created", time_str($wu->create_time));
955 955
     row("Transition Time", time_str($wu->transition_time));
956
-    row("Last time modified",mysqltime_str($wu->mod_time));
956
+    row("Last time modified", mysqltime_str($wu->mod_time));
957 957
     row("Name", $wu->name);
958 958
     row("XML doc", "<pre>".htmlspecialchars($wu->xml_doc)."</pre>");
959
-    row("Application", "<a href=\"db_action.php?table=app&id=$wu->appid\">" . app_name_by_id($wu->appid) . " [".$wu->appid."]</a>");
959
+    row("Application", "<a href=\"db_action.php?table=app&id=$wu->appid\">".app_name_by_id($wu->appid)." [".$wu->appid."]</a>");
960 960
     row("Application version number", $wu->app_version_num);
961 961
     row("Batch", $wu->batch);
962 962
     $x = number_format($wu->rsc_fpops_est/1e9, 2);
@@ -969,12 +969,12 @@  discard block
 block discarded – undo
969 969
     $x = $wu->rsc_disk_bound/(1024*1024);
970 970
     $y = number_format($x, 2);
971 971
     row("Max Disk Usage", "$y MB");
972
-    row("Need validate?", ($wu->need_validate?"yes [":"no [").$wu->need_validate."]");
972
+    row("Need validate?", ($wu->need_validate ? "yes [" : "no [").$wu->need_validate."]");
973 973
     row("Canonical resultid",
974 974
             "<a href=\"db_action.php?table=result&id=$wu->canonical_resultid\">".$wu->canonical_resultid."</a>");
975 975
     row("Canonical credit", $wu->canonical_credit);
976 976
     //row("Timeout check time", time_str($wu->timeout_check_time));
977
-    row("Delay bound", "$wu->delay_bound" . " =  " . time_diff($wu->delay_bound) );
977
+    row("Delay bound", "$wu->delay_bound"." =  ".time_diff($wu->delay_bound));
978 978
     row("Error mask", wu_error_mask_str($wu->error_mask, true));
979 979
     row("File delete state", file_delete_state_str($wu->file_delete_state)." [".$wu->file_delete_state."]");
980 980
     row("Assimilation state", assimilate_state_str($wu->assimilate_state)." [".$wu->assimilate_state."]");
@@ -984,7 +984,7 @@  discard block
 block discarded – undo
984 984
     row("max error results", $wu->max_error_results);
985 985
     row("max total results", $wu->max_total_results);
986 986
     row("max success results", $wu->max_success_results);
987
-    row("result template file",$wu->result_template_file);
987
+    row("result template file", $wu->result_template_file);
988 988
     row("hr_class", $wu->hr_class);
989 989
     row("opaque", $wu->opaque);
990 990
     row("Priority", $wu->priority);
@@ -1062,7 +1062,7 @@  discard block
 block discarded – undo
1062 1062
 }
1063 1063
 
1064 1064
 function outcome_color($outcome) {
1065
-    switch($outcome) {
1065
+    switch ($outcome) {
1066 1066
     case 0: return '9900cc'; // "Init", purple
1067 1067
     case 1: return '33cc33'; // "Success", green
1068 1068
     case 3: return 'ff3333'; // "Client error", red
@@ -1089,18 +1089,18 @@  discard block
 block discarded – undo
1089 1089
     row("Sent", time_str($result->sent_time));
1090 1090
     row("Report deadline", time_str($result->report_deadline));
1091 1091
     row("Received", time_str($result->received_time));
1092
-    row("Last time modified",mysqltime_str($result->mod_time));
1092
+    row("Last time modified", mysqltime_str($result->mod_time));
1093 1093
     row("Name", $result->name);
1094
-    row("Workunit", "<a href=\"db_action.php?table=workunit&id=$result->workunitid\">" . wu_name_by_id($result->workunitid) . "</a> [$result->workunitid]" );
1094
+    row("Workunit", "<a href=\"db_action.php?table=workunit&id=$result->workunitid\">".wu_name_by_id($result->workunitid)."</a> [$result->workunitid]");
1095 1095
     row("Server state", result_server_state_string($result)." [$result->server_state]");
1096 1096
     row("Outcome", result_outcome_string($result)." [$result->outcome]");
1097 1097
     row("Client state", result_client_state_string($result)." [$result->client_state]");
1098 1098
     row("Exit status", exit_status_string($result->exit_status));
1099
-    row("Host ID", "<a href=\"db_action.php?table=host&id=$result->hostid\">" . host_name_by_id($result->hostid) . "</a> [$result->hostid]");
1100
-    row("User ID", "<a href=\"db_action.php?table=user&id=$result->userid\">" . user_name_by_id($result->userid) . "</a> [$result->userid]");
1099
+    row("Host ID", "<a href=\"db_action.php?table=host&id=$result->hostid\">".host_name_by_id($result->hostid)."</a> [$result->hostid]");
1100
+    row("User ID", "<a href=\"db_action.php?table=user&id=$result->userid\">".user_name_by_id($result->userid)."</a> [$result->userid]");
1101 1101
     row("CPU time", $result->cpu_time);
1102 1102
     row("Elapsed time", $result->elapsed_time);
1103
-    if($error=stderr_error_string($result->stderr_out)) {
1103
+    if ($error = stderr_error_string($result->stderr_out)) {
1104 1104
         row("error in stderr out", $error);
1105 1105
     }
1106 1106
     row("Batch", $result->batch);
@@ -1117,16 +1117,16 @@  discard block
 block discarded – undo
1117 1117
     row("App version", $x1.app_version_string($result).$x2);
1118 1118
     row("App version ID", $result->app_version_id);
1119 1119
     row("Estimated GFLOPS", number_format($result->flops_estimate/1e9, 2));
1120
-    row("Random",$result->random);
1121
-    row("Opaque",$result->opaque);
1122
-    row("Teamid",$result->teamid);
1123
-    row("Priority",$result->priority);
1120
+    row("Random", $result->random);
1121
+    row("Opaque", $result->opaque);
1122
+    row("Teamid", $result->teamid);
1123
+    row("Priority", $result->priority);
1124 1124
     row("XML doc in", "<pre>".htmlspecialchars($result->xml_doc_in)."</pre>");
1125 1125
     row("XML doc out", "<pre>".htmlspecialchars($result->xml_doc_out)."</pre>");
1126 1126
     row("stderr out", "<pre>"
1127 1127
         .htmlspecialchars(
1128 1128
             $result->stderr_out,
1129
-            ENT_QUOTES | (defined('ENT_SUBSTITUTE')?ENT_SUBSTITUTE:0),
1129
+            ENT_QUOTES|(defined('ENT_SUBSTITUTE') ?ENT_SUBSTITUTE:0),
1130 1130
             'utf-8'
1131 1131
         )
1132 1132
         ."</pre>"
@@ -1174,23 +1174,23 @@  discard block
 block discarded – undo
1174 1174
     } else {
1175 1175
         // result has not been received yet, so show report deadline either
1176 1176
         // in green if in the future or in red if in the past.
1177
-        $timenow=time();
1178
-        if ($result->report_deadline==0)  {
1177
+        $timenow = time();
1178
+        if ($result->report_deadline == 0) {
1179 1179
             // not sent -- show create time in purple
1180
-            $received = "<font color=\"9900cc\">". time_str($result->create_time) . "</font>";
1181
-        } else if ($result->report_deadline>=$timenow) {
1180
+            $received = "<font color=\"9900cc\">".time_str($result->create_time)."</font>";
1181
+        } else if ($result->report_deadline >= $timenow) {
1182 1182
             // overdue -- show deadline in red
1183
-            $received = "<font color=\"#33cc33\">". time_str($result->report_deadline) . "</font>";
1183
+            $received = "<font color=\"#33cc33\">".time_str($result->report_deadline)."</font>";
1184 1184
         } else {
1185 1185
             // in progress and not overdue -- show deadline in green
1186
-            $received = "<font color=\"#ff3333\">". time_str($result->report_deadline) . "</font>";
1186
+            $received = "<font color=\"#ff3333\">".time_str($result->report_deadline)."</font>";
1187 1187
         }
1188 1188
     }
1189 1189
     $version = app_version_string($result)." (<a href=\"db_action.php?table=app_version&id=$result->app_version_id\">$result->app_version_id</a>)";
1190 1190
     $outcome_color = outcome_color($result->outcome);
1191 1191
     $validate_color = validate_color($result->validate_state);
1192 1192
     $host_user = host_user_link($result->hostid);
1193
-    $cpu_hours = sprintf("%.1f",$result->cpu_time / 3600);
1193
+    $cpu_hours = sprintf("%.1f", $result->cpu_time/3600);
1194 1194
     $granted_credit = "<a href=credit.php?wu_id=$result->workunitid>".credit_str($result->granted_credit)."</a>";
1195 1195
     $delete_state = file_delete_state_str($result->file_delete_state);
1196 1196
 
@@ -1218,7 +1218,7 @@  discard block
 block discarded – undo
1218 1218
     row("ID", $user->id);
1219 1219
     row("Created", time_str($user->create_time));
1220 1220
     row("Name", $user->name);
1221
-    if(!in_rops()) {
1221
+    if (!in_rops()) {
1222 1222
         row("Authenticator", $user->authenticator);
1223 1223
     }
1224 1224
     row("Email address", $user->email_addr);
@@ -1233,7 +1233,7 @@  discard block
 block discarded – undo
1233 1233
     row("Default venue", $user->venue);
1234 1234
     row("Hosts", "<a href=\"db_action.php?table=host&userid=$user->id&detail=low\">click</a>");
1235 1235
     row("Cross project ID", $user->cross_project_id);
1236
-    if(!in_rops()) {
1236
+    if (!in_rops()) {
1237 1237
         row("Password Hash", $user->passwd_hash);
1238 1238
     }
1239 1239
     row("Donated", $user->donated);
@@ -1284,7 +1284,7 @@  discard block
 block discarded – undo
1284 1284
     echo "</table></td>";
1285 1285
     echo "<td><table border=\"2\">\n";
1286 1286
     echo "<tr><th>User</th><th># posts</th></tr>\n";
1287
-    for ($p=1; $p<=10; $p++) {
1287
+    for ($p = 1; $p <= 10; $p++) {
1288 1288
         row2_plain(user_links_ops($top10poster[$p]), $top10poster[$p]->posts);
1289 1289
     }
1290 1290
     echo "</table></td>";
@@ -1323,10 +1323,10 @@  discard block
 block discarded – undo
1323 1323
 function admin_show_team($team) {
1324 1324
     start_table();
1325 1325
     row("ID", $team->id);
1326
-    row("Team Founder", "<a href=\"db_action.php?table=user&id=$team->userid\">" . user_name_by_id($team->userid) . "</a>");
1326
+    row("Team Founder", "<a href=\"db_action.php?table=user&id=$team->userid\">".user_name_by_id($team->userid)."</a>");
1327 1327
     row("Name", $team->name);
1328
-    row("Name (HTML Formatted)", "<pre>" . htmlspecialchars($team->name_html) . "</pre>" );
1329
-    row("Url", "<a href=\"http://$team->url\">" . $team->url . "</a>");
1328
+    row("Name (HTML Formatted)", "<pre>".htmlspecialchars($team->name_html)."</pre>");
1329
+    row("Url", "<a href=\"http://$team->url\">".$team->url."</a>");
1330 1330
     row("Type", team_type_string($team->type));
1331 1331
     row("Description", $team->description);
1332 1332
     row("", "<a href=\"db_action.php?table=user&teamid=$team->id\">List All Members</a>");
@@ -1369,7 +1369,7 @@  discard block
 block discarded – undo
1369 1369
     if (!strlen($host->domain_name) && !strlen($host->last_ip_addr)) {
1370 1370
         return "(blank)";
1371 1371
     } else {
1372
-        return $host->domain_name . " (" . $host->last_ip_addr . ")";
1372
+        return $host->domain_name." (".$host->last_ip_addr.")";
1373 1373
     }
1374 1374
 }
1375 1375
 
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";
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
             self::$instance->setOption(Memcached::OPT_PREFIX_KEY, MEMCACHE_PREFIX);
295 295
         }
296 296
         $servers = explode('|', MEMCACHE_SERVERS);
297
-        foreach($servers as &$server) {
297
+        foreach ($servers as &$server) {
298 298
             list($ip, $port) = explode(':', $server);
299 299
             if (!$port) { $port = 11211; }
300 300
             $server = array($ip, $port);
Please login to merge, or discard this patch.
html/inc/text_transform.inc 3 patches
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 // for example inside <pre> containers
273 273
 // The original \n was retained after the br when it was added
274 274
 //
275
-function remove_br($text){
275
+function remove_br($text) {
276 276
     return str_replace("<br />", "", $text);
277 277
 }
278 278
 
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
     $i=0;
284 284
     $linkpos=true;
285 285
     $out = "";
286
-    while (true){
286
+    while (true) {
287 287
         //Find a link
288 288
         //
289 289
         $linkpos=strpos($text, "<a ", $i);
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 
301 301
 // Converts image tags to links to the images.
302 302
 
303
-function image_as_link($text){
303
+function image_as_link($text) {
304 304
     /* This function depends on sanitized HTML */
305 305
     // Build some regex (should be a *lot* faster)
306 306
     $pattern = '@<img([\S\s]+?)src=([^>]+?)>@si';
@@ -318,7 +318,8 @@  discard block
 block discarded – undo
318 318
     foreach ($search as $key => $value) {
319 319
         $replace[$key] = "<span class=\"mark\">".$value."</span>";
320 320
     }
321
-    if (substr(phpversion(), 0, 1) > 4) {   // PHP 4.x doesn't support str_ireplace
321
+    if (substr(phpversion(), 0, 1) > 4) {
322
+// PHP 4.x doesn't support str_ireplace
322 323
         return str_ireplace($search, $replace, $text);
323 324
     } else {
324 325
         return str_replace($search, $replace, $text);
Please login to merge, or discard this patch.
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.
Spacing   +27 added lines, -27 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);
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
     if ($export) {
110 110
         $text = preg_replace_callback(
111 111
             "@\[pre\](.*?)\[/pre\]@is",
112
-            function ($matches) {
112
+            function($matches) {
113 113
                 $x = remove_br(substr($matches[0], 5, -6));
114 114
                 $x = htmlspecialchars($x, ENT_COMPAT, "UTF-8", false);
115 115
                 $x = str_replace("[", "&#91;", $x);
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
         );
120 120
         return preg_replace_callback(
121 121
             "@\[code\](.*?)\[/code\]@is",
122
-            function ($matches) {
122
+            function($matches) {
123 123
                 $x = remove_br(substr($matches[0], 6, -7));
124 124
                 $x = htmlspecialchars($x, ENT_COMPAT, "UTF-8", false);
125 125
                 $x = str_replace("[", "&#91;", $x);
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
     } else {
131 131
         $text = preg_replace_callback(
132 132
             "@\[pre\](.*?)\[/pre\]@is",
133
-            function ($matches) {
133
+            function($matches) {
134 134
                 $x = remove_br(substr($matches[0], 5, -6));
135 135
                 $x = htmlspecialchars($x, ENT_COMPAT, "UTF-8", false);
136 136
                 $x = str_replace("[", "&#91;", $x);
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
         );
141 141
         return preg_replace_callback(
142 142
             "@\[code\](.*?)\[/code\]@is",
143
-            function ($matches) {
143
+            function($matches) {
144 144
                 $x = remove_br(substr($matches[0], 6, -7));
145 145
                 $x = htmlspecialchars($x, ENT_COMPAT, "UTF-8", false);
146 146
                 $x = str_replace("[", "&#91;", $x);
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
     }
152 152
 }
153 153
 
154
-function bb2html($text, $export=false) {
154
+function bb2html($text, $export = false) {
155 155
     $urlregex = "(?:\"?)(?:(http\:\/\/)?)([^\[\"<\ ]+)(?:\"?)";
156 156
     // NOTE:
157 157
     // This matches https:// too; I don't understand why.
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 
172 172
     $httpsregex = "(?:\"?)https\:\/\/([^\[\"<\ ]+)(?:\"?)";
173 173
     // List of allowable tags
174
-    $bbtags = array (
174
+    $bbtags = array(
175 175
         "@\[b\](.*?)\[/b\]@is",
176 176
         "@\[i\](.*?)\[/i\]@is",
177 177
         "@\[u\](.*?)\[/u\]@is",
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 
201 201
     // What the above tags are turned in to
202 202
     if ($export) {
203
-        $htmltags = array (
203
+        $htmltags = array(
204 204
             "<b>\\1</b>",
205 205
             "<i>\\1</i>",
206 206
             "<u>\\1</u>",
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
             "<a href=\"https://github.com/BOINC/boinc/wiki/\\1\">\\1</a>",
228 228
         );
229 229
     } else {
230
-        $htmltags = array (
230
+        $htmltags = array(
231 231
             "<b>\\1</b>",
232 232
             "<i>\\1</i>",
233 233
             "<u>\\1</u>",
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
     $lasttext = "";
260 260
     $i = 0;
261 261
     // $i<1000 to prevent DoS
262
-    while ($text != $lasttext && $i<1000) {
262
+    while ($text != $lasttext && $i < 1000) {
263 263
         $lasttext = $text;
264 264
         $text = replace_pre_code($text, $export);
265 265
         $text = preg_replace($bbtags, $htmltags, $text);
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
 // for example inside <pre> containers
275 275
 // The original \n was retained after the br when it was added
276 276
 //
277
-function remove_br($text){
277
+function remove_br($text) {
278 278
     return str_replace("<br />", "", $text);
279 279
 }
280 280
 
@@ -282,19 +282,19 @@  discard block
 block discarded – undo
282 282
 //
283 283
 function externalize_links($text) {
284 284
     // TODO:  Convert this to PCRE
285
-    $i=0;
286
-    $linkpos=true;
285
+    $i = 0;
286
+    $linkpos = true;
287 287
     $out = "";
288
-    while (true){
288
+    while (true) {
289 289
         //Find a link
290 290
         //
291
-        $linkpos=strpos($text, "<a ", $i);
292
-        if ($linkpos===false) break;
291
+        $linkpos = strpos($text, "<a ", $i);
292
+        if ($linkpos === false) break;
293 293
 
294 294
         //Replace with target='_new'
295 295
         //
296
-        $out .= substr($text, $i, $linkpos-$i)."<a target=\"_new\" ";
297
-        $i = $linkpos+3;
296
+        $out .= substr($text, $i, $linkpos - $i)."<a target=\"_new\" ";
297
+        $i = $linkpos + 3;
298 298
     }
299 299
     $out .= substr($text, $i);
300 300
     return $out;
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 
303 303
 // Converts image tags to links to the images.
304 304
 
305
-function image_as_link($text){
305
+function image_as_link($text) {
306 306
     /* This function depends on sanitized HTML */
307 307
     // Build some regex (should be a *lot* faster)
308 308
     $pattern = '@<img([\S\s]+?)src=([^>]+?)>@si';
@@ -327,5 +327,5 @@  discard block
 block discarded – undo
327 327
     }
328 328
 }
329 329
 
330
-$cvs_version_tracker[]="\$Id$";  //Generated automatically - do not edit
330
+$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit
331 331
 ?>
Please login to merge, or discard this patch.