Test Failed
Push — master ( 9a4e1c...be5412 )
by Joe
02:40
created
src/Mysqli/Db.php 3 patches
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 			if ($this->connectionAttempt > 1)
72 72
 				error_log("MySQLi Connection Attempt #{$this->connectionAttempt}/{$this->maxConnectErrors}");
73 73
 			if ($this->connectionAttempt >= $this->maxConnectErrors) {
74
-				$this->halt("connect($host, $user, \$password) failed. " . $mysqli->connect_error);
74
+				$this->halt("connect($host, $user, \$password) failed. ".$mysqli->connect_error);
75 75
 				return 0;
76 76
 			}
77 77
 			//$this->linkId = new mysqli($host, $user, $password, $database);
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 			* }
88 88
 			*/
89 89
 			if ($this->linkId->connect_errno) {
90
-				$this->halt("connect($host, $user, \$password) failed. " . $mysqli->connect_error);
90
+				$this->halt("connect($host, $user, \$password) failed. ".$mysqli->connect_error);
91 91
 				return 0;
92 92
 			}
93 93
 			/*if ($this->characterSet != '') {
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 			$this->Errno = @mysqli_errno($this->linkId);
256 256
 			$this->Error = @mysqli_error($this->linkId);
257 257
 			if ($try == 1 && (null === $this->queryId || $this->queryId === FALSE)) {
258
-				$email = "MySQLi Error<br>\n".'Query: '.$queryString . "<br>\n".'Error #'.$this->Errno.': '.$this->Error . "<br>\n".'Line: '.$line . "<br>\n".'File: '.$file . "<br>\n" . (isset($GLOBALS['tf']) ? 'User: '.$GLOBALS['tf']->session->account_id . "<br>\n" : '');
258
+				$email = "MySQLi Error<br>\n".'Query: '.$queryString."<br>\n".'Error #'.$this->Errno.': '.$this->Error."<br>\n".'Line: '.$line."<br>\n".'File: '.$file."<br>\n".(isset($GLOBALS['tf']) ? 'User: '.$GLOBALS['tf']->session->account_id."<br>\n" : '');
259 259
 				$email .= '<br><br>Request Variables:<br>'.print_r($_REQUEST, TRUE);
260 260
 				$email .= '<br><br>Server Variables:<br>'.print_r($_SERVER, TRUE);
261 261
 				$subject = $_SERVER['HOSTNAME'].' MySQLi Error';
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 		if ($status) {
323 323
 			$this->Row = $pos;
324 324
 		} else {
325
-			$this->halt("seek($pos) failed: result has " . $this->num_rows().' rows');
325
+			$this->halt("seek($pos) failed: result has ".$this->num_rows().' rows');
326 326
 			/* half assed attempt to save the day,
327 327
 			* but do not consider this documented or even
328 328
 			* desirable behaviour.
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
 	 */
381 381
 	public function getLastInsertId($table, $field) {
382 382
 		if (!isset($table) || $table == '' || !isset($field) || $field == '')
383
-			return - 1;
383
+			return -1;
384 384
 
385 385
 		return @mysqli_insert_id($this->linkId);
386 386
 	}
@@ -514,22 +514,22 @@  discard block
 block discarded – undo
514 514
  * @param int|string $field
515 515
  * @return bool
516 516
  */
517
-function mysqli_result($result, $row, $field=0) {
518
-	if ($result===false) return FALSE;
519
-	if ($row>=mysqli_num_rows($result)) return FALSE;
517
+function mysqli_result($result, $row, $field = 0) {
518
+	if ($result === false) return FALSE;
519
+	if ($row >= mysqli_num_rows($result)) return FALSE;
520 520
 	if (is_string($field) && !(mb_strpos($field, '.') === FALSE)) {
521
-		$tField=explode('.', $field);
522
-		$field=-1;
523
-		$tFields=mysqli_fetch_fields($result);
524
-		for ($id=0, $idMax = mysqli_num_fields($result);$id<$idMax;$id++) {
525
-			if ($tFields[$id]->table==$tField[0] && $tFields[$id]->name==$tField[1]) {
526
-				$field=$id;
521
+		$tField = explode('.', $field);
522
+		$field = -1;
523
+		$tFields = mysqli_fetch_fields($result);
524
+		for ($id = 0, $idMax = mysqli_num_fields($result); $id < $idMax; $id++) {
525
+			if ($tFields[$id]->table == $tField[0] && $tFields[$id]->name == $tField[1]) {
526
+				$field = $id;
527 527
 				break;
528 528
 			}
529 529
 		}
530
-		if ($field==-1) return FALSE;
530
+		if ($field == -1) return FALSE;
531 531
 	}
532 532
 	mysqli_data_seek($result, $row);
533
-	$line=mysqli_fetch_array($result);
534
-	return isset($line[$field])?$line[$field]:false;
533
+	$line = mysqli_fetch_array($result);
534
+	return isset($line[$field]) ? $line[$field] : false;
535 535
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,8 +17,7 @@
 block discarded – undo
17 17
  *
18 18
  * @access public
19 19
  */
20
-class Db extends Generic implements Db_Interface
21
-{
20
+class Db extends Generic implements Db_Interface {
22 21
 	/**
23 22
 	 * @var string
24 23
 	 */
Please login to merge, or discard this patch.
Upper-Lower-Casing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 		$tries = 3;
245 245
 		$try = 0;
246 246
 		$this->queryId = FALSE;
247
-		while ((null === $this->queryId || $this->queryId === FALSE) && $try <= $tries) {
247
+		while ((NULL === $this->queryId || $this->queryId === FALSE) && $try <= $tries) {
248 248
 			$try++;
249 249
 			if ($try > 1) {
250 250
 				@mysqli_close($this->linkId);
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 			$this->Row = 0;
255 255
 			$this->Errno = @mysqli_errno($this->linkId);
256 256
 			$this->Error = @mysqli_error($this->linkId);
257
-			if ($try == 1 && (null === $this->queryId || $this->queryId === FALSE)) {
257
+			if ($try == 1 && (NULL === $this->queryId || $this->queryId === FALSE)) {
258 258
 				$email = "MySQLi Error<br>\n".'Query: '.$queryString . "<br>\n".'Error #'.$this->Errno.': '.$this->Error . "<br>\n".'Line: '.$line . "<br>\n".'File: '.$file . "<br>\n" . (isset($GLOBALS['tf']) ? 'User: '.$GLOBALS['tf']->session->account_id . "<br>\n" : '');
259 259
 				$email .= '<br><br>Request Variables:<br>'.print_r($_REQUEST, TRUE);
260 260
 				$email .= '<br><br>Server Variables:<br>'.print_r($_SERVER, TRUE);
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 			}
271 271
 		}
272 272
 		$this->haltOnError = $haltPrev;
273
-		if (null === $this->queryId || $this->queryId === FALSE)
273
+		if (NULL === $this->queryId || $this->queryId === FALSE)
274 274
 			$this->halt('', $line, $file);
275 275
 
276 276
 		// Will return nada if it fails. That's fine.
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
 	 */
342 342
 	public function transactionBegin() {
343 343
 		if (version_compare(PHP_VERSION, '5.5.0') < 0)
344
-			return true;
344
+			return TRUE;
345 345
 		if (!$this->connect())
346 346
 			return 0;
347 347
 		return mysqli_begin_transaction($this->linkId);
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
 	 */
355 355
 	public function transactionCommit() {
356 356
 		if (version_compare(PHP_VERSION, '5.5.0') < 0)
357
-			return true;
357
+			return TRUE;
358 358
 		return mysqli_commit($this->linkId);
359 359
 	}
360 360
 
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
 	 */
366 366
 	public function transactionAbort() {
367 367
 		if (version_compare(PHP_VERSION, '5.5.0') < 0)
368
-			return true;
368
+			return TRUE;
369 369
 		return mysqli_rollback($this->linkId);
370 370
 	}
371 371
 
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
  * @return bool
516 516
  */
517 517
 function mysqli_result($result, $row, $field=0) {
518
-	if ($result===false) return FALSE;
518
+	if ($result===FALSE) return FALSE;
519 519
 	if ($row>=mysqli_num_rows($result)) return FALSE;
520 520
 	if (is_string($field) && !(mb_strpos($field, '.') === FALSE)) {
521 521
 		$tField=explode('.', $field);
@@ -531,5 +531,5 @@  discard block
 block discarded – undo
531 531
 	}
532 532
 	mysqli_data_seek($result, $row);
533 533
 	$line=mysqli_fetch_array($result);
534
-	return isset($line[$field])?$line[$field]:false;
534
+	return isset($line[$field])?$line[$field]:FALSE;
535 535
 }
Please login to merge, or discard this patch.
src/Db_Interface.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
-	* Generic SQL Driver Related Functionality
4
-	* by [email protected]
5
-	* @copyright 2018
6
-	* @package MyAdmin
7
-	* @category SQL
8
-	*/
3
+ * Generic SQL Driver Related Functionality
4
+ * by [email protected]
5
+ * @copyright 2018
6
+ * @package MyAdmin
7
+ * @category SQL
8
+ */
9 9
 
10 10
 namespace MyDb;
11 11
 /**
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,8 +13,7 @@
 block discarded – undo
13 13
  *
14 14
  * @package MyDb
15 15
  */
16
-interface Db_Interface
17
-{
16
+interface Db_Interface {
18 17
 
19 18
 	/**
20 19
 	 * Db_Interface constructor.
Please login to merge, or discard this patch.
src/Pdo/Db.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -198,18 +198,18 @@  discard block
 block discarded – undo
198 198
 		$this->queryId = $this->linkId->prepare($queryString);
199 199
 		$success = $this->queryId->execute();
200 200
 		$this->Rows = $this->queryId->fetchAll();
201
-		$this->log("PDO Query $queryString (S:$success) - " . count($this->Rows).' Rows', __LINE__, __FILE__);
201
+		$this->log("PDO Query $queryString (S:$success) - ".count($this->Rows).' Rows', __LINE__, __FILE__);
202 202
 		$this->Row = 0;
203 203
 		if ($success === FALSE) {
204
-			$email = "MySQL Error<br>\n".'Query: '.$queryString . "<br>\n".'Error #'.print_r($this->queryId->errorInfo(), TRUE) . "<br>\n".'Line: '.$line . "<br>\n".'File: '.$file . "<br>\n" . (isset($GLOBALS['tf']) ? 'User: '.$GLOBALS['tf']->session->account_id . "<br>\n" : '');
204
+			$email = "MySQL Error<br>\n".'Query: '.$queryString."<br>\n".'Error #'.print_r($this->queryId->errorInfo(), TRUE)."<br>\n".'Line: '.$line."<br>\n".'File: '.$file."<br>\n".(isset($GLOBALS['tf']) ? 'User: '.$GLOBALS['tf']->session->account_id."<br>\n" : '');
205 205
 
206 206
 			$email .= '<br><br>Request Variables:<br>';
207 207
 			foreach ($_REQUEST as $key => $value)
208
-				$email .= $key.': '.$value . "<br>\n";
208
+				$email .= $key.': '.$value."<br>\n";
209 209
 
210 210
 			$email .= '<br><br>Server Variables:<br>';
211 211
 			foreach ($_SERVER as $key => $value)
212
-				$email .= $key.': '.$value . "<br>\n";
212
+				$email .= $key.': '.$value."<br>\n";
213 213
 			$subject = $_SERVER['HOSTNAME'].' MySQLi Error';
214 214
 			$headers = '';
215 215
 			$headers .= 'MIME-Version: 1.0'.PHP_EOL;
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 		if (isset($this->Rows[$pos])) {
260 260
 			$this->Row = $pos;
261 261
 		} else {
262
-			$this->halt("seek($pos) failed: result has " . count($this->Rows).' rows');
262
+			$this->halt("seek($pos) failed: result has ".count($this->Rows).' rows');
263 263
 			/* half assed attempt to save the day,
264 264
 			* but do not consider this documented or even
265 265
 			* desirable behaviour.
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 	 */
302 302
 	public function getLastInsertId($table, $field) {
303 303
 		if (!isset($table) || $table == '' || !isset($field) || $field == '')
304
-			return - 1;
304
+			return -1;
305 305
 		return $this->linkId->lastInsertId();
306 306
 	}
307 307
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -17,8 +17,7 @@  discard block
 block discarded – undo
17 17
  *
18 18
  * @access public
19 19
  */
20
-class Db extends Generic implements Db_Interface
21
-{
20
+class Db extends Generic implements Db_Interface {
22 21
 	/* public: connection parameters */
23 22
 	public $driver = 'mysql';
24 23
 	public $Rows = [];
@@ -76,11 +75,9 @@  discard block
 block discarded – undo
76 75
 		if ($this->characterSet != '')
77 76
 			$dSN .= ';charset='.$this->characterSet;
78 77
 		if ($this->linkId === FALSE) {
79
-			try
80
-			{
78
+			try {
81 79
 				$this->linkId = new \PDO($dSN, $user, $password);
82
-			}
83
-			catch (\PDOException $e) {
80
+			} catch (\PDOException $e) {
84 81
 				$this->halt('Connection Failed '.$e->getMessage());
85 82
 				return 0;
86 83
 			}
Please login to merge, or discard this patch.
src/Generic.php 3 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -164,9 +164,9 @@  discard block
 block discarded – undo
164 164
 	public function limit($start = 0) {
165 165
 		echo '<b>Warning: limit() is no longer used, use limitQuery()</b>';
166 166
 		if ($start == 0) {
167
-			$s = 'limit '.(int)$this->maxMatches;
167
+			$s = 'limit '.(int) $this->maxMatches;
168 168
 		} else {
169
-			$s = 'limit '.(int)$start.','.(int)$this->maxMatches;
169
+			$s = 'limit '.(int) $start.','.(int) $this->maxMatches;
170 170
 		}
171 171
 		return $s;
172 172
 	}
@@ -185,9 +185,9 @@  discard block
 block discarded – undo
185 185
 		if (!$numRows)
186 186
 			$numRows = $this->maxMatches;
187 187
 		if ($offset == 0) {
188
-			$queryString .= ' LIMIT '.(int)$numRows;
188
+			$queryString .= ' LIMIT '.(int) $numRows;
189 189
 		} else {
190
-			$queryString .= ' LIMIT '.(int)$offset.','.(int)$numRows;
190
+			$queryString .= ' LIMIT '.(int) $offset.','.(int) $numRows;
191 191
 		}
192 192
 
193 193
 		if ($this->Debug)
@@ -258,26 +258,26 @@  discard block
 block discarded – undo
258 258
 	 * @return mixed|void
259 259
 	 */
260 260
 	public function logBackTrace($msg, $line = '', $file = '') {
261
-		$backtrace=(function_exists('debug_backtrace') ? debug_backtrace() : []);
261
+		$backtrace = (function_exists('debug_backtrace') ? debug_backtrace() : []);
262 262
 		$this->log(
263 263
 			('' !== getenv('REQUEST_URI') ? ' '.getenv('REQUEST_URI') : '').
264 264
 			((isset($_POST) && count($_POST)) ? ' POST='.json_encode($_POST) : '').
265 265
 			((isset($_GET) && count($_GET)) ? ' GET='.json_encode($_GET) : '').
266 266
 			((isset($_FILES) && count($_FILES)) ? ' FILES='.json_encode($_FILES) : '').
267 267
 			('' !== getenv('HTTP_USER_AGENT') ? ' AGENT="'.getenv('HTTP_USER_AGENT').'"' : '').
268
-			(isset($_SERVER[ 'REQUEST_METHOD' ]) ?' METHOD="'. $_SERVER['REQUEST_METHOD']. '"'.
269
-				($_SERVER['REQUEST_METHOD'] === 'POST' ? ' POST="'. json_encode($_POST). '"' : '') : ''), $line, $file, 'error');
270
-		for($level=1, $levelMax = count($backtrace);$level < $levelMax;$level++) {
271
-			$message=(isset($backtrace[$level]['file']) ? 'File: '. $backtrace[$level]['file'] : '').
272
-				(isset($backtrace[$level]['line']) ? ' Line: '. $backtrace[$level]['line'] : '').
273
-				' Function: '.(isset($backtrace[$level] ['class']) ? '(class '. $backtrace[$level] ['class'].') ' : '') .
268
+			(isset($_SERVER['REQUEST_METHOD']) ? ' METHOD="'.$_SERVER['REQUEST_METHOD'].'"'.
269
+				($_SERVER['REQUEST_METHOD'] === 'POST' ? ' POST="'.json_encode($_POST).'"' : '') : ''), $line, $file, 'error');
270
+		for ($level = 1, $levelMax = count($backtrace); $level < $levelMax; $level++) {
271
+			$message = (isset($backtrace[$level]['file']) ? 'File: '.$backtrace[$level]['file'] : '').
272
+				(isset($backtrace[$level]['line']) ? ' Line: '.$backtrace[$level]['line'] : '').
273
+				' Function: '.(isset($backtrace[$level] ['class']) ? '(class '.$backtrace[$level] ['class'].') ' : '').
274 274
 				(isset($backtrace[$level] ['type']) ? $backtrace[$level] ['type'].' ' : '').
275 275
 				$backtrace[$level] ['function'].'(';
276
-			if(isset($backtrace[$level] ['args']))
277
-				for($argument = 0, $argumentMax = count($backtrace[$level]['args']); $argument < $argumentMax; $argument++)
276
+			if (isset($backtrace[$level] ['args']))
277
+				for ($argument = 0, $argumentMax = count($backtrace[$level]['args']); $argument < $argumentMax; $argument++)
278 278
 					$message .= ($argument > 0 ? ', ' : '').
279 279
 						(is_object($backtrace[$level]['args'][$argument]) ? 'class '.get_class($backtrace[$level]['args'][$argument]) : json_encode($backtrace[$level]['args'][$argument]));
280
-			$message.=')';
280
+			$message .= ')';
281 281
 			$this->log($message, $line, $file, 'error');
282 282
 		}
283 283
 	}
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
 		$this->log("Database error: $msg", $line, $file, 'error');
293 293
 		if ($this->Errno != '0' || !in_array($this->Error, '', '()')) {
294 294
 			$sqlstate = mysqli_sqlstate($this->linkId);
295
-			$this->log("MySQLi SQLState: {$sqlstate}. Error: " . $this->Errno . ' (' . $this->Error . ')', $line, $file, 'error');
295
+			$this->log("MySQLi SQLState: {$sqlstate}. Error: ".$this->Errno.' ('.$this->Error.')', $line, $file, 'error');
296 296
 		}
297 297
 		$this->logBackTrace($msg, $line, $file);
298 298
 	}
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,8 +12,7 @@
 block discarded – undo
12 12
 /**
13 13
  * Class Generic
14 14
  */
15
-abstract class Generic
16
-{
15
+abstract class Generic {
17 16
 	/* public: connection parameters */
18 17
 	public $host = 'localhost';
19 18
 	public $database = '';
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -234,7 +234,7 @@
 block discarded – undo
234 234
 	 * @return void
235 235
 	 */
236 236
 	public function halt($msg, $line = '', $file = '') {
237
-		$this->unlock(false);
237
+		$this->unlock(FALSE);
238 238
 		/* Just in case there is a table currently locked */
239 239
 
240 240
 		//$this->Error = @$this->linkId->error;
Please login to merge, or discard this patch.
src/Mdb2/Db.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -36,10 +36,10 @@  discard block
 block discarded – undo
36 36
 	public function quote($text = '', $type = 'text') {
37 37
 		switch ($type) {
38 38
 			case 'text':
39
-				return "'" . mysqli_real_escape_string($this->linkId, $text) . "'";
39
+				return "'".mysqli_real_escape_string($this->linkId, $text)."'";
40 40
 				break;
41 41
 			case 'integer':
42
-				return (int)$text;
42
+				return (int) $text;
43 43
 				break;
44 44
 			default:
45 45
 				return $text;
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 			if ($this->connectionAttempt > 1)
139 139
 				error_log("MySQLi Connection Attempt #{$this->connectionAttempt}/{$this->maxConnectErrors}");
140 140
 			if ($this->connectionAttempt >= $this->maxConnectErrors) {
141
-				$this->halt("connect($host, $user, \$password) failed. " . $mysqli->connect_error);
141
+				$this->halt("connect($host, $user, \$password) failed. ".$mysqli->connect_error);
142 142
 				return 0;
143 143
 			}
144 144
 			$this->linkId = mysqli_init();
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 			$this->linkId->real_connect($host, $user, $password, $database);
147 147
 			$this->linkId->set_charset($this->characterSet);
148 148
 			if ($this->linkId->connect_errno) {
149
-				$this->halt("connect($host, $user, \$password) failed. " . $mysqli->connect_error);
149
+				$this->halt("connect($host, $user, \$password) failed. ".$mysqli->connect_error);
150 150
 				return 0;
151 151
 			}
152 152
 		}
@@ -292,8 +292,8 @@  discard block
 block discarded – undo
292 292
 		}
293 293
 		$this->haltOnError = $haltPrev;
294 294
 		if ($this->queryId === FALSE) {
295
-			$email = "MySQLi Error<br>\n".'Query: '.$queryString . "<br>\n".'Error #'.$this->Errno.': '.$this->Error . "<br>\n".'Line: '.$line . "<br>\n".'File: '.$file . "<br>\n" . (isset($GLOBALS['tf']) ?
296
-					'User: '.$GLOBALS['tf']->session->account_id . "<br>\n" : '');
295
+			$email = "MySQLi Error<br>\n".'Query: '.$queryString."<br>\n".'Error #'.$this->Errno.': '.$this->Error."<br>\n".'Line: '.$line."<br>\n".'File: '.$file."<br>\n".(isset($GLOBALS['tf']) ?
296
+					'User: '.$GLOBALS['tf']->session->account_id."<br>\n" : '');
297 297
 
298 298
 			$email .= '<br><br>Request Variables:<br>'.print_r($_REQUEST, TRUE);
299 299
 			$email .= '<br><br>Server Variables:<br>'.print_r($_SERVER, TRUE);
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
 		if ($status) {
349 349
 			$this->Row = $pos;
350 350
 		} else {
351
-			$this->halt("seek($pos) failed: result has " . $this->num_rows().' rows');
351
+			$this->halt("seek($pos) failed: result has ".$this->num_rows().' rows');
352 352
 			/* half assed attempt to save the day,
353 353
 			* but do not consider this documented or even
354 354
 			* desirable behaviour.
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
 		*/
399 399
 
400 400
 		if (!isset($table) || $table == '' || !isset($field) || $field == '')
401
-			return - 1;
401
+			return -1;
402 402
 
403 403
 		return @mysqli_insert_id($this->linkId);
404 404
 	}
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,8 +17,7 @@
 block discarded – undo
17 17
  *
18 18
  * @access public
19 19
  */
20
-class Db extends Generic implements Db_Interface
21
-{
20
+class Db extends Generic implements Db_Interface {
22 21
 	public $host = 'localhost';
23 22
 	public $user = 'pdns';
24 23
 	public $password = '';
Please login to merge, or discard this patch.
src/Loader.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,8 +13,7 @@
 block discarded – undo
13 13
  *
14 14
  * @package MyDb
15 15
  */
16
-class Loader
17
-{
16
+class Loader {
18 17
 	/* public: connection parameters */
19 18
 	public $Type = 'mysqli';
20 19
 	public $host = 'localhost';
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -149,7 +149,7 @@
 block discarded – undo
149 149
 	 * @return void
150 150
 	 */
151 151
 	public function halt($msg, $line = '', $file = '') {
152
-		$this->unlock(false);
152
+		$this->unlock(FALSE);
153 153
 
154 154
 		if ($this->haltOnError == 'no')
155 155
 			return;
Please login to merge, or discard this patch.
src/Adodb/Db.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -177,16 +177,16 @@  discard block
 block discarded – undo
177 177
 			$this->queryId = $this->linkId->Execute($queryString);
178 178
 		}
179 179
 		catch (exception $e) {
180
-			$email = "MySQL Error<br>\n".'Query: '.$queryString . "<br>\n".'Error #'.print_r($e, TRUE) . "<br>\n".'Line: '.$line . "<br>\n".'File: '.$file . "<br>\n" . (isset($GLOBALS['tf']) ?
181
-					'User: '.$GLOBALS['tf']->session->account_id . "<br>\n" : '');
180
+			$email = "MySQL Error<br>\n".'Query: '.$queryString."<br>\n".'Error #'.print_r($e, TRUE)."<br>\n".'Line: '.$line."<br>\n".'File: '.$file."<br>\n".(isset($GLOBALS['tf']) ?
181
+					'User: '.$GLOBALS['tf']->session->account_id."<br>\n" : '');
182 182
 
183 183
 			$email .= '<br><br>Request Variables:<br>';
184 184
 			foreach ($_REQUEST as $key => $value)
185
-				$email .= $key.': '.$value . "<br>\n";
185
+				$email .= $key.': '.$value."<br>\n";
186 186
 
187 187
 			$email .= '<br><br>Server Variables:<br>';
188 188
 			foreach ($_SERVER as $key => $value)
189
-				$email .= $key.': '.$value . "<br>\n";
189
+				$email .= $key.': '.$value."<br>\n";
190 190
 			$subject = $_SERVER['HOSTNAME'].' MySQLi Error';
191 191
 			$headers = '';
192 192
 			$headers .= 'MIME-Version: 1.0'.PHP_EOL;
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 			admin_mail($subject, $email, $headers, FALSE, 'admin/sql_error.tpl');
197 197
 			$this->halt('Invalid SQL: '.$queryString, $line, $file);
198 198
 		}
199
-		$this->log("ADOdb Query $queryString (S:$success) - " . count($this->Rows).' Rows', __LINE__, __FILE__);
199
+		$this->log("ADOdb Query $queryString (S:$success) - ".count($this->Rows).' Rows', __LINE__, __FILE__);
200 200
 		$this->Row = 0;
201 201
 
202 202
 		// Will return nada if it fails. That's fine.
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 		if (isset($this->Rows[$pos])) {
233 233
 			$this->Row = $pos;
234 234
 		} else {
235
-			$this->halt("seek($pos) failed: result has " . count($this->Rows).' rows');
235
+			$this->halt("seek($pos) failed: result has ".count($this->Rows).' rows');
236 236
 			/* half assed attempt to save the day,
237 237
 			* but do not consider this documented or even
238 238
 			* desirable behaviour.
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
 	public function haltmsg($msg, $line = '', $file = '') {
375 375
 		$this->log("Database error: $msg", $line, $file, 'error');
376 376
 		if ($this->linkId->ErrorNo() != '0' && $this->linkId->ErrorMsg() != '')
377
-			$this->log('ADOdb SQL Error: ' . $this->linkId->ErrorMsg(), $line, $file, 'error');
377
+			$this->log('ADOdb SQL Error: '.$this->linkId->ErrorMsg(), $line, $file, 'error');
378 378
 		$this->logBackTrace($msg, $line, $file);
379 379
 	}
380 380
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -17,8 +17,7 @@  discard block
 block discarded – undo
17 17
  *
18 18
  * @access public
19 19
  */
20
-class Db extends Generic implements Db_Interface
21
-{
20
+class Db extends Generic implements Db_Interface {
22 21
 	public $driver = 'mysql';
23 22
 	public $Rows = [];
24 23
 	public $type = 'adodb';
@@ -172,11 +171,9 @@  discard block
 block discarded – undo
172 171
 
173 172
 		}
174 173
 
175
-		try
176
-		{
174
+		try {
177 175
 			$this->queryId = $this->linkId->Execute($queryString);
178
-		}
179
-		catch (exception $e) {
176
+		} catch (exception $e) {
180 177
 			$email = "MySQL Error<br>\n".'Query: '.$queryString . "<br>\n".'Error #'.print_r($e, TRUE) . "<br>\n".'Line: '.$line . "<br>\n".'File: '.$file . "<br>\n" . (isset($GLOBALS['tf']) ?
181 178
 					'User: '.$GLOBALS['tf']->session->account_id . "<br>\n" : '');
182 179
 
Please login to merge, or discard this patch.
src/Pgsql/Db.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	 */
33 33
 	public function ifadd($add, $me) {
34 34
 		if ('' != $add)
35
-			return ' '.$me . $add;
35
+			return ' '.$me.$add;
36 36
 		return '';
37 37
 	}
38 38
 
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 	 */
83 83
 	public function connect() {
84 84
 		if (0 == $this->linkId) {
85
-			$connectString = 'dbname='.$this->database . $this->ifadd($this->host, 'host=') . $this->ifadd($this->port, 'port=') . $this->ifadd($this->user, 'user=') . $this->ifadd("'" . $this->password . "'", 'password=');
85
+			$connectString = 'dbname='.$this->database.$this->ifadd($this->host, 'host=').$this->ifadd($this->port, 'port=').$this->ifadd($this->user, 'user=').$this->ifadd("'".$this->password."'", 'password=');
86 86
 			$this->linkId = pg_pconnect($connectString);
87 87
 
88 88
 			if (!$this->linkId) {
@@ -262,21 +262,21 @@  discard block
 block discarded – undo
262 262
 		* conditional code to the apps.
263 263
 		*/
264 264
 		if (!isset($table) || $table == '' || !isset($field) || $field == '')
265
-			return - 1;
265
+			return -1;
266 266
 
267 267
 		$oid = pg_getlastoid($this->queryId);
268 268
 		if ($oid == -1)
269
-			return - 1;
269
+			return -1;
270 270
 
271 271
 		$result = @pg_exec($this->linkId, "select $field from $table where oid=$oid");
272 272
 		if (!$result)
273
-			return - 1;
273
+			return -1;
274 274
 
275 275
 		$Record = @pg_fetch_array($result, 0);
276 276
 		@pg_freeresult($result);
277 277
 		if (!is_array($Record)) /* OID not found? */
278 278
 		{
279
-			return - 1;
279
+			return -1;
280 280
 		}
281 281
 
282 282
 		return $Record[0];
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,8 +17,7 @@
 block discarded – undo
17 17
  *
18 18
  * @access public
19 19
  */
20
-class Db extends Generic implements Db_Interface
21
-{
20
+class Db extends Generic implements Db_Interface {
22 21
 	/* public: this is an api revision, not a CVS revision. */
23 22
 	public $type = 'pgsql';
24 23
 	public $port = '5432';
Please login to merge, or discard this patch.