@@ -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)) { |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | $this->_tpl = $tpl; |
57 | 57 | } elseif (Tools::isInstanceOf($tpl, new Route)) { |
58 | 58 | $this->_route = $tpl; |
59 | - $this->_tpl = $this->_route->controller . "/" . $this->_route->controller . "_" . $this->_route->action; |
|
59 | + $this->_tpl = $this->_route->controller."/".$this->_route->controller."_".$this->_route->action; |
|
60 | 60 | } else { |
61 | 61 | throw new \Exception("Invalid view template"); |
62 | 62 | } |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | throw new \Exception("View object was not initialized with template"); |
71 | 71 | } |
72 | 72 | |
73 | - require_once($path . $this->_tpl . $suffix); |
|
73 | + require_once($path.$this->_tpl.$suffix); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | public function setTpl($_tpl) { |
@@ -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 | */ |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | if (isset($this->$attributeName)) { |
113 | 113 | $this->$attributeName = $attributeValue; |
114 | 114 | } else { |
115 | - throw new \Exception("Wrong attribute '" . $attributeName . "' for " . get_class($this) . " component"); |
|
115 | + throw new \Exception("Wrong attribute '".$attributeName."' for ".get_class($this)." component"); |
|
116 | 116 | } |
117 | 117 | } |
118 | 118 | } |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | public function getStyle() { |
163 | 163 | $style = ""; |
164 | 164 | foreach ($this->style as $propertyName => $propertyValue) { |
165 | - $style .= $propertyName . ":" . $propertyValue . ";"; |
|
165 | + $style .= $propertyName.":".$propertyValue.";"; |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | return $style; |
@@ -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 { |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | */ |
127 | 127 | public function getConnection($connName) { |
128 | 128 | if (!isset($this->connections[$connName])) { |
129 | - throw new DBCoreException('Unknown connection: ' . $connName); |
|
129 | + throw new DBCoreException('Unknown connection: '.$connName); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | return $this->connections[$connName]; |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | $resultSet[$field->table] = []; |
280 | 280 | } |
281 | 281 | $resultSet[$field->table][$field->name] = $fieldsCounter++; |
282 | - $parameterName = "variable" . $fieldsCounter; //$field->name; |
|
282 | + $parameterName = "variable".$fieldsCounter; //$field->name; |
|
283 | 283 | $$parameterName = null; |
284 | 284 | $parameters[] = &$$parameterName; |
285 | 285 | } |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | */ |
411 | 411 | public static function getTableFieldsList($tableName) { |
412 | 412 | if (!empty($tableName)) { |
413 | - $query = "SHOW FULL COLUMNS FROM " . $tableName; |
|
413 | + $query = "SHOW FULL COLUMNS FROM ".$tableName; |
|
414 | 414 | $stmt = self::doSelectQuery($query); |
415 | 415 | if ($stmt !== false) { |
416 | 416 | $stmt->bind_result( |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | || strpos($type, "datetime") === 0 |
457 | 457 | || strpos($type, "timestamp") === 0 |
458 | 458 | || strpos($type, "date") === 0) { |
459 | - return ('"' . $value . '"'); |
|
459 | + return ('"'.$value.'"'); |
|
460 | 460 | } elseif (strpos($type, "int") === 0 |
461 | 461 | || strpos($type, "tinyint") === 0 |
462 | 462 | || strpos($type, "smallint") === 0 |
@@ -492,17 +492,17 @@ discard block |
||
492 | 492 | $extra = trim($attributes['extra']); |
493 | 493 | $comment = trim($attributes['comment']); |
494 | 494 | |
495 | - $fieldStr = "'" . $field . "' => "; |
|
495 | + $fieldStr = "'".$field."' => "; |
|
496 | 496 | if ($attributes['null'] === 'YES' && is_null($attributes['default'])) { |
497 | - $fieldStr.= "null"; |
|
497 | + $fieldStr .= "null"; |
|
498 | 498 | } else { |
499 | - $fieldStr.= self::getPrintableSQLValue($attributes['type'], $attributes['default']); |
|
499 | + $fieldStr .= self::getPrintableSQLValue($attributes['type'], $attributes['default']); |
|
500 | 500 | } |
501 | - $fieldStr.= ", // " . $attributes['type'] . |
|
502 | - ", " . (($attributes['null'] == "NO") ? "not null" : "null") |
|
503 | - . ", default '" . $attributes['default'] . "'" . |
|
504 | - ($extra ? ", " . $extra : "") . |
|
505 | - ($comment ? " (" . $comment . ")" : "") . "\n"; |
|
501 | + $fieldStr .= ", // ".$attributes['type']. |
|
502 | + ", ".(($attributes['null'] == "NO") ? "not null" : "null") |
|
503 | + . ", default '".$attributes['default']."'". |
|
504 | + ($extra ? ", ".$extra : ""). |
|
505 | + ($comment ? " (".$comment.")" : "")."\n"; |
|
506 | 506 | |
507 | 507 | return $fieldStr; |
508 | 508 | } |
@@ -557,12 +557,12 @@ discard block |
||
557 | 557 | $idFieldName = $dbObject->getIdFieldName(); |
558 | 558 | |
559 | 559 | if (Tools::isInteger($fieldsList[$idFieldName])) { |
560 | - $query = "INSERT " . ($ignore ? 'IGNORE' : 'INTO') . " " . $dbObject->getTableName() . " |
|
560 | + $query = "INSERT ".($ignore ? 'IGNORE' : 'INTO')." ".$dbObject->getTableName()." |
|
561 | 561 | SET " . DBPreparedQuery::sqlQMValuesString($fieldsList, $idFieldName); |
562 | 562 | $typesString = DBPreparedQuery::sqlTypesString($fieldsList, $idFieldName); |
563 | 563 | $valuesList = self::createValuesList($fieldsList, $idFieldName); |
564 | 564 | } else { |
565 | - $query = "INSERT " . ($ignore ? 'IGNORE' : 'INTO') . " " . $dbObject->getTableName() . " |
|
565 | + $query = "INSERT ".($ignore ? 'IGNORE' : 'INTO')." ".$dbObject->getTableName()." |
|
566 | 566 | SET " . DBPreparedQuery::sqlQMValuesString($fieldsList); |
567 | 567 | $typesString = DBPreparedQuery::sqlTypesString($fieldsList); |
568 | 568 | $valuesList = self::createValuesList($fieldsList); |
@@ -591,15 +591,15 @@ discard block |
||
591 | 591 | $fieldsList = $dbObject->getFieldsList(); |
592 | 592 | $idFieldName = $dbObject->getIdFieldName(); |
593 | 593 | |
594 | - $query = "UPDATE " . $dbObject->getTableName() . " |
|
595 | - SET " . DBPreparedQuery::sqlQMValuesString($fieldsList, $idFieldName) . " |
|
596 | - WHERE " . $idFieldName . " = ? |
|
594 | + $query = "UPDATE ".$dbObject->getTableName()." |
|
595 | + SET " . DBPreparedQuery::sqlQMValuesString($fieldsList, $idFieldName)." |
|
596 | + WHERE " . $idFieldName." = ? |
|
597 | 597 | LIMIT 1"; |
598 | 598 | $typesString = DBPreparedQuery::sqlTypesString($fieldsList, $idFieldName); |
599 | 599 | if (Tools::isInteger($fieldsList[$idFieldName])) { |
600 | - $typesString.= "i"; |
|
600 | + $typesString .= "i"; |
|
601 | 601 | } else { |
602 | - $typesString.= "s"; |
|
602 | + $typesString .= "s"; |
|
603 | 603 | } |
604 | 604 | $valuesList = self::createValuesList($fieldsList, $idFieldName); |
605 | 605 | $valuesList[] = $dbObject->getId(); |
@@ -621,8 +621,8 @@ discard block |
||
621 | 621 | */ |
622 | 622 | public static function deleteDBObject($dbObject) { |
623 | 623 | if (!empty($dbObject) && is_object($dbObject)) { |
624 | - $query = "DELETE FROM " . $dbObject->getTableName() . |
|
625 | - " WHERE " . $dbObject->getIdFieldName() . " = ? LIMIT 1"; |
|
624 | + $query = "DELETE FROM ".$dbObject->getTableName(). |
|
625 | + " WHERE ".$dbObject->getIdFieldName()." = ? LIMIT 1"; |
|
626 | 626 | |
627 | 627 | $typesString = "s"; |
628 | 628 | if (Tools::isInteger($dbObject->getId())) { |
@@ -674,7 +674,7 @@ discard block |
||
674 | 674 | return null; |
675 | 675 | } |
676 | 676 | } elseif ($stmt->num_rows > 1) { |
677 | - throw new DBCoreException("More than single record of '" . $className . "' entity selected"); |
|
677 | + throw new DBCoreException("More than single record of '".$className."' entity selected"); |
|
678 | 678 | } |
679 | 679 | |
680 | 680 | return null; |
@@ -139,9 +139,9 @@ |
||
139 | 139 | $typeByValue = DBField::getType($value); |
140 | 140 | if ($typeByValue != 's') { |
141 | 141 | if ($type != $typeByValue && !( |
142 | - ($type == 'd' && $typeByValue == 'i') || // We can put integer as double |
|
142 | + ($type == 'd' && $typeByValue == 'i') || // We can put integer as double |
|
143 | 143 | ($type == 's' && $typeByValue == 'i') // We can put integer as string |
144 | - ) |
|
144 | + ) |
|
145 | 145 | ) { |
146 | 146 | throw new DBCoreException( |
147 | 147 | "Invalid query parameters types string ('" . $value . |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | */ |
84 | 84 | public function prepareConditions() { |
85 | 85 | if (!empty($this->conditions)) { |
86 | - $this->query.= " WHERE "; |
|
86 | + $this->query .= " WHERE "; |
|
87 | 87 | $this->sqlPushValues($this->conditions, " AND "); |
88 | 88 | } |
89 | 89 | } |
@@ -93,14 +93,14 @@ discard block |
||
93 | 93 | */ |
94 | 94 | public function prepareOrder() { |
95 | 95 | if (!empty($this->order)) { |
96 | - $this->query.= " ORDER BY"; |
|
96 | + $this->query .= " ORDER BY"; |
|
97 | 97 | if (is_array($this->order)) { |
98 | 98 | foreach ($this->order as $fieldName => $ord) { |
99 | - $this->query.= " " . $fieldName . " " . $ord . ","; |
|
99 | + $this->query .= " ".$fieldName." ".$ord.","; |
|
100 | 100 | } |
101 | 101 | $this->query = substr($this->query, 0, strlen($this->query) - 1); |
102 | 102 | } elseif (is_string($this->order)) { |
103 | - $this->query.= " " . $this->order; |
|
103 | + $this->query .= " ".$this->order; |
|
104 | 104 | } |
105 | 105 | } |
106 | 106 | } |
@@ -113,13 +113,13 @@ discard block |
||
113 | 113 | public function prepareLimit() { |
114 | 114 | if (!is_null($this->limit)) { |
115 | 115 | if (Tools::isInteger($this->limit)) { |
116 | - $this->query.= " LIMIT " . $this->limit; |
|
116 | + $this->query .= " LIMIT ".$this->limit; |
|
117 | 117 | $count = $this->limit; |
118 | 118 | } elseif (is_array($this->limit) && count($this->limit) == 2) { |
119 | 119 | $offset = $this->limit[0]; |
120 | 120 | $count = $this->limit[1]; |
121 | 121 | if (Tools::isInteger($offset) && Tools::isInteger($count)) { |
122 | - $this->query.= " LIMIT " . $offset . ", " . $count; |
|
122 | + $this->query .= " LIMIT ".$offset.", ".$count; |
|
123 | 123 | } else { |
124 | 124 | throw new DBCoreException("Invalid LIMIT param in select() method."); |
125 | 125 | } |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | |
223 | 223 | if (!in_array($type, ['i', 'd', 's', 'b'])) { |
224 | 224 | throw new DBCoreException( |
225 | - "Invalid query parameters types string (type '" . $type . |
|
225 | + "Invalid query parameters types string (type '".$type. |
|
226 | 226 | "' is undefined, only 'i', 'd', 's' and 'b' types are acceptable)" |
227 | 227 | ); |
228 | 228 | } |
@@ -235,8 +235,8 @@ discard block |
||
235 | 235 | ) |
236 | 236 | ) { |
237 | 237 | throw new DBCoreException( |
238 | - "Invalid query parameters types string ('" . $value . |
|
239 | - "' is not '" . $type . "' type but '" . $typeByValue . "' detected)" |
|
238 | + "Invalid query parameters types string ('".$value. |
|
239 | + "' is not '".$type."' type but '".$typeByValue."' detected)" |
|
240 | 240 | ); |
241 | 241 | } |
242 | 242 | } else { // in case if we try send non-string parameters as a string value |
@@ -244,21 +244,21 @@ discard block |
||
244 | 244 | case 'i': |
245 | 245 | if (!(Tools::isNumeric($value) && ((string)(int)$value === $value))) { |
246 | 246 | throw new DBCoreException( |
247 | - "Invalid query parameters types string ('" . $value . "' is not '" . $type . ")" |
|
247 | + "Invalid query parameters types string ('".$value."' is not '".$type.")" |
|
248 | 248 | ); |
249 | 249 | } |
250 | 250 | break; |
251 | 251 | case 'd': |
252 | 252 | if (!Tools::isDoubleString($value)) { |
253 | 253 | throw new DBCoreException( |
254 | - "Invalid query parameters types string ('" . $value . "' is not '" . $type . ")" |
|
254 | + "Invalid query parameters types string ('".$value."' is not '".$type.")" |
|
255 | 255 | ); |
256 | 256 | } |
257 | 257 | break; |
258 | 258 | case 'b': |
259 | 259 | if (!in_array(strtolower($value), ['true', 'false'])) { |
260 | 260 | throw new DBCoreException( |
261 | - "Invalid query parameters types string ('" . $value . "' is not '" . $type . ")" |
|
261 | + "Invalid query parameters types string ('".$value."' is not '".$type.")" |
|
262 | 262 | ); |
263 | 263 | } |
264 | 264 | break; |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | $chunks = []; |
291 | 291 | foreach (array_keys($fieldsList) as $fieldName) { |
292 | 292 | if ($fieldName != $idFieldName) { |
293 | - $chunks[] = "`" . $fieldName . "` = ?"; |
|
293 | + $chunks[] = "`".$fieldName."` = ?"; |
|
294 | 294 | } |
295 | 295 | } |
296 | 296 | |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | $chunks = []; |
310 | 310 | foreach ($fieldsList as $fieldName => $fieldValue) { |
311 | 311 | if ($fieldName != $idFieldName) { |
312 | - $chunks[]= "`" . $fieldName . "` = '" . $fieldValue . "'"; |
|
312 | + $chunks[] = "`".$fieldName."` = '".$fieldValue."'"; |
|
313 | 313 | } |
314 | 314 | } |
315 | 315 | |
@@ -333,11 +333,11 @@ discard block |
||
333 | 333 | foreach ($fieldsList as $fieldName => $fieldValue) { |
334 | 334 | if ($fieldName != $idFieldName) { |
335 | 335 | if (Tools::isDouble($fieldValue)) { |
336 | - $typesString.= "d"; |
|
336 | + $typesString .= "d"; |
|
337 | 337 | } elseif (Tools::isInteger($fieldValue)) { |
338 | - $typesString.= "i"; |
|
338 | + $typesString .= "i"; |
|
339 | 339 | } else { |
340 | - $typesString.= "s"; |
|
340 | + $typesString .= "s"; |
|
341 | 341 | } |
342 | 342 | } |
343 | 343 | } |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | $type = DBField::castType($type); |
359 | 359 | $typesString = ""; |
360 | 360 | while ($length > 0) { |
361 | - $typesString.= $type; |
|
361 | + $typesString .= $type; |
|
362 | 362 | $length--; |
363 | 363 | } |
364 | 364 | |
@@ -377,8 +377,8 @@ discard block |
||
377 | 377 | foreach ($values as $fieldName => $fieldValue) { |
378 | 378 | if (!is_array($fieldValue)) { |
379 | 379 | if (!is_null($fieldValue)) { |
380 | - $chunks[] = $fieldName . " = ?"; |
|
381 | - $this->types.= DBField::getType($fieldValue); |
|
380 | + $chunks[] = $fieldName." = ?"; |
|
381 | + $this->types .= DBField::getType($fieldValue); |
|
382 | 382 | $this->params[] = $fieldValue; |
383 | 383 | } else { |
384 | 384 | $chunks[] = $fieldName; |
@@ -389,12 +389,12 @@ discard block |
||
389 | 389 | |
390 | 390 | $chunks[] = $condition; |
391 | 391 | foreach ($localParams as $param) { |
392 | - $this->types.= DBField::getType($param); |
|
392 | + $this->types .= DBField::getType($param); |
|
393 | 393 | $this->params[] = $param; |
394 | 394 | } |
395 | 395 | } |
396 | 396 | } |
397 | - $this->query.= implode($separator, $chunks); |
|
397 | + $this->query .= implode($separator, $chunks); |
|
398 | 398 | } |
399 | 399 | |
400 | 400 | } |
@@ -149,7 +149,7 @@ |
||
149 | 149 | break; |
150 | 150 | } |
151 | 151 | $array = &$array[$key]; |
152 | - } elseif(isset($array[$key])) { // last element |
|
152 | + } elseif (isset($array[$key])) { // last element |
|
153 | 153 | unset($array[$key]); |
154 | 154 | } |
155 | 155 | } |
@@ -132,7 +132,7 @@ |
||
132 | 132 | */ |
133 | 133 | public static function reorderMessages() |
134 | 134 | { |
135 | - uasort(self::$messages, function ($a, $b) { |
|
135 | + uasort(self::$messages, function($a, $b) { |
|
136 | 136 | return $a->type <= $b->type; |
137 | 137 | }); |
138 | 138 | } |
@@ -101,8 +101,8 @@ discard block |
||
101 | 101 | */ |
102 | 102 | public function selectDBObject($debug = false) { |
103 | 103 | $query = "SELECT * FROM " . $this->dbObject->getTableName() |
104 | - . ($this->conditions != "" ? " WHERE " . $this->conditions : "") |
|
105 | - . " LIMIT 1"; |
|
104 | + . ($this->conditions != "" ? " WHERE " . $this->conditions : "") |
|
105 | + . " LIMIT 1"; |
|
106 | 106 | |
107 | 107 | if (!$debug) { |
108 | 108 | $stmt = DBCore::doSelectQuery($query); |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | */ |
184 | 184 | public function selectDBObjects($debug = false) { |
185 | 185 | $query = "SELECT" . ($this->unique ? " DISTINCT" : "") |
186 | - . " * FROM " . $this->dbObject->getTableName(); |
|
186 | + . " * FROM " . $this->dbObject->getTableName(); |
|
187 | 187 | |
188 | 188 | if ($this->conditions != "") { |
189 | 189 | $query .= " WHERE " . $this->conditions; |
@@ -61,8 +61,8 @@ discard block |
||
61 | 61 | $classNamespaceParts = explode("\\", $this->className); |
62 | 62 | if ($className != $classNamespaceParts[count($classNamespaceParts) - 1]) { |
63 | 63 | throw new DBSelectorException( |
64 | - "Invalid DB object classname '" . $className . "' in method name. " . |
|
65 | - "Valid classname is '" . $this->className . "'" |
|
64 | + "Invalid DB object classname '".$className."' in method name. ". |
|
65 | + "Valid classname is '".$this->className."'" |
|
66 | 66 | ); |
67 | 67 | } |
68 | 68 | } |
@@ -100,8 +100,8 @@ discard block |
||
100 | 100 | * @return DBObject |
101 | 101 | */ |
102 | 102 | public function selectDBObject($debug = false) { |
103 | - $query = "SELECT * FROM " . $this->dbObject->getTableName() |
|
104 | - . ($this->conditions != "" ? " WHERE " . $this->conditions : "") |
|
103 | + $query = "SELECT * FROM ".$this->dbObject->getTableName() |
|
104 | + . ($this->conditions != "" ? " WHERE ".$this->conditions : "") |
|
105 | 105 | . " LIMIT 1"; |
106 | 106 | |
107 | 107 | if (!$debug) { |
@@ -131,14 +131,14 @@ discard block |
||
131 | 131 | * @return DBObject |
132 | 132 | */ |
133 | 133 | public function selectDBObjectByField($fieldName, $fieldValue, $debug = false) { |
134 | - $query = "SELECT * FROM " . $this->dbObject->getTableName() . " WHERE " . $fieldName . " = ?"; |
|
134 | + $query = "SELECT * FROM ".$this->dbObject->getTableName()." WHERE ".$fieldName." = ?"; |
|
135 | 135 | |
136 | 136 | if ($this->conditions != "") { |
137 | - $query .= " AND " . $this->conditions; |
|
137 | + $query .= " AND ".$this->conditions; |
|
138 | 138 | } |
139 | 139 | |
140 | - $query.= $this->getQueryOrderSQL(); |
|
141 | - $query.= " LIMIT 1"; |
|
140 | + $query .= $this->getQueryOrderSQL(); |
|
141 | + $query .= " LIMIT 1"; |
|
142 | 142 | |
143 | 143 | $fieldType = DBField::getType($fieldValue); |
144 | 144 | if (!$debug) { |
@@ -182,15 +182,15 @@ discard block |
||
182 | 182 | * @return array<DBObject> |
183 | 183 | */ |
184 | 184 | public function selectDBObjects($debug = false) { |
185 | - $query = "SELECT" . ($this->unique ? " DISTINCT" : "") |
|
186 | - . " * FROM " . $this->dbObject->getTableName(); |
|
185 | + $query = "SELECT".($this->unique ? " DISTINCT" : "") |
|
186 | + . " * FROM ".$this->dbObject->getTableName(); |
|
187 | 187 | |
188 | 188 | if ($this->conditions != "") { |
189 | - $query .= " WHERE " . $this->conditions; |
|
189 | + $query .= " WHERE ".$this->conditions; |
|
190 | 190 | } |
191 | 191 | |
192 | - $query.= $this->getQueryOrderSQL(); |
|
193 | - $query.= $this->getQueryLimitSQL(); |
|
192 | + $query .= $this->getQueryOrderSQL(); |
|
193 | + $query .= $this->getQueryLimitSQL(); |
|
194 | 194 | |
195 | 195 | if (!$debug) { |
196 | 196 | $stmt = DBCore::doSelectQuery($query); |
@@ -219,15 +219,15 @@ discard block |
||
219 | 219 | * @return array<DBObject> |
220 | 220 | */ |
221 | 221 | public function selectDBObjectsByField($fieldName, $fieldValue, $debug = false) { |
222 | - $query = "SELECT * FROM " . $this->dbObject->getTableName(); |
|
223 | - $query .= " WHERE " . $fieldName . " = ?"; |
|
222 | + $query = "SELECT * FROM ".$this->dbObject->getTableName(); |
|
223 | + $query .= " WHERE ".$fieldName." = ?"; |
|
224 | 224 | |
225 | 225 | if ($this->conditions != "") { |
226 | - $query .= " AND " . $this->conditions; |
|
226 | + $query .= " AND ".$this->conditions; |
|
227 | 227 | } |
228 | 228 | |
229 | - $query.= $this->getQueryOrderSQL(); |
|
230 | - $query.= $this->getQueryLimitSQL(); |
|
229 | + $query .= $this->getQueryOrderSQL(); |
|
230 | + $query .= $this->getQueryLimitSQL(); |
|
231 | 231 | |
232 | 232 | $fieldType = DBField::getType($fieldValue); |
233 | 233 | if (!$debug) { |
@@ -253,10 +253,10 @@ discard block |
||
253 | 253 | * @return int Number of records. |
254 | 254 | */ |
255 | 255 | public function count() { |
256 | - $query = "SELECT count(*) FROM " . $this->dbObject->getTableName(); |
|
256 | + $query = "SELECT count(*) FROM ".$this->dbObject->getTableName(); |
|
257 | 257 | |
258 | 258 | if ($this->conditions != "") { |
259 | - $query .= " WHERE " . $this->conditions; |
|
259 | + $query .= " WHERE ".$this->conditions; |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | return DBCore::selectSingleValue($query); |
@@ -268,10 +268,10 @@ discard block |
||
268 | 268 | * @return int Number of records. |
269 | 269 | */ |
270 | 270 | public function max() { |
271 | - $query = "SELECT max(`" . $this->field . "`) FROM " . $this->dbObject->getTableName(); |
|
271 | + $query = "SELECT max(`".$this->field."`) FROM ".$this->dbObject->getTableName(); |
|
272 | 272 | |
273 | 273 | if ($this->conditions != "") { |
274 | - $query .= " WHERE " . $this->conditions; |
|
274 | + $query .= " WHERE ".$this->conditions; |
|
275 | 275 | } |
276 | 276 | |
277 | 277 | return DBCore::selectSingleValue($query); |
@@ -283,10 +283,10 @@ discard block |
||
283 | 283 | * @return int Number of records. |
284 | 284 | */ |
285 | 285 | public function min() { |
286 | - $query = "SELECT min(`" . $this->field . "`) FROM " . $this->dbObject->getTableName(); |
|
286 | + $query = "SELECT min(`".$this->field."`) FROM ".$this->dbObject->getTableName(); |
|
287 | 287 | |
288 | 288 | if ($this->conditions != "") { |
289 | - $query .= " WHERE " . $this->conditions; |
|
289 | + $query .= " WHERE ".$this->conditions; |
|
290 | 290 | } |
291 | 291 | |
292 | 292 | return DBCore::selectSingleValue($query); |
@@ -299,10 +299,10 @@ discard block |
||
299 | 299 | */ |
300 | 300 | private function getQueryOrderSQL() { |
301 | 301 | if ($this->order != "") { |
302 | - return (" ORDER BY " . $this->order); |
|
302 | + return (" ORDER BY ".$this->order); |
|
303 | 303 | } |
304 | 304 | |
305 | - return (" ORDER BY " . $this->dbObject->getIdFieldName() . " DESC"); |
|
305 | + return (" ORDER BY ".$this->dbObject->getIdFieldName()." DESC"); |
|
306 | 306 | } |
307 | 307 | |
308 | 308 | /** |
@@ -313,10 +313,10 @@ discard block |
||
313 | 313 | private function getQueryLimitSQL() { |
314 | 314 | if ($this->count !== "all") { |
315 | 315 | if ($this->offset > 0) { |
316 | - return (" LIMIT " . $this->offset . "," . $this->count); |
|
316 | + return (" LIMIT ".$this->offset.",".$this->count); |
|
317 | 317 | } |
318 | 318 | |
319 | - return (" LIMIT " . $this->count); |
|
319 | + return (" LIMIT ".$this->count); |
|
320 | 320 | } |
321 | 321 | |
322 | 322 | return ""; |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | elseif (preg_match("#^selectAll([A-Z]{1}[[:alpha:]]+)s#", $methodName, $matches)) { |
366 | 366 | $this->validateClassName(preg_replace("#ie$#", "y", $matches[1])); |
367 | 367 | |
368 | - $this->order = "`" . $this->dbObject->getIdFieldName() . "` DESC"; |
|
368 | + $this->order = "`".$this->dbObject->getIdFieldName()."` DESC"; |
|
369 | 369 | if (isset($methodParams[0])) { |
370 | 370 | $this->order = (string)$methodParams[0]; |
371 | 371 | } |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | case ("get"): |
413 | 413 | return $this->getFieldValue($fieldName); |
414 | 414 | default: |
415 | - throw new DBSelectorException("No method with name '" . $methodName . "'"); |
|
415 | + throw new DBSelectorException("No method with name '".$methodName."'"); |
|
416 | 416 | } |
417 | 417 | } |
418 | 418 | } |
@@ -98,7 +98,8 @@ discard block |
||
98 | 98 | /** |
99 | 99 | * Delete message from POP server. |
100 | 100 | * |
101 | - * @return int $messageId Id of the message. |
|
101 | + * @param integer $messageId |
|
102 | + * @return string $messageId Id of the message. |
|
102 | 103 | * |
103 | 104 | * @return string Response string. |
104 | 105 | */ |
@@ -111,7 +112,7 @@ discard block |
||
111 | 112 | /** |
112 | 113 | * Count messages in POP server. |
113 | 114 | * |
114 | - * @return type |
|
115 | + * @return integer |
|
115 | 116 | */ |
116 | 117 | public function countMessages() { |
117 | 118 | fwrite($this->connection, "STAT\r\n"); |
@@ -124,7 +125,7 @@ discard block |
||
124 | 125 | /** |
125 | 126 | * Return message header. |
126 | 127 | * |
127 | - * @return int $messageNumber Number of the message. |
|
128 | + * @return string $messageNumber Number of the message. |
|
128 | 129 | * |
129 | 130 | * @return string |
130 | 131 | */ |
@@ -159,9 +160,10 @@ discard block |
||
159 | 160 | /** |
160 | 161 | * Return message by number. |
161 | 162 | * |
162 | - * @return int $messageNumber Number of the message |
|
163 | + * @param integer $messageNumber |
|
164 | + * @return false|string $messageNumber Number of the message |
|
163 | 165 | * |
164 | - * @return string |
|
166 | + * @return false|string |
|
165 | 167 | */ |
166 | 168 | public function getMessage($messageNumber) { |
167 | 169 | fwrite($this->connection, "RETR $messageNumber\r\n"); |
@@ -58,10 +58,10 @@ discard block |
||
58 | 58 | fgets($sock, 1024); |
59 | 59 | |
60 | 60 | // Connection accepted |
61 | - fwrite($sock, "USER " . $username . "\r\n"); |
|
61 | + fwrite($sock, "USER ".$username."\r\n"); |
|
62 | 62 | $userresponse = fgets($sock, 1024); |
63 | 63 | if ($userresponse[0] == "+") { // User accepted |
64 | - fwrite($sock, "PASS " . $password . "\r\n"); |
|
64 | + fwrite($sock, "PASS ".$password."\r\n"); |
|
65 | 65 | $passresponse = fgets($sock, 1024); |
66 | 66 | if ($passresponse[0] != "+") { // Wrong password |
67 | 67 | $passresponse = str_replace("\r", "", str_replace("\n", "", $passresponse)); |
@@ -72,12 +72,12 @@ discard block |
||
72 | 72 | } |
73 | 73 | } else { // Invalid username |
74 | 74 | throw new POPServerException( |
75 | - "Username '" . $username . "' not accepted.", 1 |
|
75 | + "Username '".$username."' not accepted.", 1 |
|
76 | 76 | ); |
77 | 77 | } |
78 | 78 | } else { |
79 | 79 | throw new POPServerException( |
80 | - "Unable to Connect to " . $host . ". Network Problems could be responsible.", 2 |
|
80 | + "Unable to Connect to ".$host.". Network Problems could be responsible.", 2 |
|
81 | 81 | ); |
82 | 82 | } |
83 | 83 | $this->connection = $sock; |
@@ -357,8 +357,8 @@ discard block |
||
357 | 357 | $ret = $L2 = $L3 = null; |
358 | 358 | for ($i = 0; $i < $len; $i++) { |
359 | 359 | if (isset($avar[$i]) && isset($avar[$i][0]) && isset($avar[$i][1]) && isset($avar[$i][2])) { |
360 | - $L2 = $avar[$i][0] . $avar[$i][1]; |
|
361 | - $L3 = $avar[$i][0] . $avar[$i][1] . $avar[$i][2]; |
|
360 | + $L2 = $avar[$i][0].$avar[$i][1]; |
|
361 | + $L3 = $avar[$i][0].$avar[$i][1].$avar[$i][2]; |
|
362 | 362 | if ($L2 != " " && $L3 != "Rec" && $L2 != "") { |
363 | 363 | $avar2 = explode(":", $avar[$i]); |
364 | 364 | $temp = str_replace("$avar2[0]:", "", $avar[$i]); |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | |
30 | 30 | return $this->sendNotification( |
31 | 31 | Config::EMAIL_ADMIN, |
32 | - "New user signup: '" . $user->username . "'", |
|
32 | + "New user signup: '".$user->username."'", |
|
33 | 33 | $_LANG->code, |
34 | 34 | "signup_admin_email", |
35 | 35 | array( |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | global $_LANG; |
55 | 55 | |
56 | 56 | if (!Validator::isEmail($user->email)) { |
57 | - throw new \Exception("Invalid email: '" . $user->email . "'"); |
|
57 | + throw new \Exception("Invalid email: '".$user->email."'"); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | return $this->sendNotification( |