@@ -24,6 +24,9 @@ |
||
24 | 24 | private $_messages = array(); |
25 | 25 | private $_errors = array(); |
26 | 26 | |
27 | + /** |
|
28 | + * @param null|Route $tpl |
|
29 | + */ |
|
27 | 30 | public function __construct($tpl) { |
28 | 31 | if (!empty($tpl)) { |
29 | 32 | if (is_string($tpl)) { |
@@ -271,7 +271,6 @@ discard block |
||
271 | 271 | * Return parameters from the statment with dynamic number of parameters. |
272 | 272 | * |
273 | 273 | * @param resource $stmt Statement. |
274 | - * @param array $params Parameters. |
|
275 | 274 | */ |
276 | 275 | public static function bindResults($stmt) { |
277 | 276 | $resultSet = array(); |
@@ -769,7 +768,7 @@ discard block |
||
769 | 768 | /** |
770 | 769 | * Executes SQL query with single record and value result and return this value. |
771 | 770 | * |
772 | - * @param mixed $query SQL query template string or DBPreparedQuery object |
|
771 | + * @param string $query SQL query template string or DBPreparedQuery object |
|
773 | 772 | * if single parameter. |
774 | 773 | * @param string $types Types string (ex: "isdb"). |
775 | 774 | * @param array $params Parameters in the same order like types string. |
@@ -598,7 +598,7 @@ |
||
598 | 598 | public static function deleteDBObject($dbObject) { |
599 | 599 | if (!empty($dbObject) && is_object($dbObject)) { |
600 | 600 | $query = "DELETE FROM " . $dbObject->getTableName() . |
601 | - " WHERE " . $dbObject->getIdFieldName() . " = ? LIMIT 1"; |
|
601 | + " WHERE " . $dbObject->getIdFieldName() . " = ? LIMIT 1"; |
|
602 | 602 | if (Tools::isInteger($dbObject->getId())) { |
603 | 603 | $typesString = "i"; |
604 | 604 | } else { |
@@ -472,13 +472,13 @@ discard block |
||
472 | 472 | $extra = trim($attributes['extra']); |
473 | 473 | $comment = trim($attributes['comment']); |
474 | 474 | |
475 | - $fieldStr= "'" . $field . "' => "; |
|
475 | + $fieldStr = "'" . $field . "' => "; |
|
476 | 476 | if ($attributes['null'] === 'YES' && is_null($attributes['default'])) { |
477 | - $fieldStr.= "null"; |
|
477 | + $fieldStr .= "null"; |
|
478 | 478 | } else { |
479 | - $fieldStr.= self::getPrintableSQLValue($attributes['type'], $attributes['default']); |
|
479 | + $fieldStr .= self::getPrintableSQLValue($attributes['type'], $attributes['default']); |
|
480 | 480 | } |
481 | - $fieldStr.= ", // " . $attributes['type'] . |
|
481 | + $fieldStr .= ", // " . $attributes['type'] . |
|
482 | 482 | ", " . (($attributes['null'] == "NO") ? "not null" : "null") |
483 | 483 | . ", default '" . $attributes['default'] . "'" . |
484 | 484 | ($extra ? ", " . $extra : "") . |
@@ -573,9 +573,9 @@ discard block |
||
573 | 573 | LIMIT 1"; |
574 | 574 | $typesString = DBPreparedQuery::sqlTypesString($fieldsList, $idFieldName); |
575 | 575 | if (Tools::isInteger($fieldsList[$idFieldName])) { |
576 | - $typesString.= "i"; |
|
576 | + $typesString .= "i"; |
|
577 | 577 | } else { |
578 | - $typesString.= "s"; |
|
578 | + $typesString .= "s"; |
|
579 | 579 | } |
580 | 580 | $valuesList = self::createValuesList($fieldsList, $idFieldName); |
581 | 581 | $valuesList[] = $dbObject->getId(); |
@@ -917,7 +917,7 @@ discard block |
||
917 | 917 | throw new DBCoreException("Class with name '" . $className . "' is not exists"); |
918 | 918 | } |
919 | 919 | |
920 | - $query = "UPDATE " . $dbObject->getTableName() . " SET `" . $activationFieldName . "` = '" . $activationValue ."' |
|
920 | + $query = "UPDATE " . $dbObject->getTableName() . " SET `" . $activationFieldName . "` = '" . $activationValue . "' |
|
921 | 921 | WHERE " . $dbObject->getIdFieldName() . " IN (" . DBPreparedQuery::sqlQMString($itemsNumber) . ")"; |
922 | 922 | |
923 | 923 | return self::doUpdateQuery($query, $types, $idsList); |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | /** |
53 | 53 | * Sets primary key value. |
54 | 54 | * |
55 | - * @param mixed $recordId Key vaue. |
|
55 | + * @param integer $recordId Key vaue. |
|
56 | 56 | * |
57 | - * @return boolean Success flag. |
|
57 | + * @return DBObject Success flag. |
|
58 | 58 | * @throws DBCoreException If object has no field with such name. |
59 | 59 | */ |
60 | 60 | public function setId($recordId) { |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | /** |
496 | 496 | * Deletes DB record for current DBObject. |
497 | 497 | * |
498 | - * @return mixed Number of affected rows (1 if some record was deleted, |
|
498 | + * @return integer Number of affected rows (1 if some record was deleted, |
|
499 | 499 | * 0 - if no) or FALSE if some error occurred. |
500 | 500 | */ |
501 | 501 | public function delete() { |
@@ -414,11 +414,11 @@ discard block |
||
414 | 414 | */ |
415 | 415 | if ($this->isNewRecord()) { |
416 | 416 | if (!empty($this->dbQuery->conditions)) { |
417 | - $this->dbQuery->query.= " WHERE "; |
|
417 | + $this->dbQuery->query .= " WHERE "; |
|
418 | 418 | $this->dbQuery->sqlPushValues($this->dbQuery->conditions, " AND "); |
419 | 419 | } |
420 | 420 | } else { |
421 | - $this->dbQuery->query.= " WHERE "; |
|
421 | + $this->dbQuery->query .= " WHERE "; |
|
422 | 422 | $this->dbQuery->sqlPushValues([static::ID_FIELD_NAME => $this->id]); |
423 | 423 | } |
424 | 424 | |
@@ -427,14 +427,14 @@ discard block |
||
427 | 427 | */ |
428 | 428 | if ($this->isNewRecord()) { |
429 | 429 | if (!empty($this->dbQuery->order)) { |
430 | - $this->dbQuery->query.= " ORDER BY"; |
|
430 | + $this->dbQuery->query .= " ORDER BY"; |
|
431 | 431 | if (is_array($this->dbQuery->order)) { |
432 | 432 | foreach ($this->dbQuery->order as $fieldName => $ord) { |
433 | - $this->dbQuery->query.= " " . $fieldName . " " . $ord . ","; |
|
433 | + $this->dbQuery->query .= " " . $fieldName . " " . $ord . ","; |
|
434 | 434 | } |
435 | 435 | $this->dbQuery->query = substr($this->dbQuery->query, 0, strlen($this->dbQuery->query) - 1); |
436 | 436 | } elseif (is_string($this->dbQuery->order)) { |
437 | - $this->dbQuery->query.= " " . $this->dbQuery->order; |
|
437 | + $this->dbQuery->query .= " " . $this->dbQuery->order; |
|
438 | 438 | } |
439 | 439 | } |
440 | 440 | } |
@@ -446,13 +446,13 @@ discard block |
||
446 | 446 | if ($this->isNewRecord()) { |
447 | 447 | if (!is_null($this->dbQuery->limit)) { |
448 | 448 | if (Tools::isInteger($this->dbQuery->limit)) { |
449 | - $this->dbQuery->query.= " LIMIT " . $this->dbQuery->limit; |
|
449 | + $this->dbQuery->query .= " LIMIT " . $this->dbQuery->limit; |
|
450 | 450 | $count = $this->dbQuery->limit; |
451 | 451 | } elseif (is_array($this->dbQuery->limit) && count($this->dbQuery->limit) == 2) { |
452 | 452 | $offset = $this->dbQuery->limit[0]; |
453 | 453 | $count = $this->dbQuery->limit[1]; |
454 | 454 | if (Tools::isInteger($offset) && Tools::isInteger($count)) { |
455 | - $this->dbQuery->query.= " LIMIT " . $offset . ", " . $count; |
|
455 | + $this->dbQuery->query .= " LIMIT " . $offset . ", " . $count; |
|
456 | 456 | } else { |
457 | 457 | throw new DBCoreException("Invalid LIMIT param in select() method."); |
458 | 458 | } |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | } |
462 | 462 | } |
463 | 463 | } else { |
464 | - $this->dbQuery->query.= " LIMIT 1"; |
|
464 | + $this->dbQuery->query .= " LIMIT 1"; |
|
465 | 465 | $count = 1; |
466 | 466 | } |
467 | 467 |
@@ -42,6 +42,9 @@ |
||
42 | 42 | */ |
43 | 43 | private $dbObject = null; |
44 | 44 | |
45 | + /** |
|
46 | + * @param string $className |
|
47 | + */ |
|
45 | 48 | public function __construct($className) { |
46 | 49 | if (is_object($className)) { |
47 | 50 | $className = get_class($className); |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | */ |
104 | 104 | public function selectDBObject($debug = false) { |
105 | 105 | $query = "SELECT * FROM " . $this->dbObject->getTableName() . |
106 | - ($this->conditions != ""?" WHERE " . $this->conditions:"") . " LIMIT 1"; |
|
106 | + ($this->conditions != ""?" WHERE " . $this->conditions:"") . " LIMIT 1"; |
|
107 | 107 | |
108 | 108 | if (!$debug) { |
109 | 109 | $stmt = DBCore::doSelectQuery($query); |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | return $this->selectDBObject(); |
384 | 384 | } |
385 | 385 | |
386 | - /* |
|
386 | + /* |
|
387 | 387 | * Try to call parent method __call() with same params by default |
388 | 388 | */ |
389 | 389 | $method = substr($methodName, 0, 3); |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | */ |
104 | 104 | public function selectDBObject($debug = false) { |
105 | 105 | $query = "SELECT * FROM " . $this->dbObject->getTableName() . |
106 | - ($this->conditions != ""?" WHERE " . $this->conditions:"") . " LIMIT 1"; |
|
106 | + ($this->conditions != "" ? " WHERE " . $this->conditions : "") . " LIMIT 1"; |
|
107 | 107 | |
108 | 108 | if (!$debug) { |
109 | 109 | $stmt = DBCore::doSelectQuery($query); |
@@ -136,8 +136,8 @@ discard block |
||
136 | 136 | $query .= " AND " . $this->conditions; |
137 | 137 | } |
138 | 138 | |
139 | - $query.= $this->getQueryOrderSQL(); |
|
140 | - $query.= " LIMIT 1"; |
|
139 | + $query .= $this->getQueryOrderSQL(); |
|
140 | + $query .= " LIMIT 1"; |
|
141 | 141 | |
142 | 142 | $fieldType = DBField::getType($fieldValue); |
143 | 143 | if (!$debug) { |
@@ -178,14 +178,14 @@ discard block |
||
178 | 178 | * @return array<DBObject> |
179 | 179 | */ |
180 | 180 | public function selectDBObjects($debug = false) { |
181 | - $query = "SELECT" . ($this->unique?" DISTINCT":"") . " * FROM " . $this->dbObject->getTableName(); |
|
181 | + $query = "SELECT" . ($this->unique ? " DISTINCT" : "") . " * FROM " . $this->dbObject->getTableName(); |
|
182 | 182 | |
183 | 183 | if ($this->conditions != "") { |
184 | 184 | $query .= " WHERE " . $this->conditions; |
185 | 185 | } |
186 | 186 | |
187 | - $query.= $this->getQueryOrderSQL(); |
|
188 | - $query.= $this->getQueryLimitSQL(); |
|
187 | + $query .= $this->getQueryOrderSQL(); |
|
188 | + $query .= $this->getQueryLimitSQL(); |
|
189 | 189 | |
190 | 190 | if (!$debug) { |
191 | 191 | $stmt = DBCore::doSelectQuery($query); |
@@ -219,8 +219,8 @@ discard block |
||
219 | 219 | $query .= " AND " . $this->conditions; |
220 | 220 | } |
221 | 221 | |
222 | - $query.= $this->getQueryOrderSQL(); |
|
223 | - $query.= $this->getQueryLimitSQL(); |
|
222 | + $query .= $this->getQueryOrderSQL(); |
|
223 | + $query .= $this->getQueryLimitSQL(); |
|
224 | 224 | |
225 | 225 | $fieldType = DBField::getType($fieldValue); |
226 | 226 | if (!$debug) { |
@@ -110,7 +110,7 @@ |
||
110 | 110 | /** |
111 | 111 | * Count messages in POP server. |
112 | 112 | * |
113 | - * @return type |
|
113 | + * @return integer |
|
114 | 114 | */ |
115 | 115 | public function countMessages() { |
116 | 116 | fputs($this->connection, "STAT\r\n"); |
@@ -131,10 +131,10 @@ discard block |
||
131 | 131 | fputs($this->connection, "TOP $messageNumber 0\r\n"); |
132 | 132 | $buffer = ""; |
133 | 133 | $headerReceived = 0; |
134 | - while( $headerReceived == 0 ) { |
|
135 | - $temp = fgets( $this->connection, 1024 ); |
|
134 | + while ($headerReceived == 0) { |
|
135 | + $temp = fgets($this->connection, 1024); |
|
136 | 136 | $buffer .= $temp; |
137 | - if( $temp == ".\r\n" ) { |
|
137 | + if ($temp == ".\r\n") { |
|
138 | 138 | $headerReceived = 1; |
139 | 139 | } |
140 | 140 | } |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | public function getMessages() { |
187 | 187 | $messages = []; |
188 | 188 | |
189 | - for ($i=1; ; $i++) { |
|
189 | + for ($i = 1; ; $i++) { |
|
190 | 190 | $message = $this->getMessage($i); |
191 | 191 | if ($message === false) { |
192 | 192 | break; |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | public function getBouncedEmails($delete = true, $number = null) { |
206 | 206 | $emails = []; |
207 | 207 | |
208 | - for ($i = 1; (is_null($number) ? true : $i <= $number) ; $i++) { |
|
208 | + for ($i = 1; (is_null($number) ? true : $i <= $number); $i++) { |
|
209 | 209 | $message = $this->getMessage($i); |
210 | 210 | if ($message !== false) { |
211 | 211 | $markers = [ |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | public function getEmails($delete = true, $number = null) { |
266 | 266 | $emails = []; |
267 | 267 | |
268 | - for ($i = 1; (is_null($number) ? true : $i <= $number) ; $i++) { |
|
268 | + for ($i = 1; (is_null($number) ? true : $i <= $number); $i++) { |
|
269 | 269 | $message = $this->getMessage($i); |
270 | 270 | if ($message !== false) { |
271 | 271 | $failSignaturePos = 0; |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | $len = count($avar); |
351 | 351 | $ret = $L2 = $L3 = null; |
352 | 352 | for ($i = 0; $i < $len; $i++) { |
353 | - if( isset( $avar[$i] ) && isset( $avar[$i][0] ) && isset( $avar[$i][1] ) && isset( $avar[$i][2] ) ){ |
|
353 | + if (isset($avar[$i]) && isset($avar[$i][0]) && isset($avar[$i][1]) && isset($avar[$i][2])) { |
|
354 | 354 | $L2 = $avar[$i][0] . $avar[$i][1]; |
355 | 355 | $L3 = $avar[$i][0] . $avar[$i][1] . $avar[$i][2]; |
356 | 356 | if ($L2 != " " && $L3 != "Rec" && $L2 != "") { |
@@ -62,6 +62,9 @@ |
||
62 | 62 | $this->lastPage = $this->currentPage + $this->pagesOffset; |
63 | 63 | } |
64 | 64 | |
65 | + /** |
|
66 | + * @param integer $currentPage |
|
67 | + */ |
|
65 | 68 | public function setCurrentPage($currentPage) { |
66 | 69 | if (Tools::isInteger($currentPage)) { |
67 | 70 | if ($currentPage < 0) { |
@@ -77,8 +77,12 @@ |
||
77 | 77 | public static function getCurrentPageNumber($page, $totalPages) { |
78 | 78 | $page = (integer)$page; |
79 | 79 | |
80 | - if ($page < 1) return 1; |
|
81 | - if ($page > $totalPages) return $totalPages; |
|
80 | + if ($page < 1) { |
|
81 | + return 1; |
|
82 | + } |
|
83 | + if ($page > $totalPages) { |
|
84 | + return $totalPages; |
|
85 | + } |
|
82 | 86 | return $page; |
83 | 87 | } |
84 | 88 |
@@ -136,7 +136,7 @@ |
||
136 | 136 | * css($propertyName, $propertyValue) Set the value of a CSS property |
137 | 137 | * |
138 | 138 | * @param string $propertyName Name of a CSS property. |
139 | - * @param mixed $propertyValue Value of a CSS property. |
|
139 | + * @param string $propertyValue Value of a CSS property. |
|
140 | 140 | * |
141 | 141 | * @return Value of the CSS property or NULL if property is not exists. |
142 | 142 | */ |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | $urlParts['path'] = '/'; |
124 | 124 | } |
125 | 125 | |
126 | - $sock = fsockopen($urlParts['host'], (isset($urlParts['port']) ? (int) $urlParts['port'] : 80), $errno, $errstr, 30); |
|
126 | + $sock = fsockopen($urlParts['host'], (isset($urlParts['port']) ? (int)$urlParts['port'] : 80), $errno, $errstr, 30); |
|
127 | 127 | if (!$sock) { |
128 | 128 | throw new HttpException("$errstr ($errno)"); |
129 | 129 | } |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | fwrite($sock, $request); |
135 | 135 | $response = ''; |
136 | 136 | while (!feof($sock)) { |
137 | - $response.= fread($sock, 8192); |
|
137 | + $response .= fread($sock, 8192); |
|
138 | 138 | } |
139 | 139 | fclose($sock); |
140 | 140 | |
@@ -209,29 +209,29 @@ discard block |
||
209 | 209 | |
210 | 210 | // Data goes in the path for a GET request |
211 | 211 | if ($type == self::GET) { |
212 | - $parts['path'].= '?' . $postString; |
|
212 | + $parts['path'] .= '?' . $postString; |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | $request = "$type " . $parts['path'] . " HTTP/1.1\r\n"; |
216 | - $request.= "Host: " . $parts['host'] . "\r\n"; |
|
216 | + $request .= "Host: " . $parts['host'] . "\r\n"; |
|
217 | 217 | |
218 | 218 | if ($type == self::POST) { |
219 | - $request.= "Content-Type: application/x-www-form-urlencoded\r\n"; |
|
220 | - $request.= "Content-Length: " . strlen($postString) . "\r\n"; |
|
219 | + $request .= "Content-Type: application/x-www-form-urlencoded\r\n"; |
|
220 | + $request .= "Content-Length: " . strlen($postString) . "\r\n"; |
|
221 | 221 | } |
222 | - $request.= "Connection: Close\r\n"; |
|
223 | - $request.= "\r\n"; |
|
222 | + $request .= "Connection: Close\r\n"; |
|
223 | + $request .= "\r\n"; |
|
224 | 224 | |
225 | 225 | // Data goes in the request body for a POST request |
226 | 226 | if ($type == self::POST && isset($postString)) { |
227 | - $request.= $postString; |
|
227 | + $request .= $postString; |
|
228 | 228 | } |
229 | 229 | |
230 | 230 | fwrite($sock, $request); |
231 | 231 | |
232 | 232 | $response = ""; |
233 | 233 | while (!feof($sock) && $result = fgets($sock)) { |
234 | - $response.= $result; |
|
234 | + $response .= $result; |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | fclose($sock); |
@@ -243,7 +243,7 @@ |
||
243 | 243 | case ('boolean'): |
244 | 244 | case ('bool'): |
245 | 245 | case ('b'): |
246 | - $_FIELDS[$fieldName] = (boolean) $_FIELDS[$fieldName]; |
|
246 | + $_FIELDS[$fieldName] = (boolean)$_FIELDS[$fieldName]; |
|
247 | 247 | } |
248 | 248 | } else { |
249 | 249 | throw new \Exception("No field '" . $fieldName . "' in global fields list."); |