@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $cat_title = htmlspecialchars($row['title']); |
71 | 71 | |
72 | 72 | if ($include_settings) { |
73 | - $order_id = (int)$row["order_id"]; |
|
73 | + $order_id = (int) $row["order_id"]; |
|
74 | 74 | $ttrss_specific_qpart = "ttrssSortOrder=\"$order_id\""; |
75 | 75 | } |
76 | 76 | } else { |
@@ -103,8 +103,8 @@ discard block |
||
103 | 103 | $site_url = htmlspecialchars($fline["site_url"]); |
104 | 104 | |
105 | 105 | if ($include_settings) { |
106 | - $update_interval = (int)$fline["update_interval"]; |
|
107 | - $order_id = (int)$fline["order_id"]; |
|
106 | + $update_interval = (int) $fline["update_interval"]; |
|
107 | + $order_id = (int) $fline["order_id"]; |
|
108 | 108 | |
109 | 109 | $ttrss_specific_qpart = "ttrssSortOrder=\"$order_id\" ttrssUpdateInterval=\"$update_interval\""; |
110 | 110 | } else { |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | |
131 | 131 | if (!isset($_REQUEST["debug"])) { |
132 | 132 | header("Content-type: application/xml+opml"); |
133 | - header("Content-Disposition: attachment; filename=" . $name ); |
|
133 | + header("Content-Disposition: attachment; filename=".$name); |
|
134 | 134 | } else { |
135 | 135 | header("Content-type: text/xml"); |
136 | 136 | } |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | |
140 | 140 | $out .= "<opml version=\"1.0\">"; |
141 | 141 | $out .= "<head> |
142 | - <dateCreated>" . date("r", time()) . "</dateCreated> |
|
142 | + <dateCreated>" . date("r", time())."</dateCreated> |
|
143 | 143 | <title>Tiny Tiny RSS Feed Export</title> |
144 | 144 | </head>"; |
145 | 145 | $out .= "<body>"; |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | foreach (json_decode($tmp_line["match_on"], true) as $feed_id) { |
215 | 215 | |
216 | 216 | if (strpos($feed_id, "CAT:") === 0) { |
217 | - $feed_id = (int)substr($feed_id, 4); |
|
217 | + $feed_id = (int) substr($feed_id, 4); |
|
218 | 218 | if ($feed_id) { |
219 | 219 | array_push($match, [Feeds::getCategoryTitle($feed_id), true, false]); |
220 | 220 | } else { |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | } |
223 | 223 | } else { |
224 | 224 | if ($feed_id) { |
225 | - array_push($match, [Feeds::getFeedTitle((int)$feed_id), false, false]); |
|
225 | + array_push($match, [Feeds::getFeedTitle((int) $feed_id), false, false]); |
|
226 | 226 | } else { |
227 | 227 | array_push($match, [0, false, true]); |
228 | 228 | } |
@@ -409,7 +409,7 @@ discard block |
||
409 | 409 | list ($name, $is_cat, $is_id) = $match; |
410 | 410 | |
411 | 411 | if ($is_id) { |
412 | - array_push($match_on, ($is_cat ? "CAT:" : "") . $name); |
|
412 | + array_push($match_on, ($is_cat ? "CAT:" : "").$name); |
|
413 | 413 | } else { |
414 | 414 | |
415 | 415 | if (!$is_cat) { |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | } |
439 | 439 | |
440 | 440 | $reg_exp = $rule["reg_exp"]; |
441 | - $filter_type = (int)$rule["filter_type"]; |
|
441 | + $filter_type = (int) $rule["filter_type"]; |
|
442 | 442 | $inverse = bool_to_sql_bool($rule["inverse"]); |
443 | 443 | $match_on = json_encode($match_on); |
444 | 444 | |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | |
473 | 473 | $cat_filter = bool_to_sql_bool($rule["cat_filter"]); |
474 | 474 | $reg_exp = $rule["reg_exp"]; |
475 | - $filter_type = (int)$rule["filter_type"]; |
|
475 | + $filter_type = (int) $rule["filter_type"]; |
|
476 | 476 | $inverse = bool_to_sql_bool($rule["inverse"]); |
477 | 477 | |
478 | 478 | $usth = $this->pdo->prepare("INSERT INTO ttrss_filters2_rules |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | |
486 | 486 | foreach ($filter["actions"] as $action) { |
487 | 487 | |
488 | - $action_id = (int)$action["action_id"]; |
|
488 | + $action_id = (int) $action["action_id"]; |
|
489 | 489 | $action_param = $action["action_param"]; |
490 | 490 | |
491 | 491 | $usth = $this->pdo->prepare("INSERT INTO ttrss_filters2_actions |
@@ -585,7 +585,7 @@ discard block |
||
585 | 585 | } |
586 | 586 | |
587 | 587 | if (is_uploaded_file($_FILES['opml_file']['tmp_name'])) { |
588 | - $tmp_file = tempnam(CACHE_DIR . '/upload', 'opml'); |
|
588 | + $tmp_file = tempnam(CACHE_DIR.'/upload', 'opml'); |
|
589 | 589 | |
590 | 590 | $result = move_uploaded_file($_FILES['opml_file']['tmp_name'], |
591 | 591 | $tmp_file); |
@@ -623,10 +623,10 @@ discard block |
||
623 | 623 | print "$msg<br/>"; |
624 | 624 | } |
625 | 625 | |
626 | - public static function opml_publish_url(){ |
|
626 | + public static function opml_publish_url() { |
|
627 | 627 | |
628 | 628 | $url_path = get_self_url_prefix(); |
629 | - $url_path .= "/opml.php?op=publish&key=" . |
|
629 | + $url_path .= "/opml.php?op=publish&key=". |
|
630 | 630 | Feeds::get_feed_access_key('OPML:Publish', false, $_SESSION["uid"]); |
631 | 631 | |
632 | 632 | return $url_path; |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | ### HSL >> RGB |
184 | 184 | function _color_hsl2rgb($hsl) { |
185 | 185 | $h = $hsl[0]; $s = $hsl[1]; $l = $hsl[2]; |
186 | - $m2 = ($l <= 0.5) ? $l * ($s + 1) : $l + $s - $l*$s; |
|
186 | + $m2 = ($l <= 0.5) ? $l * ($s + 1) : $l + $s - $l * $s; |
|
187 | 187 | $m1 = $l * 2 - $m2; |
188 | 188 | return array(_color_hue2rgb($m1, $m2, $h + 0.33333), |
189 | 189 | _color_hue2rgb($m1, $m2, $h), |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | $hex = substr($hex, 1); |
209 | 209 | |
210 | 210 | if (strlen($hex) == 4) { |
211 | - $hex = $hex[1] . $hex[1] . $hex[2] . $hex[2] . $hex[3] . $hex[3]; |
|
211 | + $hex = $hex[1].$hex[1].$hex[2].$hex[2].$hex[3].$hex[3]; |
|
212 | 212 | } |
213 | 213 | $c = hexdec($hex); |
214 | 214 | for ($i = 16; $i >= 0; $i -= 8) { |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | function _color_pack($rgb, $normalize = false) { |
221 | 221 | foreach ($rgb as $k => $v) { |
222 | 222 | $out |= (($v * ($normalize ? 255 : 1)) << (16 - $k * 8)); |
223 | - }return '#'. str_pad(dechex($out), 6, 0, STR_PAD_LEFT); |
|
223 | + }return '#'.str_pad(dechex($out), 6, 0, STR_PAD_LEFT); |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | function rgb2hsl($arr) { |
@@ -244,13 +244,13 @@ discard block |
||
244 | 244 | } else { |
245 | 245 | $s = $del_Max / $var_Max; |
246 | 246 | |
247 | - $del_R = ((($var_Max - $var_R ) / 6 ) + ($del_Max / 2 ) ) / $del_Max; |
|
248 | - $del_G = ((($var_Max - $var_G ) / 6 ) + ($del_Max / 2 ) ) / $del_Max; |
|
249 | - $del_B = ((($var_Max - $var_B ) / 6 ) + ($del_Max / 2 ) ) / $del_Max; |
|
247 | + $del_R = ((($var_Max - $var_R) / 6) + ($del_Max / 2)) / $del_Max; |
|
248 | + $del_G = ((($var_Max - $var_G) / 6) + ($del_Max / 2)) / $del_Max; |
|
249 | + $del_B = ((($var_Max - $var_B) / 6) + ($del_Max / 2)) / $del_Max; |
|
250 | 250 | |
251 | - if ($var_R == $var_Max) $h = $del_B - $del_G; |
|
252 | - else if ($var_G == $var_Max) $h = (1 / 3 ) + $del_R - $del_B; |
|
253 | - else if ($var_B == $var_Max) $h = (2 / 3 ) + $del_G - $del_R; |
|
251 | + if ($var_R == $var_Max) $h = $del_B - $del_G; |
|
252 | + else if ($var_G == $var_Max) $h = (1 / 3) + $del_R - $del_B; |
|
253 | + else if ($var_B == $var_Max) $h = (2 / 3) + $del_G - $del_R; |
|
254 | 254 | |
255 | 255 | if ($h < 0) $h++; |
256 | 256 | if ($h > 1) $h--; |
@@ -264,21 +264,21 @@ discard block |
||
264 | 264 | $s = $arr[1]; |
265 | 265 | $v = $arr[2]; |
266 | 266 | |
267 | - if($s == 0) { |
|
267 | + if ($s == 0) { |
|
268 | 268 | $r = $g = $B = $v * 255; |
269 | 269 | } else { |
270 | 270 | $var_H = $h * 6; |
271 | - $var_i = floor($var_H ); |
|
272 | - $var_1 = $v * (1 - $s ); |
|
273 | - $var_2 = $v * (1 - $s * ($var_H - $var_i ) ); |
|
274 | - $var_3 = $v * (1 - $s * (1 - ($var_H - $var_i ) ) ); |
|
275 | - |
|
276 | - if ($var_i == 0) { $var_R = $v ; $var_G = $var_3 ; $var_B = $var_1 ; } |
|
277 | - else if ($var_i == 1) { $var_R = $var_2 ; $var_G = $v ; $var_B = $var_1 ; } |
|
278 | - else if ($var_i == 2) { $var_R = $var_1 ; $var_G = $v ; $var_B = $var_3 ; } |
|
279 | - else if ($var_i == 3) { $var_R = $var_1 ; $var_G = $var_2 ; $var_B = $v ; } |
|
280 | - else if ($var_i == 4) { $var_R = $var_3 ; $var_G = $var_1 ; $var_B = $v ; } |
|
281 | - else { $var_R = $v ; $var_G = $var_1 ; $var_B = $var_2 ; } |
|
271 | + $var_i = floor($var_H); |
|
272 | + $var_1 = $v * (1 - $s); |
|
273 | + $var_2 = $v * (1 - $s * ($var_H - $var_i)); |
|
274 | + $var_3 = $v * (1 - $s * (1 - ($var_H - $var_i))); |
|
275 | + |
|
276 | + if ($var_i == 0) { $var_R = $v; $var_G = $var_3; $var_B = $var_1; } |
|
277 | + else if ($var_i == 1) { $var_R = $var_2; $var_G = $v; $var_B = $var_1; } |
|
278 | + else if ($var_i == 2) { $var_R = $var_1; $var_G = $v; $var_B = $var_3; } |
|
279 | + else if ($var_i == 3) { $var_R = $var_1; $var_G = $var_2; $var_B = $v; } |
|
280 | + else if ($var_i == 4) { $var_R = $var_3; $var_G = $var_1; $var_B = $v; } |
|
281 | + else { $var_R = $v; $var_G = $var_1; $var_B = $var_2; } |
|
282 | 282 | |
283 | 283 | $r = $var_R * 255; |
284 | 284 | $g = $var_G * 255; |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | } |
289 | 289 | |
290 | 290 | function colorPalette($imageFile, $numColors, $granularity = 5) { |
291 | - $granularity = max(1, abs((int)$granularity)); |
|
291 | + $granularity = max(1, abs((int) $granularity)); |
|
292 | 292 | $colors = array(); |
293 | 293 | |
294 | 294 | $size = @getimagesize($imageFile); |
@@ -301,10 +301,10 @@ discard block |
||
301 | 301 | $ico = new floIcon(); |
302 | 302 | @$ico->readICO($imageFile); |
303 | 303 | |
304 | - if(count($ico->images)==0) |
|
304 | + if (count($ico->images) == 0) |
|
305 | 305 | return false; |
306 | 306 | else |
307 | - $img = @$ico->images[count($ico->images)-1]->getImageResource(); |
|
307 | + $img = @$ico->images[count($ico->images) - 1]->getImageResource(); |
|
308 | 308 | |
309 | 309 | } else { |
310 | 310 | return false; |
@@ -316,17 +316,17 @@ discard block |
||
316 | 316 | |
317 | 317 | if (!$img) return false; |
318 | 318 | |
319 | - for($x = 0; $x < $size[0]; $x += $granularity) { |
|
320 | - for($y = 0; $y < $size[1]; $y += $granularity) { |
|
319 | + for ($x = 0; $x < $size[0]; $x += $granularity) { |
|
320 | + for ($y = 0; $y < $size[1]; $y += $granularity) { |
|
321 | 321 | $thisColor = imagecolorat($img, $x, $y); |
322 | 322 | $rgb = imagecolorsforindex($img, $thisColor); |
323 | 323 | $red = round(round(($rgb['red'] / 0x33)) * 0x33); |
324 | 324 | $green = round(round(($rgb['green'] / 0x33)) * 0x33); |
325 | 325 | $blue = round(round(($rgb['blue'] / 0x33)) * 0x33); |
326 | 326 | $thisRGB = sprintf('%02X%02X%02X', $red, $green, $blue); |
327 | - if(array_key_exists($thisRGB, $colors)) { |
|
327 | + if (array_key_exists($thisRGB, $colors)) { |
|
328 | 328 | $colors[$thisRGB]++; |
329 | - } else{ |
|
329 | + } else { |
|
330 | 330 | $colors[$thisRGB] = 1; |
331 | 331 | } |
332 | 332 | } |
@@ -5,7 +5,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
743 | 742 | |
744 | 743 | function truncate_string($str, $max_len, $suffix = '…') { |
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -78,11 +78,11 @@ discard block |
||
78 | 78 | return true; |
79 | 79 | } |
80 | 80 | |
81 | -function ttrss_open () { |
|
81 | +function ttrss_open() { |
|
82 | 82 | return true; |
83 | 83 | } |
84 | 84 | |
85 | -function ttrss_read ($id){ |
|
85 | +function ttrss_read($id) { |
|
86 | 86 | global $session_expire; |
87 | 87 | |
88 | 88 | $sth = Db::pdo()->prepare("SELECT data FROM ttrss_sessions WHERE id=?"); |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | } |
102 | 102 | } |
103 | 103 | |
104 | -function ttrss_write ($id, $data) { |
|
104 | +function ttrss_write($id, $data) { |
|
105 | 105 | global $session_expire; |
106 | 106 | |
107 | 107 | $data = base64_encode($data); |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | return true; |
122 | 122 | } |
123 | 123 | |
124 | -function ttrss_close () { |
|
124 | +function ttrss_close() { |
|
125 | 125 | return true; |
126 | 126 | } |
127 | 127 | |
@@ -132,8 +132,8 @@ discard block |
||
132 | 132 | return true; |
133 | 133 | } |
134 | 134 | |
135 | -function ttrss_gc () { |
|
136 | - Db::pdo()->query("DELETE FROM ttrss_sessions WHERE expire < " . time()); |
|
135 | +function ttrss_gc() { |
|
136 | + Db::pdo()->query("DELETE FROM ttrss_sessions WHERE expire < ".time()); |
|
137 | 137 | |
138 | 138 | return true; |
139 | 139 | } |
@@ -19,7 +19,7 @@ |
||
19 | 19 | } |
20 | 20 | |
21 | 21 | public function get_js() { |
22 | - return file_get_contents(dirname(__FILE__) . "/init.js"); |
|
22 | + return file_get_contents(dirname(__FILE__)."/init.js"); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | public function hook_render_article($article) { |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | } |
14 | 14 | |
15 | 15 | /* @var PluginHost $host */ |
16 | - public function init($host ) { |
|
16 | + public function init($host) { |
|
17 | 17 | $this->host = $host; |
18 | 18 | $this->base = new Auth_Base(); |
19 | 19 | |
@@ -59,16 +59,16 @@ discard block |
||
59 | 59 | $_SESSION["hide_logout"] = true; |
60 | 60 | |
61 | 61 | // LemonLDAP can send user informations via HTTP HEADER |
62 | - if (defined('AUTH_AUTO_CREATE') && AUTH_AUTO_CREATE){ |
|
62 | + if (defined('AUTH_AUTO_CREATE') && AUTH_AUTO_CREATE) { |
|
63 | 63 | // update user name |
64 | 64 | $fullname = $_SERVER['HTTP_USER_NAME'] ? $_SERVER['HTTP_USER_NAME'] : $_SERVER['AUTHENTICATE_CN']; |
65 | - if ($fullname){ |
|
65 | + if ($fullname) { |
|
66 | 66 | $sth = $this->pdo->prepare("UPDATE ttrss_users SET full_name = ? WHERE id = ?"); |
67 | 67 | $sth->execute([$fullname, $user_id]); |
68 | 68 | } |
69 | 69 | // update user mail |
70 | 70 | $email = $_SERVER['HTTP_USER_MAIL'] ? $_SERVER['HTTP_USER_MAIL'] : $_SERVER['AUTHENTICATE_MAIL']; |
71 | - if ($email){ |
|
71 | + if ($email) { |
|
72 | 72 | $sth = $this->pdo->prepare("UPDATE ttrss_users SET email = ? WHERE id = ?"); |
73 | 73 | $sth->execute([$email, $user_id]); |
74 | 74 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | print "<div dojoType=\"dijit.layout.AccordionPane\" |
23 | 23 | title=\"<i class='material-icons'>bookmark</i> ".__('Bookmarklets')."\">"; |
24 | 24 | |
25 | - print "<h3>" . __("Drag the link below to your browser toolbar, open the feed you're interested in in your browser and click on the link to subscribe to it.") . "</h3>"; |
|
25 | + print "<h3>".__("Drag the link below to your browser toolbar, open the feed you're interested in in your browser and click on the link to subscribe to it.")."</h3>"; |
|
26 | 26 | |
27 | 27 | $bm_subscribe_url = str_replace('%s', '', Pref_Feeds::subscribe_to_feed_url()); |
28 | 28 | |
@@ -31,14 +31,14 @@ discard block |
||
31 | 31 | $bm_url = htmlspecialchars("javascript:{if(confirm('$confirm_str'.replace('%s',window.location.href)))window.location.href='$bm_subscribe_url'+window.location.href}"); |
32 | 32 | |
33 | 33 | print "<p><label class='dijitButton'>"; |
34 | - print "<a href=\"$bm_url\">" . __('Subscribe in Tiny Tiny RSS'). "</a>"; |
|
34 | + print "<a href=\"$bm_url\">".__('Subscribe in Tiny Tiny RSS')."</a>"; |
|
35 | 35 | print "</label></p>"; |
36 | 36 | |
37 | - print "<h3>" . __("Use this bookmarklet to publish arbitrary pages using Tiny Tiny RSS") . "</h3>"; |
|
37 | + print "<h3>".__("Use this bookmarklet to publish arbitrary pages using Tiny Tiny RSS")."</h3>"; |
|
38 | 38 | |
39 | 39 | print "<label class='dijitButton'>"; |
40 | 40 | $bm_url = htmlspecialchars("javascript:(function(){var d=document,w=window,e=w.getSelection,k=d.getSelection,x=d.selection,s=(e?e():(k)?k():(x?x.createRange().text:0)),f='".get_self_url_prefix()."/public.php?op=sharepopup',l=d.location,e=encodeURIComponent,g=f+'&title='+((e(s))?e(s):e(document.title))+'&url='+e(l.href);function a(){if(!w.open(g,'t','toolbar=0,resizable=0,scrollbars=1,status=1,width=500,height=250')){l.href=g;}}a();})()"); |
41 | - print "<a href=\"$bm_url\">" . __('Share with Tiny Tiny RSS'). "</a>"; |
|
41 | + print "<a href=\"$bm_url\">".__('Share with Tiny Tiny RSS')."</a>"; |
|
42 | 42 | print "</label>"; |
43 | 43 | |
44 | 44 | print "<button dojoType='dijit.form.Button' class='alt-info' onclick='window.open(\"https://tt-rss.org/wiki/ShareAnything\")'> |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | } |
16 | 16 | |
17 | 17 | public function get_js() { |
18 | - return file_get_contents(dirname(__FILE__) . "/init.js"); |
|
18 | + return file_get_contents(dirname(__FILE__)."/init.js"); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | public function hook_article_button($line) { |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | $sth->execute(array_merge($ids, [$_SESSION['uid']])); |
47 | 47 | |
48 | 48 | if (count($ids) > 1) { |
49 | - $subject = __("[Forwarded]") . " " . __("Multiple articles"); |
|
49 | + $subject = __("[Forwarded]")." ".__("Multiple articles"); |
|
50 | 50 | } else { |
51 | 51 | $subject = ""; |
52 | 52 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | while ($line = $sth->fetch()) { |
55 | 55 | |
56 | 56 | if (!$subject) |
57 | - $subject = __("[Forwarded]") . " " . htmlspecialchars($line["title"]); |
|
57 | + $subject = __("[Forwarded]")." ".htmlspecialchars($line["title"]); |
|
58 | 58 | |
59 | 59 | $tpl->setVariable('ARTICLE_TITLE', strip_tags($line["title"])); |
60 | 60 | $tpl->setVariable('ARTICLE_URL', strip_tags($line["link"])); |
@@ -17,7 +17,7 @@ |
||
17 | 17 | } |
18 | 18 | |
19 | 19 | public function get_js() { |
20 | - return file_get_contents(dirname(__FILE__) . "/note.js"); |
|
20 | + return file_get_contents(dirname(__FILE__)."/note.js"); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 |