@@ -13,8 +13,7 @@ |
||
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. |
@@ -17,8 +17,7 @@ discard block |
||
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'; |
@@ -32,8 +31,7 @@ discard block |
||
32 | 31 | * @param string $driver |
33 | 32 | * @return bool|\the |
34 | 33 | */ |
35 | - public function connect($database = '', $host = '', $user = '', $password = '', $driver = 'mysql') |
|
36 | - { |
|
34 | + public function connect($database = '', $host = '', $user = '', $password = '', $driver = 'mysql') { |
|
37 | 35 | /* Handle defaults */ |
38 | 36 | if ('' == $database) { |
39 | 37 | $database = $this->database; |
@@ -64,16 +62,14 @@ discard block |
||
64 | 62 | * Db::disconnect() |
65 | 63 | * @return void |
66 | 64 | */ |
67 | - public function disconnect() |
|
68 | - { |
|
65 | + public function disconnect() { |
|
69 | 66 | } |
70 | 67 | |
71 | 68 | /** |
72 | 69 | * @param $string |
73 | 70 | * @return string |
74 | 71 | */ |
75 | - public function real_escape($string = '') |
|
76 | - { |
|
72 | + public function real_escape($string = '') { |
|
77 | 73 | return escapeshellarg($string); |
78 | 74 | } |
79 | 75 | |
@@ -81,8 +77,7 @@ discard block |
||
81 | 77 | * discard the query result |
82 | 78 | * @return void |
83 | 79 | */ |
84 | - public function free() |
|
85 | - { |
|
80 | + public function free() { |
|
86 | 81 | // @mysql_free_result($this->queryId); |
87 | 82 | // $this->queryId = 0; |
88 | 83 | } |
@@ -98,8 +93,7 @@ discard block |
||
98 | 93 | * @param string $file optionally pass __FILE__ calling the query for logging |
99 | 94 | * @return mixed FALSE if no rows, if a single row it returns that, if multiple it returns an array of rows, associative responses only |
100 | 95 | */ |
101 | - public function queryReturn($query, $line = '', $file = '') |
|
102 | - { |
|
96 | + public function queryReturn($query, $line = '', $file = '') { |
|
103 | 97 | $this->query($query, $line, $file); |
104 | 98 | if ($this->num_rows() == 0) { |
105 | 99 | return false; |
@@ -125,8 +119,7 @@ discard block |
||
125 | 119 | * @param string $file optionally pass __FILE__ calling the query for logging |
126 | 120 | * @return mixed FALSE if no rows, if a single row it returns that, if multiple it returns an array of rows, associative responses only |
127 | 121 | */ |
128 | - public function qr($query, $line = '', $file = '') |
|
129 | - { |
|
122 | + public function qr($query, $line = '', $file = '') { |
|
130 | 123 | return $this->queryReturn($query, $line, $file); |
131 | 124 | } |
132 | 125 | |
@@ -140,8 +133,7 @@ discard block |
||
140 | 133 | * @param string $file |
141 | 134 | * @return mixed 0 if no query or query id handler, safe to ignore this return |
142 | 135 | */ |
143 | - public function query($queryString, $line = '', $file = '') |
|
144 | - { |
|
136 | + public function query($queryString, $line = '', $file = '') { |
|
145 | 137 | /* No empty queries, please, since PHP4 chokes on them. */ |
146 | 138 | /* The empty query string is passed on from the constructor, |
147 | 139 | * when calling the class without a query, e.g. in situations |
@@ -184,8 +176,7 @@ discard block |
||
184 | 176 | * @param mixed $resultType |
185 | 177 | * @return bool |
186 | 178 | */ |
187 | - public function next_record($resultType = MYSQL_ASSOC) |
|
188 | - { |
|
179 | + public function next_record($resultType = MYSQL_ASSOC) { |
|
189 | 180 | if (!$this->queryId) { |
190 | 181 | $this->halt('next_record called with no query pending.'); |
191 | 182 | return 0; |
@@ -206,8 +197,7 @@ discard block |
||
206 | 197 | * @param integer $pos |
207 | 198 | * @return int |
208 | 199 | */ |
209 | - public function seek($pos = 0) |
|
210 | - { |
|
200 | + public function seek($pos = 0) { |
|
211 | 201 | if (isset($this->Rows[$pos])) { |
212 | 202 | $this->Row = $pos; |
213 | 203 | } else { |
@@ -225,8 +215,7 @@ discard block |
||
225 | 215 | * Db::transactionBegin() |
226 | 216 | * @return bool |
227 | 217 | */ |
228 | - public function transactionBegin() |
|
229 | - { |
|
218 | + public function transactionBegin() { |
|
230 | 219 | return true; |
231 | 220 | } |
232 | 221 | |
@@ -234,8 +223,7 @@ discard block |
||
234 | 223 | * Db::transactionCommit() |
235 | 224 | * @return bool |
236 | 225 | */ |
237 | - public function transactionCommit() |
|
238 | - { |
|
226 | + public function transactionCommit() { |
|
239 | 227 | return true; |
240 | 228 | } |
241 | 229 | |
@@ -243,8 +231,7 @@ discard block |
||
243 | 231 | * Db::transactionAbort() |
244 | 232 | * @return bool |
245 | 233 | */ |
246 | - public function transactionAbort() |
|
247 | - { |
|
234 | + public function transactionAbort() { |
|
248 | 235 | return true; |
249 | 236 | } |
250 | 237 | |
@@ -255,8 +242,7 @@ discard block |
||
255 | 242 | * @param mixed $field |
256 | 243 | * @return mixed |
257 | 244 | */ |
258 | - public function getLastInsertId($table, $field) |
|
259 | - { |
|
245 | + public function getLastInsertId($table, $field) { |
|
260 | 246 | return $this->linkId->Insert_ID($table, $field); |
261 | 247 | } |
262 | 248 | |
@@ -268,8 +254,7 @@ discard block |
||
268 | 254 | * @param string $mode |
269 | 255 | * @return void |
270 | 256 | */ |
271 | - public function lock($table, $mode = 'write') |
|
272 | - { |
|
257 | + public function lock($table, $mode = 'write') { |
|
273 | 258 | /* $this->connect(); |
274 | 259 | |
275 | 260 | * $query = "lock tables "; |
@@ -306,8 +291,7 @@ discard block |
||
306 | 291 | * Db::unlock() |
307 | 292 | * @return void |
308 | 293 | */ |
309 | - public function unlock() |
|
310 | - { |
|
294 | + public function unlock() { |
|
311 | 295 | /* $this->connect(); |
312 | 296 | |
313 | 297 | * $res = @mysql_query("unlock tables"); |
@@ -327,8 +311,7 @@ discard block |
||
327 | 311 | * |
328 | 312 | * @return mixed |
329 | 313 | */ |
330 | - public function affectedRows() |
|
331 | - { |
|
314 | + public function affectedRows() { |
|
332 | 315 | return @$this->linkId->Affected_Rows(); |
333 | 316 | // return @$this->queryId->rowCount(); |
334 | 317 | } |
@@ -338,8 +321,7 @@ discard block |
||
338 | 321 | * |
339 | 322 | * @return mixed |
340 | 323 | */ |
341 | - public function num_rows() |
|
342 | - { |
|
324 | + public function num_rows() { |
|
343 | 325 | return $this->queryId->NumRows(); |
344 | 326 | } |
345 | 327 | |
@@ -348,8 +330,7 @@ discard block |
||
348 | 330 | * |
349 | 331 | * @return mixed |
350 | 332 | */ |
351 | - public function num_fields() |
|
352 | - { |
|
333 | + public function num_fields() { |
|
353 | 334 | return $this->queryId->NumCols(); |
354 | 335 | } |
355 | 336 | |
@@ -359,8 +340,7 @@ discard block |
||
359 | 340 | * @param string $file |
360 | 341 | * @return mixed|void |
361 | 342 | */ |
362 | - public function haltmsg($msg, $line = '', $file = '') |
|
363 | - { |
|
343 | + public function haltmsg($msg, $line = '', $file = '') { |
|
364 | 344 | $this->log("Database error: $msg", $line, $file, 'error'); |
365 | 345 | if ($this->linkId->ErrorNo() != '0' && $this->linkId->ErrorMsg() != '') { |
366 | 346 | $this->log('ADOdb SQL Error: '.$this->linkId->ErrorMsg(), $line, $file, 'error'); |
@@ -373,8 +353,7 @@ discard block |
||
373 | 353 | * |
374 | 354 | * @return array |
375 | 355 | */ |
376 | - public function tableNames() |
|
377 | - { |
|
356 | + public function tableNames() { |
|
378 | 357 | $return = []; |
379 | 358 | $this->query('SHOW TABLES'); |
380 | 359 | $i = 0; |
@@ -18,8 +18,7 @@ discard block |
||
18 | 18 | * |
19 | 19 | * @access public |
20 | 20 | */ |
21 | -class Db extends Generic implements Db_Interface |
|
22 | -{ |
|
21 | +class Db extends Generic implements Db_Interface { |
|
23 | 22 | /* public: connection parameters */ |
24 | 23 | public $driver = 'mysql'; |
25 | 24 | public $Rows = []; |
@@ -32,8 +31,7 @@ discard block |
||
32 | 31 | * @param string $database the name of the database to use |
33 | 32 | * @return void |
34 | 33 | */ |
35 | - public function selectDb($database) |
|
36 | - { |
|
34 | + public function selectDb($database) { |
|
37 | 35 | $dSN = "{$this->driver}:dbname={$database};host={$this->host}"; |
38 | 36 | if ($this->characterSet != '') { |
39 | 37 | $dSN .= ';charset='.$this->characterSet; |
@@ -49,8 +47,7 @@ discard block |
||
49 | 47 | * @param string $database the name of the database to use |
50 | 48 | * @return void |
51 | 49 | */ |
52 | - public function useDb($database) |
|
53 | - { |
|
50 | + public function useDb($database) { |
|
54 | 51 | $this->selectDb($database); |
55 | 52 | } |
56 | 53 | |
@@ -65,8 +62,7 @@ discard block |
||
65 | 62 | * @param string $driver |
66 | 63 | * @return bool|int|PDO |
67 | 64 | */ |
68 | - public function connect($database = '', $host = '', $user = '', $password = '', $driver = 'mysql') |
|
69 | - { |
|
65 | + public function connect($database = '', $host = '', $user = '', $password = '', $driver = 'mysql') { |
|
70 | 66 | /* Handle defaults */ |
71 | 67 | if ('' == $database) { |
72 | 68 | $database = $this->database; |
@@ -105,8 +101,7 @@ discard block |
||
105 | 101 | * Db::disconnect() |
106 | 102 | * @return void |
107 | 103 | */ |
108 | - public function disconnect() |
|
109 | - { |
|
104 | + public function disconnect() { |
|
110 | 105 | } |
111 | 106 | |
112 | 107 | /* public: discard the query result */ |
@@ -115,8 +110,7 @@ discard block |
||
115 | 110 | * Db::free() |
116 | 111 | * @return void |
117 | 112 | */ |
118 | - public function free() |
|
119 | - { |
|
113 | + public function free() { |
|
120 | 114 | // @mysql_free_result($this->queryId); |
121 | 115 | // $this->queryId = 0; |
122 | 116 | } |
@@ -131,8 +125,7 @@ discard block |
||
131 | 125 | * @param string $file |
132 | 126 | * @return mixed 0 if no query or query id handler, safe to ignore this return |
133 | 127 | */ |
134 | - public function query($queryString, $line = '', $file = '') |
|
135 | - { |
|
128 | + public function query($queryString, $line = '', $file = '') { |
|
136 | 129 | /* No empty queries, please, since PHP4 chokes on them. */ |
137 | 130 | /* The empty query string is passed on from the constructor, |
138 | 131 | * when calling the class without a query, e.g. in situations |
@@ -177,8 +170,7 @@ discard block |
||
177 | 170 | * @param mixed $resultType |
178 | 171 | * @return bool |
179 | 172 | */ |
180 | - public function next_record($resultType = MYSQLI_ASSOC) |
|
181 | - { |
|
173 | + public function next_record($resultType = MYSQLI_ASSOC) { |
|
182 | 174 | // PDO result types so far seem to be +1 |
183 | 175 | ++$resultType; |
184 | 176 | if (!$this->queryId) { |
@@ -203,8 +195,7 @@ discard block |
||
203 | 195 | * @param integer $pos |
204 | 196 | * @return int |
205 | 197 | */ |
206 | - public function seek($pos = 0) |
|
207 | - { |
|
198 | + public function seek($pos = 0) { |
|
208 | 199 | if (isset($this->Rows[$pos])) { |
209 | 200 | $this->Row = $pos; |
210 | 201 | } else { |
@@ -222,8 +213,7 @@ discard block |
||
222 | 213 | * Initiates a transaction |
223 | 214 | * @return bool |
224 | 215 | */ |
225 | - public function transactionBegin() |
|
226 | - { |
|
216 | + public function transactionBegin() { |
|
227 | 217 | return $this->linkId->beginTransaction(); |
228 | 218 | } |
229 | 219 | |
@@ -231,8 +221,7 @@ discard block |
||
231 | 221 | * Commits a transaction |
232 | 222 | * @return bool |
233 | 223 | */ |
234 | - public function transactionCommit() |
|
235 | - { |
|
224 | + public function transactionCommit() { |
|
236 | 225 | return $this->linkId->commit(); |
237 | 226 | } |
238 | 227 | |
@@ -240,8 +229,7 @@ discard block |
||
240 | 229 | * Rolls back a transaction |
241 | 230 | * @return bool |
242 | 231 | */ |
243 | - public function transactionAbort() |
|
244 | - { |
|
232 | + public function transactionAbort() { |
|
245 | 233 | return $this->linkId->rollBack(); |
246 | 234 | } |
247 | 235 | |
@@ -251,8 +239,7 @@ discard block |
||
251 | 239 | * @param mixed $field |
252 | 240 | * @return int |
253 | 241 | */ |
254 | - public function getLastInsertId($table, $field) |
|
255 | - { |
|
242 | + public function getLastInsertId($table, $field) { |
|
256 | 243 | if (!isset($table) || $table == '' || !isset($field) || $field == '') { |
257 | 244 | return -1; |
258 | 245 | } |
@@ -267,8 +254,7 @@ discard block |
||
267 | 254 | * @param string $mode |
268 | 255 | * @return void |
269 | 256 | */ |
270 | - public function lock($table, $mode = 'write') |
|
271 | - { |
|
257 | + public function lock($table, $mode = 'write') { |
|
272 | 258 | /* $this->connect(); |
273 | 259 | |
274 | 260 | * $query = "lock tables "; |
@@ -305,8 +291,7 @@ discard block |
||
305 | 291 | * Db::unlock() |
306 | 292 | * @return void |
307 | 293 | */ |
308 | - public function unlock() |
|
309 | - { |
|
294 | + public function unlock() { |
|
310 | 295 | /* $this->connect(); |
311 | 296 | |
312 | 297 | * $res = @mysql_query("unlock tables"); |
@@ -326,8 +311,7 @@ discard block |
||
326 | 311 | * |
327 | 312 | * @return mixed |
328 | 313 | */ |
329 | - public function affectedRows() |
|
330 | - { |
|
314 | + public function affectedRows() { |
|
331 | 315 | return @$this->queryId->rowCount(); |
332 | 316 | } |
333 | 317 | |
@@ -335,8 +319,7 @@ discard block |
||
335 | 319 | * Db::num_rows() |
336 | 320 | * @return int |
337 | 321 | */ |
338 | - public function num_rows() |
|
339 | - { |
|
322 | + public function num_rows() { |
|
340 | 323 | return count($this->Rows); |
341 | 324 | } |
342 | 325 | |
@@ -344,8 +327,7 @@ discard block |
||
344 | 327 | * Db::num_fields() |
345 | 328 | * @return int |
346 | 329 | */ |
347 | - public function num_fields() |
|
348 | - { |
|
330 | + public function num_fields() { |
|
349 | 331 | $keys = array_keys($this->Rows); |
350 | 332 | return count($this->Rows[$keys[0]]); |
351 | 333 | } |
@@ -356,8 +338,7 @@ discard block |
||
356 | 338 | * @param string $file |
357 | 339 | * @return mixed|void |
358 | 340 | */ |
359 | - public function haltmsg($msg, $line = '', $file = '') |
|
360 | - { |
|
341 | + public function haltmsg($msg, $line = '', $file = '') { |
|
361 | 342 | $this->log("Database error: $msg", $line, $file, 'error'); |
362 | 343 | if ($this->Errno != '0' || $this->Error != '()') { |
363 | 344 | $this->log('PDO MySQL Error: '.json_encode($this->linkId->errorInfo()), $line, $file, 'error'); |
@@ -370,8 +351,7 @@ discard block |
||
370 | 351 | * |
371 | 352 | * @return array |
372 | 353 | */ |
373 | - public function tableNames() |
|
374 | - { |
|
354 | + public function tableNames() { |
|
375 | 355 | $return = []; |
376 | 356 | $this->query('SHOW TABLES'); |
377 | 357 | foreach ($this->Rows as $i => $info) { |
@@ -14,8 +14,7 @@ discard block |
||
14 | 14 | * |
15 | 15 | * @package MyDb |
16 | 16 | */ |
17 | -class Loader |
|
18 | -{ |
|
17 | +class Loader { |
|
19 | 18 | /* public: connection parameters */ |
20 | 19 | public $Type = 'mysqli'; |
21 | 20 | public $host = 'localhost'; |
@@ -55,8 +54,7 @@ discard block |
||
55 | 54 | * @param string $host Optional The hostname where the server is, or default to localhost |
56 | 55 | * @param string $query Optional query to perform immediately |
57 | 56 | */ |
58 | - public function __construct($Type = '', $database = '', $user = '', $password = '', $host = 'localhost', $query = '') |
|
59 | - { |
|
57 | + public function __construct($Type = '', $database = '', $user = '', $password = '', $host = 'localhost', $query = '') { |
|
60 | 58 | $this->Type = $Type; |
61 | 59 | if (!defined('db')) { |
62 | 60 | switch ($this->Type) { |
@@ -97,8 +95,7 @@ discard block |
||
97 | 95 | * @param string $line |
98 | 96 | * @param string $file |
99 | 97 | */ |
100 | - public function log($message, $line = '', $file = '') |
|
101 | - { |
|
98 | + public function log($message, $line = '', $file = '') { |
|
102 | 99 | //if (function_exists('myadmin_log')) |
103 | 100 | //myadmin_log('db', 'info', $message, $line, $file, FALSE); |
104 | 101 | //else |
@@ -108,16 +105,14 @@ discard block |
||
108 | 105 | /** |
109 | 106 | * @return int |
110 | 107 | */ |
111 | - public function linkId() |
|
112 | - { |
|
108 | + public function linkId() { |
|
113 | 109 | return $this->linkId; |
114 | 110 | } |
115 | 111 | |
116 | 112 | /** |
117 | 113 | * @return int |
118 | 114 | */ |
119 | - public function queryId() |
|
120 | - { |
|
115 | + public function queryId() { |
|
121 | 116 | return $this->queryId; |
122 | 117 | } |
123 | 118 | |
@@ -125,8 +120,7 @@ discard block |
||
125 | 120 | * @param $str |
126 | 121 | * @return string |
127 | 122 | */ |
128 | - public function dbAddslashes($str) |
|
129 | - { |
|
123 | + public function dbAddslashes($str) { |
|
130 | 124 | if (!isset($str) || $str == '') { |
131 | 125 | return ''; |
132 | 126 | } |
@@ -144,8 +138,7 @@ discard block |
||
144 | 138 | * @param string $file optionally pass __FILE__ calling the query for logging |
145 | 139 | * @return mixed FALSE if no rows, if a single row it returns that, if multiple it returns an array of rows, associative responses only |
146 | 140 | */ |
147 | - public function qr($query, $line = '', $file = '') |
|
148 | - { |
|
141 | + public function qr($query, $line = '', $file = '') { |
|
149 | 142 | return $this->queryReturn($query, $line, $file); |
150 | 143 | } |
151 | 144 | |
@@ -157,8 +150,7 @@ discard block |
||
157 | 150 | * @param string $file |
158 | 151 | * @return void |
159 | 152 | */ |
160 | - public function halt($msg, $line = '', $file = '') |
|
161 | - { |
|
153 | + public function halt($msg, $line = '', $file = '') { |
|
162 | 154 | $this->unlock(false); |
163 | 155 | |
164 | 156 | if ($this->haltOnError == 'no') { |
@@ -184,8 +176,7 @@ discard block |
||
184 | 176 | /** |
185 | 177 | * @param $msg |
186 | 178 | */ |
187 | - public function haltmsg($msg) |
|
188 | - { |
|
179 | + public function haltmsg($msg) { |
|
189 | 180 | $this->log("Database error: $msg", __LINE__, __FILE__); |
190 | 181 | if ($this->Errno != '0' || $this->Error != '()') { |
191 | 182 | $this->log('SQL Error: '.$this->Errno.' ('.$this->Error.')', __LINE__, __FILE__); |
@@ -195,8 +186,7 @@ discard block |
||
195 | 186 | /** |
196 | 187 | * @return array |
197 | 188 | */ |
198 | - public function indexNames() |
|
199 | - { |
|
189 | + public function indexNames() { |
|
200 | 190 | return []; |
201 | 191 | } |
202 | 192 | } |
@@ -18,8 +18,7 @@ discard block |
||
18 | 18 | * |
19 | 19 | * @access public |
20 | 20 | */ |
21 | -class Db extends MysqliDb implements Db_Interface |
|
22 | -{ |
|
21 | +class Db extends MysqliDb implements Db_Interface { |
|
23 | 22 | public $host = 'localhost'; |
24 | 23 | public $user = 'pdns'; |
25 | 24 | public $password = ''; |
@@ -34,8 +33,7 @@ discard block |
||
34 | 33 | * @param string $type |
35 | 34 | * @return string |
36 | 35 | */ |
37 | - public function quote($text = '', $type = 'text') |
|
38 | - { |
|
36 | + public function quote($text = '', $type = 'text') { |
|
39 | 37 | switch ($type) { |
40 | 38 | case 'text': |
41 | 39 | return "'".$this->escape($text)."'"; |
@@ -57,8 +55,7 @@ discard block |
||
57 | 55 | * @param string $file |
58 | 56 | * @return bool |
59 | 57 | */ |
60 | - public function queryOne($query, $line = '', $file = '') |
|
61 | - { |
|
58 | + public function queryOne($query, $line = '', $file = '') { |
|
62 | 59 | $this->query($query, $line, $file); |
63 | 60 | if ($this->num_rows() > 0) { |
64 | 61 | $this->next_record(); |
@@ -76,8 +73,7 @@ discard block |
||
76 | 73 | * @param string $file |
77 | 74 | * @return array|bool |
78 | 75 | */ |
79 | - public function queryRow($query, $line = '', $file = '') |
|
80 | - { |
|
76 | + public function queryRow($query, $line = '', $file = '') { |
|
81 | 77 | $this->query($query, $line, $file); |
82 | 78 | if ($this->num_rows() > 0) { |
83 | 79 | $this->next_record(); |
@@ -93,8 +89,7 @@ discard block |
||
93 | 89 | * @param mixed $field |
94 | 90 | * @return int |
95 | 91 | */ |
96 | - public function lastInsertId($table, $field) |
|
97 | - { |
|
92 | + public function lastInsertId($table, $field) { |
|
98 | 93 | return $this->getLastInsertId($table, $field); |
99 | 94 | } |
100 | 95 | } |
@@ -17,8 +17,7 @@ discard block |
||
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 = ''; |
@@ -33,8 +32,7 @@ discard block |
||
33 | 32 | * @param false|string $quote optional indicate the value needs quoted |
34 | 33 | * @return string |
35 | 34 | */ |
36 | - public function ifadd($add, $me, $quote = false) |
|
37 | - { |
|
35 | + public function ifadd($add, $me, $quote = false) { |
|
38 | 36 | if ('' != $add) { |
39 | 37 | return ' '.$me.($quote === false ? '' : $quote).$add.($quote === false ? '' : $quote); |
40 | 38 | } |
@@ -45,8 +43,7 @@ discard block |
||
45 | 43 | * @param $string |
46 | 44 | * @return string |
47 | 45 | */ |
48 | - public function real_escape($string = '') |
|
49 | - { |
|
46 | + public function real_escape($string = '') { |
|
50 | 47 | return $this->escape($string); |
51 | 48 | } |
52 | 49 | |
@@ -56,8 +53,7 @@ discard block |
||
56 | 53 | * @param string $database the name of the database to use |
57 | 54 | * @return void |
58 | 55 | */ |
59 | - public function useDb($database) |
|
60 | - { |
|
56 | + public function useDb($database) { |
|
61 | 57 | $this->selectDb($database); |
62 | 58 | } |
63 | 59 | |
@@ -67,8 +63,7 @@ discard block |
||
67 | 63 | * @param string $database the name of the database to use |
68 | 64 | * @return void |
69 | 65 | */ |
70 | - public function selectDb($database) |
|
71 | - { |
|
66 | + public function selectDb($database) { |
|
72 | 67 | /*if ($database != $this->database) { |
73 | 68 | $this->database = $database; |
74 | 69 | $this->linkId = null; |
@@ -80,8 +75,7 @@ discard block |
||
80 | 75 | * Db::connect() |
81 | 76 | * @return void |
82 | 77 | */ |
83 | - public function connect() |
|
84 | - { |
|
78 | + public function connect() { |
|
85 | 79 | if (0 == $this->linkId) { |
86 | 80 | $connectString = trim($this->ifadd($this->host, 'host='). |
87 | 81 | $this->ifadd($this->port, 'port='). |
@@ -101,8 +95,7 @@ discard block |
||
101 | 95 | * Db::disconnect() |
102 | 96 | * @return bool |
103 | 97 | */ |
104 | - public function disconnect() |
|
105 | - { |
|
98 | + public function disconnect() { |
|
106 | 99 | return @pg_close($this->linkId); |
107 | 100 | } |
108 | 101 | |
@@ -117,8 +110,7 @@ discard block |
||
117 | 110 | * @param string $file optionally pass __FILE__ calling the query for logging |
118 | 111 | * @return mixed FALSE if no rows, if a single row it returns that, if multiple it returns an array of rows, associative responses only |
119 | 112 | */ |
120 | - public function queryReturn($query, $line = '', $file = '') |
|
121 | - { |
|
113 | + public function queryReturn($query, $line = '', $file = '') { |
|
122 | 114 | $this->query($query, $line, $file); |
123 | 115 | if ($this->num_rows() == 0) { |
124 | 116 | return false; |
@@ -144,8 +136,7 @@ discard block |
||
144 | 136 | * @param string $file optionally pass __FILE__ calling the query for logging |
145 | 137 | * @return mixed FALSE if no rows, if a single row it returns that, if multiple it returns an array of rows, associative responses only |
146 | 138 | */ |
147 | - public function qr($query, $line = '', $file = '') |
|
148 | - { |
|
139 | + public function qr($query, $line = '', $file = '') { |
|
149 | 140 | return $this->queryReturn($query, $line, $file); |
150 | 141 | } |
151 | 142 | |
@@ -159,8 +150,7 @@ discard block |
||
159 | 150 | * @param string $file |
160 | 151 | * @return mixed 0 if no query or query id handler, safe to ignore this return |
161 | 152 | */ |
162 | - public function query($queryString, $line = '', $file = '') |
|
163 | - { |
|
153 | + public function query($queryString, $line = '', $file = '') { |
|
164 | 154 | if (!$line && !$file) { |
165 | 155 | if (isset($GLOBALS['tf'])) { |
166 | 156 | $GLOBALS['tf']->warning(__LINE__, __FILE__, "Lazy developer didn't pass __LINE__ and __FILE__ to db->query() - Actually query: $queryString"); |
@@ -197,8 +187,7 @@ discard block |
||
197 | 187 | * |
198 | 188 | * @return void |
199 | 189 | */ |
200 | - public function free() |
|
201 | - { |
|
190 | + public function free() { |
|
202 | 191 | @pg_freeresult($this->queryId); |
203 | 192 | $this->queryId = 0; |
204 | 193 | } |
@@ -208,8 +197,7 @@ discard block |
||
208 | 197 | * @param mixed $resultType |
209 | 198 | * @return bool |
210 | 199 | */ |
211 | - public function next_record($resultType = PGSQL_BOTH) |
|
212 | - { |
|
200 | + public function next_record($resultType = PGSQL_BOTH) { |
|
213 | 201 | $this->Record = @pg_fetch_array($this->queryId, $this->Row++, $resultType); |
214 | 202 | |
215 | 203 | $this->Error = pg_errormessage($this->linkId); |
@@ -229,8 +217,7 @@ discard block |
||
229 | 217 | * @param mixed $pos |
230 | 218 | * @return void |
231 | 219 | */ |
232 | - public function seek($pos) |
|
233 | - { |
|
220 | + public function seek($pos) { |
|
234 | 221 | $this->Row = $pos; |
235 | 222 | } |
236 | 223 | |
@@ -239,8 +226,7 @@ discard block |
||
239 | 226 | * |
240 | 227 | * @return mixed |
241 | 228 | */ |
242 | - public function transactionBegin() |
|
243 | - { |
|
229 | + public function transactionBegin() { |
|
244 | 230 | return $this->query('begin'); |
245 | 231 | } |
246 | 232 | |
@@ -248,8 +234,7 @@ discard block |
||
248 | 234 | * Db::transactionCommit() |
249 | 235 | * @return bool|mixed |
250 | 236 | */ |
251 | - public function transactionCommit() |
|
252 | - { |
|
237 | + public function transactionCommit() { |
|
253 | 238 | if (!$this->Errno) { |
254 | 239 | return pg_exec($this->linkId, 'commit'); |
255 | 240 | } else { |
@@ -261,8 +246,7 @@ discard block |
||
261 | 246 | * Db::transactionAbort() |
262 | 247 | * @return mixed |
263 | 248 | */ |
264 | - public function transactionAbort() |
|
265 | - { |
|
249 | + public function transactionAbort() { |
|
266 | 250 | return pg_exec($this->linkId, 'rollback'); |
267 | 251 | } |
268 | 252 | |
@@ -272,8 +256,7 @@ discard block |
||
272 | 256 | * @param mixed $field |
273 | 257 | * @return int |
274 | 258 | */ |
275 | - public function getLastInsertId($table, $field) |
|
276 | - { |
|
259 | + public function getLastInsertId($table, $field) { |
|
277 | 260 | /* This will get the last insert ID created on the current connection. Should only be called |
278 | 261 | * after an insert query is run on a table that has an auto incrementing field. Of note, table |
279 | 262 | * and field are required because pgsql returns the last inserted OID, which is unique across |
@@ -310,8 +293,7 @@ discard block |
||
310 | 293 | * @param string $mode |
311 | 294 | * @return int|mixed |
312 | 295 | */ |
313 | - public function lock($table, $mode = 'write') |
|
314 | - { |
|
296 | + public function lock($table, $mode = 'write') { |
|
315 | 297 | $result = $this->transactionBegin(); |
316 | 298 | |
317 | 299 | if ($mode == 'write') { |
@@ -333,8 +315,7 @@ discard block |
||
333 | 315 | * Db::unlock() |
334 | 316 | * @return bool|mixed |
335 | 317 | */ |
336 | - public function unlock() |
|
337 | - { |
|
318 | + public function unlock() { |
|
338 | 319 | return $this->transactionCommit(); |
339 | 320 | } |
340 | 321 | |
@@ -342,8 +323,7 @@ discard block |
||
342 | 323 | * Db::affectedRows() |
343 | 324 | * @return void |
344 | 325 | */ |
345 | - public function affectedRows() |
|
346 | - { |
|
326 | + public function affectedRows() { |
|
347 | 327 | return pg_cmdtuples($this->queryId); |
348 | 328 | } |
349 | 329 | |
@@ -351,8 +331,7 @@ discard block |
||
351 | 331 | * Db::num_rows() |
352 | 332 | * @return int |
353 | 333 | */ |
354 | - public function num_rows() |
|
355 | - { |
|
334 | + public function num_rows() { |
|
356 | 335 | return pg_numrows($this->queryId); |
357 | 336 | } |
358 | 337 | |
@@ -360,8 +339,7 @@ discard block |
||
360 | 339 | * Db::num_fields() |
361 | 340 | * @return int |
362 | 341 | */ |
363 | - public function num_fields() |
|
364 | - { |
|
342 | + public function num_fields() { |
|
365 | 343 | return pg_numfields($this->queryId); |
366 | 344 | } |
367 | 345 | |
@@ -371,8 +349,7 @@ discard block |
||
371 | 349 | * @param string $file |
372 | 350 | * @return mixed|void |
373 | 351 | */ |
374 | - public function haltmsg($msg, $line = '', $file = '') |
|
375 | - { |
|
352 | + public function haltmsg($msg, $line = '', $file = '') { |
|
376 | 353 | $this->log("Database error: $msg", $line, $file, 'error'); |
377 | 354 | if ($this->Errno != '0' || $this->Error != '()') { |
378 | 355 | $this->log('PostgreSQL Error: '.pg_last_error($this->linkId), $line, $file, 'error'); |
@@ -385,8 +362,7 @@ discard block |
||
385 | 362 | * |
386 | 363 | * @return array |
387 | 364 | */ |
388 | - public function tableNames() |
|
389 | - { |
|
365 | + public function tableNames() { |
|
390 | 366 | $return = []; |
391 | 367 | $this->query("select relname from pg_class where relkind = 'r' and not relname like 'pg_%'"); |
392 | 368 | $i = 0; |
@@ -404,8 +380,7 @@ discard block |
||
404 | 380 | * |
405 | 381 | * @return array |
406 | 382 | */ |
407 | - public function indexNames() |
|
408 | - { |
|
383 | + public function indexNames() { |
|
409 | 384 | $return = []; |
410 | 385 | $this->query("SELECT relname FROM pg_class WHERE NOT relname ~ 'pg_.*' AND relkind ='i' ORDER BY relname"); |
411 | 386 | $i = 0; |
@@ -17,8 +17,7 @@ discard block |
||
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 | */ |
@@ -30,8 +29,7 @@ discard block |
||
30 | 29 | * @param string $database the name of the database to use |
31 | 30 | * @return void |
32 | 31 | */ |
33 | - public function useDb($database) |
|
34 | - { |
|
32 | + public function useDb($database) { |
|
35 | 33 | $this->selectDb($database); |
36 | 34 | } |
37 | 35 | |
@@ -41,8 +39,7 @@ discard block |
||
41 | 39 | * @param string $database the name of the database to use |
42 | 40 | * @return void |
43 | 41 | */ |
44 | - public function selectDb($database) |
|
45 | - { |
|
42 | + public function selectDb($database) { |
|
46 | 43 | $this->connect(); |
47 | 44 | mysqli_select_db($this->linkId, $database); |
48 | 45 | } |
@@ -57,8 +54,7 @@ discard block |
||
57 | 54 | * @param string $password |
58 | 55 | * @return int|\mysqli |
59 | 56 | */ |
60 | - public function connect($database = '', $host = '', $user = '', $password = '') |
|
61 | - { |
|
57 | + public function connect($database = '', $host = '', $user = '', $password = '') { |
|
62 | 58 | /* Handle defaults */ |
63 | 59 | if ($database == '') { |
64 | 60 | $database = $this->database; |
@@ -98,8 +94,7 @@ discard block |
||
98 | 94 | * Db::disconnect() |
99 | 95 | * @return bool |
100 | 96 | */ |
101 | - public function disconnect() |
|
102 | - { |
|
97 | + public function disconnect() { |
|
103 | 98 | $return = method_exists($this->linkId, 'close') ? $this->linkId->close() : false; |
104 | 99 | $this->linkId = 0; |
105 | 100 | return $return; |
@@ -109,8 +104,7 @@ discard block |
||
109 | 104 | * @param $string |
110 | 105 | * @return string |
111 | 106 | */ |
112 | - public function real_escape($string = '') |
|
113 | - { |
|
107 | + public function real_escape($string = '') { |
|
114 | 108 | if ((!is_resource($this->linkId) || $this->linkId == 0) && !$this->connect()) { |
115 | 109 | return $this->escape($string); |
116 | 110 | } |
@@ -121,8 +115,7 @@ discard block |
||
121 | 115 | * discard the query result |
122 | 116 | * @return void |
123 | 117 | */ |
124 | - public function free() |
|
125 | - { |
|
118 | + public function free() { |
|
126 | 119 | if (is_resource($this->queryId)) { |
127 | 120 | @mysqli_free_result($this->queryId); |
128 | 121 | } |
@@ -140,8 +133,7 @@ discard block |
||
140 | 133 | * @param string $file optionally pass __FILE__ calling the query for logging |
141 | 134 | * @return mixed FALSE if no rows, if a single row it returns that, if multiple it returns an array of rows, associative responses only |
142 | 135 | */ |
143 | - public function queryReturn($query, $line = '', $file = '') |
|
144 | - { |
|
136 | + public function queryReturn($query, $line = '', $file = '') { |
|
145 | 137 | $this->query($query, $line, $file); |
146 | 138 | if ($this->num_rows() == 0) { |
147 | 139 | return false; |
@@ -167,8 +159,7 @@ discard block |
||
167 | 159 | * @param string $file optionally pass __FILE__ calling the query for logging |
168 | 160 | * @return mixed FALSE if no rows, if a single row it returns that, if multiple it returns an array of rows, associative responses only |
169 | 161 | */ |
170 | - public function qr($query, $line = '', $file = '') |
|
171 | - { |
|
162 | + public function qr($query, $line = '', $file = '') { |
|
172 | 163 | return $this->queryReturn($query, $line, $file); |
173 | 164 | } |
174 | 165 | |
@@ -178,8 +169,7 @@ discard block |
||
178 | 169 | * @param string $query sql wuery like INSERT INTO table (col) VALUES (?) or SELECT * from table WHERE col1 = ? and col2 = ? or UPDATE table SET col1 = ?, col2 = ? WHERE col3 = ? |
179 | 170 | * @return int|\MyDb\Mysqli\mysqli_stmt |
180 | 171 | */ |
181 | - public function prepare($query) |
|
182 | - { |
|
172 | + public function prepare($query) { |
|
183 | 173 | if (!$this->connect()) { |
184 | 174 | return 0; |
185 | 175 | } |
@@ -198,8 +188,7 @@ discard block |
||
198 | 188 | * @param string $file |
199 | 189 | * @return mixed 0 if no query or query id handler, safe to ignore this return |
200 | 190 | */ |
201 | - public function query($queryString, $line = '', $file = '') |
|
202 | - { |
|
191 | + public function query($queryString, $line = '', $file = '') { |
|
203 | 192 | /* No empty queries, please, since PHP4 chokes on them. */ |
204 | 193 | /* The empty query string is passed on from the constructor, |
205 | 194 | * when calling the class without a query, e.g. in situations |
@@ -257,8 +246,7 @@ discard block |
||
257 | 246 | /** |
258 | 247 | * @return array|null|object |
259 | 248 | */ |
260 | - public function fetchObject() |
|
261 | - { |
|
249 | + public function fetchObject() { |
|
262 | 250 | $this->Record = @mysqli_fetch_object($this->queryId); |
263 | 251 | return $this->Record; |
264 | 252 | } |
@@ -271,8 +259,7 @@ discard block |
||
271 | 259 | * @param mixed $resultType |
272 | 260 | * @return bool |
273 | 261 | */ |
274 | - public function next_record($resultType = MYSQLI_BOTH) |
|
275 | - { |
|
262 | + public function next_record($resultType = MYSQLI_BOTH) { |
|
276 | 263 | if ($this->queryId === false) { |
277 | 264 | $this->haltmsg('next_record called with no query pending.'); |
278 | 265 | return 0; |
@@ -296,8 +283,7 @@ discard block |
||
296 | 283 | * @param integer $pos the row numbe starting at 0 to switch to |
297 | 284 | * @return bool whetherit was successfu or not. |
298 | 285 | */ |
299 | - public function seek($pos = 0) |
|
300 | - { |
|
286 | + public function seek($pos = 0) { |
|
301 | 287 | $status = @mysqli_data_seek($this->queryId, $pos); |
302 | 288 | if ($status) { |
303 | 289 | $this->Row = $pos; |
@@ -317,8 +303,7 @@ discard block |
||
317 | 303 | * |
318 | 304 | * @return bool |
319 | 305 | */ |
320 | - public function transactionBegin() |
|
321 | - { |
|
306 | + public function transactionBegin() { |
|
322 | 307 | if (version_compare(PHP_VERSION, '5.5.0') < 0) { |
323 | 308 | return true; |
324 | 309 | } |
@@ -333,8 +318,7 @@ discard block |
||
333 | 318 | * |
334 | 319 | * @return bool |
335 | 320 | */ |
336 | - public function transactionCommit() |
|
337 | - { |
|
321 | + public function transactionCommit() { |
|
338 | 322 | if (version_compare(PHP_VERSION, '5.5.0') < 0 || $this->linkId === 0) { |
339 | 323 | return true; |
340 | 324 | } |
@@ -346,8 +330,7 @@ discard block |
||
346 | 330 | * |
347 | 331 | * @return bool |
348 | 332 | */ |
349 | - public function transactionAbort() |
|
350 | - { |
|
333 | + public function transactionAbort() { |
|
351 | 334 | if (version_compare(PHP_VERSION, '5.5.0') < 0 || $this->linkId === 0) { |
352 | 335 | return true; |
353 | 336 | } |
@@ -363,8 +346,7 @@ discard block |
||
363 | 346 | * @param string $field |
364 | 347 | * @return int|string |
365 | 348 | */ |
366 | - public function getLastInsertId($table, $field) |
|
367 | - { |
|
349 | + public function getLastInsertId($table, $field) { |
|
368 | 350 | if (!isset($table) || $table == '' || !isset($field) || $field == '') { |
369 | 351 | return -1; |
370 | 352 | } |
@@ -380,8 +362,7 @@ discard block |
||
380 | 362 | * @param string $mode |
381 | 363 | * @return bool|int|\mysqli_result |
382 | 364 | */ |
383 | - public function lock($table, $mode = 'write') |
|
384 | - { |
|
365 | + public function lock($table, $mode = 'write') { |
|
385 | 366 | $this->connect(); |
386 | 367 | $query = 'lock tables '; |
387 | 368 | if (is_array($table)) { |
@@ -409,8 +390,7 @@ discard block |
||
409 | 390 | * @param bool $haltOnError optional, defaults to TRUE, whether or not to halt on error |
410 | 391 | * @return bool|int|\mysqli_result |
411 | 392 | */ |
412 | - public function unlock($haltOnError = true) |
|
413 | - { |
|
393 | + public function unlock($haltOnError = true) { |
|
414 | 394 | $this->connect(); |
415 | 395 | |
416 | 396 | $res = @mysqli_query($this->linkId, 'unlock tables'); |
@@ -427,8 +407,7 @@ discard block |
||
427 | 407 | * Db::affectedRows() |
428 | 408 | * @return int |
429 | 409 | */ |
430 | - public function affectedRows() |
|
431 | - { |
|
410 | + public function affectedRows() { |
|
432 | 411 | return @mysqli_affected_rows($this->linkId); |
433 | 412 | } |
434 | 413 | |
@@ -436,8 +415,7 @@ discard block |
||
436 | 415 | * Db::num_rows() |
437 | 416 | * @return int |
438 | 417 | */ |
439 | - public function num_rows() |
|
440 | - { |
|
418 | + public function num_rows() { |
|
441 | 419 | return @mysqli_num_rows($this->queryId); |
442 | 420 | } |
443 | 421 | |
@@ -445,8 +423,7 @@ discard block |
||
445 | 423 | * Db::num_fields() |
446 | 424 | * @return int |
447 | 425 | */ |
448 | - public function num_fields() |
|
449 | - { |
|
426 | + public function num_fields() { |
|
450 | 427 | return @mysqli_num_fields($this->queryId); |
451 | 428 | } |
452 | 429 | |
@@ -455,8 +432,7 @@ discard block |
||
455 | 432 | * |
456 | 433 | * @return array |
457 | 434 | */ |
458 | - public function tableNames() |
|
459 | - { |
|
435 | + public function tableNames() { |
|
460 | 436 | $return = []; |
461 | 437 | $this->query('SHOW TABLES'); |
462 | 438 | $i = 0; |
@@ -12,8 +12,7 @@ discard block |
||
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 = ''; |
@@ -63,8 +62,7 @@ discard block |
||
63 | 62 | * @param string $host Optional The hostname where the server is, or default to localhost |
64 | 63 | * @param string $query Optional query to perform immediately |
65 | 64 | */ |
66 | - public function __construct($database = '', $user = '', $password = '', $host = 'localhost', $query = '') |
|
67 | - { |
|
65 | + public function __construct($database = '', $user = '', $password = '', $host = 'localhost', $query = '') { |
|
68 | 66 | $this->database = $database; |
69 | 67 | $this->user = $user; |
70 | 68 | $this->password = $password; |
@@ -81,8 +79,7 @@ discard block |
||
81 | 79 | * @param string $file |
82 | 80 | * @return void |
83 | 81 | */ |
84 | - public function log($message, $line = '', $file = '', $level = 'info') |
|
85 | - { |
|
82 | + public function log($message, $line = '', $file = '', $level = 'info') { |
|
86 | 83 | //if (function_exists('myadmin_log')) |
87 | 84 | //myadmin_log('db', $level, $message, $line, $file, isset($GLOBALS['tf'])); |
88 | 85 | //else |
@@ -92,16 +89,14 @@ discard block |
||
92 | 89 | /** |
93 | 90 | * @return int|object |
94 | 91 | */ |
95 | - public function linkId() |
|
96 | - { |
|
92 | + public function linkId() { |
|
97 | 93 | return $this->linkId; |
98 | 94 | } |
99 | 95 | |
100 | 96 | /** |
101 | 97 | * @return int|object |
102 | 98 | */ |
103 | - public function queryId() |
|
104 | - { |
|
99 | + public function queryId() { |
|
105 | 100 | return $this->queryId; |
106 | 101 | } |
107 | 102 | |
@@ -109,8 +104,7 @@ discard block |
||
109 | 104 | * @param $string |
110 | 105 | * @return string |
111 | 106 | */ |
112 | - public function real_escape($string = '') |
|
113 | - { |
|
107 | + public function real_escape($string = '') { |
|
114 | 108 | if ((!is_resource($this->linkId) || $this->linkId == 0) && !$this->connect()) { |
115 | 109 | return $this->escape($string); |
116 | 110 | } |
@@ -121,8 +115,7 @@ discard block |
||
121 | 115 | * @param $string |
122 | 116 | * @return string |
123 | 117 | */ |
124 | - public function escape($string = '') |
|
125 | - { |
|
118 | + public function escape($string = '') { |
|
126 | 119 | //if (function_exists('mysql_escape_string')) |
127 | 120 | //return mysql_escape_string($string); |
128 | 121 | return str_replace(array('\\', "\0", "\n", "\r", "'", '"', "\x1a"), array('\\\\', '\\0', '\\n', '\\r', "\\'", '\\"', '\\Z'), $string); |
@@ -132,8 +125,7 @@ discard block |
||
132 | 125 | * @param mixed $str |
133 | 126 | * @return string |
134 | 127 | */ |
135 | - public function dbAddslashes($str = '') |
|
136 | - { |
|
128 | + public function dbAddslashes($str = '') { |
|
137 | 129 | if (!isset($str) || $str == '') { |
138 | 130 | return ''; |
139 | 131 | } |
@@ -145,8 +137,7 @@ discard block |
||
145 | 137 | * @param mixed $epoch |
146 | 138 | * @return bool|string |
147 | 139 | */ |
148 | - public function toTimestamp($epoch) |
|
149 | - { |
|
140 | + public function toTimestamp($epoch) { |
|
150 | 141 | return date('Y-m-d H:i:s', $epoch); |
151 | 142 | } |
152 | 143 | |
@@ -155,8 +146,7 @@ discard block |
||
155 | 146 | * @param mixed $timestamp |
156 | 147 | * @return bool|int|mixed |
157 | 148 | */ |
158 | - public function fromTimestamp($timestamp) |
|
159 | - { |
|
149 | + public function fromTimestamp($timestamp) { |
|
160 | 150 | if (preg_match('/([0-9]{4})-([0-9]{2})-([0-9]{2}) ([0-9]{2}):([0-9]{2}):([0-9]{2})/', $timestamp, $parts)) { |
161 | 151 | $time = mktime($parts[4], $parts[5], $parts[6], $parts[2], $parts[3], $parts[1]); |
162 | 152 | } elseif (preg_match('/([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})/', $timestamp, $parts)) { |
@@ -182,8 +172,7 @@ discard block |
||
182 | 172 | * @param string $file |
183 | 173 | * @return mixed |
184 | 174 | */ |
185 | - public function limitQuery($queryString, $numRows = '', $offset = 0, $line = '', $file = '') |
|
186 | - { |
|
175 | + public function limitQuery($queryString, $numRows = '', $offset = 0, $line = '', $file = '') { |
|
187 | 176 | if (!$numRows) { |
188 | 177 | $numRows = $this->maxMatches; |
189 | 178 | } |
@@ -210,8 +199,7 @@ discard block |
||
210 | 199 | * @param string $file optionally pass __FILE__ calling the query for logging |
211 | 200 | * @return mixed FALSE if no rows, if a single row it returns that, if multiple it returns an array of rows, associative responses only |
212 | 201 | */ |
213 | - public function qr($query, $line = '', $file = '') |
|
214 | - { |
|
202 | + public function qr($query, $line = '', $file = '') { |
|
215 | 203 | return $this->queryReturn($query, $line, $file); |
216 | 204 | } |
217 | 205 | |
@@ -222,8 +210,7 @@ discard block |
||
222 | 210 | * @param string $stripSlashes |
223 | 211 | * @return string |
224 | 212 | */ |
225 | - public function f($name, $stripSlashes = '') |
|
226 | - { |
|
213 | + public function f($name, $stripSlashes = '') { |
|
227 | 214 | if ($stripSlashes || ($this->autoStripslashes && !$stripSlashes)) { |
228 | 215 | return stripslashes($this->Record[$name]); |
229 | 216 | } else { |
@@ -239,8 +226,7 @@ discard block |
||
239 | 226 | * @param string $file |
240 | 227 | * @return void |
241 | 228 | */ |
242 | - public function halt($msg, $line = '', $file = '') |
|
243 | - { |
|
229 | + public function halt($msg, $line = '', $file = '') { |
|
244 | 230 | $this->unlock(false); |
245 | 231 | /* Just in case there is a table currently locked */ |
246 | 232 | |
@@ -268,8 +254,7 @@ discard block |
||
268 | 254 | * @param string $file |
269 | 255 | * @return mixed|void |
270 | 256 | */ |
271 | - public function logBackTrace($msg, $line = '', $file = '') |
|
272 | - { |
|
257 | + public function logBackTrace($msg, $line = '', $file = '') { |
|
273 | 258 | $backtrace = (function_exists('debug_backtrace') ? debug_backtrace() : []); |
274 | 259 | $this->log( |
275 | 260 | ('' !== getenv('REQUEST_URI') ? ' '.getenv('REQUEST_URI') : ''). |
@@ -296,8 +281,7 @@ discard block |
||
296 | 281 | } |
297 | 282 | } |
298 | 283 | |
299 | - public function emailError($queryString, $error, $line, $file) |
|
300 | - { |
|
284 | + public function emailError($queryString, $error, $line, $file) { |
|
301 | 285 | $email = $this->type." Error<br>\n".'Query: '.$queryString."<br>\n".$error."<br>\n".'Line: '.$line."<br>\n".'File: '.$file."<br>\n".(isset($GLOBALS['tf']) ? 'User: '.$GLOBALS['tf']->session->account_id."<br>\n" : ''); |
302 | 286 | $email .= '<br><br>Request Variables:<br>'.print_r($_REQUEST, true); |
303 | 287 | $email .= '<br><br>Server Variables:<br>'.print_r($_SERVER, true); |
@@ -318,8 +302,7 @@ discard block |
||
318 | 302 | * @param string $file |
319 | 303 | * @return mixed|void |
320 | 304 | */ |
321 | - public function haltmsg($msg, $line = '', $file = '') |
|
322 | - { |
|
305 | + public function haltmsg($msg, $line = '', $file = '') { |
|
323 | 306 | $this->log("Database error: $msg", $line, $file, 'error'); |
324 | 307 | if ($this->Errno != '0' || !in_array($this->Error, ['', '()'])) { |
325 | 308 | $sqlstate = mysqli_sqlstate($this->linkId); |
@@ -331,8 +314,7 @@ discard block |
||
331 | 314 | /** |
332 | 315 | * @return array |
333 | 316 | */ |
334 | - public function indexNames() |
|
335 | - { |
|
317 | + public function indexNames() { |
|
336 | 318 | return []; |
337 | 319 | } |
338 | 320 | } |