Completed
Branch master (bb0af6)
by Diego
03:15
created
_post/ez_sql_core.php 1 patch
Braces   +14 added lines, -16 removed lines patch added patch discarded remove patch
@@ -234,8 +234,7 @@  discard block
 block discarded – undo
234 234
 			if ( $output == OBJECT )
235 235
 			{
236 236
 				return $this->last_result;
237
-			}
238
-			elseif ( $output == ARRAY_A || $output == ARRAY_N )
237
+			} elseif ( $output == ARRAY_A || $output == ARRAY_N )
239 238
 			{
240 239
 				if ( $this->last_result )
241 240
 				{
@@ -254,8 +253,7 @@  discard block
 block discarded – undo
254 253
 					}
255 254
 
256 255
 					return $new_array;
257
-				}
258
-				else
256
+				} else
259 257
 				{
260 258
 					return array();
261 259
 				}
@@ -282,8 +280,7 @@  discard block
 block discarded – undo
282 280
 						$i++;
283 281
 					}
284 282
 					return $new_array;
285
-				}
286
-				else
283
+				} else
287 284
 				{
288 285
 					return $this->col_info[$col_offset]->{$info_type};
289 286
 				}
@@ -309,8 +306,7 @@  discard block
 block discarded – undo
309 306
 				{
310 307
 					$this->register_error("Could not open cache dir: $this->cache_dir");
311 308
 					$this->show_errors ? trigger_error("Could not open cache dir: $this->cache_dir",E_USER_WARNING) : null;
312
-				}
313
-				else
309
+				} else
314 310
 				{
315 311
 					// Cache all result values
316 312
 					$result_cache = array
@@ -321,8 +317,9 @@  discard block
 block discarded – undo
321 317
 						'return_value' => $this->num_rows,
322 318
 					);
323 319
 					file_put_contents($cache_file, serialize($result_cache));
324
-					if( file_exists($cache_file . ".updating") )
325
-						unlink($cache_file . ".updating");
320
+					if( file_exists($cache_file . ".updating") ) {
321
+											unlink($cache_file . ".updating");
322
+					}
326 323
 				}
327 324
 			}
328 325
 
@@ -346,8 +343,7 @@  discard block
 block discarded – undo
346 343
 					!(file_exists($cache_file . ".updating") && (time() - filemtime($cache_file . ".updating") < 60)) )
347 344
 				{
348 345
 					touch($cache_file . ".updating"); // Show that we in the process of updating the cache
349
-				}
350
-				else
346
+				} else
351 347
 				{
352 348
 					$result_cache = unserialize(file_get_contents($cache_file));
353 349
 
@@ -603,10 +599,12 @@  discard block
 block discarded – undo
603 599
 			$sql = array();
604 600
 			foreach ( $params as $field => $val )
605 601
 			{
606
-				if ( $val === 'true' || $val === true )
607
-					$val = 1;
608
-				if ( $val === 'false' || $val === false )
609
-					$val = 0;
602
+				if ( $val === 'true' || $val === true ) {
603
+									$val = 1;
604
+				}
605
+				if ( $val === 'false' || $val === false ) {
606
+									$val = 0;
607
+				}
610 608
 
611 609
 				switch( $val ){
612 610
 					case 'NOW()' :
Please login to merge, or discard this patch.
_post/ez_sql_mysqli.php 1 patch
Braces   +17 added lines, -11 removed lines patch added patch discarded remove patch
@@ -27,8 +27,12 @@  discard block
 block discarded – undo
27 27
 	*  ezSQL Database specific class - mySQLi
28 28
 	*/
29 29
 
30
-	if ( ! function_exists ('mysqli_connect') ) die('<b>Fatal Error:</b> ezSQL_mysql requires mySQLi Lib to be compiled and or linked in to the PHP engine');
31
-	if ( ! class_exists ('ezSQLcore') ) die('<b>Fatal Error:</b> ezSQL_mysql requires ezSQLcore (ez_sql_core.php) to be included/loaded before it can be used');
30
+	if ( ! function_exists ('mysqli_connect') ) {
31
+		die('<b>Fatal Error:</b> ezSQL_mysql requires mySQLi Lib to be compiled and or linked in to the PHP engine');
32
+	}
33
+	if ( ! class_exists ('ezSQLcore') ) {
34
+		die('<b>Fatal Error:</b> ezSQL_mysql requires ezSQLcore (ez_sql_core.php) to be included/loaded before it can be used');
35
+	}
32 36
 
33 37
 	class ezSQL_mysqli extends ezSQLcore
34 38
 	{
@@ -65,7 +69,9 @@  discard block
 block discarded – undo
65 69
 			$return_val = false;
66 70
 			if ( ! $this->connect($dbuser, $dbpassword, $dbhost, $dbport) ) ;
67 71
 			else if ( ! $this->select($dbname,$encoding) ) ;
68
-			else $return_val = true;
72
+			else {
73
+				$return_val = true;
74
+			}
69 75
 			return $return_val;
70 76
 		}
71 77
 
@@ -103,8 +109,7 @@  discard block
 block discarded – undo
103 109
 				{
104 110
 					$this->register_error($ezsql_mysqli_str[2].' in '.__FILE__.' on line '.__LINE__);
105 111
 					$this->show_errors ? trigger_error($ezsql_mysqli_str[2],E_USER_WARNING) : null;
106
-				}
107
-				else
112
+				} else
108 113
 				{
109 114
 					$this->dbuser = $dbuser;
110 115
 					$this->dbpassword = $dbpassword;
@@ -145,13 +150,13 @@  discard block
 block discarded – undo
145 150
 			else if ( !@$this->dbh->select_db($dbname) )
146 151
 			{
147 152
 				// Try to get error supplied by mysql if not use our own
148
-				if ( !$str = @$this->dbh->error)
149
-					  $str = $ezsql_mysqli_str[5];
153
+				if ( !$str = @$this->dbh->error) {
154
+									  $str = $ezsql_mysqli_str[5];
155
+				}
150 156
 
151 157
 				$this->register_error($str.' in '.__FILE__.' on line '.__LINE__);
152 158
 				$this->show_errors ? trigger_error($str,E_USER_WARNING) : null;
153
-			}
154
-			else
159
+			} else
155 160
 			{
156 161
 				$this->dbname = $dbname;
157 162
 				if($encoding!='')
@@ -261,8 +266,9 @@  discard block
 block discarded – undo
261 266
 				$this->connect($this->dbuser, $this->dbpassword, $this->dbhost, $this->dbport);
262 267
 				$this->select($this->dbname,$this->encoding);
263 268
 				// No existing connection at this point means the server is unreachable
264
-				if ( ! isset($this->dbh) || ! $this->dbh || $this->dbh->connect_errno )
265
-					return false;
269
+				if ( ! isset($this->dbh) || ! $this->dbh || $this->dbh->connect_errno ) {
270
+									return false;
271
+				}
266 272
 			}
267 273
 
268 274
 			// Perform the query via std mysql_query function..
Please login to merge, or discard this patch.