Passed
Pull Request — master (#6645)
by
unknown
14:22 queued 05:20
created
html/user/job_file.php 1 patch
Switch Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -80,20 +80,20 @@
 block discarded – undo
80 80
 
81 81
 function upload_error_description($errno) {
82 82
     switch ($errno) {
83
-        case UPLOAD_ERR_INI_SIZE:
84
-            return "The uploaded file exceeds upload_max_filesize of php.ini."; break;
85
-        case UPLOAD_ERR_FORM_SIZE:
86
-            return "The uploaded file exceeds the MAX_FILE_SIZE specified in the HTML form."; break;
87
-        case UPLOAD_ERR_PARTIAL:
88
-            return "The uploaded file was only partially uploaded."; break;
89
-        case UPLOAD_ERR_NO_FILE:
90
-            return "No file was uploaded."; break;
91
-        case UPLOAD_ERR_NO_TMP_DIR:
92
-            return "Missing a temporary folder."; break;
93
-        case UPLOAD_ERR_CANT_WRITE:
94
-            return "Failed to write file to disk."; break;
95
-        case UPLOAD_ERR_EXTENSION:
96
-            return "A PHP extension stopped the file upload."; break;
83
+    case UPLOAD_ERR_INI_SIZE:
84
+        return "The uploaded file exceeds upload_max_filesize of php.ini."; break;
85
+    case UPLOAD_ERR_FORM_SIZE:
86
+        return "The uploaded file exceeds the MAX_FILE_SIZE specified in the HTML form."; break;
87
+    case UPLOAD_ERR_PARTIAL:
88
+        return "The uploaded file was only partially uploaded."; break;
89
+    case UPLOAD_ERR_NO_FILE:
90
+        return "No file was uploaded."; break;
91
+    case UPLOAD_ERR_NO_TMP_DIR:
92
+        return "Missing a temporary folder."; break;
93
+    case UPLOAD_ERR_CANT_WRITE:
94
+        return "Failed to write file to disk."; break;
95
+    case UPLOAD_ERR_EXTENSION:
96
+        return "A PHP extension stopped the file upload."; break;
97 97
     }
98 98
 }
99 99
 
Please login to merge, or discard this patch.
html/inc/pm.inc 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
     return $x;
52 52
 }
53 53
 
54
-function pm_team_form($user, $teamid, $error=null) {
54
+function pm_team_form($user, $teamid, $error = null) {
55 55
     global $bbcode_html, $bbcode_js;
56 56
     $team = BoincTeam::lookup_id($teamid);
57 57
     if (!$team) {
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
         error_page("not admin");
62 62
     }
63 63
 
64
-    page_head(tra("Send message to team"),'','','', $bbcode_js);
64
+    page_head(tra("Send message to team"), '', '', '', $bbcode_js);
65 65
 
66 66
     $subject = post_str("subject", true);
67 67
     $content = post_str("content", true);
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 function pm_form_page($replyto, $userid, $error = null) {
114 114
     global $bbcode_html, $bbcode_js;
115 115
     global $g_logged_in_user;
116
-    page_head(tra("Send private message"),'','','', $bbcode_js);
116
+    page_head(tra("Send private message"), '', '', '', $bbcode_js);
117 117
 
118 118
     if (post_str("preview", true) == tra("Preview")) {
119 119
         $content = post_str("content", true);
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
         if (!$user) {
138 138
             error_page("Sender no longer exists");
139 139
         }
140
-        $writeto = UNIQUE_USER_NAME?$user->name:$userid." (".$user->name.")";
140
+        $writeto = UNIQUE_USER_NAME ? $user->name : $userid." (".$user->name.")";
141 141
         $subject = $message->subject;
142 142
         if (substr($subject, 0, 3) != "re:") {
143 143
             $subject = "re: ".$subject;
@@ -156,15 +156,15 @@  discard block
 block discarded – undo
156 156
                 time_str($user->prefs->banished_until)
157 157
             );
158 158
         }
159
-        $writeto = UNIQUE_USER_NAME?$user->name:$userid." (".$user->name.")";
159
+        $writeto = UNIQUE_USER_NAME ? $user->name : $userid." (".$user->name.")";
160 160
     } else {
161 161
         $writeto = sanitize_tags(post_str("to", true));
162 162
         $subject = post_str("subject", true);
163 163
         $content = post_str("content", true);
164 164
     }
165 165
 
166
-    $content = $content?htmlspecialchars($content):'';
167
-    $subject = $subject?htmlspecialchars($subject):'';
166
+    $content = $content ?htmlspecialchars($content) : '';
167
+    $subject = $subject ?htmlspecialchars($subject) : '';
168 168
 
169 169
     if ($error != null) {
170 170
         echo "<p class=\"text-danger\">".$error."</p>\n";
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 function send_pm_notification_email(
221 221
     $logged_in_user, $to_user, $subject, $content
222 222
 ) {
223
-    $message  = "
223
+    $message = "
224 224
 You have received a new private message at ".PROJECT.".
225 225
 
226 226
 From: $logged_in_user->name (ID $logged_in_user->id)
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
     $pm = BoincPrivateMessage::lookup_id($notify->opaque);
251 251
     $from_user = BoincUser::lookup_id($pm->senderid);
252 252
     if (!$pm || !$from_user) return null;
253
-    return "<a href=pm.php>".tra("Private message%1 from %2, subject:" , "</a>", $from_user->name )." $pm->subject";
253
+    return "<a href=pm.php>".tra("Private message%1 from %2, subject:", "</a>", $from_user->name)." $pm->subject";
254 254
 }
255 255
 
256 256
 function pm_send_msg($from_user, $to_user, $subject, $content, $send_email) {
@@ -314,11 +314,11 @@  discard block
 block discarded – undo
314 314
 
315 315
 function pm_email_remind($user) {
316 316
     if (!$user->prefs->pm_notification) {
317
-        return "<br><small>" .
317
+        return "<br><small>".
318 318
             tra(
319 319
                 "For email notification, %1 edit community prefs %2",
320 320
                 '<a href="edit_forum_preferences_form.php">', '</a>'
321
-            ) .
321
+            ).
322 322
             "</small>"
323 323
         ;
324 324
     }
Please login to merge, or discard this patch.
html/user/sandbox.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
     page_tail();
85 85
 }
86 86
 
87
-function list_files($user, $notice=null) {
87
+function list_files($user, $notice = null) {
88 88
     $dir = sandbox_dir($user);
89 89
     if (!is_dir($dir)) error_page("Can't open sandbox directory");
90 90
     page_head("File sandbox");
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
     $notice = "";
169 169
     $dir = sandbox_dir($user);
170 170
     $count = count($_FILES['new_file']['tmp_name']);
171
-    for ($i=0; $i<$count; $i++) {
171
+    for ($i = 0; $i < $count; $i++) {
172 172
         $tmp_name = $_FILES['new_file']['tmp_name'][$i];
173 173
         if (!is_uploaded_file($tmp_name)) {
174 174
             error_page("$tmp_name is not uploaded file");
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 function get_file($user) {
217 217
     $dir = sandbox_dir($user);
218 218
     $url = post_str('url');
219
-    if (filter_var($url, FILTER_VALIDATE_URL) === FALSE) {
219
+    if (filter_var($url, FILTER_VALIDATE_URL) === false) {
220 220
         error_page('Not a valid URL');
221 221
     }
222 222
     $fname = basename($url);
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
     }
226 226
     $path = "$dir/$fname";
227 227
     if (file_exists($path)) {
228
-        error_page("File $fname exists; delete it first.");
228
+        error_page("file $fname exists; delete it first.");
229 229
     }
230 230
     copy($url, $path);
231 231
     $notice = "Fetched file from <strong>$url</strong><br/>";
Please login to merge, or discard this patch.
html/inc/host.inc 2 patches
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -293,13 +293,13 @@
 block discarded – undo
293 293
 // Older clients may have the old-style serialnum in the DB
294 294
 // despite the server being upgraded.
295 295
 //
296
-function vbox_desc($parsed_ser){
296
+function vbox_desc($parsed_ser) {
297 297
     if (empty($parsed_ser['vbox'])) return '---';
298 298
     $f = $parsed_ser['vbox'];
299 299
     $desc = sprintf('Virtualbox (%s) %s',
300 300
         $f[1], tra("installed")
301 301
     );
302
-    if (sizeof($f)<=2){
302
+    if (sizeof($f)<=2) {
303 303
         return $desc;
304 304
     }
305 305
     if ($f[2]=="1" and $f[3]=="1") {
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -32,12 +32,12 @@  discard block
 block discarded – undo
32 32
 
33 33
 function sched_log_name($x) {
34 34
     if ($x == 0) return "NO_SUCH_LOG";
35
-    return gmdate('Y-m-d_H/Y-m-d_H:i', $x) . ".txt";
35
+    return gmdate('Y-m-d_H/Y-m-d_H:i', $x).".txt";
36 36
 }
37 37
 
38 38
 function sched_log_link($x) {
39 39
     if (file_exists("sched_logs")) {
40
-        return "<a href=\"../sched_logs/" . sched_log_name($x) . "\">" . time_str($x) . "</a>";
40
+        return "<a href=\"../sched_logs/".sched_log_name($x)."\">".time_str($x)."</a>";
41 41
     } else {
42 42
         return time_str($x);
43 43
     }
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 
46 46
 function location_form($host) {
47 47
     $none = "selected";
48
-    $h=$w=$s=$m="";
48
+    $h = $w = $s = $m = "";
49 49
     if ($host->venue == "home") $h = "selected";
50 50
     if ($host->venue == "work") $w = "selected";
51 51
     if ($host->venue == "school") $s = "selected";
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
             row2(tra("Product name"), $host->product_name);
100 100
         }
101 101
         $x = $host->timezone/3600;
102
-        if ($x >= 0) $x="+$x";
102
+        if ($x >= 0) $x = "+$x";
103 103
         row2(tra("Local Standard Time"), tra("UTC %1 hours", $x));
104 104
     } else {
105 105
         $owner = BoincUser::lookup_id($host->userid);
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
         }
186 186
         if (defined('BATCH_ACCEL') && BATCH_ACCEL) {
187 187
             row2('Low turnaround time?',
188
-                $host->error_rate?'yes':'no'
188
+                $host->error_rate ? 'yes' : 'no'
189 189
             );
190 190
         }
191 191
     }
@@ -298,20 +298,20 @@  discard block
 block discarded – undo
298 298
 // Older clients may have the old-style serialnum in the DB
299 299
 // despite the server being upgraded.
300 300
 //
301
-function vbox_desc($parsed_ser){
301
+function vbox_desc($parsed_ser) {
302 302
     if (empty($parsed_ser['vbox'])) return '---';
303 303
     $f = $parsed_ser['vbox'];
304 304
     $desc = sprintf('Virtualbox (%s) %s',
305 305
         $f[1], tra("installed")
306 306
     );
307
-    if (sizeof($f)<=2){
307
+    if (sizeof($f) <= 2) {
308 308
         return $desc;
309 309
     }
310
-    if ($f[2]=="1" and $f[3]=="1") {
310
+    if ($f[2] == "1" and $f[3] == "1") {
311 311
         return $desc.tra(", CPU has hardware virtualization support and it is enabled");
312
-    } elseif ($f[2]=="1" and $f[3]=="0") {
312
+    } elseif ($f[2] == "1" and $f[3] == "0") {
313 313
         return $desc.tra(", CPU has hardware virtualization support but it is disabled");
314
-    } elseif ($f[2]=="0") {
314
+    } elseif ($f[2] == "0") {
315 315
         return $desc.tra(", CPU does not have hardware virtualization support");
316 316
     }
317 317
     return $desc;
@@ -336,13 +336,13 @@  discard block
 block discarded – undo
336 336
 
337 337
 // return a human-readable version of the GPU info
338 338
 //
339
-function gpu_desc($parsed_ser, $detail=true) {
339
+function gpu_desc($parsed_ser, $detail = true) {
340 340
     $str = "";
341 341
     foreach ($parsed_ser as $d) {
342 342
         if (!is_gpu_type($d[0])) continue;
343 343
         if (count($d) < 4) continue;
344 344
         if ($str) $str .= "<p>";
345
-        if ($d[2]!="" && $d[2]!="1") $str .= "[".$d[2]."] ";
345
+        if ($d[2] != "" && $d[2] != "1") $str .= "[".$d[2]."] ";
346 346
         if ($d[0] == "CUDA") {
347 347
             $str .= "NVIDIA";
348 348
         } else if ($d[0] == "CAL") {
@@ -548,14 +548,14 @@  discard block
 block discarded – undo
548 548
     if ($pos1 === false) return $x;
549 549
     $pos2 = strpos($model, ']');
550 550
     if ($pos2 === false) return $x;
551
-    $a = substr($model, $pos1+1, $pos2-$pos1-1);
551
+    $a = substr($model, $pos1 + 1, $pos2 - $pos1 - 1);
552 552
     $y = explode(" ", $a);
553 553
     if (count($y) == 0) return $x;
554 554
     if ($y[0] == "Family") {
555 555
         $x->info = $a;
556 556
     } else {
557 557
         $x->arch = $y[0];
558
-        $x->info = substr($a, strlen($y[0])+1);
558
+        $x->info = substr($a, strlen($y[0]) + 1);
559 559
     }
560 560
     return $x;
561 561
 }
@@ -644,7 +644,7 @@  discard block
 block discarded – undo
644 644
     $avg_time = 0;
645 645
 
646 646
     $results = BoincResult::enum("hostid=$hostid order by received_time");
647
-    foreach($results as $result) {
647
+    foreach ($results as $result) {
648 648
         if ($result->granted_credit <= 0) continue;
649 649
         $total += $result->granted_credit;
650 650
 
@@ -737,7 +737,7 @@  discard block
 block discarded – undo
737 737
 
738 738
 function link_url($sort, $rev, $show_all) {
739 739
     global $userid;
740
-    $x = $userid ? "&userid=$userid":"";
740
+    $x = $userid ? "&userid=$userid" : "";
741 741
     return "hosts_user.php?sort=$sort&rev=$rev&show_all=$show_all$x";
742 742
 }
743 743
 
@@ -811,7 +811,7 @@  discard block
 block discarded – undo
811 811
 }
812 812
 
813 813
 function show_user_hosts($userid, $private, $show_all, $sort, $rev) {
814
-    $desc = false;  // whether the sort order's default is decreasing
814
+    $desc = false; // whether the sort order's default is decreasing
815 815
     switch ($sort) {
816 816
     case "total_credit": $sort_clause = "total_credit"; $desc = true; break;
817 817
     case "expavg_credit": $sort_clause = "expavg_credit"; $desc = true; break;
@@ -834,7 +834,7 @@  discard block
 block discarded – undo
834 834
     more_or_less($sort, $rev, $show_all);
835 835
 
836 836
     $now = time();
837
-    $old_hosts=0;
837
+    $old_hosts = 0;
838 838
     $i = 1;
839 839
     $hosts = BoincHost::enum("userid=$userid order by $sort_clause limit 100");
840 840
     $any_product_name = false;
@@ -846,9 +846,9 @@  discard block
 block discarded – undo
846 846
     }
847 847
     user_host_table_start($private, $sort, $rev, $show_all, $any_product_name);
848 848
     foreach ($hosts as $host) {
849
-        $is_old=false;
849
+        $is_old = false;
850 850
         if (($now - $host->rpc_time) > 30*86400) {
851
-            $is_old=true;
851
+            $is_old = true;
852 852
             $old_hosts++;
853 853
         }
854 854
         if (!$show_all && $is_old) continue;
@@ -857,7 +857,7 @@  discard block
 block discarded – undo
857 857
     }
858 858
     end_table();
859 859
 
860
-    if ($old_hosts>0) {
860
+    if ($old_hosts > 0) {
861 861
         more_or_less($sort, $rev, $show_all);
862 862
     }
863 863
 
Please login to merge, or discard this patch.
html/user/show_apps.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
             $desc->long_name,
38 38
             $desc->description,
39 39
             kw_array_to_str($desc->sci_kw),
40
-            empty($desc->url)?'':"<a href=$desc->url>View</a>",
40
+            empty($desc->url) ? '' : "<a href=$desc->url>View</a>",
41 41
             'Yes'
42 42
         );
43 43
     }
Please login to merge, or discard this patch.
html/inc/bootstrap.inc 2 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -210,7 +210,7 @@
 block discarded – undo
210 210
                                 ];
211 211
                             } else {
212 212
                                 $x[] = [
213
-                                    "Manage $app->name",
213
+                                    "manage $app->name",
214 214
                                     "manage_project.php"
215 215
                                 ];
216 216
                             }
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 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
     $master_url = master_url();
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 // output a panel.
247 247
 // $content_func is a function that generates the panel contents
248 248
 //
249
-function panel($title, $content_func, $class="panel-primary", $body_class="") {
249
+function panel($title, $content_func, $class = "panel-primary", $body_class = "") {
250 250
     echo sprintf('<div class="panel %s">
251 251
         ', $class
252 252
     );
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 // $left_width is the width of left column in 1/12 units.
274 274
 // $arg is passed to the functions.
275 275
 //
276
-function grid($top_func, $left_func, $right_func, $left_width=6, $arg=null) {
276
+function grid($top_func, $left_func, $right_func, $left_width = 6, $arg = null) {
277 277
     echo '
278 278
         <div class="container-fluid">
279 279
     ';
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
             </div>
289 289
         ';
290 290
     }
291
-    $right_width = 12-$left_width;
291
+    $right_width = 12 - $left_width;
292 292
     echo '
293 293
         <div class="row">
294 294
         <div class="col-sm-'.$left_width.'">
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 //      use extra = "name=x"
313 313
 //      call forum_focus(x, foo) after defining the field
314 314
 //
315
-function form_start($action, $method='get', $extra='') {
315
+function form_start($action, $method = 'get', $extra = '') {
316 316
     echo sprintf(
317 317
         '<div class="container-fluid">
318 318
         <form class="form-horizontal" method="%s" action="%s" %s>'
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
 // just the input field
347 347
 //
348 348
 function form_input_text_field(
349
-    $name, $value='', $type='text', $attrs='', $extra=''
349
+    $name, $value = '', $type = 'text', $attrs = '', $extra = ''
350 350
 ) {
351 351
     return sprintf(
352 352
         '<input %s type="%s" class="form-control" name="%s" value="%s">%s',
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
 // the whole row
358 358
 //
359 359
 function form_input_text(
360
-    $label, $name, $value='', $type='text', $attrs='', $extra=''
360
+    $label, $name, $value = '', $type = 'text', $attrs = '', $extra = ''
361 361
 ) {
362 362
     echo sprintf('
363 363
         <div class="form-group">
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
     );
386 386
 }
387 387
 
388
-function form_input_textarea($label, $name, $value='', $nrows=4) {
388
+function form_input_textarea($label, $name, $value = '', $nrows = 4) {
389 389
     echo sprintf('
390 390
         <div class="form-group">
391 391
             <label align=right class="%s" for="%s">%s</label>
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
 // $items is either a string of <option> elements,
403 403
 // or an array of [value, name] pairs
404 404
 //
405
-function form_select($label, $name, $items, $selected=null) {
405
+function form_select($label, $name, $items, $selected = null) {
406 406
     echo sprintf('
407 407
         <div class="form-group">
408 408
             <label align=right class="%s" for="%s">%s</label>
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
         foreach ($items as $i) {
416 416
             echo sprintf(
417 417
                 '<option %s value="%s">%s</option>',
418
-                ($i[0]==$selected)?'selected':'',
418
+                ($i[0] == $selected) ? 'selected' : '',
419 419
                 $i[0], $i[1]
420 420
             );
421 421
         }
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
 // same, for multiple select.
429 429
 // $selected, if non-null, is a list of selected values
430 430
 //
431
-function form_select_multiple($label, $name, $items, $selected=null, $size=0) {
431
+function form_select_multiple($label, $name, $items, $selected = null, $size = 0) {
432 432
     echo sprintf('
433 433
         <div class="form-group">
434 434
             <label align=right class="%s" for="%s">%s</label>
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
     foreach ($items as $i) {
441 441
         echo sprintf(
442 442
             '<option %s value="%s">%s</option>',
443
-            ($selected && in_array($i[0], $selected))?'selected':'',
443
+            ($selected && in_array($i[0], $selected)) ? 'selected' : '',
444 444
             $i[0], $i[1]
445 445
         );
446 446
     }
@@ -449,12 +449,12 @@  discard block
 block discarded – undo
449 449
 
450 450
 // return a list of strings for checkbox items
451 451
 //
452
-function checkbox_item_strings($items, $attrs='') {
452
+function checkbox_item_strings($items, $attrs = '') {
453 453
     $x = [];
454 454
     foreach ($items as $i) {
455 455
         $x[] = sprintf('<input %s type="checkbox" name="%s" %s> %s
456 456
             ',
457
-            $attrs, $i[0], $i[2]?"checked":"", $i[1]
457
+            $attrs, $i[0], $i[2] ? "checked" : "", $i[1]
458 458
         );
459 459
     }
460 460
     return $x;
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
 
463 463
 // $items is list of (name, label, checked)
464 464
 //
465
-function form_checkboxes($label, $items, $attrs='') {
465
+function form_checkboxes($label, $items, $attrs = '') {
466 466
     echo sprintf('
467 467
         <div class="form-group">
468 468
             <label align=right class="%s">%s</label>
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
 //
482 482
 function form_radio_buttons(
483 483
     $label, $name, $items, $selected,
484
-    $assign_ids=false       // assign IDs to buttons based on names
484
+    $assign_ids = false       // assign IDs to buttons based on names
485 485
 ) {
486 486
     echo sprintf('
487 487
         <div class="form-group">
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
         FORM_LEFT_CLASS, $label, FORM_RIGHT_CLASS
492 492
     );
493 493
     foreach ($items as $i) {
494
-        $checked = ($selected == $i[0])?"checked":"";
494
+        $checked = ($selected == $i[0]) ? "checked" : "";
495 495
         if ($assign_ids) {
496 496
             $id = sprintf('id="%s_%s"', $name, $i[0]);
497 497
         } else {
@@ -529,7 +529,7 @@  discard block
 block discarded – undo
529 529
 ';
530 530
 }
531 531
 
532
-function form_submit($text, $attrs='') {
532
+function form_submit($text, $attrs = '') {
533 533
     form_general(
534 534
         "",
535 535
         sprintf(
@@ -539,7 +539,7 @@  discard block
 block discarded – undo
539 539
     );
540 540
 }
541 541
 
542
-function form_checkbox($label, $name, $checked=false) {
542
+function form_checkbox($label, $name, $checked = false) {
543 543
     echo sprintf('
544 544
         <div class="form-group">
545 545
             <label align=right class="%s">%s</label>
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
               <input type="checkbox" name="%s" %s>
552 552
            </div>
553 553
         </div>
554
-        ', $name, $checked?"checked":""
554
+        ', $name, $checked ? "checked" : ""
555 555
     );
556 556
 }
557 557
 
@@ -579,7 +579,7 @@  discard block
 block discarded – undo
579 579
 // $selected is the list of selected values.
580 580
 // $extra is e.g. id=foo
581 581
 //
582
-function form_select2_multi($label, $name, $items, $selected=null, $extra='') {
582
+function form_select2_multi($label, $name, $items, $selected = null, $extra = '') {
583 583
     echo sprintf('
584 584
         <div class="form-group">
585 585
             <label align=right class="%s" for="%s">%s</label>
@@ -591,7 +591,7 @@  discard block
 block discarded – undo
591 591
     foreach ($items as $i) {
592 592
         echo sprintf(
593 593
             '<option %s value="%s">%s</option>',
594
-            ($selected && in_array($i[0], $selected))?'selected':'',
594
+            ($selected && in_array($i[0], $selected)) ? 'selected' : '',
595 595
             $i[0], $i[1]
596 596
         );
597 597
     }
Please login to merge, or discard this patch.
html/inc/boinc_db.inc 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -362,12 +362,12 @@
 block discarded – undo
362 362
         $db = BoincDb::get();
363 363
         return $db->enum('result', 'BoincResult', $where_clause);
364 364
     }
365
-	static function enum_fields($fields, $where_clause, $order_clause=null) {
365
+    static function enum_fields($fields, $where_clause, $order_clause=null) {
366 366
         $db = BoincDb::get();
367
-		return $db->enum_fields(
367
+        return $db->enum_fields(
368 368
             'result', 'BoincResult', $fields, $where_clause, $order_clause
369 369
         );
370
-	}
370
+    }
371 371
     function update($clause) {
372 372
         $db = BoincDb::get();
373 373
         return $db->update($this, 'result', $clause);
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
44 44
 // close() closes the connection.
45 45
 
46 46
 class BoincDb {
47
-    static $instance;       // a DbConn object, or null
48
-    static $dbnum;          // which replica we're connected to
47
+    static $instance; // a DbConn object, or null
48
+    static $dbnum; // which replica we're connected to
49 49
 
50 50
     // connect to DB $dbnum (0, 1, ...)
51 51
     // If the requested DB doesn't exist or connection fails, connect to DB 0.
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
         self::$instance = null;
57 57
         $config = get_config();
58 58
         if ($dbnum) {
59
-            $r = $dbnum==1?'':strval($dbnum);
59
+            $r = $dbnum == 1 ? '' : strval($dbnum);
60 60
             $host = parse_config($config, sprintf('<replica%s_db_host>', $r));
61 61
             $name = parse_config($config, sprintf('<replica%s_db_name>', $r));
62 62
             $user = parse_config($config, sprintf('<replica%s_db_user>', $r));
@@ -204,11 +204,11 @@  discard block
 block discarded – undo
204 204
         $db = BoincDb::get();
205 205
         return $db->update($this, 'user', $clause);
206 206
     }
207
-    static function enum($where_clause, $order_clause=null) {
207
+    static function enum($where_clause, $order_clause = null) {
208 208
         $db = BoincDb::get();
209 209
         return $db->enum('user', 'BoincUser', $where_clause, $order_clause);
210 210
     }
211
-    static function enum_fields($fields, $where_clause, $order_clause=null) {
211
+    static function enum_fields($fields, $where_clause, $order_clause = null) {
212 212
         $db = BoincDb::get();
213 213
         return $db->enum_fields(
214 214
             'user', 'BoincUser', $fields, $where_clause, $order_clause
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
         $db = BoincDb::get();
259 259
         return $db->update($this, 'team', $clause);
260 260
     }
261
-    static function enum($where_clause, $order_clause=null) {
261
+    static function enum($where_clause, $order_clause = null) {
262 262
         $db = BoincDb::get();
263 263
         return $db->enum('team', 'BoincTeam', $where_clause, $order_clause);
264 264
     }
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
         $db = BoincDb::get();
284 284
         return $db->max('team', $field);
285 285
     }
286
-    static function enum_fields($fields, $where_clause, $order_clause=null) {
286
+    static function enum_fields($fields, $where_clause, $order_clause = null) {
287 287
         $db = BoincDb::get();
288 288
         return $db->enum_fields(
289 289
             'team', 'BoincTeam', $fields, $where_clause, $order_clause
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
         $db = BoincDb::get();
318 318
         return $db->update($this, 'host', $clause);
319 319
     }
320
-    static function update_aux($clause, $where='') {
320
+    static function update_aux($clause, $where = '') {
321 321
         $db = BoincDb::get();
322 322
         return $db->update_aux('host', $clause, $where);
323 323
     }
@@ -325,11 +325,11 @@  discard block
 block discarded – undo
325 325
         $db = BoincDb::get();
326 326
         return $db->delete($this, 'host');
327 327
     }
328
-    static function enum($where_clause, $order_clause=null) {
328
+    static function enum($where_clause, $order_clause = null) {
329 329
         $db = BoincDb::get();
330 330
         return $db->enum('host', 'BoincHost', $where_clause, $order_clause);
331 331
     }
332
-    static function enum_fields($fields, $where_clause, $order_clause=null) {
332
+    static function enum_fields($fields, $where_clause, $order_clause = null) {
333 333
         $db = BoincDb::get();
334 334
         return $db->enum_fields(
335 335
             'host', 'BoincHost', $fields, $where_clause, $order_clause
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
         $db = BoincDb::get();
367 367
         return $db->enum('result', 'BoincResult', $where_clause);
368 368
     }
369
-	static function enum_fields($fields, $where_clause, $order_clause=null) {
369
+	static function enum_fields($fields, $where_clause, $order_clause = null) {
370 370
         $db = BoincDb::get();
371 371
 		return $db->enum_fields(
372 372
             'result', 'BoincResult', $fields, $where_clause, $order_clause
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
         $db = BoincDb::get();
377 377
         return $db->update($this, 'result', $clause);
378 378
     }
379
-    static function update_aux($clause, $where='') {
379
+    static function update_aux($clause, $where = '') {
380 380
         $db = BoincDb::get();
381 381
         return $db->update_aux('result', $clause, $where);
382 382
     }
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
         $db = BoincDb::get();
416 416
         return $db->enum('workunit', 'BoincWorkunit', $where_clause);
417 417
     }
418
-    static function enum_fields($fields, $where_clause, $order_clause=null) {
418
+    static function enum_fields($fields, $where_clause, $order_clause = null) {
419 419
         $db = BoincDb::get();
420 420
         return $db->enum_fields('workunit', 'BoincWorkunit', $fields, $where_clause, $order_clause);
421 421
     }
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
         $db = BoincDb::get();
424 424
         return $db->update($this, 'workunit', $clause);
425 425
     }
426
-    static function update_aux($clause, $where='') {
426
+    static function update_aux($clause, $where = '') {
427 427
         $db = BoincDb::get();
428 428
         return $db->update_aux('workunit', $clause, $where);
429 429
     }
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
         $db = BoincDb::get();
458 458
         return $db->update($this, 'app', $clause);
459 459
     }
460
-    static function sum($field, $clause=null) {
460
+    static function sum($field, $clause = null) {
461 461
         $db = BoincDb::get();
462 462
         return $db->sum('app', $field, $clause);
463 463
     }
@@ -515,11 +515,11 @@  discard block
 block discarded – undo
515 515
         $db = BoincDb::get();
516 516
         return $db->insert('profile', $clause);
517 517
     }
518
-    static function enum($where_clause=null, $order_clause=null) {
518
+    static function enum($where_clause = null, $order_clause = null) {
519 519
         $db = BoincDb::get();
520 520
         return $db->enum('profile', 'BoincProfile', $where_clause, $order_clause);
521 521
     }
522
-    static function enum_fields($fields, $where_clause=null, $order_clause=null) {
522
+    static function enum_fields($fields, $where_clause = null, $order_clause = null) {
523 523
         $db = BoincDb::get();
524 524
         return $db->enum_fields('profile', 'BoincProfile', $fields, $where_clause, $order_clause);
525 525
     }
@@ -914,12 +914,12 @@  discard block
 block discarded – undo
914 914
         return $db->enum('consent', 'BoincConsent', $where_clause);
915 915
     }
916 916
 
917
-    static function insert ($clause) {
917
+    static function insert($clause) {
918 918
         $db = BoincDb::get();
919 919
         return $db->insert('consent', $clause);
920 920
     }
921 921
 
922
-    static function update ($clause) {
922
+    static function update($clause) {
923 923
         $db = BoincDb::get();
924 924
         return $db->update_aux('consent', $clause);
925 925
     }
@@ -944,17 +944,17 @@  discard block
 block discarded – undo
944 944
         return $db->lookup('consent_type', 'BoincConsentType', $clause);
945 945
     }
946 946
 
947
-    static function enum($where_clause, $order_clause=null) {
947
+    static function enum($where_clause, $order_clause = null) {
948 948
         $db = BoincDb::get();
949 949
         return $db->enum('consent_type', 'BoincConsentType', $where_clause, $order_clause);
950 950
     }
951 951
 
952
-    static function insert ($clause) {
952
+    static function insert($clause) {
953 953
         $db = BoincDb::get();
954 954
         return $db->insert('consent_type', $clause);
955 955
     }
956 956
 
957
-    static function update ($clause) {
957
+    static function update($clause) {
958 958
         $db = BoincDb::get();
959 959
         return $db->update_aux('consent_type', $clause);
960 960
     }
@@ -980,7 +980,7 @@  discard block
 block discarded – undo
980 980
         return $db->lookup('latest_consent', 'BoincLatestConsent', $clause);
981 981
     }
982 982
 
983
-    static function enum($where_clause, $order_clause=null) {
983
+    static function enum($where_clause, $order_clause = null) {
984 984
         $db = BoincDb::get();
985 985
         return $db->enum('latest_consent', 'BoincLatestConsent', $where_clause, $order_clause);
986 986
     }
@@ -991,7 +991,7 @@  discard block
 block discarded – undo
991 991
 // apply this to any user-supplied strings used in queries
992 992
 //
993 993
 function boinc_real_escape_string($x) {
994
-    if (version_compare(phpversion(),"4.3.0")>=0) {
994
+    if (version_compare(phpversion(), "4.3.0") >= 0) {
995 995
         return BoincDb::escape_string($x);
996 996
     } else {
997 997
         $x = str_replace("'", "\'", $x);
Please login to merge, or discard this patch.
html/user/job_fpops.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
             $host = BoincHost::lookup_id($res->hostid);
36 36
             $hosts[$res->hostid] = $host;
37 37
         }
38
-        $fpops = $res->cpu_time * $host->p_fpops;
38
+        $fpops = $res->cpu_time*$host->p_fpops;
39 39
         $samples[] = $res->cpu_time;
40 40
         //$fpops /= 1e9;
41 41
         //echo "$res->cpu_time $fpops\n";
@@ -45,11 +45,11 @@  discard block
 block discarded – undo
45 45
 }
46 46
 
47 47
 function show($samples) {
48
-    $x = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
48
+    $x = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
49 49
     foreach ($samples as $s) {
50 50
         $x[(int)log10($s)] += 1;
51 51
     }
52
-    for ($i=0; $i<16; $i++) {
52
+    for ($i = 0; $i < 16; $i++) {
53 53
         echo sprintf("%d: %d\n", $i, $x[$i]);
54 54
     }
55 55
 }
Please login to merge, or discard this patch.
html/user/register.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
 function reg_form() {
32 32
     $config = get_config();
33 33
     $disable_acct = parse_bool($config, "disable_account_creation");
34
-    page_head("Register",  null, null, null, boinc_recaptcha_get_head_extra());
34
+    page_head("Register", null, null, null, boinc_recaptcha_get_head_extra());
35 35
     echo "<h3>Create an account</h3>";
36 36
     form_start("create_account_action.php", "post");
37 37
     create_account_form(0, "download_software.php");
Please login to merge, or discard this patch.