@@ -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 | public 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 | - public static function opml_publish_url(){ |
|
| 626 | + public static function opml_publish_url() { |
|
| 627 | 627 | |
| 628 | 628 | $url_path = get_self_url_prefix(); |
| 629 | - $url_path .= "/opml.php?op=publish&key=" . |
|
| 629 | + $url_path .= "/opml.php?op=publish&key=". |
|
| 630 | 630 | Feeds::get_feed_access_key('OPML:Publish', false, $_SESSION["uid"]); |
| 631 | 631 | |
| 632 | 632 | return $url_path; |
@@ -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 | public 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 | public 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 | |
@@ -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 |
@@ -28,7 +28,9 @@ |
||
| 28 | 28 | if ($login && defined('AUTH_AUTO_CREATE') && AUTH_AUTO_CREATE) { |
| 29 | 29 | $user_id = $this->find_user_by_login($login); |
| 30 | 30 | |
| 31 | - if (!$password) $password = make_password(); |
|
| 31 | + if (!$password) { |
|
| 32 | + $password = make_password(); |
|
| 33 | + } |
|
| 32 | 34 | |
| 33 | 35 | if (!$user_id) { |
| 34 | 36 | $salt = substr(bin2hex(get_random_bytes(125)), 0, 250); |
@@ -143,9 +143,9 @@ discard block |
||
| 143 | 143 | |
| 144 | 144 | return $pdo; |
| 145 | 145 | } catch (Exception $e) { |
| 146 | - print "<div class='alert alert-danger'>" . $e->getMessage() . "</div>"; |
|
| 147 | - return null; |
|
| 148 | - } |
|
| 146 | + print "<div class='alert alert-danger'>" . $e->getMessage() . "</div>"; |
|
| 147 | + return null; |
|
| 148 | + } |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | function make_config($DB_TYPE, $DB_HOST, $DB_USER, $DB_NAME, $DB_PASS, |
@@ -322,13 +322,13 @@ discard block |
||
| 322 | 322 | array_push($notices, "PHP support for Internationalization Functions is required to handle Internationalized Domain Names."); |
| 323 | 323 | } |
| 324 | 324 | |
| 325 | - if ($DB_TYPE == "mysql" && !function_exists("mysqli_connect")) { |
|
| 326 | - array_push($notices, "PHP extension for MySQL (mysqli) is missing. This may prevent legacy plugins from working."); |
|
| 327 | - } |
|
| 325 | + if ($DB_TYPE == "mysql" && !function_exists("mysqli_connect")) { |
|
| 326 | + array_push($notices, "PHP extension for MySQL (mysqli) is missing. This may prevent legacy plugins from working."); |
|
| 327 | + } |
|
| 328 | 328 | |
| 329 | - if ($DB_TYPE == "pgsql" && !function_exists("pg_connect")) { |
|
| 329 | + if ($DB_TYPE == "pgsql" && !function_exists("pg_connect")) { |
|
| 330 | 330 | array_push($notices, "PHP extension for PostgreSQL is missing. This may prevent legacy plugins from working."); |
| 331 | - } |
|
| 331 | + } |
|
| 332 | 332 | |
| 333 | 333 | if (count($notices) > 0) { |
| 334 | 334 | print_notice("Configuration check succeeded with minor problems:"); |
@@ -429,7 +429,7 @@ discard block |
||
| 429 | 429 | print "<h2>Initializing database...</h2>"; |
| 430 | 430 | |
| 431 | 431 | $lines = explode(";", preg_replace("/[\r\n]/", "", |
| 432 | - file_get_contents("../schema/ttrss_schema_".basename($DB_TYPE).".sql"))); |
|
| 432 | + file_get_contents("../schema/ttrss_schema_".basename($DB_TYPE).".sql"))); |
|
| 433 | 433 | |
| 434 | 434 | foreach ($lines as $line) { |
| 435 | 435 | if (strpos($line, "--") !== 0 && $line) { |
@@ -438,7 +438,7 @@ discard block |
||
| 438 | 438 | if (!$res) { |
| 439 | 439 | print_notice("Query: $line"); |
| 440 | 440 | print_error("Error: " . implode(", ", $pdo->errorInfo())); |
| 441 | - } |
|
| 441 | + } |
|
| 442 | 442 | } |
| 443 | 443 | } |
| 444 | 444 | |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | $query = ""; |
| 12 | 12 | |
| 13 | 13 | if (!(strpos($filename, "?") === FALSE)) { |
| 14 | - $query = substr($filename, strpos($filename, "?")+1); |
|
| 14 | + $query = substr($filename, strpos($filename, "?") + 1); |
|
| 15 | 15 | $filename = substr($filename, 0, strpos($filename, "?")); |
| 16 | 16 | } |
| 17 | 17 | |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | $errors = array(); |
| 86 | 86 | |
| 87 | 87 | if (version_compare(PHP_VERSION, '5.6.0', '<')) { |
| 88 | - array_push($errors, "PHP version 5.6.0 or newer required. You're using " . PHP_VERSION . "."); |
|
| 88 | + array_push($errors, "PHP version 5.6.0 or newer required. You're using ".PHP_VERSION."."); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | if (!function_exists("curl_init") && !ini_get("allow_url_fopen")) { |
@@ -133,17 +133,17 @@ discard block |
||
| 133 | 133 | |
| 134 | 134 | function pdo_connect($host, $user, $pass, $db, $type, $port = false) { |
| 135 | 135 | |
| 136 | - $db_port = $port ? ';port=' . $port : ''; |
|
| 137 | - $db_host = $host ? ';host=' . $host : ''; |
|
| 136 | + $db_port = $port ? ';port='.$port : ''; |
|
| 137 | + $db_host = $host ? ';host='.$host : ''; |
|
| 138 | 138 | |
| 139 | 139 | try { |
| 140 | - $pdo = new PDO($type . ':dbname=' . $db . $db_host . $db_port, |
|
| 140 | + $pdo = new PDO($type.':dbname='.$db.$db_host.$db_port, |
|
| 141 | 141 | $user, |
| 142 | 142 | $pass); |
| 143 | 143 | |
| 144 | 144 | return $pdo; |
| 145 | 145 | } catch (Exception $e) { |
| 146 | - print "<div class='alert alert-danger'>" . $e->getMessage() . "</div>"; |
|
| 146 | + print "<div class='alert alert-danger'>".$e->getMessage()."</div>"; |
|
| 147 | 147 | return null; |
| 148 | 148 | } |
| 149 | 149 | } |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | function make_self_url_path() { |
| 192 | - $url_path = (is_server_https() ? 'https://' : 'http://') . $_SERVER["HTTP_HOST"] . parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH); |
|
| 192 | + $url_path = (is_server_https() ? 'https://' : 'http://').$_SERVER["HTTP_HOST"].parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH); |
|
| 193 | 193 | |
| 194 | 194 | return $url_path; |
| 195 | 195 | } |
@@ -437,7 +437,7 @@ discard block |
||
| 437 | 437 | |
| 438 | 438 | if (!$res) { |
| 439 | 439 | print_notice("Query: $line"); |
| 440 | - print_error("Error: " . implode(", ", $pdo->errorInfo())); |
|
| 440 | + print_error("Error: ".implode(", ", $pdo->errorInfo())); |
|
| 441 | 441 | } |
| 442 | 442 | } |
| 443 | 443 | } |
@@ -17,7 +17,9 @@ |
||
| 17 | 17 | |
| 18 | 18 | $timestamp = filemtime($filename); |
| 19 | 19 | |
| 20 | - if ($query) $timestamp .= "&$query"; |
|
| 20 | + if ($query) { |
|
| 21 | + $timestamp .= "&$query"; |
|
| 22 | + } |
|
| 21 | 23 | |
| 22 | 24 | return "<script type=\"text/javascript\" charset=\"utf-8\" src=\"$filename?$timestamp\"></script>\n"; |
| 23 | 25 | } |