Completed
Push — master ( 0e91d6...ba22dc )
by Lars
02:17
created
src/voku/db/DB.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -282,12 +282,12 @@  discard block
 block discarded – undo
282 282
           $this->socket
283 283
       );
284 284
     } catch (\Exception $e) {
285
-      $this->_debug->displayError('Error connecting to mysql server: ' . $e->getMessage(), true);
285
+      $this->_debug->displayError('Error connecting to mysql server: '.$e->getMessage(), true);
286 286
     }
287 287
     \mysqli_report(MYSQLI_REPORT_OFF);
288 288
 
289 289
     if (!$this->connected) {
290
-      $this->_debug->displayError('Error connecting to mysql server: ' . \mysqli_connect_error(), true);
290
+      $this->_debug->displayError('Error connecting to mysql server: '.\mysqli_connect_error(), true);
291 291
     } else {
292 292
       $this->set_charset($this->charset);
293 293
     }
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
     static $firstInstance = null;
383 383
 
384 384
     if (
385
-        $hostname . $username . $password . $database . $port . $charset == ''
385
+        $hostname.$username.$password.$database.$port.$charset == ''
386 386
         &&
387 387
         null !== $firstInstance
388 388
     ) {
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
     }
391 391
 
392 392
     $connection = md5(
393
-        $hostname . $username . $password . $database . $port . $charset . (int)$exit_on_error . (int)$echo_on_error . $logger_class_name . $logger_level . (int)$session_to_db
393
+        $hostname.$username.$password.$database.$port.$charset.(int)$exit_on_error.(int)$echo_on_error.$logger_class_name.$logger_level.(int)$session_to_db
394 394
     );
395 395
 
396 396
     if (!isset($instance[$connection])) {
@@ -598,7 +598,7 @@  discard block
 block discarded – undo
598 598
     $var = $this->escape($var, false, false, null);
599 599
 
600 600
     if (is_string($var)) {
601
-      $var = "'" . trim($var, "'") . "'";
601
+      $var = "'".trim($var, "'")."'";
602 602
     }
603 603
 
604 604
     return $var;
@@ -770,10 +770,10 @@  discard block
 block discarded – undo
770 770
 
771 771
       // exit if we have more then 3 "DB server has gone away"-errors
772 772
       if ($reconnectCounter > 3) {
773
-        $this->_debug->mailToAdmin('SQL-Fatal-Error', $errorMsg . ":\n<br />" . $sql, 5);
773
+        $this->_debug->mailToAdmin('SQL-Fatal-Error', $errorMsg.":\n<br />".$sql, 5);
774 774
         throw new \Exception($errorMsg);
775 775
       } else {
776
-        $this->_debug->mailToAdmin('SQL-Error', $errorMsg . ":\n<br />" . $sql);
776
+        $this->_debug->mailToAdmin('SQL-Error', $errorMsg.":\n<br />".$sql);
777 777
 
778 778
         // reconnect
779 779
         $reconnectCounter++;
@@ -783,10 +783,10 @@  discard block
 block discarded – undo
783 783
         return $this->query($sql, $sqlParams);
784 784
       }
785 785
     } else {
786
-      $this->_debug->mailToAdmin('SQL-Warning', $errorMsg . ":\n<br />" . $sql);
786
+      $this->_debug->mailToAdmin('SQL-Warning', $errorMsg.":\n<br />".$sql);
787 787
 
788 788
       // this query returned an error, we must display it (only for dev) !!!
789
-      $this->_debug->displayError($errorMsg . ' | ' . $sql);
789
+      $this->_debug->displayError($errorMsg.' | '.$sql);
790 790
     }
791 791
 
792 792
     return false;
@@ -854,7 +854,7 @@  discard block
 block discarded – undo
854 854
 
855 855
     if ($useCache === true) {
856 856
       $cache = new Cache(null, null, false, $useCache);
857
-      $cacheKey = 'sql-' . md5($query);
857
+      $cacheKey = 'sql-'.md5($query);
858 858
 
859 859
       if (
860 860
           $cache->getCacheIsReady() === true
@@ -969,9 +969,9 @@  discard block
 block discarded – undo
969 969
 
970 970
     $return = mysqli_set_charset($this->link, $charset);
971 971
     /** @noinspection PhpUsageOfSilenceOperatorInspection */
972
-    @\mysqli_query($this->link, 'SET CHARACTER SET ' . $charset);
972
+    @\mysqli_query($this->link, 'SET CHARACTER SET '.$charset);
973 973
     /** @noinspection PhpUsageOfSilenceOperatorInspection */
974
-    @\mysqli_query($this->link, "SET NAMES '" . $charset . "'");
974
+    @\mysqli_query($this->link, "SET NAMES '".$charset."'");
975 975
 
976 976
     return $return;
977 977
   }
@@ -1058,10 +1058,10 @@  discard block
 block discarded – undo
1058 1058
 
1059 1059
       if ($this->_debug->checkForDev() === true) {
1060 1060
         echo "Info: maybe you have to increase your 'max_allowed_packet = 30M' in the config: 'my.conf' \n<br />";
1061
-        echo 'Error:' . $errorMsg;
1061
+        echo 'Error:'.$errorMsg;
1062 1062
       }
1063 1063
 
1064
-      $this->_debug->mailToAdmin('SQL-Error in mysqli_multi_query', $errorMsg . ":\n<br />" . $sql);
1064
+      $this->_debug->mailToAdmin('SQL-Error in mysqli_multi_query', $errorMsg.":\n<br />".$sql);
1065 1065
     }
1066 1066
 
1067 1067
     // return the result only if there was a "SELECT"-query
@@ -1098,7 +1098,7 @@  discard block
 block discarded – undo
1098 1098
 
1099 1099
       return false;
1100 1100
     } elseif (\mysqli_connect_errno()) {
1101
-      $this->_debug->displayError('Error connecting to mysql server: ' . \mysqli_connect_error(), true);
1101
+      $this->_debug->displayError('Error connecting to mysql server: '.\mysqli_connect_error(), true);
1102 1102
 
1103 1103
       return false;
1104 1104
     } else {
@@ -1207,7 +1207,7 @@  discard block
 block discarded – undo
1207 1207
 
1208 1208
     $SET = $this->_parseArrayPair($data);
1209 1209
 
1210
-    $sql = 'INSERT INTO ' . $this->quote_string($table) . " SET $SET;";
1210
+    $sql = 'INSERT INTO '.$this->quote_string($table)." SET $SET;";
1211 1211
 
1212 1212
     return $this->query($sql);
1213 1213
   }
@@ -1295,9 +1295,9 @@  discard block
 block discarded – undo
1295 1295
           }
1296 1296
 
1297 1297
           if ($_connector === 'NOT IN' || $_connector === 'IN') {
1298
-            $_value = '(' . implode(',', $_value) . ')';
1298
+            $_value = '('.implode(',', $_value).')';
1299 1299
           } elseif ($_connector === 'NOT BETWEEN' || $_connector === 'BETWEEN') {
1300
-            $_value = '(' . implode(' AND ', $_value) . ')';
1300
+            $_value = '('.implode(' AND ', $_value).')';
1301 1301
           }
1302 1302
 
1303 1303
         } else {
@@ -1305,7 +1305,7 @@  discard block
 block discarded – undo
1305 1305
         }
1306 1306
 
1307 1307
         $quoteString = $this->quote_string(trim(str_ireplace($_connector, '', $_key)));
1308
-        $pairs[] = ' ' . $quoteString . ' ' . $_connector . ' ' . $_value . " \n";
1308
+        $pairs[] = ' '.$quoteString.' '.$_connector.' '.$_value." \n";
1309 1309
       }
1310 1310
 
1311 1311
       $sql = implode($glue, $pairs);
@@ -1323,7 +1323,7 @@  discard block
 block discarded – undo
1323 1323
    */
1324 1324
   public function quote_string($str)
1325 1325
   {
1326
-    $str= str_replace(
1326
+    $str = str_replace(
1327 1327
         '`',
1328 1328
         '``',
1329 1329
         trim(
@@ -1332,7 +1332,7 @@  discard block
 block discarded – undo
1332 1332
         )
1333 1333
     );
1334 1334
 
1335
-    return '`' . $str . '`';
1335
+    return '`'.$str.'`';
1336 1336
   }
1337 1337
 
1338 1338
   /**
@@ -1386,7 +1386,7 @@  discard block
 block discarded – undo
1386 1386
     }
1387 1387
     $values = implode(',', $data);
1388 1388
 
1389
-    $sql = 'REPLACE INTO ' . $this->quote_string($table) . " ($columns) VALUES ($values);";
1389
+    $sql = 'REPLACE INTO '.$this->quote_string($table)." ($columns) VALUES ($values);";
1390 1390
 
1391 1391
     return $this->query($sql);
1392 1392
   }
@@ -1426,7 +1426,7 @@  discard block
 block discarded – undo
1426 1426
       $WHERE = '';
1427 1427
     }
1428 1428
 
1429
-    $sql = 'UPDATE ' . $this->quote_string($table) . " SET $SET WHERE ($WHERE);";
1429
+    $sql = 'UPDATE '.$this->quote_string($table)." SET $SET WHERE ($WHERE);";
1430 1430
 
1431 1431
     return $this->query($sql);
1432 1432
   }
@@ -1458,7 +1458,7 @@  discard block
 block discarded – undo
1458 1458
       $WHERE = '';
1459 1459
     }
1460 1460
 
1461
-    $sql = 'DELETE FROM ' . $this->quote_string($table) . " WHERE ($WHERE);";
1461
+    $sql = 'DELETE FROM '.$this->quote_string($table)." WHERE ($WHERE);";
1462 1462
 
1463 1463
     return $this->query($sql);
1464 1464
   }
@@ -1488,7 +1488,7 @@  discard block
 block discarded – undo
1488 1488
       $WHERE = '';
1489 1489
     }
1490 1490
 
1491
-    $sql = 'SELECT * FROM ' . $this->quote_string($table) . " WHERE ($WHERE);";
1491
+    $sql = 'SELECT * FROM '.$this->quote_string($table)." WHERE ($WHERE);";
1492 1492
 
1493 1493
     return $this->query($sql);
1494 1494
   }
Please login to merge, or discard this patch.