@@ -7,10 +7,10 @@ discard block |
||
| 7 | 7 | $ERRORS[0] = ""; |
| 8 | 8 | |
| 9 | 9 | $ERRORS[1] = __("This program requires XmlHttpRequest " . |
| 10 | - "to function properly. Your browser doesn't seem to support it."); |
|
| 10 | + "to function properly. Your browser doesn't seem to support it."); |
|
| 11 | 11 | |
| 12 | 12 | $ERRORS[2] = __("This program requires cookies " . |
| 13 | - "to function properly. Your browser doesn't seem to support them."); |
|
| 13 | + "to function properly. Your browser doesn't seem to support them."); |
|
| 14 | 14 | |
| 15 | 15 | $ERRORS[3] = __("Backend sanity check failed."); |
| 16 | 16 | |
@@ -41,15 +41,15 @@ discard block |
||
| 41 | 41 | $ERRORS[15] = __("Encoding data as JSON failed"); |
| 42 | 42 | |
| 43 | 43 | if ($_REQUEST['mode'] == 'js') { |
| 44 | - header("Content-Type: text/javascript; charset=UTF-8"); |
|
| 44 | + header("Content-Type: text/javascript; charset=UTF-8"); |
|
| 45 | 45 | |
| 46 | - print "var ERRORS = [];\n"; |
|
| 46 | + print "var ERRORS = [];\n"; |
|
| 47 | 47 | |
| 48 | - foreach ($ERRORS as $id => $error) { |
|
| 48 | + foreach ($ERRORS as $id => $error) { |
|
| 49 | 49 | |
| 50 | - $error = preg_replace("/\n/", "", $error); |
|
| 51 | - $error = preg_replace("/\"/", "\\\"", $error); |
|
| 50 | + $error = preg_replace("/\n/", "", $error); |
|
| 51 | + $error = preg_replace("/\"/", "\\\"", $error); |
|
| 52 | 52 | |
| 53 | - print "ERRORS[$id] = \"$error\";\n"; |
|
| 54 | - } |
|
| 53 | + print "ERRORS[$id] = \"$error\";\n"; |
|
| 54 | + } |
|
| 55 | 55 | } |
@@ -173,29 +173,29 @@ discard block |
||
| 173 | 173 | /** |
| 174 | 174 | * Maximum matrix size for maximum version (version 40 is 177*177 matrix). |
| 175 | 175 | */ |
| 176 | - define('QRSPEC_WIDTH_MAX', 177); |
|
| 176 | + define('QRSPEC_WIDTH_MAX', 177); |
|
| 177 | 177 | |
| 178 | 178 | // ----------------------------------------------------- |
| 179 | 179 | |
| 180 | 180 | /** |
| 181 | 181 | * Matrix index to get width from $capacity array. |
| 182 | 182 | */ |
| 183 | - define('QRCAP_WIDTH', 0); |
|
| 183 | + define('QRCAP_WIDTH', 0); |
|
| 184 | 184 | |
| 185 | - /** |
|
| 185 | + /** |
|
| 186 | 186 | * Matrix index to get number of words from $capacity array. |
| 187 | 187 | */ |
| 188 | - define('QRCAP_WORDS', 1); |
|
| 188 | + define('QRCAP_WORDS', 1); |
|
| 189 | 189 | |
| 190 | - /** |
|
| 190 | + /** |
|
| 191 | 191 | * Matrix index to get remainder from $capacity array. |
| 192 | 192 | */ |
| 193 | - define('QRCAP_REMINDER', 2); |
|
| 193 | + define('QRCAP_REMINDER', 2); |
|
| 194 | 194 | |
| 195 | - /** |
|
| 195 | + /** |
|
| 196 | 196 | * Matrix index to get error correction level from $capacity array. |
| 197 | 197 | */ |
| 198 | - define('QRCAP_EC', 3); |
|
| 198 | + define('QRCAP_EC', 3); |
|
| 199 | 199 | |
| 200 | 200 | // ----------------------------------------------------- |
| 201 | 201 | |
@@ -204,33 +204,33 @@ discard block |
||
| 204 | 204 | /** |
| 205 | 205 | * Number of header bits for structured mode |
| 206 | 206 | */ |
| 207 | - define('STRUCTURE_HEADER_BITS', 20); |
|
| 207 | + define('STRUCTURE_HEADER_BITS', 20); |
|
| 208 | 208 | |
| 209 | - /** |
|
| 209 | + /** |
|
| 210 | 210 | * Max number of symbols for structured mode |
| 211 | 211 | */ |
| 212 | - define('MAX_STRUCTURED_SYMBOLS', 16); |
|
| 212 | + define('MAX_STRUCTURED_SYMBOLS', 16); |
|
| 213 | 213 | |
| 214 | 214 | // ----------------------------------------------------- |
| 215 | 215 | |
| 216 | - // Masks |
|
| 216 | + // Masks |
|
| 217 | 217 | |
| 218 | - /** |
|
| 218 | + /** |
|
| 219 | 219 | * Down point base value for case 1 mask pattern (concatenation of same color in a line or a column) |
| 220 | 220 | */ |
| 221 | - define('N1', 3); |
|
| 221 | + define('N1', 3); |
|
| 222 | 222 | |
| 223 | - /** |
|
| 223 | + /** |
|
| 224 | 224 | * Down point base value for case 2 mask pattern (module block of same color) |
| 225 | 225 | */ |
| 226 | 226 | define('N2', 3); |
| 227 | 227 | |
| 228 | - /** |
|
| 228 | + /** |
|
| 229 | 229 | * Down point base value for case 3 mask pattern (1:1:3:1:1(dark:bright:dark:bright:dark)pattern in a line or a column) |
| 230 | 230 | */ |
| 231 | 231 | define('N3', 40); |
| 232 | 232 | |
| 233 | - /** |
|
| 233 | + /** |
|
| 234 | 234 | * Down point base value for case 4 mask pattern (ration of dark modules in whole) |
| 235 | 235 | */ |
| 236 | 236 | define('N4', 10); |
@@ -264,12 +264,12 @@ discard block |
||
| 264 | 264 | |
| 265 | 265 | // for compaibility with PHP4 |
| 266 | 266 | if (!function_exists('str_split')) { |
| 267 | - /** |
|
| 268 | - * Convert a string to an array (needed for PHP4 compatibility) |
|
| 269 | - * @param string $string The input string. |
|
| 270 | - * @param int $split_length Maximum length of the chunk. |
|
| 271 | - * @return If the optional split_length parameter is specified, the returned array will be broken down into chunks with each being split_length in length, otherwise each chunk will be one character in length. FALSE is returned if split_length is less than 1. If the split_length length exceeds the length of string , the entire string is returned as the first (and only) array element. |
|
| 272 | - */ |
|
| 267 | + /** |
|
| 268 | + * Convert a string to an array (needed for PHP4 compatibility) |
|
| 269 | + * @param string $string The input string. |
|
| 270 | + * @param int $split_length Maximum length of the chunk. |
|
| 271 | + * @return If the optional split_length parameter is specified, the returned array will be broken down into chunks with each being split_length in length, otherwise each chunk will be one character in length. FALSE is returned if split_length is less than 1. If the split_length length exceeds the length of string , the entire string is returned as the first (and only) array element. |
|
| 272 | + */ |
|
| 273 | 273 | public function str_split($string, $split_length=1) { |
| 274 | 274 | if ((strlen($string) > $split_length) OR (!$split_length)) { |
| 275 | 275 | do { |
@@ -2622,7 +2622,7 @@ discard block |
||
| 2622 | 2622 | } |
| 2623 | 2623 | |
| 2624 | 2624 | /** |
| 2625 | - * Return block number 1 |
|
| 2625 | + * Return block number 1 |
|
| 2626 | 2626 | * @param array $spec |
| 2627 | 2627 | * @return int value |
| 2628 | 2628 | */ |
@@ -11,7 +11,9 @@ discard block |
||
| 11 | 11 | $_SESSION["profile"] = (int) clean($_REQUEST["id"]); |
| 12 | 12 | |
| 13 | 13 | // default value |
| 14 | - if (!$_SESSION["profile"]) $_SESSION["profile"] = null; |
|
| 14 | + if (!$_SESSION["profile"]) { |
|
| 15 | + $_SESSION["profile"] = null; |
|
| 16 | + } |
|
| 15 | 17 | } |
| 16 | 18 | |
| 17 | 19 | public function remprofiles() { |
@@ -173,7 +175,9 @@ discard block |
||
| 173 | 175 | if ($row = $sth->fetch()) { |
| 174 | 176 | $feed_id = $row["id"]; |
| 175 | 177 | } else { |
| 176 | - if (!$title) $title = '[Unknown]'; |
|
| 178 | + if (!$title) { |
|
| 179 | + $title = '[Unknown]'; |
|
| 180 | + } |
|
| 177 | 181 | |
| 178 | 182 | $sth = $this->pdo->prepare("INSERT INTO ttrss_feeds |
| 179 | 183 | (owner_uid,feed_url,site_url,title,cat_id,auth_login,auth_pass,update_method) |
@@ -216,7 +220,9 @@ discard block |
||
| 216 | 220 | private function archive_article($id, $owner_uid) { |
| 217 | 221 | $this->pdo->beginTransaction(); |
| 218 | 222 | |
| 219 | - if (!$owner_uid) $owner_uid = $_SESSION['uid']; |
|
| 223 | + if (!$owner_uid) { |
|
| 224 | + $owner_uid = $_SESSION['uid']; |
|
| 225 | + } |
|
| 220 | 226 | |
| 221 | 227 | $sth = $this->pdo->prepare("SELECT feed_id FROM ttrss_user_entries |
| 222 | 228 | WHERE ref_id = ? AND owner_uid = ?"); |
@@ -278,8 +284,9 @@ discard block |
||
| 278 | 284 | 'seq' => $seq |
| 279 | 285 | ]; |
| 280 | 286 | |
| 281 | - if ($seq % 2 == 0) |
|
| 282 | - $reply['runtime-info'] = make_runtime_info(); |
|
| 287 | + if ($seq % 2 == 0) { |
|
| 288 | + $reply['runtime-info'] = make_runtime_info(); |
|
| 289 | + } |
|
| 283 | 290 | |
| 284 | 291 | print json_encode($reply); |
| 285 | 292 | } |
@@ -353,7 +360,9 @@ discard block |
||
| 353 | 360 | $payload = json_decode(clean($_REQUEST["payload"]), false); |
| 354 | 361 | $mode = clean($_REQUEST["mode"]); |
| 355 | 362 | |
| 356 | - if (!$payload || !is_array($payload)) return; |
|
| 363 | + if (!$payload || !is_array($payload)) { |
|
| 364 | + return; |
|
| 365 | + } |
|
| 357 | 366 | |
| 358 | 367 | if ($mode == 1) { |
| 359 | 368 | foreach ($payload as $feed) { |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | $sth = $this->pdo->prepare("SELECT link FROM ttrss_entries, ttrss_user_entries |
| 14 | 14 | WHERE id = ? AND id = ref_id AND owner_uid = ? |
| 15 | 15 | LIMIT 1"); |
| 16 | - $sth->execute([$id, $_SESSION['uid']]); |
|
| 16 | + $sth->execute([$id, $_SESSION['uid']]); |
|
| 17 | 17 | |
| 18 | 18 | if ($row = $sth->fetch()) { |
| 19 | 19 | $article_url = $row['link']; |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | |
| 77 | 77 | $sth = $pdo->prepare("SELECT int_id FROM ttrss_user_entries WHERE |
| 78 | 78 | ref_id = ? AND owner_uid = ? LIMIT 1"); |
| 79 | - $sth->execute([$ref_id, $owner_uid]); |
|
| 79 | + $sth->execute([$ref_id, $owner_uid]); |
|
| 80 | 80 | |
| 81 | 81 | if ($row = $sth->fetch()) { |
| 82 | 82 | $int_id = $row['int_id']; |
@@ -616,22 +616,22 @@ discard block |
||
| 616 | 616 | |
| 617 | 617 | public static function purge_orphans() { |
| 618 | 618 | |
| 619 | - // purge orphaned posts in main content table |
|
| 619 | + // purge orphaned posts in main content table |
|
| 620 | 620 | |
| 621 | - if (DB_TYPE == "mysql") |
|
| 622 | - $limit_qpart = "LIMIT 5000"; |
|
| 623 | - else |
|
| 624 | - $limit_qpart = ""; |
|
| 621 | + if (DB_TYPE == "mysql") |
|
| 622 | + $limit_qpart = "LIMIT 5000"; |
|
| 623 | + else |
|
| 624 | + $limit_qpart = ""; |
|
| 625 | 625 | |
| 626 | - $pdo = Db::pdo(); |
|
| 627 | - $res = $pdo->query("DELETE FROM ttrss_entries WHERE |
|
| 626 | + $pdo = Db::pdo(); |
|
| 627 | + $res = $pdo->query("DELETE FROM ttrss_entries WHERE |
|
| 628 | 628 | NOT EXISTS (SELECT ref_id FROM ttrss_user_entries WHERE ref_id = id) $limit_qpart"); |
| 629 | 629 | |
| 630 | - if (Debug::enabled()) { |
|
| 631 | - $rows = $res->rowCount(); |
|
| 632 | - Debug::log("Purged $rows orphaned posts."); |
|
| 633 | - } |
|
| 634 | - } |
|
| 630 | + if (Debug::enabled()) { |
|
| 631 | + $rows = $res->rowCount(); |
|
| 632 | + Debug::log("Purged $rows orphaned posts."); |
|
| 633 | + } |
|
| 634 | + } |
|
| 635 | 635 | |
| 636 | 636 | public static function catchupArticlesById($ids, $cmode, $owner_uid = false) { |
| 637 | 637 | |
@@ -57,10 +57,16 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | $rc = false; |
| 59 | 59 | |
| 60 | - if (!$title) $title = $url; |
|
| 61 | - if (!$title && !$url) return false; |
|
| 60 | + if (!$title) { |
|
| 61 | + $title = $url; |
|
| 62 | + } |
|
| 63 | + if (!$title && !$url) { |
|
| 64 | + return false; |
|
| 65 | + } |
|
| 62 | 66 | |
| 63 | - if (filter_var($url, FILTER_VALIDATE_URL) === FALSE) return false; |
|
| 67 | + if (filter_var($url, FILTER_VALIDATE_URL) === FALSE) { |
|
| 68 | + return false; |
|
| 69 | + } |
|
| 64 | 70 | |
| 65 | 71 | $pdo = Db::pdo(); |
| 66 | 72 | |
@@ -271,7 +277,9 @@ discard block |
||
| 271 | 277 | $tags_str = $this->format_tags_string($tags); |
| 272 | 278 | $tags_str_full = join(", ", $tags); |
| 273 | 279 | |
| 274 | - if (!$tags_str_full) $tags_str_full = __("no tags"); |
|
| 280 | + if (!$tags_str_full) { |
|
| 281 | + $tags_str_full = __("no tags"); |
|
| 282 | + } |
|
| 275 | 283 | |
| 276 | 284 | print json_encode([ |
| 277 | 285 | "id" => (int) $id, |
@@ -320,10 +328,11 @@ discard block |
||
| 320 | 328 | |
| 321 | 329 | foreach ($ids as $id) { |
| 322 | 330 | |
| 323 | - if ($assign) |
|
| 324 | - Labels::add_article($id, $label, $_SESSION["uid"]); |
|
| 325 | - else |
|
| 326 | - Labels::remove_article($id, $label, $_SESSION["uid"]); |
|
| 331 | + if ($assign) { |
|
| 332 | + Labels::add_article($id, $label, $_SESSION["uid"]); |
|
| 333 | + } else { |
|
| 334 | + Labels::remove_article($id, $label, $_SESSION["uid"]); |
|
| 335 | + } |
|
| 327 | 336 | |
| 328 | 337 | $labels = $this->get_article_labels($id, $_SESSION["uid"]); |
| 329 | 338 | |
@@ -384,14 +393,18 @@ discard block |
||
| 384 | 393 | $width = $line["width"]; |
| 385 | 394 | $height = $line["height"]; |
| 386 | 395 | |
| 387 | - if (!$ctype) $ctype = __("unknown type"); |
|
| 396 | + if (!$ctype) { |
|
| 397 | + $ctype = __("unknown type"); |
|
| 398 | + } |
|
| 388 | 399 | |
| 389 | 400 | //$filename = substr($url, strrpos($url, "/")+1); |
| 390 | 401 | $filename = basename($url); |
| 391 | 402 | |
| 392 | 403 | $player = format_inline_player($url, $ctype); |
| 393 | 404 | |
| 394 | - if ($player) array_push($entries_inline, $player); |
|
| 405 | + if ($player) { |
|
| 406 | + array_push($entries_inline, $player); |
|
| 407 | + } |
|
| 395 | 408 | |
| 396 | 409 | # $entry .= " <a target=\"_blank\" href=\"" . htmlspecialchars($url) . "\" rel=\"noopener noreferrer\">" . |
| 397 | 410 | # $filename . " (" . $ctype . ")" . "</a>"; |
@@ -419,8 +432,9 @@ discard block |
||
| 419 | 432 | |
| 420 | 433 | foreach ($entries as $entry) { |
| 421 | 434 | |
| 422 | - foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_RENDER_ENCLOSURE) as $plugin) |
|
| 423 | - $retval = $plugin->hook_render_enclosure($entry, $hide_images); |
|
| 435 | + foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_RENDER_ENCLOSURE) as $plugin) { |
|
| 436 | + $retval = $plugin->hook_render_enclosure($entry, $hide_images); |
|
| 437 | + } |
|
| 424 | 438 | |
| 425 | 439 | |
| 426 | 440 | if ($retval) { |
@@ -431,10 +445,12 @@ discard block |
||
| 431 | 445 | |
| 432 | 446 | if (!$hide_images) { |
| 433 | 447 | $encsize = ''; |
| 434 | - if ($entry['height'] > 0) |
|
| 435 | - $encsize .= ' height="' . intval($entry['height']) . '"'; |
|
| 436 | - if ($entry['width'] > 0) |
|
| 437 | - $encsize .= ' width="' . intval($entry['width']) . '"'; |
|
| 448 | + if ($entry['height'] > 0) { |
|
| 449 | + $encsize .= ' height="' . intval($entry['height']) . '"'; |
|
| 450 | + } |
|
| 451 | + if ($entry['width'] > 0) { |
|
| 452 | + $encsize .= ' width="' . intval($entry['width']) . '"'; |
|
| 453 | + } |
|
| 438 | 454 | $rv .= "<p><img |
| 439 | 455 | alt=\"".htmlspecialchars($entry["filename"])."\" |
| 440 | 456 | src=\"" .htmlspecialchars($entry["url"]) . "\" |
@@ -466,15 +482,17 @@ discard block |
||
| 466 | 482 | $rv .= "<div dojoType=\"dijit.Menu\" style=\"display: none;\">"; |
| 467 | 483 | |
| 468 | 484 | foreach ($entries as $entry) { |
| 469 | - if ($entry["title"]) |
|
| 470 | - $title = " — " . truncate_string($entry["title"], 30); |
|
| 471 | - else |
|
| 472 | - $title = ""; |
|
| 485 | + if ($entry["title"]) { |
|
| 486 | + $title = " — " . truncate_string($entry["title"], 30); |
|
| 487 | + } else { |
|
| 488 | + $title = ""; |
|
| 489 | + } |
|
| 473 | 490 | |
| 474 | - if ($entry["filename"]) |
|
| 475 | - $filename = truncate_middle(htmlspecialchars($entry["filename"]), 60); |
|
| 476 | - else |
|
| 477 | - $filename = ""; |
|
| 491 | + if ($entry["filename"]) { |
|
| 492 | + $filename = truncate_middle(htmlspecialchars($entry["filename"]), 60); |
|
| 493 | + } else { |
|
| 494 | + $filename = ""; |
|
| 495 | + } |
|
| 478 | 496 | |
| 479 | 497 | $rv .= "<div onclick='popupOpenUrl(\"".htmlspecialchars($entry["url"])."\")' |
| 480 | 498 | dojoType=\"dijit.MenuItem\">".$filename . $title."</div>"; |
@@ -492,7 +510,9 @@ discard block |
||
| 492 | 510 | |
| 493 | 511 | $a_id = $id; |
| 494 | 512 | |
| 495 | - if (!$owner_uid) $owner_uid = $_SESSION["uid"]; |
|
| 513 | + if (!$owner_uid) { |
|
| 514 | + $owner_uid = $_SESSION["uid"]; |
|
| 515 | + } |
|
| 496 | 516 | |
| 497 | 517 | $pdo = Db::pdo(); |
| 498 | 518 | |
@@ -510,7 +530,9 @@ discard block |
||
| 510 | 530 | WHERE ref_id = ? AND owner_uid = ?"); |
| 511 | 531 | $csth->execute([$id, $owner_uid]); |
| 512 | 532 | |
| 513 | - if ($row = $csth->fetch()) $tag_cache = $row["tag_cache"]; |
|
| 533 | + if ($row = $csth->fetch()) { |
|
| 534 | + $tag_cache = $row["tag_cache"]; |
|
| 535 | + } |
|
| 514 | 536 | } |
| 515 | 537 | |
| 516 | 538 | if ($tag_cache) { |
@@ -551,8 +573,9 @@ discard block |
||
| 551 | 573 | |
| 552 | 574 | $tags_str = mb_substr($tags_str, 0, mb_strlen($tags_str)-2); |
| 553 | 575 | |
| 554 | - if (count($tags) > $maxtags) |
|
| 555 | - $tags_str .= ", …"; |
|
| 576 | + if (count($tags) > $maxtags) { |
|
| 577 | + $tags_str .= ", …"; |
|
| 578 | + } |
|
| 556 | 579 | |
| 557 | 580 | return $tags_str; |
| 558 | 581 | } |
@@ -560,7 +583,9 @@ discard block |
||
| 560 | 583 | |
| 561 | 584 | public static function format_article_labels($labels) { |
| 562 | 585 | |
| 563 | - if (!is_array($labels)) return ''; |
|
| 586 | + if (!is_array($labels)) { |
|
| 587 | + return ''; |
|
| 588 | + } |
|
| 564 | 589 | |
| 565 | 590 | $labels_str = ""; |
| 566 | 591 | |
@@ -618,10 +643,11 @@ discard block |
||
| 618 | 643 | |
| 619 | 644 | // purge orphaned posts in main content table |
| 620 | 645 | |
| 621 | - if (DB_TYPE == "mysql") |
|
| 622 | - $limit_qpart = "LIMIT 5000"; |
|
| 623 | - else |
|
| 624 | - $limit_qpart = ""; |
|
| 646 | + if (DB_TYPE == "mysql") { |
|
| 647 | + $limit_qpart = "LIMIT 5000"; |
|
| 648 | + } else { |
|
| 649 | + $limit_qpart = ""; |
|
| 650 | + } |
|
| 625 | 651 | |
| 626 | 652 | $pdo = Db::pdo(); |
| 627 | 653 | $res = $pdo->query("DELETE FROM ttrss_entries WHERE |
@@ -635,7 +661,9 @@ discard block |
||
| 635 | 661 | |
| 636 | 662 | public static function catchupArticlesById($ids, $cmode, $owner_uid = false) { |
| 637 | 663 | |
| 638 | - if (!$owner_uid) $owner_uid = $_SESSION["uid"]; |
|
| 664 | + if (!$owner_uid) { |
|
| 665 | + $owner_uid = $_SESSION["uid"]; |
|
| 666 | + } |
|
| 639 | 667 | |
| 640 | 668 | $pdo = Db::pdo(); |
| 641 | 669 | |
@@ -685,7 +713,9 @@ discard block |
||
| 685 | 713 | public static function get_article_labels($id, $owner_uid = false) { |
| 686 | 714 | $rv = array(); |
| 687 | 715 | |
| 688 | - if (!$owner_uid) $owner_uid = $_SESSION["uid"]; |
|
| 716 | + if (!$owner_uid) { |
|
| 717 | + $owner_uid = $_SESSION["uid"]; |
|
| 718 | + } |
|
| 689 | 719 | |
| 690 | 720 | $pdo = Db::pdo(); |
| 691 | 721 | |
@@ -699,10 +729,11 @@ discard block |
||
| 699 | 729 | if ($label_cache) { |
| 700 | 730 | $tmp = json_decode($label_cache, true); |
| 701 | 731 | |
| 702 | - if (!$tmp || $tmp["no-labels"] == 1) |
|
| 703 | - return $rv; |
|
| 704 | - else |
|
| 705 | - return $tmp; |
|
| 732 | + if (!$tmp || $tmp["no-labels"] == 1) { |
|
| 733 | + return $rv; |
|
| 734 | + } else { |
|
| 735 | + return $tmp; |
|
| 736 | + } |
|
| 706 | 737 | } |
| 707 | 738 | } |
| 708 | 739 | |
@@ -721,10 +752,11 @@ discard block |
||
| 721 | 752 | array_push($rv, $rk); |
| 722 | 753 | } |
| 723 | 754 | |
| 724 | - if (count($rv) > 0) |
|
| 725 | - Labels::update_cache($owner_uid, $id, $rv); |
|
| 726 | - else |
|
| 727 | - Labels::update_cache($owner_uid, $id, array("no-labels" => 1)); |
|
| 755 | + if (count($rv) > 0) { |
|
| 756 | + Labels::update_cache($owner_uid, $id, $rv); |
|
| 757 | + } else { |
|
| 758 | + Labels::update_cache($owner_uid, $id, array("no-labels" => 1)); |
|
| 759 | + } |
|
| 728 | 760 | |
| 729 | 761 | return $rv; |
| 730 | 762 | } |
@@ -772,28 +804,33 @@ discard block |
||
| 772 | 804 | } |
| 773 | 805 | } |
| 774 | 806 | |
| 775 | - if (!$article_image) |
|
| 776 | - foreach ($enclosures as $enc) { |
|
| 807 | + if (!$article_image) { |
|
| 808 | + foreach ($enclosures as $enc) { |
|
| 777 | 809 | if (strpos($enc["content_type"], "image/") !== FALSE) { |
| 778 | 810 | $article_image = $enc["content_url"]; |
| 811 | + } |
|
| 779 | 812 | break; |
| 780 | 813 | } |
| 781 | 814 | } |
| 782 | 815 | |
| 783 | - if ($article_image) |
|
| 784 | - $article_image = rewrite_relative_url($site_url, $article_image); |
|
| 816 | + if ($article_image) { |
|
| 817 | + $article_image = rewrite_relative_url($site_url, $article_image); |
|
| 818 | + } |
|
| 785 | 819 | |
| 786 | - if ($article_stream) |
|
| 787 | - $article_stream = rewrite_relative_url($site_url, $article_stream); |
|
| 820 | + if ($article_stream) { |
|
| 821 | + $article_stream = rewrite_relative_url($site_url, $article_stream); |
|
| 822 | + } |
|
| 788 | 823 | } |
| 789 | 824 | |
| 790 | 825 | $cache = new DiskCache("images"); |
| 791 | 826 | |
| 792 | - if ($article_image && $cache->exists(sha1($article_image))) |
|
| 793 | - $article_image = $cache->getUrl(sha1($article_image)); |
|
| 827 | + if ($article_image && $cache->exists(sha1($article_image))) { |
|
| 828 | + $article_image = $cache->getUrl(sha1($article_image)); |
|
| 829 | + } |
|
| 794 | 830 | |
| 795 | - if ($article_stream && $cache->exists(sha1($article_stream))) |
|
| 796 | - $article_stream = $cache->getUrl(sha1($article_stream)); |
|
| 831 | + if ($article_stream && $cache->exists(sha1($article_stream))) { |
|
| 832 | + $article_stream = $cache->getUrl(sha1($article_stream)); |
|
| 833 | + } |
|
| 797 | 834 | |
| 798 | 835 | return [$article_image, $article_stream]; |
| 799 | 836 | } |
@@ -5,9 +5,9 @@ discard block |
||
| 5 | 5 | const NEVER_GROUP_FEEDS = [ -6, 0 ]; |
| 6 | 6 | const NEVER_GROUP_BY_DATE = [ -2, -1, -3 ]; |
| 7 | 7 | |
| 8 | - private $params; |
|
| 8 | + private $params; |
|
| 9 | 9 | |
| 10 | - function csrf_ignore($method) { |
|
| 10 | + function csrf_ignore($method) { |
|
| 11 | 11 | $csrf_ignored = array("index", "quickaddfeed", "search"); |
| 12 | 12 | |
| 13 | 13 | return array_search($method, $csrf_ignored) !== false; |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | //$reply .= "<option value=\"catchupPage()\">".__('Mark as read')."</option>"; |
| 102 | 102 | |
| 103 | 103 | $reply .= "<option value=\"App.displayDlg('".__("Show as feed")."','generatedFeed', '$feed_id:$is_cat:$rss_link')\">". |
| 104 | - __('Show as feed')."</option>"; |
|
| 104 | + __('Show as feed')."</option>"; |
|
| 105 | 105 | |
| 106 | 106 | $reply .= "</select>"; |
| 107 | 107 | |
@@ -133,10 +133,10 @@ discard block |
||
| 133 | 133 | $method_split = explode(":", $method); |
| 134 | 134 | |
| 135 | 135 | if ($method == "ForceUpdate" && $feed > 0 && is_numeric($feed)) { |
| 136 | - $sth = $this->pdo->prepare("UPDATE ttrss_feeds |
|
| 136 | + $sth = $this->pdo->prepare("UPDATE ttrss_feeds |
|
| 137 | 137 | SET last_updated = '1970-01-01', last_update_started = '1970-01-01' |
| 138 | 138 | WHERE id = ?"); |
| 139 | - $sth->execute([$feed]); |
|
| 139 | + $sth->execute([$feed]); |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | if ($method_split[0] == "MarkAllReadGR") { |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | "include_children" => $include_children, |
| 198 | 198 | "check_first_id" => $check_first_id, |
| 199 | 199 | "skip_first_id_check" => $skip_first_id_check, |
| 200 | - "order_by" => $order_by |
|
| 200 | + "order_by" => $order_by |
|
| 201 | 201 | ); |
| 202 | 202 | |
| 203 | 203 | $qfh_ret = $this->queryFeedHeadlines($params); |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | |
| 236 | 236 | $headlines_count = 0; |
| 237 | 237 | |
| 238 | - if (is_object($result)) { |
|
| 238 | + if (is_object($result)) { |
|
| 239 | 239 | while ($line = $result->fetch(PDO::FETCH_ASSOC)) { |
| 240 | 240 | |
| 241 | 241 | ++$headlines_count; |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_QUERY_HEADLINES) as $p) { |
| 249 | 249 | $line = $p->hook_query_headlines($line, 250, false); |
| 250 | 250 | } |
| 251 | - } |
|
| 251 | + } |
|
| 252 | 252 | |
| 253 | 253 | $id = $line["id"]; |
| 254 | 254 | |
@@ -295,53 +295,53 @@ discard block |
||
| 295 | 295 | |
| 296 | 296 | if (!$line["feed_title"]) $line["feed_title"] = ""; |
| 297 | 297 | |
| 298 | - $line["buttons_left"] = ""; |
|
| 299 | - foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_ARTICLE_LEFT_BUTTON) as $p) { |
|
| 300 | - $line["buttons_left"] .= $p->hook_article_left_button($line); |
|
| 301 | - } |
|
| 298 | + $line["buttons_left"] = ""; |
|
| 299 | + foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_ARTICLE_LEFT_BUTTON) as $p) { |
|
| 300 | + $line["buttons_left"] .= $p->hook_article_left_button($line); |
|
| 301 | + } |
|
| 302 | 302 | |
| 303 | - $line["buttons"] = ""; |
|
| 304 | - foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_ARTICLE_BUTTON) as $p) { |
|
| 305 | - $line["buttons"] .= $p->hook_article_button($line); |
|
| 306 | - } |
|
| 303 | + $line["buttons"] = ""; |
|
| 304 | + foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_ARTICLE_BUTTON) as $p) { |
|
| 305 | + $line["buttons"] .= $p->hook_article_button($line); |
|
| 306 | + } |
|
| 307 | 307 | |
| 308 | - $line["content"] = sanitize($line["content"], |
|
| 309 | - $line['hide_images'], false, $line["site_url"], $highlight_words, $line["id"]); |
|
| 308 | + $line["content"] = sanitize($line["content"], |
|
| 309 | + $line['hide_images'], false, $line["site_url"], $highlight_words, $line["id"]); |
|
| 310 | 310 | |
| 311 | - foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_RENDER_ARTICLE_CDM) as $p) { |
|
| 312 | - $line = $p->hook_render_article_cdm($line); |
|
| 313 | - } |
|
| 311 | + foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_RENDER_ARTICLE_CDM) as $p) { |
|
| 312 | + $line = $p->hook_render_article_cdm($line); |
|
| 313 | + } |
|
| 314 | 314 | |
| 315 | - $line['content'] = DiskCache::rewriteUrls($line['content']); |
|
| 315 | + $line['content'] = DiskCache::rewriteUrls($line['content']); |
|
| 316 | 316 | |
| 317 | - if ($line['note']) |
|
| 318 | - $line['note'] = Article::format_article_note($id, $line['note']); |
|
| 319 | - else |
|
| 320 | - $line['note'] = ""; |
|
| 317 | + if ($line['note']) |
|
| 318 | + $line['note'] = Article::format_article_note($id, $line['note']); |
|
| 319 | + else |
|
| 320 | + $line['note'] = ""; |
|
| 321 | 321 | |
| 322 | - if (!get_pref("CDM_EXPANDED")) { |
|
| 323 | - $line["cdm_excerpt"] = "<span class='collapse'> |
|
| 322 | + if (!get_pref("CDM_EXPANDED")) { |
|
| 323 | + $line["cdm_excerpt"] = "<span class='collapse'> |
|
| 324 | 324 | <i class='material-icons' onclick='return Article.cdmUnsetActive(event)' |
| 325 | 325 | title=\"" . __("Collapse article") . "\">remove_circle</i></span>"; |
| 326 | 326 | |
| 327 | - if (get_pref('SHOW_CONTENT_PREVIEW')) { |
|
| 328 | - $line["cdm_excerpt"] .= "<span class='excerpt'>" . $line["content_preview"] . "</span>"; |
|
| 329 | - } |
|
| 330 | - } |
|
| 327 | + if (get_pref('SHOW_CONTENT_PREVIEW')) { |
|
| 328 | + $line["cdm_excerpt"] .= "<span class='excerpt'>" . $line["content_preview"] . "</span>"; |
|
| 329 | + } |
|
| 330 | + } |
|
| 331 | 331 | |
| 332 | - $line["enclosures"] = Article::format_article_enclosures($id, $line["always_display_enclosures"], |
|
| 333 | - $line["content"], $line["hide_images"]); |
|
| 332 | + $line["enclosures"] = Article::format_article_enclosures($id, $line["always_display_enclosures"], |
|
| 333 | + $line["content"], $line["hide_images"]); |
|
| 334 | 334 | |
| 335 | - if ($line["orig_feed_id"]) { |
|
| 335 | + if ($line["orig_feed_id"]) { |
|
| 336 | 336 | |
| 337 | - $ofgh = $this->pdo->prepare("SELECT * FROM ttrss_archived_feeds |
|
| 337 | + $ofgh = $this->pdo->prepare("SELECT * FROM ttrss_archived_feeds |
|
| 338 | 338 | WHERE id = ? AND owner_uid = ?"); |
| 339 | - $ofgh->execute([$line["orig_feed_id"], $_SESSION['uid']]); |
|
| 339 | + $ofgh->execute([$line["orig_feed_id"], $_SESSION['uid']]); |
|
| 340 | 340 | |
| 341 | - if ($tmp_line = $ofgh->fetch()) { |
|
| 342 | - $line["orig_feed"] = [ $tmp_line["title"], $tmp_line["site_url"], $tmp_line["feed_url"] ]; |
|
| 343 | - } |
|
| 344 | - } |
|
| 341 | + if ($tmp_line = $ofgh->fetch()) { |
|
| 342 | + $line["orig_feed"] = [ $tmp_line["title"], $tmp_line["site_url"], $tmp_line["feed_url"] ]; |
|
| 343 | + } |
|
| 344 | + } |
|
| 345 | 345 | |
| 346 | 346 | $line["updated_long"] = make_local_datetime($line["updated"],true); |
| 347 | 347 | $line["updated"] = make_local_datetime($line["updated"], false, false, false, true); |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | $line['feed_icon'] = "<i class='icon-no-feed material-icons'>rss_feed</i>"; |
| 364 | 364 | } |
| 365 | 365 | |
| 366 | - //setting feed headline background color, needs to change text color based on dark/light |
|
| 366 | + //setting feed headline background color, needs to change text color based on dark/light |
|
| 367 | 367 | $fav_color = $line['favicon_avg_color']; |
| 368 | 368 | |
| 369 | 369 | require_once "colors.php"; |
@@ -377,18 +377,18 @@ discard block |
||
| 377 | 377 | } |
| 378 | 378 | |
| 379 | 379 | if (isset($rgba_cache[$feed_id])) { |
| 380 | - $line['feed_bg_color'] = 'rgba(' . implode(",", $rgba_cache[$feed_id]) . ',0.3)'; |
|
| 381 | - } |
|
| 380 | + $line['feed_bg_color'] = 'rgba(' . implode(",", $rgba_cache[$feed_id]) . ',0.3)'; |
|
| 381 | + } |
|
| 382 | 382 | |
| 383 | 383 | /* we don't need those */ |
| 384 | 384 | |
| 385 | - foreach (["date_entered", "guid", "last_published", "last_marked", "tag_cache", "favicon_avg_color", |
|
| 386 | - "uuid", "label_cache", "yyiw"] as $k) |
|
| 387 | - unset($line[$k]); |
|
| 385 | + foreach (["date_entered", "guid", "last_published", "last_marked", "tag_cache", "favicon_avg_color", |
|
| 386 | + "uuid", "label_cache", "yyiw"] as $k) |
|
| 387 | + unset($line[$k]); |
|
| 388 | 388 | |
| 389 | 389 | array_push($reply['content'], $line); |
| 390 | 390 | } |
| 391 | - } |
|
| 391 | + } |
|
| 392 | 392 | |
| 393 | 393 | if (!$headlines_count) { |
| 394 | 394 | |
@@ -570,7 +570,7 @@ discard block |
||
| 570 | 570 | $reply['headlines']['is_cat'] = (bool) $cat_view; |
| 571 | 571 | |
| 572 | 572 | $reply['headlines-info'] = ["count" => (int) $headlines_count, |
| 573 | - "disable_cache" => (bool) $disable_cache]; |
|
| 573 | + "disable_cache" => (bool) $disable_cache]; |
|
| 574 | 574 | |
| 575 | 575 | // this is parsed by handleRpcJson() on first viewfeed() to set cdm expanded, etc |
| 576 | 576 | $reply['runtime-info'] = make_runtime_info(); |
@@ -578,9 +578,9 @@ discard block |
||
| 578 | 578 | $reply_json = json_encode($reply); |
| 579 | 579 | |
| 580 | 580 | if (!$reply_json) { |
| 581 | - $reply_json = json_encode(["error" => ["code" => 15, |
|
| 582 | - "message" => json_last_error_msg()]]); |
|
| 583 | - } |
|
| 581 | + $reply_json = json_encode(["error" => ["code" => 15, |
|
| 582 | + "message" => json_last_error_msg()]]); |
|
| 583 | + } |
|
| 584 | 584 | |
| 585 | 585 | print $reply_json; |
| 586 | 586 | |
@@ -780,9 +780,9 @@ discard block |
||
| 780 | 780 | $sth->execute([$feed_id, $_SESSION['uid']]); |
| 781 | 781 | |
| 782 | 782 | if (!$sth->fetch()) { |
| 783 | - print "Access denied."; |
|
| 784 | - return; |
|
| 785 | - } |
|
| 783 | + print "Access denied."; |
|
| 784 | + return; |
|
| 785 | + } |
|
| 786 | 786 | |
| 787 | 787 | $refetch_checked = isset($_REQUEST["force_refetch"]) ? "checked" : ""; |
| 788 | 788 | $rehash_checked = isset($_REQUEST["force_rehash"]) ? "checked" : ""; |
@@ -1230,7 +1230,7 @@ discard block |
||
| 1230 | 1230 | } else { |
| 1231 | 1231 | $icon = self::getIconFile($id); |
| 1232 | 1232 | |
| 1233 | - if ($icon && file_exists($icon)) { |
|
| 1233 | + if ($icon && file_exists($icon)) { |
|
| 1234 | 1234 | return ICONS_URL . "/" . basename($icon) . "?" . filemtime($icon); |
| 1235 | 1235 | } |
| 1236 | 1236 | } |
@@ -1240,7 +1240,7 @@ discard block |
||
| 1240 | 1240 | } |
| 1241 | 1241 | |
| 1242 | 1242 | public static function getFeedTitle($id, $cat = false) { |
| 1243 | - $pdo = Db::pdo(); |
|
| 1243 | + $pdo = Db::pdo(); |
|
| 1244 | 1244 | |
| 1245 | 1245 | if ($cat) { |
| 1246 | 1246 | return Feeds::getCategoryTitle($id); |
@@ -1271,10 +1271,10 @@ discard block |
||
| 1271 | 1271 | |
| 1272 | 1272 | } else if (is_numeric($id) && $id > 0) { |
| 1273 | 1273 | |
| 1274 | - $sth = $pdo->prepare("SELECT title FROM ttrss_feeds WHERE id = ?"); |
|
| 1275 | - $sth->execute([$id]); |
|
| 1274 | + $sth = $pdo->prepare("SELECT title FROM ttrss_feeds WHERE id = ?"); |
|
| 1275 | + $sth->execute([$id]); |
|
| 1276 | 1276 | |
| 1277 | - if ($row = $sth->fetch()) { |
|
| 1277 | + if ($row = $sth->fetch()) { |
|
| 1278 | 1278 | return $row["title"]; |
| 1279 | 1279 | } else { |
| 1280 | 1280 | return "Unknown feed ($id)"; |
@@ -1293,7 +1293,7 @@ discard block |
||
| 1293 | 1293 | |
| 1294 | 1294 | if ($cat >= 0) { |
| 1295 | 1295 | |
| 1296 | - if (!$cat) $cat = null; |
|
| 1296 | + if (!$cat) $cat = null; |
|
| 1297 | 1297 | |
| 1298 | 1298 | $sth = $pdo->prepare("SELECT id FROM ttrss_feeds |
| 1299 | 1299 | WHERE (cat_id = :cat OR (:cat IS NULL AND cat_id IS NULL)) |
@@ -1333,7 +1333,7 @@ discard block |
||
| 1333 | 1333 | WHERE article_id = ref_id AND unread = true |
| 1334 | 1334 | AND ttrss_user_entries.owner_uid = ?"); |
| 1335 | 1335 | $sth->execute([$owner_uid]); |
| 1336 | - $row = $sth->fetch(); |
|
| 1336 | + $row = $sth->fetch(); |
|
| 1337 | 1337 | |
| 1338 | 1338 | return $row["unread"]; |
| 1339 | 1339 | } |
@@ -1381,7 +1381,7 @@ discard block |
||
| 1381 | 1381 | return __("Labels"); |
| 1382 | 1382 | } else { |
| 1383 | 1383 | |
| 1384 | - $pdo = Db::pdo(); |
|
| 1384 | + $pdo = Db::pdo(); |
|
| 1385 | 1385 | |
| 1386 | 1386 | $sth = $pdo->prepare("SELECT title FROM ttrss_feed_categories WHERE |
| 1387 | 1387 | id = ?"); |
@@ -1417,7 +1417,7 @@ discard block |
||
| 1417 | 1417 | $pdo = Db::pdo(); |
| 1418 | 1418 | |
| 1419 | 1419 | // WARNING: due to highly dynamic nature of this query its going to quote parameters |
| 1420 | - // right before adding them to SQL part |
|
| 1420 | + // right before adding them to SQL part |
|
| 1421 | 1421 | |
| 1422 | 1422 | $feed = $params["feed"]; |
| 1423 | 1423 | $limit = isset($params["limit"]) ? $params["limit"] : 30; |
@@ -1661,7 +1661,7 @@ discard block |
||
| 1661 | 1661 | $ssth = $pdo->prepare("SELECT title,site_url,last_error,last_updated |
| 1662 | 1662 | FROM ttrss_feeds WHERE id = ? AND owner_uid = ?"); |
| 1663 | 1663 | $ssth->execute([$feed, $owner_uid]); |
| 1664 | - $row = $ssth->fetch(); |
|
| 1664 | + $row = $ssth->fetch(); |
|
| 1665 | 1665 | |
| 1666 | 1666 | $feed_title = $row["title"]; |
| 1667 | 1667 | $feed_site_url = $row["site_url"]; |
@@ -1899,9 +1899,9 @@ discard block |
||
| 1899 | 1899 | public static function getFeedCategory($feed) { |
| 1900 | 1900 | $pdo = Db::pdo(); |
| 1901 | 1901 | |
| 1902 | - $sth = $pdo->prepare("SELECT cat_id FROM ttrss_feeds |
|
| 1902 | + $sth = $pdo->prepare("SELECT cat_id FROM ttrss_feeds |
|
| 1903 | 1903 | WHERE id = ?"); |
| 1904 | - $sth->execute([$feed]); |
|
| 1904 | + $sth->execute([$feed]); |
|
| 1905 | 1905 | |
| 1906 | 1906 | if ($row = $sth->fetch()) { |
| 1907 | 1907 | return $row["cat_id"]; |
@@ -1911,20 +1911,20 @@ discard block |
||
| 1911 | 1911 | |
| 1912 | 1912 | } |
| 1913 | 1913 | |
| 1914 | - function color_of($name) { |
|
| 1915 | - $colormap = [ "#1cd7d7","#d91111","#1212d7","#8e16e5","#7b7b7b", |
|
| 1916 | - "#39f110","#0bbea6","#ec0e0e","#1534f2","#b9e416", |
|
| 1917 | - "#479af2","#f36b14","#10c7e9","#1e8fe7","#e22727" ]; |
|
| 1914 | + function color_of($name) { |
|
| 1915 | + $colormap = [ "#1cd7d7","#d91111","#1212d7","#8e16e5","#7b7b7b", |
|
| 1916 | + "#39f110","#0bbea6","#ec0e0e","#1534f2","#b9e416", |
|
| 1917 | + "#479af2","#f36b14","#10c7e9","#1e8fe7","#e22727" ]; |
|
| 1918 | 1918 | |
| 1919 | - $sum = 0; |
|
| 1919 | + $sum = 0; |
|
| 1920 | 1920 | |
| 1921 | - for ($i = 0; $i < strlen($name); $i++) { |
|
| 1922 | - $sum += ord($name[$i]); |
|
| 1923 | - } |
|
| 1921 | + for ($i = 0; $i < strlen($name); $i++) { |
|
| 1922 | + $sum += ord($name[$i]); |
|
| 1923 | + } |
|
| 1924 | 1924 | |
| 1925 | - $sum %= count($colormap); |
|
| 1925 | + $sum %= count($colormap); |
|
| 1926 | 1926 | |
| 1927 | - return $colormap[$sum]; |
|
| 1927 | + return $colormap[$sum]; |
|
| 1928 | 1928 | } |
| 1929 | 1929 | |
| 1930 | 1930 | public static function get_feeds_from_html($url, $content) { |
@@ -17,7 +17,9 @@ discard block |
||
| 17 | 17 | $feed_id, $is_cat, $search, |
| 18 | 18 | $error, $feed_last_updated) { |
| 19 | 19 | |
| 20 | - if ($is_cat) $cat_q = "&is_cat=$is_cat"; |
|
| 20 | + if ($is_cat) { |
|
| 21 | + $cat_q = "&is_cat=$is_cat"; |
|
| 22 | + } |
|
| 21 | 23 | |
| 22 | 24 | if ($search) { |
| 23 | 25 | $search_q = "&q=$search"; |
@@ -48,8 +50,9 @@ discard block |
||
| 48 | 50 | $reply .= strip_tags($feed_title); |
| 49 | 51 | } |
| 50 | 52 | |
| 51 | - if ($error) |
|
| 52 | - $reply .= " <i title=\"" . htmlspecialchars($error) . "\" class='material-icons icon-error'>error</i>"; |
|
| 53 | + if ($error) { |
|
| 54 | + $reply .= " <i title=\"" . htmlspecialchars($error) . "\" class='material-icons icon-error'>error</i>"; |
|
| 55 | + } |
|
| 53 | 56 | |
| 54 | 57 | $reply .= "</span>"; |
| 55 | 58 | $reply .= "<span id='feed_current_unread' style='display: none'></span>"; |
@@ -127,8 +130,12 @@ discard block |
||
| 127 | 130 | $rgba_cache = array(); |
| 128 | 131 | $topmost_article_ids = array(); |
| 129 | 132 | |
| 130 | - if (!$offset) $offset = 0; |
|
| 131 | - if ($method == "undefined") $method = ""; |
|
| 133 | + if (!$offset) { |
|
| 134 | + $offset = 0; |
|
| 135 | + } |
|
| 136 | + if ($method == "undefined") { |
|
| 137 | + $method = ""; |
|
| 138 | + } |
|
| 132 | 139 | |
| 133 | 140 | $method_split = explode(":", $method); |
| 134 | 141 | |
@@ -274,14 +281,17 @@ discard block |
||
| 274 | 281 | $label_cache = json_decode($label_cache, true); |
| 275 | 282 | |
| 276 | 283 | if ($label_cache) { |
| 277 | - if ($label_cache["no-labels"] == 1) |
|
| 278 | - $labels = array(); |
|
| 279 | - else |
|
| 280 | - $labels = $label_cache; |
|
| 284 | + if ($label_cache["no-labels"] == 1) { |
|
| 285 | + $labels = array(); |
|
| 286 | + } else { |
|
| 287 | + $labels = $label_cache; |
|
| 288 | + } |
|
| 281 | 289 | } |
| 282 | 290 | } |
| 283 | 291 | |
| 284 | - if (!is_array($labels)) $labels = Article::get_article_labels($id); |
|
| 292 | + if (!is_array($labels)) { |
|
| 293 | + $labels = Article::get_article_labels($id); |
|
| 294 | + } |
|
| 285 | 295 | |
| 286 | 296 | $labels_str = "<span class=\"HLLCTR-$id\">"; |
| 287 | 297 | $labels_str .= Article::format_article_labels($labels); |
@@ -293,7 +303,9 @@ discard block |
||
| 293 | 303 | array_push($topmost_article_ids, $id); |
| 294 | 304 | } |
| 295 | 305 | |
| 296 | - if (!$line["feed_title"]) $line["feed_title"] = ""; |
|
| 306 | + if (!$line["feed_title"]) { |
|
| 307 | + $line["feed_title"] = ""; |
|
| 308 | + } |
|
| 297 | 309 | |
| 298 | 310 | $line["buttons_left"] = ""; |
| 299 | 311 | foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_ARTICLE_LEFT_BUTTON) as $p) { |
@@ -314,10 +326,11 @@ discard block |
||
| 314 | 326 | |
| 315 | 327 | $line['content'] = DiskCache::rewriteUrls($line['content']); |
| 316 | 328 | |
| 317 | - if ($line['note']) |
|
| 318 | - $line['note'] = Article::format_article_note($id, $line['note']); |
|
| 319 | - else |
|
| 320 | - $line['note'] = ""; |
|
| 329 | + if ($line['note']) { |
|
| 330 | + $line['note'] = Article::format_article_note($id, $line['note']); |
|
| 331 | + } else { |
|
| 332 | + $line['note'] = ""; |
|
| 333 | + } |
|
| 321 | 334 | |
| 322 | 335 | if (!get_pref("CDM_EXPANDED")) { |
| 323 | 336 | $line["cdm_excerpt"] = "<span class='collapse'> |
@@ -350,10 +363,11 @@ discard block |
||
| 350 | 363 | $line['imported'] = T_sprintf("Imported at %s", |
| 351 | 364 | make_local_datetime($line["date_entered"], false)); |
| 352 | 365 | |
| 353 | - if ($line["tag_cache"]) |
|
| 354 | - $tags = explode(",", $line["tag_cache"]); |
|
| 355 | - else |
|
| 356 | - $tags = false; |
|
| 366 | + if ($line["tag_cache"]) { |
|
| 367 | + $tags = explode(",", $line["tag_cache"]); |
|
| 368 | + } else { |
|
| 369 | + $tags = false; |
|
| 370 | + } |
|
| 357 | 371 | |
| 358 | 372 | $line["tags_str"] = Article::format_tags_string($tags); |
| 359 | 373 | |
@@ -383,8 +397,9 @@ discard block |
||
| 383 | 397 | /* we don't need those */ |
| 384 | 398 | |
| 385 | 399 | foreach (["date_entered", "guid", "last_published", "last_marked", "tag_cache", "favicon_avg_color", |
| 386 | - "uuid", "label_cache", "yyiw"] as $k) |
|
| 387 | - unset($line[$k]); |
|
| 400 | + "uuid", "label_cache", "yyiw"] as $k) { |
|
| 401 | + unset($line[$k]); |
|
| 402 | + } |
|
| 388 | 403 | |
| 389 | 404 | array_push($reply['content'], $line); |
| 390 | 405 | } |
@@ -474,7 +489,9 @@ discard block |
||
| 474 | 489 | $order_by = $_REQUEST["order_by"]; |
| 475 | 490 | $check_first_id = $_REQUEST["fid"]; |
| 476 | 491 | |
| 477 | - if (is_numeric($feed)) $feed = (int) $feed; |
|
| 492 | + if (is_numeric($feed)) { |
|
| 493 | + $feed = (int) $feed; |
|
| 494 | + } |
|
| 478 | 495 | |
| 479 | 496 | /* Feed -5 is a special case: it is used to display auxiliary information |
| 480 | 497 | * when there's nothing to load - e.g. no stuff in fresh feed */ |
@@ -562,10 +579,11 @@ discard block |
||
| 562 | 579 | $disable_cache = $ret[3]; |
| 563 | 580 | $reply['headlines'] = $ret[4]; |
| 564 | 581 | |
| 565 | - if (!$next_unread_feed) |
|
| 566 | - $reply['headlines']['id'] = $feed; |
|
| 567 | - else |
|
| 568 | - $reply['headlines']['id'] = $next_unread_feed; |
|
| 582 | + if (!$next_unread_feed) { |
|
| 583 | + $reply['headlines']['id'] = $feed; |
|
| 584 | + } else { |
|
| 585 | + $reply['headlines']['id'] = $next_unread_feed; |
|
| 586 | + } |
|
| 569 | 587 | |
| 570 | 588 | $reply['headlines']['is_cat'] = (bool) $cat_view; |
| 571 | 589 | |
@@ -851,7 +869,9 @@ discard block |
||
| 851 | 869 | |
| 852 | 870 | public static function catchup_feed($feed, $cat_view, $owner_uid = false, $mode = 'all', $search = false) { |
| 853 | 871 | |
| 854 | - if (!$owner_uid) $owner_uid = $_SESSION['uid']; |
|
| 872 | + if (!$owner_uid) { |
|
| 873 | + $owner_uid = $_SESSION['uid']; |
|
| 874 | + } |
|
| 855 | 875 | |
| 856 | 876 | $pdo = Db::pdo(); |
| 857 | 877 | |
@@ -1026,7 +1046,9 @@ discard block |
||
| 1026 | 1046 | |
| 1027 | 1047 | $pdo = Db::pdo(); |
| 1028 | 1048 | |
| 1029 | - if (!$owner_uid) $owner_uid = $_SESSION["uid"]; |
|
| 1049 | + if (!$owner_uid) { |
|
| 1050 | + $owner_uid = $_SESSION["uid"]; |
|
| 1051 | + } |
|
| 1030 | 1052 | |
| 1031 | 1053 | if ($unread_only) { |
| 1032 | 1054 | $unread_qpart = "unread = true"; |
@@ -1142,7 +1164,9 @@ discard block |
||
| 1142 | 1164 | |
| 1143 | 1165 | $url = Feeds::fix_url($url); |
| 1144 | 1166 | |
| 1145 | - if (!$url || !Feeds::validate_feed_url($url)) return array("code" => 2); |
|
| 1167 | + if (!$url || !Feeds::validate_feed_url($url)) { |
|
| 1168 | + return array("code" => 2); |
|
| 1169 | + } |
|
| 1146 | 1170 | |
| 1147 | 1171 | $contents = @fetch_file_contents($url, false, $auth_login, $auth_pass); |
| 1148 | 1172 | |
@@ -1170,7 +1194,9 @@ discard block |
||
| 1170 | 1194 | $url = key($feedUrls); |
| 1171 | 1195 | } |
| 1172 | 1196 | |
| 1173 | - if (!$cat_id) $cat_id = null; |
|
| 1197 | + if (!$cat_id) { |
|
| 1198 | + $cat_id = null; |
|
| 1199 | + } |
|
| 1174 | 1200 | |
| 1175 | 1201 | $sth = $pdo->prepare("SELECT id FROM ttrss_feeds |
| 1176 | 1202 | WHERE feed_url = ? AND owner_uid = ?"); |
@@ -1287,13 +1313,17 @@ discard block |
||
| 1287 | 1313 | |
| 1288 | 1314 | public static function getCategoryUnread($cat, $owner_uid = false) { |
| 1289 | 1315 | |
| 1290 | - if (!$owner_uid) $owner_uid = $_SESSION["uid"]; |
|
| 1316 | + if (!$owner_uid) { |
|
| 1317 | + $owner_uid = $_SESSION["uid"]; |
|
| 1318 | + } |
|
| 1291 | 1319 | |
| 1292 | 1320 | $pdo = Db::pdo(); |
| 1293 | 1321 | |
| 1294 | 1322 | if ($cat >= 0) { |
| 1295 | 1323 | |
| 1296 | - if (!$cat) $cat = null; |
|
| 1324 | + if (!$cat) { |
|
| 1325 | + $cat = null; |
|
| 1326 | + } |
|
| 1297 | 1327 | |
| 1298 | 1328 | $sth = $pdo->prepare("SELECT id FROM ttrss_feeds |
| 1299 | 1329 | WHERE (cat_id = :cat OR (:cat IS NULL AND cat_id IS NULL)) |
@@ -1306,7 +1336,9 @@ discard block |
||
| 1306 | 1336 | array_push($cat_feeds, "feed_id = " . (int)$line["id"]); |
| 1307 | 1337 | } |
| 1308 | 1338 | |
| 1309 | - if (count($cat_feeds) == 0) return 0; |
|
| 1339 | + if (count($cat_feeds) == 0) { |
|
| 1340 | + return 0; |
|
| 1341 | + } |
|
| 1310 | 1342 | |
| 1311 | 1343 | $match_part = implode(" OR ", $cat_feeds); |
| 1312 | 1344 | |
@@ -1341,7 +1373,9 @@ discard block |
||
| 1341 | 1373 | |
| 1342 | 1374 | // only accepts real cats (>= 0) |
| 1343 | 1375 | public static function getCategoryChildrenUnread($cat, $owner_uid = false) { |
| 1344 | - if (!$owner_uid) $owner_uid = $_SESSION["uid"]; |
|
| 1376 | + if (!$owner_uid) { |
|
| 1377 | + $owner_uid = $_SESSION["uid"]; |
|
| 1378 | + } |
|
| 1345 | 1379 | |
| 1346 | 1380 | $pdo = Db::pdo(); |
| 1347 | 1381 | |
@@ -1361,7 +1395,9 @@ discard block |
||
| 1361 | 1395 | |
| 1362 | 1396 | public static function getGlobalUnread($user_id = false) { |
| 1363 | 1397 | |
| 1364 | - if (!$user_id) $user_id = $_SESSION["uid"]; |
|
| 1398 | + if (!$user_id) { |
|
| 1399 | + $user_id = $_SESSION["uid"]; |
|
| 1400 | + } |
|
| 1365 | 1401 | |
| 1366 | 1402 | $pdo = Db::pdo(); |
| 1367 | 1403 | |
@@ -1396,7 +1432,9 @@ discard block |
||
| 1396 | 1432 | } |
| 1397 | 1433 | |
| 1398 | 1434 | public static function getLabelUnread($label_id, $owner_uid = false) { |
| 1399 | - if (!$owner_uid) $owner_uid = $_SESSION["uid"]; |
|
| 1435 | + if (!$owner_uid) { |
|
| 1436 | + $owner_uid = $_SESSION["uid"]; |
|
| 1437 | + } |
|
| 1400 | 1438 | |
| 1401 | 1439 | $pdo = Db::pdo(); |
| 1402 | 1440 | |
@@ -1491,8 +1529,9 @@ discard block |
||
| 1491 | 1529 | |
| 1492 | 1530 | $unread = getFeedUnread($feed, $cat_view); |
| 1493 | 1531 | |
| 1494 | - if ($cat_view && $feed > 0 && $include_children) |
|
| 1495 | - $unread += Feeds::getCategoryChildrenUnread($feed); |
|
| 1532 | + if ($cat_view && $feed > 0 && $include_children) { |
|
| 1533 | + $unread += Feeds::getCategoryChildrenUnread($feed); |
|
| 1534 | + } |
|
| 1496 | 1535 | |
| 1497 | 1536 | if ($unread > 0) { |
| 1498 | 1537 | $view_query_part = " unread = true AND "; |
@@ -1604,7 +1643,9 @@ discard block |
||
| 1604 | 1643 | $allow_archived = true; |
| 1605 | 1644 | $ignore_vfeed_group = true; |
| 1606 | 1645 | |
| 1607 | - if (!$override_order) $override_order = "last_read DESC"; |
|
| 1646 | + if (!$override_order) { |
|
| 1647 | + $override_order = "last_read DESC"; |
|
| 1648 | + } |
|
| 1608 | 1649 | |
| 1609 | 1650 | } else if ($feed == -3) { // fresh virtual feed |
| 1610 | 1651 | $query_strategy_part = "unread = true AND score >= 0"; |
@@ -1715,13 +1756,16 @@ discard block |
||
| 1715 | 1756 | LEFT JOIN ttrss_feeds ON (feed_id = ttrss_feeds.id)"; |
| 1716 | 1757 | } |
| 1717 | 1758 | |
| 1718 | - if ($vfeed_query_part) $vfeed_query_part .= "favicon_avg_color,"; |
|
| 1759 | + if ($vfeed_query_part) { |
|
| 1760 | + $vfeed_query_part .= "favicon_avg_color,"; |
|
| 1761 | + } |
|
| 1719 | 1762 | |
| 1720 | 1763 | $first_id = 0; |
| 1721 | 1764 | $first_id_query_strategy_part = $query_strategy_part; |
| 1722 | 1765 | |
| 1723 | - if ($feed == -3) |
|
| 1724 | - $first_id_query_strategy_part = "true"; |
|
| 1766 | + if ($feed == -3) { |
|
| 1767 | + $first_id_query_strategy_part = "true"; |
|
| 1768 | + } |
|
| 1725 | 1769 | |
| 1726 | 1770 | if (DB_TYPE == "pgsql") { |
| 1727 | 1771 | $sanity_interval_qpart = "date_entered >= NOW() - INTERVAL '1 hour' AND"; |
@@ -1853,7 +1897,9 @@ discard block |
||
| 1853 | 1897 | $query_strategy_part ORDER BY $order_by |
| 1854 | 1898 | $limit_query_part $offset_query_part"; |
| 1855 | 1899 | |
| 1856 | - if ($_REQUEST["debug"]) print $query; |
|
| 1900 | + if ($_REQUEST["debug"]) { |
|
| 1901 | + print $query; |
|
| 1902 | + } |
|
| 1857 | 1903 | |
| 1858 | 1904 | $res = $pdo->query($query); |
| 1859 | 1905 | } |
@@ -2003,18 +2049,23 @@ discard block |
||
| 2003 | 2049 | } |
| 2004 | 2050 | } |
| 2005 | 2051 | |
| 2006 | - if ($url != "http:///") |
|
| 2007 | - return $url; |
|
| 2008 | - else |
|
| 2009 | - return ''; |
|
| 2052 | + if ($url != "http:///") { |
|
| 2053 | + return $url; |
|
| 2054 | + } else { |
|
| 2055 | + return ''; |
|
| 2056 | + } |
|
| 2010 | 2057 | } |
| 2011 | 2058 | |
| 2012 | 2059 | public static function add_feed_category($feed_cat, $parent_cat_id = false, $order_id = 0) { |
| 2013 | 2060 | |
| 2014 | - if (!$feed_cat) return false; |
|
| 2061 | + if (!$feed_cat) { |
|
| 2062 | + return false; |
|
| 2063 | + } |
|
| 2015 | 2064 | |
| 2016 | 2065 | $feed_cat = mb_substr($feed_cat, 0, 250); |
| 2017 | - if (!$parent_cat_id) $parent_cat_id = null; |
|
| 2066 | + if (!$parent_cat_id) { |
|
| 2067 | + $parent_cat_id = null; |
|
| 2068 | + } |
|
| 2018 | 2069 | |
| 2019 | 2070 | $pdo = Db::pdo(); |
| 2020 | 2071 | $tr_in_progress = false; |
@@ -2036,7 +2087,9 @@ discard block |
||
| 2036 | 2087 | VALUES (?, ?, ?, ?)"); |
| 2037 | 2088 | $sth->execute([$_SESSION['uid'], $feed_cat, $parent_cat_id, (int)$order_id]); |
| 2038 | 2089 | |
| 2039 | - if (!$tr_in_progress) $pdo->commit(); |
|
| 2090 | + if (!$tr_in_progress) { |
|
| 2091 | + $pdo->commit(); |
|
| 2092 | + } |
|
| 2040 | 2093 | |
| 2041 | 2094 | return true; |
| 2042 | 2095 | } |
@@ -2048,7 +2101,9 @@ discard block |
||
| 2048 | 2101 | |
| 2049 | 2102 | public static function get_feed_access_key($feed_id, $is_cat, $owner_uid = false) { |
| 2050 | 2103 | |
| 2051 | - if (!$owner_uid) $owner_uid = $_SESSION["uid"]; |
|
| 2104 | + if (!$owner_uid) { |
|
| 2105 | + $owner_uid = $_SESSION["uid"]; |
|
| 2106 | + } |
|
| 2052 | 2107 | |
| 2053 | 2108 | $is_cat = bool_to_sql_bool($is_cat); |
| 2054 | 2109 | |
@@ -2086,7 +2141,9 @@ discard block |
||
| 2086 | 2141 | */ |
| 2087 | 2142 | public static function purge_feed($feed_id, $purge_interval) { |
| 2088 | 2143 | |
| 2089 | - if (!$purge_interval) $purge_interval = Feeds::feed_purge_interval($feed_id); |
|
| 2144 | + if (!$purge_interval) { |
|
| 2145 | + $purge_interval = Feeds::feed_purge_interval($feed_id); |
|
| 2146 | + } |
|
| 2090 | 2147 | |
| 2091 | 2148 | $pdo = Db::pdo(); |
| 2092 | 2149 | |
@@ -2106,7 +2163,9 @@ discard block |
||
| 2106 | 2163 | return; |
| 2107 | 2164 | } |
| 2108 | 2165 | |
| 2109 | - if (!$owner_uid) return; |
|
| 2166 | + if (!$owner_uid) { |
|
| 2167 | + return; |
|
| 2168 | + } |
|
| 2110 | 2169 | |
| 2111 | 2170 | if (FORCE_ARTICLE_PURGE == 0) { |
| 2112 | 2171 | $purge_unread = get_pref("PURGE_UNREAD_ARTICLES", |
@@ -2116,10 +2175,11 @@ discard block |
||
| 2116 | 2175 | $purge_interval = FORCE_ARTICLE_PURGE; |
| 2117 | 2176 | } |
| 2118 | 2177 | |
| 2119 | - if (!$purge_unread) |
|
| 2120 | - $query_limit = " unread = false AND "; |
|
| 2121 | - else |
|
| 2122 | - $query_limit = ""; |
|
| 2178 | + if (!$purge_unread) { |
|
| 2179 | + $query_limit = " unread = false AND "; |
|
| 2180 | + } else { |
|
| 2181 | + $query_limit = ""; |
|
| 2182 | + } |
|
| 2123 | 2183 | |
| 2124 | 2184 | $purge_interval = (int) $purge_interval; |
| 2125 | 2185 | |
@@ -2166,8 +2226,10 @@ discard block |
||
| 2166 | 2226 | $purge_interval = $row["purge_interval"]; |
| 2167 | 2227 | $owner_uid = $row["owner_uid"]; |
| 2168 | 2228 | |
| 2169 | - if ($purge_interval == 0) $purge_interval = get_pref( |
|
| 2229 | + if ($purge_interval == 0) { |
|
| 2230 | + $purge_interval = get_pref( |
|
| 2170 | 2231 | 'PURGE_OLD_DAYS', $owner_uid); |
| 2232 | + } |
|
| 2171 | 2233 | |
| 2172 | 2234 | return $purge_interval; |
| 2173 | 2235 | |
@@ -2185,10 +2247,11 @@ discard block |
||
| 2185 | 2247 | |
| 2186 | 2248 | $pdo = Db::pdo(); |
| 2187 | 2249 | |
| 2188 | - if ($search_language) |
|
| 2189 | - $search_language = $pdo->quote(mb_strtolower($search_language)); |
|
| 2190 | - else |
|
| 2191 | - $search_language = $pdo->quote("english"); |
|
| 2250 | + if ($search_language) { |
|
| 2251 | + $search_language = $pdo->quote(mb_strtolower($search_language)); |
|
| 2252 | + } else { |
|
| 2253 | + $search_language = $pdo->quote("english"); |
|
| 2254 | + } |
|
| 2192 | 2255 | |
| 2193 | 2256 | foreach ($keywords as $k) { |
| 2194 | 2257 | if (strpos($k, "-") === 0) { |
@@ -2223,56 +2286,68 @@ discard block |
||
| 2223 | 2286 | break; |
| 2224 | 2287 | case "note": |
| 2225 | 2288 | if ($commandpair[1]) { |
| 2226 | - if ($commandpair[1] == "true") |
|
| 2227 | - array_push($query_keywords, "($not (note IS NOT NULL AND note != ''))"); |
|
| 2228 | - else if ($commandpair[1] == "false") |
|
| 2229 | - array_push($query_keywords, "($not (note IS NULL OR note = ''))"); |
|
| 2230 | - else |
|
| 2231 | - array_push($query_keywords, "($not (LOWER(note) LIKE ". |
|
| 2289 | + if ($commandpair[1] == "true") { |
|
| 2290 | + array_push($query_keywords, "($not (note IS NOT NULL AND note != ''))"); |
|
| 2291 | + } else if ($commandpair[1] == "false") { |
|
| 2292 | + array_push($query_keywords, "($not (note IS NULL OR note = ''))"); |
|
| 2293 | + } else { |
|
| 2294 | + array_push($query_keywords, "($not (LOWER(note) LIKE ". |
|
| 2232 | 2295 | $pdo->quote('%' . mb_strtolower($commandpair[1]) . '%')."))"); |
| 2296 | + } |
|
| 2233 | 2297 | } else { |
| 2234 | 2298 | array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").") |
| 2235 | 2299 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
| 2236 | - if (!$not) array_push($search_words, $k); |
|
| 2300 | + if (!$not) { |
|
| 2301 | + array_push($search_words, $k); |
|
| 2302 | + } |
|
| 2237 | 2303 | } |
| 2238 | 2304 | break; |
| 2239 | 2305 | case "star": |
| 2240 | 2306 | |
| 2241 | 2307 | if ($commandpair[1]) { |
| 2242 | - if ($commandpair[1] == "true") |
|
| 2243 | - array_push($query_keywords, "($not (marked = true))"); |
|
| 2244 | - else |
|
| 2245 | - array_push($query_keywords, "($not (marked = false))"); |
|
| 2308 | + if ($commandpair[1] == "true") { |
|
| 2309 | + array_push($query_keywords, "($not (marked = true))"); |
|
| 2310 | + } else { |
|
| 2311 | + array_push($query_keywords, "($not (marked = false))"); |
|
| 2312 | + } |
|
| 2246 | 2313 | } else { |
| 2247 | 2314 | array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").") |
| 2248 | 2315 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
| 2249 | - if (!$not) array_push($search_words, $k); |
|
| 2316 | + if (!$not) { |
|
| 2317 | + array_push($search_words, $k); |
|
| 2318 | + } |
|
| 2250 | 2319 | } |
| 2251 | 2320 | break; |
| 2252 | 2321 | case "pub": |
| 2253 | 2322 | if ($commandpair[1]) { |
| 2254 | - if ($commandpair[1] == "true") |
|
| 2255 | - array_push($query_keywords, "($not (published = true))"); |
|
| 2256 | - else |
|
| 2257 | - array_push($query_keywords, "($not (published = false))"); |
|
| 2323 | + if ($commandpair[1] == "true") { |
|
| 2324 | + array_push($query_keywords, "($not (published = true))"); |
|
| 2325 | + } else { |
|
| 2326 | + array_push($query_keywords, "($not (published = false))"); |
|
| 2327 | + } |
|
| 2258 | 2328 | |
| 2259 | 2329 | } else { |
| 2260 | 2330 | array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER('%$k%') |
| 2261 | 2331 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
| 2262 | - if (!$not) array_push($search_words, $k); |
|
| 2332 | + if (!$not) { |
|
| 2333 | + array_push($search_words, $k); |
|
| 2334 | + } |
|
| 2263 | 2335 | } |
| 2264 | 2336 | break; |
| 2265 | 2337 | case "unread": |
| 2266 | 2338 | if ($commandpair[1]) { |
| 2267 | - if ($commandpair[1] == "true") |
|
| 2268 | - array_push($query_keywords, "($not (unread = true))"); |
|
| 2269 | - else |
|
| 2270 | - array_push($query_keywords, "($not (unread = false))"); |
|
| 2339 | + if ($commandpair[1] == "true") { |
|
| 2340 | + array_push($query_keywords, "($not (unread = true))"); |
|
| 2341 | + } else { |
|
| 2342 | + array_push($query_keywords, "($not (unread = false))"); |
|
| 2343 | + } |
|
| 2271 | 2344 | |
| 2272 | 2345 | } else { |
| 2273 | 2346 | array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").") |
| 2274 | 2347 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
| 2275 | - if (!$not) array_push($search_words, $k); |
|
| 2348 | + if (!$not) { |
|
| 2349 | + array_push($search_words, $k); |
|
| 2350 | + } |
|
| 2276 | 2351 | } |
| 2277 | 2352 | break; |
| 2278 | 2353 | default: |
@@ -2295,7 +2370,9 @@ discard block |
||
| 2295 | 2370 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
| 2296 | 2371 | } |
| 2297 | 2372 | |
| 2298 | - if (!$not) array_push($search_words, $k); |
|
| 2373 | + if (!$not) { |
|
| 2374 | + array_push($search_words, $k); |
|
| 2375 | + } |
|
| 2299 | 2376 | } |
| 2300 | 2377 | } |
| 2301 | 2378 | } |
@@ -1568,8 +1568,8 @@ |
||
| 1568 | 1568 | public static function remove_feed($id, $owner_uid) { |
| 1569 | 1569 | foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_UNSUBSCRIBE_FEED) as $p) { |
| 1570 | 1570 | if (! $p->hook_unsubscribe_feed($id, $owner_uid)) { |
| 1571 | - user_error("Feed $id (owner: $owner_uid) not removed due to plugin error (HOOK_UNSUBSCRIBE_FEED).", E_USER_WARNING); |
|
| 1572 | - return; |
|
| 1571 | + user_error("Feed $id (owner: $owner_uid) not removed due to plugin error (HOOK_UNSUBSCRIBE_FEED).", E_USER_WARNING); |
|
| 1572 | + return; |
|
| 1573 | 1573 | } |
| 1574 | 1574 | } |
| 1575 | 1575 | |
@@ -42,10 +42,11 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | private function get_category_items($cat_id) { |
| 44 | 44 | |
| 45 | - if (clean($_REQUEST['mode']) != 2) |
|
| 46 | - $search = $_SESSION["prefs_feed_search"]; |
|
| 47 | - else |
|
| 48 | - $search = ""; |
|
| 45 | + if (clean($_REQUEST['mode']) != 2) { |
|
| 46 | + $search = $_SESSION["prefs_feed_search"]; |
|
| 47 | + } else { |
|
| 48 | + $search = ""; |
|
| 49 | + } |
|
| 49 | 50 | |
| 50 | 51 | // first one is set by API |
| 51 | 52 | $show_empty_cats = clean($_REQUEST['force_show_empty']) || |
@@ -76,8 +77,9 @@ discard block |
||
| 76 | 77 | $num_children = $this->calculate_children_count($cat); |
| 77 | 78 | $cat['param'] = vsprintf(_ngettext('(%d feed)', '(%d feeds)', (int) $num_children), $num_children); |
| 78 | 79 | |
| 79 | - if ($num_children > 0 || $show_empty_cats) |
|
| 80 | - array_push($items, $cat); |
|
| 80 | + if ($num_children > 0 || $show_empty_cats) { |
|
| 81 | + array_push($items, $cat); |
|
| 82 | + } |
|
| 81 | 83 | |
| 82 | 84 | } |
| 83 | 85 | |
@@ -117,10 +119,11 @@ discard block |
||
| 117 | 119 | |
| 118 | 120 | public function makefeedtree() { |
| 119 | 121 | |
| 120 | - if (clean($_REQUEST['mode']) != 2) |
|
| 121 | - $search = $_SESSION["prefs_feed_search"]; |
|
| 122 | - else |
|
| 123 | - $search = ""; |
|
| 122 | + if (clean($_REQUEST['mode']) != 2) { |
|
| 123 | + $search = $_SESSION["prefs_feed_search"]; |
|
| 124 | + } else { |
|
| 125 | + $search = ""; |
|
| 126 | + } |
|
| 124 | 127 | |
| 125 | 128 | $root = array(); |
| 126 | 129 | $root['id'] = 'root'; |
@@ -231,8 +234,9 @@ discard block |
||
| 231 | 234 | $num_children = $this->calculate_children_count($cat); |
| 232 | 235 | $cat['param'] = vsprintf(_ngettext('(%d feed)', '(%d feeds)', (int) $num_children), $num_children); |
| 233 | 236 | |
| 234 | - if ($num_children > 0 || $show_empty_cats) |
|
| 235 | - array_push($root['items'], $cat); |
|
| 237 | + if ($num_children > 0 || $show_empty_cats) { |
|
| 238 | + array_push($root['items'], $cat); |
|
| 239 | + } |
|
| 236 | 240 | |
| 237 | 241 | $root['param'] += count($cat['items']); |
| 238 | 242 | } |
@@ -279,8 +283,9 @@ discard block |
||
| 279 | 283 | |
| 280 | 284 | $cat['param'] = vsprintf(_ngettext('(%d feed)', '(%d feeds)', count($cat['items'])), count($cat['items'])); |
| 281 | 285 | |
| 282 | - if (count($cat['items']) > 0 || $show_empty_cats) |
|
| 283 | - array_push($root['items'], $cat); |
|
| 286 | + if (count($cat['items']) > 0 || $show_empty_cats) { |
|
| 287 | + array_push($root['items'], $cat); |
|
| 288 | + } |
|
| 284 | 289 | |
| 285 | 290 | $num_children = $this->calculate_children_count($root); |
| 286 | 291 | $root['param'] = vsprintf(_ngettext('(%d feed)', '(%d feeds)', (int) $num_children), $num_children); |
@@ -343,8 +348,9 @@ discard block |
||
| 343 | 348 | private function process_category_order(&$data_map, $item_id, $parent_id = false, $nest_level = 0) { |
| 344 | 349 | |
| 345 | 350 | $prefix = ""; |
| 346 | - for ($i = 0; $i < $nest_level; $i++) |
|
| 347 | - $prefix .= " "; |
|
| 351 | + for ($i = 0; $i < $nest_level; $i++) { |
|
| 352 | + $prefix .= " "; |
|
| 353 | + } |
|
| 348 | 354 | |
| 349 | 355 | Debug::log("$prefix C: $item_id P: $parent_id"); |
| 350 | 356 | |
@@ -409,8 +415,9 @@ discard block |
||
| 409 | 415 | #file_put_contents("/tmp/saveorder.json", clean($_POST['payload'])); |
| 410 | 416 | #$data = json_decode(file_get_contents("/tmp/saveorder.json"), true); |
| 411 | 417 | |
| 412 | - if (!is_array($data['items'])) |
|
| 413 | - $data['items'] = json_decode($data['items'], true); |
|
| 418 | + if (!is_array($data['items'])) { |
|
| 419 | + $data['items'] = json_decode($data['items'], true); |
|
| 420 | + } |
|
| 414 | 421 | |
| 415 | 422 | # print_r($data['items']); |
| 416 | 423 | |
@@ -494,7 +501,9 @@ discard block |
||
| 494 | 501 | } |
| 495 | 502 | } |
| 496 | 503 | |
| 497 | - if (is_file($icon_file)) @unlink($icon_file); |
|
| 504 | + if (is_file($icon_file)) { |
|
| 505 | + @unlink($icon_file); |
|
| 506 | + } |
|
| 498 | 507 | |
| 499 | 508 | print $rc; |
| 500 | 509 | return; |
@@ -590,8 +599,9 @@ discard block |
||
| 590 | 599 | if (DB_TYPE == "pgsql") { |
| 591 | 600 | $feed_language = $row["feed_language"]; |
| 592 | 601 | |
| 593 | - if (!$feed_language) |
|
| 594 | - $feed_language = get_pref('DEFAULT_SEARCH_LANGUAGE'); |
|
| 602 | + if (!$feed_language) { |
|
| 603 | + $feed_language = get_pref('DEFAULT_SEARCH_LANGUAGE'); |
|
| 604 | + } |
|
| 595 | 605 | |
| 596 | 606 | print "<fieldset>"; |
| 597 | 607 | |
@@ -1404,11 +1414,13 @@ discard block |
||
| 1404 | 1414 | $obj = array(); |
| 1405 | 1415 | $feed_id = (int) $feed_id; |
| 1406 | 1416 | |
| 1407 | - if (!$title) |
|
| 1408 | - $title = Feeds::getFeedTitle($feed_id, false); |
|
| 1417 | + if (!$title) { |
|
| 1418 | + $title = Feeds::getFeedTitle($feed_id, false); |
|
| 1419 | + } |
|
| 1409 | 1420 | |
| 1410 | - if ($unread === false) |
|
| 1411 | - $unread = getFeedUnread($feed_id, false); |
|
| 1421 | + if ($unread === false) { |
|
| 1422 | + $unread = getFeedUnread($feed_id, false); |
|
| 1423 | + } |
|
| 1412 | 1424 | |
| 1413 | 1425 | $obj['id'] = 'FEED:' . $feed_id; |
| 1414 | 1426 | $obj['name'] = $title; |
@@ -1738,7 +1750,9 @@ discard block |
||
| 1738 | 1750 | |
| 1739 | 1751 | |
| 1740 | 1752 | private function update_feed_access_key($feed_id, $is_cat, $owner_uid = false) { |
| 1741 | - if (!$owner_uid) $owner_uid = $_SESSION["uid"]; |
|
| 1753 | + if (!$owner_uid) { |
|
| 1754 | + $owner_uid = $_SESSION["uid"]; |
|
| 1755 | + } |
|
| 1742 | 1756 | |
| 1743 | 1757 | // clear old value and generate new one |
| 1744 | 1758 | $sth = $this->pdo->prepare("DELETE FROM ttrss_access_keys |
@@ -160,7 +160,9 @@ discard block |
||
| 160 | 160 | $boolean_prefs = explode(",", clean($_POST["boolean_prefs"])); |
| 161 | 161 | |
| 162 | 162 | foreach ($boolean_prefs as $pref) { |
| 163 | - if (!isset($_POST[$pref])) $_POST[$pref] = 'false'; |
|
| 163 | + if (!isset($_POST[$pref])) { |
|
| 164 | + $_POST[$pref] = 'false'; |
|
| 165 | + } |
|
| 164 | 166 | } |
| 165 | 167 | |
| 166 | 168 | $need_reload = false; |
@@ -180,11 +182,15 @@ discard block |
||
| 180 | 182 | } |
| 181 | 183 | break; |
| 182 | 184 | case 'USER_LANGUAGE': |
| 183 | - if (!$need_reload) $need_reload = $_SESSION["language"] != $value; |
|
| 185 | + if (!$need_reload) { |
|
| 186 | + $need_reload = $_SESSION["language"] != $value; |
|
| 187 | + } |
|
| 184 | 188 | break; |
| 185 | 189 | |
| 186 | 190 | case 'USER_CSS_THEME': |
| 187 | - if (!$need_reload) $need_reload = get_pref($pref_name) != $value; |
|
| 191 | + if (!$need_reload) { |
|
| 192 | + $need_reload = get_pref($pref_name) != $value; |
|
| 193 | + } |
|
| 188 | 194 | break; |
| 189 | 195 | } |
| 190 | 196 | |
@@ -616,8 +622,9 @@ discard block |
||
| 616 | 622 | $pref_name = $line["pref_name"]; |
| 617 | 623 | $short_desc = $this->getShortDesc($pref_name); |
| 618 | 624 | |
| 619 | - if (!$short_desc) |
|
| 620 | - continue; |
|
| 625 | + if (!$short_desc) { |
|
| 626 | + continue; |
|
| 627 | + } |
|
| 621 | 628 | |
| 622 | 629 | $prefs_available[$pref_name] = [ |
| 623 | 630 | 'type_name' => $line["type_name"], |
@@ -669,7 +676,9 @@ discard block |
||
| 669 | 676 | $themes = array_filter($themes, "theme_exists"); |
| 670 | 677 | asort($themes); |
| 671 | 678 | |
| 672 | - if (!theme_exists($value)) $value = "default.php"; |
|
| 679 | + if (!theme_exists($value)) { |
|
| 680 | + $value = "default.php"; |
|
| 681 | + } |
|
| 673 | 682 | |
| 674 | 683 | print "<select name='$pref_name' id='$pref_name' dojoType='fox.form.Select'>"; |
| 675 | 684 | |
@@ -728,14 +737,15 @@ discard block |
||
| 728 | 737 | $disabled = ""; |
| 729 | 738 | } |
| 730 | 739 | |
| 731 | - if ($type_name == 'integer') |
|
| 732 | - print "<input dojoType=\"dijit.form.NumberSpinner\" |
|
| 740 | + if ($type_name == 'integer') { |
|
| 741 | + print "<input dojoType=\"dijit.form.NumberSpinner\" |
|
| 733 | 742 | required='1' $disabled |
| 734 | 743 | name=\"$pref_name\" value=\"$value\">"; |
| 735 | - else |
|
| 736 | - print "<input dojoType=\"dijit.form.TextBox\" |
|
| 744 | + } else { |
|
| 745 | + print "<input dojoType=\"dijit.form.TextBox\" |
|
| 737 | 746 | required='1' $regexp $disabled |
| 738 | 747 | name=\"$pref_name\" value=\"$value\">"; |
| 748 | + } |
|
| 739 | 749 | |
| 740 | 750 | } else if ($pref_name == "SSL_CERT_SERIAL") { |
| 741 | 751 | |
@@ -770,8 +780,9 @@ discard block |
||
| 770 | 780 | print "<input dojoType=\"dijit.form.ValidationTextBox\" $regexp name=\"$pref_name\" value=\"$value\">"; |
| 771 | 781 | } |
| 772 | 782 | |
| 773 | - if ($item['help_text']) |
|
| 774 | - print "<div class='help-text text-muted'><label for='CB_$pref_name'>".$item['help_text']."</label></div>"; |
|
| 783 | + if ($item['help_text']) { |
|
| 784 | + print "<div class='help-text text-muted'><label for='CB_$pref_name'>".$item['help_text']."</label></div>"; |
|
| 785 | + } |
|
| 775 | 786 | |
| 776 | 787 | print "</fieldset>"; |
| 777 | 788 | } |
@@ -1108,10 +1119,11 @@ discard block |
||
| 1108 | 1119 | } |
| 1109 | 1120 | |
| 1110 | 1121 | public function setplugins() { |
| 1111 | - if (is_array(clean($_REQUEST["plugins"]))) |
|
| 1112 | - $plugins = join(",", clean($_REQUEST["plugins"])); |
|
| 1113 | - else |
|
| 1114 | - $plugins = ""; |
|
| 1122 | + if (is_array(clean($_REQUEST["plugins"]))) { |
|
| 1123 | + $plugins = join(",", clean($_REQUEST["plugins"])); |
|
| 1124 | + } else { |
|
| 1125 | + $plugins = ""; |
|
| 1126 | + } |
|
| 1115 | 1127 | |
| 1116 | 1128 | set_pref("_ENABLED_PLUGINS", $plugins); |
| 1117 | 1129 | } |
@@ -21,8 +21,9 @@ discard block |
||
| 21 | 21 | #file_put_contents("/tmp/saveorder.json", clean($_POST['payload'])); |
| 22 | 22 | #$data = json_decode(file_get_contents("/tmp/saveorder.json"), true); |
| 23 | 23 | |
| 24 | - if (!is_array($data['items'])) |
|
| 25 | - $data['items'] = json_decode($data['items'], true); |
|
| 24 | + if (!is_array($data['items'])) { |
|
| 25 | + $data['items'] = json_decode($data['items'], true); |
|
| 26 | + } |
|
| 26 | 27 | |
| 27 | 28 | $index = 0; |
| 28 | 29 | |
@@ -98,12 +99,16 @@ discard block |
||
| 98 | 99 | } |
| 99 | 100 | } |
| 100 | 101 | |
| 101 | - if (count($scope_qparts) == 0) $scope_qparts = ["true"]; |
|
| 102 | + if (count($scope_qparts) == 0) { |
|
| 103 | + $scope_qparts = ["true"]; |
|
| 104 | + } |
|
| 102 | 105 | |
| 103 | 106 | $glue = $filter['match_any_rule'] ? " OR " : " AND "; |
| 104 | 107 | $scope_qpart = join($glue, $scope_qparts); |
| 105 | 108 | |
| 106 | - if (!$scope_qpart) $scope_qpart = "true"; |
|
| 109 | + if (!$scope_qpart) { |
|
| 110 | + $scope_qpart = "true"; |
|
| 111 | + } |
|
| 107 | 112 | |
| 108 | 113 | $rv = array(); |
| 109 | 114 | |
@@ -161,7 +166,9 @@ discard block |
||
| 161 | 166 | |
| 162 | 167 | public function testFilter() { |
| 163 | 168 | |
| 164 | - if (isset($_REQUEST["offset"])) return $this->testFilterDo(); |
|
| 169 | + if (isset($_REQUEST["offset"])) { |
|
| 170 | + return $this->testFilterDo(); |
|
| 171 | + } |
|
| 165 | 172 | |
| 166 | 173 | //print __("Articles matching this filter:"); |
| 167 | 174 | |
@@ -206,10 +213,11 @@ discard block |
||
| 206 | 213 | $feed_id = (int)substr($feed_id, 4); |
| 207 | 214 | array_push($feeds_fmt, Feeds::getCategoryTitle($feed_id)); |
| 208 | 215 | } else { |
| 209 | - if ($feed_id) |
|
| 210 | - array_push($feeds_fmt, Feeds::getFeedTitle((int)$feed_id)); |
|
| 211 | - else |
|
| 212 | - array_push($feeds_fmt, __("All feeds")); |
|
| 216 | + if ($feed_id) { |
|
| 217 | + array_push($feeds_fmt, Feeds::getFeedTitle((int)$feed_id)); |
|
| 218 | + } else { |
|
| 219 | + array_push($feeds_fmt, __("All feeds")); |
|
| 220 | + } |
|
| 213 | 221 | } |
| 214 | 222 | } |
| 215 | 223 | |
@@ -396,7 +404,9 @@ discard block |
||
| 396 | 404 | unset($line["cat_id"]); |
| 397 | 405 | unset($line["filter_id"]); |
| 398 | 406 | unset($line["id"]); |
| 399 | - if (!$line["inverse"]) unset($line["inverse"]); |
|
| 407 | + if (!$line["inverse"]) { |
|
| 408 | + unset($line["inverse"]); |
|
| 409 | + } |
|
| 400 | 410 | unset($line["match_on"]); |
| 401 | 411 | |
| 402 | 412 | $data = htmlspecialchars(json_encode($line)); |
@@ -518,12 +528,16 @@ discard block |
||
| 518 | 528 | } |
| 519 | 529 | |
| 520 | 530 | private function getRuleName($rule) { |
| 521 | - if (!$rule) $rule = json_decode(clean($_REQUEST["rule"]), true); |
|
| 531 | + if (!$rule) { |
|
| 532 | + $rule = json_decode(clean($_REQUEST["rule"]), true); |
|
| 533 | + } |
|
| 522 | 534 | |
| 523 | 535 | $feeds = $rule["feed_id"]; |
| 524 | 536 | $feeds_fmt = []; |
| 525 | 537 | |
| 526 | - if (!is_array($feeds)) $feeds = [$feeds]; |
|
| 538 | + if (!is_array($feeds)) { |
|
| 539 | + $feeds = [$feeds]; |
|
| 540 | + } |
|
| 527 | 541 | |
| 528 | 542 | foreach ($feeds as $feed_id) { |
| 529 | 543 | |
@@ -531,10 +545,11 @@ discard block |
||
| 531 | 545 | $feed_id = (int)substr($feed_id, 4); |
| 532 | 546 | array_push($feeds_fmt, Feeds::getCategoryTitle($feed_id)); |
| 533 | 547 | } else { |
| 534 | - if ($feed_id) |
|
| 535 | - array_push($feeds_fmt, Feeds::getFeedTitle((int)$feed_id)); |
|
| 536 | - else |
|
| 537 | - array_push($feeds_fmt, __("All feeds")); |
|
| 548 | + if ($feed_id) { |
|
| 549 | + array_push($feeds_fmt, Feeds::getFeedTitle((int)$feed_id)); |
|
| 550 | + } else { |
|
| 551 | + array_push($feeds_fmt, __("All feeds")); |
|
| 552 | + } |
|
| 538 | 553 | } |
| 539 | 554 | } |
| 540 | 555 | |
@@ -573,8 +588,9 @@ discard block |
||
| 573 | 588 | $title = __($row["description"]); |
| 574 | 589 | |
| 575 | 590 | if ($action["action_id"] == 4 || $action["action_id"] == 6 || |
| 576 | - $action["action_id"] == 7) |
|
| 577 | - $title .= ": " . $action["action_param"]; |
|
| 591 | + $action["action_id"] == 7) { |
|
| 592 | + $title .= ": " . $action["action_param"]; |
|
| 593 | + } |
|
| 578 | 594 | |
| 579 | 595 | if ($action["action_id"] == 9) { |
| 580 | 596 | list ($pfclass, $pfaction) = explode(":", $action["action_param"]); |
@@ -644,8 +660,12 @@ discard block |
||
| 644 | 660 | $sth = $this->pdo->prepare("DELETE FROM ttrss_filters2_actions WHERE filter_id = ?"); |
| 645 | 661 | $sth->execute([$filter_id]); |
| 646 | 662 | |
| 647 | - if (!is_array(clean($_REQUEST["rule"]))) $_REQUEST["rule"] = []; |
|
| 648 | - if (!is_array(clean($_REQUEST["action"]))) $_REQUEST["action"] = []; |
|
| 663 | + if (!is_array(clean($_REQUEST["rule"]))) { |
|
| 664 | + $_REQUEST["rule"] = []; |
|
| 665 | + } |
|
| 666 | + if (!is_array(clean($_REQUEST["action"]))) { |
|
| 667 | + $_REQUEST["action"] = []; |
|
| 668 | + } |
|
| 649 | 669 | |
| 650 | 670 | if ($filter_id) { |
| 651 | 671 | /* create rules */ |
@@ -1137,7 +1157,9 @@ discard block |
||
| 1137 | 1157 | $match_any_rule = $row["match_any_rule"]; |
| 1138 | 1158 | $inverse = $row["inverse"]; |
| 1139 | 1159 | |
| 1140 | - if (!$title) $title = __("[No caption]"); |
|
| 1160 | + if (!$title) { |
|
| 1161 | + $title = __("[No caption]"); |
|
| 1162 | + } |
|
| 1141 | 1163 | |
| 1142 | 1164 | $title = sprintf(_ngettext("%s (%d rule)", "%s (%d rules)", (int) $num_rules), $title, $num_rules); |
| 1143 | 1165 | |
@@ -1153,11 +1175,16 @@ discard block |
||
| 1153 | 1175 | $num_actions -= 1; |
| 1154 | 1176 | } |
| 1155 | 1177 | |
| 1156 | - if ($match_any_rule) $title .= " (" . __("matches any rule") . ")"; |
|
| 1157 | - if ($inverse) $title .= " (" . __("inverse") . ")"; |
|
| 1178 | + if ($match_any_rule) { |
|
| 1179 | + $title .= " (" . __("matches any rule") . ")"; |
|
| 1180 | + } |
|
| 1181 | + if ($inverse) { |
|
| 1182 | + $title .= " (" . __("inverse") . ")"; |
|
| 1183 | + } |
|
| 1158 | 1184 | |
| 1159 | - if ($num_actions > 0) |
|
| 1160 | - $actions = sprintf(_ngettext("%s (+%d action)", "%s (+%d actions)", (int) $num_actions), $actions, $num_actions); |
|
| 1185 | + if ($num_actions > 0) { |
|
| 1186 | + $actions = sprintf(_ngettext("%s (+%d action)", "%s (+%d actions)", (int) $num_actions), $actions, $num_actions); |
|
| 1187 | + } |
|
| 1161 | 1188 | |
| 1162 | 1189 | return [$title, $actions]; |
| 1163 | 1190 | } |
@@ -235,7 +235,10 @@ discard block |
||
| 235 | 235 | $salt = substr(bin2hex(get_random_bytes(125)), 0, 250); |
| 236 | 236 | $pwd_hash = encrypt_password($tmp_user_pwd, $salt, true); |
| 237 | 237 | |
| 238 | - if (!$login) return; // no blank usernames |
|
| 238 | + if (!$login) { |
|
| 239 | + return; |
|
| 240 | + } |
|
| 241 | + // no blank usernames |
|
| 239 | 242 | |
| 240 | 243 | $sth = $this->pdo->prepare("SELECT id FROM ttrss_users WHERE |
| 241 | 244 | login = ?"); |
@@ -294,10 +297,11 @@ discard block |
||
| 294 | 297 | |
| 295 | 298 | $message = T_sprintf("Changed password of user %s to %s", "<strong>$login</strong>", "<strong>$tmp_user_pwd</strong>"); |
| 296 | 299 | |
| 297 | - if ($format_output) |
|
| 298 | - print_notice($message); |
|
| 299 | - else |
|
| 300 | - print $message; |
|
| 300 | + if ($format_output) { |
|
| 301 | + print_notice($message); |
|
| 302 | + } else { |
|
| 303 | + print $message; |
|
| 304 | + } |
|
| 301 | 305 | |
| 302 | 306 | } |
| 303 | 307 | } |
@@ -365,7 +369,9 @@ discard block |
||
| 365 | 369 | $sort = $this->validate_field($sort, |
| 366 | 370 | ["login", "access_level", "created", "num_feeds", "created", "last_login"], "login"); |
| 367 | 371 | |
| 368 | - if ($sort != "login") $sort = "$sort DESC"; |
|
| 372 | + if ($sort != "login") { |
|
| 373 | + $sort = "$sort DESC"; |
|
| 374 | + } |
|
| 369 | 375 | |
| 370 | 376 | $sth = $this->pdo->prepare("SELECT |
| 371 | 377 | tu.id, |
@@ -437,10 +443,11 @@ discard block |
||
| 437 | 443 | } |
| 438 | 444 | |
| 439 | 445 | public function validate_field($string, $allowed, $default = "") { |
| 440 | - if (in_array($string, $allowed)) |
|
| 441 | - return $string; |
|
| 442 | - else |
|
| 443 | - return $default; |
|
| 446 | + if (in_array($string, $allowed)) { |
|
| 447 | + return $string; |
|
| 448 | + } else { |
|
| 449 | + return $default; |
|
| 450 | + } |
|
| 444 | 451 | } |
| 445 | 452 | |
| 446 | 453 | } |