@@ -175,7 +175,7 @@ |
||
| 175 | 175 | |
| 176 | 176 | // we don't support numeric tags |
| 177 | 177 | if (is_numeric($cat)) |
| 178 | - $cat = 't:' . $cat; |
|
| 178 | + $cat = 't:'.$cat; |
|
| 179 | 179 | |
| 180 | 180 | $cat = preg_replace('/[,\'\"]/', "", $cat); |
| 181 | 181 | |
@@ -14,8 +14,9 @@ discard block |
||
| 14 | 14 | $source = $elem->getElementsByTagName("source")->item(0); |
| 15 | 15 | |
| 16 | 16 | // we don't need <source> element |
| 17 | - if ($source) |
|
| 18 | - $elem->removeChild($source); |
|
| 17 | + if ($source) { |
|
| 18 | + $elem->removeChild($source); |
|
| 19 | + } |
|
| 19 | 20 | } catch (DOMException $e) { |
| 20 | 21 | // |
| 21 | 22 | } |
@@ -31,14 +32,19 @@ discard block |
||
| 31 | 32 | if ($author) { |
| 32 | 33 | $name = $author->getElementsByTagName("name")->item(0); |
| 33 | 34 | |
| 34 | - if ($name) return clean($name->nodeValue); |
|
| 35 | + if ($name) { |
|
| 36 | + return clean($name->nodeValue); |
|
| 37 | + } |
|
| 35 | 38 | |
| 36 | 39 | $email = $author->getElementsByTagName("email")->item(0); |
| 37 | 40 | |
| 38 | - if ($email) return clean($email->nodeValue); |
|
| 41 | + if ($email) { |
|
| 42 | + return clean($email->nodeValue); |
|
| 43 | + } |
|
| 39 | 44 | |
| 40 | - if ($author->nodeValue) |
|
| 41 | - return clean($author->nodeValue); |
|
| 45 | + if ($author->nodeValue) { |
|
| 46 | + return clean($author->nodeValue); |
|
| 47 | + } |
|
| 42 | 48 | } |
| 43 | 49 | |
| 44 | 50 | $author_elems = $this->xpath->query("dc:creator", $this->elem); |
@@ -56,15 +62,17 @@ discard block |
||
| 56 | 62 | //might give a wrong result if a default namespace was declared (possible with XPath 2.0) |
| 57 | 63 | $com_url = $this->xpath->query("comments", $this->elem)->item(0); |
| 58 | 64 | |
| 59 | - if ($com_url) |
|
| 60 | - return clean($com_url->nodeValue); |
|
| 65 | + if ($com_url) { |
|
| 66 | + return clean($com_url->nodeValue); |
|
| 67 | + } |
|
| 61 | 68 | |
| 62 | 69 | //Atom Threading Extension (RFC 4685) stuff. Could be used in RSS feeds, so it's in common. |
| 63 | 70 | //'text/html' for type is too restrictive? |
| 64 | 71 | $com_url = $this->xpath->query("atom:link[@rel='replies' and contains(@type,'text/html')]/@href", $this->elem)->item(0); |
| 65 | 72 | |
| 66 | - if ($com_url) |
|
| 67 | - return clean($com_url->nodeValue); |
|
| 73 | + if ($com_url) { |
|
| 74 | + return clean($com_url->nodeValue); |
|
| 75 | + } |
|
| 68 | 76 | } |
| 69 | 77 | |
| 70 | 78 | function get_comments_count() { |
@@ -98,7 +106,9 @@ discard block |
||
| 98 | 106 | } |
| 99 | 107 | |
| 100 | 108 | $desc = $this->xpath->query("media:description", $enclosure)->item(0); |
| 101 | - if ($desc) $enc->title = clean($desc->nodeValue); |
|
| 109 | + if ($desc) { |
|
| 110 | + $enc->title = clean($desc->nodeValue); |
|
| 111 | + } |
|
| 102 | 112 | |
| 103 | 113 | array_push($encs, $enc); |
| 104 | 114 | } |
@@ -127,7 +137,9 @@ discard block |
||
| 127 | 137 | $enc->title = clean($desc->nodeValue); |
| 128 | 138 | } else { |
| 129 | 139 | $desc = $this->xpath->query("media:description", $enclosure)->item(0); |
| 130 | - if ($desc) $enc->title = clean($desc->nodeValue); |
|
| 140 | + if ($desc) { |
|
| 141 | + $enc->title = clean($desc->nodeValue); |
|
| 142 | + } |
|
| 131 | 143 | } |
| 132 | 144 | |
| 133 | 145 | array_push($encs, $enc); |
@@ -174,8 +186,9 @@ discard block |
||
| 174 | 186 | $cat = clean(trim(mb_strtolower($srccat))); |
| 175 | 187 | |
| 176 | 188 | // we don't support numeric tags |
| 177 | - if (is_numeric($cat)) |
|
| 178 | - $cat = 't:' . $cat; |
|
| 189 | + if (is_numeric($cat)) { |
|
| 190 | + $cat = 't:' . $cat; |
|
| 191 | + } |
|
| 179 | 192 | |
| 180 | 193 | $cat = preg_replace('/[,\'\"]/', "", $cat); |
| 181 | 194 | |
@@ -183,8 +196,9 @@ discard block |
||
| 183 | 196 | $cat = preg_replace('/[\x{10000}-\x{10FFFF}]/u', "\xEF\xBF\xBD", $cat); |
| 184 | 197 | } |
| 185 | 198 | |
| 186 | - if (mb_strlen($cat) > 250) |
|
| 187 | - $cat = mb_substr($cat, 0, 250); |
|
| 199 | + if (mb_strlen($cat) > 250) { |
|
| 200 | + $cat = mb_substr($cat, 0, 250); |
|
| 201 | + } |
|
| 188 | 202 | |
| 189 | 203 | return $cat; |
| 190 | 204 | }, $tmp); |
@@ -43,10 +43,11 @@ discard block |
||
| 43 | 43 | || $link->getAttribute("rel") == "standout")) { |
| 44 | 44 | $base = $this->xpath->evaluate("string(ancestor-or-self::*[@xml:base][1]/@xml:base)", $link); |
| 45 | 45 | |
| 46 | - if ($base) |
|
| 47 | - return rewrite_relative_url($base, clean(trim($link->getAttribute("href")))); |
|
| 48 | - else |
|
| 49 | - return clean(trim($link->getAttribute("href"))); |
|
| 46 | + if ($base) { |
|
| 47 | + return rewrite_relative_url($base, clean(trim($link->getAttribute("href")))); |
|
| 48 | + } else { |
|
| 49 | + return clean(trim($link->getAttribute("href"))); |
|
| 50 | + } |
|
| 50 | 51 | |
| 51 | 52 | } |
| 52 | 53 | } |
@@ -106,8 +107,9 @@ discard block |
||
| 106 | 107 | $cats = []; |
| 107 | 108 | |
| 108 | 109 | foreach ($categories as $cat) { |
| 109 | - if ($cat->hasAttribute("term")) |
|
| 110 | - array_push($cats, $cat->getAttribute("term")); |
|
| 110 | + if ($cat->hasAttribute("term")) { |
|
| 111 | + array_push($cats, $cat->getAttribute("term")); |
|
| 112 | + } |
|
| 111 | 113 | } |
| 112 | 114 | |
| 113 | 115 | $categories = $this->xpath->query("dc:subject", $this->elem); |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | |
| 286 | 286 | array_push($rv, [ "label" => $title, "value" => $id ]); |
| 287 | 287 | } |
| 288 | - } |
|
| 288 | + } |
|
| 289 | 289 | |
| 290 | 290 | print json_encode($rv); |
| 291 | 291 | } |
@@ -358,37 +358,37 @@ discard block |
||
| 358 | 358 | |
| 359 | 359 | $enclosures = Article::get_article_enclosures($line["id"]); |
| 360 | 360 | |
| 361 | - header("Content-Type: text/html"); |
|
| 361 | + header("Content-Type: text/html"); |
|
| 362 | 362 | |
| 363 | - $rv .= "<!DOCTYPE html> |
|
| 363 | + $rv .= "<!DOCTYPE html> |
|
| 364 | 364 | <html><head> |
| 365 | 365 | <meta http-equiv='Content-Type' content='text/html; charset=utf-8'/> |
| 366 | 366 | <title>".$line["title"]."</title>". |
| 367 | - stylesheet_tag("css/default.css")." |
|
| 367 | + stylesheet_tag("css/default.css")." |
|
| 368 | 368 | <link rel='shortcut icon' type='image/png' href='images/favicon.png'> |
| 369 | 369 | <link rel='icon' type='image/png' sizes='72x72' href='images/favicon-72px.png'>"; |
| 370 | 370 | |
| 371 | - $rv .= "<meta property='og:title' content=\"".htmlspecialchars(html_entity_decode($line["title"], ENT_NOQUOTES | ENT_HTML401))."\"/>\n"; |
|
| 372 | - $rv .= "<meta property='og:description' content=\"". |
|
| 373 | - htmlspecialchars( |
|
| 374 | - truncate_string( |
|
| 375 | - preg_replace("/[\r\n\t]/", "", |
|
| 371 | + $rv .= "<meta property='og:title' content=\"".htmlspecialchars(html_entity_decode($line["title"], ENT_NOQUOTES | ENT_HTML401))."\"/>\n"; |
|
| 372 | + $rv .= "<meta property='og:description' content=\"". |
|
| 373 | + htmlspecialchars( |
|
| 374 | + truncate_string( |
|
| 375 | + preg_replace("/[\r\n\t]/", "", |
|
| 376 | 376 | preg_replace("/ {1,}/", " ", |
| 377 | 377 | strip_tags(html_entity_decode($line["content"], ENT_NOQUOTES | ENT_HTML401)) |
| 378 | 378 | ) |
| 379 | 379 | ), 500, "...") |
| 380 | 380 | )."\"/>\n"; |
| 381 | 381 | |
| 382 | - $rv .= "</head>"; |
|
| 382 | + $rv .= "</head>"; |
|
| 383 | 383 | |
| 384 | - list ($og_image, $og_stream) = Article::get_article_image($enclosures, $line['content'], $line["site_url"]); |
|
| 384 | + list ($og_image, $og_stream) = Article::get_article_image($enclosures, $line['content'], $line["site_url"]); |
|
| 385 | 385 | |
| 386 | - if ($og_image) { |
|
| 387 | - $rv .= "<meta property='og:image' content=\"" . htmlspecialchars($og_image) . "\"/>"; |
|
| 388 | - } |
|
| 386 | + if ($og_image) { |
|
| 387 | + $rv .= "<meta property='og:image' content=\"" . htmlspecialchars($og_image) . "\"/>"; |
|
| 388 | + } |
|
| 389 | 389 | |
| 390 | - $rv .= "<body class='flat ttrss_utility ttrss_zoom'>"; |
|
| 391 | - $rv .= "<div class='container'>"; |
|
| 390 | + $rv .= "<body class='flat ttrss_utility ttrss_zoom'>"; |
|
| 391 | + $rv .= "<div class='container'>"; |
|
| 392 | 392 | |
| 393 | 393 | if ($line["link"]) { |
| 394 | 394 | $rv .= "<h1><a target='_blank' rel='noopener noreferrer' |
@@ -410,7 +410,7 @@ discard block |
||
| 410 | 410 | $owner_uid, true); |
| 411 | 411 | |
| 412 | 412 | $rv .= "<div>".$line['author']."</div>"; |
| 413 | - $rv .= "<div>$parsed_updated</div>"; |
|
| 413 | + $rv .= "<div>$parsed_updated</div>"; |
|
| 414 | 414 | |
| 415 | 415 | $rv .= "</div>"; # row |
| 416 | 416 | |
@@ -425,10 +425,10 @@ discard block |
||
| 425 | 425 | |
| 426 | 426 | $rv .= $line["content"]; |
| 427 | 427 | |
| 428 | - $rv .= Article::format_article_enclosures($id, |
|
| 429 | - $line["always_display_enclosures"], |
|
| 430 | - $line["content"], |
|
| 431 | - $line["hide_images"]); |
|
| 428 | + $rv .= Article::format_article_enclosures($id, |
|
| 429 | + $line["always_display_enclosures"], |
|
| 430 | + $line["content"], |
|
| 431 | + $line["hide_images"]); |
|
| 432 | 432 | |
| 433 | 433 | $rv .= "</div>"; # content |
| 434 | 434 | |
@@ -675,8 +675,8 @@ discard block |
||
| 675 | 675 | if ($sth->fetch()) { |
| 676 | 676 | $_SESSION["profile"] = $profile; |
| 677 | 677 | } else { |
| 678 | - $_SESSION["profile"] = null; |
|
| 679 | - } |
|
| 678 | + $_SESSION["profile"] = null; |
|
| 679 | + } |
|
| 680 | 680 | } |
| 681 | 681 | } else { |
| 682 | 682 | |
@@ -760,24 +760,24 @@ |
||
| 760 | 760 | $feed_urls = false; |
| 761 | 761 | |
| 762 | 762 | switch ($rc['code']) { |
| 763 | - case 0: |
|
| 764 | - print_warning(T_sprintf("Already subscribed to <b>%s</b>.", $feed_url)); |
|
| 765 | - break; |
|
| 766 | - case 1: |
|
| 767 | - print_notice(T_sprintf("Subscribed to <b>%s</b>.", $feed_url)); |
|
| 768 | - break; |
|
| 769 | - case 2: |
|
| 770 | - print_error(T_sprintf("Could not subscribe to <b>%s</b>.", $feed_url)); |
|
| 771 | - break; |
|
| 772 | - case 3: |
|
| 773 | - print_error(T_sprintf("No feeds found in <b>%s</b>.", $feed_url)); |
|
| 774 | - break; |
|
| 775 | - case 4: |
|
| 776 | - $feed_urls = $rc["feeds"]; |
|
| 777 | - break; |
|
| 778 | - case 5: |
|
| 779 | - print_error(T_sprintf("Could not subscribe to <b>%s</b>.<br>Can't download the Feed URL.", $feed_url)); |
|
| 780 | - break; |
|
| 763 | + case 0: |
|
| 764 | + print_warning(T_sprintf("Already subscribed to <b>%s</b>.", $feed_url)); |
|
| 765 | + break; |
|
| 766 | + case 1: |
|
| 767 | + print_notice(T_sprintf("Subscribed to <b>%s</b>.", $feed_url)); |
|
| 768 | + break; |
|
| 769 | + case 2: |
|
| 770 | + print_error(T_sprintf("Could not subscribe to <b>%s</b>.", $feed_url)); |
|
| 771 | + break; |
|
| 772 | + case 3: |
|
| 773 | + print_error(T_sprintf("No feeds found in <b>%s</b>.", $feed_url)); |
|
| 774 | + break; |
|
| 775 | + case 4: |
|
| 776 | + $feed_urls = $rc["feeds"]; |
|
| 777 | + break; |
|
| 778 | + case 5: |
|
| 779 | + print_error(T_sprintf("Could not subscribe to <b>%s</b>.<br>Can't download the Feed URL.", $feed_url)); |
|
| 780 | + break; |
|
| 781 | 781 | } |
| 782 | 782 | |
| 783 | 783 | if ($feed_urls) { |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | |
| 8 | 8 | require_once "lib/MiniTemplator.class.php"; |
| 9 | 9 | |
| 10 | - $note_style = "background-color : #fff7d5; |
|
| 10 | + $note_style = "background-color : #fff7d5; |
|
| 11 | 11 | border-width : 1px; ". |
| 12 | 12 | "padding : 5px; border-style : dashed; border-color : #e7d796;". |
| 13 | 13 | "margin-bottom : 1em; color : #9a8c59;"; |
@@ -73,8 +73,8 @@ discard block |
||
| 73 | 73 | $feed_site_url = $qfh_ret[2]; |
| 74 | 74 | /* $last_error = $qfh_ret[3]; */ |
| 75 | 75 | |
| 76 | - $feed_self_url = get_self_url_prefix() . |
|
| 77 | - "/public.php?op=rss&id=$feed&key=" . |
|
| 76 | + $feed_self_url = get_self_url_prefix(). |
|
| 77 | + "/public.php?op=rss&id=$feed&key=". |
|
| 78 | 78 | Feeds::get_feed_access_key($feed, false, $owner_uid); |
| 79 | 79 | |
| 80 | 80 | if (!$feed_site_url) $feed_site_url = get_self_url_prefix(); |
@@ -102,8 +102,7 @@ discard block |
||
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | $tpl->setVariable('ARTICLE_ID', |
| 105 | - htmlspecialchars($orig_guid ? $line['link'] : |
|
| 106 | - $this->make_article_tag_uri($line['id'], $line['date_entered'])), true); |
|
| 105 | + htmlspecialchars($orig_guid ? $line['link'] : $this->make_article_tag_uri($line['id'], $line['date_entered'])), true); |
|
| 107 | 106 | $tpl->setVariable('ARTICLE_LINK', htmlspecialchars($line['link']), true); |
| 108 | 107 | $tpl->setVariable('ARTICLE_TITLE', htmlspecialchars($line['title']), true); |
| 109 | 108 | $tpl->setVariable('ARTICLE_EXCERPT', $line["content_preview"], true); |
@@ -112,7 +111,7 @@ discard block |
||
| 112 | 111 | $feed_site_url, false, $line["id"]); |
| 113 | 112 | |
| 114 | 113 | if ($line['note']) { |
| 115 | - $content = "<div style=\"$note_style\">Article note: " . $line['note'] . "</div>" . |
|
| 114 | + $content = "<div style=\"$note_style\">Article note: ".$line['note']."</div>". |
|
| 116 | 115 | $content; |
| 117 | 116 | $tpl->setVariable('ARTICLE_NOTE', htmlspecialchars($line['note']), true); |
| 118 | 117 | } |
@@ -201,7 +200,7 @@ discard block |
||
| 201 | 200 | $article = array(); |
| 202 | 201 | |
| 203 | 202 | $article['id'] = $line['link']; |
| 204 | - $article['link'] = $line['link']; |
|
| 203 | + $article['link'] = $line['link']; |
|
| 205 | 204 | $article['title'] = $line['title']; |
| 206 | 205 | $article['excerpt'] = $line["content_preview"]; |
| 207 | 206 | $article['content'] = sanitize($line["content"], false, $owner_uid, $feed_site_url, false, $line["id"]); |
@@ -277,13 +276,13 @@ discard block |
||
| 277 | 276 | WHERE ttrss_users.id = ttrss_settings_profiles.owner_uid AND login = ? ORDER BY title"); |
| 278 | 277 | $sth->execute([$login]); |
| 279 | 278 | |
| 280 | - $rv = [ [ "value" => 0, "label" => __("Default profile") ] ]; |
|
| 279 | + $rv = [["value" => 0, "label" => __("Default profile")]]; |
|
| 281 | 280 | |
| 282 | 281 | while ($line = $sth->fetch()) { |
| 283 | 282 | $id = $line["id"]; |
| 284 | 283 | $title = $line["title"]; |
| 285 | 284 | |
| 286 | - array_push($rv, [ "label" => $title, "value" => $id ]); |
|
| 285 | + array_push($rv, ["label" => $title, "value" => $id]); |
|
| 287 | 286 | } |
| 288 | 287 | } |
| 289 | 288 | |
@@ -384,7 +383,7 @@ discard block |
||
| 384 | 383 | list ($og_image, $og_stream) = Article::get_article_image($enclosures, $line['content'], $line["site_url"]); |
| 385 | 384 | |
| 386 | 385 | if ($og_image) { |
| 387 | - $rv .= "<meta property='og:image' content=\"" . htmlspecialchars($og_image) . "\"/>"; |
|
| 386 | + $rv .= "<meta property='og:image' content=\"".htmlspecialchars($og_image)."\"/>"; |
|
| 388 | 387 | } |
| 389 | 388 | |
| 390 | 389 | $rv .= "<body class='flat ttrss_utility ttrss_zoom'>"; |
@@ -393,9 +392,9 @@ discard block |
||
| 393 | 392 | if ($line["link"]) { |
| 394 | 393 | $rv .= "<h1><a target='_blank' rel='noopener noreferrer' |
| 395 | 394 | title=\"".htmlspecialchars($line['title'])."\" |
| 396 | - href=\"" .htmlspecialchars($line["link"]) . "\">" . $line["title"] . "</a></h1>"; |
|
| 395 | + href=\"" .htmlspecialchars($line["link"])."\">".$line["title"]."</a></h1>"; |
|
| 397 | 396 | } else { |
| 398 | - $rv .= "<h1>" . $line["title"] . "</h1>"; |
|
| 397 | + $rv .= "<h1>".$line["title"]."</h1>"; |
|
| 399 | 398 | } |
| 400 | 399 | |
| 401 | 400 | $rv .= "<div class='content post'>"; |
@@ -448,8 +447,8 @@ discard block |
||
| 448 | 447 | $feed = clean($_REQUEST["id"]); |
| 449 | 448 | $key = clean($_REQUEST["key"]); |
| 450 | 449 | $is_cat = clean($_REQUEST["is_cat"]); |
| 451 | - $limit = (int)clean($_REQUEST["limit"]); |
|
| 452 | - $offset = (int)clean($_REQUEST["offset"]); |
|
| 450 | + $limit = (int) clean($_REQUEST["limit"]); |
|
| 451 | + $offset = (int) clean($_REQUEST["offset"]); |
|
| 453 | 452 | |
| 454 | 453 | $search = clean($_REQUEST["q"]); |
| 455 | 454 | $view_mode = clean($_REQUEST["view-mode"]); |
@@ -692,9 +691,9 @@ discard block |
||
| 692 | 691 | $return = clean($_REQUEST['return']); |
| 693 | 692 | |
| 694 | 693 | if ($_REQUEST['return'] && mb_strpos($return, SELF_URL_PATH) === 0) { |
| 695 | - header("Location: " . clean($_REQUEST['return'])); |
|
| 694 | + header("Location: ".clean($_REQUEST['return'])); |
|
| 696 | 695 | } else { |
| 697 | - header("Location: " . get_self_url_prefix()); |
|
| 696 | + header("Location: ".get_self_url_prefix()); |
|
| 698 | 697 | } |
| 699 | 698 | } |
| 700 | 699 | } |
@@ -786,7 +785,7 @@ discard block |
||
| 786 | 785 | print "<input type='hidden' name='op' value='subscribe'>"; |
| 787 | 786 | |
| 788 | 787 | print "<fieldset>"; |
| 789 | - print "<label style='display : inline'>" . __("Multiple feed URLs found:") . "</label>"; |
|
| 788 | + print "<label style='display : inline'>".__("Multiple feed URLs found:")."</label>"; |
|
| 790 | 789 | print "<select name='feed_url' dojoType='dijit.form.Select'>"; |
| 791 | 790 | |
| 792 | 791 | foreach ($feed_urls as $url => $name) { |
@@ -805,9 +804,9 @@ discard block |
||
| 805 | 804 | print "</form>"; |
| 806 | 805 | } |
| 807 | 806 | |
| 808 | - $tp_uri = get_self_url_prefix() . "/prefs.php"; |
|
| 807 | + $tp_uri = get_self_url_prefix()."/prefs.php"; |
|
| 809 | 808 | |
| 810 | - if ($rc['code'] <= 2){ |
|
| 809 | + if ($rc['code'] <= 2) { |
|
| 811 | 810 | $sth = $this->pdo->prepare("SELECT id FROM ttrss_feeds WHERE |
| 812 | 811 | feed_url = ? AND owner_uid = ?"); |
| 813 | 812 | $sth->execute([$feed_url, $_SESSION['uid']]); |
@@ -895,7 +894,7 @@ discard block |
||
| 895 | 894 | list($timestamp, $resetpass_token) = explode(":", $resetpass_token_full); |
| 896 | 895 | |
| 897 | 896 | if ($timestamp && $resetpass_token && |
| 898 | - $timestamp >= time() - 15*60*60 && |
|
| 897 | + $timestamp >= time() - 15 * 60 * 60 && |
|
| 899 | 898 | $resetpass_token == $hash) { |
| 900 | 899 | |
| 901 | 900 | $sth = $this->pdo->prepare("UPDATE ttrss_users SET resetpass_token = NULL |
@@ -935,8 +934,8 @@ discard block |
||
| 935 | 934 | <input dojoType='dijit.form.TextBox' type='email' name='email' value='' required> |
| 936 | 935 | </fieldset>"; |
| 937 | 936 | |
| 938 | - $_SESSION["pwdreset:testvalue1"] = rand(1,10); |
|
| 939 | - $_SESSION["pwdreset:testvalue2"] = rand(1,10); |
|
| 937 | + $_SESSION["pwdreset:testvalue1"] = rand(1, 10); |
|
| 938 | + $_SESSION["pwdreset:testvalue2"] = rand(1, 10); |
|
| 940 | 939 | |
| 941 | 940 | print "<fieldset> |
| 942 | 941 | <label>".T_sprintf("How much is %d + %d:", $_SESSION["pwdreset:testvalue1"], $_SESSION["pwdreset:testvalue2"])."</label> |
@@ -981,8 +980,8 @@ discard block |
||
| 981 | 980 | |
| 982 | 981 | if ($id) { |
| 983 | 982 | $resetpass_token = sha1(get_random_bytes(128)); |
| 984 | - $resetpass_link = get_self_url_prefix() . "/public.php?op=forgotpass&hash=" . $resetpass_token . |
|
| 985 | - "&login=" . urlencode($login); |
|
| 983 | + $resetpass_link = get_self_url_prefix()."/public.php?op=forgotpass&hash=".$resetpass_token. |
|
| 984 | + "&login=".urlencode($login); |
|
| 986 | 985 | |
| 987 | 986 | require_once "lib/MiniTemplator.class.php"; |
| 988 | 987 | |
@@ -1009,7 +1008,7 @@ discard block |
||
| 1009 | 1008 | |
| 1010 | 1009 | if (!$rc) print_error($mailer->error()); |
| 1011 | 1010 | |
| 1012 | - $resetpass_token_full = time() . ":" . $resetpass_token; |
|
| 1011 | + $resetpass_token_full = time().":".$resetpass_token; |
|
| 1013 | 1012 | |
| 1014 | 1013 | $sth = $this->pdo->prepare("UPDATE ttrss_users |
| 1015 | 1014 | SET resetpass_token = ? |
@@ -1099,12 +1098,12 @@ discard block |
||
| 1099 | 1098 | if ($op == "performupdate") { |
| 1100 | 1099 | if ($updater->isUpdateRequired()) { |
| 1101 | 1100 | |
| 1102 | - print "<h2>" . T_sprintf("Performing updates to version %d", SCHEMA_VERSION) . "</h2>"; |
|
| 1101 | + print "<h2>".T_sprintf("Performing updates to version %d", SCHEMA_VERSION)."</h2>"; |
|
| 1103 | 1102 | |
| 1104 | 1103 | for ($i = $updater->getSchemaVersion() + 1; $i <= SCHEMA_VERSION; $i++) { |
| 1105 | 1104 | print "<ul>"; |
| 1106 | 1105 | |
| 1107 | - print "<li class='text-info'>" . T_sprintf("Updating to version %d", $i) . "</li>"; |
|
| 1106 | + print "<li class='text-info'>".T_sprintf("Updating to version %d", $i)."</li>"; |
|
| 1108 | 1107 | |
| 1109 | 1108 | print "<li>"; |
| 1110 | 1109 | $result = $updater->performUpdateTo($i, true); |
@@ -1123,7 +1122,7 @@ discard block |
||
| 1123 | 1122 | |
| 1124 | 1123 | return; |
| 1125 | 1124 | } else { |
| 1126 | - print "<li class='text-success'>" . __("Completed.") . "</li>"; |
|
| 1125 | + print "<li class='text-success'>".__("Completed.")."</li>"; |
|
| 1127 | 1126 | print "</ul>"; |
| 1128 | 1127 | } |
| 1129 | 1128 | } |
@@ -1191,7 +1190,7 @@ discard block |
||
| 1191 | 1190 | |
| 1192 | 1191 | $timestamp = date("Y-m-d", strtotime($timestamp)); |
| 1193 | 1192 | |
| 1194 | - return "tag:" . parse_url(get_self_url_prefix(), PHP_URL_HOST) . ",$timestamp:/$id"; |
|
| 1193 | + return "tag:".parse_url(get_self_url_prefix(), PHP_URL_HOST).",$timestamp:/$id"; |
|
| 1195 | 1194 | } |
| 1196 | 1195 | |
| 1197 | 1196 | // this should be used very carefully because this endpoint is exposed to unauthenticated users |
@@ -12,7 +12,9 @@ discard block |
||
| 12 | 12 | "padding : 5px; border-style : dashed; border-color : #e7d796;". |
| 13 | 13 | "margin-bottom : 1em; color : #9a8c59;"; |
| 14 | 14 | |
| 15 | - if (!$limit) $limit = 60; |
|
| 15 | + if (!$limit) { |
|
| 16 | + $limit = 60; |
|
| 17 | + } |
|
| 16 | 18 | |
| 17 | 19 | $date_sort_field = "date_entered DESC, updated DESC"; |
| 18 | 20 | |
@@ -77,7 +79,9 @@ discard block |
||
| 77 | 79 | "/public.php?op=rss&id=$feed&key=" . |
| 78 | 80 | Feeds::get_feed_access_key($feed, false, $owner_uid); |
| 79 | 81 | |
| 80 | - if (!$feed_site_url) $feed_site_url = get_self_url_prefix(); |
|
| 82 | + if (!$feed_site_url) { |
|
| 83 | + $feed_site_url = get_self_url_prefix(); |
|
| 84 | + } |
|
| 81 | 85 | |
| 82 | 86 | if ($format == 'atom') { |
| 83 | 87 | $tpl = new MiniTemplator; |
@@ -207,8 +211,12 @@ discard block |
||
| 207 | 211 | $article['content'] = sanitize($line["content"], false, $owner_uid, $feed_site_url, false, $line["id"]); |
| 208 | 212 | $article['updated'] = date('c', strtotime($line["updated"])); |
| 209 | 213 | |
| 210 | - if ($line['note']) $article['note'] = $line['note']; |
|
| 211 | - if ($article['author']) $article['author'] = $line['author']; |
|
| 214 | + if ($line['note']) { |
|
| 215 | + $article['note'] = $line['note']; |
|
| 216 | + } |
|
| 217 | + if ($article['author']) { |
|
| 218 | + $article['author'] = $line['author']; |
|
| 219 | + } |
|
| 212 | 220 | |
| 213 | 221 | $tags = Article::get_article_tags($line["id"], $owner_uid); |
| 214 | 222 | |
@@ -459,7 +467,9 @@ discard block |
||
| 459 | 467 | $format = clean($_REQUEST['format']); |
| 460 | 468 | $orig_guid = clean($_REQUEST["orig_guid"]); |
| 461 | 469 | |
| 462 | - if (!$format) $format = 'atom'; |
|
| 470 | + if (!$format) { |
|
| 471 | + $format = 'atom'; |
|
| 472 | + } |
|
| 463 | 473 | |
| 464 | 474 | if (SINGLE_USER_MODE) { |
| 465 | 475 | authenticate_user("admin", null); |
@@ -472,8 +482,9 @@ discard block |
||
| 472 | 482 | ttrss_access_keys WHERE access_key = ? AND feed_id = ?"); |
| 473 | 483 | $sth->execute([$key, $feed]); |
| 474 | 484 | |
| 475 | - if ($row = $sth->fetch()) |
|
| 476 | - $owner_id = $row["owner_uid"]; |
|
| 485 | + if ($row = $sth->fetch()) { |
|
| 486 | + $owner_id = $row["owner_uid"]; |
|
| 487 | + } |
|
| 477 | 488 | } |
| 478 | 489 | |
| 479 | 490 | if ($owner_id) { |
@@ -683,8 +694,9 @@ discard block |
||
| 683 | 694 | // start an empty session to deliver login error message |
| 684 | 695 | @session_start(); |
| 685 | 696 | |
| 686 | - if (!isset($_SESSION["login_error_msg"])) |
|
| 687 | - $_SESSION["login_error_msg"] = __("Incorrect username or password"); |
|
| 697 | + if (!isset($_SESSION["login_error_msg"])) { |
|
| 698 | + $_SESSION["login_error_msg"] = __("Incorrect username or password"); |
|
| 699 | + } |
|
| 688 | 700 | |
| 689 | 701 | user_error("Failed login attempt for $login from {$_SERVER['REMOTE_ADDR']}", E_USER_WARNING); |
| 690 | 702 | } |
@@ -1007,7 +1019,9 @@ discard block |
||
| 1007 | 1019 | "subject" => __("[tt-rss] Password reset request"), |
| 1008 | 1020 | "message" => $message]); |
| 1009 | 1021 | |
| 1010 | - if (!$rc) print_error($mailer->error()); |
|
| 1022 | + if (!$rc) { |
|
| 1023 | + print_error($mailer->error()); |
|
| 1024 | + } |
|
| 1011 | 1025 | |
| 1012 | 1026 | $resetpass_token_full = time() . ":" . $resetpass_token; |
| 1013 | 1027 | |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | if ($error) { |
| 27 | 27 | foreach (libxml_get_errors() as $error) { |
| 28 | 28 | if ($error->level == LIBXML_ERR_FATAL) { |
| 29 | - if(!isset($this->error)) //currently only the first error is reported |
|
| 29 | + if (!isset($this->error)) //currently only the first error is reported |
|
| 30 | 30 | $this->error = $this->format_error($error); |
| 31 | 31 | $this->libxml_errors [] = $this->format_error($error); |
| 32 | 32 | } |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | $this->type = $this::FEED_ATOM; |
| 70 | 70 | break; |
| 71 | 71 | default: |
| 72 | - if( !isset($this->error) ){ |
|
| 72 | + if (!isset($this->error)) { |
|
| 73 | 73 | $this->error = "Unknown/unsupported feed type"; |
| 74 | 74 | } |
| 75 | 75 | return; |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | if ($this->link) $this->link = trim($this->link); |
| 167 | 167 | |
| 168 | 168 | } else { |
| 169 | - if( !isset($this->error) ){ |
|
| 169 | + if (!isset($this->error)) { |
|
| 170 | 170 | $this->error = "Unknown/unsupported feed type"; |
| 171 | 171 | } |
| 172 | 172 | return; |
@@ -26,8 +26,10 @@ discard block |
||
| 26 | 26 | if ($error) { |
| 27 | 27 | foreach (libxml_get_errors() as $error) { |
| 28 | 28 | if ($error->level == LIBXML_ERR_FATAL) { |
| 29 | - if(!isset($this->error)) //currently only the first error is reported |
|
| 29 | + if(!isset($this->error)) { |
|
| 30 | + //currently only the first error is reported |
|
| 30 | 31 | $this->error = $this->format_error($error); |
| 32 | + } |
|
| 31 | 33 | $this->libxml_errors [] = $this->format_error($error); |
| 32 | 34 | } |
| 33 | 35 | } |
@@ -81,8 +83,9 @@ discard block |
||
| 81 | 83 | |
| 82 | 84 | $title = $xpath->query("//atom:feed/atom:title")->item(0); |
| 83 | 85 | |
| 84 | - if (!$title) |
|
| 85 | - $title = $xpath->query("//atom03:feed/atom03:title")->item(0); |
|
| 86 | + if (!$title) { |
|
| 87 | + $title = $xpath->query("//atom03:feed/atom03:title")->item(0); |
|
| 88 | + } |
|
| 86 | 89 | |
| 87 | 90 | |
| 88 | 91 | if ($title) { |
@@ -91,14 +94,17 @@ discard block |
||
| 91 | 94 | |
| 92 | 95 | $link = $xpath->query("//atom:feed/atom:link[not(@rel)]")->item(0); |
| 93 | 96 | |
| 94 | - if (!$link) |
|
| 95 | - $link = $xpath->query("//atom:feed/atom:link[@rel='alternate']")->item(0); |
|
| 97 | + if (!$link) { |
|
| 98 | + $link = $xpath->query("//atom:feed/atom:link[@rel='alternate']")->item(0); |
|
| 99 | + } |
|
| 96 | 100 | |
| 97 | - if (!$link) |
|
| 98 | - $link = $xpath->query("//atom03:feed/atom03:link[not(@rel)]")->item(0); |
|
| 101 | + if (!$link) { |
|
| 102 | + $link = $xpath->query("//atom03:feed/atom03:link[not(@rel)]")->item(0); |
|
| 103 | + } |
|
| 99 | 104 | |
| 100 | - if (!$link) |
|
| 101 | - $link = $xpath->query("//atom03:feed/atom03:link[@rel='alternate']")->item(0); |
|
| 105 | + if (!$link) { |
|
| 106 | + $link = $xpath->query("//atom03:feed/atom03:link[@rel='alternate']")->item(0); |
|
| 107 | + } |
|
| 102 | 108 | |
| 103 | 109 | if ($link && $link->hasAttributes()) { |
| 104 | 110 | $this->link = $link->getAttribute("href"); |
@@ -106,8 +112,9 @@ discard block |
||
| 106 | 112 | |
| 107 | 113 | $articles = $xpath->query("//atom:entry"); |
| 108 | 114 | |
| 109 | - if (!$articles || $articles->length == 0) |
|
| 110 | - $articles = $xpath->query("//atom03:entry"); |
|
| 115 | + if (!$articles || $articles->length == 0) { |
|
| 116 | + $articles = $xpath->query("//atom03:entry"); |
|
| 117 | + } |
|
| 111 | 118 | |
| 112 | 119 | foreach ($articles as $article) { |
| 113 | 120 | array_push($this->items, new FeedItem_Atom($article, $this->doc, $this->xpath)); |
@@ -124,10 +131,11 @@ discard block |
||
| 124 | 131 | $link = $xpath->query("//channel/link")->item(0); |
| 125 | 132 | |
| 126 | 133 | if ($link) { |
| 127 | - if ($link->getAttribute("href")) |
|
| 128 | - $this->link = $link->getAttribute("href"); |
|
| 129 | - else if ($link->nodeValue) |
|
| 130 | - $this->link = $link->nodeValue; |
|
| 134 | + if ($link->getAttribute("href")) { |
|
| 135 | + $this->link = $link->getAttribute("href"); |
|
| 136 | + } else if ($link->nodeValue) { |
|
| 137 | + $this->link = $link->nodeValue; |
|
| 138 | + } |
|
| 131 | 139 | } |
| 132 | 140 | |
| 133 | 141 | $articles = $xpath->query("//channel/item"); |
@@ -162,8 +170,12 @@ discard block |
||
| 162 | 170 | |
| 163 | 171 | } |
| 164 | 172 | |
| 165 | - if ($this->title) $this->title = trim($this->title); |
|
| 166 | - if ($this->link) $this->link = trim($this->link); |
|
| 173 | + if ($this->title) { |
|
| 174 | + $this->title = trim($this->title); |
|
| 175 | + } |
|
| 176 | + if ($this->link) { |
|
| 177 | + $this->link = trim($this->link); |
|
| 178 | + } |
|
| 167 | 179 | |
| 168 | 180 | } else { |
| 169 | 181 | if( !isset($this->error) ){ |
@@ -202,36 +202,36 @@ discard block |
||
| 202 | 202 | $cat_filter = $tmp_line["cat_filter"]; |
| 203 | 203 | |
| 204 | 204 | if (!$tmp_line["match_on"]) { |
| 205 | - if ($cat_filter && $tmp_line["cat_id"] || $tmp_line["feed_id"]) { |
|
| 206 | - $tmp_line["feed"] = Feeds::getFeedTitle( |
|
| 207 | - $cat_filter ? $tmp_line["cat_id"] : $tmp_line["feed_id"], |
|
| 208 | - $cat_filter); |
|
| 209 | - } else { |
|
| 210 | - $tmp_line["feed"] = ""; |
|
| 211 | - } |
|
| 212 | - } else { |
|
| 213 | - $match = []; |
|
| 214 | - foreach (json_decode($tmp_line["match_on"], true) as $feed_id) { |
|
| 215 | - |
|
| 216 | - if (strpos($feed_id, "CAT:") === 0) { |
|
| 217 | - $feed_id = (int)substr($feed_id, 4); |
|
| 218 | - if ($feed_id) { |
|
| 219 | - array_push($match, [Feeds::getCategoryTitle($feed_id), true, false]); |
|
| 220 | - } else { |
|
| 221 | - array_push($match, [0, true, true]); |
|
| 222 | - } |
|
| 223 | - } else { |
|
| 224 | - if ($feed_id) { |
|
| 225 | - array_push($match, [Feeds::getFeedTitle((int)$feed_id), false, false]); |
|
| 226 | - } else { |
|
| 227 | - array_push($match, [0, false, true]); |
|
| 228 | - } |
|
| 229 | - } |
|
| 230 | - } |
|
| 231 | - |
|
| 232 | - $tmp_line["match"] = $match; |
|
| 233 | - unset($tmp_line["match_on"]); |
|
| 234 | - } |
|
| 205 | + if ($cat_filter && $tmp_line["cat_id"] || $tmp_line["feed_id"]) { |
|
| 206 | + $tmp_line["feed"] = Feeds::getFeedTitle( |
|
| 207 | + $cat_filter ? $tmp_line["cat_id"] : $tmp_line["feed_id"], |
|
| 208 | + $cat_filter); |
|
| 209 | + } else { |
|
| 210 | + $tmp_line["feed"] = ""; |
|
| 211 | + } |
|
| 212 | + } else { |
|
| 213 | + $match = []; |
|
| 214 | + foreach (json_decode($tmp_line["match_on"], true) as $feed_id) { |
|
| 215 | + |
|
| 216 | + if (strpos($feed_id, "CAT:") === 0) { |
|
| 217 | + $feed_id = (int)substr($feed_id, 4); |
|
| 218 | + if ($feed_id) { |
|
| 219 | + array_push($match, [Feeds::getCategoryTitle($feed_id), true, false]); |
|
| 220 | + } else { |
|
| 221 | + array_push($match, [0, true, true]); |
|
| 222 | + } |
|
| 223 | + } else { |
|
| 224 | + if ($feed_id) { |
|
| 225 | + array_push($match, [Feeds::getFeedTitle((int)$feed_id), false, false]); |
|
| 226 | + } else { |
|
| 227 | + array_push($match, [0, false, true]); |
|
| 228 | + } |
|
| 229 | + } |
|
| 230 | + } |
|
| 231 | + |
|
| 232 | + $tmp_line["match"] = $match; |
|
| 233 | + unset($tmp_line["match_on"]); |
|
| 234 | + } |
|
| 235 | 235 | |
| 236 | 236 | unset($tmp_line["feed_id"]); |
| 237 | 237 | unset($tmp_line["cat_id"]); |
@@ -403,28 +403,28 @@ discard block |
||
| 403 | 403 | |
| 404 | 404 | if ($rule["match"]) { |
| 405 | 405 | |
| 406 | - $match_on = []; |
|
| 406 | + $match_on = []; |
|
| 407 | 407 | |
| 408 | - foreach ($rule["match"] as $match) { |
|
| 409 | - list ($name, $is_cat, $is_id) = $match; |
|
| 408 | + foreach ($rule["match"] as $match) { |
|
| 409 | + list ($name, $is_cat, $is_id) = $match; |
|
| 410 | 410 | |
| 411 | - if ($is_id) { |
|
| 412 | - array_push($match_on, ($is_cat ? "CAT:" : "") . $name); |
|
| 413 | - } else { |
|
| 411 | + if ($is_id) { |
|
| 412 | + array_push($match_on, ($is_cat ? "CAT:" : "") . $name); |
|
| 413 | + } else { |
|
| 414 | 414 | |
| 415 | - if (!$is_cat) { |
|
| 416 | - $tsth = $this->pdo->prepare("SELECT id FROM ttrss_feeds |
|
| 415 | + if (!$is_cat) { |
|
| 416 | + $tsth = $this->pdo->prepare("SELECT id FROM ttrss_feeds |
|
| 417 | 417 | WHERE title = ? AND owner_uid = ?"); |
| 418 | 418 | |
| 419 | - $tsth->execute([$name, $_SESSION['uid']]); |
|
| 419 | + $tsth->execute([$name, $_SESSION['uid']]); |
|
| 420 | 420 | |
| 421 | - if ($row = $tsth->fetch()) { |
|
| 422 | - $match_id = $row['id']; |
|
| 421 | + if ($row = $tsth->fetch()) { |
|
| 422 | + $match_id = $row['id']; |
|
| 423 | 423 | |
| 424 | 424 | array_push($match_on, $match_id); |
| 425 | - } |
|
| 426 | - } else { |
|
| 427 | - $tsth = $this->pdo->prepare("SELECT id FROM ttrss_feed_categories |
|
| 425 | + } |
|
| 426 | + } else { |
|
| 427 | + $tsth = $this->pdo->prepare("SELECT id FROM ttrss_feed_categories |
|
| 428 | 428 | WHERE title = ? AND owner_uid = ?"); |
| 429 | 429 | $tsth->execute([$name, $_SESSION['uid']]); |
| 430 | 430 | |
@@ -433,33 +433,33 @@ discard block |
||
| 433 | 433 | |
| 434 | 434 | array_push($match_on, "CAT:$match_id"); |
| 435 | 435 | } |
| 436 | - } |
|
| 437 | - } |
|
| 438 | - } |
|
| 436 | + } |
|
| 437 | + } |
|
| 438 | + } |
|
| 439 | 439 | |
| 440 | - $reg_exp = $rule["reg_exp"]; |
|
| 441 | - $filter_type = (int)$rule["filter_type"]; |
|
| 442 | - $inverse = bool_to_sql_bool($rule["inverse"]); |
|
| 443 | - $match_on = json_encode($match_on); |
|
| 440 | + $reg_exp = $rule["reg_exp"]; |
|
| 441 | + $filter_type = (int)$rule["filter_type"]; |
|
| 442 | + $inverse = bool_to_sql_bool($rule["inverse"]); |
|
| 443 | + $match_on = json_encode($match_on); |
|
| 444 | 444 | |
| 445 | - $usth = $this->pdo->prepare("INSERT INTO ttrss_filters2_rules |
|
| 445 | + $usth = $this->pdo->prepare("INSERT INTO ttrss_filters2_rules |
|
| 446 | 446 | (feed_id,cat_id,match_on,filter_id,filter_type,reg_exp,cat_filter,inverse) |
| 447 | 447 | VALUES |
| 448 | 448 | (NULL, NULL, ?, ?, ?, ?, false, ?)"); |
| 449 | - $usth->execute([$match_on, $filter_id, $filter_type, $reg_exp, $inverse]); |
|
| 449 | + $usth->execute([$match_on, $filter_id, $filter_type, $reg_exp, $inverse]); |
|
| 450 | 450 | |
| 451 | - } else { |
|
| 451 | + } else { |
|
| 452 | 452 | |
| 453 | - if (!$rule["cat_filter"]) { |
|
| 454 | - $tsth = $this->pdo->prepare("SELECT id FROM ttrss_feeds |
|
| 453 | + if (!$rule["cat_filter"]) { |
|
| 454 | + $tsth = $this->pdo->prepare("SELECT id FROM ttrss_feeds |
|
| 455 | 455 | WHERE title = ? AND owner_uid = ?"); |
| 456 | 456 | |
| 457 | - $tsth->execute([$rule['feed'], $_SESSION['uid']]); |
|
| 457 | + $tsth->execute([$rule['feed'], $_SESSION['uid']]); |
|
| 458 | 458 | |
| 459 | - if ($row = $tsth->fetch()) { |
|
| 460 | - $feed_id = $row['id']; |
|
| 461 | - } |
|
| 462 | - } else { |
|
| 459 | + if ($row = $tsth->fetch()) { |
|
| 460 | + $feed_id = $row['id']; |
|
| 461 | + } |
|
| 462 | + } else { |
|
| 463 | 463 | $tsth = $this->pdo->prepare("SELECT id FROM ttrss_feed_categories |
| 464 | 464 | WHERE title = ? AND owner_uid = ?"); |
| 465 | 465 | |
@@ -468,19 +468,19 @@ discard block |
||
| 468 | 468 | if ($row = $tsth->fetch()) { |
| 469 | 469 | $feed_id = $row['id']; |
| 470 | 470 | } |
| 471 | - } |
|
| 471 | + } |
|
| 472 | 472 | |
| 473 | - $cat_filter = bool_to_sql_bool($rule["cat_filter"]); |
|
| 474 | - $reg_exp = $rule["reg_exp"]; |
|
| 475 | - $filter_type = (int)$rule["filter_type"]; |
|
| 476 | - $inverse = bool_to_sql_bool($rule["inverse"]); |
|
| 473 | + $cat_filter = bool_to_sql_bool($rule["cat_filter"]); |
|
| 474 | + $reg_exp = $rule["reg_exp"]; |
|
| 475 | + $filter_type = (int)$rule["filter_type"]; |
|
| 476 | + $inverse = bool_to_sql_bool($rule["inverse"]); |
|
| 477 | 477 | |
| 478 | - $usth = $this->pdo->prepare("INSERT INTO ttrss_filters2_rules |
|
| 478 | + $usth = $this->pdo->prepare("INSERT INTO ttrss_filters2_rules |
|
| 479 | 479 | (feed_id,cat_id,filter_id,filter_type,reg_exp,cat_filter,inverse) |
| 480 | 480 | VALUES |
| 481 | 481 | (?, ?, ?, ?, ?, ?, ?)"); |
| 482 | - $usth->execute([$feed_id, $cat_id, $filter_id, $filter_type, $reg_exp, $cat_filter, $inverse]); |
|
| 483 | - } |
|
| 482 | + $usth->execute([$feed_id, $cat_id, $filter_id, $filter_type, $reg_exp, $cat_filter, $inverse]); |
|
| 483 | + } |
|
| 484 | 484 | } |
| 485 | 485 | |
| 486 | 486 | foreach ($filter["actions"] as $action) { |
@@ -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 | - static function opml_publish_url(){ |
|
| 626 | + 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; |
@@ -52,10 +52,11 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | $cat_id = (int) $cat_id; |
| 54 | 54 | |
| 55 | - if ($hide_private_feeds) |
|
| 56 | - $hide_qpart = "(private IS false AND auth_login = '' AND auth_pass = '')"; |
|
| 57 | - else |
|
| 58 | - $hide_qpart = "true"; |
|
| 55 | + if ($hide_private_feeds) { |
|
| 56 | + $hide_qpart = "(private IS false AND auth_login = '' AND auth_pass = '')"; |
|
| 57 | + } else { |
|
| 58 | + $hide_qpart = "true"; |
|
| 59 | + } |
|
| 59 | 60 | |
| 60 | 61 | $out = ""; |
| 61 | 62 | |
@@ -77,7 +78,9 @@ discard block |
||
| 77 | 78 | $cat_title = ""; |
| 78 | 79 | } |
| 79 | 80 | |
| 80 | - if ($cat_title) $out .= "<outline text=\"$cat_title\" $ttrss_specific_qpart>\n"; |
|
| 81 | + if ($cat_title) { |
|
| 82 | + $out .= "<outline text=\"$cat_title\" $ttrss_specific_qpart>\n"; |
|
| 83 | + } |
|
| 81 | 84 | |
| 82 | 85 | $sth = $this->pdo->prepare("SELECT id,title |
| 83 | 86 | FROM ttrss_feed_categories WHERE |
@@ -120,13 +123,17 @@ discard block |
||
| 120 | 123 | $out .= "<outline type=\"rss\" text=\"$title\" xmlUrl=\"$url\" $ttrss_specific_qpart $html_url_qpart/>\n"; |
| 121 | 124 | } |
| 122 | 125 | |
| 123 | - if ($cat_title) $out .= "</outline>\n"; |
|
| 126 | + if ($cat_title) { |
|
| 127 | + $out .= "</outline>\n"; |
|
| 128 | + } |
|
| 124 | 129 | |
| 125 | 130 | return $out; |
| 126 | 131 | } |
| 127 | 132 | |
| 128 | 133 | function opml_export($name, $owner_uid, $hide_private_feeds = false, $include_settings = true) { |
| 129 | - if (!$owner_uid) return; |
|
| 134 | + if (!$owner_uid) { |
|
| 135 | + return; |
|
| 136 | + } |
|
| 130 | 137 | |
| 131 | 138 | if (!isset($_REQUEST["debug"])) { |
| 132 | 139 | header("Content-type: application/xml+opml"); |
@@ -275,8 +282,9 @@ discard block |
||
| 275 | 282 | |
| 276 | 283 | // cleanup empty categories |
| 277 | 284 | foreach ($outlines as $node) { |
| 278 | - if ($node->getElementsByTagName('outline')->length == 0) |
|
| 279 | - $node->parentNode->removeChild($node); |
|
| 285 | + if ($node->getElementsByTagName('outline')->length == 0) { |
|
| 286 | + $node->parentNode->removeChild($node); |
|
| 287 | + } |
|
| 280 | 288 | } |
| 281 | 289 | |
| 282 | 290 | $res = $doc->saveXML(); |
@@ -297,10 +305,14 @@ discard block |
||
| 297 | 305 | $attrs = $node->attributes; |
| 298 | 306 | |
| 299 | 307 | $feed_title = mb_substr($attrs->getNamedItem('text')->nodeValue, 0, 250); |
| 300 | - if (!$feed_title) $feed_title = mb_substr($attrs->getNamedItem('title')->nodeValue, 0, 250); |
|
| 308 | + if (!$feed_title) { |
|
| 309 | + $feed_title = mb_substr($attrs->getNamedItem('title')->nodeValue, 0, 250); |
|
| 310 | + } |
|
| 301 | 311 | |
| 302 | 312 | $feed_url = $attrs->getNamedItem('xmlUrl')->nodeValue; |
| 303 | - if (!$feed_url) $feed_url = $attrs->getNamedItem('xmlURL')->nodeValue; |
|
| 313 | + if (!$feed_url) { |
|
| 314 | + $feed_url = $attrs->getNamedItem('xmlURL')->nodeValue; |
|
| 315 | + } |
|
| 304 | 316 | |
| 305 | 317 | $site_url = mb_substr($attrs->getNamedItem('htmlUrl')->nodeValue, 0, 250); |
| 306 | 318 | |
@@ -309,19 +321,27 @@ discard block |
||
| 309 | 321 | feed_url = ? AND owner_uid = ?"); |
| 310 | 322 | $sth->execute([$feed_url, $owner_uid]); |
| 311 | 323 | |
| 312 | - if (!$feed_title) $feed_title = '[Unknown]'; |
|
| 324 | + if (!$feed_title) { |
|
| 325 | + $feed_title = '[Unknown]'; |
|
| 326 | + } |
|
| 313 | 327 | |
| 314 | 328 | if (!$sth->fetch()) { |
| 315 | 329 | #$this->opml_notice("[FEED] [$feed_title/$feed_url] dst_CAT=$cat_id"); |
| 316 | 330 | $this->opml_notice(T_sprintf("Adding feed: %s", $feed_title == '[Unknown]' ? $feed_url : $feed_title)); |
| 317 | 331 | |
| 318 | - if (!$cat_id) $cat_id = null; |
|
| 332 | + if (!$cat_id) { |
|
| 333 | + $cat_id = null; |
|
| 334 | + } |
|
| 319 | 335 | |
| 320 | 336 | $update_interval = (int) $attrs->getNamedItem('ttrssUpdateInterval')->nodeValue; |
| 321 | - if (!$update_interval) $update_interval = 0; |
|
| 337 | + if (!$update_interval) { |
|
| 338 | + $update_interval = 0; |
|
| 339 | + } |
|
| 322 | 340 | |
| 323 | 341 | $order_id = (int) $attrs->getNamedItem('ttrssSortOrder')->nodeValue; |
| 324 | - if (!$order_id) $order_id = 0; |
|
| 342 | + if (!$order_id) { |
|
| 343 | + $order_id = 0; |
|
| 344 | + } |
|
| 325 | 345 | |
| 326 | 346 | $sth = $this->pdo->prepare("INSERT INTO ttrss_feeds |
| 327 | 347 | (title, feed_url, owner_uid, cat_id, site_url, order_id, update_interval) VALUES |
@@ -505,15 +525,18 @@ discard block |
||
| 505 | 525 | if ($root_node) { |
| 506 | 526 | $cat_title = mb_substr($root_node->attributes->getNamedItem('text')->nodeValue, 0, 250); |
| 507 | 527 | |
| 508 | - if (!$cat_title) |
|
| 509 | - $cat_title = mb_substr($root_node->attributes->getNamedItem('title')->nodeValue, 0, 250); |
|
| 528 | + if (!$cat_title) { |
|
| 529 | + $cat_title = mb_substr($root_node->attributes->getNamedItem('title')->nodeValue, 0, 250); |
|
| 530 | + } |
|
| 510 | 531 | |
| 511 | 532 | if (!in_array($cat_title, array("tt-rss-filters", "tt-rss-labels", "tt-rss-prefs"))) { |
| 512 | 533 | $cat_id = $this->get_feed_category($cat_title, $parent_id); |
| 513 | 534 | |
| 514 | 535 | if ($cat_id === false) { |
| 515 | 536 | $order_id = (int) $root_node->attributes->getNamedItem('ttrssSortOrder')->nodeValue; |
| 516 | - if (!$order_id) $order_id = 0; |
|
| 537 | + if (!$order_id) { |
|
| 538 | + $order_id = 0; |
|
| 539 | + } |
|
| 517 | 540 | |
| 518 | 541 | Feeds::add_feed_category($cat_title, $parent_id, $order_id); |
| 519 | 542 | $cat_id = $this->get_feed_category($cat_title, $parent_id); |
@@ -540,8 +563,9 @@ discard block |
||
| 540 | 563 | $attrs = $node->attributes; |
| 541 | 564 | $node_cat_title = $attrs->getNamedItem('text')->nodeValue; |
| 542 | 565 | |
| 543 | - if (!$node_cat_title) |
|
| 544 | - $node_cat_title = $attrs->getNamedItem('title')->nodeValue; |
|
| 566 | + if (!$node_cat_title) { |
|
| 567 | + $node_cat_title = $attrs->getNamedItem('title')->nodeValue; |
|
| 568 | + } |
|
| 545 | 569 | |
| 546 | 570 | $node_feed_url = $attrs->getNamedItem('xmlUrl')->nodeValue; |
| 547 | 571 | |
@@ -574,7 +598,9 @@ discard block |
||
| 574 | 598 | } |
| 575 | 599 | |
| 576 | 600 | function opml_import($owner_uid) { |
| 577 | - if (!$owner_uid) return; |
|
| 601 | + if (!$owner_uid) { |
|
| 602 | + return; |
|
| 603 | + } |
|
| 578 | 604 | |
| 579 | 605 | $doc = false; |
| 580 | 606 | |
@@ -95,10 +95,11 @@ discard block |
||
| 95 | 95 | |
| 96 | 96 | $count = getFeedUnread($i); |
| 97 | 97 | |
| 98 | - if ($i == 0 || $i == -1 || $i == -2) |
|
| 99 | - $auxctr = Feeds::getFeedArticles($i, false); |
|
| 100 | - else |
|
| 101 | - $auxctr = 0; |
|
| 98 | + if ($i == 0 || $i == -1 || $i == -2) { |
|
| 99 | + $auxctr = Feeds::getFeedArticles($i, false); |
|
| 100 | + } else { |
|
| 101 | + $auxctr = 0; |
|
| 102 | + } |
|
| 102 | 103 | |
| 103 | 104 | $cv = array("id" => $i, |
| 104 | 105 | "counter" => (int) $count, |
@@ -117,8 +118,9 @@ discard block |
||
| 117 | 118 | $cv = array("id" => PluginHost::pfeed_to_feed_id($feed['id']), |
| 118 | 119 | "counter" => $feed['sender']->get_unread($feed['id'])); |
| 119 | 120 | |
| 120 | - if (method_exists($feed['sender'], 'get_total')) |
|
| 121 | - $cv["auxcounter"] = $feed['sender']->get_total($feed['id']); |
|
| 121 | + if (method_exists($feed['sender'], 'get_total')) { |
|
| 122 | + $cv["auxcounter"] = $feed['sender']->get_total($feed['id']); |
|
| 123 | + } |
|
| 122 | 124 | |
| 123 | 125 | array_push($ret_arr, $cv); |
| 124 | 126 | } |
@@ -150,8 +152,9 @@ discard block |
||
| 150 | 152 | "counter" => (int) $line["unread"], |
| 151 | 153 | "auxcounter" => (int) $line["total"]); |
| 152 | 154 | |
| 153 | - if ($descriptions) |
|
| 154 | - $cv["description"] = $line["caption"]; |
|
| 155 | + if ($descriptions) { |
|
| 156 | + $cv["description"] = $line["caption"]; |
|
| 157 | + } |
|
| 155 | 158 | |
| 156 | 159 | array_push($ret_arr, $cv); |
| 157 | 160 | } |
@@ -189,22 +192,25 @@ discard block |
||
| 189 | 192 | $has_img = false; |
| 190 | 193 | } |
| 191 | 194 | |
| 192 | - if (date('Y') - date('Y', strtotime($line['last_updated'])) > 2) |
|
| 193 | - $last_updated = ''; |
|
| 195 | + if (date('Y') - date('Y', strtotime($line['last_updated'])) > 2) { |
|
| 196 | + $last_updated = ''; |
|
| 197 | + } |
|
| 194 | 198 | |
| 195 | 199 | $cv = array("id" => $id, |
| 196 | 200 | "updated" => $last_updated, |
| 197 | 201 | "counter" => (int) $count, |
| 198 | 202 | "has_img" => (int) $has_img); |
| 199 | 203 | |
| 200 | - if ($last_error) |
|
| 201 | - $cv["error"] = $last_error; |
|
| 204 | + if ($last_error) { |
|
| 205 | + $cv["error"] = $last_error; |
|
| 206 | + } |
|
| 202 | 207 | |
| 203 | 208 | // if (get_pref('EXTENDED_FEEDLIST')) |
| 204 | 209 | // $cv["xmsg"] = getFeedArticles($id)." ".__("total"); |
| 205 | 210 | |
| 206 | - if ($active_feed && $id == $active_feed) |
|
| 207 | - $cv["title"] = truncate_string($line["title"], 30); |
|
| 211 | + if ($active_feed && $id == $active_feed) { |
|
| 212 | + $cv["title"] = truncate_string($line["title"], 30); |
|
| 213 | + } |
|
| 208 | 214 | |
| 209 | 215 | array_push($ret_arr, $cv); |
| 210 | 216 | |
@@ -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']; |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | |
| 140 | 140 | $sth = $pdo->prepare("SELECT int_id FROM ttrss_user_entries WHERE |
| 141 | 141 | ref_id = ? AND owner_uid = ? LIMIT 1"); |
| 142 | - $sth->execute([$ref_id, $owner_uid]); |
|
| 142 | + $sth->execute([$ref_id, $owner_uid]); |
|
| 143 | 143 | |
| 144 | 144 | if ($row = $sth->fetch()) { |
| 145 | 145 | $int_id = $row['int_id']; |
@@ -678,22 +678,22 @@ discard block |
||
| 678 | 678 | |
| 679 | 679 | static function purge_orphans() { |
| 680 | 680 | |
| 681 | - // purge orphaned posts in main content table |
|
| 681 | + // purge orphaned posts in main content table |
|
| 682 | 682 | |
| 683 | - if (DB_TYPE == "mysql") |
|
| 684 | - $limit_qpart = "LIMIT 5000"; |
|
| 685 | - else |
|
| 686 | - $limit_qpart = ""; |
|
| 683 | + if (DB_TYPE == "mysql") |
|
| 684 | + $limit_qpart = "LIMIT 5000"; |
|
| 685 | + else |
|
| 686 | + $limit_qpart = ""; |
|
| 687 | 687 | |
| 688 | - $pdo = Db::pdo(); |
|
| 689 | - $res = $pdo->query("DELETE FROM ttrss_entries WHERE |
|
| 688 | + $pdo = Db::pdo(); |
|
| 689 | + $res = $pdo->query("DELETE FROM ttrss_entries WHERE |
|
| 690 | 690 | NOT EXISTS (SELECT ref_id FROM ttrss_user_entries WHERE ref_id = id) $limit_qpart"); |
| 691 | 691 | |
| 692 | - if (Debug::enabled()) { |
|
| 693 | - $rows = $res->rowCount(); |
|
| 694 | - Debug::log("Purged $rows orphaned posts."); |
|
| 695 | - } |
|
| 696 | - } |
|
| 692 | + if (Debug::enabled()) { |
|
| 693 | + $rows = $res->rowCount(); |
|
| 694 | + Debug::log("Purged $rows orphaned posts."); |
|
| 695 | + } |
|
| 696 | + } |
|
| 697 | 697 | |
| 698 | 698 | static function catchupArticlesById($ids, $cmode, $owner_uid = false) { |
| 699 | 699 | |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | static function create_published_article($title, $url, $content, $labels_str, |
| 94 | 94 | $owner_uid) { |
| 95 | 95 | |
| 96 | - $guid = 'SHA1:' . sha1("ttshared:" . $url . $owner_uid); // include owner_uid to prevent global GUID clash |
|
| 96 | + $guid = 'SHA1:'.sha1("ttshared:".$url.$owner_uid); // include owner_uid to prevent global GUID clash |
|
| 97 | 97 | |
| 98 | 98 | if (!$content) { |
| 99 | 99 | $pluginhost = new PluginHost(); |
@@ -148,12 +148,12 @@ discard block |
||
| 148 | 148 | content = ?, content_hash = ? WHERE id = ?"); |
| 149 | 149 | $sth->execute([$content, $content_hash, $ref_id]); |
| 150 | 150 | |
| 151 | - if (DB_TYPE == "pgsql"){ |
|
| 151 | + if (DB_TYPE == "pgsql") { |
|
| 152 | 152 | $sth = $pdo->prepare("UPDATE ttrss_entries |
| 153 | 153 | SET tsvector_combined = to_tsvector( :ts_content) |
| 154 | 154 | WHERE id = :id"); |
| 155 | 155 | $params = [ |
| 156 | - ":ts_content" => mb_substr(strip_tags($content ), 0, 900000), |
|
| 156 | + ":ts_content" => mb_substr(strip_tags($content), 0, 900000), |
|
| 157 | 157 | ":id" => $ref_id]; |
| 158 | 158 | $sth->execute($params); |
| 159 | 159 | } |
@@ -193,12 +193,12 @@ discard block |
||
| 193 | 193 | |
| 194 | 194 | if ($row = $sth->fetch()) { |
| 195 | 195 | $ref_id = $row["id"]; |
| 196 | - if (DB_TYPE == "pgsql"){ |
|
| 196 | + if (DB_TYPE == "pgsql") { |
|
| 197 | 197 | $sth = $pdo->prepare("UPDATE ttrss_entries |
| 198 | 198 | SET tsvector_combined = to_tsvector( :ts_content) |
| 199 | 199 | WHERE id = :id"); |
| 200 | 200 | $params = [ |
| 201 | - ":ts_content" => mb_substr(strip_tags($content ), 0, 900000), |
|
| 201 | + ":ts_content" => mb_substr(strip_tags($content), 0, 900000), |
|
| 202 | 202 | ":id" => $ref_id]; |
| 203 | 203 | $sth->execute($params); |
| 204 | 204 | } |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | print_hidden("op", "article"); |
| 237 | 237 | print_hidden("method", "setArticleTags"); |
| 238 | 238 | |
| 239 | - print "<header class='horizontal'>" . __("Tags for this article (separated by commas):")."</header>"; |
|
| 239 | + print "<header class='horizontal'>".__("Tags for this article (separated by commas):")."</header>"; |
|
| 240 | 240 | |
| 241 | 241 | print "<section>"; |
| 242 | 242 | print "<textarea dojoType='dijit.form.SimpleTextarea' rows='4' |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | |
| 258 | 258 | function setScore() { |
| 259 | 259 | $ids = explode(",", clean($_REQUEST['id'])); |
| 260 | - $score = (int)clean($_REQUEST['score']); |
|
| 260 | + $score = (int) clean($_REQUEST['score']); |
|
| 261 | 261 | |
| 262 | 262 | $ids_qmarks = arr_qmarks($ids); |
| 263 | 263 | |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | |
| 267 | 267 | $sth->execute(array_merge([$score], $ids, [$_SESSION['uid']])); |
| 268 | 268 | |
| 269 | - print json_encode(["id" => $ids, "score" => (int)$score]); |
|
| 269 | + print json_encode(["id" => $ids, "score" => (int) $score]); |
|
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | function getScore() { |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | |
| 279 | 279 | $score = $row['score']; |
| 280 | 280 | |
| 281 | - print json_encode(["id" => $id, "score" => (int)$score]); |
|
| 281 | + print json_encode(["id" => $id, "score" => (int) $score]); |
|
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | |
| 357 | 357 | print "<ul>"; |
| 358 | 358 | while ($line = $sth->fetch()) { |
| 359 | - print "<li>" . $line["tag_name"] . "</li>"; |
|
| 359 | + print "<li>".$line["tag_name"]."</li>"; |
|
| 360 | 360 | } |
| 361 | 361 | print "</ul>"; |
| 362 | 362 | } |
@@ -495,21 +495,21 @@ discard block |
||
| 495 | 495 | if (!$hide_images) { |
| 496 | 496 | $encsize = ''; |
| 497 | 497 | if ($entry['height'] > 0) |
| 498 | - $encsize .= ' height="' . intval($entry['height']) . '"'; |
|
| 498 | + $encsize .= ' height="'.intval($entry['height']).'"'; |
|
| 499 | 499 | if ($entry['width'] > 0) |
| 500 | - $encsize .= ' width="' . intval($entry['width']) . '"'; |
|
| 500 | + $encsize .= ' width="'.intval($entry['width']).'"'; |
|
| 501 | 501 | $rv .= "<p><img |
| 502 | 502 | alt=\"".htmlspecialchars($entry["filename"])."\" |
| 503 | - src=\"" .htmlspecialchars($entry["url"]) . "\" |
|
| 504 | - " . $encsize . " /></p>"; |
|
| 503 | + src=\"" .htmlspecialchars($entry["url"])."\" |
|
| 504 | + " . $encsize." /></p>"; |
|
| 505 | 505 | } else { |
| 506 | 506 | $rv .= "<p><a target=\"_blank\" rel=\"noopener noreferrer\" |
| 507 | 507 | href=\"".htmlspecialchars($entry["url"])."\" |
| 508 | - >" .htmlspecialchars($entry["url"]) . "</a></p>"; |
|
| 508 | + >" .htmlspecialchars($entry["url"])."</a></p>"; |
|
| 509 | 509 | } |
| 510 | 510 | |
| 511 | 511 | if ($entry['title']) { |
| 512 | - $rv.= "<div class=\"enclosure_title\">${entry['title']}</div>"; |
|
| 512 | + $rv .= "<div class=\"enclosure_title\">${entry['title']}</div>"; |
|
| 513 | 513 | } |
| 514 | 514 | } |
| 515 | 515 | } |
@@ -524,13 +524,13 @@ discard block |
||
| 524 | 524 | } |
| 525 | 525 | |
| 526 | 526 | $rv .= "<div class=\"attachments\" dojoType=\"fox.form.DropDownButton\">". |
| 527 | - "<span>" . __('Attachments')."</span>"; |
|
| 527 | + "<span>".__('Attachments')."</span>"; |
|
| 528 | 528 | |
| 529 | 529 | $rv .= "<div dojoType=\"dijit.Menu\" style=\"display: none;\">"; |
| 530 | 530 | |
| 531 | 531 | foreach ($entries as $entry) { |
| 532 | 532 | if ($entry["title"]) |
| 533 | - $title = " — " . truncate_string($entry["title"], 30); |
|
| 533 | + $title = " — ".truncate_string($entry["title"], 30); |
|
| 534 | 534 | else |
| 535 | 535 | $title = ""; |
| 536 | 536 | |
@@ -540,7 +540,7 @@ discard block |
||
| 540 | 540 | $filename = ""; |
| 541 | 541 | |
| 542 | 542 | $rv .= "<div onclick='popupOpenUrl(\"".htmlspecialchars($entry["url"])."\")' |
| 543 | - dojoType=\"dijit.MenuItem\">".$filename . $title."</div>"; |
|
| 543 | + dojoType=\"dijit.MenuItem\">".$filename.$title."</div>"; |
|
| 544 | 544 | |
| 545 | 545 | }; |
| 546 | 546 | |
@@ -609,10 +609,10 @@ discard block |
||
| 609 | 609 | $tags_str = ""; |
| 610 | 610 | |
| 611 | 611 | for ($i = 0; $i < $maxtags; $i++) { |
| 612 | - $tags_str .= "<a class=\"tag\" href=\"#\" onclick=\"Feeds.open({feed:'".$tags[$i]."'})\">" . $tags[$i] . "</a>, "; |
|
| 612 | + $tags_str .= "<a class=\"tag\" href=\"#\" onclick=\"Feeds.open({feed:'".$tags[$i]."'})\">".$tags[$i]."</a>, "; |
|
| 613 | 613 | } |
| 614 | 614 | |
| 615 | - $tags_str = mb_substr($tags_str, 0, mb_strlen($tags_str)-2); |
|
| 615 | + $tags_str = mb_substr($tags_str, 0, mb_strlen($tags_str) - 2); |
|
| 616 | 616 | |
| 617 | 617 | if (count($tags) > $maxtags) |
| 618 | 618 | $tags_str .= ", …"; |
@@ -804,7 +804,7 @@ discard block |
||
| 804 | 804 | if (!$article_image && !$article_stream) { |
| 805 | 805 | $tmpdoc = new DOMDocument(); |
| 806 | 806 | |
| 807 | - if (@$tmpdoc->loadHTML('<?xml encoding="UTF-8">' . mb_substr($content, 0, 131070))) { |
|
| 807 | + if (@$tmpdoc->loadHTML('<?xml encoding="UTF-8">'.mb_substr($content, 0, 131070))) { |
|
| 808 | 808 | $tmpxpath = new DOMXPath($tmpdoc); |
| 809 | 809 | $elems = $tmpxpath->query('(//img[@src]|//video[@poster]|//iframe[contains(@src , "youtube.com/embed/")])'); |
| 810 | 810 | |
@@ -812,8 +812,8 @@ discard block |
||
| 812 | 812 | if ($e->nodeName == "iframe") { |
| 813 | 813 | $matches = []; |
| 814 | 814 | if (preg_match("/\/embed\/([\w-]+)/", $e->getAttribute("src"), $matches)) { |
| 815 | - $article_image = "https://img.youtube.com/vi/" . $matches[1] . "/hqdefault.jpg"; |
|
| 816 | - $article_stream = "https://youtu.be/" . $matches[1]; |
|
| 815 | + $article_image = "https://img.youtube.com/vi/".$matches[1]."/hqdefault.jpg"; |
|
| 816 | + $article_stream = "https://youtu.be/".$matches[1]; |
|
| 817 | 817 | break; |
| 818 | 818 | } |
| 819 | 819 | } else if ($e->nodeName == "video") { |
@@ -120,10 +120,16 @@ discard block |
||
| 120 | 120 | |
| 121 | 121 | $rc = false; |
| 122 | 122 | |
| 123 | - if (!$title) $title = $url; |
|
| 124 | - if (!$title && !$url) return false; |
|
| 123 | + if (!$title) { |
|
| 124 | + $title = $url; |
|
| 125 | + } |
|
| 126 | + if (!$title && !$url) { |
|
| 127 | + return false; |
|
| 128 | + } |
|
| 125 | 129 | |
| 126 | - if (filter_var($url, FILTER_VALIDATE_URL) === FALSE) return false; |
|
| 130 | + if (filter_var($url, FILTER_VALIDATE_URL) === FALSE) { |
|
| 131 | + return false; |
|
| 132 | + } |
|
| 127 | 133 | |
| 128 | 134 | $pdo = Db::pdo(); |
| 129 | 135 | |
@@ -334,7 +340,9 @@ discard block |
||
| 334 | 340 | $tags_str = $this->format_tags_string($tags); |
| 335 | 341 | $tags_str_full = join(", ", $tags); |
| 336 | 342 | |
| 337 | - if (!$tags_str_full) $tags_str_full = __("no tags"); |
|
| 343 | + if (!$tags_str_full) { |
|
| 344 | + $tags_str_full = __("no tags"); |
|
| 345 | + } |
|
| 338 | 346 | |
| 339 | 347 | print json_encode([ |
| 340 | 348 | "id" => (int) $id, |
@@ -383,10 +391,11 @@ discard block |
||
| 383 | 391 | |
| 384 | 392 | foreach ($ids as $id) { |
| 385 | 393 | |
| 386 | - if ($assign) |
|
| 387 | - Labels::add_article($id, $label, $_SESSION["uid"]); |
|
| 388 | - else |
|
| 389 | - Labels::remove_article($id, $label, $_SESSION["uid"]); |
|
| 394 | + if ($assign) { |
|
| 395 | + Labels::add_article($id, $label, $_SESSION["uid"]); |
|
| 396 | + } else { |
|
| 397 | + Labels::remove_article($id, $label, $_SESSION["uid"]); |
|
| 398 | + } |
|
| 390 | 399 | |
| 391 | 400 | $labels = $this->get_article_labels($id, $_SESSION["uid"]); |
| 392 | 401 | |
@@ -447,14 +456,18 @@ discard block |
||
| 447 | 456 | $width = $line["width"]; |
| 448 | 457 | $height = $line["height"]; |
| 449 | 458 | |
| 450 | - if (!$ctype) $ctype = __("unknown type"); |
|
| 459 | + if (!$ctype) { |
|
| 460 | + $ctype = __("unknown type"); |
|
| 461 | + } |
|
| 451 | 462 | |
| 452 | 463 | //$filename = substr($url, strrpos($url, "/")+1); |
| 453 | 464 | $filename = basename($url); |
| 454 | 465 | |
| 455 | 466 | $player = format_inline_player($url, $ctype); |
| 456 | 467 | |
| 457 | - if ($player) array_push($entries_inline, $player); |
|
| 468 | + if ($player) { |
|
| 469 | + array_push($entries_inline, $player); |
|
| 470 | + } |
|
| 458 | 471 | |
| 459 | 472 | # $entry .= " <a target=\"_blank\" href=\"" . htmlspecialchars($url) . "\" rel=\"noopener noreferrer\">" . |
| 460 | 473 | # $filename . " (" . $ctype . ")" . "</a>"; |
@@ -482,8 +495,9 @@ discard block |
||
| 482 | 495 | |
| 483 | 496 | foreach ($entries as $entry) { |
| 484 | 497 | |
| 485 | - foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_RENDER_ENCLOSURE) as $plugin) |
|
| 486 | - $retval = $plugin->hook_render_enclosure($entry, $hide_images); |
|
| 498 | + foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_RENDER_ENCLOSURE) as $plugin) { |
|
| 499 | + $retval = $plugin->hook_render_enclosure($entry, $hide_images); |
|
| 500 | + } |
|
| 487 | 501 | |
| 488 | 502 | |
| 489 | 503 | if ($retval) { |
@@ -494,10 +508,12 @@ discard block |
||
| 494 | 508 | |
| 495 | 509 | if (!$hide_images) { |
| 496 | 510 | $encsize = ''; |
| 497 | - if ($entry['height'] > 0) |
|
| 498 | - $encsize .= ' height="' . intval($entry['height']) . '"'; |
|
| 499 | - if ($entry['width'] > 0) |
|
| 500 | - $encsize .= ' width="' . intval($entry['width']) . '"'; |
|
| 511 | + if ($entry['height'] > 0) { |
|
| 512 | + $encsize .= ' height="' . intval($entry['height']) . '"'; |
|
| 513 | + } |
|
| 514 | + if ($entry['width'] > 0) { |
|
| 515 | + $encsize .= ' width="' . intval($entry['width']) . '"'; |
|
| 516 | + } |
|
| 501 | 517 | $rv .= "<p><img |
| 502 | 518 | alt=\"".htmlspecialchars($entry["filename"])."\" |
| 503 | 519 | src=\"" .htmlspecialchars($entry["url"]) . "\" |
@@ -529,15 +545,17 @@ discard block |
||
| 529 | 545 | $rv .= "<div dojoType=\"dijit.Menu\" style=\"display: none;\">"; |
| 530 | 546 | |
| 531 | 547 | foreach ($entries as $entry) { |
| 532 | - if ($entry["title"]) |
|
| 533 | - $title = " — " . truncate_string($entry["title"], 30); |
|
| 534 | - else |
|
| 535 | - $title = ""; |
|
| 548 | + if ($entry["title"]) { |
|
| 549 | + $title = " — " . truncate_string($entry["title"], 30); |
|
| 550 | + } else { |
|
| 551 | + $title = ""; |
|
| 552 | + } |
|
| 536 | 553 | |
| 537 | - if ($entry["filename"]) |
|
| 538 | - $filename = truncate_middle(htmlspecialchars($entry["filename"]), 60); |
|
| 539 | - else |
|
| 540 | - $filename = ""; |
|
| 554 | + if ($entry["filename"]) { |
|
| 555 | + $filename = truncate_middle(htmlspecialchars($entry["filename"]), 60); |
|
| 556 | + } else { |
|
| 557 | + $filename = ""; |
|
| 558 | + } |
|
| 541 | 559 | |
| 542 | 560 | $rv .= "<div onclick='popupOpenUrl(\"".htmlspecialchars($entry["url"])."\")' |
| 543 | 561 | dojoType=\"dijit.MenuItem\">".$filename . $title."</div>"; |
@@ -555,7 +573,9 @@ discard block |
||
| 555 | 573 | |
| 556 | 574 | $a_id = $id; |
| 557 | 575 | |
| 558 | - if (!$owner_uid) $owner_uid = $_SESSION["uid"]; |
|
| 576 | + if (!$owner_uid) { |
|
| 577 | + $owner_uid = $_SESSION["uid"]; |
|
| 578 | + } |
|
| 559 | 579 | |
| 560 | 580 | $pdo = Db::pdo(); |
| 561 | 581 | |
@@ -573,7 +593,9 @@ discard block |
||
| 573 | 593 | WHERE ref_id = ? AND owner_uid = ?"); |
| 574 | 594 | $csth->execute([$id, $owner_uid]); |
| 575 | 595 | |
| 576 | - if ($row = $csth->fetch()) $tag_cache = $row["tag_cache"]; |
|
| 596 | + if ($row = $csth->fetch()) { |
|
| 597 | + $tag_cache = $row["tag_cache"]; |
|
| 598 | + } |
|
| 577 | 599 | } |
| 578 | 600 | |
| 579 | 601 | if ($tag_cache) { |
@@ -614,8 +636,9 @@ discard block |
||
| 614 | 636 | |
| 615 | 637 | $tags_str = mb_substr($tags_str, 0, mb_strlen($tags_str)-2); |
| 616 | 638 | |
| 617 | - if (count($tags) > $maxtags) |
|
| 618 | - $tags_str .= ", …"; |
|
| 639 | + if (count($tags) > $maxtags) { |
|
| 640 | + $tags_str .= ", …"; |
|
| 641 | + } |
|
| 619 | 642 | |
| 620 | 643 | return $tags_str; |
| 621 | 644 | } |
@@ -623,7 +646,9 @@ discard block |
||
| 623 | 646 | |
| 624 | 647 | static function format_article_labels($labels) { |
| 625 | 648 | |
| 626 | - if (!is_array($labels)) return ''; |
|
| 649 | + if (!is_array($labels)) { |
|
| 650 | + return ''; |
|
| 651 | + } |
|
| 627 | 652 | |
| 628 | 653 | $labels_str = ""; |
| 629 | 654 | |
@@ -681,10 +706,11 @@ discard block |
||
| 681 | 706 | |
| 682 | 707 | // purge orphaned posts in main content table |
| 683 | 708 | |
| 684 | - if (DB_TYPE == "mysql") |
|
| 685 | - $limit_qpart = "LIMIT 5000"; |
|
| 686 | - else |
|
| 687 | - $limit_qpart = ""; |
|
| 709 | + if (DB_TYPE == "mysql") { |
|
| 710 | + $limit_qpart = "LIMIT 5000"; |
|
| 711 | + } else { |
|
| 712 | + $limit_qpart = ""; |
|
| 713 | + } |
|
| 688 | 714 | |
| 689 | 715 | $pdo = Db::pdo(); |
| 690 | 716 | $res = $pdo->query("DELETE FROM ttrss_entries WHERE |
@@ -698,7 +724,9 @@ discard block |
||
| 698 | 724 | |
| 699 | 725 | static function catchupArticlesById($ids, $cmode, $owner_uid = false) { |
| 700 | 726 | |
| 701 | - if (!$owner_uid) $owner_uid = $_SESSION["uid"]; |
|
| 727 | + if (!$owner_uid) { |
|
| 728 | + $owner_uid = $_SESSION["uid"]; |
|
| 729 | + } |
|
| 702 | 730 | |
| 703 | 731 | $pdo = Db::pdo(); |
| 704 | 732 | |
@@ -748,7 +776,9 @@ discard block |
||
| 748 | 776 | static function get_article_labels($id, $owner_uid = false) { |
| 749 | 777 | $rv = array(); |
| 750 | 778 | |
| 751 | - if (!$owner_uid) $owner_uid = $_SESSION["uid"]; |
|
| 779 | + if (!$owner_uid) { |
|
| 780 | + $owner_uid = $_SESSION["uid"]; |
|
| 781 | + } |
|
| 752 | 782 | |
| 753 | 783 | $pdo = Db::pdo(); |
| 754 | 784 | |
@@ -762,10 +792,11 @@ discard block |
||
| 762 | 792 | if ($label_cache) { |
| 763 | 793 | $tmp = json_decode($label_cache, true); |
| 764 | 794 | |
| 765 | - if (!$tmp || $tmp["no-labels"] == 1) |
|
| 766 | - return $rv; |
|
| 767 | - else |
|
| 768 | - return $tmp; |
|
| 795 | + if (!$tmp || $tmp["no-labels"] == 1) { |
|
| 796 | + return $rv; |
|
| 797 | + } else { |
|
| 798 | + return $tmp; |
|
| 799 | + } |
|
| 769 | 800 | } |
| 770 | 801 | } |
| 771 | 802 | |
@@ -784,10 +815,11 @@ discard block |
||
| 784 | 815 | array_push($rv, $rk); |
| 785 | 816 | } |
| 786 | 817 | |
| 787 | - if (count($rv) > 0) |
|
| 788 | - Labels::update_cache($owner_uid, $id, $rv); |
|
| 789 | - else |
|
| 790 | - Labels::update_cache($owner_uid, $id, array("no-labels" => 1)); |
|
| 818 | + if (count($rv) > 0) { |
|
| 819 | + Labels::update_cache($owner_uid, $id, $rv); |
|
| 820 | + } else { |
|
| 821 | + Labels::update_cache($owner_uid, $id, array("no-labels" => 1)); |
|
| 822 | + } |
|
| 791 | 823 | |
| 792 | 824 | return $rv; |
| 793 | 825 | } |
@@ -835,28 +867,33 @@ discard block |
||
| 835 | 867 | } |
| 836 | 868 | } |
| 837 | 869 | |
| 838 | - if (!$article_image) |
|
| 839 | - foreach ($enclosures as $enc) { |
|
| 870 | + if (!$article_image) { |
|
| 871 | + foreach ($enclosures as $enc) { |
|
| 840 | 872 | if (strpos($enc["content_type"], "image/") !== FALSE) { |
| 841 | 873 | $article_image = $enc["content_url"]; |
| 874 | + } |
|
| 842 | 875 | break; |
| 843 | 876 | } |
| 844 | 877 | } |
| 845 | 878 | |
| 846 | - if ($article_image) |
|
| 847 | - $article_image = rewrite_relative_url($site_url, $article_image); |
|
| 879 | + if ($article_image) { |
|
| 880 | + $article_image = rewrite_relative_url($site_url, $article_image); |
|
| 881 | + } |
|
| 848 | 882 | |
| 849 | - if ($article_stream) |
|
| 850 | - $article_stream = rewrite_relative_url($site_url, $article_stream); |
|
| 883 | + if ($article_stream) { |
|
| 884 | + $article_stream = rewrite_relative_url($site_url, $article_stream); |
|
| 885 | + } |
|
| 851 | 886 | } |
| 852 | 887 | |
| 853 | 888 | $cache = new DiskCache("images"); |
| 854 | 889 | |
| 855 | - if ($article_image && $cache->exists(sha1($article_image))) |
|
| 856 | - $article_image = $cache->getUrl(sha1($article_image)); |
|
| 890 | + if ($article_image && $cache->exists(sha1($article_image))) { |
|
| 891 | + $article_image = $cache->getUrl(sha1($article_image)); |
|
| 892 | + } |
|
| 857 | 893 | |
| 858 | - if ($article_stream && $cache->exists(sha1($article_stream))) |
|
| 859 | - $article_stream = $cache->getUrl(sha1($article_stream)); |
|
| 894 | + if ($article_stream && $cache->exists(sha1($article_stream))) { |
|
| 895 | + $article_stream = $cache->getUrl(sha1($article_stream)); |
|
| 896 | + } |
|
| 860 | 897 | |
| 861 | 898 | return [$article_image, $article_stream]; |
| 862 | 899 | } |
@@ -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" : ""; |
@@ -1236,7 +1236,7 @@ discard block |
||
| 1236 | 1236 | } else { |
| 1237 | 1237 | $icon = self::getIconFile($id); |
| 1238 | 1238 | |
| 1239 | - if ($icon && file_exists($icon)) { |
|
| 1239 | + if ($icon && file_exists($icon)) { |
|
| 1240 | 1240 | return ICONS_URL . "/" . basename($icon) . "?" . filemtime($icon); |
| 1241 | 1241 | } |
| 1242 | 1242 | } |
@@ -1247,7 +1247,7 @@ discard block |
||
| 1247 | 1247 | } |
| 1248 | 1248 | |
| 1249 | 1249 | static function getFeedTitle($id, $cat = false) { |
| 1250 | - $pdo = Db::pdo(); |
|
| 1250 | + $pdo = Db::pdo(); |
|
| 1251 | 1251 | |
| 1252 | 1252 | if ($cat) { |
| 1253 | 1253 | return Feeds::getCategoryTitle($id); |
@@ -1278,10 +1278,10 @@ discard block |
||
| 1278 | 1278 | |
| 1279 | 1279 | } else if (is_numeric($id) && $id > 0) { |
| 1280 | 1280 | |
| 1281 | - $sth = $pdo->prepare("SELECT title FROM ttrss_feeds WHERE id = ?"); |
|
| 1282 | - $sth->execute([$id]); |
|
| 1281 | + $sth = $pdo->prepare("SELECT title FROM ttrss_feeds WHERE id = ?"); |
|
| 1282 | + $sth->execute([$id]); |
|
| 1283 | 1283 | |
| 1284 | - if ($row = $sth->fetch()) { |
|
| 1284 | + if ($row = $sth->fetch()) { |
|
| 1285 | 1285 | return $row["title"]; |
| 1286 | 1286 | } else { |
| 1287 | 1287 | return "Unknown feed ($id)"; |
@@ -1300,7 +1300,7 @@ discard block |
||
| 1300 | 1300 | |
| 1301 | 1301 | if ($cat >= 0) { |
| 1302 | 1302 | |
| 1303 | - if (!$cat) $cat = null; |
|
| 1303 | + if (!$cat) $cat = null; |
|
| 1304 | 1304 | |
| 1305 | 1305 | $sth = $pdo->prepare("SELECT id FROM ttrss_feeds |
| 1306 | 1306 | WHERE (cat_id = :cat OR (:cat IS NULL AND cat_id IS NULL)) |
@@ -1340,7 +1340,7 @@ discard block |
||
| 1340 | 1340 | WHERE article_id = ref_id AND unread = true |
| 1341 | 1341 | AND ttrss_user_entries.owner_uid = ?"); |
| 1342 | 1342 | $sth->execute([$owner_uid]); |
| 1343 | - $row = $sth->fetch(); |
|
| 1343 | + $row = $sth->fetch(); |
|
| 1344 | 1344 | |
| 1345 | 1345 | return $row["unread"]; |
| 1346 | 1346 | } |
@@ -1388,7 +1388,7 @@ discard block |
||
| 1388 | 1388 | return __("Labels"); |
| 1389 | 1389 | } else { |
| 1390 | 1390 | |
| 1391 | - $pdo = Db::pdo(); |
|
| 1391 | + $pdo = Db::pdo(); |
|
| 1392 | 1392 | |
| 1393 | 1393 | $sth = $pdo->prepare("SELECT title FROM ttrss_feed_categories WHERE |
| 1394 | 1394 | id = ?"); |
@@ -1424,7 +1424,7 @@ discard block |
||
| 1424 | 1424 | $pdo = Db::pdo(); |
| 1425 | 1425 | |
| 1426 | 1426 | // WARNING: due to highly dynamic nature of this query its going to quote parameters |
| 1427 | - // right before adding them to SQL part |
|
| 1427 | + // right before adding them to SQL part |
|
| 1428 | 1428 | |
| 1429 | 1429 | $feed = $params["feed"]; |
| 1430 | 1430 | $limit = isset($params["limit"]) ? $params["limit"] : 30; |
@@ -1668,7 +1668,7 @@ discard block |
||
| 1668 | 1668 | $ssth = $pdo->prepare("SELECT title,site_url,last_error,last_updated |
| 1669 | 1669 | FROM ttrss_feeds WHERE id = ? AND owner_uid = ?"); |
| 1670 | 1670 | $ssth->execute([$feed, $owner_uid]); |
| 1671 | - $row = $ssth->fetch(); |
|
| 1671 | + $row = $ssth->fetch(); |
|
| 1672 | 1672 | |
| 1673 | 1673 | $feed_title = $row["title"]; |
| 1674 | 1674 | $feed_site_url = $row["site_url"]; |
@@ -1906,9 +1906,9 @@ discard block |
||
| 1906 | 1906 | static function getFeedCategory($feed) { |
| 1907 | 1907 | $pdo = Db::pdo(); |
| 1908 | 1908 | |
| 1909 | - $sth = $pdo->prepare("SELECT cat_id FROM ttrss_feeds |
|
| 1909 | + $sth = $pdo->prepare("SELECT cat_id FROM ttrss_feeds |
|
| 1910 | 1910 | WHERE id = ?"); |
| 1911 | - $sth->execute([$feed]); |
|
| 1911 | + $sth->execute([$feed]); |
|
| 1912 | 1912 | |
| 1913 | 1913 | if ($row = $sth->fetch()) { |
| 1914 | 1914 | return $row["cat_id"]; |
@@ -1918,20 +1918,20 @@ discard block |
||
| 1918 | 1918 | |
| 1919 | 1919 | } |
| 1920 | 1920 | |
| 1921 | - function color_of($name) { |
|
| 1922 | - $colormap = [ "#1cd7d7","#d91111","#1212d7","#8e16e5","#7b7b7b", |
|
| 1923 | - "#39f110","#0bbea6","#ec0e0e","#1534f2","#b9e416", |
|
| 1924 | - "#479af2","#f36b14","#10c7e9","#1e8fe7","#e22727" ]; |
|
| 1921 | + function color_of($name) { |
|
| 1922 | + $colormap = [ "#1cd7d7","#d91111","#1212d7","#8e16e5","#7b7b7b", |
|
| 1923 | + "#39f110","#0bbea6","#ec0e0e","#1534f2","#b9e416", |
|
| 1924 | + "#479af2","#f36b14","#10c7e9","#1e8fe7","#e22727" ]; |
|
| 1925 | 1925 | |
| 1926 | - $sum = 0; |
|
| 1926 | + $sum = 0; |
|
| 1927 | 1927 | |
| 1928 | - for ($i = 0; $i < strlen($name); $i++) { |
|
| 1929 | - $sum += ord($name[$i]); |
|
| 1930 | - } |
|
| 1928 | + for ($i = 0; $i < strlen($name); $i++) { |
|
| 1929 | + $sum += ord($name[$i]); |
|
| 1930 | + } |
|
| 1931 | 1931 | |
| 1932 | - $sum %= count($colormap); |
|
| 1932 | + $sum %= count($colormap); |
|
| 1933 | 1933 | |
| 1934 | - return $colormap[$sum]; |
|
| 1934 | + return $colormap[$sum]; |
|
| 1935 | 1935 | } |
| 1936 | 1936 | |
| 1937 | 1937 | static function get_feeds_from_html($url, $content) { |
@@ -398,21 +398,21 @@ discard block |
||
| 398 | 398 | $message = $query_error_override; |
| 399 | 399 | } else { |
| 400 | 400 | switch ($view_mode) { |
| 401 | - case "unread": |
|
| 402 | - $message = __("No unread articles found to display."); |
|
| 403 | - break; |
|
| 404 | - case "updated": |
|
| 405 | - $message = __("No updated articles found to display."); |
|
| 406 | - break; |
|
| 407 | - case "marked": |
|
| 408 | - $message = __("No starred articles found to display."); |
|
| 409 | - break; |
|
| 410 | - default: |
|
| 411 | - if ($feed < LABEL_BASE_INDEX) { |
|
| 412 | - $message = __("No articles found to display. You can assign articles to labels manually from article header context menu (applies to all selected articles) or use a filter."); |
|
| 413 | - } else { |
|
| 414 | - $message = __("No articles found to display."); |
|
| 415 | - } |
|
| 401 | + case "unread": |
|
| 402 | + $message = __("No unread articles found to display."); |
|
| 403 | + break; |
|
| 404 | + case "updated": |
|
| 405 | + $message = __("No updated articles found to display."); |
|
| 406 | + break; |
|
| 407 | + case "marked": |
|
| 408 | + $message = __("No starred articles found to display."); |
|
| 409 | + break; |
|
| 410 | + default: |
|
| 411 | + if ($feed < LABEL_BASE_INDEX) { |
|
| 412 | + $message = __("No articles found to display. You can assign articles to labels manually from article header context menu (applies to all selected articles) or use a filter."); |
|
| 413 | + } else { |
|
| 414 | + $message = __("No articles found to display."); |
|
| 415 | + } |
|
| 416 | 416 | } |
| 417 | 417 | } |
| 418 | 418 | |
@@ -874,29 +874,29 @@ discard block |
||
| 874 | 874 | // TODO: all this interval stuff needs some generic generator function |
| 875 | 875 | |
| 876 | 876 | switch ($mode) { |
| 877 | - case "1day": |
|
| 878 | - if (DB_TYPE == "pgsql") { |
|
| 879 | - $date_qpart = "date_entered < NOW() - INTERVAL '1 day' "; |
|
| 880 | - } else { |
|
| 881 | - $date_qpart = "date_entered < DATE_SUB(NOW(), INTERVAL 1 DAY) "; |
|
| 882 | - } |
|
| 883 | - break; |
|
| 884 | - case "1week": |
|
| 885 | - if (DB_TYPE == "pgsql") { |
|
| 886 | - $date_qpart = "date_entered < NOW() - INTERVAL '1 week' "; |
|
| 887 | - } else { |
|
| 888 | - $date_qpart = "date_entered < DATE_SUB(NOW(), INTERVAL 1 WEEK) "; |
|
| 889 | - } |
|
| 890 | - break; |
|
| 891 | - case "2week": |
|
| 892 | - if (DB_TYPE == "pgsql") { |
|
| 893 | - $date_qpart = "date_entered < NOW() - INTERVAL '2 week' "; |
|
| 894 | - } else { |
|
| 895 | - $date_qpart = "date_entered < DATE_SUB(NOW(), INTERVAL 2 WEEK) "; |
|
| 896 | - } |
|
| 897 | - break; |
|
| 898 | - default: |
|
| 899 | - $date_qpart = "true"; |
|
| 877 | + case "1day": |
|
| 878 | + if (DB_TYPE == "pgsql") { |
|
| 879 | + $date_qpart = "date_entered < NOW() - INTERVAL '1 day' "; |
|
| 880 | + } else { |
|
| 881 | + $date_qpart = "date_entered < DATE_SUB(NOW(), INTERVAL 1 DAY) "; |
|
| 882 | + } |
|
| 883 | + break; |
|
| 884 | + case "1week": |
|
| 885 | + if (DB_TYPE == "pgsql") { |
|
| 886 | + $date_qpart = "date_entered < NOW() - INTERVAL '1 week' "; |
|
| 887 | + } else { |
|
| 888 | + $date_qpart = "date_entered < DATE_SUB(NOW(), INTERVAL 1 WEEK) "; |
|
| 889 | + } |
|
| 890 | + break; |
|
| 891 | + case "2week": |
|
| 892 | + if (DB_TYPE == "pgsql") { |
|
| 893 | + $date_qpart = "date_entered < NOW() - INTERVAL '2 week' "; |
|
| 894 | + } else { |
|
| 895 | + $date_qpart = "date_entered < DATE_SUB(NOW(), INTERVAL 2 WEEK) "; |
|
| 896 | + } |
|
| 897 | + break; |
|
| 898 | + default: |
|
| 899 | + $date_qpart = "true"; |
|
| 900 | 900 | } |
| 901 | 901 | |
| 902 | 902 | if (is_numeric($feed)) { |
@@ -1212,28 +1212,28 @@ discard block |
||
| 1212 | 1212 | |
| 1213 | 1213 | static function getFeedIcon($id) { |
| 1214 | 1214 | switch ($id) { |
| 1215 | - case 0: |
|
| 1216 | - return "archive"; |
|
| 1217 | - case -1: |
|
| 1218 | - return "star"; |
|
| 1219 | - case -2: |
|
| 1220 | - return "rss_feed"; |
|
| 1221 | - case -3: |
|
| 1222 | - return "whatshot"; |
|
| 1223 | - case -4: |
|
| 1224 | - return "inbox"; |
|
| 1225 | - case -6: |
|
| 1226 | - return "restore"; |
|
| 1227 | - default: |
|
| 1228 | - if ($id < LABEL_BASE_INDEX) { |
|
| 1229 | - return "label"; |
|
| 1230 | - } else { |
|
| 1231 | - $icon = self::getIconFile($id); |
|
| 1215 | + case 0: |
|
| 1216 | + return "archive"; |
|
| 1217 | + case -1: |
|
| 1218 | + return "star"; |
|
| 1219 | + case -2: |
|
| 1220 | + return "rss_feed"; |
|
| 1221 | + case -3: |
|
| 1222 | + return "whatshot"; |
|
| 1223 | + case -4: |
|
| 1224 | + return "inbox"; |
|
| 1225 | + case -6: |
|
| 1226 | + return "restore"; |
|
| 1227 | + default: |
|
| 1228 | + if ($id < LABEL_BASE_INDEX) { |
|
| 1229 | + return "label"; |
|
| 1230 | + } else { |
|
| 1231 | + $icon = self::getIconFile($id); |
|
| 1232 | 1232 | |
| 1233 | 1233 | if ($icon && file_exists($icon)) { |
| 1234 | - return ICONS_URL . "/" . basename($icon) . "?" . filemtime($icon); |
|
| 1235 | - } |
|
| 1234 | + return ICONS_URL . "/" . basename($icon) . "?" . filemtime($icon); |
|
| 1236 | 1235 | } |
| 1236 | + } |
|
| 1237 | 1237 | } |
| 1238 | 1238 | |
| 1239 | 1239 | return false; |
@@ -2201,102 +2201,102 @@ discard block |
||
| 2201 | 2201 | $commandpair = explode(":", mb_strtolower($k), 2); |
| 2202 | 2202 | |
| 2203 | 2203 | switch ($commandpair[0]) { |
| 2204 | - case "title": |
|
| 2205 | - if ($commandpair[1]) { |
|
| 2206 | - array_push($query_keywords, "($not (LOWER(ttrss_entries.title) LIKE ". |
|
| 2207 | - $pdo->quote('%' . mb_strtolower($commandpair[1]) . '%') ."))"); |
|
| 2208 | - } else { |
|
| 2209 | - array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER('%$k%') |
|
| 2204 | + case "title": |
|
| 2205 | + if ($commandpair[1]) { |
|
| 2206 | + array_push($query_keywords, "($not (LOWER(ttrss_entries.title) LIKE ". |
|
| 2207 | + $pdo->quote('%' . mb_strtolower($commandpair[1]) . '%') ."))"); |
|
| 2208 | + } else { |
|
| 2209 | + array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER('%$k%') |
|
| 2210 | 2210 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
| 2211 | - array_push($search_words, $k); |
|
| 2212 | - } |
|
| 2213 | - break; |
|
| 2214 | - case "author": |
|
| 2215 | - if ($commandpair[1]) { |
|
| 2216 | - array_push($query_keywords, "($not (LOWER(author) LIKE ". |
|
| 2217 | - $pdo->quote('%' . mb_strtolower($commandpair[1]) . '%')."))"); |
|
| 2218 | - } else { |
|
| 2219 | - array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER('%$k%') |
|
| 2211 | + array_push($search_words, $k); |
|
| 2212 | + } |
|
| 2213 | + break; |
|
| 2214 | + case "author": |
|
| 2215 | + if ($commandpair[1]) { |
|
| 2216 | + array_push($query_keywords, "($not (LOWER(author) LIKE ". |
|
| 2217 | + $pdo->quote('%' . mb_strtolower($commandpair[1]) . '%')."))"); |
|
| 2218 | + } else { |
|
| 2219 | + array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER('%$k%') |
|
| 2220 | 2220 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
| 2221 | - array_push($search_words, $k); |
|
| 2222 | - } |
|
| 2223 | - break; |
|
| 2224 | - case "note": |
|
| 2225 | - 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 ". |
|
| 2232 | - $pdo->quote('%' . mb_strtolower($commandpair[1]) . '%')."))"); |
|
| 2233 | - } else { |
|
| 2234 | - array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").") |
|
| 2221 | + array_push($search_words, $k); |
|
| 2222 | + } |
|
| 2223 | + break; |
|
| 2224 | + case "note": |
|
| 2225 | + 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 ". |
|
| 2232 | + $pdo->quote('%' . mb_strtolower($commandpair[1]) . '%')."))"); |
|
| 2233 | + } else { |
|
| 2234 | + array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").") |
|
| 2235 | 2235 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
| 2236 | - if (!$not) array_push($search_words, $k); |
|
| 2237 | - } |
|
| 2238 | - break; |
|
| 2239 | - case "star": |
|
| 2236 | + if (!$not) array_push($search_words, $k); |
|
| 2237 | + } |
|
| 2238 | + break; |
|
| 2239 | + case "star": |
|
| 2240 | 2240 | |
| 2241 | - 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))"); |
|
| 2246 | - } else { |
|
| 2247 | - array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").") |
|
| 2241 | + 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))"); |
|
| 2246 | + } else { |
|
| 2247 | + array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").") |
|
| 2248 | 2248 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
| 2249 | - if (!$not) array_push($search_words, $k); |
|
| 2250 | - } |
|
| 2251 | - break; |
|
| 2252 | - case "pub": |
|
| 2253 | - 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))"); |
|
| 2249 | + if (!$not) array_push($search_words, $k); |
|
| 2250 | + } |
|
| 2251 | + break; |
|
| 2252 | + case "pub": |
|
| 2253 | + 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))"); |
|
| 2258 | 2258 | |
| 2259 | - } else { |
|
| 2260 | - array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER('%$k%') |
|
| 2259 | + } else { |
|
| 2260 | + array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER('%$k%') |
|
| 2261 | 2261 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
| 2262 | - if (!$not) array_push($search_words, $k); |
|
| 2263 | - } |
|
| 2264 | - break; |
|
| 2265 | - case "unread": |
|
| 2266 | - 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))"); |
|
| 2262 | + if (!$not) array_push($search_words, $k); |
|
| 2263 | + } |
|
| 2264 | + break; |
|
| 2265 | + case "unread": |
|
| 2266 | + 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))"); |
|
| 2271 | 2271 | |
| 2272 | - } else { |
|
| 2273 | - array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").") |
|
| 2272 | + } else { |
|
| 2273 | + array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").") |
|
| 2274 | 2274 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
| 2275 | - if (!$not) array_push($search_words, $k); |
|
| 2276 | - } |
|
| 2277 | - break; |
|
| 2278 | - default: |
|
| 2279 | - if (strpos($k, "@") === 0) { |
|
| 2275 | + if (!$not) array_push($search_words, $k); |
|
| 2276 | + } |
|
| 2277 | + break; |
|
| 2278 | + default: |
|
| 2279 | + if (strpos($k, "@") === 0) { |
|
| 2280 | 2280 | |
| 2281 | - $user_tz_string = get_pref('USER_TIMEZONE', $_SESSION['uid']); |
|
| 2282 | - $orig_ts = strtotime(substr($k, 1)); |
|
| 2283 | - $k = date("Y-m-d", convert_timestamp($orig_ts, $user_tz_string, 'UTC')); |
|
| 2281 | + $user_tz_string = get_pref('USER_TIMEZONE', $_SESSION['uid']); |
|
| 2282 | + $orig_ts = strtotime(substr($k, 1)); |
|
| 2283 | + $k = date("Y-m-d", convert_timestamp($orig_ts, $user_tz_string, 'UTC')); |
|
| 2284 | 2284 | |
| 2285 | - //$k = date("Y-m-d", strtotime(substr($k, 1))); |
|
| 2285 | + //$k = date("Y-m-d", strtotime(substr($k, 1))); |
|
| 2286 | 2286 | |
| 2287 | - array_push($query_keywords, "(".SUBSTRING_FOR_DATE."(updated,1,LENGTH('$k')) $not = '$k')"); |
|
| 2288 | - } else { |
|
| 2287 | + array_push($query_keywords, "(".SUBSTRING_FOR_DATE."(updated,1,LENGTH('$k')) $not = '$k')"); |
|
| 2288 | + } else { |
|
| 2289 | 2289 | |
| 2290 | - if (DB_TYPE == "pgsql") { |
|
| 2291 | - $k = mb_strtolower($k); |
|
| 2292 | - array_push($search_query_leftover, $not ? "!$k" : $k); |
|
| 2293 | - } else { |
|
| 2294 | - array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").") |
|
| 2290 | + if (DB_TYPE == "pgsql") { |
|
| 2291 | + $k = mb_strtolower($k); |
|
| 2292 | + array_push($search_query_leftover, $not ? "!$k" : $k); |
|
| 2293 | + } else { |
|
| 2294 | + array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").") |
|
| 2295 | 2295 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
| 2296 | - } |
|
| 2297 | - |
|
| 2298 | - if (!$not) array_push($search_words, $k); |
|
| 2299 | 2296 | } |
| 2297 | + |
|
| 2298 | + if (!$not) array_push($search_words, $k); |
|
| 2299 | + } |
|
| 2300 | 2300 | } |
| 2301 | 2301 | } |
| 2302 | 2302 | |
@@ -2,8 +2,8 @@ discard block |
||
| 2 | 2 | require_once "colors.php"; |
| 3 | 3 | |
| 4 | 4 | class Feeds extends Handler_Protected { |
| 5 | - const NEVER_GROUP_FEEDS = [ -6, 0 ]; |
|
| 6 | - const NEVER_GROUP_BY_DATE = [ -2, -1, -3 ]; |
|
| 5 | + const NEVER_GROUP_FEEDS = [ -6, 0]; |
|
| 6 | + const NEVER_GROUP_BY_DATE = [ -2, -1, -3]; |
|
| 7 | 7 | |
| 8 | 8 | private $params; |
| 9 | 9 | |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | $reply = ""; |
| 29 | 29 | |
| 30 | - $rss_link = htmlspecialchars(get_self_url_prefix() . |
|
| 30 | + $rss_link = htmlspecialchars(get_self_url_prefix(). |
|
| 31 | 31 | "/public.php?op=rss&id=$feed_id$cat_q$search_q"); |
| 32 | 32 | |
| 33 | 33 | $reply .= "<span class='left'>"; |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | if ($error) |
| 52 | - $reply .= " <i title=\"" . htmlspecialchars($error) . "\" class='material-icons icon-error'>error</i>"; |
|
| 52 | + $reply .= " <i title=\"".htmlspecialchars($error)."\" class='material-icons icon-error'>error</i>"; |
|
| 53 | 53 | |
| 54 | 54 | $reply .= "</span>"; |
| 55 | 55 | $reply .= "<span id='feed_current_unread' style='display: none'></span>"; |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | $sth->execute([$feed]); |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | - if ($method_split[0] == "MarkAllReadGR") { |
|
| 142 | + if ($method_split[0] == "MarkAllReadGR") { |
|
| 143 | 143 | $this->catchup_feed($method_split[1], false); |
| 144 | 144 | } |
| 145 | 145 | |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | if (!get_pref('SHOW_CONTENT_PREVIEW')) { |
| 244 | 244 | $line["content_preview"] = ""; |
| 245 | 245 | } else { |
| 246 | - $line["content_preview"] = "— " . truncate_string(strip_tags($line["content"]), 250); |
|
| 246 | + $line["content_preview"] = "— ".truncate_string(strip_tags($line["content"]), 250); |
|
| 247 | 247 | |
| 248 | 248 | foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_QUERY_HEADLINES) as $p) { |
| 249 | 249 | $line = $p->hook_query_headlines($line, 250, false); |
@@ -322,10 +322,10 @@ discard block |
||
| 322 | 322 | if (!get_pref("CDM_EXPANDED")) { |
| 323 | 323 | $line["cdm_excerpt"] = "<span class='collapse'> |
| 324 | 324 | <i class='material-icons' onclick='return Article.cdmUnsetActive(event)' |
| 325 | - title=\"" . __("Collapse article") . "\">remove_circle</i></span>"; |
|
| 325 | + title=\"" . __("Collapse article")."\">remove_circle</i></span>"; |
|
| 326 | 326 | |
| 327 | 327 | if (get_pref('SHOW_CONTENT_PREVIEW')) { |
| 328 | - $line["cdm_excerpt"] .= "<span class='excerpt'>" . $line["content_preview"] . "</span>"; |
|
| 328 | + $line["cdm_excerpt"] .= "<span class='excerpt'>".$line["content_preview"]."</span>"; |
|
| 329 | 329 | } |
| 330 | 330 | } |
| 331 | 331 | |
@@ -339,11 +339,11 @@ discard block |
||
| 339 | 339 | $ofgh->execute([$line["orig_feed_id"], $_SESSION['uid']]); |
| 340 | 340 | |
| 341 | 341 | if ($tmp_line = $ofgh->fetch()) { |
| 342 | - $line["orig_feed"] = [ $tmp_line["title"], $tmp_line["site_url"], $tmp_line["feed_url"] ]; |
|
| 342 | + $line["orig_feed"] = [$tmp_line["title"], $tmp_line["site_url"], $tmp_line["feed_url"]]; |
|
| 343 | 343 | } |
| 344 | 344 | } |
| 345 | 345 | |
| 346 | - $line["updated_long"] = make_local_datetime($line["updated"],true); |
|
| 346 | + $line["updated_long"] = make_local_datetime($line["updated"], true); |
|
| 347 | 347 | $line["updated"] = make_local_datetime($line["updated"], false, false, false, true); |
| 348 | 348 | |
| 349 | 349 | |
@@ -377,7 +377,7 @@ 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)'; |
|
| 380 | + $line['feed_bg_color'] = 'rgba('.implode(",", $rgba_cache[$feed_id]).',0.3)'; |
|
| 381 | 381 | } |
| 382 | 382 | |
| 383 | 383 | /* we don't need those */ |
@@ -421,7 +421,7 @@ discard block |
||
| 421 | 421 | |
| 422 | 422 | $reply['content'] .= "<p><span class=\"text-muted\">"; |
| 423 | 423 | |
| 424 | - $sth = $this->pdo->prepare("SELECT " . SUBSTRING_FOR_DATE . "(MAX(last_updated), 1, 19) AS last_updated FROM ttrss_feeds |
|
| 424 | + $sth = $this->pdo->prepare("SELECT ".SUBSTRING_FOR_DATE."(MAX(last_updated), 1, 19) AS last_updated FROM ttrss_feeds |
|
| 425 | 425 | WHERE owner_uid = ?"); |
| 426 | 426 | $sth->execute([$_SESSION['uid']]); |
| 427 | 427 | $row = $sth->fetch(); |
@@ -439,8 +439,8 @@ discard block |
||
| 439 | 439 | |
| 440 | 440 | if ($num_errors > 0) { |
| 441 | 441 | $reply['content'] .= "<br/>"; |
| 442 | - $reply['content'] .= "<a class=\"text-muted\" href=\"#\" onclick=\"CommonDialogs.showFeedsWithErrors()\">" . |
|
| 443 | - __('Some feeds have update errors (click for details)') . "</a>"; |
|
| 442 | + $reply['content'] .= "<a class=\"text-muted\" href=\"#\" onclick=\"CommonDialogs.showFeedsWithErrors()\">". |
|
| 443 | + __('Some feeds have update errors (click for details)')."</a>"; |
|
| 444 | 444 | } |
| 445 | 445 | $reply['content'] .= "</span></p></div>"; |
| 446 | 446 | |
@@ -635,7 +635,7 @@ discard block |
||
| 635 | 635 | $reply['headlines']['is_cat'] = false; |
| 636 | 636 | |
| 637 | 637 | $reply['headlines']['toolbar'] = ''; |
| 638 | - $reply['headlines']['content'] = "<div class='whiteBox'>". $error . "</div>"; |
|
| 638 | + $reply['headlines']['content'] = "<div class='whiteBox'>".$error."</div>"; |
|
| 639 | 639 | |
| 640 | 640 | $reply['headlines-info'] = array("count" => 0, |
| 641 | 641 | "unread" => 0, |
@@ -669,7 +669,7 @@ discard block |
||
| 669 | 669 | print "<fieldset>"; |
| 670 | 670 | |
| 671 | 671 | if (get_pref('ENABLE_FEED_CATS')) { |
| 672 | - print "<label class='inline'>" . __('Place in category:') . "</label> "; |
|
| 672 | + print "<label class='inline'>".__('Place in category:')."</label> "; |
|
| 673 | 673 | print_feed_cat_select("cat", false, 'dojoType="fox.form.Select"'); |
| 674 | 674 | } |
| 675 | 675 | |
@@ -678,7 +678,7 @@ discard block |
||
| 678 | 678 | print "</section>"; |
| 679 | 679 | |
| 680 | 680 | print '<div id="feedDlg_feedsContainer" style="display : none"> |
| 681 | - <header>' . __('Available feeds') . '</header> |
|
| 681 | + <header>' . __('Available feeds').'</header> |
|
| 682 | 682 | <section> |
| 683 | 683 | <fieldset> |
| 684 | 684 | <select id="feedDlg_feedContainerSelect" |
@@ -743,7 +743,7 @@ discard block |
||
| 743 | 743 | |
| 744 | 744 | if (DB_TYPE == "pgsql") { |
| 745 | 745 | print "<fieldset>"; |
| 746 | - print "<label class='inline'>" . __("Language:") . "</label>"; |
|
| 746 | + print "<label class='inline'>".__("Language:")."</label>"; |
|
| 747 | 747 | print_select("search_language", get_pref('DEFAULT_SEARCH_LANGUAGE'), Pref_Feeds::get_ts_languages(), |
| 748 | 748 | "dojoType='fox.form.Select' title=\"".__('Used for word stemming')."\""); |
| 749 | 749 | print "</fieldset>"; |
@@ -772,7 +772,7 @@ discard block |
||
| 772 | 772 | Debug::set_enabled(true); |
| 773 | 773 | Debug::set_loglevel($_REQUEST["xdebug"]); |
| 774 | 774 | |
| 775 | - $feed_id = (int)$_REQUEST["feed_id"]; |
|
| 775 | + $feed_id = (int) $_REQUEST["feed_id"]; |
|
| 776 | 776 | @$do_update = $_REQUEST["action"] == "do_update"; |
| 777 | 777 | $csrf_token = $_REQUEST["csrf_token"]; |
| 778 | 778 | |
@@ -811,7 +811,7 @@ discard block |
||
| 811 | 811 | </script> |
| 812 | 812 | |
| 813 | 813 | <div class="container"> |
| 814 | - <h1>Feed Debugger: <?php echo "$feed_id: " . $this->getFeedTitle($feed_id) ?></h1> |
|
| 814 | + <h1>Feed Debugger: <?php echo "$feed_id: ".$this->getFeedTitle($feed_id) ?></h1> |
|
| 815 | 815 | <div class="content"> |
| 816 | 816 | <form method="GET" action=""> |
| 817 | 817 | <input type="hidden" name="op" value="feeds"> |
@@ -1074,7 +1074,7 @@ discard block |
||
| 1074 | 1074 | } else if ($n_feed >= 0) { |
| 1075 | 1075 | |
| 1076 | 1076 | if ($n_feed != 0) { |
| 1077 | - $match_part = "feed_id = " . (int)$n_feed; |
|
| 1077 | + $match_part = "feed_id = ".(int) $n_feed; |
|
| 1078 | 1078 | } else { |
| 1079 | 1079 | $match_part = "feed_id IS NULL"; |
| 1080 | 1080 | } |
@@ -1184,7 +1184,7 @@ discard block |
||
| 1184 | 1184 | (owner_uid,feed_url,title,cat_id, auth_login,auth_pass,update_method,auth_pass_encrypted) |
| 1185 | 1185 | VALUES (?, ?, ?, ?, ?, ?, 0, false)"); |
| 1186 | 1186 | |
| 1187 | - $sth->execute([$_SESSION['uid'], $url, "[Unknown]", $cat_id, (string)$auth_login, (string)$auth_pass]); |
|
| 1187 | + $sth->execute([$_SESSION['uid'], $url, "[Unknown]", $cat_id, (string) $auth_login, (string) $auth_pass]); |
|
| 1188 | 1188 | |
| 1189 | 1189 | $sth = $pdo->prepare("SELECT id FROM ttrss_feeds WHERE feed_url = ? |
| 1190 | 1190 | AND owner_uid = ?"); |
@@ -1203,11 +1203,11 @@ discard block |
||
| 1203 | 1203 | } |
| 1204 | 1204 | |
| 1205 | 1205 | static function getIconFile($feed_id) { |
| 1206 | - return ICONS_DIR . "/$feed_id.ico"; |
|
| 1206 | + return ICONS_DIR."/$feed_id.ico"; |
|
| 1207 | 1207 | } |
| 1208 | 1208 | |
| 1209 | 1209 | static function feedHasIcon($id) { |
| 1210 | - return is_file(ICONS_DIR . "/$id.ico") && filesize(ICONS_DIR . "/$id.ico") > 0; |
|
| 1210 | + return is_file(ICONS_DIR."/$id.ico") && filesize(ICONS_DIR."/$id.ico") > 0; |
|
| 1211 | 1211 | } |
| 1212 | 1212 | |
| 1213 | 1213 | static function getFeedIcon($id) { |
@@ -1231,7 +1231,7 @@ discard block |
||
| 1231 | 1231 | $icon = self::getIconFile($id); |
| 1232 | 1232 | |
| 1233 | 1233 | if ($icon && file_exists($icon)) { |
| 1234 | - return ICONS_URL . "/" . basename($icon) . "?" . filemtime($icon); |
|
| 1234 | + return ICONS_URL."/".basename($icon)."?".filemtime($icon); |
|
| 1235 | 1235 | } |
| 1236 | 1236 | } |
| 1237 | 1237 | } |
@@ -1303,7 +1303,7 @@ discard block |
||
| 1303 | 1303 | |
| 1304 | 1304 | $cat_feeds = array(); |
| 1305 | 1305 | while ($line = $sth->fetch()) { |
| 1306 | - array_push($cat_feeds, "feed_id = " . (int)$line["id"]); |
|
| 1306 | + array_push($cat_feeds, "feed_id = ".(int) $line["id"]); |
|
| 1307 | 1307 | } |
| 1308 | 1308 | |
| 1309 | 1309 | if (count($cat_feeds) == 0) return 0; |
@@ -1517,7 +1517,7 @@ discard block |
||
| 1517 | 1517 | } |
| 1518 | 1518 | |
| 1519 | 1519 | if ($limit > 0) { |
| 1520 | - $limit_query_part = "LIMIT " . (int)$limit; |
|
| 1520 | + $limit_query_part = "LIMIT ".(int) $limit; |
|
| 1521 | 1521 | } |
| 1522 | 1522 | |
| 1523 | 1523 | $allow_archived = false; |
@@ -1544,7 +1544,7 @@ discard block |
||
| 1544 | 1544 | implode(",", $subcats).")"; |
| 1545 | 1545 | |
| 1546 | 1546 | } else { |
| 1547 | - $query_strategy_part = "cat_id = " . $pdo->quote($feed); |
|
| 1547 | + $query_strategy_part = "cat_id = ".$pdo->quote($feed); |
|
| 1548 | 1548 | } |
| 1549 | 1549 | |
| 1550 | 1550 | } else { |
@@ -1554,7 +1554,7 @@ discard block |
||
| 1554 | 1554 | $vfeed_query_part = "ttrss_feeds.title AS feed_title,"; |
| 1555 | 1555 | |
| 1556 | 1556 | } else { |
| 1557 | - $query_strategy_part = "feed_id = " . $pdo->quote($feed); |
|
| 1557 | + $query_strategy_part = "feed_id = ".$pdo->quote($feed); |
|
| 1558 | 1558 | } |
| 1559 | 1559 | } else if ($feed == 0 && !$cat_view) { // archive virtual feed |
| 1560 | 1560 | $query_strategy_part = "feed_id IS NULL"; |
@@ -1676,7 +1676,7 @@ discard block |
||
| 1676 | 1676 | $content_query_part = "content, "; |
| 1677 | 1677 | |
| 1678 | 1678 | if ($limit_query_part) { |
| 1679 | - $offset_query_part = "OFFSET " . (int)$offset; |
|
| 1679 | + $offset_query_part = "OFFSET ".(int) $offset; |
|
| 1680 | 1680 | } else { |
| 1681 | 1681 | $offset_query_part = ""; |
| 1682 | 1682 | } |
@@ -1765,7 +1765,7 @@ discard block |
||
| 1765 | 1765 | $res = $pdo->query($query); |
| 1766 | 1766 | |
| 1767 | 1767 | if ($row = $res->fetch()) { |
| 1768 | - $first_id = (int)$row["id"]; |
|
| 1768 | + $first_id = (int) $row["id"]; |
|
| 1769 | 1769 | |
| 1770 | 1770 | if ($offset > 0 && $first_id && $check_first_id && $first_id != $check_first_id) { |
| 1771 | 1771 | return array(-1, $feed_title, $feed_site_url, $last_error, $last_updated, $search_words, $first_id, $vfeed_query_part != "", $query_error_override); |
@@ -1912,9 +1912,9 @@ discard block |
||
| 1912 | 1912 | } |
| 1913 | 1913 | |
| 1914 | 1914 | function color_of($name) { |
| 1915 | - $colormap = [ "#1cd7d7","#d91111","#1212d7","#8e16e5","#7b7b7b", |
|
| 1916 | - "#39f110","#0bbea6","#ec0e0e","#1534f2","#b9e416", |
|
| 1917 | - "#479af2","#f36b14","#10c7e9","#1e8fe7","#e22727" ]; |
|
| 1915 | + $colormap = ["#1cd7d7", "#d91111", "#1212d7", "#8e16e5", "#7b7b7b", |
|
| 1916 | + "#39f110", "#0bbea6", "#ec0e0e", "#1534f2", "#b9e416", |
|
| 1917 | + "#479af2", "#f36b14", "#10c7e9", "#1e8fe7", "#e22727"]; |
|
| 1918 | 1918 | |
| 1919 | 1919 | $sum = 0; |
| 1920 | 1920 | |
@@ -1978,13 +1978,13 @@ discard block |
||
| 1978 | 1978 | |
| 1979 | 1979 | // support schema-less urls |
| 1980 | 1980 | if (strpos($url, '//') === 0) { |
| 1981 | - $url = 'https:' . $url; |
|
| 1981 | + $url = 'https:'.$url; |
|
| 1982 | 1982 | } |
| 1983 | 1983 | |
| 1984 | 1984 | if (strpos($url, '://') === false) { |
| 1985 | - $url = 'http://' . $url; |
|
| 1985 | + $url = 'http://'.$url; |
|
| 1986 | 1986 | } else if (substr($url, 0, 5) == 'feed:') { |
| 1987 | - $url = 'http:' . substr($url, 5); |
|
| 1987 | + $url = 'http:'.substr($url, 5); |
|
| 1988 | 1988 | } |
| 1989 | 1989 | |
| 1990 | 1990 | //prepend slash if the URL has no slash in it |
@@ -2034,7 +2034,7 @@ discard block |
||
| 2034 | 2034 | |
| 2035 | 2035 | $sth = $pdo->prepare("INSERT INTO ttrss_feed_categories (owner_uid,title,parent_cat,order_id) |
| 2036 | 2036 | VALUES (?, ?, ?, ?)"); |
| 2037 | - $sth->execute([$_SESSION['uid'], $feed_cat, $parent_cat_id, (int)$order_id]); |
|
| 2037 | + $sth->execute([$_SESSION['uid'], $feed_cat, $parent_cat_id, (int) $order_id]); |
|
| 2038 | 2038 | |
| 2039 | 2039 | if (!$tr_in_progress) $pdo->commit(); |
| 2040 | 2040 | |
@@ -2134,7 +2134,7 @@ discard block |
||
| 2134 | 2134 | $sth->execute([$feed_id]); |
| 2135 | 2135 | |
| 2136 | 2136 | } else { |
| 2137 | - $sth = $pdo->prepare("DELETE FROM ttrss_user_entries |
|
| 2137 | + $sth = $pdo->prepare("DELETE FROM ttrss_user_entries |
|
| 2138 | 2138 | USING ttrss_user_entries, ttrss_entries |
| 2139 | 2139 | WHERE ttrss_entries.id = ref_id AND |
| 2140 | 2140 | marked = false AND |
@@ -2204,7 +2204,7 @@ discard block |
||
| 2204 | 2204 | case "title": |
| 2205 | 2205 | if ($commandpair[1]) { |
| 2206 | 2206 | array_push($query_keywords, "($not (LOWER(ttrss_entries.title) LIKE ". |
| 2207 | - $pdo->quote('%' . mb_strtolower($commandpair[1]) . '%') ."))"); |
|
| 2207 | + $pdo->quote('%'.mb_strtolower($commandpair[1]).'%')."))"); |
|
| 2208 | 2208 | } else { |
| 2209 | 2209 | array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER('%$k%') |
| 2210 | 2210 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
@@ -2214,7 +2214,7 @@ discard block |
||
| 2214 | 2214 | case "author": |
| 2215 | 2215 | if ($commandpair[1]) { |
| 2216 | 2216 | array_push($query_keywords, "($not (LOWER(author) LIKE ". |
| 2217 | - $pdo->quote('%' . mb_strtolower($commandpair[1]) . '%')."))"); |
|
| 2217 | + $pdo->quote('%'.mb_strtolower($commandpair[1]).'%')."))"); |
|
| 2218 | 2218 | } else { |
| 2219 | 2219 | array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER('%$k%') |
| 2220 | 2220 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
@@ -2229,7 +2229,7 @@ discard block |
||
| 2229 | 2229 | array_push($query_keywords, "($not (note IS NULL OR note = ''))"); |
| 2230 | 2230 | else |
| 2231 | 2231 | array_push($query_keywords, "($not (LOWER(note) LIKE ". |
| 2232 | - $pdo->quote('%' . mb_strtolower($commandpair[1]) . '%')."))"); |
|
| 2232 | + $pdo->quote('%'.mb_strtolower($commandpair[1]).'%')."))"); |
|
| 2233 | 2233 | } else { |
| 2234 | 2234 | array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").") |
| 2235 | 2235 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
@@ -2306,7 +2306,7 @@ discard block |
||
| 2306 | 2306 | |
| 2307 | 2307 | // if there's no joiners consider this a "simple" search and |
| 2308 | 2308 | // concatenate everything with &, otherwise don't try to mess with tsquery syntax |
| 2309 | - if (preg_match("/[&|]/", implode(" " , $search_query_leftover))) { |
|
| 2309 | + if (preg_match("/[&|]/", implode(" ", $search_query_leftover))) { |
|
| 2310 | 2310 | $tsquery = $pdo->quote(implode(" ", $search_query_leftover)); |
| 2311 | 2311 | } else { |
| 2312 | 2312 | $tsquery = $pdo->quote(implode(" & ", $search_query_leftover)); |
@@ -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 | 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 | 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 | 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 | 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 | 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 | 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 | 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 | 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 | } |
@@ -52,9 +52,9 @@ |
||
| 52 | 52 | $this->pdo->query($line); // PDO returns errors as exceptions now |
| 53 | 53 | } catch (PDOException $e) { |
| 54 | 54 | if ($html_output) { |
| 55 | - print "<div class='text-error'>Error: " . $e->getMessage() . "</div>"; |
|
| 55 | + print "<div class='text-error'>Error: ".$e->getMessage()."</div>"; |
|
| 56 | 56 | } else { |
| 57 | - Debug::log("Error: " . $e->getMessage()); |
|
| 57 | + Debug::log("Error: ".$e->getMessage()); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | $this->pdo->rollBack(); |
@@ -43,10 +43,11 @@ |
||
| 43 | 43 | foreach ($lines as $line) { |
| 44 | 44 | if (strpos($line, "--") !== 0 && $line) { |
| 45 | 45 | |
| 46 | - if ($html_output) |
|
| 47 | - print "<pre>$line</pre>"; |
|
| 48 | - else |
|
| 49 | - Debug::log("> $line"); |
|
| 46 | + if ($html_output) { |
|
| 47 | + print "<pre>$line</pre>"; |
|
| 48 | + } else { |
|
| 49 | + Debug::log("> $line"); |
|
| 50 | + } |
|
| 50 | 51 | |
| 51 | 52 | try { |
| 52 | 53 | $this->pdo->query($line); // PDO returns errors as exceptions now |