Passed
Push — master ( 8b88f4...c5ef2d )
by Christian
07:24 queued 10s
created
drupal/sites/default/boinc/modules/boincuser/includes/boincuser.helpers.inc 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -165,8 +165,8 @@  discard block
 block discarded – undo
165 165
       WHERE n.type = 'profile'
166 166
       AND n.status = 1
167 167
       AND n.moderate = 0
168
-      " . ($never_been_picked ? " AND bu.uotd_time = 0 " : '') . "
169
-      " . ($active_users ? " AND bu.boinc_id IN ({$active_users}) " : '') . "
168
+      " . ($never_been_picked ? " AND bu.uotd_time = 0 " : '')."
169
+      " . ($active_users ? " AND bu.boinc_id IN ({$active_users}) " : '')."
170 170
       ORDER BY RAND()
171 171
       LIMIT 1"
172 172
     ));
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
  * this function is called, it may be called with optional parameters
213 213
  * new and prev email.
214 214
  */
215
-function _boincuser_send_emailchange($account, $new_email=NULL, $prev_email=NULL, $adminuser=FALSE) {
215
+function _boincuser_send_emailchange($account, $new_email = NULL, $prev_email = NULL, $adminuser = FALSE) {
216 216
   require_boinc('token');
217 217
   module_load_include('inc', 'rules', 'modules/system.rules');
218 218
 
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
     // Name is limited to 60 characters, but we want to leave space to add a
304 304
     // tally if needed (for users with duplicate names); Limit to 56 chars and
305 305
     // replace the middle of the string with "..." if too long
306
-    $cleaned_name = substr_replace($cleaned_name, '...', 28, ($name_length-56)+3);
306
+    $cleaned_name = substr_replace($cleaned_name, '...', 28, ($name_length - 56) + 3);
307 307
   }
308 308
 
309 309
   // Determine if there are duplicate names, if so append a number to end.
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
     // delimiters. Curly brace is not really allowed un URLs, but a
374 374
     // more robust function would first check for these curly braces
375 375
     // in the path_to_ignore patterms, just in case.
376
-    if (preg_match('{' . $pi . '}', $path)) {
376
+    if (preg_match('{'.$pi.'}', $path)) {
377 377
       return TRUE;
378 378
     }
379 379
   }
@@ -499,15 +499,15 @@  discard block
 block discarded – undo
499 499
   elseif (!in_array($_GET['q'], $page_blacklist)) {
500 500
     watchdog('boincuser', 'The BOINC scheduling server settings are not yet
501 501
         configured. Please !verify for the settings to become effective.',
502
-          array('!verify' => l(t('verify the default values') . ' <strong>' . 
503
-            t('and') . '</strong> ' . t('save the configuration'),
502
+          array('!verify' => l(t('verify the default values').' <strong>'. 
503
+            t('and').'</strong> '.t('save the configuration'),
504 504
             'admin/boinc/scheduler', array('html' => TRUE))
505 505
           ), WATCHDOG_WARNING);
506 506
     if (user_access('administer site configuration')) {
507 507
       drupal_set_message(t('The BOINC scheduling server settings are not yet
508 508
           configured. Please !verify for the settings to become effective',
509
-            array('!verify' => l(t('verify the default values') . ' <strong>' . 
510
-              t('and') . '</strong> ' . t('save the configuration'),
509
+            array('!verify' => l(t('verify the default values').' <strong>'. 
510
+              t('and').'</strong> '.t('save the configuration'),
511 511
               'admin/boinc/scheduler', array('html' => TRUE))
512 512
             )), 'warning', FALSE);
513 513
     }
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
  */
570 570
 function _boincuser_node_profile_delete_submit($form, &$form_state) {
571 571
   $node = $form['#node'];
572
-  $deleteurl = 'node/'. $node->nid .'/delete';
572
+  $deleteurl = 'node/'.$node->nid.'/delete';
573 573
   $afterq = 'destination=account';
574 574
   drupal_goto($deleteurl, $afterq);
575 575
 }
@@ -599,8 +599,8 @@  discard block
 block discarded – undo
599 599
   $view = views_get_current_view();
600 600
   $account_id = $view->args[0];
601 601
   $friend_count = flag_friend_get_friend_count($account_id);
602
-  return '<h2 class="pane-title">' . bts('Friends (@count)', 
603
-    array('@count' => $friend_count)) . '</h2>';
602
+  return '<h2 class="pane-title">'.bts('Friends (@count)', 
603
+    array('@count' => $friend_count)).'</h2>';
604 604
 }
605 605
 
606 606
 /**
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
   $result = db_query_range("SELECT id,name FROM {user} WHERE name LIKE '%s%'", $string, 0, 10);
614 614
   db_set_active('default');
615 615
   while ($user = db_fetch_object($result)) {
616
-      $matches[$user->name . '_' . $user->id] = htmlentities($user->name) . " (" . $user->id . ')';
616
+      $matches[$user->name.'_'.$user->id] = htmlentities($user->name)." (".$user->id.')';
617 617
   }
618 618
 
619 619
   drupal_json((object)$matches);
Please login to merge, or discard this patch.
html/inc/account.inc 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
             tra("Must be at least %1 characters", $min_passwd_length),
101 101
             tra("Password")
102 102
         ),
103
-        "passwd", "", "password",'id="passwd"',passwd_visible_checkbox("passwd")
103
+        "passwd", "", "password", 'id="passwd"', passwd_visible_checkbox("passwd")
104 104
     );
105 105
     if (USER_COUNTRY) {
106 106
         form_select(
@@ -145,9 +145,9 @@  discard block
 block discarded – undo
145 145
     } else {
146 146
         $x = tra("Email address:");
147 147
     }
148
-    form_input_text($x, "email_addr", '', 'text', $attrs='autofocus tabindex="1"');
148
+    form_input_text($x, "email_addr", '', 'text', $attrs = 'autofocus tabindex="1"');
149 149
     form_input_text(
150
-        tra("Password:").'<br><small><a href="get_passwd.php">' . tra("forgot password?") . "</a></small>",
150
+        tra("Password:").'<br><small><a href="get_passwd.php">'.tra("forgot password?")."</a></small>",
151 151
         "passwd",
152 152
         "",
153 153
         "password",
Please login to merge, or discard this patch.
html/inc/util_basic.inc 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -46,10 +46,10 @@  discard block
 block discarded – undo
46 46
     ";
47 47
 }
48 48
 
49
-function xml_error($num, $msg=null, $file=null, $line=null) {
49
+function xml_error($num, $msg = null, $file = null, $line = null) {
50 50
     global $xml_outer_tag;
51 51
     if (!$msg) {
52
-        switch($num) {
52
+        switch ($num) {
53 53
         case -112: $msg = "Invalid XML"; break;
54 54
         case -136: $msg = "Not found"; break;
55 55
         case -137: $msg = "Name or email address is not unique"; break;
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 // If it's a single-tag element, and it's present, just return the tag
96 96
 //
97 97
 function parse_element($xml, $tag) {
98
-    $closetag = "</" . substr($tag,1);
98
+    $closetag = "</".substr($tag, 1);
99 99
     $x = strstr($xml, $tag);
100 100
     if ($x) {
101 101
         if (strstr($tag, "/>")) return $tag;
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
 
112 112
 function parse_next_element($xml, $tag, &$cursor) {
113 113
     $element = null;
114
-    $closetag = "</" . substr($tag,1);
115
-    $pos = substr($xml,$cursor);
114
+    $closetag = "</".substr($tag, 1);
115
+    $pos = substr($xml, $cursor);
116 116
     $x = strstr($pos, $tag);
117 117
     if ($x) {
118 118
         if (strstr($tag, "/>")) return $tag;
Please login to merge, or discard this patch.
html/inc/util.inc 1 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.
html/user/get_project_config.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -30,10 +30,10 @@  discard block
 block discarded – undo
30 30
 //
31 31
 function show_platforms() {
32 32
     $xmlFragment = unserialize(get_cached_data(3600, "project_config_platform_xml"));
33
-    if ($xmlFragment==false){
33
+    if ($xmlFragment == false) {
34 34
         $platforms = BoincDB::get()->enum_fields("platform, DBNAME.app_version, DBNAME.app", "BoincPlatform", "platform.name, platform.user_friendly_name, plan_class", "app_version.platformid = platform.id and app_version.appid = app.id and app_version.deprecated=0 and app.deprecated=0 group by platform.name, plan_class", "");
35 35
         $xmlFragment = "    <platforms>";
36
-        foreach ($platforms as $platform){
36
+        foreach ($platforms as $platform) {
37 37
             $xmlFragment .= "
38 38
             <platform>
39 39
                 <platform_name>$platform->name</platform_name>
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 if (defined('TERMSOFUSE_FILE')) {
116 116
   $tou_file = TERMSOFUSE_FILE;
117 117
 } else {
118
-  $tou_file =  "../../terms_of_use.txt";
118
+  $tou_file = "../../terms_of_use.txt";
119 119
 }
120 120
 if (file_exists($tou_file)) {
121 121
     $terms_of_use = trim(file_get_contents($tou_file));
Please login to merge, or discard this patch.
html/ops/mass_email_script.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 $globals->batch = 1000;
56 56
 $globals->lapsed_interval = 60*86400;
57 57
 
58
-for ($i=1; $i<$argc; $i++) {
58
+for ($i = 1; $i < $argc; $i++) {
59 59
     if ($argv[$i] == "--batch") {
60 60
         $i++;
61 61
         $globals->batch = $argv[$i];
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
         gmdate('d F Y', $user->create_time),
170 170
         number_format($user->total_credit, 0),
171 171
         opt_out_url($user),
172
-        floor((time() - $user->last_rpc_time) / 86400),
172
+        floor((time() - $user->last_rpc_time)/86400),
173 173
     );
174 174
     return preg_replace($pat, $rep, $template);
175 175
 }
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
     while ($user = _mysql_fetch_object($result)) {
239 239
         handle_user($user);
240 240
         $startid = $user->id;
241
-        fputs($log, $user->id . "\n");
241
+        fputs($log, $user->id."\n");
242 242
         fflush($log);
243 243
     }
244 244
     _mysql_free_result($result);
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
     $user = _mysql_fetch_object($result);
253 253
     if ($user) {
254 254
         handle_user($user);
255
-        fputs($log, $user->id . "\n");
255
+        fputs($log, $user->id."\n");
256 256
         fflush($log);
257 257
     }
258 258
     _mysql_free_result($result);
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
     } else {
290 290
         $fid = fopen($id_file, 'r');
291 291
         if (!$fid) {
292
-            echo  $id_file . ' not found - create ID list and run again\n';
292
+            echo  $id_file.' not found - create ID list and run again\n';
293 293
             exit();
294 294
         }
295 295
         $thisid = 0;
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
         }
301 301
         fclose($fid);
302 302
     }
303
-    echo 'All done!' . "\n";
303
+    echo 'All done!'."\n";
304 304
 }
305 305
 
306 306
 if (!function_exists('make_php_mailer')) {
Please login to merge, or discard this patch.
html/inc/translation.inc 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -64,11 +64,11 @@  discard block
 block discarded – undo
64 64
     $dh = opendir($langdir.$transdir);
65 65
     if (!$dh) die("can't open translation dir");
66 66
     while (($file = readdir($dh)) !== false) {
67
-        if ($file==".." || $file==".") {
67
+        if ($file == ".." || $file == ".") {
68 68
             continue;
69 69
         }
70 70
         // only do files ending in .po
71
-        if (substr($file,-3) != ".po"){
71
+        if (substr($file, -3) != ".po") {
72 72
             //debug("File $file with unknown extension found in $info_dir");
73 73
             continue;
74 74
         }
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
             "-------------Compiling $transdir$file------------", 0
77 77
         );
78 78
         $language = parse_po_file($langdir.$transdir.$file);
79
-        if (!$language){
79
+        if (!$language) {
80 80
             language_log(
81 81
                 "WARNING: Could not parse language ".$file
82 82
             );
@@ -95,10 +95,10 @@  discard block
 block discarded – undo
95 95
             );
96 96
             exit;
97 97
         }
98
-        foreach ($language as $key => $value){
98
+        foreach ($language as $key => $value) {
99 99
             if ($value !== "") {
100 100
                 // Skip if the msgstr is empty
101
-                fwrite($fh, "\$language_lookup_array[\"".str_replace("\"", "\\\"", substr($file,0,-3))."\"][\"".$key."\"] = \"".$value."\";\n");
101
+                fwrite($fh, "\$language_lookup_array[\"".str_replace("\"", "\\\"", substr($file, 0, -3))."\"][\"".$key."\"] = \"".$value."\";\n");
102 102
             }
103 103
         }
104 104
         // don't write \?\> - may append
@@ -115,27 +115,27 @@  discard block
 block discarded – undo
115 115
 function parse_po_file($file) {
116 116
     $translation_file = file($file);
117 117
     $first_entry = true;
118
-    $current_token_text="";
119
-    $current_token ="";
118
+    $current_token_text = "";
119
+    $current_token = "";
120 120
     $parsing_token = false;
121 121
     $parsing_text = false;
122 122
     $size = sizeof($translation_file);
123 123
     $output = array();
124
-    for ($i=0; $i<$size; $i++){
124
+    for ($i = 0; $i < $size; $i++) {
125 125
         $entry = trim($translation_file[$i]);
126 126
         //echo "line $i: $entry\n";
127
-        if (substr($entry, 0, 1)=="#") {
127
+        if (substr($entry, 0, 1) == "#") {
128 128
             continue;
129 129
         } elseif (strpos($entry, "msgid") !== false) {
130
-            if (!$first_entry){
130
+            if (!$first_entry) {
131 131
                 //If this is not the first, save the previous entry
132
-                $output[$current_token]=$current_token_text;
132
+                $output[$current_token] = $current_token_text;
133 133
             }
134 134
             $current_token = get_po_line($entry, $file);
135
-            $current_token_text="";
135
+            $current_token_text = "";
136 136
             $parsing_token = true;
137 137
             $parsing_text = false;
138
-            $first_entry=false;
138
+            $first_entry = false;
139 139
         } elseif (strpos($entry, "msgstr") !== false) {
140 140
             $current_token_text = get_po_line($entry, $file);
141 141
             $parsing_token = false;
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
     
150 150
     // Get the last token
151 151
     //
152
-    if ($current_token && $current_token_text){
152
+    if ($current_token && $current_token_text) {
153 153
         $output[$current_token] = $current_token_text;
154 154
     }
155 155
     return $output;
@@ -159,9 +159,9 @@  discard block
 block discarded – undo
159 159
 // Returns the contents of a line (ie removes "" from start and end)
160 160
 //
161 161
 function get_po_line($line, $file) {
162
-    $start = strpos($line, '"')+1;
162
+    $start = strpos($line, '"') + 1;
163 163
     $stop = strrpos($line, '"');
164
-    $x = substr($line, $start, $stop-$start);
164
+    $x = substr($line, $start, $stop - $start);
165 165
     $n = preg_match("/[^\\\\]\"/", $x);
166 166
     if ($n) {
167 167
         echo "ERROR - MISMATCHED QUOTES IN $file: $line\n";
@@ -180,11 +180,11 @@  discard block
 block discarded – undo
180 180
     
181 181
     // Find the string in the user's language
182 182
     //
183
-    foreach ($languages_in_use as $language){
183
+    foreach ($languages_in_use as $language) {
184 184
         if (isset($language_lookup_array[$language][$text])) {
185 185
             $text = $language_lookup_array[$language][$text];
186 186
             break;
187
-        } else if ($language=="en"){ 
187
+        } else if ($language == "en") { 
188 188
             // This language is defined in the code and is always available
189 189
             break;
190 190
         }
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
     // Replace relevant substrings with given arguments.
194 194
     // Use strtr to avoid problems if an argument contains %n.
195 195
     $replacements = array();
196
-    for ($i=1; $i<func_num_args(); $i++){
196
+    for ($i = 1; $i < func_num_args(); $i++) {
197 197
         $replacements["%".$i] = func_get_arg($i);
198 198
     }
199 199
 
@@ -210,14 +210,14 @@  discard block
 block discarded – undo
210 210
     return $text;
211 211
 }
212 212
 
213
-function language_log($message, $loglevel=0) {
213
+function language_log($message, $loglevel = 0) {
214 214
     global $lang_log_level;
215 215
     $msg = "";
216
-    if ($loglevel==0) $msg = "[ Debug    ]";
217
-    if ($loglevel==1) $msg = "[ Warning  ]";
218
-    if ($loglevel==2) $msg = "[ CRITICAL ]";
216
+    if ($loglevel == 0) $msg = "[ Debug    ]";
217
+    if ($loglevel == 1) $msg = "[ Warning  ]";
218
+    if ($loglevel == 2) $msg = "[ CRITICAL ]";
219 219
 
220
-    if ($loglevel >= $lang_log_level){
220
+    if ($loglevel >= $lang_log_level) {
221 221
         echo gmdate("Y-m-d H:i:s", time())." ".$msg." ".$message."\n";
222 222
     }
223 223
 }
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 // (by looking at cookies and browser settings)
227 227
 // cookies have highest priority.
228 228
 
229
-if (isset($_COOKIE['lang'])){
229
+if (isset($_COOKIE['lang'])) {
230 230
     $language_string = $_COOKIE['lang'].",";
231 231
 } else {
232 232
     $language_string = '';
@@ -257,10 +257,10 @@  discard block
 block discarded – undo
257 257
 // Loop over languages that the client requests
258 258
 //
259 259
 $size = sizeof($client_languages);
260
-for ($i=0; $i<$size; $i++) {
261
-    if ((strlen($client_languages[$i])>2)
260
+for ($i = 0; $i < $size; $i++) {
261
+    if ((strlen($client_languages[$i]) > 2)
262 262
         && (substr($client_languages[$i], 2, 1) == "_" || substr($client_languages[$i], 2, 1) == "-")
263
-    ){
263
+    ) {
264 264
         // If this is defined as primary-secondary, represent it as xx_YY
265 265
         //
266 266
         $language = substr(
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 
280 280
     // if main language is english, look no further
281 281
     //
282
-    if ((count($languages_in_use)==0) && ($language == 'en' || $language2 == 'en')) {
282
+    if ((count($languages_in_use) == 0) && ($language == 'en' || $language2 == 'en')) {
283 283
         break;
284 284
     }
285 285
 
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
     //
288 288
     $file_name = $lang_language_dir.$lang_compiled_dir.$language.".po.inc";
289 289
     if (file_exists($file_name)) {
290
-        if (!in_array($language, $languages_in_use)){
290
+        if (!in_array($language, $languages_in_use)) {
291 291
             require_once($file_name);
292 292
             $languages_in_use[] = $language;
293 293
         }
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
     if ($language2) {
296 296
         $file_name = $lang_language_dir.$lang_compiled_dir.$language2.".po.inc";
297 297
         if (file_exists($file_name)) {
298
-            if (!in_array($language2, $languages_in_use)){
298
+            if (!in_array($language2, $languages_in_use)) {
299 299
                 require_once($file_name);
300 300
                 $languages_in_use[] = $language2;
301 301
             }
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
     }
304 304
 }
305 305
 
306
-$GLOBALS['languages_in_use'] = $languages_in_use;   // for Drupal
306
+$GLOBALS['languages_in_use'] = $languages_in_use; // for Drupal
307 307
 
308
-$cvs_version_tracker[]="\$Id$";  //Generated automatically - do not edit
308
+$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit
309 309
 ?>
Please login to merge, or discard this patch.
html/user/cert_all.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -29,10 +29,10 @@  discard block
 block discarded – undo
29 29
 
30 30
 $border = get_str("border", true);
31 31
 
32
-if ($border=="no") {
32
+if ($border == "no") {
33 33
     $border = 0;
34 34
 } else {
35
-    $border=8;
35
+    $border = 8;
36 36
 }
37 37
 
38 38
 $font = "\"Optima,Lucida Bright,Times New Roman\"";
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
     <tr><th align=left>Project</th><th align=left>Cobblestones</th><th align=left>Joined</th></tr>
76 76
 ";
77 77
 foreach ($user->projects as $p) {
78
-    if ($p->total_credit<100) continue;
78
+    if ($p->total_credit < 100) continue;
79 79
     show_proj($p);
80 80
 }
81 81
 echo "
Please login to merge, or discard this patch.
drupal/sites/default/settings.php 1 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.