@@ -66,11 +66,11 @@ discard block |
||
| 66 | 66 | $this->changeUpdateTime(); |
| 67 | 67 | |
| 68 | 68 | return DBCore::doUpdateQuery( |
| 69 | - "UPDATE " . static::TABLE_NAME . " |
|
| 69 | + "UPDATE ".static::TABLE_NAME." |
|
| 70 | 70 | SET activation = ?, |
| 71 | 71 | update_time = ?, |
| 72 | 72 | update_user_id = ? |
| 73 | - WHERE " . static::ID_FIELD_NAME . " = ? |
|
| 73 | + WHERE " . static::ID_FIELD_NAME." = ? |
|
| 74 | 74 | LIMIT 1", |
| 75 | 75 | "isii", |
| 76 | 76 | [$this->activation, $this->updateTime, $this->updateUserId, $this->id] |
@@ -87,11 +87,11 @@ discard block |
||
| 87 | 87 | $this->changeUpdateTime(); |
| 88 | 88 | |
| 89 | 89 | return DBCore::doUpdateQuery( |
| 90 | - "UPDATE " . static::TABLE_NAME . " |
|
| 90 | + "UPDATE ".static::TABLE_NAME." |
|
| 91 | 91 | SET removed = ?, |
| 92 | 92 | update_time = ?, |
| 93 | 93 | update_user_id = ? |
| 94 | - WHERE " . static::ID_FIELD_NAME . " = ? |
|
| 94 | + WHERE " . static::ID_FIELD_NAME." = ? |
|
| 95 | 95 | LIMIT 1", |
| 96 | 96 | "isii", |
| 97 | 97 | [$this->removed, $this->updateTime, $this->updateUserId, $this->id] |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | */ |
| 46 | 46 | public function __construct($type = "", $name = "", $value = null) { |
| 47 | 47 | if (!(bool)preg_match("#^[a-zA-Z][a-zA-Z0-9_]*$#", $name)) { |
| 48 | - throw new DBFieldException("Can't create DBField object: invalid field name '" . $name . "'"); |
|
| 48 | + throw new DBFieldException("Can't create DBField object: invalid field name '".$name."'"); |
|
| 49 | 49 | } |
| 50 | 50 | $this->name = $name; |
| 51 | 51 | |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | return "s"; |
| 134 | 134 | } else { |
| 135 | 135 | throw new DBFieldTypeException( |
| 136 | - "Can't detect field value type for value '" . (string)$fieldValue . "'" |
|
| 136 | + "Can't detect field value type for value '".(string)$fieldValue."'" |
|
| 137 | 137 | ); |
| 138 | 138 | } |
| 139 | 139 | } |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | return $value; |
| 181 | 181 | case ("s"): |
| 182 | 182 | if (!in_array($value, ['NOW()'])) { |
| 183 | - return "'" . $value . "'"; |
|
| 183 | + return "'".$value."'"; |
|
| 184 | 184 | } else { |
| 185 | 185 | return $value; |
| 186 | 186 | } |
@@ -85,11 +85,11 @@ discard block |
||
| 85 | 85 | case ("!="): |
| 86 | 86 | $this->value = DBField::castValue($this->field->type, $value); |
| 87 | 87 | |
| 88 | - $this->sqlCondition = "`" . $field->name . "` " |
|
| 89 | - . $this->type . " " |
|
| 88 | + $this->sqlCondition = "`".$field->name."` " |
|
| 89 | + . $this->type." " |
|
| 90 | 90 | . DBField::sqlValue($this->field->type, $value); |
| 91 | 91 | |
| 92 | - $this->preparedCondition = "`" . $field->name . "` " . $this->type . " ?"; |
|
| 92 | + $this->preparedCondition = "`".$field->name."` ".$this->type." ?"; |
|
| 93 | 93 | $this->preparedTypes = $this->field->type; |
| 94 | 94 | $this->preparedData = [DBField::sqlValue($this->field->type, $value)]; |
| 95 | 95 | break; |
@@ -100,17 +100,17 @@ discard block |
||
| 100 | 100 | if ($this->field->type != "s") { |
| 101 | 101 | throw new DBQueryConditionException("Field type is not a string"); |
| 102 | 102 | } |
| 103 | - $this->sqlCondition = "`" . $field->name . "` " |
|
| 104 | - . $this->type . " " |
|
| 103 | + $this->sqlCondition = "`".$field->name."` " |
|
| 104 | + . $this->type." " |
|
| 105 | 105 | . DBField::sqlValue($this->field->type, $value); |
| 106 | 106 | |
| 107 | - $this->preparedCondition = "`" . $field->name . "` " . $this->type . " ?"; |
|
| 107 | + $this->preparedCondition = "`".$field->name."` ".$this->type." ?"; |
|
| 108 | 108 | $this->preparedTypes = $this->field->type; |
| 109 | 109 | $this->preparedData = [DBField::sqlValue($this->field->type, $value)]; |
| 110 | 110 | break; |
| 111 | 111 | case ("IN"): |
| 112 | 112 | case ("NOT IN"): |
| 113 | - if (is_array($value) && !empty($value)) { |
|
| 113 | + if (is_array($value) && !empty($value)) { |
|
| 114 | 114 | $dataList = []; |
| 115 | 115 | foreach ($value as $dataItem) { |
| 116 | 116 | $dataList[] = DBField::sqlValue($this->field->type, $dataItem); |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | if ($count > 0) { |
| 121 | 121 | $qmStr = "?"; |
| 122 | 122 | $tStr = $this->field->type; |
| 123 | - for ($i = 1; $i < $count; $i ++) { |
|
| 123 | + for ($i = 1; $i < $count; $i++) { |
|
| 124 | 124 | $qmStr .= ", ?"; |
| 125 | 125 | $tStr .= $this->field->type; |
| 126 | 126 | } |
@@ -130,11 +130,11 @@ discard block |
||
| 130 | 130 | return; |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - $this->sqlCondition = "`" . $field->name . "` " |
|
| 133 | + $this->sqlCondition = "`".$field->name."` " |
|
| 134 | 134 | . $this->type |
| 135 | - . " (" . implode(", ", $dataList) . ")"; |
|
| 135 | + . " (".implode(", ", $dataList).")"; |
|
| 136 | 136 | |
| 137 | - $this->preparedCondition = "`" . $field->name . "` " . $this->type . " (" . $qmStr . ")"; |
|
| 137 | + $this->preparedCondition = "`".$field->name."` ".$this->type." (".$qmStr.")"; |
|
| 138 | 138 | $this->preparedTypes = $tStr; |
| 139 | 139 | $this->preparedData = $dataList; |
| 140 | 140 | } else { |
@@ -145,10 +145,10 @@ discard block |
||
| 145 | 145 | if (is_array($value) && count($value) == 2 && isset($value[0]) && isset($value[1])) { |
| 146 | 146 | $from = DBField::sqlValue($this->field->type, $value[0]); |
| 147 | 147 | $to = DBField::sqlValue($this->field->type, $value[1]); |
| 148 | - $this->sqlCondition = "`" . $field->name . "` BETWEEN " . $from . " AND " . $to; |
|
| 148 | + $this->sqlCondition = "`".$field->name."` BETWEEN ".$from." AND ".$to; |
|
| 149 | 149 | |
| 150 | - $this->preparedCondition = "`" . $field->name . "` BETWEEN ? AND ?"; |
|
| 151 | - $this->preparedTypes = $this->field->type . $this->field->type; |
|
| 150 | + $this->preparedCondition = "`".$field->name."` BETWEEN ? AND ?"; |
|
| 151 | + $this->preparedTypes = $this->field->type.$this->field->type; |
|
| 152 | 152 | $this->preparedData = [$from, $to]; |
| 153 | 153 | } else { |
| 154 | 154 | throw new DBQueryConditionException("Invalid data for 'BETWEEN' condition"); |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | case ("!="): |
| 167 | 167 | case ("LIKE"): |
| 168 | 168 | case ("NOT LIKE"): |
| 169 | - $this->sqlCondition = "`" . $field1->name . "` " . $this->type . " `" . $field2->name . "`"; |
|
| 169 | + $this->sqlCondition = "`".$field1->name."` ".$this->type." `".$field2->name."`"; |
|
| 170 | 170 | break; |
| 171 | 171 | case ("IN"): |
| 172 | 172 | case ("NOT IN"): |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | foreach ($queryCondition as $operation => $conditions) { |
| 202 | - $cond .= " " . $operator . self::getSQLCondition($conditions, $operation); |
|
| 202 | + $cond .= " ".$operator.self::getSQLCondition($conditions, $operation); |
|
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | $cond .= ")"; |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | ); |
| 217 | 217 | } |
| 218 | 218 | } elseif (Tools::isInstanceOf($queryCondition, "\Asymptix\db\DBQueryCondition")) { |
| 219 | - return (" " . $queryCondition->sqlCondition); |
|
| 219 | + return (" ".$queryCondition->sqlCondition); |
|
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | return ""; |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | if (isset($conditionTypes[$conditionType])) { |
| 280 | 280 | return $conditionTypes[$conditionType]; |
| 281 | 281 | } |
| 282 | - throw new DBQueryConditionException("Invalid SQL condition type '" . $conditionType . "'"); |
|
| 282 | + throw new DBQueryConditionException("Invalid SQL condition type '".$conditionType."'"); |
|
| 283 | 283 | } |
| 284 | 284 | } |
| 285 | 285 | |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | if (DBQueryType::isValidQueryType($type)) { |
| 73 | 73 | $this->type = $type; |
| 74 | 74 | } else { |
| 75 | - throw new DBCoreException("Invalid SQL query type '" . $type . "'"); |
|
| 75 | + throw new DBCoreException("Invalid SQL query type '".$type."'"); |
|
| 76 | 76 | } |
| 77 | 77 | } |
| 78 | 78 | |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | OutputStream::start(); |
| 125 | 125 | if (!empty($query)) { |
| 126 | 126 | if (empty($types) && empty($params)) { |
| 127 | - OutputStream::message(OutputStream::MSG_INFO, "Q: " . $query); |
|
| 127 | + OutputStream::message(OutputStream::MSG_INFO, "Q: ".$query); |
|
| 128 | 128 | } else { |
| 129 | 129 | if (strlen($types) === count($params)) { |
| 130 | 130 | $query = preg_replace('/\s+/', ' ', $query); |
@@ -134,17 +134,17 @@ discard block |
||
| 134 | 134 | for ($i = 0; $i < strlen($types); $i++) { |
| 135 | 135 | $query = preg_replace("/\?/", DBField::sqlValue($types[$i], $params[$i]), $query, 1); |
| 136 | 136 | |
| 137 | - $paramsStr[] = $types[$i] . ": " . DBField::sqlValue($types[$i], $params[$i]); |
|
| 137 | + $paramsStr[] = $types[$i].": ".DBField::sqlValue($types[$i], $params[$i]); |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | - OutputStream::message(OutputStream::MSG_INFO, "Q: " . $query); |
|
| 141 | - OutputStream::message(OutputStream::MSG_INFO, "P: " . $preparedQuery); |
|
| 140 | + OutputStream::message(OutputStream::MSG_INFO, "Q: ".$query); |
|
| 141 | + OutputStream::message(OutputStream::MSG_INFO, "P: ".$preparedQuery); |
|
| 142 | 142 | |
| 143 | - OutputStream::message(OutputStream::MSG_INFO, "A: [" . implode(", ", $paramsStr) . "]"); |
|
| 143 | + OutputStream::message(OutputStream::MSG_INFO, "A: [".implode(", ", $paramsStr)."]"); |
|
| 144 | 144 | } else { |
| 145 | 145 | OutputStream::message(OutputStream::MSG_ERROR, "Number of types is not equal parameters number."); |
| 146 | - OutputStream::message(OutputStream::MSG_INFO, "T: " . $types); |
|
| 147 | - OutputStream::message(OutputStream::MSG_INFO, "A: [" . implode(", ", $params) . "]"); |
|
| 146 | + OutputStream::message(OutputStream::MSG_INFO, "T: ".$types); |
|
| 147 | + OutputStream::message(OutputStream::MSG_INFO, "A: [".implode(", ", $params)."]"); |
|
| 148 | 148 | } |
| 149 | 149 | } |
| 150 | 150 | } else { |
@@ -31,9 +31,9 @@ |
||
| 31 | 31 | */ |
| 32 | 32 | public static function displayError($errorMessage, $fieldName = null) { |
| 33 | 33 | if (!is_null($fieldName)) { |
| 34 | - return ('<label for="' . $fieldName . '" class="form-error">' . $errorMessage . '</label>'); |
|
| 34 | + return ('<label for="'.$fieldName.'" class="form-error">'.$errorMessage.'</label>'); |
|
| 35 | 35 | } else { |
| 36 | - return ('<span class="label label-danger pull-right form-error">' . $errorMessage . '</span>'); |
|
| 36 | + return ('<span class="label label-danger pull-right form-error">'.$errorMessage.'</span>'); |
|
| 37 | 37 | } |
| 38 | 38 | } |
| 39 | 39 | |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | * @param string $str String to output. |
| 55 | 55 | */ |
| 56 | 56 | public static function line($str = "") { |
| 57 | - self::output($str . "\n"); |
|
| 57 | + self::output($str."\n"); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | /** |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | $str = str_replace("{{time}}", date($format, $time), $str); |
| 76 | 76 | self::line($str); |
| 77 | 77 | } else { |
| 78 | - self::line(date($format, $time) . " " . $str); |
|
| 78 | + self::line(date($format, $time)." ".$str); |
|
| 79 | 79 | } |
| 80 | 80 | } |
| 81 | 81 | |
@@ -91,11 +91,11 @@ discard block |
||
| 91 | 91 | */ |
| 92 | 92 | public static function message($msgType, $str, $format = "\[Y-m-d H:i:s\]", $time = null) { |
| 93 | 93 | if (strpos($str, "{{time}}") === false) { |
| 94 | - $str = "{{time}} " . $str; |
|
| 94 | + $str = "{{time}} ".$str; |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | self::log( |
| 98 | - '<b><font color="' . $msgType . '">' . $str . '</font></b>', |
|
| 98 | + '<b><font color="'.$msgType.'">'.$str.'</font></b>', |
|
| 99 | 99 | $format, |
| 100 | 100 | $time |
| 101 | 101 | ); |
@@ -96,17 +96,17 @@ discard block |
||
| 96 | 96 | * @return string URL. |
| 97 | 97 | */ |
| 98 | 98 | public function getUrl($action, $id = null, $getParams = []) { |
| 99 | - $url = $this->controller . "/"; |
|
| 99 | + $url = $this->controller."/"; |
|
| 100 | 100 | if (!is_null($id)) { |
| 101 | - $url.= $action . "/" . $id; |
|
| 101 | + $url .= $action."/".$id; |
|
| 102 | 102 | } else { |
| 103 | - $url.= $action; |
|
| 103 | + $url .= $action; |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | if (!empty($getParams)) { |
| 107 | - $url.= "?"; |
|
| 107 | + $url .= "?"; |
|
| 108 | 108 | foreach ($getParams as $key => $value) { |
| 109 | - $url.= $key . "=" . $value; |
|
| 109 | + $url .= $key."=".$value; |
|
| 110 | 110 | } |
| 111 | 111 | } |
| 112 | 112 | |
@@ -119,9 +119,9 @@ discard block |
||
| 119 | 119 | * @return string |
| 120 | 120 | */ |
| 121 | 121 | public function tplPath() { |
| 122 | - $path = $this->controller . "/" . $this->controller; |
|
| 122 | + $path = $this->controller."/".$this->controller; |
|
| 123 | 123 | if (!empty($this->action)) { |
| 124 | - $path.= "_" . $this->action; |
|
| 124 | + $path .= "_".$this->action; |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | return $path; |
@@ -217,8 +217,8 @@ |
||
| 217 | 217 | return ""; |
| 218 | 218 | } |
| 219 | 219 | |
| 220 | - if (!self::validateRegexp($url, "#^" . $protocol . "://.+#")) { |
|
| 221 | - $url = $protocol . "://" . $url; |
|
| 220 | + if (!self::validateRegexp($url, "#^".$protocol."://.+#")) { |
|
| 221 | + $url = $protocol."://".$url; |
|
| 222 | 222 | } |
| 223 | 223 | $url = preg_replace("#/{3,}#", "//", $url); |
| 224 | 224 | |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | } else { |
| 47 | 47 | $fieldValue = $newValue; |
| 48 | 48 | } |
| 49 | - $count ++; |
|
| 49 | + $count++; |
|
| 50 | 50 | } elseif (!empty($this->fieldsAliases)) { // look up for the field aliases |
| 51 | 51 | $fieldAliases = array_keys($this->fieldsAliases, $fieldName); |
| 52 | 52 | if (!empty($fieldAliases)) { |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | } else { |
| 59 | 59 | $fieldValue = $newValue; |
| 60 | 60 | } |
| 61 | - $count ++; |
|
| 61 | + $count++; |
|
| 62 | 62 | |
| 63 | 63 | break; |
| 64 | 64 | } |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | return $this; |
| 94 | 94 | } else { |
| 95 | - throw new \Exception("Object '" . get_class($this) . "' hasn't field '" . $fieldName . "'"); |
|
| 95 | + throw new \Exception("Object '".get_class($this)."' hasn't field '".$fieldName."'"); |
|
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | if (isset($this->fieldsList[$fieldName])) { |
| 134 | 134 | return $this->fieldsList[$fieldName]; |
| 135 | 135 | } else { |
| 136 | - throw new \Exception("Object '" . get_class($this) . "' hasn't field '" . $fieldName . "'"); |
|
| 136 | + throw new \Exception("Object '".get_class($this)."' hasn't field '".$fieldName."'"); |
|
| 137 | 137 | } |
| 138 | 138 | } |
| 139 | 139 | |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | * @return mixed The return value of the callback, or FALSE on error. |
| 212 | 212 | */ |
| 213 | 213 | public function __set($fieldName, $fieldValue) { |
| 214 | - return call_user_func_array([$this, "set" . ucfirst($fieldName)], [$fieldValue]); |
|
| 214 | + return call_user_func_array([$this, "set".ucfirst($fieldName)], [$fieldValue]); |
|
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | /** |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | * @return mixed The return value of the callback, or FALSE on error. |
| 223 | 223 | */ |
| 224 | 224 | public function __get($fieldName) { |
| 225 | - return call_user_func_array([$this, "get" . ucfirst($fieldName)], []); |
|
| 225 | + return call_user_func_array([$this, "get".ucfirst($fieldName)], []); |
|
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | } |