Passed
Pull Request — master (#5697)
by David
16:47
created
html/inc/db_conn.inc 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
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 {
@@ -131,10 +131,10 @@  discard block
 block discarded – undo
131 131
             $where_clause = "where $where_clause";
132 132
         }
133 133
         $query = "select $fields from DBNAME.$table $where_clause $order_clause";
134
-        return $this->enum_general($classname,$query);
134
+        return $this->enum_general($classname, $query);
135 135
     }
136 136
 
137
-    function enum($table, $classname, $where_clause=null, $order_clause=null) {
137
+    function enum($table, $classname, $where_clause = null, $order_clause = null) {
138 138
         return self::enum_fields(
139 139
             $table, $classname, '*', $where_clause, $order_clause
140 140
         );
@@ -179,15 +179,15 @@  discard block
 block discarded – undo
179 179
         if ($x) return (double)$x->$field;
180 180
         return false;
181 181
     }
182
-    function count($table, $clause="TRUE") {
182
+    function count($table, $clause = "TRUE") {
183 183
         $query = "select count(*) as total from DBNAME.$table where $clause";
184 184
         return $this->get_int($query, 'total');
185 185
     }
186
-    function sum($table, $field, $clause="") {
186
+    function sum($table, $field, $clause = "") {
187 187
         $query = "select sum($field) as total from DBNAME.$table $clause";
188 188
         return $this->get_double($query, 'total');
189 189
     }
190
-    function max($table, $field, $clause="") {
190
+    function max($table, $field, $clause = "") {
191 191
         $query = "select max($field) as total from DBNAME.$table $clause";
192 192
         return $this->get_double($query, 'total');
193 193
     }
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,8 @@
 block discarded – undo
33 33
         } else {
34 34
             $port = null;
35 35
         }
36
-        if (1) {        // don't use persistent connections for now
36
+        if (1) {
37
+// don't use persistent connections for now
37 38
             $this->db_conn = @new mysqli(
38 39
                 $host, $user, $passwd, $name, $port
39 40
             );
Please login to merge, or discard this patch.
html/inc/boinc_db.inc 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
         self::$instance = null;
50 50
         $config = get_config();
51 51
         if ($dbnum) {
52
-            $r = $dbnum==1?'':strval($dbnum);
52
+            $r = $dbnum == 1 ? '' : strval($dbnum);
53 53
             $host = parse_config($config, sprintf('<replica%s_db_host>', $r));
54 54
             $name = parse_config($config, sprintf('<replica%s_db_name>', $r));
55 55
             $user = parse_config($config, sprintf('<replica%s_db_user>', $r));
@@ -189,11 +189,11 @@  discard block
 block discarded – undo
189 189
         $db = BoincDb::get();
190 190
         return $db->update($this, 'user', $clause);
191 191
     }
192
-    static function enum($where_clause, $order_clause=null) {
192
+    static function enum($where_clause, $order_clause = null) {
193 193
         $db = BoincDb::get();
194 194
         return $db->enum('user', 'BoincUser', $where_clause, $order_clause);
195 195
     }
196
-    static function enum_fields($fields, $where_clause, $order_clause=null) {
196
+    static function enum_fields($fields, $where_clause, $order_clause = null) {
197 197
         $db = BoincDb::get();
198 198
         return $db->enum_fields(
199 199
             'user', 'BoincUser', $fields, $where_clause, $order_clause
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
         $db = BoincDb::get();
244 244
         return $db->update($this, 'team', $clause);
245 245
     }
246
-    static function enum($where_clause, $order_clause=null) {
246
+    static function enum($where_clause, $order_clause = null) {
247 247
         $db = BoincDb::get();
248 248
         return $db->enum('team', 'BoincTeam', $where_clause, $order_clause);
249 249
     }
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
         $db = BoincDb::get();
269 269
         return $db->max('team', $field);
270 270
     }
271
-    static function enum_fields($fields, $where_clause, $order_clause=null) {
271
+    static function enum_fields($fields, $where_clause, $order_clause = null) {
272 272
         $db = BoincDb::get();
273 273
         return $db->enum_fields(
274 274
             'team', 'BoincTeam', $fields, $where_clause, $order_clause
@@ -306,11 +306,11 @@  discard block
 block discarded – undo
306 306
         $db = BoincDb::get();
307 307
         return $db->delete($this, 'host');
308 308
     }
309
-    static function enum($where_clause, $order_clause=null) {
309
+    static function enum($where_clause, $order_clause = null) {
310 310
         $db = BoincDb::get();
311 311
         return $db->enum('host', 'BoincHost', $where_clause, $order_clause);
312 312
     }
313
-    static function enum_fields($fields, $where_clause, $order_clause=null) {
313
+    static function enum_fields($fields, $where_clause, $order_clause = null) {
314 314
         $db = BoincDb::get();
315 315
         return $db->enum_fields(
316 316
             'host', 'BoincHost', $fields, $where_clause, $order_clause
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
         $db = BoincDb::get();
433 433
         return $db->update($this, 'app', $clause);
434 434
     }
435
-    static function sum($field, $clause=null) {
435
+    static function sum($field, $clause = null) {
436 436
         $db = BoincDb::get();
437 437
         return $db->sum('app', $field, $clause);
438 438
     }
@@ -490,11 +490,11 @@  discard block
 block discarded – undo
490 490
         $db = BoincDb::get();
491 491
         return $db->insert('profile', $clause);
492 492
     }
493
-    static function enum($where_clause=null, $order_clause=null) {
493
+    static function enum($where_clause = null, $order_clause = null) {
494 494
         $db = BoincDb::get();
495 495
         return $db->enum('profile', 'BoincProfile', $where_clause, $order_clause);
496 496
     }
497
-    static function enum_fields($fields, $where_clause=null, $order_clause=null) {
497
+    static function enum_fields($fields, $where_clause = null, $order_clause = null) {
498 498
         $db = BoincDb::get();
499 499
         return $db->enum_fields('profile', 'BoincProfile', $fields, $where_clause, $order_clause);
500 500
     }
@@ -889,12 +889,12 @@  discard block
 block discarded – undo
889 889
         return $db->enum('consent', 'BoincConsent', $where_clause);
890 890
     }
891 891
 
892
-    static function insert ($clause) {
892
+    static function insert($clause) {
893 893
         $db = BoincDb::get();
894 894
         return $db->insert('consent', $clause);
895 895
     }
896 896
 
897
-    static function update ($clause) {
897
+    static function update($clause) {
898 898
         $db = BoincDb::get();
899 899
         return $db->update_aux('consent', $clause);
900 900
     }
@@ -919,17 +919,17 @@  discard block
 block discarded – undo
919 919
         return $db->lookup('consent_type', 'BoincConsentType', $clause);
920 920
     }
921 921
 
922
-    static function enum($where_clause, $order_clause=null) {
922
+    static function enum($where_clause, $order_clause = null) {
923 923
         $db = BoincDb::get();
924 924
         return $db->enum('consent_type', 'BoincConsentType', $where_clause, $order_clause);
925 925
     }
926 926
 
927
-    static function insert ($clause) {
927
+    static function insert($clause) {
928 928
         $db = BoincDb::get();
929 929
         return $db->insert('consent_type', $clause);
930 930
     }
931 931
 
932
-    static function update ($clause) {
932
+    static function update($clause) {
933 933
         $db = BoincDb::get();
934 934
         return $db->update_aux('consent_type', $clause);
935 935
     }
@@ -955,7 +955,7 @@  discard block
 block discarded – undo
955 955
         return $db->lookup('latest_consent', 'BoincLatestConsent', $clause);
956 956
     }
957 957
 
958
-    static function enum($where_clause, $order_clause=null) {
958
+    static function enum($where_clause, $order_clause = null) {
959 959
         $db = BoincDb::get();
960 960
         return $db->enum('latest_consent', 'BoincLatestConsent', $where_clause, $order_clause);
961 961
     }
@@ -966,7 +966,7 @@  discard block
 block discarded – undo
966 966
 // apply this to any user-supplied strings used in queries
967 967
 //
968 968
 function boinc_real_escape_string($x) {
969
-    if (version_compare(phpversion(),"4.3.0")>=0) {
969
+    if (version_compare(phpversion(), "4.3.0") >= 0) {
970 970
         return BoincDb::escape_string($x);
971 971
     } else {
972 972
         $x = str_replace("'", "\'", $x);
Please login to merge, or discard this patch.