Passed
Pull Request — master (#5952)
by
unknown
10:11
created
html/ops/create_forums.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -41,10 +41,10 @@  discard block
 block discarded – undo
41 41
     return $db->insert_id();
42 42
 }
43 43
 
44
-function create_forum($category, $orderID, $title, $description, $is_dev_blog=0) {
44
+function create_forum($category, $orderID, $title, $description, $is_dev_blog = 0) {
45 45
     $q = "(category, orderID, title, description, is_dev_blog) values ($category, $orderID, '$title', '$description', $is_dev_blog)";
46 46
     $db = BoincDb::get();
47
-    $result = $db->insert("forum",$q);
47
+    $result = $db->insert("forum", $q);
48 48
     if (!$result) {
49 49
         $forum = BoincForum::lookup("category=$category and title='$title'");
50 50
         if ($forum) return $forum->id;
@@ -72,5 +72,5 @@  discard block
 block discarded – undo
72 72
 create_forum($catid, 4, "Preferences", "Using preferences");
73 73
 create_forum($catid, 6, "Web site", "Issues involving this web site");
74 74
 
75
-$cvs_version_tracker[]="\$Id$";  //Generated automatically - do not edit
75
+$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit
76 76
 ?>
Please login to merge, or discard this patch.
html/user/get_project_config.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -31,10 +31,10 @@  discard block
 block discarded – undo
31 31
 //
32 32
 function show_platforms() {
33 33
     $xmlFragment = unserialize(get_cached_data(3600, "project_config_platform_xml"));
34
-    if ($xmlFragment==false){
34
+    if ($xmlFragment == false) {
35 35
         $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", "");
36 36
         $xmlFragment = "    <platforms>";
37
-        foreach ($platforms as $platform){
37
+        foreach ($platforms as $platform) {
38 38
             $xmlFragment .= "
39 39
             <platform>
40 40
                 <platform_name>$platform->name</platform_name>
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 if (defined('TERMSOFUSE_FILE')) {
117 117
   $tou_file = TERMSOFUSE_FILE;
118 118
 } else {
119
-  $tou_file =  "../../terms_of_use.txt";
119
+  $tou_file = "../../terms_of_use.txt";
120 120
 }
121 121
 if (file_exists($tou_file)) {
122 122
     $terms_of_use = trim(file_get_contents($tou_file));
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,10 +31,10 @@
 block discarded – undo
31 31
 //
32 32
 function show_platforms() {
33 33
     $xmlFragment = unserialize(get_cached_data(3600, "project_config_platform_xml"));
34
-    if ($xmlFragment==false){
34
+    if ($xmlFragment==false) {
35 35
         $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", "");
36 36
         $xmlFragment = "    <platforms>";
37
-        foreach ($platforms as $platform){
37
+        foreach ($platforms as $platform) {
38 38
             $xmlFragment .= "
39 39
             <platform>
40 40
                 <platform_name>$platform->name</platform_name>
Please login to merge, or discard this patch.
html/inc/boinc_db.inc 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -387,10 +387,10 @@
 block discarded – undo
387 387
         $db = BoincDb::get();
388 388
         return $db->enum('result', 'BoincResult', $where_clause, $order_clause);
389 389
     }
390
-	static function enum_fields($fields, $where_clause, $order_clause) {
390
+    static function enum_fields($fields, $where_clause, $order_clause) {
391 391
         $db = BoincDb::get();
392
-		return $db->enum_fields('result', 'BoincResult', $fields, $where_clause, $order_clause);
393
-	}
392
+        return $db->enum_fields('result', 'BoincResult', $fields, $where_clause, $order_clause);
393
+    }
394 394
     function update($clause) {
395 395
         $db = BoincDb::get();
396 396
         return $db->update($this, 'result', $clause);
Please login to merge, or discard this patch.
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
44 44
 // close() closes the connection.
45 45
 
46 46
 class BoincDb {
47
-    static $instance;       // a DbConn object, or null
48
-    static $dbnum;          // which replica we're connected to
47
+    static $instance; // a DbConn object, or null
48
+    static $dbnum; // which replica we're connected to
49 49
 
50 50
     // connect to DB $dbnum (0, 1, ...)
51 51
     // If the requested DB doesn't exist or connection fails, connect to DB 0.
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
         self::$instance = null;
57 57
         $config = get_config();
58 58
         if ($dbnum) {
59
-            $r = $dbnum==1?'':strval($dbnum);
59
+            $r = $dbnum == 1 ? '' : strval($dbnum);
60 60
             $host = parse_config($config, sprintf('<replica%s_db_host>', $r));
61 61
             $name = parse_config($config, sprintf('<replica%s_db_name>', $r));
62 62
             $user = parse_config($config, sprintf('<replica%s_db_user>', $r));
@@ -209,11 +209,11 @@  discard block
 block discarded – undo
209 209
      * @param string|null $order_clause
210 210
      * @return list<BoincUser>
211 211
      */
212
-    static function enum($where_clause, $order_clause=null) {
212
+    static function enum($where_clause, $order_clause = null) {
213 213
         $db = BoincDb::get();
214 214
         return $db->enum('user', 'BoincUser', $where_clause, $order_clause);
215 215
     }
216
-    static function enum_fields($fields, $where_clause, $order_clause=null) {
216
+    static function enum_fields($fields, $where_clause, $order_clause = null) {
217 217
         $db = BoincDb::get();
218 218
         return $db->enum_fields(
219 219
             'user', 'BoincUser', $fields, $where_clause, $order_clause
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
      * @param string|null $order_clause
269 269
      * @return list<BoincTeam>
270 270
      */
271
-    static function enum($where_clause, $order_clause=null) {
271
+    static function enum($where_clause, $order_clause = null) {
272 272
         $db = BoincDb::get();
273 273
         return $db->enum('team', 'BoincTeam', $where_clause, $order_clause);
274 274
     }
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
         $db = BoincDb::get();
294 294
         return $db->max('team', $field);
295 295
     }
296
-    static function enum_fields($fields, $where_clause, $order_clause=null) {
296
+    static function enum_fields($fields, $where_clause, $order_clause = null) {
297 297
         $db = BoincDb::get();
298 298
         return $db->enum_fields(
299 299
             'team', 'BoincTeam', $fields, $where_clause, $order_clause
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
      * @param string|null $order_clause
313 313
      * @return list<BoincTeamDelta>
314 314
      */
315
-    static function enum($where_clause, $order_clause=null) {
315
+    static function enum($where_clause, $order_clause = null) {
316 316
         $db = BoincDb::get();
317 317
         return $db->enum('team_delta', 'BoincTeamDelta', $where_clause, $order_clause);
318 318
     }
@@ -341,11 +341,11 @@  discard block
 block discarded – undo
341 341
      * @param string|null $order_clause
342 342
      * @return list<BoincHost>
343 343
      */
344
-    static function enum($where_clause, $order_clause=null) {
344
+    static function enum($where_clause, $order_clause = null) {
345 345
         $db = BoincDb::get();
346 346
         return $db->enum('host', 'BoincHost', $where_clause, $order_clause);
347 347
     }
348
-    static function enum_fields($fields, $where_clause, $order_clause=null) {
348
+    static function enum_fields($fields, $where_clause, $order_clause = null) {
349 349
         $db = BoincDb::get();
350 350
         return $db->enum_fields(
351 351
             'host', 'BoincHost', $fields, $where_clause, $order_clause
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
      * @param string|null $order_clause
384 384
      * @return list<BoincResult>
385 385
      */
386
-    static function enum($where_clause, $order_clause=null) {
386
+    static function enum($where_clause, $order_clause = null) {
387 387
         $db = BoincDb::get();
388 388
         return $db->enum('result', 'BoincResult', $where_clause, $order_clause);
389 389
     }
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
      * @param string|null $order_clause
436 436
      * @return list<BoincWorkunit>
437 437
      */
438
-    static function enum($where_clause, $order_clause=null) {
438
+    static function enum($where_clause, $order_clause = null) {
439 439
         $db = BoincDb::get();
440 440
         return $db->enum('workunit', 'BoincWorkunit', $where_clause, $order_clause);
441 441
     }
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
      * @param string|null $order_clause
469 469
      * @return list<BoincApp>
470 470
      */
471
-    static function enum($where_clause, $order_clause=null) {
471
+    static function enum($where_clause, $order_clause = null) {
472 472
         $db = BoincDb::get();
473 473
         return $db->enum('app', 'BoincApp', $where_clause, $order_clause);
474 474
     }
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
         $db = BoincDb::get();
483 483
         return $db->update($this, 'app', $clause);
484 484
     }
485
-    static function sum($field, $clause=null) {
485
+    static function sum($field, $clause = null) {
486 486
         $db = BoincDb::get();
487 487
         return $db->sum('app', $field, $clause);
488 488
     }
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
      * @param string|null $order_clause
496 496
      * @return list<BoincAppVersion>
497 497
      */
498
-    static function enum($where_clause, $order_clause=null) {
498
+    static function enum($where_clause, $order_clause = null) {
499 499
         $db = BoincDb::get();
500 500
         return $db->enum('app_version', 'BoincAppVersion', $where_clause, $order_clause);
501 501
     }
@@ -550,11 +550,11 @@  discard block
 block discarded – undo
550 550
      * @param string|null $order_clause
551 551
      * @return list<BoincProfile>
552 552
      */
553
-    static function enum($where_clause=null, $order_clause=null) {
553
+    static function enum($where_clause = null, $order_clause = null) {
554 554
         $db = BoincDb::get();
555 555
         return $db->enum('profile', 'BoincProfile', $where_clause, $order_clause);
556 556
     }
557
-    static function enum_fields($fields, $where_clause=null, $order_clause=null) {
557
+    static function enum_fields($fields, $where_clause = null, $order_clause = null) {
558 558
         $db = BoincDb::get();
559 559
         return $db->enum_fields('profile', 'BoincProfile', $fields, $where_clause, $order_clause);
560 560
     }
@@ -579,7 +579,7 @@  discard block
 block discarded – undo
579 579
      * @param string|null $order_clause
580 580
      * @return list<BoincTeamAdmin>
581 581
      */
582
-    static function enum($where_clause, $order_clause=null) {
582
+    static function enum($where_clause, $order_clause = null) {
583 583
         $db = BoincDb::get();
584 584
         return $db->enum('team_admin', 'BoincTeamAdmin', $where_clause, $order_clause);
585 585
     }
@@ -608,7 +608,7 @@  discard block
 block discarded – undo
608 608
      * @param string|null $order_clause
609 609
      * @return list<BoincPrivateMessage>
610 610
      */
611
-    static function enum($where_clause, $order_clause=null) {
611
+    static function enum($where_clause, $order_clause = null) {
612 612
         $db = BoincDb::get();
613 613
         return $db->enum('private_messages', 'BoincPrivateMessage', $where_clause, $order_clause);
614 614
     }
@@ -639,7 +639,7 @@  discard block
 block discarded – undo
639 639
      * @param string|null $order_clause
640 640
      * @return list<BoincPlatform>
641 641
      */
642
-    static function enum($where_clause, $order_clause=null) {
642
+    static function enum($where_clause, $order_clause = null) {
643 643
         $db = BoincDb::get();
644 644
         return $db->enum('platform', 'BoincPlatform', $where_clause, $order_clause);
645 645
     }
@@ -668,7 +668,7 @@  discard block
 block discarded – undo
668 668
      * @param string|null $order_clause
669 669
      * @return list<BoincHostAppVersion>
670 670
      */
671
-    static function enum($where_clause, $order_clause=null) {
671
+    static function enum($where_clause, $order_clause = null) {
672 672
         $db = BoincDb::get();
673 673
         return $db->enum('host_app_version', 'BoincHostAppVersion', $where_clause, $order_clause);
674 674
     }
@@ -733,7 +733,7 @@  discard block
 block discarded – undo
733 733
      * @param string|null $order_clause
734 734
      * @return list<BoincBadge>
735 735
      */
736
-    static function enum($where_clause, $order_clause=null) {
736
+    static function enum($where_clause, $order_clause = null) {
737 737
         $db = BoincDb::get();
738 738
         return $db->enum('badge', 'BoincBadge', $where_clause, $order_clause);
739 739
     }
@@ -768,7 +768,7 @@  discard block
 block discarded – undo
768 768
      * @param string|null $order_clause
769 769
      * @return list<BoincBadgeUser>
770 770
      */
771
-    static function enum($where_clause, $order_clause=null) {
771
+    static function enum($where_clause, $order_clause = null) {
772 772
         $db = BoincDb::get();
773 773
         return $db->enum('badge_user', 'BoincBadgeUser', $where_clause, $order_clause);
774 774
     }
@@ -803,7 +803,7 @@  discard block
 block discarded – undo
803 803
      * @param string|null $order_clause
804 804
      * @return list<BoincBadgeTeam>
805 805
      */
806
-    static function enum($where_clause, $order_clause=null) {
806
+    static function enum($where_clause, $order_clause = null) {
807 807
         $db = BoincDb::get();
808 808
         return $db->enum('badge_team', 'BoincBadgeTeam', $where_clause, $order_clause);
809 809
     }
@@ -842,7 +842,7 @@  discard block
 block discarded – undo
842 842
      * @param string|null $order_clause
843 843
      * @return list<BoincCreditUser>
844 844
      */
845
-    static function enum($where_clause, $order_clause=null) {
845
+    static function enum($where_clause, $order_clause = null) {
846 846
         $db = BoincDb::get();
847 847
         return $db->enum('credit_user', 'BoincCreditUser', $where_clause, $order_clause);
848 848
     }
@@ -875,7 +875,7 @@  discard block
 block discarded – undo
875 875
      * @param string|null $order_clause
876 876
      * @return list<BoincCreditTeam>
877 877
      */
878
-    static function enum($where_clause, $order_clause=null) {
878
+    static function enum($where_clause, $order_clause = null) {
879 879
         $db = BoincDb::get();
880 880
         return $db->enum('credit_team', 'BoincCreditTeam', $where_clause, $order_clause);
881 881
     }
@@ -914,7 +914,7 @@  discard block
 block discarded – undo
914 914
      * @param string|null $order_clause
915 915
      * @return list<BoincToken>
916 916
      */
917
-    static function enum($where_clause, $order_clause=null) {
917
+    static function enum($where_clause, $order_clause = null) {
918 918
         $db = BoincDb::get();
919 919
         return $db->enum('token', 'BoincToken', $where_clause, $order_clause);
920 920
     }
@@ -999,17 +999,17 @@  discard block
 block discarded – undo
999 999
      * @param string|null $order_clause
1000 1000
      * @return list<BoincConsent>
1001 1001
      */
1002
-    static function enum($where_clause, $order_clause=null) {
1002
+    static function enum($where_clause, $order_clause = null) {
1003 1003
         $db = BoincDb::get();
1004 1004
         return $db->enum('consent', 'BoincConsent', $where_clause, $order_clause);
1005 1005
     }
1006 1006
 
1007
-    static function insert ($clause) {
1007
+    static function insert($clause) {
1008 1008
         $db = BoincDb::get();
1009 1009
         return $db->insert('consent', $clause);
1010 1010
     }
1011 1011
 
1012
-    static function update ($clause) {
1012
+    static function update($clause) {
1013 1013
         $db = BoincDb::get();
1014 1014
         return $db->update_aux('consent', $clause);
1015 1015
     }
@@ -1039,17 +1039,17 @@  discard block
 block discarded – undo
1039 1039
      * @param string|null $order_clause
1040 1040
      * @return list<BoincConsentType>
1041 1041
      */
1042
-    static function enum($where_clause, $order_clause=null) {
1042
+    static function enum($where_clause, $order_clause = null) {
1043 1043
         $db = BoincDb::get();
1044 1044
         return $db->enum('consent_type', 'BoincConsentType', $where_clause, $order_clause);
1045 1045
     }
1046 1046
 
1047
-    static function insert ($clause) {
1047
+    static function insert($clause) {
1048 1048
         $db = BoincDb::get();
1049 1049
         return $db->insert('consent_type', $clause);
1050 1050
     }
1051 1051
 
1052
-    static function update ($clause) {
1052
+    static function update($clause) {
1053 1053
         $db = BoincDb::get();
1054 1054
         return $db->update_aux('consent_type', $clause);
1055 1055
     }
@@ -1080,7 +1080,7 @@  discard block
 block discarded – undo
1080 1080
      * @param string|null $order_clause
1081 1081
      * @return list<BoincLatestConsent>
1082 1082
      */
1083
-    static function enum($where_clause, $order_clause=null) {
1083
+    static function enum($where_clause, $order_clause = null) {
1084 1084
         $db = BoincDb::get();
1085 1085
         return $db->enum('latest_consent', 'BoincLatestConsent', $where_clause, $order_clause);
1086 1086
     }
@@ -1091,7 +1091,7 @@  discard block
 block discarded – undo
1091 1091
 // apply this to any user-supplied strings used in queries
1092 1092
 //
1093 1093
 function boinc_real_escape_string($x) {
1094
-    if (version_compare(phpversion(),"4.3.0")>=0) {
1094
+    if (version_compare(phpversion(), "4.3.0") >= 0) {
1095 1095
         return BoincDb::escape_string($x);
1096 1096
     } else {
1097 1097
         $x = str_replace("'", "\'", $x);
Please login to merge, or discard this patch.
html/inc/db_conn.inc 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -22,12 +22,12 @@  discard block
 block discarded – undo
22 22
 // Intended to be subclassed (e.g., BoincDb, BossaDb)
23 23
 //
24 24
 class DbConn {
25
-    var $db_conn;       // a mysqli object
26
-    var $db_name;       // the DB name
25
+    var $db_conn; // a mysqli object
26
+    var $db_name; // the DB name
27 27
 
28 28
     function init_conn($user, $passwd, $host, $name) {
29 29
         $x = explode(":", $host);
30
-        if (sizeof($x)>1) {
30
+        if (sizeof($x) > 1) {
31 31
             $host = $x[0];
32 32
             $port = $x[1];
33 33
         } else {
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
         }
36 36
         try {
37 37
             $this->db_conn = @new mysqli($host, $user, $passwd, $name, $port);
38
-        } catch(Exception $e) {
38
+        } catch (Exception $e) {
39 39
             return false;
40 40
         }
41 41
         if (mysqli_connect_error()) {
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
      * @param string|null $order_clause
159 159
      * @return list<T>
160 160
      */
161
-    function enum($table, $classname, $where_clause=null, $order_clause=null) {
161
+    function enum($table, $classname, $where_clause = null, $order_clause = null) {
162 162
         return self::enum_fields(
163 163
             $table, $classname, '*', $where_clause, $order_clause
164 164
         );
@@ -203,15 +203,15 @@  discard block
 block discarded – undo
203 203
         if ($x) return (double)$x->$field;
204 204
         return false;
205 205
     }
206
-    function count($table, $clause="TRUE") {
206
+    function count($table, $clause = "TRUE") {
207 207
         $query = "select count(*) as total from DBNAME.$table where $clause";
208 208
         return $this->get_int($query, 'total');
209 209
     }
210
-    function sum($table, $field, $clause="") {
210
+    function sum($table, $field, $clause = "") {
211 211
         $query = "select sum($field) as total from DBNAME.$table $clause";
212 212
         return $this->get_double($query, 'total');
213 213
     }
214
-    function max($table, $field, $clause="") {
214
+    function max($table, $field, $clause = "") {
215 215
         $query = "select max($field) as total from DBNAME.$table $clause";
216 216
         return $this->get_double($query, 'total');
217 217
     }
Please login to merge, or discard this patch.