Completed
Pull Request — master (#1976)
by Christian
10:47
created
html/inc/result.inc 1 patch
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -500,9 +500,9 @@  discard block
 block discarded – undo
500 500
 // @return String A human readable error message
501 501
 // @param Integer $x An error number
502 502
 //
503
-function windows_error_code_str($x){
503
+function windows_error_code_str($x) {
504 504
     $h=int2hex($x);
505
-    switch($h){
505
+    switch($h) {
506 506
     case "0xC0000005": return "STATUS_ACCESS_VIOLATION";
507 507
     case "0xC000001D": return "STATUS_ILLEGAL_INSTRUCTION";
508 508
     case "0xC0000094": return "STATUS_INTEGER_DIVIDE_BY_ZERO";
@@ -523,10 +523,10 @@  discard block
 block discarded – undo
523 523
 // @return String A human readable error message
524 524
 // @param Integer $x An error number
525 525
 //
526
-function error_code_str($x){
526
+function error_code_str($x) {
527 527
     // severe Windows error numbers are always large negative integers
528 528
     if ($x<-400) return windows_error_code_str($x);
529
-    switch($x){
529
+    switch($x) {
530 530
     case 0: return "";
531 531
     case 192: return "EXIT_STATEFILE_WRITE";
532 532
     case 193: return "EXIT_SIGNAL";
Please login to merge, or discard this patch.
html/inc/host.inc 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@
 block discarded – undo
90 90
             if ($host->last_ip_addr != $host->external_ip_addr) {
91 91
                 row2(tra("External IP address"), $host->external_ip_addr);
92 92
             }
93
-        } else { 
93
+        } else {
94 94
             row2(tra("IP address"), "<a href=show_host_detail.php?hostid=$host->id&ipprivate=1>".tra("Show IP address")."</a>");
95 95
         }
96 96
         row2(tra("Domain name"), $host->domain_name);
Please login to merge, or discard this patch.
html/inc/countries.inc 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -505,7 +505,7 @@
 block discarded – undo
505 505
     geoip_close($gi);
506 506
 
507 507
     if ($selected_country=="") $selected_country="None";
508
-    if ($selected_country=="None" and $geoip_country!=""){
508
+    if ($selected_country=="None" and $geoip_country!="") {
509 509
         $selected_country=$geoip_country;
510 510
     }
511 511
 
Please login to merge, or discard this patch.
html/inc/util_ops.inc 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@
 block discarded – undo
74 74
 }
75 75
 
76 76
 function show_profile_link_ops($user) {
77
-    if ($user->has_profile) { 
77
+    if ($user->has_profile) {
78 78
         row2("Profile",
79 79
             "<a href=\"".url_base()."view_profile.php?userid=$user->id\">View</a>"
80 80
         );
Please login to merge, or discard this patch.
html/inc/bolt_xset.inc 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -134,7 +134,7 @@
 block discarded – undo
134 134
     }
135 135
 }
136 136
 
137
-class BoltRefresh{
137
+class BoltRefresh {
138 138
     public $intervals;
139 139
     function __construct($i) {
140 140
         $this->intervals = $i;
Please login to merge, or discard this patch.
html/project.sample/project.inc 1 patch
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -183,15 +183,15 @@  discard block
 block discarded – undo
183 183
     </ol>", PROJECT);
184 184
 }
185 185
 
186
-function project_workunit($wu){
186
+function project_workunit($wu) {
187 187
     // shown in the workunit page
188 188
 }
189 189
 
190
-function project_user_summary($user){
190
+function project_user_summary($user) {
191 191
     // shown in the user summary page
192 192
 }
193 193
 
194
-function project_user_page_private($user){
194
+function project_user_page_private($user) {
195 195
     // shown in the private account page
196 196
 }
197 197
 
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
     array("name" => "Uppercase", "short_name" => "UC", "appids" => array(1, 25)),
259 259
 );
260 260
 
261
-function project_user_credit($user){
261
+function project_user_credit($user) {
262 262
     global $sub_projects;
263 263
     foreach ($sub_projects as $sp) {
264 264
         show_app_credit_user($user, $sp["name"], $sp["appids"]);
Please login to merge, or discard this patch.
drupal/sites/default/boinc/modules/boincimport/boincimport.module 1 patch
Braces   +91 added lines, -180 removed lines patch added patch discarded remove patch
@@ -172,8 +172,7 @@  discard block
 block discarded – undo
172 172
   $out['result'] = $result;
173 173
   if ($result == 1) {
174 174
     $out['html'] .= '<li>'. t('Module %module is enabled. OK!', array('%module' => $module)) .'</li>';
175
-  }
176
-  else {
175
+  } else {
177 176
     $out['html'] .= '<li><span class="marker">'. t('Module %module is disabled.', array('%module' => $module)) .'</span></li>';
178 177
   }
179 178
   $out['html'] .= '</ul>';
@@ -201,16 +200,14 @@  discard block
 block discarded – undo
201 200
     if ($GLOBALS['db_type'] == 'pgsql') {
202 201
       // adapt from db_table_exists in database.pgsql.inc
203 202
       $result = (bool) db_result(db_query("SELECT COUNT(*) FROM pg_class WHERE relname = '%s'", $table));
204
-    }
205
-    else {
203
+    } else {
206 204
       // adapt from db_table_exists in database.mysql.inc
207 205
       $result = (bool) db_fetch_object(db_query("SHOW TABLES LIKE '%s'", $table));
208 206
     }
209 207
     db_set_active('default');
210 208
     if ($result) {
211 209
       $out['html'] .= '<li>'. t('Table %table: OK!', array('%table' => $table)) .'</li>';
212
-    }
213
-    else {
210
+    } else {
214 211
       $out['html'] .= '<li><span class="marker">'. t('Table <strong>%table</strong> does not exist!', array('%table' => $table)) .'</span></li>';
215 212
       $out['result']= 0;
216 213
     }
@@ -257,8 +254,7 @@  discard block
 block discarded – undo
257 254
       array('!unlock_it' => l(t('release the lock'),
258 255
         'admin/boinc/import/unlock')
259 256
       ), WATCHDOG_WARNING); 
260
-  }
261
-  else {
257
+  } else {
262 258
     $boincimport_functions = array(
263 259
       'users' => t('Import users'),
264 260
       'teams' => t('Import teams'),
@@ -293,8 +289,7 @@  discard block
 block discarded – undo
293 289
   // Lock the import process
294 290
   if (!variable_get('boincimport_process_locked', 0)) {
295 291
     variable_set('boincimport_process_locked', 1);
296
-  }
297
-  else {
292
+  } else {
298 293
     watchdog('boincimport', 'The import process is locked, but another process
299 294
       is trying to access it...', array(), WATCHDOG_WARNING); 
300 295
   }
@@ -308,8 +303,7 @@  discard block
 block discarded – undo
308 303
       boincimport_teams();
309 304
       if (!variable_get('boincimport_import_team_successful', 0)) {
310 305
         $_SESSION['boincimport_stage_selected'] = 'teams';
311
-      }
312
-      else {
306
+      } else {
313 307
         $_SESSION['boincimport_stage_selected'] = 'friends';
314 308
       }
315 309
       break;
@@ -318,8 +312,7 @@  discard block
 block discarded – undo
318 312
       boincimport_friends();
319 313
       if (!variable_get('boincimport_import_friend_successful', 0)) {
320 314
         $_SESSION['boincimport_stage_selected'] = 'friends';
321
-      }
322
-      else {
315
+      } else {
323 316
         $_SESSION['boincimport_stage_selected'] = 'preferences';
324 317
       }
325 318
       break;
@@ -328,8 +321,7 @@  discard block
 block discarded – undo
328 321
       boincimport_preferences();
329 322
       if (!variable_get('boincimport_import_preferences_successful', 0)) {
330 323
         $_SESSION['boincimport_stage_selected'] = 'preferences';
331
-      }
332
-      else {
324
+      } else {
333 325
         $_SESSION['boincimport_stage_selected'] = 'private messages';
334 326
       }
335 327
       break;
@@ -338,8 +330,7 @@  discard block
 block discarded – undo
338 330
       boincimport_private_msgs();
339 331
       if (!variable_get('boincimport_import_private_msg_successful', 0)) {
340 332
         $_SESSION['boincimport_stage_selected'] = 'private messages';
341
-      }
342
-      else {
333
+      } else {
343 334
         $_SESSION['boincimport_stage_selected'] = 'categories';
344 335
       }
345 336
       break;
@@ -348,8 +339,7 @@  discard block
 block discarded – undo
348 339
       boincimport_forum_categories();
349 340
       if (!variable_get('boincimport_import_category_successful', 0)) {
350 341
         $_SESSION['boincimport_stage_selected'] = 'categories';
351
-      }
352
-      else {
342
+      } else {
353 343
         $_SESSION['boincimport_stage_selected'] = 'topics';
354 344
       }
355 345
       break;
@@ -358,8 +348,7 @@  discard block
 block discarded – undo
358 348
       boincimport_forum_topics();
359 349
       if (!variable_get('boincimport_import_topic_successful', 0)) {
360 350
         $_SESSION['boincimport_stage_selected'] = 'topics';
361
-      }
362
-      else {
351
+      } else {
363 352
         $_SESSION['boincimport_stage_selected'] = 'posts';
364 353
       }
365 354
       break;
@@ -368,8 +357,7 @@  discard block
 block discarded – undo
368 357
       boincimport_forum_posts();
369 358
       if (!variable_get('boincimport_import_post_successful', 0)) {
370 359
         $_SESSION['boincimport_stage_selected'] = 'posts';
371
-      }
372
-      else {
360
+      } else {
373 361
         $_SESSION['boincimport_stage_selected'] = 'url';
374 362
       }
375 363
       break;
@@ -378,8 +366,7 @@  discard block
 block discarded – undo
378 366
       boincimport_team_forums();
379 367
       if (!variable_get('boincimport_team_forum_successful', 0)) {
380 368
         $_SESSION['boincimport_stage_selected'] = 'team forums';
381
-      }
382
-      else {
369
+      } else {
383 370
         $_SESSION['boincimport_stage_selected'] = 'team topics';
384 371
       }
385 372
       break;
@@ -388,8 +375,7 @@  discard block
 block discarded – undo
388 375
       boincimport_team_forum_topics();
389 376
       if (!variable_get('boincimport_team_topic_successful', 0)) {
390 377
         $_SESSION['boincimport_stage_selected'] = 'team topics';
391
-      }
392
-      else {
378
+      } else {
393 379
         $_SESSION['boincimport_stage_selected'] = 'team posts';
394 380
       }
395 381
       break;
@@ -398,8 +384,7 @@  discard block
 block discarded – undo
398 384
       boincimport_team_forum_posts();
399 385
       if (!variable_get('boincimport_team_post_successful', 0)) {
400 386
         $_SESSION['boincimport_stage_selected'] = 'team posts';
401
-      }
402
-      else {
387
+      } else {
403 388
         $_SESSION['boincimport_stage_selected'] = 'url';
404 389
       }
405 390
       break;
@@ -408,8 +393,7 @@  discard block
 block discarded – undo
408 393
       boincimport_replace_urls();
409 394
       if (!variable_get('boincimport_replace_url_successful', 0)) {
410 395
         $_SESSION['boincimport_stage_selected'] = 'url';
411
-      }
412
-      else {
396
+      } else {
413 397
         drupal_set_message('Congratulations.  Import Finished');
414 398
         drupal_set_message('Please visit the '. l('Post migration configuration', 'admin/boinc/import/post_configuration') .' page');
415 399
         watchdog('boincimport', 'Import process is complete', array(), WATCHDOG_INFO); 
@@ -478,8 +462,7 @@  discard block
 block discarded – undo
478 462
       ORDER BY id ASC'
479 463
     );
480 464
     $user_count = mysql_num_rows($boinc_accounts);
481
-  }
482
-  else {
465
+  } else {
483 466
     // Need to import any user who is currently ignored in order to keep them
484 467
     // ignored... not particularly clean (ignored users are stored in a string)
485 468
     $ignored_user_list = array(0);
@@ -555,8 +538,7 @@  discard block
 block discarded – undo
555 538
      if (isset($existing_users[$boinc_account->id])) {
556 539
       // This user has already been imported
557 540
       $duplicates[] = $boinc_account->id;
558
-    }
559
-    else {
541
+    } else {
560 542
       $operations[] = array(
561 543
         'boincimport_users_op', array(
562 544
           $boinc_account->id
@@ -612,8 +594,7 @@  discard block
 block discarded – undo
612 594
     // Store some result for post-processing in the finished callback.
613 595
     $context['results']['success'][] = $boinc_id;
614 596
     $message = "Successfully imported user {$boinc_id}";
615
-  }
616
-  else {
597
+  } else {
617 598
     $context['results']['failure'][] = $boinc_id;
618 599
     $message = "Failed to import user {$boinc_id}!";
619 600
     watchdog('boincimport',
@@ -630,8 +611,7 @@  discard block
 block discarded – undo
630 611
   // Update the progress for the batch engine
631 612
   if ($context['sandbox']['progress'] >= $context['sandbox']['max']) {
632 613
     $context['finished'] = 1;
633
-  }
634
-  else {
614
+  } else {
635 615
     $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
636 616
   }
637 617
 }
@@ -656,8 +636,7 @@  discard block
 block discarded – undo
656 636
     // Set the user import successful flag in the variable table
657 637
     variable_set('boincimport_import_user_successful', '1');
658 638
     $_SESSION['boincimport_stage_selected'] = 'teams';
659
-  }
660
-  else {
639
+  } else {
661 640
     // An error occurred.
662 641
     // $operations contains the operations that remained unprocessed.
663 642
     $error_operation = reset($operations);
@@ -719,8 +698,7 @@  discard block
 block discarded – undo
719 698
         $team_type = array(
720 699
           'tid' => $team_type_id
721 700
         );
722
-      }
723
-      else {
701
+      } else {
724 702
         if (!$name) continue;
725 703
         $team_type = array(
726 704
           'name' => strip_tags($name),
@@ -783,8 +761,7 @@  discard block
 block discarded – undo
783 761
      if (isset($existing_teams[$boinc_team->id])) {
784 762
       // This team has already been imported
785 763
       $duplicates[] = $boinc_team->id;
786
-    }
787
-    else {
764
+    } else {
788 765
       $operations[] = array(
789 766
         'boincimport_teams_op', array(
790 767
           $boinc_team
@@ -825,8 +802,7 @@  discard block
 block discarded – undo
825 802
     // Store some result for post-processing in the finished callback.
826 803
     $context['results']['success'][] = $boincteam->id;
827 804
     $message = "Successfully imported team {$boincteam->id}";
828
-  }
829
-  else {
805
+  } else {
830 806
     $context['results']['failure'][] = $boincteam->id;
831 807
     $message = "Failed to import team {$boincteam->id}!";
832 808
     watchdog('boincimport',
@@ -843,8 +819,7 @@  discard block
 block discarded – undo
843 819
   // Update the progress for the batch engine
844 820
   if ($context['sandbox']['progress'] >= $context['sandbox']['max']) {
845 821
     $context['finished'] = 1;
846
-  }
847
-  else {
822
+  } else {
848 823
     $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
849 824
   }
850 825
 }
@@ -867,8 +842,7 @@  discard block
 block discarded – undo
867 842
     // Set the team import successful flag in the variable table
868 843
     variable_set('boincimport_import_team_successful', '1');
869 844
     $_SESSION['boincimport_stage_selected'] = 'friends';
870
-  }
871
-  else {
845
+  } else {
872 846
     // An error occurred.
873 847
     // $operations contains the operations that remained unprocessed.
874 848
     $error_operation = reset($operations);
@@ -989,8 +963,7 @@  discard block
 block discarded – undo
989 963
       SET uid = '%d', friend_uid = '%d', created = '%d'",
990 964
       $uid, $friend_uid, $friendship->create_time
991 965
     );
992
-  }
993
-  else {
966
+  } else {
994 967
     $boinc_id = ($uid) ? $friendship->user_dest : $friendship->user_src;
995 968
     $message = "No Drupal account exists for BOINC user {$boinc_id}!";
996 969
   }
@@ -999,8 +972,7 @@  discard block
 block discarded – undo
999 972
     // Store some result for post-processing in the finished callback.
1000 973
     $context['results']['success'][] = $uid;
1001 974
     $message = "Successfully made users {$uid} and {$friend_uid} friends";
1002
-  }
1003
-  else {
975
+  } else {
1004 976
     $context['results']['failure'][] = $uid;
1005 977
     if (!$message) {
1006 978
       $message = "Failed to make users {$uid} and {$friend_uid} friends!";
@@ -1016,8 +988,7 @@  discard block
 block discarded – undo
1016 988
   // Update the progress for the batch engine
1017 989
   if ($context['sandbox']['progress'] >= $context['sandbox']['max']) {
1018 990
     $context['finished'] = 1;
1019
-  }
1020
-  else {
991
+  } else {
1021 992
     $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
1022 993
   }
1023 994
 }
@@ -1041,8 +1012,7 @@  discard block
 block discarded – undo
1041 1012
     // Set the friend import successful flag in the variable table
1042 1013
     variable_set('boincimport_import_friend_successful', '1');
1043 1014
     $_SESSION['boincimport_stage_selected'] = 'preferences';
1044
-  }
1045
-  else {
1015
+  } else {
1046 1016
     // An error occurred.
1047 1017
     // $operations contains the operations that remained unprocessed.
1048 1018
     $error_operation = reset($operations);
@@ -1166,8 +1136,7 @@  discard block
 block discarded – undo
1166 1136
     );
1167 1137
     if ($user_ignored) {
1168 1138
       $success = TRUE;
1169
-    }
1170
-    else {
1139
+    } else {
1171 1140
       $context['results']['warning'][] = "{$uid}:{$ignored_user_uid}";
1172 1141
       watchdog('boincimport',
1173 1142
         'Could not add user @ignored_uid to the ignore list of user @uid',
@@ -1182,8 +1151,7 @@  discard block
 block discarded – undo
1182 1151
     // Store some result for post-processing in the finished callback.
1183 1152
     $context['results']['success'][] = $uid;
1184 1153
     $message = "Successfully imported ignored users for user {$uid}";
1185
-  }
1186
-  else {
1154
+  } else {
1187 1155
     $context['results']['failure'][] = $uid;
1188 1156
     $message = "Failed to import any user filter preferences for user {$uid}!";
1189 1157
     watchdog('boincimport',
@@ -1200,8 +1168,7 @@  discard block
 block discarded – undo
1200 1168
   // Update the progress for the batch engine
1201 1169
   if ($context['sandbox']['progress'] >= $context['sandbox']['max']) {
1202 1170
     $context['finished'] = 1;
1203
-  }
1204
-  else {
1171
+  } else {
1205 1172
     $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
1206 1173
   }
1207 1174
 }
@@ -1226,8 +1193,7 @@  discard block
 block discarded – undo
1226 1193
     // Set the preference import successful flag in the variable table
1227 1194
     variable_set('boincimport_import_preferences_successful', '1');
1228 1195
     $_SESSION['boincimport_stage_selected'] = 'private messages';
1229
-  }
1230
-  else {
1196
+  } else {
1231 1197
     // An error occurred.
1232 1198
     // $operations contains the operations that remained unprocessed.
1233 1199
     $error_operation = reset($operations);
@@ -1361,8 +1327,7 @@  discard block
 block discarded – undo
1361 1327
     // Store some result for post-processing in the finished callback.
1362 1328
     $context['results']['success'][] = $pm->id;
1363 1329
     $message = "Successfully imported private message {$pm->id}";
1364
-  }
1365
-  else {
1330
+  } else {
1366 1331
     $context['results']['failure'][] = $pm->id;
1367 1332
     $message = "Failed to import private message {$pm->id}!";
1368 1333
     watchdog('boincimport',
@@ -1379,8 +1344,7 @@  discard block
 block discarded – undo
1379 1344
   // Update the progress for the batch engine
1380 1345
   if ($context['sandbox']['progress'] >= $context['sandbox']['max']) {
1381 1346
     $context['finished'] = 1;
1382
-  }
1383
-  else {
1347
+  } else {
1384 1348
     $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
1385 1349
   }
1386 1350
 }
@@ -1403,8 +1367,7 @@  discard block
 block discarded – undo
1403 1367
     // Set the private message import successful flag in the variable table
1404 1368
     variable_set('boincimport_import_private_msg_successful', '1');
1405 1369
     $_SESSION['boincimport_stage_selected'] = 'categories';
1406
-  }
1407
-  else {
1370
+  } else {
1408 1371
     // An error occurred.
1409 1372
     // $operations contains the operations that remained unprocessed.
1410 1373
     $error_operation = reset($operations);
@@ -1557,8 +1520,7 @@  discard block
 block discarded – undo
1557 1520
     if (in_array($boinc_forum_category->name, $existing_categories)) {
1558 1521
       // This category has already been imported
1559 1522
       $duplicate_categories[] = $boinc_forum_category->name;
1560
-    }
1561
-    else {
1523
+    } else {
1562 1524
       $operations[] = array(
1563 1525
         'boincimport_forum_categories_op', array(
1564 1526
           $boinc_forum_category, $forum_vid, $pre, FALSE
@@ -1572,8 +1534,7 @@  discard block
 block discarded – undo
1572 1534
      if (isset($existing_forums[$boinc_forum->id])) {
1573 1535
       // This forum has already been imported
1574 1536
       $duplicates[] = $boinc_forum->id;
1575
-    }
1576
-    else {
1537
+    } else {
1577 1538
       $operations[] = array(
1578 1539
         'boincimport_forums_op', array(
1579 1540
           $boinc_forum, $forum_vid, $pre
@@ -1640,8 +1601,7 @@  discard block
 block discarded – undo
1640 1601
     $category->name = 'Hidden';
1641 1602
     $category->id = 0;
1642 1603
     $hidden = TRUE;
1643
-  }
1644
-  else {
1604
+  } else {
1645 1605
     // If this container is empty, put it into the hidden container
1646 1606
     db_set_active('boinc');
1647 1607
     $forums_contained = db_result(db_query('
@@ -1684,13 +1644,11 @@  discard block
 block discarded – undo
1684 1644
     // Store some result for post-processing in the finished callback.
1685 1645
     if (!$category AND $create_hidden) {
1686 1646
       $message = "Created special hidden container";
1687
-    }
1688
-    else {
1647
+    } else {
1689 1648
       $context['results']['categories']['success'][] = $category->id;
1690 1649
       $message = "Successfully imported container {$category->id}";
1691 1650
     }
1692
-  }
1693
-  else {
1651
+  } else {
1694 1652
     $context['results']['categories']['failure'][] = $category->id;
1695 1653
     $message = "Failed to import container {$category->id}!";
1696 1654
     watchdog('boincimport',
@@ -1707,8 +1665,7 @@  discard block
 block discarded – undo
1707 1665
   // Update the progress for the batch engine
1708 1666
   if ($context['sandbox']['progress'] >= $context['sandbox']['max']) {
1709 1667
     $context['finished'] = 1;
1710
-  }
1711
-  else {
1668
+  } else {
1712 1669
     $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
1713 1670
   }
1714 1671
 }
@@ -1744,8 +1701,7 @@  discard block
 block discarded – undo
1744 1701
     // Save the ID of the News forum for later import
1745 1702
     variable_set('boincimport_news_forum_id', $forum_id);
1746 1703
     $success = TRUE;
1747
-  }
1748
-  else {
1704
+  } else {
1749 1705
     // Save all other forums as taxonomy terms
1750 1706
     $forum = array(
1751 1707
       'name' => $name,
@@ -1771,8 +1727,7 @@  discard block
 block discarded – undo
1771 1727
     // Store some result for post-processing in the finished callback.
1772 1728
     $context['results']['forums']['success'][] = $forum_id;
1773 1729
     $message = "Successfully imported forum {$forum_id}";
1774
-  }
1775
-  else {
1730
+  } else {
1776 1731
     $context['results']['forums']['failure'][] = $forum_id;
1777 1732
     $message = "Failed to import forum {$forum_id}!";
1778 1733
   }
@@ -1785,8 +1740,7 @@  discard block
 block discarded – undo
1785 1740
   // Update the progress for the batch engine
1786 1741
   if ($context['sandbox']['progress'] >= $context['sandbox']['max']) {
1787 1742
     $context['finished'] = 1;
1788
-  }
1789
-  else {
1743
+  } else {
1790 1744
     $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
1791 1745
   }
1792 1746
 }
@@ -1887,8 +1841,7 @@  discard block
 block discarded – undo
1887 1841
     // Set the forum import successful flag in the variable table
1888 1842
     variable_set('boincimport_import_forum_successful', '1');
1889 1843
     $_SESSION['boincimport_stage_selected'] = 'topics';
1890
-  }
1891
-  else {
1844
+  } else {
1892 1845
     // An error occurred.
1893 1846
     // $operations contains the operations that remained unprocessed.
1894 1847
     $error_operation = reset($operations);
@@ -2042,9 +1995,7 @@  discard block
 block discarded – undo
2042 1995
     
2043 1996
     if ($duplicate OR !$post) {
2044 1997
       $success = FALSE;
2045
-    }
2046
-    
2047
-    else {
1998
+    } else {
2048 1999
       // Get the user and term IDs along with other data to define the topic
2049 2000
       $uid = boincuser_lookup_uid($topic->owner);
2050 2001
       $tid = db_result(db_query('
@@ -2108,12 +2059,10 @@  discard block
 block discarded – undo
2108 2059
           if (!$success) {
2109 2060
             $error_detail = 'topic imported, but failed to set last comment timestamp';
2110 2061
           }
2111
-        }
2112
-        else {
2062
+        } else {
2113 2063
           $error_detail = 'topic node saved, but failed to link in boincimport_temp_topic table';
2114 2064
         }
2115
-      }
2116
-      else {
2065
+      } else {
2117 2066
         $error_detail = 'failed to save topic node to database';
2118 2067
       }
2119 2068
     }
@@ -2124,16 +2073,13 @@  discard block
 block discarded – undo
2124 2073
       // Store some result for post-processing in the finished callback.
2125 2074
       $context['results']['success'][] = $topic->id;
2126 2075
       $message = "Successfully imported topic {$topic->id}";
2127
-    }
2128
-    elseif ($duplicate) {
2076
+    } elseif ($duplicate) {
2129 2077
       $context['results']['duplicate'][] = $topic->id;
2130 2078
       $message = "Topic {$topic->id} was already imported";
2131
-    }
2132
-    elseif (!$post) {
2079
+    } elseif (!$post) {
2133 2080
       $context['results']['empty'][] = $topic->id;
2134 2081
       $message = "Skipping topic {$topic->id} as empty";
2135
-    }
2136
-    else {
2082
+    } else {
2137 2083
       $context['results']['failure'][] = $topic->id;
2138 2084
       $message = "Failed to import topic {$topic->id}!";
2139 2085
       watchdog('boincimport',
@@ -2154,8 +2100,7 @@  discard block
 block discarded – undo
2154 2100
     // Update the progress for the batch engine
2155 2101
     if ($context['sandbox']['progress'] >= $context['sandbox']['max']) {
2156 2102
       $context['finished'] = 1;
2157
-    }
2158
-    else {
2103
+    } else {
2159 2104
       $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
2160 2105
     }
2161 2106
   }
@@ -2189,8 +2134,7 @@  discard block
 block discarded – undo
2189 2134
     // Set the topic import successful flag in the variable table
2190 2135
     variable_set('boincimport_import_topic_successful', '1');
2191 2136
     $_SESSION['boincimport_stage_selected'] = 'posts';
2192
-  }
2193
-  else {
2137
+  } else {
2194 2138
     // An error occurred.
2195 2139
     // $operations contains the operations that remained unprocessed.
2196 2140
     $error_operation = reset($operations);
@@ -2438,18 +2382,15 @@  discard block
 block discarded – undo
2438 2382
           if ($success) {
2439 2383
             $posts_imported++;
2440 2384
             $context['results']['posts']['success'][] = $post->id;
2441
-          }
2442
-          else {
2385
+          } else {
2443 2386
             $context['results']['posts']['failure'][] = $post->id;
2444 2387
             $error_posts++;
2445 2388
           }
2446
-        }
2447
-        else {
2389
+        } else {
2448 2390
           $context['results']['posts']['failure'][] = $post->id;
2449 2391
           $error_posts++;
2450 2392
         }
2451
-      }
2452
-      else {
2393
+      } else {
2453 2394
         $context['results']['posts']['empty'][] = $post->id;
2454 2395
         $empty_posts++;
2455 2396
       }
@@ -2460,8 +2401,7 @@  discard block
 block discarded – undo
2460 2401
       // Store some result for post-processing in the finished callback.
2461 2402
       $context['results']['success'][] = $boinc_topic->id;
2462 2403
       $message = "Imported {$posts_imported} post(s) for topic {$boinc_topic->id}";
2463
-    }
2464
-    else {
2404
+    } else {
2465 2405
       $context['results']['failure'][] = $boinc_topic->id;
2466 2406
       $message = "Failed to import any posts for topic {$boinc_topic->id} (excluded {$error_posts} errors, {$duplicate_posts} duplicates, and {$empty_posts} empty)";
2467 2407
       watchdog('boincimport', 'Failed to import any posts for topic @id (excluded @error_posts errors, @duplicate_posts duplicates, and @empty_posts empty)', 
@@ -2482,8 +2422,7 @@  discard block
 block discarded – undo
2482 2422
     // Update the progress for the batch engine
2483 2423
     if ($context['sandbox']['progress'] >= $context['sandbox']['max']) {
2484 2424
       $context['finished'] = 1;
2485
-    }
2486
-    else {
2425
+    } else {
2487 2426
       $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
2488 2427
     }
2489 2428
   }
@@ -2523,8 +2462,7 @@  discard block
 block discarded – undo
2523 2462
     // Set the post import successful flag in the variable table
2524 2463
     variable_set('boincimport_import_post_successful', '1');
2525 2464
     $_SESSION['boincimport_stage_selected'] = 'team forums';
2526
-  }
2527
-  else {
2465
+  } else {
2528 2466
     // An error occurred.
2529 2467
     // $operations contains the operations that remained unprocessed.
2530 2468
     $error_operation = reset($operations);
@@ -2611,8 +2549,7 @@  discard block
 block discarded – undo
2611 2549
      if (isset($existing_team_forums[$boincteam_forum->id])) {
2612 2550
       // This team has already been imported
2613 2551
       $duplicates[] = $boincteam_forum->id;
2614
-    }
2615
-    else {
2552
+    } else {
2616 2553
       $operations[] = array(
2617 2554
         'boincimport_team_forums_op', array(
2618 2555
           $boincteam_forum
@@ -2678,8 +2615,7 @@  discard block
 block discarded – undo
2678 2615
     // Store some result for post-processing in the finished callback.
2679 2616
     $context['results']['success'][] = $forum_id;
2680 2617
     $message = "Successfully imported team forum {$forum_id}";
2681
-  }
2682
-  else {
2618
+  } else {
2683 2619
     $context['results']['failure'][] = $forum_id;
2684 2620
     $message = "Failed to import team forum {$forum_id}!";
2685 2621
     watchdog('boincimport',
@@ -2696,8 +2632,7 @@  discard block
 block discarded – undo
2696 2632
   // Update the progress for the batch engine
2697 2633
   if ($context['sandbox']['progress'] >= $context['sandbox']['max']) {
2698 2634
     $context['finished'] = 1;
2699
-  }
2700
-  else {
2635
+  } else {
2701 2636
     $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
2702 2637
   }
2703 2638
 }
@@ -2720,8 +2655,7 @@  discard block
 block discarded – undo
2720 2655
     // Set the team forum import successful flag in the variable table
2721 2656
     variable_set('boincimport_import_team_forum_successful', '1');
2722 2657
     $_SESSION['boincimport_stage_selected'] = 'team topics';
2723
-  }
2724
-  else {
2658
+  } else {
2725 2659
     // An error occurred.
2726 2660
     // $operations contains the operations that remained unprocessed.
2727 2661
     $error_operation = reset($operations);
@@ -2816,8 +2750,7 @@  discard block
 block discarded – undo
2816 2750
      if (isset($existing_team_topics[$boincteam_topic->id])) {
2817 2751
       // This team topic has already been imported
2818 2752
       $duplicates[] = $boincteam_topic->id;
2819
-    }
2820
-    else {
2753
+    } else {
2821 2754
       $operations[] = array(
2822 2755
         'boincimport_team_topics_op', array(
2823 2756
           $boincteam_topic
@@ -2864,8 +2797,7 @@  discard block
 block discarded – undo
2864 2797
   ));
2865 2798
   if (!$team_forum_id) {
2866 2799
     $missing_parent[] = $topic->id;
2867
-  }
2868
-  else {
2800
+  } else {
2869 2801
     // Get the content of the post that started the topic
2870 2802
     db_set_active('boinc');
2871 2803
     $query = db_query('
@@ -2882,8 +2814,7 @@  discard block
 block discarded – undo
2882 2814
       // Empty topics should have already been filtered out of the import, so
2883 2815
       // consider this an error condition
2884 2816
       $empty_topics[] = $topic->id;
2885
-    }
2886
-    else {
2817
+    } else {
2887 2818
       // Get the user ID along with other data to define the topic
2888 2819
       $uid = boincuser_lookup_uid($topic->owner);
2889 2820
        if (!$topic->owner) {
@@ -2947,8 +2878,7 @@  discard block
 block discarded – undo
2947 2878
     // Store some result for post-processing in the finished callback.
2948 2879
     $context['results']['success'][] = $topic->id;
2949 2880
     $message = "Successfully imported team topic {$topic->id}";
2950
-  }
2951
-  else {
2881
+  } else {
2952 2882
     $context['results']['failure'][] = $topic->id;
2953 2883
     $message = "Failed to import team topic {$topic->id}!";
2954 2884
     watchdog('boincimport',
@@ -2965,8 +2895,7 @@  discard block
 block discarded – undo
2965 2895
   // Update the progress for the batch engine
2966 2896
   if ($context['sandbox']['progress'] >= $context['sandbox']['max']) {
2967 2897
     $context['finished'] = 1;
2968
-  }
2969
-  else {
2898
+  } else {
2970 2899
     $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
2971 2900
   }
2972 2901
 }
@@ -2989,8 +2918,7 @@  discard block
 block discarded – undo
2989 2918
     // Set the BLAH import successful flag in the variable table
2990 2919
     variable_set('boincimport_import_team_topic_successful', '1');
2991 2920
     $_SESSION['boincimport_stage_selected'] = 'team posts';
2992
-  }
2993
-  else {
2921
+  } else {
2994 2922
     // An error occurred.
2995 2923
     // $operations contains the operations that remained unprocessed.
2996 2924
     $error_operation = reset($operations);
@@ -3112,8 +3040,7 @@  discard block
 block discarded – undo
3112 3040
       if (isset($existing_posts[$boincteam_post->id])) {
3113 3041
         // This post has already been imported
3114 3042
         $duplicates[] = $boincteam_post->id;
3115
-      }
3116
-      else {
3043
+      } else {
3117 3044
         $operations[] = array(
3118 3045
           'boincimport_team_posts_op', array(
3119 3046
             $boincteam_post
@@ -3229,8 +3156,7 @@  discard block
 block discarded – undo
3229 3156
     // Store some result for post-processing in the finished callback.
3230 3157
     $context['results']['success'][] = $post->id;
3231 3158
     $message = "Successfully imported team post {$post->id}";
3232
-  }
3233
-  else {
3159
+  } else {
3234 3160
     $context['results']['failure'][] = $post->id;
3235 3161
     $message = "Failed to import team post {$post->id}!";
3236 3162
     watchdog('boincimport',
@@ -3247,8 +3173,7 @@  discard block
 block discarded – undo
3247 3173
   // Update the progress for the batch engine
3248 3174
   if ($context['sandbox']['progress'] >= $context['sandbox']['max']) {
3249 3175
     $context['finished'] = 1;
3250
-  }
3251
-  else {
3176
+  } else {
3252 3177
     $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
3253 3178
   }
3254 3179
 }
@@ -3271,8 +3196,7 @@  discard block
 block discarded – undo
3271 3196
     // Set the team post import successful flag in the variable table
3272 3197
     variable_set('boincimport_import_team_post_successful', '1');
3273 3198
     $_SESSION['boincimport_stage_selected'] = 'url';
3274
-  }
3275
-  else {
3199
+  } else {
3276 3200
     // An error occurred.
3277 3201
     // $operations contains the operations that remained unprocessed.
3278 3202
     $error_operation = reset($operations);
@@ -3378,8 +3302,7 @@  discard block
 block discarded – undo
3378 3302
     $context['results']['success'][] = $boincuser_id;
3379 3303
     $context['results']['subscriptions'][$boincuser_id] = $count;
3380 3304
     $message = "Successfully imported {$count} subscriptions for user {$boincuser_id}";
3381
-  }
3382
-  else {
3305
+  } else {
3383 3306
     $context['results']['failure'][] = $boincuser_id;
3384 3307
     $message = "Failed to import subscriptions for user {$boincuser_id}!";
3385 3308
     watchdog('boincimport',
@@ -3396,8 +3319,7 @@  discard block
 block discarded – undo
3396 3319
   // Update the progress for the batch engine
3397 3320
   if ($context['sandbox']['progress'] >= $context['sandbox']['max']) {
3398 3321
     $context['finished'] = 1;
3399
-  }
3400
-  else {
3322
+  } else {
3401 3323
     $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
3402 3324
   }
3403 3325
 }
@@ -3422,8 +3344,7 @@  discard block
 block discarded – undo
3422 3344
     // Set the subscription import successful flag in the variable table
3423 3345
     variable_set('boincimport_import_subscription_successful', '1');
3424 3346
     $_SESSION['boincimport_stage_selected'] = 'url';
3425
-  }
3426
-  else {
3347
+  } else {
3427 3348
     // An error occurred.
3428 3349
     // $operations contains the operations that remained unprocessed.
3429 3350
     $error_operation = reset($operations);
@@ -3601,8 +3522,7 @@  discard block
 block discarded – undo
3601 3522
       // Store some result for post-processing in the finished callback.
3602 3523
       $context['results']['nodes']['updated'][] = $node->nid;
3603 3524
       $message = "Successfully updated node {$node->nid}";
3604
-    }
3605
-    else {
3525
+    } else {
3606 3526
       $message = "No changes made to node {$node->nid}!";
3607 3527
     }
3608 3528
     
@@ -3614,8 +3534,7 @@  discard block
 block discarded – undo
3614 3534
     // Update the progress for the batch engine
3615 3535
     if ($context['sandbox']['progress'] >= $context['sandbox']['max']) {
3616 3536
       $context['finished'] = 1;
3617
-    }
3618
-    else {
3537
+    } else {
3619 3538
       $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
3620 3539
     }
3621 3540
   }
@@ -3665,8 +3584,7 @@  discard block
 block discarded – undo
3665 3584
       // Store some result for post-processing in the finished callback.
3666 3585
       $context['results']['comments']['updated'][] = $comment->cid;
3667 3586
       $message = "Successfully updated comment {$comment->cid}";
3668
-    }
3669
-    else {
3587
+    } else {
3670 3588
       $message = "No changes made to comment {$comment->cid}!";
3671 3589
     }
3672 3590
     
@@ -3678,8 +3596,7 @@  discard block
 block discarded – undo
3678 3596
     // Update the progress for the batch engine
3679 3597
     if ($context['sandbox']['progress'] >= $context['sandbox']['max']) {
3680 3598
       $context['finished'] = 1;
3681
-    }
3682
-    else {
3599
+    } else {
3683 3600
       $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
3684 3601
     }
3685 3602
   }
@@ -3728,8 +3645,7 @@  discard block
 block discarded – undo
3728 3645
       // Store some result for post-processing in the finished callback.
3729 3646
       $context['results']['pm']['updated'][] = $pm->mid;
3730 3647
       $message = "Successfully updated private message {$pm->mid}";
3731
-    }
3732
-    else {
3648
+    } else {
3733 3649
       $message = "No changes made to private message {$pm->mid}!";
3734 3650
     }
3735 3651
     
@@ -3741,8 +3657,7 @@  discard block
 block discarded – undo
3741 3657
     // Update the progress for the batch engine
3742 3658
     if ($context['sandbox']['progress'] >= $context['sandbox']['max']) {
3743 3659
       $context['finished'] = 1;
3744
-    }
3745
-    else {
3660
+    } else {
3746 3661
       $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
3747 3662
     }
3748 3663
   }
@@ -3807,8 +3722,7 @@  discard block
 block discarded – undo
3807 3722
     // Set the replace URLs successful flag in the variable table
3808 3723
     variable_set('boincimport_replace_urls_successful', '1');
3809 3724
     $_SESSION['boincimport_stage_selected'] = 'users';
3810
-  }
3811
-  else {
3725
+  } else {
3812 3726
     // An error occurred.
3813 3727
     // $operations contains the operations that remained unprocessed.
3814 3728
     $error_operation = reset($operations);
@@ -3910,7 +3824,8 @@  discard block
 block discarded – undo
3910 3824
   $score = 0; // 0 default value, comments get higher score depending on the author's roles
3911 3825
   $users = serialize(array(0 => 1));  // default value for everybody!!
3912 3826
   
3913
-  if ($edit['uid'] === $user->uid) { // '===' because we want to modify anonymous users too
3827
+  if ($edit['uid'] === $user->uid) {
3828
+// '===' because we want to modify anonymous users too
3914 3829
     $edit['name'] = $user->name;
3915 3830
   }
3916 3831
 
@@ -4028,13 +3943,11 @@  discard block
 block discarded – undo
4028 3943
       if (isset($this->boincDomains[$domain])) {
4029 3944
         // This is a URL configured to be transformed
4030 3945
         return "{$http}://{$this->drupalDomain}{$this->basePath}";
4031
-      }
4032
-      else {
3946
+      } else {
4033 3947
         // This URL should not be transformed
4034 3948
         return NULL;
4035 3949
       }
4036
-    }
4037
-    else {
3950
+    } else {
4038 3951
       // This is a relative URL
4039 3952
       return $this->basePath;
4040 3953
     }
@@ -4056,8 +3969,7 @@  discard block
 block discarded – undo
4056 3969
       ));
4057 3970
       if ($id) {
4058 3971
         $link = "{$newBaseUrl}goto/comment/{$id}";
4059
-      }
4060
-      else {
3972
+      } else {
4061 3973
         // This post is not in the post import table, so it's probably a topic
4062 3974
         $link = $this->transformTopicLinks($matches);
4063 3975
       }
@@ -4081,8 +3993,7 @@  discard block
 block discarded – undo
4081 3993
       ));
4082 3994
       if ($id) {
4083 3995
         $link = "{$newBaseUrl}goto/comment/{$id}";
4084
-      }
4085
-      else {
3996
+      } else {
4086 3997
         // This post is not in the post import table, so it's probably a topic
4087 3998
         $link = $this->transformTopicLinks($matches);
4088 3999
       }
Please login to merge, or discard this patch.
default/boinc/modules/boincstats/includes/pchart/class/pStock.class.php 1 patch
Braces   +11 added lines, -25 removed lines patch added patch discarded remove patch
@@ -16,21 +16,18 @@  discard block
 block discarded – undo
16 16
  define("STOCK_MISSING_SERIE"	, 180001);
17 17
 
18 18
  /* pStock class definition */
19
- class pStock
20
-  {
19
+ class pStock {
21 20
    var $pChartObject;
22 21
    var $pDataObject;
23 22
 
24 23
    /* Class creator */
25
-   function pStock($pChartObject,$pDataObject)
26
-    {
24
+   function pStock($pChartObject,$pDataObject) {
27 25
      $this->pChartObject = $pChartObject;
28 26
      $this->pDataObject  = $pDataObject;
29 27
     }
30 28
 
31 29
    /* Draw a stock chart */
32
-   function drawStockChart($Format="")
33
-    {
30
+   function drawStockChart($Format="") {
34 31
      $SerieOpen		= isset($Format["SerieOpen"]) ? $Format["SerieOpen"] : "Open";
35 32
      $SerieClose	= isset($Format["SerieClose"]) ? $Format["SerieClose"] : "Close";
36 33
      $SerieMin		= isset($Format["SerieMin"]) ? $Format["SerieMin"] : "Min";
@@ -92,8 +89,7 @@  discard block
 block discarded – undo
92 89
       return(STOCK_MISSING_SERIE);
93 90
 
94 91
      $Plots = "";
95
-     foreach($Data["Series"][$SerieOpen]["Data"] as $Key => $Value)
96
-      {
92
+     foreach($Data["Series"][$SerieOpen]["Data"] as $Key => $Value) {
97 93
        $Point = "";
98 94
        if ( isset($Data["Series"][$SerieClose]["Data"][$Key]) || isset($Data["Series"][$SerieMin]["Data"][$Key]) || isset($Data["Series"][$SerieMax]["Data"][$Key]) )
99 95
         $Point = array($Value,$Data["Series"][$SerieClose]["Data"][$Key],$Data["Series"][$SerieMin]["Data"][$Key],$Data["Series"][$SerieMax]["Data"][$Key]);
@@ -120,16 +116,14 @@  discard block
 block discarded – undo
120 116
      $BoxDownSettings	= array("R"=>$BoxDownR,"G"=>$BoxDownG,"B"=>$BoxDownB,"Alpha"=>$BoxDownAlpha,"BorderR"=>$BoxDownBorderR,"BorderG"=>$BoxDownBorderG,"BorderB"=>$BoxDownBorderB,"BorderAlpha"=>$BoxDownBorderAlpha);
121 117
      $MedianSettings	= array("R"=>$MedianR,"G"=>$MedianG,"B"=>$MedianB,"Alpha"=>$MedianAlpha);
122 118
 
123
-     foreach($Plots as $Key =>$Points)
124
-      {
119
+     foreach($Plots as $Key =>$Points) {
125 120
        $PosArray = $this->pChartObject->scaleComputeY($Points,array("AxisID"=>$AxisID));
126 121
 
127 122
        $Values = "Open :".$Data["Series"][$SerieOpen]["Data"][$Key]."<BR>Close : ".$Data["Series"][$SerieClose]["Data"][$Key]."<BR>Min : ".$Data["Series"][$SerieMin]["Data"][$Key]."<BR>Max : ".$Data["Series"][$SerieMax]["Data"][$Key]."<BR>";
128 123
        if ( $SerieMedian != NULL ) { $Values = $Values."Median : ".$Data["Series"][$SerieMedian]["Data"][$Key]."<BR>"; }
129 124
        if ( $PosArray[0] > $PosArray[1] ) { $ImageMapColor = $this->pChartObject->toHTMLColor($BoxUpR,$BoxUpG,$BoxUpB); } else { $ImageMapColor = $this->pChartObject->toHTMLColor($BoxDownR,$BoxDownG,$BoxDownB); } 
130 125
 
131
-       if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT )
132
-        {
126
+       if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) {
133 127
          if ( $YZero > $this->pChartObject->GraphAreaY2-1 ) { $YZero = $this->pChartObject->GraphAreaY2-1; }
134 128
          if ( $YZero < $this->pChartObject->GraphAreaY1+1 ) { $YZero = $this->pChartObject->GraphAreaY1+1; }
135 129
 
@@ -142,15 +136,12 @@  discard block
 block discarded – undo
142 136
          else
143 137
           $this->pChartObject->drawFilledRectangle($X-$LineOffset,$PosArray[2],$X+$LineOffset,$PosArray[3],$LineSettings);
144 138
 
145
-         if ( $ExtremityWidth == 1 )
146
-          {
139
+         if ( $ExtremityWidth == 1 ) {
147 140
            $this->pChartObject->drawLine($X-$ExtremityLength,$PosArray[2],$X+$ExtremityLength,$PosArray[2],$ExtremitySettings);
148 141
            $this->pChartObject->drawLine($X-$ExtremityLength,$PosArray[3],$X+$ExtremityLength,$PosArray[3],$ExtremitySettings);
149 142
 
150 143
            if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("RECT",floor($X-$ExtremityLength).",".floor($PosArray[2]).",".floor($X+$ExtremityLength).",".floor($PosArray[3]),$ImageMapColor,$ImageMapTitle,$Values); }
151
-          }
152
-         else
153
-          {
144
+          } else {
154 145
            $this->pChartObject->drawFilledRectangle($X-$ExtremityLength,$PosArray[2],$X+$ExtremityLength,$PosArray[2]-$ExtremityWidth,$ExtremitySettings);
155 146
            $this->pChartObject->drawFilledRectangle($X-$ExtremityLength,$PosArray[3],$X+$ExtremityLength,$PosArray[3]+$ExtremityWidth,$ExtremitySettings);
156 147
 
@@ -168,9 +159,7 @@  discard block
 block discarded – undo
168 159
           $this->pChartObject->drawLine($X-$ExtremityLength,$PosArray[4],$X+$ExtremityLength,$PosArray[4],$MedianSettings);
169 160
 
170 161
          $X = $X + $XStep;
171
-        }
172
-       elseif ( $Data["Orientation"] == SCALE_POS_TOPBOTTOM )
173
-        {
162
+        } elseif ( $Data["Orientation"] == SCALE_POS_TOPBOTTOM ) {
174 163
          if ( $YZero > $this->pChartObject->GraphAreaX2-1 ) { $YZero = $this->pChartObject->GraphAreaX2-1; }
175 164
          if ( $YZero < $this->pChartObject->GraphAreaX1+1 ) { $YZero = $this->pChartObject->GraphAreaX1+1; }
176 165
 
@@ -183,15 +172,12 @@  discard block
 block discarded – undo
183 172
 
184 173
          if ( $ShadowOnBoxesOnly ) { $RestoreShadow = $this->pChartObject->Shadow; $this->pChartObject->Shadow = FALSE; }
185 174
 
186
-         if ( $ExtremityWidth == 1 )
187
-          {
175
+         if ( $ExtremityWidth == 1 ) {
188 176
            $this->pChartObject->drawLine($PosArray[2],$Y-$ExtremityLength,$PosArray[2],$Y+$ExtremityLength,$ExtremitySettings);
189 177
            $this->pChartObject->drawLine($PosArray[3],$Y-$ExtremityLength,$PosArray[3],$Y+$ExtremityLength,$ExtremitySettings);
190 178
 
191 179
            if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("RECT",floor($PosArray[2]).",".floor($Y-$ExtremityLength).",".floor($PosArray[3]).",".floor($Y+$ExtremityLength),$ImageMapColor,$ImageMapTitle,$Values); }
192
-          }
193
-         else
194
-          {
180
+          } else {
195 181
            $this->pChartObject->drawFilledRectangle($PosArray[2],$Y-$ExtremityLength,$PosArray[2]-$ExtremityWidth,$Y+$ExtremityLength,$ExtremitySettings);
196 182
            $this->pChartObject->drawFilledRectangle($PosArray[3],$Y-$ExtremityLength,$PosArray[3]+$ExtremityWidth,$Y+$ExtremityLength,$ExtremitySettings);
197 183
 
Please login to merge, or discard this patch.
default/boinc/modules/boincstats/includes/pchart/class/pBarcode39.class.php 1 patch
Braces   +19 added lines, -35 removed lines patch added patch discarded remove patch
@@ -14,8 +14,7 @@  discard block
 block discarded – undo
14 14
  */
15 15
 
16 16
  /* pData class definition */
17
- class pBarcode39
18
-  {
17
+ class pBarcode39 {
19 18
    var $Codes;
20 19
    var $Reverse;
21 20
    var $Result;
@@ -24,8 +23,7 @@  discard block
 block discarded – undo
24 23
    var $MOD43;
25 24
 
26 25
    /* Class creator */
27
-   function pBarcode39($BasePath="",$EnableMOD43=FALSE)
28
-    {
26
+   function pBarcode39($BasePath="",$EnableMOD43=FALSE) {
29 27
      $this->MOD43  = $EnableMOD43;
30 28
      $this->Codes   = "";
31 29
      $this->Reverse = "";
@@ -34,8 +32,7 @@  discard block
 block discarded – undo
34 32
 
35 33
      if (!$FileHandle) { die("Cannot find barcode database (".$BasePath."data/39.db)."); }
36 34
 
37
-     while (!feof($FileHandle))
38
-      {
35
+     while (!feof($FileHandle)) {
39 36
        $Buffer = fgets($FileHandle,4096);
40 37
        $Buffer = str_replace(chr(10),"",$Buffer);
41 38
        $Buffer = str_replace(chr(13),"",$Buffer);
@@ -47,8 +44,7 @@  discard block
 block discarded – undo
47 44
     }
48 45
 
49 46
    /* Return the projected size of a barcode */
50
-   function getSize($TextString,$Format="")
51
-    {
47
+   function getSize($TextString,$Format="") {
52 48
      $Angle		= isset($Format["Angle"]) ? $Format["Angle"] : 0;
53 49
      $ShowLegend	= isset($Format["ShowLegend"]) ? $Format["ShowLegend"] : FALSE;
54 50
      $LegendOffset	= isset($Format["LegendOffset"]) ? $Format["LegendOffset"] : 5;
@@ -76,24 +72,20 @@  discard block
 block discarded – undo
76 72
     }
77 73
 
78 74
    /* Create the encoded string */
79
-   function encode39($Value)
80
-    {
75
+   function encode39($Value) {
81 76
      $this->Result = "100101101101"."0";
82 77
      $TextString   = "";
83
-     for($i=1;$i<=strlen($Value);$i++)
84
-      {
78
+     for($i=1;$i<=strlen($Value);$i++) {
85 79
        $CharCode = ord($this->mid($Value,$i,1));
86 80
        if ( $CharCode >= 97 && $CharCode <= 122 ) { $CharCode = $CharCode - 32; }
87 81
 
88
-       if ( isset($this->Codes[chr($CharCode)]) )
89
-        {
82
+       if ( isset($this->Codes[chr($CharCode)]) ) {
90 83
          $this->Result = $this->Result.$this->Codes[chr($CharCode)]."0";
91 84
          $TextString = $TextString.chr($CharCode);
92 85
         }
93 86
       }
94 87
 
95
-     if ( $this->MOD43 )
96
-      {
88
+     if ( $this->MOD43 ) {
97 89
        $Checksum = $this->checksum($TextString);
98 90
        $this->Result = $this->Result.$this->Codes[$Checksum]."0";
99 91
       }
@@ -105,8 +97,7 @@  discard block
 block discarded – undo
105 97
     }
106 98
 
107 99
    /* Create the encoded string */
108
-   function draw($Object,$Value,$X,$Y,$Format="")
109
-    {
100
+   function draw($Object,$Value,$X,$Y,$Format="") {
110 101
      $this->pChartObject = $Object;
111 102
 
112 103
      $R			= isset($Format["R"]) ? $Format["R"] : 0;
@@ -127,21 +118,17 @@  discard block
 block discarded – undo
127 118
 
128 119
      $TextString   = $this->encode39($Value);
129 120
 
130
-     if ( $DrawArea )
131
-      {
121
+     if ( $DrawArea ) {
132 122
        $X1 = $X + cos(($Angle-135) * PI / 180) * 10;
133 123
        $Y1 = $Y + sin(($Angle-135) * PI / 180) * 10;
134 124
 
135 125
        $X2 = $X1 + cos($Angle * PI / 180) * (strlen($this->Result)+20);
136 126
        $Y2 = $Y1 + sin($Angle * PI / 180) * (strlen($this->Result)+20);
137 127
 
138
-       if ( $ShowLegend )
139
-        {
128
+       if ( $ShowLegend ) {
140 129
          $X3 = $X2 + cos(($Angle+90) * PI / 180) * ($Height+$LegendOffset+$this->pChartObject->FontSize+10);
141 130
          $Y3 = $Y2 + sin(($Angle+90) * PI / 180) * ($Height+$LegendOffset+$this->pChartObject->FontSize+10);
142
-        }
143
-       else
144
-        {
131
+        } else {
145 132
          $X3 = $X2 + cos(($Angle+90) * PI / 180) * ($Height+20);
146 133
          $Y3 = $Y2 + sin(($Angle+90) * PI / 180) * ($Height+20);
147 134
         }
@@ -154,10 +141,8 @@  discard block
 block discarded – undo
154 141
        $this->pChartObject->drawPolygon($Polygon,$Settings);
155 142
       }
156 143
 
157
-     for($i=1;$i<=strlen($this->Result);$i++)
158
-      {
159
-       if ( $this->mid($this->Result,$i,1) == 1 )
160
-        {
144
+     for($i=1;$i<=strlen($this->Result);$i++) {
145
+       if ( $this->mid($this->Result,$i,1) == 1 ) {
161 146
          $X1 = $X + cos($Angle * PI / 180) * $i;
162 147
          $Y1 = $Y + sin($Angle * PI / 180) * $i;
163 148
          $X2 = $X1 + cos(($Angle+90) * PI / 180) * $Height;
@@ -168,8 +153,7 @@  discard block
 block discarded – undo
168 153
         }
169 154
       }
170 155
 
171
-     if ( $ShowLegend )
172
-      {
156
+     if ( $ShowLegend ) {
173 157
        $X1 = $X + cos($Angle * PI / 180) * (strlen($this->Result)/2);
174 158
        $Y1 = $Y + sin($Angle * PI / 180) * (strlen($this->Result)/2);
175 159
 
@@ -181,14 +165,14 @@  discard block
 block discarded – undo
181 165
       }
182 166
     }
183 167
 
184
-   function checksum( $string )
185
-    {
168
+   function checksum( $string ) {
186 169
      $checksum = 0;
187 170
      $length   = strlen( $string );
188 171
      $charset  = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%';
189 172
 
190
-     for( $i=0; $i < $length; ++$i )
191
-      $checksum += strpos( $charset, $string[$i] );
173
+     for( $i=0; $i < $length; ++$i ) {
174
+           $checksum += strpos( $charset, $string[$i] );
175
+     }
192 176
  
193 177
      return substr( $charset, ($checksum % 43), 1 );
194 178
     }
Please login to merge, or discard this patch.