Passed
Pull Request — master (#5599)
by Vitalii
21:21 queued 10:05
created
html/inc/prefs_project.inc 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 }
70 70
 
71 71
 if ($app_types->cpu) {
72
-    $project_pref_descs[] = new PREF_BOOL (
72
+    $project_pref_descs[] = new PREF_BOOL(
73 73
         tra("Use CPU"),
74 74
         "Request CPU-only tasks from this project.",
75 75
         "no_cpu",
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
     );
79 79
 }
80 80
 if ($app_types->ati) {
81
-    $project_pref_descs[] = new PREF_BOOL (
81
+    $project_pref_descs[] = new PREF_BOOL(
82 82
         tra("Use AMD GPU"),
83 83
         "Request AMD GPU tasks from this project.",
84 84
         "no_ati",
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
     );
88 88
 }
89 89
 if ($app_types->cuda) {
90
-    $project_pref_descs[] = new PREF_BOOL (
90
+    $project_pref_descs[] = new PREF_BOOL(
91 91
         tra("Use NVIDIA GPU"),
92 92
         "Request NVIDIA GPU tasks from this project.",
93 93
         "no_cuda",
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
     );
97 97
 }
98 98
 if ($app_types->intel_gpu) {
99
-    $project_pref_descs[] = new PREF_BOOL (
99
+    $project_pref_descs[] = new PREF_BOOL(
100 100
         tra("Use Intel GPU"),
101 101
         "Request Intel GPU tasks from this project.",
102 102
         "no_intel_gpu",
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
     );
106 106
 }
107 107
 if ($app_types->apple_gpu) {
108
-    $project_pref_descs[] = new PREF_BOOL (
108
+    $project_pref_descs[] = new PREF_BOOL(
109 109
         tra("Use Apple GPU"),
110 110
         "Request Apple GPU tasks from this project.",
111 111
         "no_apple_gpu",
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
     $x = "";
131 131
 }
132 132
 
133
-$privacy_pref_descs = array (
133
+$privacy_pref_descs = array(
134 134
     new PREF_BOOL(
135 135
         tra("Is it OK for %1 and your team (if any) to email you?", PROJECT).$x,
136 136
         "",
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
     global $in_project_specific;
179 179
     global $venue_name;
180 180
 
181
-    switch($name) {
181
+    switch ($name) {
182 182
     case "venue":
183 183
         $venue_name = $attrs["name"];
184 184
         $top_parse_result = $parse_result;
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
         break;
191 191
     default:
192 192
         if ($in_project_specific) {
193
-            $text= $text."<$name>";
193
+            $text = $text."<$name>";
194 194
         } else {
195 195
             $text = "";
196 196
         }
@@ -205,12 +205,12 @@  discard block
 block discarded – undo
205 205
     global $venue_name;
206 206
     global $project_pref_descs;
207 207
 
208
-    foreach($project_pref_descs as $p) {
208
+    foreach ($project_pref_descs as $p) {
209 209
         if ($p->xml_parse($parse_result, $name, $text)) {
210 210
             return;
211 211
         }
212 212
     }
213
-    switch($name) {
213
+    switch ($name) {
214 214
     case "venue":
215 215
         $top_parse_result->$venue_name = $parse_result;
216 216
         $parse_result = $top_parse_result;
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
     return $parse_result;
255 255
 }
256 256
 
257
-function prefs_show_project($prefs, $columns=false) {
257
+function prefs_show_project($prefs, $columns = false) {
258 258
     global $project_pref_descs;
259 259
     if ($columns) {
260 260
         foreach ($project_pref_descs as $p) {
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
     }
294 294
 }
295 295
 
296
-function prefs_show_project_specific($prefs, $columns=false) {
296
+function prefs_show_project_specific($prefs, $columns = false) {
297 297
     if ($columns) {
298 298
         $project_specific_prefs = project_specific_prefs_parse($prefs->project_specific);
299 299
         $project_specific_prefs->home = isset($prefs->home) ? project_specific_prefs_parse($prefs->home->project_specific) : "";
@@ -305,10 +305,10 @@  discard block
 block discarded – undo
305 305
     project_specific_prefs_show($project_specific_prefs, $columns);
306 306
 }
307 307
 
308
-function print_prefs_display_project($user, $columns=false) {
308
+function print_prefs_display_project($user, $columns = false) {
309 309
     $project_prefs = prefs_parse_project($user->project_prefs);
310 310
 
311
-    $switch_link = " <font size=\"-1\"><a href=prefs.php?subset=project&cols=". (int)!$columns .">".tra("(Switch View)")."</a></font>";
311
+    $switch_link = " <font size=\"-1\"><a href=prefs.php?subset=project&cols=".(int)!$columns.">".tra("(Switch View)")."</a></font>";
312 312
     if ($columns) {
313 313
         start_table();
314 314
         row_heading(tra("Combined preferences").$switch_link);
@@ -359,14 +359,14 @@  discard block
 block discarded – undo
359 359
     }
360 360
 }
361 361
 
362
-function prefs_form_project($prefs, $error=false) {
362
+function prefs_form_project($prefs, $error = false) {
363 363
     global $project_pref_descs;
364 364
     foreach ($project_pref_descs as $p) {
365 365
         $p->show_form_row($prefs, $error);
366 366
     }
367 367
 }
368 368
 
369
-function prefs_form_project_specific($prefs_xml, $error=false) {
369
+function prefs_form_project_specific($prefs_xml, $error = false) {
370 370
     $prefs = project_specific_prefs_parse($prefs_xml);
371 371
     project_specific_prefs_edit($prefs, $error);
372 372
 }
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
 
415 415
 // given a prefs structure, return the corresponding XML string
416 416
 //
417
-function project_prefs_make_xml($prefs, $primary=true) {
417
+function project_prefs_make_xml($prefs, $primary = true) {
418 418
     global $project_pref_descs;
419 419
     $xml = "";
420 420
     if ($primary) {
@@ -449,8 +449,8 @@  discard block
 block discarded – undo
449 449
 //
450 450
 function project_prefs_update(&$user, $prefs) {
451 451
     $prefs_xml = BoincDb::escape_string(project_prefs_make_xml($prefs));
452
-    $send_email = $user->send_email?1:0;
453
-    $show_hosts = $user->show_hosts?1:0;
452
+    $send_email = $user->send_email ? 1 : 0;
453
+    $show_hosts = $user->show_hosts ? 1 : 0;
454 454
     $retval = $user->update("project_prefs='$prefs_xml', send_email=$send_email, show_hosts=$show_hosts");
455 455
     if (!$retval) {
456 456
         return 1;
Please login to merge, or discard this patch.
html/inc/common_defs.inc 1 patch
Spacing   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -27,74 +27,74 @@
 block discarded – undo
27 27
 define('BATCH_STATE_RETIRED', 4);
28 28
 
29 29
 define('ANON_PLATFORM_UNKNOWN', -1);
30
-define('ANON_PLATFORM_CPU',     -2);
31
-define('ANON_PLATFORM_NVIDIA',  -3);
32
-define('ANON_PLATFORM_ATI',     -4);
33
-define('ANON_PLATFORM_INTEL_GPU',   -5);
34
-define('ANON_PLATFORM_APPLE_GPU',   -6);
30
+define('ANON_PLATFORM_CPU', -2);
31
+define('ANON_PLATFORM_NVIDIA', -3);
32
+define('ANON_PLATFORM_ATI', -4);
33
+define('ANON_PLATFORM_INTEL_GPU', -5);
34
+define('ANON_PLATFORM_APPLE_GPU', -6);
35 35
 
36
-define('RESULT_SERVER_STATE_INACTIVE',       1);
37
-define('RESULT_SERVER_STATE_UNSENT',         2);
38
-define('RESULT_SERVER_STATE_IN_PROGRESS',    4);
39
-define('RESULT_SERVER_STATE_OVER',           5);
36
+define('RESULT_SERVER_STATE_INACTIVE', 1);
37
+define('RESULT_SERVER_STATE_UNSENT', 2);
38
+define('RESULT_SERVER_STATE_IN_PROGRESS', 4);
39
+define('RESULT_SERVER_STATE_OVER', 5);
40 40
 
41
-define('RESULT_OUTCOME_INIT',             0);
42
-define('RESULT_OUTCOME_SUCCESS',          1);
43
-define('RESULT_OUTCOME_COULDNT_SEND',     2);
44
-define('RESULT_OUTCOME_CLIENT_ERROR',     3);
45
-define('RESULT_OUTCOME_NO_REPLY',         4);
46
-define('RESULT_OUTCOME_DIDNT_NEED',       5);
47
-define('RESULT_OUTCOME_VALIDATE_ERROR',   6);
48
-define('RESULT_OUTCOME_CLIENT_DETACHED',  7);
41
+define('RESULT_OUTCOME_INIT', 0);
42
+define('RESULT_OUTCOME_SUCCESS', 1);
43
+define('RESULT_OUTCOME_COULDNT_SEND', 2);
44
+define('RESULT_OUTCOME_CLIENT_ERROR', 3);
45
+define('RESULT_OUTCOME_NO_REPLY', 4);
46
+define('RESULT_OUTCOME_DIDNT_NEED', 5);
47
+define('RESULT_OUTCOME_VALIDATE_ERROR', 6);
48
+define('RESULT_OUTCOME_CLIENT_DETACHED', 7);
49 49
 
50
-define('VALIDATE_STATE_INIT',        0);
51
-define('VALIDATE_STATE_VALID',       1);
52
-define('VALIDATE_STATE_INVALID',     2);
53
-define('VALIDATE_STATE_NO_CHECK',    3);
54
-define('VALIDATE_STATE_INCONCLUSIVE',4);
55
-define('VALIDATE_STATE_TOO_LATE',    5);
50
+define('VALIDATE_STATE_INIT', 0);
51
+define('VALIDATE_STATE_VALID', 1);
52
+define('VALIDATE_STATE_INVALID', 2);
53
+define('VALIDATE_STATE_NO_CHECK', 3);
54
+define('VALIDATE_STATE_INCONCLUSIVE', 4);
55
+define('VALIDATE_STATE_TOO_LATE', 5);
56 56
 
57
-define('WU_ERROR_COULDNT_SEND_RESULT',           1);
58
-define('WU_ERROR_TOO_MANY_ERROR_RESULTS',        2);
59
-define('WU_ERROR_TOO_MANY_SUCCESS_RESULTS',      4);
60
-define('WU_ERROR_TOO_MANY_TOTAL_RESULTS',        8);
61
-define('WU_ERROR_CANCELLED',                     16);
62
-define('WU_ERROR_NO_CANONICAL_RESULT',           32);
57
+define('WU_ERROR_COULDNT_SEND_RESULT', 1);
58
+define('WU_ERROR_TOO_MANY_ERROR_RESULTS', 2);
59
+define('WU_ERROR_TOO_MANY_SUCCESS_RESULTS', 4);
60
+define('WU_ERROR_TOO_MANY_TOTAL_RESULTS', 8);
61
+define('WU_ERROR_CANCELLED', 16);
62
+define('WU_ERROR_NO_CANONICAL_RESULT', 32);
63 63
 
64
-define('FILE_DELETE_INIT',       0);
65
-define('FILE_DELETE_READY',      1);
66
-define('FILE_DELETE_DONE',       2);
67
-define('FILE_DELETE_ERROR',      3);
64
+define('FILE_DELETE_INIT', 0);
65
+define('FILE_DELETE_READY', 1);
66
+define('FILE_DELETE_DONE', 2);
67
+define('FILE_DELETE_ERROR', 3);
68 68
 
69
-define('ASSIMILATE_INIT',       0);
70
-define('ASSIMILATE_READY',      1);
71
-define('ASSIMILATE_DONE',       2);
69
+define('ASSIMILATE_INIT', 0);
70
+define('ASSIMILATE_READY', 1);
71
+define('ASSIMILATE_DONE', 2);
72 72
 
73 73
 // from lib/common_defs.h
74 74
 //
75
-define('RESULT_NEW',                 0);
76
-define('RESULT_FILES_DOWNLOADING',   1);
77
-define('RESULT_FILES_DOWNLOADED',    2);
78
-define('RESULT_COMPUTE_ERROR',       3);
79
-define('RESULT_FILES_UPLOADING',     4);
80
-define('RESULT_FILES_UPLOADED',      5);
81
-define('RESULT_ABORTED',             6);
82
-define('RESULT_UPLOAD_FAILED',       7);
75
+define('RESULT_NEW', 0);
76
+define('RESULT_FILES_DOWNLOADING', 1);
77
+define('RESULT_FILES_DOWNLOADED', 2);
78
+define('RESULT_COMPUTE_ERROR', 3);
79
+define('RESULT_FILES_UPLOADING', 4);
80
+define('RESULT_FILES_UPLOADED', 5);
81
+define('RESULT_ABORTED', 6);
82
+define('RESULT_UPLOAD_FAILED', 7);
83 83
 
84 84
 // from lib/error_numbers.h
85 85
 // returned by some web RPCs
86 86
 //
87
-define('ERR_XML_PARSE',               -112);
88
-define('ERR_DB_NOT_FOUND',            -136);
89
-define('ERR_DB_NOT_UNIQUE',           -137);
90
-define('ERR_DB_CANT_CONNECT',         -138);
91
-define('ERR_PROJECT_DOWN',            -183);
92
-define('ERR_BAD_USER_NAME',           -188);
93
-define('ERR_NO_OPTION',               -191);
94
-define('ERR_BAD_EMAIL_ADDR',          -205);
95
-define('ERR_BAD_PASSWD',              -206);
96
-define('ERR_ACCT_CREATION_DISABLED',  -208);
97
-define('ERR_ATTACH_FAIL_INIT',        -209);
98
-define('ERR_ATTACH_FAIL_DOWNLOAD',    -210);
99
-define('ERR_ACCT_REQUIRE_CONSENT',    -242);
87
+define('ERR_XML_PARSE', -112);
88
+define('ERR_DB_NOT_FOUND', -136);
89
+define('ERR_DB_NOT_UNIQUE', -137);
90
+define('ERR_DB_CANT_CONNECT', -138);
91
+define('ERR_PROJECT_DOWN', -183);
92
+define('ERR_BAD_USER_NAME', -188);
93
+define('ERR_NO_OPTION', -191);
94
+define('ERR_BAD_EMAIL_ADDR', -205);
95
+define('ERR_BAD_PASSWD', -206);
96
+define('ERR_ACCT_CREATION_DISABLED', -208);
97
+define('ERR_ATTACH_FAIL_INIT', -209);
98
+define('ERR_ATTACH_FAIL_DOWNLOAD', -210);
99
+define('ERR_ACCT_REQUIRE_CONSENT', -242);
100 100
 ?>
Please login to merge, or discard this patch.
html/user/gpu_ratios.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -34,26 +34,26 @@
 block discarded – undo
34 34
 $intel_gpu_credit_sum = 0;
35 35
 $apple_gpu_scale_sum = 0;
36 36
 $apple_gpu_credit_sum = 0;
37
-$total_credit_sum= 0;
37
+$total_credit_sum = 0;
38 38
 
39 39
 $apps = BoincApp::enum("deprecated=0");
40 40
 foreach ($apps as $app) {
41 41
     $avs = BoincAppVersion::enum("appid=$app->id and deprecated=0");
42 42
     foreach ($avs as $av) {
43 43
         if (strstr($av->plan_class, "ati")) {
44
-            $ati_scale_sum += $av->pfc_scale * $av->expavg_credit;
44
+            $ati_scale_sum += $av->pfc_scale*$av->expavg_credit;
45 45
             $ati_credit_sum += $av->expavg_credit;
46 46
         } else if (strstr($av->plan_class, "nvidia") || strstr($av->plan_class, "cuda")) {
47
-            $nvidia_scale_sum += $av->pfc_scale * $av->expavg_credit;
47
+            $nvidia_scale_sum += $av->pfc_scale*$av->expavg_credit;
48 48
             $nvidia_credit_sum += $av->expavg_credit;
49 49
         } else if (strstr($av->plan_class, "intel_gpu")) {
50
-            $intel_gpu_scale_sum += $av->pfc_scale * $av->expavg_credit;
50
+            $intel_gpu_scale_sum += $av->pfc_scale*$av->expavg_credit;
51 51
             $intel_gpu_credit_sum += $av->expavg_credit;
52 52
         } else if (strstr($av->plan_class, "apple_gpu")) {
53
-            $apple_gpu_scale_sum += $av->pfc_scale * $av->expavg_credit;
53
+            $apple_gpu_scale_sum += $av->pfc_scale*$av->expavg_credit;
54 54
             $apple_gpu_credit_sum += $av->expavg_credit;
55 55
         } else {
56
-            $cpu_scale_sum += $av->pfc_scale * $av->expavg_credit;
56
+            $cpu_scale_sum += $av->pfc_scale*$av->expavg_credit;
57 57
             $cpu_credit_sum += $av->expavg_credit;
58 58
         }
59 59
         $total_credit_sum += $av->expavg_credit;
Please login to merge, or discard this patch.
html/inc/bootstrap.inc 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -141,12 +141,12 @@  discard block
 block discarded – undo
141 141
         // prefix for links; needed for pages not in top dir
142 142
     $user,
143 143
         // logged-in user, if any
144
-    $fixed=false,
144
+    $fixed = false,
145 145
         // if true, navbar is fixed at top of page.
146 146
         // NOTE: if you do this, you must set a global var $fixed_navbar
147 147
         // to true at compile time
148 148
         // (it needs to be set when page_head() is called).
149
-    $inverse=false
149
+    $inverse = false
150 150
         // white on black?
151 151
 ) {
152 152
     global $master_url;
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 // output a panel.
215 215
 // $content_func is a function that generates the panel contents
216 216
 //
217
-function panel($title, $content_func, $class="panel-primary", $body_class="") {
217
+function panel($title, $content_func, $class = "panel-primary", $body_class = "") {
218 218
     echo sprintf('<div class="panel %s">
219 219
         ', $class
220 220
     );
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 // $left_width is the width of left column in 1/12 units.
242 242
 // $arg is passed to the functions.
243 243
 //
244
-function grid($top_func, $left_func, $right_func, $left_width=6, $arg=null) {
244
+function grid($top_func, $left_func, $right_func, $left_width = 6, $arg = null) {
245 245
     echo '
246 246
         <div class="container-fluid">
247 247
     ';
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
             </div>
257 257
         ';
258 258
     }
259
-    $right_width = 12-$left_width;
259
+    $right_width = 12 - $left_width;
260 260
     echo '
261 261
         <div class="row">
262 262
         <div class="col-sm-'.$left_width.'">
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 //      use extra = "name=x"
281 281
 //      call forum_focus(x, foo) after defining the field
282 282
 //
283
-function form_start($action, $method='get', $extra='') {
283
+function form_start($action, $method = 'get', $extra = '') {
284 284
     echo sprintf(
285 285
         '<div class="container-fluid">
286 286
         <form class="form-horizontal" method="%s" action="%s" %s>'
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 // just the input field
313 313
 //
314 314
 function form_input_text_field(
315
-    $name, $value='', $type='text', $attrs='', $extra=''
315
+    $name, $value = '', $type = 'text', $attrs = '', $extra = ''
316 316
 ) {
317 317
     return sprintf(
318 318
         '<input %s type="%s" class="form-control" name="%s" value="%s">%s',
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 // the whole row
324 324
 //
325 325
 function form_input_text(
326
-    $label, $name, $value='', $type='text', $attrs='', $extra=''
326
+    $label, $name, $value = '', $type = 'text', $attrs = '', $extra = ''
327 327
 ) {
328 328
     echo sprintf('
329 329
         <div class="form-group">
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
     );
352 352
 }
353 353
 
354
-function form_input_textarea($label, $name, $value='', $nrows=4) {
354
+function form_input_textarea($label, $name, $value = '', $nrows = 4) {
355 355
     echo sprintf('
356 356
         <div class="form-group">
357 357
             <label align=right class="%s" for="%s">%s</label>
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
 
368 368
 // $items is either a string of <option> elements, or an array
369 369
 //
370
-function form_select($label, $name, $items, $selected=null) {
370
+function form_select($label, $name, $items, $selected = null) {
371 371
     echo sprintf('
372 372
         <div class="form-group">
373 373
             <label align=right class="%s" for="%s">%s</label>
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
         foreach ($items as $i) {
381 381
             echo sprintf(
382 382
                 '<option %s value=%s>%s</option>',
383
-                ($i[0]==$selected)?'selected':'',
383
+                ($i[0] == $selected) ? 'selected' : '',
384 384
                 $i[0], $i[1]
385 385
             );
386 386
         }
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
 // same, for multiple select.
394 394
 // $selected, if non-null, is a list of selected values
395 395
 //
396
-function form_select_multiple($label, $name, $items, $selected=null) {
396
+function form_select_multiple($label, $name, $items, $selected = null) {
397 397
     echo sprintf('
398 398
         <div class="form-group">
399 399
             <label align=right class="%s" for="%s">%s</label>
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
     foreach ($items as $i) {
406 406
         echo sprintf(
407 407
             '<option %s value=%s>%s</option>',
408
-            ($selected && in_array($i[0], $selected))?'selected':'',
408
+            ($selected && in_array($i[0], $selected)) ? 'selected' : '',
409 409
             $i[0], $i[1]
410 410
         );
411 411
     }
@@ -414,12 +414,12 @@  discard block
 block discarded – undo
414 414
 
415 415
 // return a list of string for checkbox items
416 416
 //
417
-function checkbox_item_strings($items, $attrs='') {
417
+function checkbox_item_strings($items, $attrs = '') {
418 418
     $x = [];
419 419
     foreach ($items as $i) {
420 420
         $x[] = sprintf('<input %s type="checkbox" name="%s" %s> %s
421 421
             ',
422
-            $attrs, $i[0], $i[2]?"checked":"", $i[1]
422
+            $attrs, $i[0], $i[2] ? "checked" : "", $i[1]
423 423
         );
424 424
     }
425 425
     return $x;
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
 
428 428
 // $items is list of (name, label, checked)
429 429
 //
430
-function form_checkboxes($label, $items, $attrs='') {
430
+function form_checkboxes($label, $items, $attrs = '') {
431 431
     echo sprintf('
432 432
         <div class="form-group">
433 433
             <label align=right class="%s">%s</label>
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
         FORM_LEFT_CLASS, $label, FORM_RIGHT_CLASS
454 454
     );
455 455
     foreach ($items as $i) {
456
-        $checked = ($selected == $i[0])?"checked":"";
456
+        $checked = ($selected == $i[0]) ? "checked" : "";
457 457
         echo sprintf('<input type="radio" name="%s" value="%s" %s> %s <br>
458 458
             ',
459 459
             $name, $i[0], $checked, $i[1]
@@ -486,7 +486,7 @@  discard block
 block discarded – undo
486 486
 ';
487 487
 }
488 488
 
489
-function form_submit($text, $attrs='') {
489
+function form_submit($text, $attrs = '') {
490 490
     form_general(
491 491
         "",
492 492
         sprintf('<button %s type="submit" class="btn btn-success">%s</button>',
@@ -495,11 +495,11 @@  discard block
 block discarded – undo
495 495
     );
496 496
 }
497 497
 
498
-function form_checkbox($label, $name, $checked=false) {
498
+function form_checkbox($label, $name, $checked = false) {
499 499
     echo sprintf('
500 500
         <div class="form-group">
501 501
             <input type="checkbox" name="%s" %s> &nbsp; <span class="lead">%s</span>
502 502
         </div>
503
-        ', $name, $checked?"checked":"", $label
503
+        ', $name, $checked ? "checked" : "", $label
504 504
     );
505 505
 }
Please login to merge, or discard this patch.
html/user/submit_rpc_handler.php 1 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/inc/util.inc 1 patch
Spacing   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -33,17 +33,17 @@  discard block
 block discarded – undo
33 33
 //
34 34
 $config = get_config();
35 35
 global $master_url;
36
-$master_url = parse_config($config , "<master_url>");
36
+$master_url = parse_config($config, "<master_url>");
37 37
 $recaptcha_public_key = parse_config($config, "<recaptcha_public_key>");
38 38
 $recaptcha_private_key = parse_config($config, "<recaptcha_private_key>");
39 39
 
40 40
 // Set parameters to defaults if not defined in config.xml
41 41
 
42 42
 $x = parse_config($config, "<user_country>");
43
-define('USER_COUNTRY', ($x===null)?1:(int)$x);
43
+define('USER_COUNTRY', ($x === null) ? 1 : (int)$x);
44 44
 
45 45
 $x = parse_config($config, "<user_url>");
46
-define('USER_URL', ($x===null)?1:(int)$x);
46
+define('USER_URL', ($x === null) ? 1 : (int)$x);
47 47
 
48 48
 // Set parameters to defaults if not defined in project.inc
49 49
 
@@ -136,10 +136,10 @@  discard block
 block discarded – undo
136 136
 }
137 137
 
138 138
 function url_base() {
139
-    return is_https()?secure_url_base():URL_BASE;
139
+    return is_https() ?secure_url_base() : URL_BASE;
140 140
 }
141 141
 
142
-function send_cookie($name, $value, $permanent, $ops=false) {
142
+function send_cookie($name, $value, $permanent, $ops = false) {
143 143
     global $master_url;
144 144
 
145 145
     // the following allows independent login for projects on the same server
@@ -150,11 +150,11 @@  discard block
 block discarded – undo
150 150
         $path = substr($path, 0, -1);
151 151
         $path .= "_ops/";
152 152
     }
153
-    $expire = $permanent?time()+3600*24*365:0;
153
+    $expire = $permanent ?time() + 3600*24*365 : 0;
154 154
     setcookie($name, $value, $expire, $path);
155 155
 }
156 156
 
157
-function clear_cookie($name, $ops=false) {
157
+function clear_cookie($name, $ops = false) {
158 158
     global $master_url;
159 159
     $url = parse_url($master_url);
160 160
     $path = $url['path'];
@@ -162,13 +162,13 @@  discard block
 block discarded – undo
162 162
         $path = substr($path, 0, -1);
163 163
         $path .= "_ops/";
164 164
     }
165
-    setcookie($name, '', time()-3600, $path);
165
+    setcookie($name, '', time() - 3600, $path);
166 166
 }
167 167
 
168 168
 $g_logged_in_user = null;
169 169
 $got_logged_in_user = false;
170 170
 
171
-function get_logged_in_user($must_be_logged_in=true) {
171
+function get_logged_in_user($must_be_logged_in = true) {
172 172
     global $g_logged_in_user, $got_logged_in_user;
173 173
     if ($got_logged_in_user) {
174 174
         // this could have been called earlier with $must_be_logged_in false
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
             $next_url = $_SERVER['REQUEST_URI'];
195 195
             $n = strrpos($next_url, "/");
196 196
             if ($n) {
197
-                $next_url = substr($next_url, $n+1);
197
+                $next_url = substr($next_url, $n + 1);
198 198
             }
199 199
         }
200 200
         $next_url = urlencode($next_url);
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
     return $g_logged_in_user;
206 206
 }
207 207
 
208
-function show_login_info($prefix="") {
208
+function show_login_info($prefix = "") {
209 209
     $user = get_logged_in_user(false);
210 210
     if ($user) {
211 211
         $url_tokens = url_tokens($user->authenticator);
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
     }
216 216
 }
217 217
 
218
-$cache_control_extra="";
218
+$cache_control_extra = "";
219 219
 $is_login_page = false;
220 220
 
221 221
 // Call this to start pages.
@@ -227,11 +227,11 @@  discard block
 block discarded – undo
227 227
 // with an existing web framework can more easily do so.
228 228
 // To do so, define page_head() in the project include file.
229 229
 //
230
-if (!function_exists("page_head")){
230
+if (!function_exists("page_head")) {
231 231
 function page_head(
232 232
     $title,
233 233
         // page title. Put in <title>, used as title for browser tab.
234
-    $body_attrs=null,
234
+    $body_attrs = null,
235 235
         // <body XXXX>
236 236
         // e.g. Javascript to put focus in an input field
237 237
         // (onload="document.form.foo.focus()")
@@ -240,10 +240,10 @@  discard block
 block discarded – undo
240 240
         // if set, include schedulers.txt.
241 241
         // also pass to project_banner() in case you want a different
242 242
         // header for your main page.
243
-    $url_prefix="",
243
+    $url_prefix = "",
244 244
         // prepend this to links.
245 245
         // Use for web pages not in the top directory
246
-    $head_extra=null
246
+    $head_extra = null
247 247
         // extra stuff to put in <head>. E.g.:
248 248
         // reCAPTCHA code (create_profile.php)
249 249
         // bbcode javascript (forums)
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
         header("Content-type: text/html; charset=utf-8");
266 266
         header("Expires: Mon, 26 Jul 1997 05:00:00 UTC");
267 267
             // Date in the past
268
-        header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " UTC");
268
+        header("Last-Modified: ".gmdate("D, d M Y H:i:s")." UTC");
269 269
             // always modified
270 270
         header("Cache-Control: $cache_control_extra no-cache, must-revalidate, post-check=0, pre-check=0");
271 271
             // for HTTP/1.1
@@ -286,11 +286,11 @@  discard block
 block discarded – undo
286 286
     if ($head_extra) {
287 287
         echo "\n$head_extra\n";
288 288
     }
289
-    if ($is_main && (!defined('NO_COMPUTING')||!NO_COMPUTING)) {
289
+    if ($is_main && (!defined('NO_COMPUTING') || !NO_COMPUTING)) {
290 290
         readfile("schedulers.txt");
291 291
     }
292 292
 
293
-    $t = $title?$title:PROJECT;
293
+    $t = $title ? $title : PROJECT;
294 294
     echo "<title>$t</title>\n";
295 295
     echo '
296 296
         <meta charset="utf-8">
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
     echo '<div class="container-fluid">
348 348
     ';
349 349
 
350
-    switch($title) {    //kludge
350
+    switch ($title) {    //kludge
351 351
     case tra("Log in"):
352 352
     case tra("Create an account"):
353 353
     case tra("Server status page"):
@@ -362,13 +362,13 @@  discard block
 block discarded – undo
362 362
 
363 363
 // See the comments for page_head()
364 364
 //
365
-if (!function_exists("page_tail")){
365
+if (!function_exists("page_tail")) {
366 366
 function page_tail(
367
-    $show_date=false,
367
+    $show_date = false,
368 368
         // true for pages that are generated periodically rather than on the fly
369
-    $url_prefix="",
369
+    $url_prefix = "",
370 370
         // use for pages not at top level
371
-    $is_main=false
371
+    $is_main = false
372 372
         // passed to project_footer;
373 373
 ) {
374 374
     echo "<br>\n";
@@ -383,10 +383,10 @@  discard block
 block discarded – undo
383 383
 }
384 384
 }
385 385
 
386
-function display_cvs_versions(){
386
+function display_cvs_versions() {
387 387
     global $cvs_version_tracker;
388 388
     echo "\n<!-- SVN VERSIONS -->\n";
389
-    for ($i=0;$i<sizeof($cvs_version_tracker);$i++) {
389
+    for ($i = 0; $i < sizeof($cvs_version_tracker); $i++) {
390 390
         echo "<!-- ".$cvs_version_tracker[$i]." -->\n";
391 391
     }
392 392
 }
@@ -411,24 +411,24 @@  discard block
 block discarded – undo
411 411
 // convert time interval in seconds to a string of the form
412 412
 // 'D days h hours m min s sec'.
413 413
 
414
-function time_diff($x, $res=3) {
414
+function time_diff($x, $res = 3) {
415 415
     $x = (int)$x;
416 416
     $days    = (int)($x/86400);
417
-    $hours   = (int)(($x-$days*86400)/3600);
418
-    $minutes = (int)(($x-$days*86400-$hours*3600)/60);
419
-    $seconds = $x % 60;
417
+    $hours   = (int)(($x - $days*86400)/3600);
418
+    $minutes = (int)(($x - $days*86400 - $hours*3600)/60);
419
+    $seconds = $x%60;
420 420
 
421 421
     $s = "";
422 422
     if ($days) {
423 423
         $s .= "$days ".tra("days")." ";
424 424
     }
425
-    if ($res>0 && ($hours || strlen($s))) {
425
+    if ($res > 0 && ($hours || strlen($s))) {
426 426
         $s .= "$hours ".tra("hours")." ";
427 427
     }
428
-    if ($res>1 && ($minutes || strlen($s))) {
428
+    if ($res > 1 && ($minutes || strlen($s))) {
429 429
         $s .= "$minutes ".tra("min")." ";
430 430
     }
431
-    if ($res>2) {
431
+    if ($res > 2) {
432 432
         $s .= "$seconds ".tra("sec")." ";
433 433
     }
434 434
     return $s;
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
 
443 443
 function time_str($x) {
444 444
     if ($x == 0) return "---";
445
-    return gmdate('j M Y, G:i:s', (int)$x) . " UTC";
445
+    return gmdate('j M Y, G:i:s', (int)$x)." UTC";
446 446
 }
447 447
 
448 448
 function local_time_str($x) {
@@ -454,14 +454,14 @@  discard block
 block discarded – undo
454 454
     return time_str($x);
455 455
 }
456 456
 
457
-function start_table_str($class="", $style="") {
458
-    $s = $style?'style="'.$style.'"':'';
457
+function start_table_str($class = "", $style = "") {
458
+    $s = $style ? 'style="'.$style.'"' : '';
459 459
     return '<div class="table">
460 460
       <table '.$s.' width="100%" class="table table-condensed '.$class.'" >
461 461
     ';
462 462
 }
463 463
 
464
-function start_table($class="", $style="") {
464
+function start_table($class = "", $style = "") {
465 465
     echo start_table_str($class, $style);
466 466
 }
467 467
 
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
     echo "</tr>\n";
507 507
 }
508 508
 
509
-function row1($x, $ncols=2, $class="heading") {
509
+function row1($x, $ncols = 2, $class = "heading") {
510 510
     if ($class == "heading") {
511 511
         echo "<tr><th class=\"bg-primary\" colspan=\"$ncols\">$x</th></tr>\n";
512 512
     } else {
@@ -520,10 +520,10 @@  discard block
 block discarded – undo
520 520
 
521 521
 // a table row with 2 columns, with the left on right-aligned
522 522
 
523
-function row2($x, $y, $show_error=false, $lwidth='40%') {
524
-    if ($x==="") $x="<br>";
525
-    if ($y==="") $y="<br>";
526
-    $attrs = $show_error?VALUE_ATTRS_ERR:VALUE_ATTRS;
523
+function row2($x, $y, $show_error = false, $lwidth = '40%') {
524
+    if ($x === "") $x = "<br>";
525
+    if ($y === "") $y = "<br>";
526
+    $attrs = $show_error ?VALUE_ATTRS_ERR:VALUE_ATTRS;
527 527
     echo "<tr>
528 528
         <td width=\"$lwidth\" ".NAME_ATTRS.">$x</td>
529 529
         <td $attrs >$y</td>
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
 // output the first part of row2();
535 535
 // then write the content, followed by </td></tr>
536 536
 
537
-function row2_init($x, $lwidth='40%') {
537
+function row2_init($x, $lwidth = '40%') {
538 538
     echo sprintf('<tr>
539 539
         <td width="%s" %s>%s</td>
540 540
         <td %s>',
@@ -558,20 +558,20 @@  discard block
 block discarded – undo
558 558
     echo "</tr>\n";
559 559
 }
560 560
 
561
-define ('ALIGN_RIGHT', 'style="text-align:right;"');
561
+define('ALIGN_RIGHT', 'style="text-align:right;"');
562 562
 
563
-function row_heading_array($x, $attrs=null, $class='bg-primary') {
563
+function row_heading_array($x, $attrs = null, $class = 'bg-primary') {
564 564
     echo "<tr>";
565 565
     $i = 0;
566 566
     foreach ($x as $h) {
567
-        $a = $attrs?$attrs[$i]:"";
567
+        $a = $attrs ? $attrs[$i] : "";
568 568
         echo "<th $a class=\"$class\">$h</th>";
569 569
         $i++;
570 570
     }
571 571
     echo "</tr>\n";
572 572
 }
573 573
 
574
-function row_heading($x, $class='bg-primary') {
574
+function row_heading($x, $class = 'bg-primary') {
575 575
     echo sprintf('<tr><th class="%s" colspan=99>%s</th></tr>
576 576
         ', $class, $x
577 577
     );
@@ -631,7 +631,7 @@  discard block
 block discarded – undo
631 631
 // If $ellipsis is true, then an ellipsis is added to any sentence which
632 632
 // is cut short.
633 633
 
634
-function sub_sentence($sentence, $delimiter, $max_chars, $ellipsis=false) {
634
+function sub_sentence($sentence, $delimiter, $max_chars, $ellipsis = false) {
635 635
     $words = explode($delimiter, $sentence);
636 636
     $total_chars = 0;
637 637
     $trunc = false;
@@ -714,8 +714,8 @@  discard block
 block discarded – undo
714 714
 
715 715
 // returns null if the arg is optional and missing
716 716
 //
717
-function get_int($name, $optional=false) {
718
-    $x=null;
717
+function get_int($name, $optional = false) {
718
+    $x = null;
719 719
     if (isset($_GET[$name])) $x = $_GET[$name];
720 720
     if (!is_numeric($x)) {
721 721
         if ($optional) {
@@ -734,7 +734,7 @@  discard block
 block discarded – undo
734 734
 
735 735
 // returns null if the arg is optional and missing
736 736
 //
737
-function post_num($name, $optional=false) {
737
+function post_num($name, $optional = false) {
738 738
     $x = null;
739 739
     if (isset($_POST[$name])) $x = $_POST[$name];
740 740
     if (!is_numeric($x)) {
@@ -749,7 +749,7 @@  discard block
 block discarded – undo
749 749
 
750 750
 // returns null if the arg is optional and missing
751 751
 //
752
-function post_int($name, $optional=false) {
752
+function post_int($name, $optional = false) {
753 753
     $x = post_num($name, $optional);
754 754
     if (is_null($x)) return null;
755 755
     $y = (int)$x;
@@ -767,7 +767,7 @@  discard block
 block discarded – undo
767 767
     }
768 768
 }
769 769
 
770
-function get_str($name, $optional=false) {
770
+function get_str($name, $optional = false) {
771 771
     if (isset($_GET[$name])) {
772 772
         $x = $_GET[$name];
773 773
     } else {
@@ -779,7 +779,7 @@  discard block
 block discarded – undo
779 779
     return undo_magic_quotes($x);
780 780
 }
781 781
 
782
-function post_str($name, $optional=false) {
782
+function post_str($name, $optional = false) {
783 783
     if (isset($_POST[$name])) {
784 784
         $x = $_POST[$name];
785 785
     } else {
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
     return undo_magic_quotes($x);
792 792
 }
793 793
 
794
-function post_arr($name, $optional=false) {
794
+function post_arr($name, $optional = false) {
795 795
     if (isset($_POST[$name]) && is_array($_POST[$name])) {
796 796
         $x = $_POST[$name];
797 797
     } else {
@@ -807,7 +807,7 @@  discard block
 block discarded – undo
807 807
     // the mb_* functions are not included by default
808 808
     // return (mb_detect_encoding($passwd) -= 'ASCII');
809 809
 
810
-    for ($i=0; $i<strlen($str); $i++) {
810
+    for ($i = 0; $i < strlen($str); $i++) {
811 811
         $c = ord(substr($str, $i));
812 812
         if ($c < 32 || $c > 127) return false;
813 813
     }
@@ -831,7 +831,7 @@  discard block
 block discarded – undo
831 831
     $number = str_replace(',', '.', $number); // replace the german decimal separator
832 832
     // if no value was entered and this is ok
833 833
     //
834
-    if ($number=='' && !$low) return true;
834
+    if ($number == '' && !$low) return true;
835 835
 
836 836
     // the supplied value contains alphabetic characters
837 837
     //
@@ -848,7 +848,7 @@  discard block
 block discarded – undo
848 848
 
849 849
 // Generate a "select" element from an array of values
850 850
 //
851
-function select_from_array($name, $array, $selection=null, $width=240) {
851
+function select_from_array($name, $array, $selection = null, $width = 240) {
852 852
     $out = '<select style="color:#000;"class="form-control input-sm" style="width:'.$width.'px" name="'.$name.'">"';
853 853
 
854 854
     foreach ($array as $key => $value) {
@@ -873,8 +873,8 @@  discard block
 block discarded – undo
873 873
     return $str;
874 874
 }
875 875
 
876
-function strip_bbcode($string){
877
-    return preg_replace("/((\[.+\])+?)(.+?)((\[\/.+\])+?)/","",$string);
876
+function strip_bbcode($string) {
877
+    return preg_replace("/((\[.+\])+?)(.+?)((\[\/.+\])+?)/", "", $string);
878 878
 }
879 879
 
880 880
 function current_url() {
@@ -903,7 +903,7 @@  discard block
 block discarded – undo
903 903
 // @params extra Additional text in href tag
904 904
 //
905 905
 
906
-function button_text($url, $text, $desc=null, $class=null, $extra='') {
906
+function button_text($url, $text, $desc = null, $class = null, $extra = '') {
907 907
     if (!$desc) {
908 908
         $desc = $text;
909 909
     }
@@ -915,19 +915,19 @@  discard block
 block discarded – undo
915 915
     );
916 916
 }
917 917
 
918
-function show_button($url, $text, $desc=null, $class=null, $extra=null) {
918
+function show_button($url, $text, $desc = null, $class = null, $extra = null) {
919 919
     echo button_text($url, $text, $desc, $class, $extra);
920 920
 }
921 921
 
922 922
 // for places with a bunch of buttons, like forum posts
923 923
 //
924
-function show_button_small($url, $text, $desc=null) {
924
+function show_button_small($url, $text, $desc = null) {
925 925
     echo button_text($url, $text, $desc, "btn-primary btn-xs");
926 926
 }
927 927
 
928 928
 // used for showing icons
929 929
 //
930
-function show_image($src, $title, $alt, $height=null) {
930
+function show_image($src, $title, $alt, $height = null) {
931 931
     $h = "";
932 932
     if ($height) {
933 933
         $h = "height=\"$height\"";
@@ -964,7 +964,7 @@  discard block
 block discarded – undo
964 964
 // tries instead to connect to <replica_db_host> if tag exists.
965 965
 // DEPRECATED - use boinc_db.inc
966 966
 //
967
-function db_init($try_replica=false) {
967
+function db_init($try_replica = false) {
968 968
     check_web_stopped();
969 969
     $retval = db_init_aux($try_replica);
970 970
     if ($retval == 1) {
@@ -1080,7 +1080,7 @@  discard block
 block discarded – undo
1080 1080
 // Check this to avoid XSS vulnerability
1081 1081
 //
1082 1082
 function sanitize_sort_by($x) {
1083
-    switch($x) {
1083
+    switch ($x) {
1084 1084
     case 'expavg_credit':
1085 1085
     case 'total_credit':
1086 1086
         return;
@@ -1097,9 +1097,9 @@  discard block
 block discarded – undo
1097 1097
     return $c/(200/24);
1098 1098
 }
1099 1099
 
1100
-function do_download($path,$name="") {
1101
-    if (strcmp($name,"") == 0) {
1102
-        $name=basename($path);
1100
+function do_download($path, $name = "") {
1101
+    if (strcmp($name, "") == 0) {
1102
+        $name = basename($path);
1103 1103
     }
1104 1104
     header('Content-Description: File Transfer');
1105 1105
     header('Content-Type: application/octet-stream');
@@ -1108,7 +1108,7 @@  discard block
 block discarded – undo
1108 1108
     header('Expires: 0');
1109 1109
     header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
1110 1110
     header('Pragma: public');
1111
-    header('Content-Length: ' . filesize($path));
1111
+    header('Content-Length: '.filesize($path));
1112 1112
     flush();
1113 1113
     readfile($path);
1114 1114
 }
@@ -1157,10 +1157,10 @@  discard block
 block discarded – undo
1157 1157
 // Otherwise return 0.
1158 1158
 // Format of user agent string is "BOINC client (windows_x86_64 7.3.17)"
1159 1159
 //
1160
-function boinc_client_version(){
1160
+function boinc_client_version() {
1161 1161
     if (!array_key_exists('HTTP_USER_AGENT', $_SERVER)) return 0;
1162 1162
     $x = $_SERVER['HTTP_USER_AGENT'];
1163
-    $e =  "/BOINC client [^ ]* (\d+).(\d+).(\d+)\)/";
1163
+    $e = "/BOINC client [^ ]* (\d+).(\d+).(\d+)\)/";
1164 1164
     if (preg_match($e, $x, $matches)) {
1165 1165
         return $matches[1]*10000 + $matches[2]*100 + $matches[3];
1166 1166
     }
@@ -1189,7 +1189,7 @@  discard block
 block discarded – undo
1189 1189
     $rem_name = $name."_remaining";
1190 1190
     return "<textarea name=\"$name\" class=\"form-control\" rows=3 id=\"$name\" onkeydown=\"text_counter(this.form.$name, this.form.$rem_name, $maxlen);\"
1191 1191
         onkeyup=\"text_counter(this.form.$name, this.form.$rem_name, $maxlen);\">".$text."</textarea>
1192
-        <br><input name=\"$rem_name\" type=\"text\" id=\"$rem_name\" value=\"".($maxlen-strlen($text))."\" size=\"3\" maxlength=\"3\" readonly> ".tra("characters remaining")
1192
+        <br><input name=\"$rem_name\" type=\"text\" id=\"$rem_name\" value=\"".($maxlen - strlen($text))."\" size=\"3\" maxlength=\"3\" readonly> ".tra("characters remaining")
1193 1193
     ;
1194 1194
 }
1195 1195
 
@@ -1219,7 +1219,7 @@  discard block
 block discarded – undo
1219 1219
 // use the following around text with long lines,
1220 1220
 // to limit the width and make it more readable.
1221 1221
 //
1222
-function text_start($width=640) {
1222
+function text_start($width = 640) {
1223 1223
     echo sprintf("<div style=\"max-width: %dpx;\">\n", $width);
1224 1224
 }
1225 1225
 function text_end() {
@@ -1245,7 +1245,7 @@  discard block
 block discarded – undo
1245 1245
 }
1246 1246
 
1247 1247
 function cert_filename() {
1248
-    return defined("CERT_FILENAME")?CERT_FILENAME:"cert1.php";
1248
+    return defined("CERT_FILENAME") ?CERT_FILENAME:"cert1.php";
1249 1249
 }
1250 1250
 
1251 1251
 // if user hasn't validated their email addr, tell them to
@@ -1262,6 +1262,6 @@  discard block
 block discarded – undo
1262 1262
     }
1263 1263
 }
1264 1264
 
1265
-$cvs_version_tracker[]="\$Id$";  //Generated automatically - do not edit
1265
+$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit
1266 1266
 
1267 1267
 ?>
Please login to merge, or discard this patch.
html/inc/team.inc 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
     row2('<b>'.tra('Search criteria (use one or more)').'</b>', '');
41 41
     row2(
42 42
         tra('Key words').'<br><small>'.tra('Find teams with these words in their names or descriptions').'</small>',
43
-        '<input class="form-control" type="text" name="keywords" value="' . htmlspecialchars($params->keywords) . '">');
43
+        '<input class="form-control" type="text" name="keywords" value="'.htmlspecialchars($params->keywords).'">');
44 44
     row2_init(tra('Country'));
45 45
     echo '<select class="form-control" name="country"><option value="" selected>---</option>';
46 46
     $country = $params->country;
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
     echo country_select_options($country);
49 49
     echo "</select></td></tr>\n";
50 50
     row2(tra('Type of team'), team_type_select($params->type, true));
51
-    $checked = $params->active?"checked":"";
51
+    $checked = $params->active ? "checked" : "";
52 52
     row2(tra('Show only active teams'), "<input type=checkbox name=active $checked>");
53 53
     row2("", "<input class=\"btn btn-primary\" type=submit name=submit value=\"".tra('Search')."\">");
54 54
     end_table();
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
     row2("Created", date_str($team->create_time));
97 97
     if (defined("SHOW_NONVALIDATED_TEAMS")) {
98 98
         $founder = $team->founder;
99
-        row2("Founder email validated", $founder->email_validated?"Yes":"No (team will not be exported)");
99
+        row2("Founder email validated", $founder->email_validated ? "Yes" : "No (team will not be exported)");
100 100
     }
101 101
     if (strlen($team->url)) {;
102 102
         if (strstr($team->url, "http://")) {
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
     }
170 170
     row1(tra('Members'));
171 171
     row2(tra('Founder'),
172
-        $team->founder?user_links($team->founder, BADGE_HEIGHT_MEDIUM):"---"
172
+        $team->founder ?user_links($team->founder, BADGE_HEIGHT_MEDIUM) : "---"
173 173
     );
174 174
     if (count($team->admins)) {
175 175
         $first = true;
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
     foreach ($deltas as $delta) {
357 357
         $u = BoincUser::lookup_id($delta->userid);
358 358
         if ($u->teamid == $teamid) {
359
-            $new_members[] = $u->id;  // they might have later quit
359
+            $new_members[] = $u->id; // they might have later quit
360 360
         }
361 361
     }
362 362
     return array_unique($new_members);
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
     if (!$user->teamid) return;
440 440
     $user->update("teamid=0");
441 441
     $team = BoincTeam::lookup_id($user->teamid);
442
-    if ($team && $team->ping_user==$user->id) {
442
+    if ($team && $team->ping_user == $user->id) {
443 443
         $team->update("ping_user=-ping_user");
444 444
     }
445 445
     BoincTeamAdmin::delete("teamid=$user->teamid and userid=$user->id");
@@ -478,33 +478,33 @@  discard block
 block discarded – undo
478 478
     start_table();
479 479
     row2(tra('Team name, text version').'
480 480
         <br><p class=\"text-muted\">'.tra('Don\'t use HTML tags.').'</p>',
481
-        '<input class="form-control" name="name" type="text" size="50" value="'.($team?$team->name:"").'">'
481
+        '<input class="form-control" name="name" type="text" size="50" value="'.($team ? $team->name : "").'">'
482 482
     );
483 483
     row2(tra('Team name, HTML version').'
484 484
         <br><p class=\"text-muted\">
485 485
         '.tra('You may use %1 limited HTML tags %2.', '<a href="html.php" target="_new">', '</a>').'
486 486
         '.tra('If you don\'t know HTML, leave this box blank.').'</p>',
487
-        '<input class="form-control" name="name_html" type="text" size="50" value="'.str_replace('"',"'",($team?$team->name_html:"")).'">'
487
+        '<input class="form-control" name="name_html" type="text" size="50" value="'.str_replace('"', "'", ($team ? $team->name_html : "")).'">'
488 488
     );
489 489
     row2(tra('URL of team web page, if any').':<br><font size=-2>('.tra('without "http://"').')
490 490
         '.tra('This URL will be linked to from the team\'s page on this site.'),
491
-        '<input class="form-control" type="text" name="url" size="60" value="'.($team?$team->url:"").'">'
491
+        '<input class="form-control" type="text" name="url" size="60" value="'.($team ? $team->url : "").'">'
492 492
     );
493 493
     row2(tra('Description of team').':
494 494
         <br><p class=\"text-muted\">
495 495
         '.tra('You may use %1 limited HTML tags %2.', '<a href="html.php" target="_new">', '</a>').'
496 496
         </p>',
497
-        '<textarea class="form-control" name="description" rows=10>'.($team?$team->description:"").'</textarea>'
497
+        '<textarea class="form-control" name="description" rows=10>'.($team ? $team->description : "").'</textarea>'
498 498
     );
499 499
 
500
-    row2(tra('Type of team').':', team_type_select($team?$team->type:null));
500
+    row2(tra('Type of team').':', team_type_select($team ? $team->type : null));
501 501
 
502 502
     row2_init(tra('Country'));
503 503
     echo '<select class="form-control" name="country">';
504
-    echo country_select_options($team?$team->country:null);
504
+    echo country_select_options($team ? $team->country : null);
505 505
     echo "</select></td></tr>\n";
506 506
 
507
-    $x = (!$team || $team->joinable)?"checked":"";
507
+    $x = (!$team || $team->joinable) ? "checked" : "";
508 508
     row2(tra("Accept new members?"), "<input type=checkbox name=joinable $x>");
509 509
     // Check if we're using reCaptcha to prevent spam accounts
510 510
     //
@@ -568,12 +568,12 @@  discard block
 block discarded – undo
568 568
 //
569 569
 function new_transfer_request_ok($team, $now) {
570 570
     if ($team->ping_user <= 0) {
571
-        if ($team->ping_time < $now - 60 * 86400) {
571
+        if ($team->ping_time < $now - 60*86400) {
572 572
             return true;
573 573
         }
574 574
         return false;
575 575
     }
576
-    if ($team->ping_time < $now - 90 * 86400) {
576
+    if ($team->ping_time < $now - 90*86400) {
577 577
         return true;
578 578
     }
579 579
     return false;
@@ -608,7 +608,7 @@  discard block
 block discarded – undo
608 608
     if (!is_valid_country($country)) {
609 609
         $country = tra('None');
610 610
     }
611
-    $country = BoincDb::escape_string($country);  // for Cote d'Ivoire
611
+    $country = BoincDb::escape_string($country); // for Cote d'Ivoire
612 612
 
613 613
     $clause = sprintf(
614 614
         "(userid, create_time, name, name_lc, url, type, name_html, description, country, nusers, expavg_time) values(%d, %d, '%s', '%s', '%s', %d, '%s', '%s', '%s', %d, unix_timestamp())",
@@ -631,6 +631,6 @@  discard block
 block discarded – undo
631 631
     }
632 632
 }
633 633
 
634
-$cvs_version_tracker[]="\$Id$";  //Generated automatically - do not edit
634
+$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit
635 635
 
636 636
 ?>
Please login to merge, or discard this patch.