@@ -108,9 +108,9 @@ discard block |
||
108 | 108 | * Updates login time. |
109 | 109 | */ |
110 | 110 | public function updateLoginTime() { |
111 | - $query = "UPDATE " . self::TABLE_NAME . " |
|
111 | + $query = "UPDATE ".self::TABLE_NAME." |
|
112 | 112 | SET last_login_time = NOW() |
113 | - WHERE " . self::ID_FIELD_NAME . " = ?"; |
|
113 | + WHERE " . self::ID_FIELD_NAME." = ?"; |
|
114 | 114 | DBCore::doUpdateQuery($query, "i", array($this->id)); |
115 | 115 | } |
116 | 116 | |
@@ -176,8 +176,8 @@ discard block |
||
176 | 176 | */ |
177 | 177 | public function getAvatarPath($icon = false) { |
178 | 178 | $currentAvatarFileName = $this->avatar; |
179 | - if (!empty($currentAvatarFileName) && file_exists(Config::DIR_AVATARS . $currentAvatarFileName)) { |
|
180 | - return Config::DIR_AVATARS . $currentAvatarFileName; |
|
179 | + if (!empty($currentAvatarFileName) && file_exists(Config::DIR_AVATARS.$currentAvatarFileName)) { |
|
180 | + return Config::DIR_AVATARS.$currentAvatarFileName; |
|
181 | 181 | } |
182 | 182 | if ($icon) { |
183 | 183 | return "img/user_avatar.png"; |
@@ -194,14 +194,14 @@ discard block |
||
194 | 194 | */ |
195 | 195 | public function updateAvatar($newAvatarFileName) { |
196 | 196 | $currentAvatarFileName = $this->avatar; |
197 | - if (!empty($currentAvatarFileName) && file_exists(Config::DIR_AVATARS . $currentAvatarFileName)) { |
|
198 | - unlink(Config::DIR_AVATARS . $currentAvatarFileName); |
|
197 | + if (!empty($currentAvatarFileName) && file_exists(Config::DIR_AVATARS.$currentAvatarFileName)) { |
|
198 | + unlink(Config::DIR_AVATARS.$currentAvatarFileName); |
|
199 | 199 | } |
200 | 200 | |
201 | - if (file_exists(Config::DIR_AVATARS . $newAvatarFileName)) { |
|
202 | - $query = "UPDATE " . self::TABLE_NAME |
|
201 | + if (file_exists(Config::DIR_AVATARS.$newAvatarFileName)) { |
|
202 | + $query = "UPDATE ".self::TABLE_NAME |
|
203 | 203 | . " SET avatar = ?" |
204 | - . " WHERE " . self::ID_FIELD_NAME . " = ?"; |
|
204 | + . " WHERE ".self::ID_FIELD_NAME." = ?"; |
|
205 | 205 | if (DBCore::doUpdateQuery($query, "si", array( |
206 | 206 | $newAvatarFileName, |
207 | 207 | $this->id |
@@ -21,7 +21,7 @@ |
||
21 | 21 | ); |
22 | 22 | |
23 | 23 | public function save() { |
24 | - $query = "INSERT INTO " . self::TABLE_NAME . " (setting_id, value) VALUES (?, ?) |
|
24 | + $query = "INSERT INTO ".self::TABLE_NAME." (setting_id, value) VALUES (?, ?) |
|
25 | 25 | ON DUPLICATE KEY UPDATE value = ?"; |
26 | 26 | return DBCore::doUpdateQuery($query, "sss", array( |
27 | 27 | $this->id, |
@@ -88,12 +88,12 @@ discard block |
||
88 | 88 | * delivery, FALSE otherwise. |
89 | 89 | */ |
90 | 90 | protected function sendMail($email, $subject, $message, $format = self::FORMAT_TEXT, $replyTo = "") { |
91 | - $headers = "From: " . $this->fromName . " <" . $this->fromEmail . ">\r\n"; |
|
92 | - $headers.= "Reply-To: " . $replyTo . "\r\n"; |
|
91 | + $headers = "From: ".$this->fromName." <".$this->fromEmail.">\r\n"; |
|
92 | + $headers .= "Reply-To: ".$replyTo."\r\n"; |
|
93 | 93 | |
94 | 94 | if ($format == self::FORMAT_HTML) { |
95 | - $headers.= "MIME-Version: 1.0\r\n"; |
|
96 | - $headers.= "Content-type: text/html; charset=utf-8\r\n"; |
|
95 | + $headers .= "MIME-Version: 1.0\r\n"; |
|
96 | + $headers .= "Content-type: text/html; charset=utf-8\r\n"; |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | /* |
@@ -149,9 +149,9 @@ discard block |
||
149 | 149 | $_EMAIL = $params; |
150 | 150 | |
151 | 151 | ob_start(); |
152 | - include($this->tplFolder . $languageCode . "/" . $template . ".tpl.php"); |
|
152 | + include($this->tplFolder.$languageCode."/".$template.".tpl.php"); |
|
153 | 153 | if (!empty($this->signatureTpl)) { |
154 | - include($this->tplFolder . $languageCode . "/" . $this->signatureTpl); |
|
154 | + include($this->tplFolder.$languageCode."/".$this->signatureTpl); |
|
155 | 155 | } |
156 | 156 | $message = ob_get_contents(); |
157 | 157 | ob_end_clean(); |
@@ -43,10 +43,10 @@ |
||
43 | 43 | } |
44 | 44 | |
45 | 45 | protected function init() { |
46 | - $action = 'action' . ucfirst( |
|
46 | + $action = 'action'.ucfirst( |
|
47 | 47 | preg_replace_callback( |
48 | 48 | "#_([a-z])#", |
49 | - function ($matches) { |
|
49 | + function($matches) { |
|
50 | 50 | return strtoupper($matches[1]); |
51 | 51 | }, |
52 | 52 | $this->route->action |
@@ -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 |