Passed
Pull Request — master (#3042)
by Christian
07:09
created
html/user/bolt_sched.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 }
78 78
 
79 79
 function default_mode($item) {
80
-    return $item->is_exercise()?BOLT_MODE_SHOW:BOLT_MODE_LESSON;
80
+    return $item->is_exercise() ?BOLT_MODE_SHOW:BOLT_MODE_LESSON;
81 81
 }
82 82
 
83 83
 // A page is being shown to the user; make a record of it
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 
171 171
 // show an item (lesson, exercise, answer page)
172 172
 //
173
-function show_item($iter, $view_id, $prev_view_id, $mode, $repeat=null) {
173
+function show_item($iter, $view_id, $prev_view_id, $mode, $repeat = null) {
174 174
     global $user;
175 175
     global $course;
176 176
     global $bolt_ex;
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
     $bolt_ex->score = 0;
463 463
     $bolt_query_string = $item->query_string;
464 464
     srand($view_id);
465
-    ob_start();     // buffer output to avoid showing exercise text
465
+    ob_start(); // buffer output to avoid showing exercise text
466 466
     require($item->filename);
467 467
     ob_end_clean();
468 468
 
Please login to merge, or discard this patch.
html/inc/util.inc 2 patches
Braces   +7 added lines, -6 removed lines patch added patch discarded remove patch
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 // with an existing web framework can more easily do so.
208 208
 // To do so, define page_head() in the project include file.
209 209
 //
210
-if (!function_exists("page_head")){
210
+if (!function_exists("page_head")) {
211 211
 function page_head(
212 212
     $title,
213 213
         // page title. Put in <title>, used as title for browser tab.
@@ -293,7 +293,8 @@  discard block
 block discarded – undo
293 293
     echo '<div class="container-fluid">
294 294
     ';
295 295
 
296
-    switch($title) {    //kludge
296
+    switch($title) {
297
+//kludge
297 298
     case tra("Log in"):
298 299
     case tra("Create an account"):
299 300
     case tra("Server status page"):
@@ -309,7 +310,7 @@  discard block
 block discarded – undo
309 310
 
310 311
 // See the comments for page_head()
311 312
 //
312
-if (!function_exists("page_tail")){
313
+if (!function_exists("page_tail")) {
313 314
 function page_tail(
314 315
     $show_date=false,
315 316
         // true for pages that are generated periodically rather than on the fly
@@ -330,7 +331,7 @@  discard block
 block discarded – undo
330 331
 }
331 332
 }
332 333
 
333
-function display_cvs_versions(){
334
+function display_cvs_versions() {
334 335
     global $cvs_version_tracker;
335 336
     echo "\n<!-- SVN VERSIONS -->\n";
336 337
     for ($i=0;$i<sizeof($cvs_version_tracker);$i++) {
@@ -816,7 +817,7 @@  discard block
 block discarded – undo
816 817
     return $str;
817 818
 }
818 819
 
819
-function strip_bbcode($string){
820
+function strip_bbcode($string) {
820 821
     return preg_replace("/((\[.+\])+?)(.+?)((\[\/.+\])+?)/","",$string);
821 822
 }
822 823
 
@@ -1047,7 +1048,7 @@  discard block
 block discarded – undo
1047 1048
 // Otherwise return 0.
1048 1049
 // Format of user agent string is "BOINC client (windows_x86_64 7.3.17)"
1049 1050
 //
1050
-function boinc_client_version(){
1051
+function boinc_client_version() {
1051 1052
     if (!array_key_exists('HTTP_USER_AGENT', $_SERVER)) return 0;
1052 1053
     $x = $_SERVER['HTTP_USER_AGENT'];
1053 1054
     $e =  "/BOINC client [^ ]* (\d+).(\d+).(\d+)\)/";
Please login to merge, or discard this patch.
Spacing   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -38,17 +38,17 @@  discard block
 block discarded – undo
38 38
 //
39 39
 $config = get_config();
40 40
 global $master_url;
41
-$master_url = parse_config($config , "<master_url>");
41
+$master_url = parse_config($config, "<master_url>");
42 42
 $recaptcha_public_key = parse_config($config, "<recaptcha_public_key>");
43 43
 $recaptcha_private_key = parse_config($config, "<recaptcha_private_key>");
44 44
 
45 45
 // the following default to on
46 46
 //
47 47
 $x = parse_config($config, "<user_country>");
48
-define('USER_COUNTRY', ($x===null)?1:(int)$x);
48
+define('USER_COUNTRY', ($x === null) ? 1 : (int)$x);
49 49
 
50 50
 $x = parse_config($config, "<user_url>");
51
-define('USER_URL', ($x===null)?1:(int)$x);
51
+define('USER_URL', ($x === null) ? 1 : (int)$x);
52 52
 
53 53
 // don't allow /... at the end of URL
54 54
 //
@@ -135,10 +135,10 @@  discard block
 block discarded – undo
135 135
 }
136 136
 
137 137
 function url_base() {
138
-    return is_https()?secure_url_base():URL_BASE;
138
+    return is_https() ?secure_url_base() : URL_BASE;
139 139
 }
140 140
 
141
-function send_cookie($name, $value, $permanent, $ops=false) {
141
+function send_cookie($name, $value, $permanent, $ops = false) {
142 142
     global $master_url;
143 143
 
144 144
     // the following allows independent login for projects on the same server
@@ -149,11 +149,11 @@  discard block
 block discarded – undo
149 149
         $path = substr($path, 0, -1);
150 150
         $path .= "_ops/";
151 151
     }
152
-    $expire = $permanent?time()+3600*24*365:0;
152
+    $expire = $permanent ?time() + 3600*24*365 : 0;
153 153
     setcookie($name, $value, $expire, $path);
154 154
 }
155 155
 
156
-function clear_cookie($name, $ops=false) {
156
+function clear_cookie($name, $ops = false) {
157 157
     global $master_url;
158 158
     $url = parse_url($master_url);
159 159
     $path = $url['path'];
@@ -161,13 +161,13 @@  discard block
 block discarded – undo
161 161
         $path = substr($path, 0, -1);
162 162
         $path .= "_ops/";
163 163
     }
164
-    setcookie($name, '', time()-3600, $path);
164
+    setcookie($name, '', time() - 3600, $path);
165 165
 }
166 166
 
167 167
 $g_logged_in_user = null;
168 168
 $got_logged_in_user = false;
169 169
 
170
-function get_logged_in_user($must_be_logged_in=true) {
170
+function get_logged_in_user($must_be_logged_in = true) {
171 171
     global $g_logged_in_user, $got_logged_in_user;
172 172
     if ($got_logged_in_user) return $g_logged_in_user;
173 173
 
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
             $next_url = $_SERVER['REQUEST_URI'];
187 187
             $n = strrpos($next_url, "/");
188 188
             if ($n) {
189
-                $next_url = substr($next_url, $n+1);
189
+                $next_url = substr($next_url, $n + 1);
190 190
             }
191 191
         }
192 192
         $next_url = urlencode($next_url);
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
     return $g_logged_in_user;
198 198
 }
199 199
 
200
-function show_login_info($prefix="") {
200
+function show_login_info($prefix = "") {
201 201
     $user = get_logged_in_user(false);
202 202
     if ($user) {
203 203
         $url_tokens = url_tokens($user->authenticator);
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
     }
208 208
 }
209 209
 
210
-$cache_control_extra="";
210
+$cache_control_extra = "";
211 211
 $is_login_page = false;
212 212
 
213 213
 // Call this to start pages.
@@ -219,11 +219,11 @@  discard block
 block discarded – undo
219 219
 // with an existing web framework can more easily do so.
220 220
 // To do so, define page_head() in the project include file.
221 221
 //
222
-if (!function_exists("page_head")){
222
+if (!function_exists("page_head")) {
223 223
 function page_head(
224 224
     $title,
225 225
         // page title. Put in <title>, used as title for browser tab.
226
-    $body_attrs=null,
226
+    $body_attrs = null,
227 227
         // <body XXXX>
228 228
         // e.g. Javascript to put focus in an input field
229 229
         // (onload="document.form.foo.focus()")
@@ -232,10 +232,10 @@  discard block
 block discarded – undo
232 232
         // if set, include schedulers.txt.
233 233
         // also pass to project_banner() in case you want a different
234 234
         // header for your main page.
235
-    $url_prefix="",
235
+    $url_prefix = "",
236 236
         // prepend this to links.
237 237
         // Use for web pages not in the top directory
238
-    $head_extra=null
238
+    $head_extra = null
239 239
         // extra stuff to put in <head>. E.g.:
240 240
         // reCAPTCHA code (create_profile.php)
241 241
         // bbcode javascript (forums)
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
         header("Content-type: text/html; charset=utf-8");
254 254
         header("Expires: Mon, 26 Jul 1997 05:00:00 UTC");
255 255
             // Date in the past
256
-        header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " UTC");
256
+        header("Last-Modified: ".gmdate("D, d M Y H:i:s")." UTC");
257 257
             // always modified
258 258
         header("Cache-Control: $cache_control_extra no-cache, must-revalidate, post-check=0, pre-check=0");
259 259
             // for HTTP/1.1
@@ -274,11 +274,11 @@  discard block
 block discarded – undo
274 274
     if ($head_extra) {
275 275
         echo "\n$head_extra\n";
276 276
     }
277
-    if ($is_main && (!defined('NO_COMPUTING')||!NO_COMPUTING)) {
277
+    if ($is_main && (!defined('NO_COMPUTING') || !NO_COMPUTING)) {
278 278
         readfile("schedulers.txt");
279 279
     }
280 280
 
281
-    $t = $title?$title:PROJECT;
281
+    $t = $title ? $title : PROJECT;
282 282
     echo "<title>$t</title>\n";
283 283
     echo '
284 284
         <meta charset="utf-8">
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
     echo '<div class="container-fluid">
315 315
     ';
316 316
 
317
-    switch($title) {    //kludge
317
+    switch ($title) {    //kludge
318 318
     case tra("Log in"):
319 319
     case tra("Create an account"):
320 320
     case tra("Server status page"):
@@ -329,13 +329,13 @@  discard block
 block discarded – undo
329 329
 
330 330
 // See the comments for page_head()
331 331
 //
332
-if (!function_exists("page_tail")){
332
+if (!function_exists("page_tail")) {
333 333
 function page_tail(
334
-    $show_date=false,
334
+    $show_date = false,
335 335
         // true for pages that are generated periodically rather than on the fly
336
-    $url_prefix="",
336
+    $url_prefix = "",
337 337
         // use for pages not at top level
338
-    $is_main=false
338
+    $is_main = false
339 339
         // passed to project_footer;
340 340
 ) {
341 341
     echo "<br>\n";
@@ -350,10 +350,10 @@  discard block
 block discarded – undo
350 350
 }
351 351
 }
352 352
 
353
-function display_cvs_versions(){
353
+function display_cvs_versions() {
354 354
     global $cvs_version_tracker;
355 355
     echo "\n<!-- SVN VERSIONS -->\n";
356
-    for ($i=0;$i<sizeof($cvs_version_tracker);$i++) {
356
+    for ($i = 0; $i < sizeof($cvs_version_tracker); $i++) {
357 357
         echo "<!-- ".$cvs_version_tracker[$i]." -->\n";
358 358
     }
359 359
 }
@@ -378,23 +378,23 @@  discard block
 block discarded – undo
378 378
 // takes argument in second and returns a human formatted time string
379 379
 // in the form D days + h Hours + m Min + s sec.
380 380
 
381
-function time_diff($x, $res=3) {
381
+function time_diff($x, $res = 3) {
382 382
     $days    = (int)($x/86400);
383
-    $hours   = (int)(($x-$days*86400)/3600);
384
-    $minutes = (int)(($x-$days*86400-$hours*3600)/60);
385
-    $seconds = (int)($x % 60);
383
+    $hours   = (int)(($x - $days*86400)/3600);
384
+    $minutes = (int)(($x - $days*86400 - $hours*3600)/60);
385
+    $seconds = (int)($x%60);
386 386
 
387 387
     $datestring = "";
388 388
     if ($days) {
389 389
         $datestring .= "$days ".tra("days")." ";
390 390
     }
391
-    if ($res>0 && ($hours || strlen($datestring))) {
391
+    if ($res > 0 && ($hours || strlen($datestring))) {
392 392
         $datestring .= "$hours ".tra("hours")." ";
393 393
     }
394
-    if ($res>1 && ($minutes || strlen($datestring))) {
394
+    if ($res > 1 && ($minutes || strlen($datestring))) {
395 395
         $datestring .= "$minutes ".tra("min")." ";
396 396
     }
397
-    if ($res>2 && ($seconds)) {
397
+    if ($res > 2 && ($seconds)) {
398 398
         $datestring .= "$seconds ".tra("sec")." ";
399 399
     }
400 400
 
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
 
410 410
 function time_str($x) {
411 411
     if ($x == 0) return "---";
412
-    return gmdate('j M Y, G:i:s', $x) . " UTC";
412
+    return gmdate('j M Y, G:i:s', $x)." UTC";
413 413
 }
414 414
 
415 415
 function local_time_str($x) {
@@ -421,14 +421,14 @@  discard block
 block discarded – undo
421 421
     return time_str($x);
422 422
 }
423 423
 
424
-function start_table_str($class="", $style="") {
425
-    $s = $style?'style="'.$style.'"':'';
424
+function start_table_str($class = "", $style = "") {
425
+    $s = $style ? 'style="'.$style.'"' : '';
426 426
     return '<div class="table">
427 427
       <table '.$s.' width="100%" class="table table-condensed '.$class.'" >
428 428
     ';
429 429
 }
430 430
 
431
-function start_table($class="", $style="") {
431
+function start_table($class = "", $style = "") {
432 432
     echo start_table_str($class, $style);
433 433
 }
434 434
 
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
     echo "</tr>\n";
474 474
 }
475 475
 
476
-function row1($x, $ncols=2, $class="heading") {
476
+function row1($x, $ncols = 2, $class = "heading") {
477 477
     if ($class == "heading") {
478 478
         echo "<tr><th class=\"bg-primary\" colspan=\"$ncols\">$x</th></tr>\n";
479 479
     } else {
@@ -485,10 +485,10 @@  discard block
 block discarded – undo
485 485
 define('VALUE_ATTRS', 'style="padding-left:12px"');
486 486
 define('VALUE_ATTRS_ERR', 'class="danger" style="padding-left:12px"');
487 487
 
488
-function row2($x, $y, $show_error=false, $lwidth='40%') {
489
-    if ($x==="") $x="<br>";
490
-    if ($y==="") $y="<br>";
491
-    $attrs = $show_error?VALUE_ATTRS_ERR:VALUE_ATTRS;
488
+function row2($x, $y, $show_error = false, $lwidth = '40%') {
489
+    if ($x === "") $x = "<br>";
490
+    if ($y === "") $y = "<br>";
491
+    $attrs = $show_error ?VALUE_ATTRS_ERR:VALUE_ATTRS;
492 492
     echo "<tr>
493 493
         <td width=\"$lwidth\" ".NAME_ATTRS.">$x</td>
494 494
         <td $attrs >$y</td>
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
     ";
497 497
 }
498 498
 
499
-function row2_init($x, $y, $lwidth='40%') {
499
+function row2_init($x, $y, $lwidth = '40%') {
500 500
     echo '<tr>
501 501
         <td class="text-right " width="'.$lwidth.'"  style="padding-right: 20px;">'.$x.'</td>
502 502
         <td '.VALUE_ATTRS.'>'.$y.'
@@ -519,20 +519,20 @@  discard block
 block discarded – undo
519 519
     echo "</tr>\n";
520 520
 }
521 521
 
522
-define ('ALIGN_RIGHT', 'style="text-align:right;"');
522
+define('ALIGN_RIGHT', 'style="text-align:right;"');
523 523
 
524
-function row_heading_array($x, $attrs=null, $class='bg-primary') {
524
+function row_heading_array($x, $attrs = null, $class = 'bg-primary') {
525 525
     echo "<tr>";
526 526
     $i = 0;
527 527
     foreach ($x as $h) {
528
-        $a = $attrs?$attrs[$i]:"";
528
+        $a = $attrs ? $attrs[$i] : "";
529 529
         echo "<th $a class=\"$class\">$h</th>";
530 530
         $i++;
531 531
     }
532 532
     echo "</tr>\n";
533 533
 }
534 534
 
535
-function row_heading($x, $class='bg-primary') {
535
+function row_heading($x, $class = 'bg-primary') {
536 536
     echo sprintf('<tr><th class="%s" colspan=99>%s</th></tr>
537 537
         ', $class, $x
538 538
     );
@@ -588,7 +588,7 @@  discard block
 block discarded – undo
588 588
 // If $ellipsis is true, then an ellipsis is added to any sentence which
589 589
 // is cut short.
590 590
 
591
-function sub_sentence($sentence, $delimiter, $max_chars, $ellipsis=false) {
591
+function sub_sentence($sentence, $delimiter, $max_chars, $ellipsis = false) {
592 592
     $words = explode($delimiter, $sentence);
593 593
     $total_chars = 0;
594 594
     $trunc = false;
@@ -671,8 +671,8 @@  discard block
 block discarded – undo
671 671
 
672 672
 // returns null if the arg is optional and missing
673 673
 //
674
-function get_int($name, $optional=false) {
675
-    $x=null;
674
+function get_int($name, $optional = false) {
675
+    $x = null;
676 676
     if (isset($_GET[$name])) $x = $_GET[$name];
677 677
     if (!is_numeric($x)) {
678 678
         if ($optional) {
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
 
692 692
 // returns null if the arg is optional and missing
693 693
 //
694
-function post_num($name, $optional=false) {
694
+function post_num($name, $optional = false) {
695 695
     $x = null;
696 696
     if (isset($_POST[$name])) $x = $_POST[$name];
697 697
     if (!is_numeric($x)) {
@@ -706,7 +706,7 @@  discard block
 block discarded – undo
706 706
 
707 707
 // returns null if the arg is optional and missing
708 708
 //
709
-function post_int($name, $optional=false) {
709
+function post_int($name, $optional = false) {
710 710
     $x = post_num($name, $optional);
711 711
     if (is_null($x)) return null;
712 712
     $y = (int)$x;
@@ -724,7 +724,7 @@  discard block
 block discarded – undo
724 724
     }
725 725
 }
726 726
 
727
-function get_str($name, $optional=false) {
727
+function get_str($name, $optional = false) {
728 728
     if (isset($_GET[$name])) {
729 729
         $x = $_GET[$name];
730 730
     } else {
@@ -736,7 +736,7 @@  discard block
 block discarded – undo
736 736
     return undo_magic_quotes($x);
737 737
 }
738 738
 
739
-function post_str($name, $optional=false) {
739
+function post_str($name, $optional = false) {
740 740
     if (isset($_POST[$name])) {
741 741
         $x = $_POST[$name];
742 742
     } else {
@@ -748,7 +748,7 @@  discard block
 block discarded – undo
748 748
     return undo_magic_quotes($x);
749 749
 }
750 750
 
751
-function post_arr($name, $optional=false) {
751
+function post_arr($name, $optional = false) {
752 752
     if (isset($_POST[$name]) && is_array($_POST[$name])) {
753 753
         $x = $_POST[$name];
754 754
     } else {
@@ -764,7 +764,7 @@  discard block
 block discarded – undo
764 764
     // the mb_* functions are not included by default
765 765
     // return (mb_detect_encoding($passwd) -= 'ASCII');
766 766
 
767
-    for ($i=0; $i<strlen($str); $i++) {
767
+    for ($i = 0; $i < strlen($str); $i++) {
768 768
         $c = ord(substr($str, $i));
769 769
         if ($c < 32 || $c > 127) return false;
770 770
     }
@@ -788,7 +788,7 @@  discard block
 block discarded – undo
788 788
     $number = str_replace(',', '.', $number); // replace the german decimal separator
789 789
     // if no value was entered and this is ok
790 790
     //
791
-    if ($number=='' && !$low) return true;
791
+    if ($number == '' && !$low) return true;
792 792
 
793 793
     // the supplied value contains alphabetic characters
794 794
     //
@@ -805,7 +805,7 @@  discard block
 block discarded – undo
805 805
 
806 806
 // Generate a "select" element from an array of values
807 807
 //
808
-function select_from_array($name, $array, $selection=null, $width=240) {
808
+function select_from_array($name, $array, $selection = null, $width = 240) {
809 809
     $out = '<select style="color:#000;"class="form-control input-sm" style="width:'.$width.'px" name="'.$name.'">"';
810 810
 
811 811
     foreach ($array as $key => $value) {
@@ -830,8 +830,8 @@  discard block
 block discarded – undo
830 830
     return $str;
831 831
 }
832 832
 
833
-function strip_bbcode($string){
834
-    return preg_replace("/((\[.+\])+?)(.+?)((\[\/.+\])+?)/","",$string);
833
+function strip_bbcode($string) {
834
+    return preg_replace("/((\[.+\])+?)(.+?)((\[\/.+\])+?)/", "", $string);
835 835
 }
836 836
 
837 837
 function current_url() {
@@ -859,7 +859,7 @@  discard block
 block discarded – undo
859 859
 // @param class The optional CSS class of the button. Defaults to a standard button
860 860
 //
861 861
 
862
-function button_text($url, $text, $desc=null, $class="btn-success btn-sm") {
862
+function button_text($url, $text, $desc = null, $class = "btn-success btn-sm") {
863 863
     if (!$desc) {
864 864
         $desc = $text;
865 865
     }
@@ -868,19 +868,19 @@  discard block
 block discarded – undo
868 868
     );
869 869
 }
870 870
 
871
-function show_button($url, $text, $desc=null, $class="btn-success btn-sm") {
872
-    echo button_text($url, $text, $desc=null, $class);
871
+function show_button($url, $text, $desc = null, $class = "btn-success btn-sm") {
872
+    echo button_text($url, $text, $desc = null, $class);
873 873
 }
874 874
 
875 875
 // for places with a bunch of buttons, like forum posts
876 876
 //
877
-function show_button_small($url, $text, $desc=null) {
877
+function show_button_small($url, $text, $desc = null) {
878 878
     echo button_text($url, $text, $desc, "btn-primary btn-xs");
879 879
 }
880 880
 
881 881
 // used for showing icons
882 882
 //
883
-function show_image($src, $title, $alt, $height=null) {
883
+function show_image($src, $title, $alt, $height = null) {
884 884
     $h = "";
885 885
     if ($height) {
886 886
         $h = "height=\"$height\"";
@@ -917,7 +917,7 @@  discard block
 block discarded – undo
917 917
 // tries instead to connect to <replica_db_host> if tag exists.
918 918
 // DEPRECATED - use boinc_db.inc
919 919
 //
920
-function db_init($try_replica=false) {
920
+function db_init($try_replica = false) {
921 921
     check_web_stopped();
922 922
     $retval = db_init_aux($try_replica);
923 923
     if ($retval == 1) {
@@ -988,7 +988,7 @@  discard block
 block discarded – undo
988 988
 function sanitize_numeric($x) {
989 989
     if (is_numeric($x)) {
990 990
         return $x;
991
-    } else if (trim($x) == '' ) {
991
+    } else if (trim($x) == '') {
992 992
         return '';
993 993
     } else {
994 994
         return "not numeric";
@@ -1011,9 +1011,9 @@  discard block
 block discarded – undo
1011 1011
     return $c/(200/24);
1012 1012
 }
1013 1013
 
1014
-function do_download($path,$name="") {
1015
-    if (strcmp($name,"") == 0) {
1016
-        $name=basename($path);
1014
+function do_download($path, $name = "") {
1015
+    if (strcmp($name, "") == 0) {
1016
+        $name = basename($path);
1017 1017
     }
1018 1018
     header('Content-Description: File Transfer');
1019 1019
     header('Content-Type: application/octet-stream');
@@ -1022,7 +1022,7 @@  discard block
 block discarded – undo
1022 1022
     header('Expires: 0');
1023 1023
     header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
1024 1024
     header('Pragma: public');
1025
-    header('Content-Length: ' . filesize($path));
1025
+    header('Content-Length: '.filesize($path));
1026 1026
     flush();
1027 1027
     readfile($path);
1028 1028
 }
@@ -1071,10 +1071,10 @@  discard block
 block discarded – undo
1071 1071
 // Otherwise return 0.
1072 1072
 // Format of user agent string is "BOINC client (windows_x86_64 7.3.17)"
1073 1073
 //
1074
-function boinc_client_version(){
1074
+function boinc_client_version() {
1075 1075
     if (!array_key_exists('HTTP_USER_AGENT', $_SERVER)) return 0;
1076 1076
     $x = $_SERVER['HTTP_USER_AGENT'];
1077
-    $e =  "/BOINC client [^ ]* (\d+).(\d+).(\d+)\)/";
1077
+    $e = "/BOINC client [^ ]* (\d+).(\d+).(\d+)\)/";
1078 1078
     if (preg_match($e, $x, $matches)) {
1079 1079
         return $matches[1]*10000 + $matches[2]*100 + $matches[3];
1080 1080
     }
@@ -1103,7 +1103,7 @@  discard block
 block discarded – undo
1103 1103
     $rem_name = $name."_remaining";
1104 1104
     return "<textarea name=\"$name\" class=\"form-control\" rows=3 id=\"$name\" onkeydown=\"text_counter(this.form.$name, this.form.$rem_name, $maxlen);\"
1105 1105
         onkeyup=\"text_counter(this.form.$name, this.form.$rem_name, $maxlen);\">".$text."</textarea>
1106
-        <br><input name=\"$rem_name\" type=\"text\" id=\"$rem_name\" value=\"".($maxlen-strlen($text))."\" size=\"3\" maxlength=\"3\" readonly> ".tra("characters remaining")
1106
+        <br><input name=\"$rem_name\" type=\"text\" id=\"$rem_name\" value=\"".($maxlen - strlen($text))."\" size=\"3\" maxlength=\"3\" readonly> ".tra("characters remaining")
1107 1107
     ;
1108 1108
 }
1109 1109
 
@@ -1133,7 +1133,7 @@  discard block
 block discarded – undo
1133 1133
 // use the following around text with long lines,
1134 1134
 // to limit the width and make it more readable.
1135 1135
 //
1136
-function text_start($width=640) {
1136
+function text_start($width = 640) {
1137 1137
     echo sprintf("<div style=\"max-width: %dpx;\">\n", $width);
1138 1138
 }
1139 1139
 function text_end() {
@@ -1146,9 +1146,9 @@  discard block
 block discarded – undo
1146 1146
 }
1147 1147
 
1148 1148
 function cert_filename() {
1149
-    return defined("CERT_FILENAME")?CERT_FILENAME:"cert1.php";
1149
+    return defined("CERT_FILENAME") ?CERT_FILENAME:"cert1.php";
1150 1150
 }
1151 1151
 
1152
-$cvs_version_tracker[]="\$Id$";  //Generated automatically - do not edit
1152
+$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit
1153 1153
 
1154 1154
 ?>
Please login to merge, or discard this patch.
drupal/sites/default/boinc/modules/boinccore/includes/boinccore.rules.inc 2 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 function boinccore_rules_event_info() {
19 19
   return array(
20 20
     'boinccore_comment_convert' => array(
21
-      'label' => bts('A comment was converted to a new forum topic.', array(), NULL, 'boinc:rule-event'),
21
+      'label' => bts('A comment was converted to a new forum topic.', array(), null, 'boinc:rule-event'),
22 22
       'module' => 'BOINCcore',
23 23
       'arguments' => rules_events_hook_comment_arguments(t('converted comment')),
24 24
     ),
Please login to merge, or discard this patch.
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -16,16 +16,16 @@
 block discarded – undo
16 16
  */
17 17
 
18 18
 function boinccore_rules_event_info() {
19
-  return array(
19
+    return array(
20 20
     'boinccore_comment_convert' => array(
21
-      'label' => bts('A comment was converted to a new forum topic.', array(), NULL, 'boinc:rule-event'),
22
-      'module' => 'BOINCcore',
23
-      'arguments' => rules_events_hook_comment_arguments(t('converted comment')),
21
+        'label' => bts('A comment was converted to a new forum topic.', array(), NULL, 'boinc:rule-event'),
22
+        'module' => 'BOINCcore',
23
+        'arguments' => rules_events_hook_comment_arguments(t('converted comment')),
24 24
     ),
25 25
     'boinccore_comment_unhidden' => array(
26
-      'label' => bts('A comment was unhidden.', array(), 'boinc:rule-event'),
27
-      'module' => 'BOINCcore',
28
-      'arguments' => rules_events_hook_comment_arguments(t('unhidden comment')),
26
+        'label' => bts('A comment was unhidden.', array(), 'boinc:rule-event'),
27
+        'module' => 'BOINCcore',
28
+        'arguments' => rules_events_hook_comment_arguments(t('unhidden comment')),
29 29
     ),
30
-  );
30
+    );
31 31
 }
32 32
\ No newline at end of file
Please login to merge, or discard this patch.
sites/default/boinc/modules/boincimport/includes/import_subscriptions.php 1 patch
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -12,33 +12,33 @@
 block discarded – undo
12 12
  */
13 13
 
14 14
 
15
-  require_once('./includes/bootstrap.inc');
16
-  drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
17
-  require_boinc('db');
15
+    require_once('./includes/bootstrap.inc');
16
+    drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
17
+    require_boinc('db');
18 18
   
19
-  // Parse arguments
20
-  $record_offset = isset($argv[1]) ? $argv[1] : 0;
21
-  $chunk_size = isset($argv[2]) ? $argv[2] : 100;
19
+    // Parse arguments
20
+    $record_offset = isset($argv[1]) ? $argv[1] : 0;
21
+    $chunk_size = isset($argv[2]) ? $argv[2] : 100;
22 22
   
23
-  // Construct sql conditions
24
-  $limit = sprintf('LIMIT %d,%d', $record_offset, $chunk_size);
23
+    // Construct sql conditions
24
+    $limit = sprintf('LIMIT %d,%d', $record_offset, $chunk_size);
25 25
   
26
-  $total_count = 0;
26
+    $total_count = 0;
27 27
   
28
-  // Get the users with subscriptions to import
29
-  db_set_active('boinc_rw');
30
-  $subscribed_boinc_users = db_query("
28
+    // Get the users with subscriptions to import
29
+    db_set_active('boinc_rw');
30
+    $subscribed_boinc_users = db_query("
31 31
     SELECT DISTINCT userid FROM {subscriptions}
32 32
     ORDER BY userid ASC %s", $limit
33
-  );
34
-  db_set_active('default');
33
+    );
34
+    db_set_active('default');
35 35
   
36
-  // Import subscriptions
37
-  while ($boinc_subscription = db_fetch_object($subscribed_boinc_users)) {
36
+    // Import subscriptions
37
+    while ($boinc_subscription = db_fetch_object($subscribed_boinc_users)) {
38 38
     $uid = get_drupal_id($boinc_subscription->userid);
39 39
     $count = boincuser_pull_subscriptions($uid);
40 40
     $total_count += $count;
41 41
     echo "\nuser: {$uid}; boinc_id: {$boinc_subscription->userid}; {$count} subscriptions";
42
-  }
43
-  echo "\n";
44
-  echo $total_count;
42
+    }
43
+    echo "\n";
44
+    echo $total_count;
Please login to merge, or discard this patch.
drupal/sites/default/boinc/modules/boincimport/includes/import_users.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -12,26 +12,26 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 
15
-  require_once('./includes/bootstrap.inc');
16
-  drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
17
-  require_boinc('db');
15
+    require_once('./includes/bootstrap.inc');
16
+    drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
17
+    require_boinc('db');
18 18
   
19
-  // Parse arguments
20
-  $import_lurkers = isset($argv[1]) ? $argv[1] : false;
21
-  $record_offset = isset($argv[2]) ? $argv[2] : 0;
22
-  $chunk_size = isset($argv[3]) ? $argv[3] : 100;
19
+    // Parse arguments
20
+    $import_lurkers = isset($argv[1]) ? $argv[1] : false;
21
+    $record_offset = isset($argv[2]) ? $argv[2] : 0;
22
+    $chunk_size = isset($argv[3]) ? $argv[3] : 100;
23 23
   
24
-  // Construct sql conditions
25
-  $limit = sprintf('LIMIT %d,%d', $record_offset, $chunk_size);
24
+    // Construct sql conditions
25
+    $limit = sprintf('LIMIT %d,%d', $record_offset, $chunk_size);
26 26
   
27
-  $count = 0;
27
+    $count = 0;
28 28
   
29
-  db_set_active('boinc_rw');
30
-  if ($import_lurkers) {
29
+    db_set_active('boinc_rw');
30
+    if ($import_lurkers) {
31 31
     $boinc_accounts = db_query('SELECT id FROM user ORDER BY id %s', $limit);
32
-  }
33
-  //else $boinc_accounts = db_query('SELECT DISTINCT user AS boinc_id FROM post ORDER BY boinc_id %s', $limit);
34
-  else {
32
+    }
33
+    //else $boinc_accounts = db_query('SELECT DISTINCT user AS boinc_id FROM post ORDER BY boinc_id %s', $limit);
34
+    else {
35 35
     // Need to import any user who is currently ignored in order to keep them
36 36
     // ignored... not particularly clean (ignored users are stored in a string)
37 37
     $ignored_user_list = array();
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
       ORDER BY userid ASC"
43 43
     );
44 44
     while ($ignoring_user = db_fetch_object($ignoring_users)) {
45
-      $ignored_user_list = $ignored_user_list + array_fill_keys(explode('|', trim($ignoring_user->ignorelist, '|')), 1);
45
+        $ignored_user_list = $ignored_user_list + array_fill_keys(explode('|', trim($ignoring_user->ignorelist, '|')), 1);
46 46
     }
47 47
     $ignored_user_list = array_keys($ignored_user_list);
48 48
     $boinc_accounts = db_query("
@@ -58,14 +58,14 @@  discard block
 block discarded – undo
58 58
         (SELECT DISTINCT senderid FROM {private_messages})
59 59
       ) AS usersToImport ORDER BY id ASC %s", implode(',', $ignored_user_list), $limit
60 60
     );
61
-  }
62
-  db_set_active('default');
61
+    }
62
+    db_set_active('default');
63 63
   
64
-  while ($boinc_account = db_fetch_object($boinc_accounts)) {
64
+    while ($boinc_account = db_fetch_object($boinc_accounts)) {
65 65
     // Grab the BOINC user object and create a Drupal user from it
66 66
     if (boincuser_register_make_drupal_user($boinc_account->id)) {
67
-      $count++;
67
+        $count++;
68
+    }
68 69
     }
69
-  }
70 70
   
71
-  echo $count;
71
+    echo $count;
Please login to merge, or discard this patch.
drupal/sites/default/settings.php 3 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -114,10 +114,10 @@  discard block
 block discarded – undo
114 114
  */
115 115
 require_once('dbconfig.php');
116 116
 if (!isset($dbserver) || empty($dbserver))
117
-  $dbserver='localhost';
117
+    $dbserver='localhost';
118 118
 $db_url = array(
119
-  'default' => "{$dbtype}://{$dbuser}:".urlencode($dbpass)."@{$dbserver}/{$dbname}",
120
-  'boinc_rw' => "{$boinc_rw_dbtype}://{$boinc_rw_dbuser}:".urlencode($boinc_rw_dbpass)."@{$boinc_rw_dbserver}/{$boinc_rw_dbname}"
119
+    'default' => "{$dbtype}://{$dbuser}:".urlencode($dbpass)."@{$dbserver}/{$dbname}",
120
+    'boinc_rw' => "{$boinc_rw_dbtype}://{$boinc_rw_dbuser}:".urlencode($boinc_rw_dbpass)."@{$boinc_rw_dbserver}/{$boinc_rw_dbname}"
121 121
 );
122 122
 $db_prefix = '';
123 123
 
@@ -125,10 +125,10 @@  discard block
 block discarded – undo
125 125
 // 'boinc_rw' entry as 'boinc_ro'.
126 126
 
127 127
 if (isset($boinc_ro_dbtype) && isset($boinc_ro_dbuser) && isset($boinc_ro_dbpass) && isset($boinc_ro_dbserver) && isset($boinc_ro_dbname)) {
128
-  $db_url['boinc_ro'] = "{$boinc_ro_dbtype}://{$boinc_ro_dbuser}:".urlencode($boinc_ro_dbpass)."@{$boinc_ro_dbserver}/{$boinc_ro_dbname}";
128
+    $db_url['boinc_ro'] = "{$boinc_ro_dbtype}://{$boinc_ro_dbuser}:".urlencode($boinc_ro_dbpass)."@{$boinc_ro_dbserver}/{$boinc_ro_dbname}";
129 129
 }
130 130
 else {
131
-  $db_url['boinc_ro'] = $db_url['boinc_rw'];
131
+    $db_url['boinc_ro'] = $db_url['boinc_rw'];
132 132
 }
133 133
 
134 134
 /**
@@ -216,5 +216,5 @@  discard block
 block discarded – undo
216 216
  */
217 217
 
218 218
 if (stream_resolve_include_path('settings.local.php')) {
219
-  include 'settings.local.php';
219
+    include 'settings.local.php';
220 220
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -126,8 +126,7 @@
 block discarded – undo
126 126
 
127 127
 if (isset($boinc_ro_dbtype) && isset($boinc_ro_dbuser) && isset($boinc_ro_dbpass) && isset($boinc_ro_dbserver) && isset($boinc_ro_dbname)) {
128 128
   $db_url['boinc_ro'] = "{$boinc_ro_dbtype}://{$boinc_ro_dbuser}:".urlencode($boinc_ro_dbpass)."@{$boinc_ro_dbserver}/{$boinc_ro_dbname}";
129
-}
130
-else {
129
+} else {
131 130
   $db_url['boinc_ro'] = $db_url['boinc_rw'];
132 131
 }
133 132
 
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
  */
115 115
 require_once('dbconfig.php');
116 116
 if (!isset($dbserver) || empty($dbserver))
117
-  $dbserver='localhost';
117
+  $dbserver = 'localhost';
118 118
 $db_url = array(
119 119
   'default' => "{$dbtype}://{$dbuser}:".urlencode($dbpass)."@{$dbserver}/{$dbname}",
120 120
   'boinc_rw' => "{$boinc_rw_dbtype}://{$boinc_rw_dbuser}:".urlencode($boinc_rw_dbpass)."@{$boinc_rw_dbserver}/{$boinc_rw_dbname}"
@@ -162,14 +162,14 @@  discard block
 block discarded – undo
162 162
  * settings are used there. Settings defined here should not be
163 163
  * duplicated there so as to avoid conflict issues.
164 164
  */
165
-ini_set('session.cache_expire',     200000);
166
-ini_set('session.cache_limiter',    'none');
167
-ini_set('session.cookie_lifetime',  2000000);
168
-ini_set('session.gc_maxlifetime',   200000);
169
-ini_set('session.save_handler',     'user');
165
+ini_set('session.cache_expire', 200000);
166
+ini_set('session.cache_limiter', 'none');
167
+ini_set('session.cookie_lifetime', 2000000);
168
+ini_set('session.gc_maxlifetime', 200000);
169
+ini_set('session.save_handler', 'user');
170 170
 ini_set('session.use_only_cookies', 1);
171
-ini_set('session.use_trans_sid',    0);
172
-ini_set('url_rewriter.tags',        '');
171
+ini_set('session.use_trans_sid', 0);
172
+ini_set('url_rewriter.tags', '');
173 173
 ini_set('memory_limit', '128M');
174 174
 ini_set('post_max_size', '8MB');
175 175
 ini_set('upload_max_filesize', '8MB');
Please login to merge, or discard this patch.
html/inc/bootstrap.inc 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -138,12 +138,12 @@  discard block
 block discarded – undo
138 138
         // prefix for links; needed for pages not in top dir
139 139
     $user,
140 140
         // logged-in user, if any
141
-    $fixed=false,
141
+    $fixed = false,
142 142
         // if true, navbar is fixed at top of page.
143 143
         // NOTE: if you do this, you must set a global var $fixed_navbar
144 144
         // to true at compile time
145 145
         // (it needs to be set when page_head() is called).
146
-    $inverse=false
146
+    $inverse = false
147 147
         // white on black?
148 148
 ) {
149 149
     global $master_url;
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 // output a panel.
219 219
 // $content_func is a function that generates the panel contents
220 220
 //
221
-function panel($title, $content_func, $class="panel-primary") {
221
+function panel($title, $content_func, $class = "panel-primary") {
222 222
     echo sprintf('<div class="panel %s">
223 223
         ', $class
224 224
     );
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 // are functions that generate the top, left, and right content
245 245
 // $left_width is the width of left column in 1/12 units.
246 246
 //
247
-function grid($top_func, $left_func, $right_func, $left_width=6) {
247
+function grid($top_func, $left_func, $right_func, $left_width = 6) {
248 248
     echo '
249 249
         <div class="container-fluid">
250 250
     ';
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
             </div>
260 260
         ';
261 261
     }
262
-    $right_width = 12-$left_width;
262
+    $right_width = 12 - $left_width;
263 263
     echo '
264 264
         <div class="row">
265 265
         <div class="col-sm-'.$left_width.'">
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
     ';
278 278
 }
279 279
 
280
-function form_start($action, $method='get') {
280
+function form_start($action, $method = 'get') {
281 281
     echo sprintf(
282 282
         '<div class="container">
283 283
         <form class="form-horizontal" method="%s" action="%s">'
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 define('FORM_LEFT_OFFSET', 'col-sm-offset-4');
302 302
 define('FORM_RIGHT_CLASS', 'col-sm-8');
303 303
 
304
-function form_input_text($label, $name, $value='', $type='text', $attrs='', $extra='') {
304
+function form_input_text($label, $name, $value = '', $type = 'text', $attrs = '', $extra = '') {
305 305
     echo sprintf('
306 306
         <div class="form-group">
307 307
             <label class="control-label %s">%s</label>
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
     );
329 329
 }
330 330
 
331
-function form_input_textarea($label, $name, $value='') {
331
+function form_input_textarea($label, $name, $value = '') {
332 332
     echo sprintf('
333 333
         <div class="form-group">
334 334
             <label class="control-label %s" for="%s">%s</label>
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
     );
378 378
     $n = 0;
379 379
     foreach ($items as $i) {
380
-        $s = ($flags && $flags[$n])?'selected':'';
380
+        $s = ($flags && $flags[$n]) ? 'selected' : '';
381 381
         echo '<option '.$s.' value="'.$i[0].'">'.$i[1].'</option>
382 382
         ';
383 383
         $n++;
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 
388 388
 // $items is list of (name, label, checked)
389 389
 //
390
-function form_checkboxes($label, $items, $attrs='') {
390
+function form_checkboxes($label, $items, $attrs = '') {
391 391
     echo sprintf('
392 392
         <div class="form-group">
393 393
             <label class="control-label %s">%s</label>
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
         }
405 405
         echo sprintf('<input %s type="checkbox" name="%s" %s> %s
406 406
             ',
407
-            $attrs, $i[0], $i[2]?"checked":"", $i[1]
407
+            $attrs, $i[0], $i[2] ? "checked" : "", $i[1]
408 408
         );
409 409
     }
410 410
     echo '</div>
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
         FORM_LEFT_CLASS, $label, FORM_RIGHT_CLASS
424 424
     );
425 425
     foreach ($items as $i) {
426
-        $checked = ($selected == $i[0])?"checked":"";
426
+        $checked = ($selected == $i[0]) ? "checked" : "";
427 427
         echo sprintf('<input type="radio" name="%s" value="%s" %s> %s <br>
428 428
             ',
429 429
             $name, $i[0], $checked, $i[1]
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
 ';
457 457
 }
458 458
 
459
-function form_submit($text, $attrs='') {
459
+function form_submit($text, $attrs = '') {
460 460
     form_general(
461 461
         "",
462 462
         sprintf('<button %s type="submit" class="btn btn-success">%s</button>',
@@ -465,11 +465,11 @@  discard block
 block discarded – undo
465 465
     );
466 466
 }
467 467
 
468
-function form_checkbox($label, $name, $checked=false) {
468
+function form_checkbox($label, $name, $checked = false) {
469 469
     echo sprintf('
470 470
         <div class="form-group">
471 471
             <input type="checkbox" name="%s" %s> &nbsp; <span class="lead">%s</span>
472 472
         </div>
473
-        ', $name, $checked?"checked":"", $label
473
+        ', $name, $checked ? "checked" : "", $label
474 474
     );
475 475
 }
Please login to merge, or discard this patch.
html/user/login_form.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@
 block discarded – undo
56 56
 if (!parse_bool($config, "disable_account_creation")
57 57
     && !parse_bool($config, "no_web_account_creation")
58 58
 ) {
59
-    echo tra("or %1 create an account %2.", "<a href=\"create_account_form.php?next_url=$next_url\">","</a>");
59
+    echo tra("or %1 create an account %2.", "<a href=\"create_account_form.php?next_url=$next_url\">", "</a>");
60 60
 }
61 61
 
62 62
 page_tail();
Please login to merge, or discard this patch.
drupal/sites/default/boinc/modules/boincteam/boincteam.admin.inc 4 patches
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -105,8 +105,7 @@  discard block
 block discarded – undo
105 105
       $drupalnid = boincteam_lookup_nid($result->id);
106 106
       if ($drupalnid) {
107 107
         $tlink = l($result->name, '/community/teams/' . $drupalnid);
108
-      }
109
-      else {
108
+      } else {
110 109
         $tlink = '';
111 110
       }
112 111
       // only keys no values
@@ -181,8 +180,7 @@  discard block
 block discarded – undo
181 180
         drupal_render($form['link'][$key]),
182 181
       );
183 182
     }
184
-  }
185
-  else {
183
+  } else {
186 184
     $rows[] = array(array('data' => '<div class="error">No teams found</div>', 'colspan' => 5));
187 185
   }
188 186
   $output .= theme('table', $header, $rows);
@@ -230,8 +228,7 @@  discard block
 block discarded – undo
230 228
   if ($success) {
231 229
     $message = 'Info: Delete SPAM Teams utility- ' . count($results) . ' team(s) deleted.';
232 230
     drupal_set_message($message, 'info');
233
-  }
234
-  else {
231
+  } else {
235 232
     // An error occurred.
236 233
     // $operations contains the operations that remained unprocessed.
237 234
     $error_operation = reset($operations);
Please login to merge, or discard this patch.
Upper-Lower-Casing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
   $form['help'] = array(
23 23
     '#type' => 'fieldset',
24 24
     '#title' => t('Help'),
25
-    '#collapsible' => TRUE,
25
+    '#collapsible' => true,
26 26
   );
27 27
 
28 28
   $form['help']['text'] = array(
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
     }
128 128
 
129 129
     $form['checkboxes'] = array('#type' => 'checkboxes', '#options' => $checkboxes);
130
-    $form['pager'] = array('#value' => theme('pager', NULL, $limit, 0));
130
+    $form['pager'] = array('#value' => theme('pager', null, $limit, 0));
131 131
 
132 132
     return $form;
133 133
   }
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
     // An error occurred.
236 236
     // $operations contains the operations that remained unprocessed.
237 237
     $error_operation = reset($operations);
238
-    $message = 'Error: An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE);
238
+    $message = 'Error: An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], true);
239 239
     drupal_set_message($message, 'error');
240 240
   }
241 241
 }
242 242
\ No newline at end of file
Please login to merge, or discard this patch.
Indentation   +99 added lines, -99 removed lines patch added patch discarded remove patch
@@ -17,15 +17,15 @@  discard block
 block discarded – undo
17 17
  * Utility Form to delete teams suspected of being spammers.
18 18
  */
19 19
 function boincteam_utility_delete(&$form_state) {
20
-  $form = array();
20
+    $form = array();
21 21
 
22
-  $form['help'] = array(
22
+    $form['help'] = array(
23 23
     '#type' => 'fieldset',
24 24
     '#title' => t('Help'),
25 25
     '#collapsible' => TRUE,
26
-  );
26
+    );
27 27
 
28
-  $form['help']['text'] = array(
28
+    $form['help']['text'] = array(
29 29
     '#type' => 'item',
30 30
     '#description' => t('This utility page will help in identifying BOINC teams created by SPAMMERs which can be deleted. The search will find BOINC teams that meet the following criteria.
31 31
 <ul>
@@ -38,19 +38,19 @@  discard block
 block discarded – undo
38 38
 <p> <i>How teams are deleted</i>: Select the teams to be deleted from the table below. Click "Delete Selected Teams" button to begin a batch operation to delete the teams. If you select teams, and then page through to another page of the table, your selections will be lost. I.e., only the teams select on the current page will be deleted.
39 39
 <p> The site must be offline/in maintenance mode before searching for and deleting teams. If not, the delete button below is disabled.
40 40
 '),
41
-  );
41
+    );
42 42
 
43
-  // This variable name has been changed for Drupal 7/8.
44
-  $maintenance_mode = variable_get('site_offline');
45
-  if (!$maintenance_mode) {
43
+    // This variable name has been changed for Drupal 7/8.
44
+    $maintenance_mode = variable_get('site_offline');
45
+    if (!$maintenance_mode) {
46 46
     drupal_set_message(t('WARNING: Site is online (not in maintenance mode)! Deleting teams is only allowed when site is offline. Change this setting in ') . l(t('Site maintenance'), '/admin/settings/site-maintenance'), 'warning');
47
-  }
47
+    }
48 48
 
49
-  $form['teamdelete'] = array(
49
+    $form['teamdelete'] = array(
50 50
     '#type' => 'fieldset',
51 51
     '#title' => t('Teams to delete'),
52
-  );
53
-  $form['teamdelete']['deleteall'] = array(
52
+    );
53
+    $form['teamdelete']['deleteall'] = array(
54 54
     '#type' => 'submit',
55 55
     '#disabled' => !($maintenance_mode),
56 56
     '#value' => t('Delete Selected Teams'),
@@ -58,101 +58,101 @@  discard block
 block discarded – undo
58 58
     '#attributes' => array(
59 59
         'onclick' => 'return confirm(\'' . t('You are about to delete the selected teams suspected of being SPAM. Do you want to continue?') . '\')',
60 60
     ),
61
-  );
62
-  $form['teamdelete']['results_table'] = array(
61
+    );
62
+    $form['teamdelete']['results_table'] = array(
63 63
     '#value' => drupal_get_form('boincteam_utility_team_table'),
64
-  );
64
+    );
65 65
 
66
-  return $form;
66
+    return $form;
67 67
 }
68 68
 
69 69
 function boincteam_utility_team_table() {
70 70
 
71
-  $limit=50;
72
-  $sql = "SELECT team.id AS id, team.name AS name, team.nusers AS nusers FROM {team} WHERE team.nusers<2 AND team.total_credit=0 AND team.seti_id=0 AND team.description REGEXP '<a href'";
71
+    $limit=50;
72
+    $sql = "SELECT team.id AS id, team.name AS name, team.nusers AS nusers FROM {team} WHERE team.nusers<2 AND team.total_credit=0 AND team.seti_id=0 AND team.description REGEXP '<a href'";
73 73
 
74
-  // @todo - add bts() or t()
75
-  $resultheader = array(
74
+    // @todo - add bts() or t()
75
+    $resultheader = array(
76 76
     array(
77
-      'data' => 'Team ID',
78
-      'field' => 'id',
79
-      'sort' => 'asc',
77
+        'data' => 'Team ID',
78
+        'field' => 'id',
79
+        'sort' => 'asc',
80 80
     ),
81 81
     array(
82
-      'data' => 'Team Name',
83
-      'field' => 'name',
82
+        'data' => 'Team Name',
83
+        'field' => 'name',
84 84
     ),
85 85
     array(
86
-      'data' => 'Num Users',
87
-      'field' => 'nusers',
86
+        'data' => 'Num Users',
87
+        'field' => 'nusers',
88 88
     ),
89 89
     array(
90
-      'data' => 'Link to Team',
91
-      'field' => 'link',
90
+        'data' => 'Link to Team',
91
+        'field' => 'link',
92 92
     ),
93
-  );
93
+    );
94 94
 
95
-  $tablesort = tablesort_sql($resultheader);
96
-  db_set_active('boinc_rw');
97
-  $db_res = pager_query($sql . $tablesort, $limit);
98
-  db_set_active('default');
95
+    $tablesort = tablesort_sql($resultheader);
96
+    db_set_active('boinc_rw');
97
+    $db_res = pager_query($sql . $tablesort, $limit);
98
+    db_set_active('default');
99 99
 
100
-  $form = array();
101
-  $form['options'] = array();
102
-  $checkboxes = array();
103
-  if ($db_res) {
100
+    $form = array();
101
+    $form['options'] = array();
102
+    $checkboxes = array();
103
+    if ($db_res) {
104 104
     while ($result = db_fetch_object($db_res)) {
105
-      $drupalnid = boincteam_lookup_nid($result->id);
106
-      if ($drupalnid) {
105
+        $drupalnid = boincteam_lookup_nid($result->id);
106
+        if ($drupalnid) {
107 107
         $tlink = l($result->name, '/community/teams/' . $drupalnid);
108
-      }
109
-      else {
108
+        }
109
+        else {
110 110
         $tlink = '';
111
-      }
112
-      // only keys no values
113
-      $checkboxes[$result->id] = '';
111
+        }
112
+        // only keys no values
113
+        $checkboxes[$result->id] = '';
114 114
 
115
-      $form['id'][$result->id] = array(
115
+        $form['id'][$result->id] = array(
116 116
         '#value' => $result->id,
117
-      );
118
-      $form['name'][$result->id] = array(
117
+        );
118
+        $form['name'][$result->id] = array(
119 119
         '#value' => $result->name,
120
-      );
121
-      $form['nusers'][$result->id] = array(
120
+        );
121
+        $form['nusers'][$result->id] = array(
122 122
         '#value' => $result->nusers,
123
-      );
124
-      $form['link'][$result->id] = array(
123
+        );
124
+        $form['link'][$result->id] = array(
125 125
         '#value' => $tlink,
126
-      );
126
+        );
127 127
     }
128 128
 
129 129
     $form['checkboxes'] = array('#type' => 'checkboxes', '#options' => $checkboxes);
130 130
     $form['pager'] = array('#value' => theme('pager', NULL, $limit, 0));
131 131
 
132 132
     return $form;
133
-  }
134
-  return "<p>No teams matched the criteria for a SPAM team.</p>";
133
+    }
134
+    return "<p>No teams matched the criteria for a SPAM team.</p>";
135 135
 }
136 136
 
137 137
 /**
138 138
  * Submit handler - also creates the batch job to delete the teams.
139 139
  */
140 140
 function boincteam_utility_delete_team($form, &$form_state) {
141
-  $checkedteamids = $form_state['clicked_button']['#post']['checkboxes'];
142
-  // Use batch to delete teams
143
-  $operations = array();
144
-  foreach ($checkedteamids as $id) {
141
+    $checkedteamids = $form_state['clicked_button']['#post']['checkboxes'];
142
+    // Use batch to delete teams
143
+    $operations = array();
144
+    foreach ($checkedteamids as $id) {
145 145
     $operations[] = array('boincteam_utility_batch_process', array($id));
146
-  }
147
-  $batch = array(
146
+    }
147
+    $batch = array(
148 148
     'title' => t('Processing BOINC Teams'),
149 149
     'operations' => $operations,
150 150
     'init_message' => t('Starting team deletion'),
151 151
     'finished' => 'boincteam_utility_batch_finished',
152 152
     'file' => drupal_get_path('module', 'boincteam') . '/boincteam.admin.inc',
153
-  );
154
-  batch_set($batch);
155
-  //batch_process('/admin/boinc/utility-team-delete');
153
+    );
154
+    batch_set($batch);
155
+    //batch_process('/admin/boinc/utility-team-delete');
156 156
 }
157 157
 
158 158
 /*
@@ -163,37 +163,37 @@  discard block
 block discarded – undo
163 163
  *     Input form (table)
164 164
  */
165 165
 function theme_boincteam_utility_team_table($form) {
166
-  //define table header
167
-  $header = array(
166
+    //define table header
167
+    $header = array(
168 168
     theme('table_select_header_cell'), //using that previously empty field
169 169
     array('data' => t('Team ID'), 'field' => 'id', 'sort' => 'asc'),
170 170
     array('data' => t('Name'), 'field' => 'name'),
171 171
     array('data' => t('Num Users'), 'field' => 'nusers'),
172 172
     array('data' => t('Link to Team'), 'field' => 'link'),
173
-  );
174
-  $rows = array();
175
-  $output = "";
176
-  if(!empty($form['checkboxes']['#options'])) {
173
+    );
174
+    $rows = array();
175
+    $output = "";
176
+    if(!empty($form['checkboxes']['#options'])) {
177 177
     foreach (element_children($form['id']) as $key) {
178
-      $rows[] = array(
178
+        $rows[] = array(
179 179
         drupal_render($form['checkboxes'][$key]),
180 180
         drupal_render($form['id'][$key]),
181 181
         drupal_render($form['name'][$key]),
182 182
         drupal_render($form['nusers'][$key]),
183 183
         drupal_render($form['link'][$key]),
184
-      );
184
+        );
185
+    }
185 186
     }
186
-  }
187
-  else {
187
+    else {
188 188
     $rows[] = array(array('data' => '<div class="error">No teams found</div>', 'colspan' => 5));
189
-  }
190
-  $output .= theme('table', $header, $rows);
191
-  if ($form['pager']['#value']) {
189
+    }
190
+    $output .= theme('table', $header, $rows);
191
+    if ($form['pager']['#value']) {
192 192
     $output .= drupal_render($form['pager']);
193
-  }
193
+    }
194 194
 
195
-  $output .= drupal_render($form);
196
-  return $output;
195
+    $output .= drupal_render($form);
196
+    return $output;
197 197
 }
198 198
 
199 199
 /**
@@ -202,26 +202,26 @@  discard block
 block discarded – undo
202 202
  * table. It also removes the team's drupal page (node) if found.
203 203
  */
204 204
 function boincteam_utility_batch_process($id, &$context) {
205
-  $boincteam = boincteam_load($id);
206
-  $drupalid = boincteam_lookup_nid($id);
205
+    $boincteam = boincteam_load($id);
206
+    $drupalid = boincteam_lookup_nid($id);
207 207
 
208
-  // Delete entry in team table
209
-  db_set_active('boinc_rw');
210
-  $sql1='DELETE FROM {team} WHERE id=%d';
211
-  $db_res = db_query($sql1, $id);
212
-  db_set_active('default');
208
+    // Delete entry in team table
209
+    db_set_active('boinc_rw');
210
+    $sql1='DELETE FROM {team} WHERE id=%d';
211
+    $db_res = db_query($sql1, $id);
212
+    db_set_active('default');
213 213
 
214
-  // Delete entry in boincteam table
215
-  $sql2='DELETE FROM {boincteam} WHERE id=%d';
216
-  $db_res = db_query($sql2, $id);
214
+    // Delete entry in boincteam table
215
+    $sql2='DELETE FROM {boincteam} WHERE id=%d';
216
+    $db_res = db_query($sql2, $id);
217 217
 
218
-  // Delete the drupal node (if present)
219
-  if ($drupalid) {
218
+    // Delete the drupal node (if present)
219
+    if ($drupalid) {
220 220
     node_delete($drupalid);
221
-  }
221
+    }
222 222
 
223
-  $context['results'][] = $id . ' : ' . check_plain($boincteam->name);
224
-  $context['message'] = t('Processing team @name', array('@name' => $boincteam->name));
223
+    $context['results'][] = $id . ' : ' . check_plain($boincteam->name);
224
+    $context['message'] = t('Processing team @name', array('@name' => $boincteam->name));
225 225
 }
226 226
 
227 227
 /**
@@ -229,15 +229,15 @@  discard block
 block discarded – undo
229 229
  * or failure.
230 230
  */
231 231
 function boincteam_utility_batch_finished($success, $results, $operations) {
232
-  if ($success) {
232
+    if ($success) {
233 233
     $message = 'Info: Delete SPAM Teams utility- ' . count($results) . ' team(s) deleted.';
234 234
     drupal_set_message($message, 'info');
235
-  }
236
-  else {
235
+    }
236
+    else {
237 237
     // An error occurred.
238 238
     // $operations contains the operations that remained unprocessed.
239 239
     $error_operation = reset($operations);
240 240
     $message = 'Error: An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE);
241 241
     drupal_set_message($message, 'error');
242
-  }
242
+    }
243 243
 }
244 244
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
   // This variable name has been changed for Drupal 7/8.
44 44
   $maintenance_mode = variable_get('site_offline');
45 45
   if (!$maintenance_mode) {
46
-    drupal_set_message(t('WARNING: Site is online (not in maintenance mode)! Deleting teams is only allowed when site is offline. Change this setting in ') . l(t('Site maintenance'), '/admin/settings/site-maintenance'), 'warning');
46
+    drupal_set_message(t('WARNING: Site is online (not in maintenance mode)! Deleting teams is only allowed when site is offline. Change this setting in ').l(t('Site maintenance'), '/admin/settings/site-maintenance'), 'warning');
47 47
   }
48 48
 
49 49
   $form['teamdelete'] = array(
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
     '#value' => t('Delete Selected Teams'),
57 57
     '#submit' => array('boincteam_utility_delete_team'),
58 58
     '#attributes' => array(
59
-        'onclick' => 'return confirm(\'' . t('You are about to delete the selected teams suspected of being SPAM. Do you want to continue?') . '\')',
59
+        'onclick' => 'return confirm(\''.t('You are about to delete the selected teams suspected of being SPAM. Do you want to continue?').'\')',
60 60
     ),
61 61
   );
62 62
   $form['teamdelete']['results_table'] = array(
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 
69 69
 function boincteam_utility_team_table() {
70 70
 
71
-  $limit=50;
71
+  $limit = 50;
72 72
   $sql = "SELECT team.id AS id, team.name AS name, team.nusers AS nusers FROM {team} WHERE team.nusers<2 AND team.total_credit=0 AND team.seti_id=0 AND team.description REGEXP '<a href'";
73 73
 
74 74
   // @todo - add bts() or t()
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 
95 95
   $tablesort = tablesort_sql($resultheader);
96 96
   db_set_active('boinc_rw');
97
-  $db_res = pager_query($sql . $tablesort, $limit);
97
+  $db_res = pager_query($sql.$tablesort, $limit);
98 98
   db_set_active('default');
99 99
 
100 100
   $form = array();
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
     while ($result = db_fetch_object($db_res)) {
105 105
       $drupalnid = boincteam_lookup_nid($result->id);
106 106
       if ($drupalnid) {
107
-        $tlink = l($result->name, '/community/teams/' . $drupalnid);
107
+        $tlink = l($result->name, '/community/teams/'.$drupalnid);
108 108
       }
109 109
       else {
110 110
         $tlink = '';
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
     'operations' => $operations,
150 150
     'init_message' => t('Starting team deletion'),
151 151
     'finished' => 'boincteam_utility_batch_finished',
152
-    'file' => drupal_get_path('module', 'boincteam') . '/boincteam.admin.inc',
152
+    'file' => drupal_get_path('module', 'boincteam').'/boincteam.admin.inc',
153 153
   );
154 154
   batch_set($batch);
155 155
   //batch_process('/admin/boinc/utility-team-delete');
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
   );
174 174
   $rows = array();
175 175
   $output = "";
176
-  if(!empty($form['checkboxes']['#options'])) {
176
+  if (!empty($form['checkboxes']['#options'])) {
177 177
     foreach (element_children($form['id']) as $key) {
178 178
       $rows[] = array(
179 179
         drupal_render($form['checkboxes'][$key]),
@@ -207,12 +207,12 @@  discard block
 block discarded – undo
207 207
 
208 208
   // Delete entry in team table
209 209
   db_set_active('boinc_rw');
210
-  $sql1='DELETE FROM {team} WHERE id=%d';
210
+  $sql1 = 'DELETE FROM {team} WHERE id=%d';
211 211
   $db_res = db_query($sql1, $id);
212 212
   db_set_active('default');
213 213
 
214 214
   // Delete entry in boincteam table
215
-  $sql2='DELETE FROM {boincteam} WHERE id=%d';
215
+  $sql2 = 'DELETE FROM {boincteam} WHERE id=%d';
216 216
   $db_res = db_query($sql2, $id);
217 217
 
218 218
   // Delete the drupal node (if present)
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
     node_delete($drupalid);
221 221
   }
222 222
 
223
-  $context['results'][] = $id . ' : ' . check_plain($boincteam->name);
223
+  $context['results'][] = $id.' : '.check_plain($boincteam->name);
224 224
   $context['message'] = t('Processing team @name', array('@name' => $boincteam->name));
225 225
 }
226 226
 
@@ -230,14 +230,14 @@  discard block
 block discarded – undo
230 230
  */
231 231
 function boincteam_utility_batch_finished($success, $results, $operations) {
232 232
   if ($success) {
233
-    $message = 'Info: Delete SPAM Teams utility- ' . count($results) . ' team(s) deleted.';
233
+    $message = 'Info: Delete SPAM Teams utility- '.count($results).' team(s) deleted.';
234 234
     drupal_set_message($message, 'info');
235 235
   }
236 236
   else {
237 237
     // An error occurred.
238 238
     // $operations contains the operations that remained unprocessed.
239 239
     $error_operation = reset($operations);
240
-    $message = 'Error: An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE);
240
+    $message = 'Error: An error occurred while processing '.$error_operation[0].' with arguments :'.print_r($error_operation[0], TRUE);
241 241
     drupal_set_message($message, 'error');
242 242
   }
243 243
 }
244 244
\ No newline at end of file
Please login to merge, or discard this patch.