@@ -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) { |
@@ -50,6 +50,9 @@ |
||
| 50 | 50 | */ |
| 51 | 51 | private $_errors = []; |
| 52 | 52 | |
| 53 | + /** |
|
| 54 | + * @param null|Route $tpl |
|
| 55 | + */ |
|
| 53 | 56 | public function __construct($tpl) { |
| 54 | 57 | if (!empty($tpl)) { |
| 55 | 58 | if (is_string($tpl)) { |
@@ -158,10 +158,10 @@ |
||
| 158 | 158 | |
| 159 | 159 | return; |
| 160 | 160 | case (self::TO_FILE): |
| 161 | - $message = "({$type}) " . $message; |
|
| 161 | + $message = "({$type}) ".$message; |
|
| 162 | 162 | |
| 163 | 163 | if (strpos($message, "{{time}}") === false) { |
| 164 | - $message = "{{time}} " . $message; |
|
| 164 | + $message = "{{time}} ".$message; |
|
| 165 | 165 | } |
| 166 | 166 | if (is_null($time)) { |
| 167 | 167 | $time = time(); |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | $time = time(); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - $query = "INSERT INTO " . self::TABLE_NAME . " (type, message, count, last_seen) VALUES (?, ?, 1, ?) |
|
| 41 | + $query = "INSERT INTO ".self::TABLE_NAME." (type, message, count, last_seen) VALUES (?, ?, 1, ?) |
|
| 42 | 42 | ON DUPLICATE KEY UPDATE count = count + 1, last_seen = ?"; |
| 43 | 43 | try { |
| 44 | 44 | return DBCore::doUpdateQuery($query, "ssss", [ |
@@ -27,16 +27,16 @@ discard block |
||
| 27 | 27 | public static function http_redirect($url, $params = [], $session = false) { |
| 28 | 28 | $paramsString = ""; |
| 29 | 29 | foreach ($params as $key => $value) { |
| 30 | - $paramsString.= "&" . $key . "=" . $value; |
|
| 30 | + $paramsString .= "&".$key."=".$value; |
|
| 31 | 31 | } |
| 32 | 32 | if ($session) { |
| 33 | - $paramsString.= "&" . session_name() . "=" . session_id(); |
|
| 33 | + $paramsString .= "&".session_name()."=".session_id(); |
|
| 34 | 34 | } |
| 35 | 35 | $paramsString = substr($paramsString, 1); |
| 36 | 36 | if ($paramsString) { |
| 37 | - $paramsString = "?" . $paramsString; |
|
| 37 | + $paramsString = "?".$paramsString; |
|
| 38 | 38 | } |
| 39 | - header("Location: " . $url . $paramsString); |
|
| 39 | + header("Location: ".$url.$paramsString); |
|
| 40 | 40 | exit(); |
| 41 | 41 | } |
| 42 | 42 | |
@@ -68,9 +68,9 @@ discard block |
||
| 68 | 68 | } |
| 69 | 69 | } |
| 70 | 70 | if (function_exists("http_redirect")) { |
| 71 | - http_redirect("http://" . $_SERVER['SERVER_NAME'] . "/" . $url); |
|
| 71 | + http_redirect("http://".$_SERVER['SERVER_NAME']."/".$url); |
|
| 72 | 72 | } else { |
| 73 | - self::http_redirect("http://" . $_SERVER['SERVER_NAME'] . "/" . $url); |
|
| 73 | + self::http_redirect("http://".$_SERVER['SERVER_NAME']."/".$url); |
|
| 74 | 74 | } |
| 75 | 75 | } |
| 76 | 76 | } |
@@ -131,24 +131,24 @@ discard block |
||
| 131 | 131 | $urlParts['path'] = '/'; |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | - $sock = fsockopen($urlParts['host'], (isset($urlParts['port']) ? (int) $urlParts['port'] : 80), $errno, $errstr, 30); |
|
| 134 | + $sock = fsockopen($urlParts['host'], (isset($urlParts['port']) ? (int)$urlParts['port'] : 80), $errno, $errstr, 30); |
|
| 135 | 135 | if (!$sock) { |
| 136 | 136 | throw new HttpException("$errstr ($errno)"); |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | - $request = "HEAD " . $urlParts['path'] . (isset($urlParts['query']) ? '?' . $urlParts['query'] : '') . " HTTP/1.1\r\n"; |
|
| 140 | - $request.= 'Host: ' . $urlParts['host'] . "\r\n"; |
|
| 141 | - $request.= "Connection: Close\r\n\r\n"; |
|
| 139 | + $request = "HEAD ".$urlParts['path'].(isset($urlParts['query']) ? '?'.$urlParts['query'] : '')." HTTP/1.1\r\n"; |
|
| 140 | + $request .= 'Host: '.$urlParts['host']."\r\n"; |
|
| 141 | + $request .= "Connection: Close\r\n\r\n"; |
|
| 142 | 142 | fwrite($sock, $request); |
| 143 | 143 | $response = ''; |
| 144 | 144 | while (!feof($sock)) { |
| 145 | - $response.= fread($sock, 8192); |
|
| 145 | + $response .= fread($sock, 8192); |
|
| 146 | 146 | } |
| 147 | 147 | fclose($sock); |
| 148 | 148 | |
| 149 | 149 | if (preg_match('/^Location: (.+?)$/m', $response, $matches)) { |
| 150 | 150 | if (substr($matches[1], 0, 1) == "/") { |
| 151 | - return $urlParts['scheme'] . "://" . $urlParts['host'] . trim($matches[1]); |
|
| 151 | + return $urlParts['scheme']."://".$urlParts['host'].trim($matches[1]); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | return trim($matches[1]); |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | if (is_array($val)) { |
| 209 | 209 | $val = implode(',', $val); |
| 210 | 210 | } |
| 211 | - $postParams[] = $key . '=' . urlencode($val); |
|
| 211 | + $postParams[] = $key.'='.urlencode($val); |
|
| 212 | 212 | } |
| 213 | 213 | $postString = implode('&', $postParams); |
| 214 | 214 | |
@@ -220,29 +220,29 @@ discard block |
||
| 220 | 220 | |
| 221 | 221 | // Data goes in the path for a GET request |
| 222 | 222 | if ($type == self::GET) { |
| 223 | - $parts['path'].= '?' . $postString; |
|
| 223 | + $parts['path'] .= '?'.$postString; |
|
| 224 | 224 | } |
| 225 | 225 | |
| 226 | - $request = "$type " . $parts['path'] . " HTTP/1.1\r\n"; |
|
| 227 | - $request.= "Host: " . $parts['host'] . "\r\n"; |
|
| 226 | + $request = "$type ".$parts['path']." HTTP/1.1\r\n"; |
|
| 227 | + $request .= "Host: ".$parts['host']."\r\n"; |
|
| 228 | 228 | |
| 229 | 229 | if ($type == self::POST) { |
| 230 | - $request.= "Content-Type: application/x-www-form-urlencoded\r\n"; |
|
| 231 | - $request.= "Content-Length: " . strlen($postString) . "\r\n"; |
|
| 230 | + $request .= "Content-Type: application/x-www-form-urlencoded\r\n"; |
|
| 231 | + $request .= "Content-Length: ".strlen($postString)."\r\n"; |
|
| 232 | 232 | } |
| 233 | - $request.= "Connection: Close\r\n"; |
|
| 234 | - $request.= "\r\n"; |
|
| 233 | + $request .= "Connection: Close\r\n"; |
|
| 234 | + $request .= "\r\n"; |
|
| 235 | 235 | |
| 236 | 236 | // Data goes in the request body for a POST request |
| 237 | 237 | if ($type == self::POST && isset($postString)) { |
| 238 | - $request.= $postString; |
|
| 238 | + $request .= $postString; |
|
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | fwrite($sock, $request); |
| 242 | 242 | |
| 243 | 243 | $response = ""; |
| 244 | 244 | while (!feof($sock) && $result = fgets($sock)) { |
| 245 | - $response.= $result; |
|
| 245 | + $response .= $result; |
|
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | fclose($sock); |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | header('HTTP/1.0 404 Not Found', true, 404); |
| 283 | 283 | break; |
| 284 | 284 | default: |
| 285 | - throw new HttpException("Invalid HTTP status code '" . $code . "'"); |
|
| 285 | + throw new HttpException("Invalid HTTP status code '".$code."'"); |
|
| 286 | 286 | } |
| 287 | 287 | if (!is_null($path)) { |
| 288 | 288 | include($path); |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | |
| 309 | 309 | return self::forceHttpStatus($code, $path); |
| 310 | 310 | } |
| 311 | - throw new HttpException("Invalid HTTP class method '" . $name . "'"); |
|
| 311 | + throw new HttpException("Invalid HTTP class method '".$name."'"); |
|
| 312 | 312 | } |
| 313 | 313 | |
| 314 | 314 | } |
@@ -112,7 +112,7 @@ |
||
| 112 | 112 | * Detect browser version number |
| 113 | 113 | */ |
| 114 | 114 | $identifiers[] = $browserShortName; |
| 115 | - self::$pattern = '#(?<browser>' . implode('|', $identifiers) . |
|
| 115 | + self::$pattern = '#(?<browser>'.implode('|', $identifiers). |
|
| 116 | 116 | ')[/ ]+(?<version>[0-9.|a-zA-Z.]*)#'; |
| 117 | 117 | if (!preg_match_all(self::$pattern, $userAgent, $matches)) { |
| 118 | 118 | // we have no matching number just continue |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | if (isset($_FIELDS[$fieldName])) { |
| 211 | 211 | $_FIELDS[$fieldName] = $fieldValue; |
| 212 | 212 | } else { |
| 213 | - throw new \Exception("No field '" . $fieldName . "' in global fields list."); |
|
| 213 | + throw new \Exception("No field '".$fieldName."' in global fields list."); |
|
| 214 | 214 | } |
| 215 | 215 | } |
| 216 | 216 | |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | $_FIELDS[$fieldName] = (bool)$_FIELDS[$fieldName]; |
| 249 | 249 | } |
| 250 | 250 | } else { |
| 251 | - throw new \Exception("No field '" . $fieldName . "' in global fields list."); |
|
| 251 | + throw new \Exception("No field '".$fieldName."' in global fields list."); |
|
| 252 | 252 | } |
| 253 | 253 | } |
| 254 | 254 | |
@@ -63,7 +63,7 @@ |
||
| 63 | 63 | $type = strtoupper($chunks[0]); |
| 64 | 64 | |
| 65 | 65 | if (!self::isValidQueryType($type)) { |
| 66 | - throw new DBQueryTypeException("Invalid SQL query type '" . $type . "'"); |
|
| 66 | + throw new DBQueryTypeException("Invalid SQL query type '".$type."'"); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | return $type; |
@@ -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 | } |