Passed
Push — dpa_submit25 ( dd51d3 )
by David
09:16
created
html/inc/boinc_db.inc 1 patch
Spacing   +21 added lines, -21 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));
@@ -204,11 +204,11 @@  discard block
 block discarded – undo
204 204
         $db = BoincDb::get();
205 205
         return $db->update($this, 'user', $clause);
206 206
     }
207
-    static function enum($where_clause, $order_clause=null) {
207
+    static function enum($where_clause, $order_clause = null) {
208 208
         $db = BoincDb::get();
209 209
         return $db->enum('user', 'BoincUser', $where_clause, $order_clause);
210 210
     }
211
-    static function enum_fields($fields, $where_clause, $order_clause=null) {
211
+    static function enum_fields($fields, $where_clause, $order_clause = null) {
212 212
         $db = BoincDb::get();
213 213
         return $db->enum_fields(
214 214
             'user', 'BoincUser', $fields, $where_clause, $order_clause
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
         $db = BoincDb::get();
259 259
         return $db->update($this, 'team', $clause);
260 260
     }
261
-    static function enum($where_clause, $order_clause=null) {
261
+    static function enum($where_clause, $order_clause = null) {
262 262
         $db = BoincDb::get();
263 263
         return $db->enum('team', 'BoincTeam', $where_clause, $order_clause);
264 264
     }
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
         $db = BoincDb::get();
284 284
         return $db->max('team', $field);
285 285
     }
286
-    static function enum_fields($fields, $where_clause, $order_clause=null) {
286
+    static function enum_fields($fields, $where_clause, $order_clause = null) {
287 287
         $db = BoincDb::get();
288 288
         return $db->enum_fields(
289 289
             'team', 'BoincTeam', $fields, $where_clause, $order_clause
@@ -321,11 +321,11 @@  discard block
 block discarded – undo
321 321
         $db = BoincDb::get();
322 322
         return $db->delete($this, 'host');
323 323
     }
324
-    static function enum($where_clause, $order_clause=null) {
324
+    static function enum($where_clause, $order_clause = null) {
325 325
         $db = BoincDb::get();
326 326
         return $db->enum('host', 'BoincHost', $where_clause, $order_clause);
327 327
     }
328
-    static function enum_fields($fields, $where_clause, $order_clause=null) {
328
+    static function enum_fields($fields, $where_clause, $order_clause = null) {
329 329
         $db = BoincDb::get();
330 330
         return $db->enum_fields(
331 331
             'host', 'BoincHost', $fields, $where_clause, $order_clause
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
         $db = BoincDb::get();
363 363
         return $db->enum('result', 'BoincResult', $where_clause);
364 364
     }
365
-	static function enum_fields($fields, $where_clause, $order_clause=null) {
365
+	static function enum_fields($fields, $where_clause, $order_clause = null) {
366 366
         $db = BoincDb::get();
367 367
 		return $db->enum_fields(
368 368
             'result', 'BoincResult', $fields, $where_clause, $order_clause
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
         $db = BoincDb::get();
412 412
         return $db->enum('workunit', 'BoincWorkunit', $where_clause);
413 413
     }
414
-    static function enum_fields($fields, $where_clause, $order_clause=null) {
414
+    static function enum_fields($fields, $where_clause, $order_clause = null) {
415 415
         $db = BoincDb::get();
416 416
         return $db->enum_fields('workunit', 'BoincWorkunit', $fields, $where_clause, $order_clause);
417 417
     }
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
         $db = BoincDb::get();
454 454
         return $db->update($this, 'app', $clause);
455 455
     }
456
-    static function sum($field, $clause=null) {
456
+    static function sum($field, $clause = null) {
457 457
         $db = BoincDb::get();
458 458
         return $db->sum('app', $field, $clause);
459 459
     }
@@ -511,11 +511,11 @@  discard block
 block discarded – undo
511 511
         $db = BoincDb::get();
512 512
         return $db->insert('profile', $clause);
513 513
     }
514
-    static function enum($where_clause=null, $order_clause=null) {
514
+    static function enum($where_clause = null, $order_clause = null) {
515 515
         $db = BoincDb::get();
516 516
         return $db->enum('profile', 'BoincProfile', $where_clause, $order_clause);
517 517
     }
518
-    static function enum_fields($fields, $where_clause=null, $order_clause=null) {
518
+    static function enum_fields($fields, $where_clause = null, $order_clause = null) {
519 519
         $db = BoincDb::get();
520 520
         return $db->enum_fields('profile', 'BoincProfile', $fields, $where_clause, $order_clause);
521 521
     }
@@ -910,12 +910,12 @@  discard block
 block discarded – undo
910 910
         return $db->enum('consent', 'BoincConsent', $where_clause);
911 911
     }
912 912
 
913
-    static function insert ($clause) {
913
+    static function insert($clause) {
914 914
         $db = BoincDb::get();
915 915
         return $db->insert('consent', $clause);
916 916
     }
917 917
 
918
-    static function update ($clause) {
918
+    static function update($clause) {
919 919
         $db = BoincDb::get();
920 920
         return $db->update_aux('consent', $clause);
921 921
     }
@@ -940,17 +940,17 @@  discard block
 block discarded – undo
940 940
         return $db->lookup('consent_type', 'BoincConsentType', $clause);
941 941
     }
942 942
 
943
-    static function enum($where_clause, $order_clause=null) {
943
+    static function enum($where_clause, $order_clause = null) {
944 944
         $db = BoincDb::get();
945 945
         return $db->enum('consent_type', 'BoincConsentType', $where_clause, $order_clause);
946 946
     }
947 947
 
948
-    static function insert ($clause) {
948
+    static function insert($clause) {
949 949
         $db = BoincDb::get();
950 950
         return $db->insert('consent_type', $clause);
951 951
     }
952 952
 
953
-    static function update ($clause) {
953
+    static function update($clause) {
954 954
         $db = BoincDb::get();
955 955
         return $db->update_aux('consent_type', $clause);
956 956
     }
@@ -976,7 +976,7 @@  discard block
 block discarded – undo
976 976
         return $db->lookup('latest_consent', 'BoincLatestConsent', $clause);
977 977
     }
978 978
 
979
-    static function enum($where_clause, $order_clause=null) {
979
+    static function enum($where_clause, $order_clause = null) {
980 980
         $db = BoincDb::get();
981 981
         return $db->enum('latest_consent', 'BoincLatestConsent', $where_clause, $order_clause);
982 982
     }
@@ -987,7 +987,7 @@  discard block
 block discarded – undo
987 987
 // apply this to any user-supplied strings used in queries
988 988
 //
989 989
 function boinc_real_escape_string($x) {
990
-    if (version_compare(phpversion(),"4.3.0")>=0) {
990
+    if (version_compare(phpversion(), "4.3.0") >= 0) {
991 991
         return BoincDb::escape_string($x);
992 992
     } else {
993 993
         $x = str_replace("'", "\'", $x);
Please login to merge, or discard this patch.