Passed
Push — master ( a3c0d0...678db7 )
by Cody
06:27 queued 03:12
created
lib/gettext/gettext.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -38,17 +38,17 @@  discard block
 block discarded – undo
38 38
    var $error = 0; // public variable that holds error code (0 if no error)
39 39
 
40 40
    //private:
41
-  var $BYTEORDER = 0;        // 0: low endian, 1: big endian
41
+  var $BYTEORDER = 0; // 0: low endian, 1: big endian
42 42
   var $STREAM = null;
43 43
   var $short_circuit = false;
44 44
   var $enable_cache = false;
45
-  var $originals = null;      // offset of original table
46
-  var $translations = null;    // offset of translation table
47
-  var $pluralheader = null;    // cache header field for plural forms
48
-  var $total = 0;          // total string count
49
-  var $table_originals = null;  // table for original strings (offsets)
50
-  var $table_translations = null;  // table for translated strings (offsets)
51
-  var $cache_translations = null;  // original -> translation mapping
45
+  var $originals = null; // offset of original table
46
+  var $translations = null; // offset of translation table
47
+  var $pluralheader = null; // cache header field for plural forms
48
+  var $total = 0; // total string count
49
+  var $table_originals = null; // table for original strings (offsets)
50
+  var $table_translations = null; // table for translated strings (offsets)
51
+  var $cache_translations = null; // original -> translation mapping
52 52
 
53 53
 
54 54
   /* Methods */
@@ -63,11 +63,11 @@  discard block
 block discarded – undo
63 63
   function readint() {
64 64
       if ($this->BYTEORDER == 0) {
65 65
         // low endian
66
-        $input=unpack('V', $this->STREAM->read(4));
66
+        $input = unpack('V', $this->STREAM->read(4));
67 67
         return array_shift($input);
68 68
       } else {
69 69
         // big endian
70
-        $input=unpack('N', $this->STREAM->read(4));
70
+        $input = unpack('N', $this->STREAM->read(4));
71 71
         return array_shift($input);
72 72
       }
73 73
     }
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
    */
101 101
   function __construct($Reader, $enable_cache = true) {
102 102
     // If there isn't a StreamReader, turn on short circuit mode.
103
-    if (! $Reader || isset($Reader->error) ) {
103
+    if (!$Reader || isset($Reader->error)) {
104 104
       $this->short_circuit = true;
105 105
       return;
106 106
     }
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
     }
155 155
 
156 156
     if ($this->enable_cache) {
157
-      $this->cache_translations = array ();
157
+      $this->cache_translations = array();
158 158
       /* read all strings in the cache */
159 159
       for ($i = 0; $i < $this->total; $i++) {
160 160
         $this->STREAM->seekto($this->table_originals[$i * 2 + 2]);
@@ -176,11 +176,11 @@  discard block
 block discarded – undo
176 176
   function get_original_string($num) {
177 177
     $length = $this->table_originals[$num * 2 + 1];
178 178
     $offset = $this->table_originals[$num * 2 + 2];
179
-    if (! $length)
179
+    if (!$length)
180 180
       return '';
181 181
     $this->STREAM->seekto($offset);
182 182
     $data = $this->STREAM->read($length);
183
-    return (string)$data;
183
+    return (string) $data;
184 184
   }
185 185
 
186 186
   /**
@@ -193,11 +193,11 @@  discard block
 block discarded – undo
193 193
   function get_translation_string($num) {
194 194
     $length = $this->table_translations[$num * 2 + 1];
195 195
     $offset = $this->table_translations[$num * 2 + 2];
196
-    if (! $length)
196
+    if (!$length)
197 197
       return '';
198 198
     $this->STREAM->seekto($offset);
199 199
     $data = $this->STREAM->read($length);
200
-    return (string)$data;
200
+    return (string) $data;
201 201
   }
202 202
 
203 203
   /**
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
       return $this->find_string($string, $end, $start);
228 228
     } else {
229 229
       // Divide table in two parts
230
-      $half = (int)(($start + $end) / 2);
230
+      $half = (int) (($start + $end) / 2);
231 231
       $cmp = strcmp($string, $this->get_original_string($half));
232 232
       if ($cmp == 0)
233 233
         // string is exactly in the middle => return it
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
         $res .= ') : (';
295 295
         break;
296 296
       case ';':
297
-        $res .= str_repeat( ')', $p) . ';';
297
+        $res .= str_repeat(')', $p).';';
298 298
         $p = 0;
299 299
         break;
300 300
       default:
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
     $this->load_tables();
331 331
 
332 332
     // cache header field for plural forms
333
-    if (! is_string($this->pluralheader)) {
333
+    if (!is_string($this->pluralheader)) {
334 334
       if ($this->enable_cache) {
335 335
         $header = $this->cache_translations[""];
336 336
       } else {
@@ -352,12 +352,12 @@  discard block
 block discarded – undo
352 352
   function select_string($n) {
353 353
     if (!is_int($n)) {
354 354
       throw new InvalidArgumentException(
355
-        "Select_string only accepts integers: " . $n);
355
+        "Select_string only accepts integers: ".$n);
356 356
     }
357 357
     $string = $this->get_plural_forms();
358
-    $string = str_replace('nplurals',"\$total",$string);
359
-    $string = str_replace("n",$n,$string);
360
-    $string = str_replace('plural',"\$plural",$string);
358
+    $string = str_replace('nplurals', "\$total", $string);
359
+    $string = str_replace("n", $n, $string);
360
+    $string = str_replace('plural', "\$plural", $string);
361 361
 
362 362
     $total = 0;
363 363
     $plural = 0;
@@ -388,11 +388,11 @@  discard block
 block discarded – undo
388 388
     $select = $this->select_string($number);
389 389
 
390 390
     // this should contains all strings separated by NULLs
391
-    $key = $single . chr(0) . $plural;
391
+    $key = $single.chr(0).$plural;
392 392
 
393 393
 
394 394
     if ($this->enable_cache) {
395
-      if (! array_key_exists($key, $this->cache_translations)) {
395
+      if (!array_key_exists($key, $this->cache_translations)) {
396 396
         return ($number != 1) ? $plural : $single;
397 397
       } else {
398 398
         $result = $this->cache_translations[$key];
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
   }
413 413
 
414 414
   function pgettext($context, $msgid) {
415
-    $key = $context . chr(4) . $msgid;
415
+    $key = $context.chr(4).$msgid;
416 416
     $ret = $this->translate($key);
417 417
     if (strpos($ret, "\004") !== false) {
418 418
       return $msgid;
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
   }
423 423
 
424 424
   function npgettext($context, $singular, $plural, $number) {
425
-    $key = $context . chr(4) . $singular;
425
+    $key = $context.chr(4).$singular;
426 426
     $ret = $this->ngettext($key, $plural, $number);
427 427
     if (strpos($ret, "\004") !== false) {
428 428
       return $singular;
Please login to merge, or discard this patch.
include/functions.php 1 patch
Spacing   +53 added lines, -54 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
 define('LABEL_BASE_INDEX', -1024);
6 6
 define('PLUGIN_FEED_BASE_INDEX', -128);
7 7
 
8
-define('COOKIE_LIFETIME_LONG', 86400*365);
8
+define('COOKIE_LIFETIME_LONG', 86400 * 365);
9 9
 
10 10
 $fetch_last_error = false;
11 11
 $fetch_last_error_code = false;
@@ -57,13 +57,13 @@  discard block
 block discarded – undo
57 57
 // feed limit for one update batch
58 58
 define_default('DAEMON_SLEEP_INTERVAL', 120);
59 59
 // default sleep interval between feed updates (sec)
60
-define_default('MAX_CACHE_FILE_SIZE', 64*1024*1024);
60
+define_default('MAX_CACHE_FILE_SIZE', 64 * 1024 * 1024);
61 61
 // do not cache files larger than that (bytes)
62
-define_default('MAX_DOWNLOAD_FILE_SIZE', 16*1024*1024);
62
+define_default('MAX_DOWNLOAD_FILE_SIZE', 16 * 1024 * 1024);
63 63
 // do not download general files larger than that (bytes)
64 64
 define_default('CACHE_MAX_DAYS', 7);
65 65
 // max age in days for various automatically cached (temporary) files
66
-define_default('MAX_CONDITIONAL_INTERVAL', 3600*12);
66
+define_default('MAX_CONDITIONAL_INTERVAL', 3600 * 12);
67 67
 // max interval between forced unconditional updates for servers
68 68
 // not complying with http if-modified-since (seconds)
69 69
 define_default('MAX_FETCH_REQUESTS_PER_HOST', 25);
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 require_once 'db-prefs.php';
158 158
 require_once 'controls.php';
159 159
 
160
-define('SELF_USER_AGENT', 'Tiny Tiny RSS/' . get_version() . ' (http://tt-rss.org/)');
160
+define('SELF_USER_AGENT', 'Tiny Tiny RSS/'.get_version().' (http://tt-rss.org/)');
161 161
 ini_set('user_agent', SELF_USER_AGENT);
162 162
 
163 163
 $schema_version = false;
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
     if (!is_array($options)) {
202 202
 
203 203
         // falling back on compatibility shim
204
-        $option_names = [ "url", "type", "login", "pass", "post_query", "timeout", "last_modified", "useragent" ];
204
+        $option_names = ["url", "type", "login", "pass", "post_query", "timeout", "last_modified", "useragent"];
205 205
         $tmp = [];
206 206
 
207 207
         for ($i = 0; $i < func_num_args(); $i++) {
@@ -228,13 +228,13 @@  discard block
 block discarded – undo
228 228
     $url = str_replace(' ', '%20', $url);
229 229
 
230 230
     if (strpos($url, "//") === 0)
231
-        $url = 'http:' . $url;
231
+        $url = 'http:'.$url;
232 232
 
233 233
     $url_host = parse_url($url, PHP_URL_HOST);
234 234
     $fetch_domain_hits[$url_host] += 1;
235 235
 
236 236
     if ($fetch_domain_hits[$url_host] > MAX_FETCH_REQUESTS_PER_HOST) {
237
-        user_error("Exceeded fetch request quota for $url_host: " . $fetch_domain_hits[$url_host], E_USER_WARNING);
237
+        user_error("Exceeded fetch request quota for $url_host: ".$fetch_domain_hits[$url_host], E_USER_WARNING);
238 238
         #return false;
239 239
     }
240 240
 
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
             array_push($curl_http_headers, "If-Modified-Since: $last_modified");
251 251
 
252 252
         if ($http_accept)
253
-            array_push($curl_http_headers, "Accept: " . $http_accept);
253
+            array_push($curl_http_headers, "Accept: ".$http_accept);
254 254
 
255 255
         if (count($curl_http_headers) > 0)
256 256
             curl_setopt($ch, CURLOPT_HTTPHEADER, $curl_http_headers);
@@ -263,11 +263,10 @@  discard block
 block discarded – undo
263 263
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
264 264
         curl_setopt($ch, CURLOPT_HEADER, true);
265 265
         curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
266
-        curl_setopt($ch, CURLOPT_USERAGENT, $useragent ? $useragent :
267
-            SELF_USER_AGENT);
266
+        curl_setopt($ch, CURLOPT_USERAGENT, $useragent ? $useragent : SELF_USER_AGENT);
268 267
         curl_setopt($ch, CURLOPT_ENCODING, "");
269 268
 
270
-        if  ($http_referrer)
269
+        if ($http_referrer)
271 270
             curl_setopt($ch, CURLOPT_REFERER, $http_referrer);
272 271
 
273 272
         if ($max_size) {
@@ -276,7 +275,7 @@  discard block
 block discarded – undo
276 275
 
277 276
             // holy shit closures in php
278 277
             // download & upload are *expected* sizes respectively, could be zero
279
-            curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, function($curl_handle, $download_size, $downloaded, $upload_size, $uploaded) use( &$max_size) {
278
+            curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, function($curl_handle, $download_size, $downloaded, $upload_size, $uploaded) use(&$max_size) {
280 279
                 Debug::log("[curl progressfunction] $downloaded $max_size", Debug::$LOG_EXTENDED);
281 280
 
282 281
                 return ($downloaded > $max_size) ? 1 : 0; // if max size is set, abort when exceeding it
@@ -336,7 +335,7 @@  discard block
 block discarded – undo
336 335
         if ($http_code != 200 || $type && strpos($fetch_last_content_type, "$type") === false) {
337 336
 
338 337
             if (curl_errno($ch) != 0) {
339
-                $fetch_last_error .=  "; " . curl_errno($ch) . " " . curl_error($ch);
338
+                $fetch_last_error .= "; ".curl_errno($ch)." ".curl_error($ch);
340 339
             }
341 340
 
342 341
             $fetch_last_error_content = $contents;
@@ -345,7 +344,7 @@  discard block
 block discarded – undo
345 344
         }
346 345
 
347 346
         if (!$contents) {
348
-            $fetch_last_error = curl_errno($ch) . " " . curl_error($ch);
347
+            $fetch_last_error = curl_errno($ch)." ".curl_error($ch);
349 348
             curl_close($ch);
350 349
             return false;
351 350
         }
@@ -365,7 +364,7 @@  discard block
 block discarded – undo
365 364
 
366 365
         $fetch_curl_used = false;
367 366
 
368
-        if ($login && $pass){
367
+        if ($login && $pass) {
369 368
             $url_parts = array();
370 369
 
371 370
             preg_match("/(^[^:]*):\/\/(.*)/", $url, $url_parts);
@@ -373,7 +372,7 @@  discard block
 block discarded – undo
373 372
             $pass = urlencode($pass);
374 373
 
375 374
             if ($url_parts[1] && $url_parts[2]) {
376
-                $url = $url_parts[1] . "://$login:$pass@" . $url_parts[2];
375
+                $url = $url_parts[1]."://$login:$pass@".$url_parts[2];
377 376
             }
378 377
         }
379 378
 
@@ -441,7 +440,7 @@  discard block
 block discarded – undo
441 440
             $error = error_get_last();
442 441
 
443 442
             if ($error['message'] != $old_error['message']) {
444
-                $fetch_last_error .= "; " . $error["message"];
443
+                $fetch_last_error .= "; ".$error["message"];
445 444
             }
446 445
 
447 446
             $fetch_last_error_content = $data;
@@ -516,15 +515,15 @@  discard block
 block discarded – undo
516 515
 
517 516
 function get_ssl_certificate_id() {
518 517
     if ($_SERVER["REDIRECT_SSL_CLIENT_M_SERIAL"]) {
519
-        return sha1($_SERVER["REDIRECT_SSL_CLIENT_M_SERIAL"] .
520
-            $_SERVER["REDIRECT_SSL_CLIENT_V_START"] .
521
-            $_SERVER["REDIRECT_SSL_CLIENT_V_END"] .
518
+        return sha1($_SERVER["REDIRECT_SSL_CLIENT_M_SERIAL"].
519
+            $_SERVER["REDIRECT_SSL_CLIENT_V_START"].
520
+            $_SERVER["REDIRECT_SSL_CLIENT_V_END"].
522 521
             $_SERVER["REDIRECT_SSL_CLIENT_S_DN"]);
523 522
     }
524 523
     if ($_SERVER["SSL_CLIENT_M_SERIAL"]) {
525
-        return sha1($_SERVER["SSL_CLIENT_M_SERIAL"] .
526
-            $_SERVER["SSL_CLIENT_V_START"] .
527
-            $_SERVER["SSL_CLIENT_V_END"] .
524
+        return sha1($_SERVER["SSL_CLIENT_M_SERIAL"].
525
+            $_SERVER["SSL_CLIENT_V_START"].
526
+            $_SERVER["SSL_CLIENT_V_END"].
528 527
             $_SERVER["SSL_CLIENT_S_DN"]);
529 528
     }
530 529
     return "";
@@ -659,7 +658,7 @@  discard block
 block discarded – undo
659 658
 function logout_user() {
660 659
     @session_destroy();
661 660
     if (isset($_COOKIE[session_name()])) {
662
-       setcookie(session_name(), '', time()-42000, '/');
661
+       setcookie(session_name(), '', time() - 42000, '/');
663 662
     }
664 663
     session_commit();
665 664
 }
@@ -743,7 +742,7 @@  discard block
 block discarded – undo
743 742
 
744 743
 function truncate_string($str, $max_len, $suffix = '&hellip;') {
745 744
     if (mb_strlen($str, "utf-8") > $max_len) {
746
-        return mb_substr($str, 0, $max_len, "utf-8") . $suffix;
745
+        return mb_substr($str, 0, $max_len, "utf-8").$suffix;
747 746
     } else {
748 747
         return $str;
749 748
     }
@@ -753,7 +752,7 @@  discard block
 block discarded – undo
753 752
     $startString = mb_substr($original, 0, $position, "UTF-8");
754 753
     $endString = mb_substr($original, $position + $length, mb_strlen($original), "UTF-8");
755 754
 
756
-    $out = $startString . $replacement . $endString;
755
+    $out = $startString.$replacement.$endString;
757 756
 
758 757
     return $out;
759 758
 }
@@ -891,9 +890,9 @@  discard block
 block discarded – undo
891 890
 }
892 891
 
893 892
 function file_is_locked($filename) {
894
-    if (file_exists(LOCK_DIRECTORY . "/$filename")) {
893
+    if (file_exists(LOCK_DIRECTORY."/$filename")) {
895 894
         if (function_exists('flock')) {
896
-            $fp = @fopen(LOCK_DIRECTORY . "/$filename", "r");
895
+            $fp = @fopen(LOCK_DIRECTORY."/$filename", "r");
897 896
             if ($fp) {
898 897
                 if (flock($fp, LOCK_EX | LOCK_NB)) {
899 898
                     flock($fp, LOCK_UN);
@@ -914,11 +913,11 @@  discard block
 block discarded – undo
914 913
 
915 914
 
916 915
 function make_lockfile($filename) {
917
-    $fp = fopen(LOCK_DIRECTORY . "/$filename", "w");
916
+    $fp = fopen(LOCK_DIRECTORY."/$filename", "w");
918 917
 
919 918
     if ($fp && flock($fp, LOCK_EX | LOCK_NB)) {
920 919
         $stat_h = fstat($fp);
921
-        $stat_f = stat(LOCK_DIRECTORY . "/$filename");
920
+        $stat_f = stat(LOCK_DIRECTORY."/$filename");
922 921
 
923 922
         if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') {
924 923
             if ($stat_h["ino"] != $stat_f["ino"] ||
@@ -929,7 +928,7 @@  discard block
 block discarded – undo
929 928
         }
930 929
 
931 930
         if (function_exists('posix_getpid')) {
932
-            fwrite($fp, posix_getpid() . "\n");
931
+            fwrite($fp, posix_getpid()."\n");
933 932
         }
934 933
         return $fp;
935 934
     } else {
@@ -938,10 +937,10 @@  discard block
 block discarded – undo
938 937
 }
939 938
 
940 939
 function make_stampfile($filename) {
941
-    $fp = fopen(LOCK_DIRECTORY . "/$filename", "w");
940
+    $fp = fopen(LOCK_DIRECTORY."/$filename", "w");
942 941
 
943 942
     if (flock($fp, LOCK_EX | LOCK_NB)) {
944
-        fwrite($fp, time() . "\n");
943
+        fwrite($fp, time()."\n");
945 944
         flock($fp, LOCK_UN);
946 945
         fclose($fp);
947 946
         return true;
@@ -991,7 +990,7 @@  discard block
 block discarded – undo
991 990
     $params["is_default_pw"] = Pref_Prefs::isdefaultpassword();
992 991
     $params["label_base_index"] = (int) LABEL_BASE_INDEX;
993 992
 
994
-    $theme = get_pref( "USER_CSS_THEME", false, false);
993
+    $theme = get_pref("USER_CSS_THEME", false, false);
995 994
     $params["theme"] = theme_exists($theme) ? $theme : "";
996 995
 
997 996
     $params["plugins"] = implode(", ", PluginHost::getInstance()->get_plugin_names());
@@ -1215,13 +1214,13 @@  discard block
 block discarded – undo
1215 1214
         }
1216 1215
     }
1217 1216
 
1218
-    if (file_exists(LOCK_DIRECTORY . "/update_daemon.lock")) {
1217
+    if (file_exists(LOCK_DIRECTORY."/update_daemon.lock")) {
1219 1218
 
1220 1219
         $data['daemon_is_running'] = (int) file_is_locked("update_daemon.lock");
1221 1220
 
1222 1221
         if (time() - $_SESSION["daemon_stamp_check"] > 30) {
1223 1222
 
1224
-            $stamp = (int) @file_get_contents(LOCK_DIRECTORY . "/update_daemon.stamp");
1223
+            $stamp = (int) @file_get_contents(LOCK_DIRECTORY."/update_daemon.stamp");
1225 1224
 
1226 1225
             if ($stamp) {
1227 1226
                 $stamp_delta = time() - $stamp;
@@ -1264,7 +1263,7 @@  discard block
 block discarded – undo
1264 1263
     $res = trim($str); if (!$res) return '';
1265 1264
 
1266 1265
     $doc = new DOMDocument();
1267
-    $doc->loadHTML('<?xml encoding="UTF-8">' . $res);
1266
+    $doc->loadHTML('<?xml encoding="UTF-8">'.$res);
1268 1267
     $xpath = new DOMXPath($doc);
1269 1268
 
1270 1269
     $rewrite_base_url = $site_url ? $site_url : get_self_url_prefix();
@@ -1363,7 +1362,7 @@  discard block
 block discarded – undo
1363 1362
         'ol', 'p', 'picture', 'pre', 'q', 'ruby', 'rp', 'rt', 's', 'samp', 'section',
1364 1363
         'small', 'source', 'span', 'strike', 'strong', 'sub', 'summary',
1365 1364
         'sup', 'table', 'tbody', 'td', 'tfoot', 'th', 'thead', 'time',
1366
-        'tr', 'track', 'tt', 'u', 'ul', 'var', 'wbr', 'video', 'xml:namespace' );
1365
+        'tr', 'track', 'tt', 'u', 'ul', 'var', 'wbr', 'video', 'xml:namespace');
1367 1366
 
1368 1367
     if ($_SESSION['hasSandbox']) $allowed_elements[] = 'iframe';
1369 1368
 
@@ -1498,8 +1497,8 @@  discard block
 block discarded – undo
1498 1497
 
1499 1498
 // this returns SELF_URL_PATH sans ending slash
1500 1499
 function get_self_url_prefix() {
1501
-    if (strrpos(SELF_URL_PATH, "/") === strlen(SELF_URL_PATH)-1) {
1502
-        return substr(SELF_URL_PATH, 0, strlen(SELF_URL_PATH)-1);
1500
+    if (strrpos(SELF_URL_PATH, "/") === strlen(SELF_URL_PATH) - 1) {
1501
+        return substr(SELF_URL_PATH, 0, strlen(SELF_URL_PATH) - 1);
1503 1502
     } else {
1504 1503
         return SELF_URL_PATH;
1505 1504
     }
@@ -1508,11 +1507,11 @@  discard block
 block discarded – undo
1508 1507
 /* TODO: This needs to use bcrypt */
1509 1508
 function encrypt_password($pass, $salt = '', $mode2 = false) {
1510 1509
     if ($salt && $mode2) {
1511
-        return "MODE2:" . hash('sha256', $salt . $pass);
1510
+        return "MODE2:".hash('sha256', $salt.$pass);
1512 1511
     } else if ($salt) {
1513
-        return "SHA1X:" . sha1("$salt:$pass");
1512
+        return "SHA1X:".sha1("$salt:$pass");
1514 1513
     } else {
1515
-        return "SHA1:" . sha1($pass);
1514
+        return "SHA1:".sha1($pass);
1516 1515
     }
1517 1516
 }
1518 1517
 
@@ -1523,7 +1522,7 @@  discard block
 block discarded – undo
1523 1522
 }
1524 1523
 
1525 1524
 function build_url($parts) {
1526
-    return $parts['scheme'] . "://" . $parts['host'] . $parts['path'];
1525
+    return $parts['scheme']."://".$parts['host'].$parts['path'];
1527 1526
 }
1528 1527
 
1529 1528
 function cleanup_url_path($path) {
@@ -1567,7 +1566,7 @@  discard block
 block discarded – undo
1567 1566
             $dir = dirname($parts['path']);
1568 1567
             $dir !== '/' && $dir .= '/';
1569 1568
         }
1570
-        $parts['path'] = $dir . $rel_url;
1569
+        $parts['path'] = $dir.$rel_url;
1571 1570
         $parts['path'] = cleanup_url_path($parts['path']);
1572 1571
 
1573 1572
         return build_url($parts);
@@ -1654,12 +1653,12 @@  discard block
 block discarded – undo
1654 1653
 
1655 1654
         for ($i = 0; $i < $l10n->total; $i++) {
1656 1655
             $orig = $l10n->get_original_string($i);
1657
-            if(strpos($orig, "\000") !== false) { // Plural forms
1656
+            if (strpos($orig, "\000") !== false) { // Plural forms
1658 1657
                 $key = explode(chr(0), $orig);
1659 1658
                 print T_js_decl($key[0], _ngettext($key[0], $key[1], 1)); // Singular
1660 1659
                 print T_js_decl($key[1], _ngettext($key[0], $key[1], 2)); // Plural
1661 1660
             } else {
1662
-                $translation = _dgettext($domain,$orig);
1661
+                $translation = _dgettext($domain, $orig);
1663 1662
                 print T_js_decl($orig, $translation);
1664 1663
             }
1665 1664
         }
@@ -1715,7 +1714,7 @@  discard block
 block discarded – undo
1715 1714
     if (file_exists($filename)) {
1716 1715
         $ext = pathinfo($filename, PATHINFO_EXTENSION);
1717 1716
 
1718
-        return "data:image/$ext;base64," . base64_encode(file_get_contents($filename));
1717
+        return "data:image/$ext;base64,".base64_encode(file_get_contents($filename));
1719 1718
     } else {
1720 1719
         return "";
1721 1720
     }
@@ -1752,7 +1751,7 @@  discard block
 block discarded – undo
1752 1751
 
1753 1752
         header("Content-type: $mimetype");
1754 1753
 
1755
-        $stamp = gmdate("D, d M Y H:i:s", filemtime($filename)) . " GMT";
1754
+        $stamp = gmdate("D, d M Y H:i:s", filemtime($filename))." GMT";
1756 1755
         header("Last-Modified: $stamp", true);
1757 1756
 
1758 1757
         return readfile($filename);
@@ -1762,7 +1761,7 @@  discard block
 block discarded – undo
1762 1761
 }
1763 1762
 
1764 1763
 function arr_qmarks($arr) {
1765
-    return str_repeat('?,', count($arr) - 1) . '?';
1764
+    return str_repeat('?,', count($arr) - 1).'?';
1766 1765
 }
1767 1766
 
1768 1767
 function get_scripts_timestamp() {
@@ -1797,7 +1796,7 @@  discard block
 block discarded – undo
1797 1796
     } else if (PHP_OS === "Darwin") {
1798 1797
         $ttrss_version = "UNKNOWN (Unsupported, Darwin)";
1799 1798
     } else if (file_exists("$root_dir/version_static.txt")) {
1800
-        $ttrss_version = trim(file_get_contents("$root_dir/version_static.txt")) . " (Unsupported)";
1799
+        $ttrss_version = trim(file_get_contents("$root_dir/version_static.txt"))." (Unsupported)";
1801 1800
     } else if (is_dir("$root_dir/.git")) {
1802 1801
         $rc = 0;
1803 1802
         $output = [];
@@ -1815,10 +1814,10 @@  discard block
 block discarded – undo
1815 1814
                 $git_commit = $commit;
1816 1815
                 $git_timestamp = $timestamp;
1817 1816
 
1818
-                $ttrss_version = strftime("%y.%m", $timestamp) . "-$commit";
1817
+                $ttrss_version = strftime("%y.%m", $timestamp)."-$commit";
1819 1818
             }
1820 1819
         } else {
1821
-            user_error("Unable to determine version (using $root_dir): " . implode("\n", $output), E_USER_WARNING);
1820
+            user_error("Unable to determine version (using $root_dir): ".implode("\n", $output), E_USER_WARNING);
1822 1821
         }
1823 1822
     }
1824 1823
 
Please login to merge, or discard this patch.
include/controls.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 
77 77
 	$pdo = DB::pdo();
78 78
 
79
-	print_r(in_array("CAT:6",$default_ids));
79
+	print_r(in_array("CAT:6", $default_ids));
80 80
 
81 81
 	if (!$root_id) {
82 82
 		print "<select multiple=\true\" id=\"$id\" name=\"$id\" $attributes>";
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 		while ($line = $sth->fetch()) {
103 103
 
104 104
 			for ($i = 0; $i < $nest_level; $i++)
105
-				$line["title"] = " - " . $line["title"];
105
+				$line["title"] = " - ".$line["title"];
106 106
 
107 107
 			$is_selected = in_array("CAT:".$line["id"], $default_ids) ? "selected=\"1\"" : "";
108 108
 
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 
112 112
 			if ($line["num_children"] > 0)
113 113
 				print_feed_multi_select($id, $default_ids, $attributes,
114
-					$include_all_feeds, $line["id"], $nest_level+1);
114
+					$include_all_feeds, $line["id"], $nest_level + 1);
115 115
 
116 116
 			$f_sth = $pdo->prepare("SELECT id,title FROM ttrss_feeds
117 117
 					WHERE cat_id = ? AND owner_uid = ? ORDER BY title");
@@ -121,10 +121,10 @@  discard block
 block discarded – undo
121 121
 			while ($fline = $f_sth->fetch()) {
122 122
 				$is_selected = (in_array($fline["id"], $default_ids)) ? "selected=\"1\"" : "";
123 123
 
124
-				$fline["title"] = " + " . $fline["title"];
124
+				$fline["title"] = " + ".$fline["title"];
125 125
 
126 126
 				for ($i = 0; $i < $nest_level; $i++)
127
-					$fline["title"] = " - " . $fline["title"];
127
+					$fline["title"] = " - ".$fline["title"];
128 128
 
129 129
 				printf("<option $is_selected value='%d'>%s</option>",
130 130
 					$fline["id"], htmlspecialchars($fline["title"]));
@@ -144,10 +144,10 @@  discard block
 block discarded – undo
144 144
 			while ($fline = $f_sth->fetch()) {
145 145
 				$is_selected = in_array($fline["id"], $default_ids) ? "selected=\"1\"" : "";
146 146
 
147
-				$fline["title"] = " + " . $fline["title"];
147
+				$fline["title"] = " + ".$fline["title"];
148 148
 
149 149
 				for ($i = 0; $i < $nest_level; $i++)
150
-					$fline["title"] = " - " . $fline["title"];
150
+					$fline["title"] = " - ".$fline["title"];
151 151
 
152 152
 				printf("<option $is_selected value='%d'>%s</option>",
153 153
 					$fline["id"], htmlspecialchars($fline["title"]));
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 		}
205 205
 
206 206
 		for ($i = 0; $i < $nest_level; $i++)
207
-			$line["title"] = " - " . $line["title"];
207
+			$line["title"] = " - ".$line["title"];
208 208
 
209 209
 		if ($line["title"])
210 210
 			printf("<option $is_selected value='%d'>%s</option>",
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 
213 213
 		if ($line["num_children"] > 0)
214 214
 			print_feed_cat_select($id, $default_id, $attributes,
215
-				$include_all_cats, $line["id"], $nest_level+1);
215
+				$include_all_cats, $line["id"], $nest_level + 1);
216 216
 	}
217 217
 
218 218
 	if (!$root_id) {
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 	$query = "";
246 246
 
247 247
 	if (!(strpos($filename, "?") === false)) {
248
-		$query = substr($filename, strpos($filename, "?")+1);
248
+		$query = substr($filename, strpos($filename, "?") + 1);
249 249
 		$filename = substr($filename, 0, strpos($filename, "?"));
250 250
 	}
251 251
 
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 		}
301 301
 
302 302
 		if ($entry) $entry .= "<a target=\"_blank\" rel=\"noopener noreferrer\"
303
-				href=\"$url\">" . basename($url) . "</a>";
303
+				href=\"$url\">".basename($url)."</a>";
304 304
 
305 305
 		$entry .= "</div>";
306 306
 
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 			WHERE owner_uid = ? ORDER BY caption");
320 320
 	$sth->execute([$_SESSION['uid']]);
321 321
 
322
-	print "<select default=\"$value\" name=\"" . htmlspecialchars($name) .
322
+	print "<select default=\"$value\" name=\"".htmlspecialchars($name).
323 323
 		"\" $attributes>";
324 324
 
325 325
 	while ($line = $sth->fetch()) {
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 		$issel = ($line["caption"] == $value) ? "selected=\"1\"" : "";
328 328
 
329 329
 		print "<option value=\"".htmlspecialchars($line["caption"])."\"
330
-				$issel>" . htmlspecialchars($line["caption"]) . "</option>";
330
+				$issel>".htmlspecialchars($line["caption"])."</option>";
331 331
 
332 332
 	}
333 333
 
Please login to merge, or discard this patch.
install/index.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 		$query = "";
12 12
 
13 13
 		if (!(strpos($filename, "?") === false)) {
14
-			$query = substr($filename, strpos($filename, "?")+1);
14
+			$query = substr($filename, strpos($filename, "?") + 1);
15 15
 			$filename = substr($filename, 0, strpos($filename, "?"));
16 16
 		}
17 17
 
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 		$errors = array();
86 86
 
87 87
 		if (version_compare(PHP_VERSION, '5.6.0', '<')) {
88
-			array_push($errors, "PHP version 5.6.0 or newer required. You're using " . PHP_VERSION . ".");
88
+			array_push($errors, "PHP version 5.6.0 or newer required. You're using ".PHP_VERSION.".");
89 89
 		}
90 90
 
91 91
 		if (!function_exists("curl_init") && !ini_get("allow_url_fopen")) {
@@ -133,17 +133,17 @@  discard block
 block discarded – undo
133 133
 
134 134
 	function pdo_connect($host, $user, $pass, $db, $type, $port = false) {
135 135
 
136
-		$db_port = $port ? ';port=' . $port : '';
137
-		$db_host = $host ? ';host=' . $host : '';
136
+		$db_port = $port ? ';port='.$port : '';
137
+		$db_host = $host ? ';host='.$host : '';
138 138
 
139 139
 		try {
140
-			$pdo = new PDO($type . ':dbname=' . $db . $db_host . $db_port,
140
+			$pdo = new PDO($type.':dbname='.$db.$db_host.$db_port,
141 141
 				$user,
142 142
 				$pass);
143 143
 
144 144
 			return $pdo;
145 145
 		} catch (Exception $e) {
146
-		    print "<div class='alert alert-danger'>" . $e->getMessage() . "</div>";
146
+		    print "<div class='alert alert-danger'>".$e->getMessage()."</div>";
147 147
 		    return null;
148 148
         }
149 149
 	}
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 	}
190 190
 
191 191
 	function make_self_url_path() {
192
-		$url_path = (is_server_https() ? 'https://' :  'http://') . $_SERVER["HTTP_HOST"] . parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH);
192
+		$url_path = (is_server_https() ? 'https://' : 'http://').$_SERVER["HTTP_HOST"].parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH);
193 193
 
194 194
 		return $url_path;
195 195
 	}
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 
438 438
 						if (!$res) {
439 439
 							print_notice("Query: $line");
440
-							print_error("Error: " . implode(", ", $pdo->errorInfo()));
440
+							print_error("Error: ".implode(", ", $pdo->errorInfo()));
441 441
                         }
442 442
 					}
443 443
 				}
Please login to merge, or discard this patch.