Completed
Push — master ( 3474b8...2a4221 )
by Yannick
08:49
created
require/class.Connection.php 1 patch
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -7,35 +7,35 @@  discard block
 block discarded – undo
7 7
 	public $latest_schema = 37;
8 8
 	
9 9
 	public function __construct($dbc = null,$dbname = null,$user = null,$pass = null) {
10
-	    global $globalDBdriver, $globalNoDB;
11
-	    if (isset($globalNoDB) && $globalNoDB === TRUE) {
10
+		global $globalDBdriver, $globalNoDB;
11
+		if (isset($globalNoDB) && $globalNoDB === TRUE) {
12 12
 		$this->db = null;
13
-	    } else {
13
+		} else {
14 14
 		if ($dbc === null) {
15
-		    if ($this->db === null && $dbname === null) {
15
+			if ($this->db === null && $dbname === null) {
16 16
 			if ($user === null && $pass === null) {
17
-			    $this->createDBConnection();
17
+				$this->createDBConnection();
18 18
 			} else {
19
-			    $this->createDBConnection(null,$user,$pass);
19
+				$this->createDBConnection(null,$user,$pass);
20 20
 			}
21
-		    } else {
21
+			} else {
22 22
 			$this->createDBConnection($dbname);
23
-		    }
23
+			}
24 24
 		} elseif ($dbname === null || $dbname === 'default') {
25
-	    	    $this->db = $dbc;
26
-	    	    if ($this->connectionExists() === false) {
25
+				$this->db = $dbc;
26
+				if ($this->connectionExists() === false) {
27 27
 			/*
28 28
 			echo 'Restart Connection !!!'."\n";
29 29
 			$e = new \Exception;
30 30
 			var_dump($e->getTraceAsString());
31 31
 			*/
32 32
 			$this->createDBConnection();
33
-		    }
33
+			}
34 34
 		} else {
35
-		    //$this->connectionExists();
36
-		    $this->dbs[$dbname] = $dbc;
35
+			//$this->connectionExists();
36
+			$this->dbs[$dbname] = $dbc;
37
+		}
37 38
 		}
38
-	    }
39 39
 	}
40 40
 
41 41
 	public function db() {
@@ -55,11 +55,11 @@  discard block
 block discarded – undo
55 55
 	}
56 56
 
57 57
 	/**
58
-	* Creates the database connection
59
-	*
60
-	* @return Boolean of the database connection
61
-	*
62
-	*/
58
+	 * Creates the database connection
59
+	 *
60
+	 * @return Boolean of the database connection
61
+	 *
62
+	 */
63 63
 
64 64
 	public function createDBConnection($DBname = null, $user = null, $pass = null)
65 65
 	{
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 			return false;
157 157
 		}
158 158
 		if($results->rowCount()>0) {
159
-		    return true; 
159
+			return true; 
160 160
 		}
161 161
 		else return false;
162 162
 	}
@@ -173,14 +173,14 @@  discard block
 block discarded – undo
173 173
 				$sum = $sum->fetchColumn(0);
174 174
 			} else $sum = 0;
175 175
 			if (intval($sum) !== 2) {
176
-			     return false;
176
+				 return false;
177 177
 			}
178 178
 			
179 179
 		} catch(PDOException $e) {
180 180
 			if($e->getCode() != 'HY000' || !stristr($e->getMessage(), 'server has gone away')) {
181
-            			throw $e;
182
-	                }
183
-	                //echo 'error ! '.$e->getMessage();
181
+						throw $e;
182
+					}
183
+					//echo 'error ! '.$e->getMessage();
184 184
 			return false;
185 185
 		}
186 186
 		return true; 
@@ -284,8 +284,8 @@  discard block
 block discarded – undo
284 284
 		$version = 0;
285 285
 		if ($this->tableExists('aircraft')) {
286 286
 			if (!$this->tableExists('config')) {
287
-	    			$version = '1';
288
-	    			return $version;
287
+					$version = '1';
288
+					return $version;
289 289
 			} else {
290 290
 				$query = "SELECT value FROM config WHERE name = 'schema_version' LIMIT 1";
291 291
 				try {
@@ -306,10 +306,10 @@  discard block
 block discarded – undo
306 306
 	* @return Boolean if latest version or not
307 307
 	*/
308 308
 	public function latest() {
309
-	    global $globalNoDB;
310
-	    if (isset($globalNoDB) && $globalNoDB === TRUE) return true;
311
-	    if ($this->check_schema_version() == $this->latest_schema) return true;
312
-	    else return false;
309
+		global $globalNoDB;
310
+		if (isset($globalNoDB) && $globalNoDB === TRUE) return true;
311
+		if ($this->check_schema_version() == $this->latest_schema) return true;
312
+		else return false;
313 313
 	}
314 314
 
315 315
 }
Please login to merge, or discard this patch.