@@ -5,8 +5,9 @@ discard block |
||
| 5 | 5 | $namespace = ''; |
| 6 | 6 | $class_name = $class; |
| 7 | 7 | |
| 8 | - if (strpos($class, '\\') !== FALSE) |
|
| 9 | - list ($namespace, $class_name) = explode('\\', $class, 2); |
|
| 8 | + if (strpos($class, '\\') !== FALSE) { |
|
| 9 | + list ($namespace, $class_name) = explode('\\', $class, 2); |
|
| 10 | + } |
|
| 10 | 11 | |
| 11 | 12 | $root_dir = dirname(__DIR__); // we're in tt-rss/include |
| 12 | 13 | |
@@ -20,7 +21,8 @@ discard block |
||
| 20 | 21 | $class_file = "$root_dir/classes/" . str_replace("_", "/", strtolower($class)) . ".php"; |
| 21 | 22 | } |
| 22 | 23 | |
| 23 | - if (file_exists($class_file)) |
|
| 24 | - include $class_file; |
|
| 24 | + if (file_exists($class_file)) { |
|
| 25 | + include $class_file; |
|
| 26 | + } |
|
| 25 | 27 | |
| 26 | 28 | }); |
@@ -24,14 +24,14 @@ |
||
| 24 | 24 | $er = error_reporting(E_ALL); |
| 25 | 25 | |
| 26 | 26 | switch (DB_TYPE) { |
| 27 | - case "mysql": |
|
| 28 | - $this->adapter = new Db_Mysqli(); |
|
| 29 | - break; |
|
| 30 | - case "pgsql": |
|
| 31 | - $this->adapter = new Db_Pgsql(); |
|
| 32 | - break; |
|
| 33 | - default: |
|
| 34 | - die("Unknown DB_TYPE: " . DB_TYPE); |
|
| 27 | + case "mysql": |
|
| 28 | + $this->adapter = new Db_Mysqli(); |
|
| 29 | + break; |
|
| 30 | + case "pgsql": |
|
| 31 | + $this->adapter = new Db_Pgsql(); |
|
| 32 | + break; |
|
| 33 | + default: |
|
| 34 | + die("Unknown DB_TYPE: " . DB_TYPE); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | if (!$this->adapter) { |
@@ -86,15 +86,17 @@ discard block |
||
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | public static function instance() { |
| 89 | - if (self::$instance == null) |
|
| 90 | - self::$instance = new self(); |
|
| 89 | + if (self::$instance == null) { |
|
| 90 | + self::$instance = new self(); |
|
| 91 | + } |
|
| 91 | 92 | |
| 92 | 93 | return self::$instance; |
| 93 | 94 | } |
| 94 | 95 | |
| 95 | 96 | public static function get() { |
| 96 | - if (self::$instance == null) |
|
| 97 | - self::$instance = new self(); |
|
| 97 | + if (self::$instance == null) { |
|
| 98 | + self::$instance = new self(); |
|
| 99 | + } |
|
| 98 | 100 | |
| 99 | 101 | if (!self::$instance->adapter) { |
| 100 | 102 | self::$instance->legacy_connect(); |
@@ -104,8 +106,9 @@ discard block |
||
| 104 | 106 | } |
| 105 | 107 | |
| 106 | 108 | public static function pdo() { |
| 107 | - if (self::$instance == null) |
|
| 108 | - self::$instance = new self(); |
|
| 109 | + if (self::$instance == null) { |
|
| 110 | + self::$instance = new self(); |
|
| 111 | + } |
|
| 109 | 112 | |
| 110 | 113 | if (!self::$instance->pdo) { |
| 111 | 114 | self::$instance->pdo = self::$instance->pdo_connect(); |
@@ -19,8 +19,9 @@ discard block |
||
| 19 | 19 | $from_combined = $from_name ? "$from_name <$from_address>" : $from_address; |
| 20 | 20 | $to_combined = $to_name ? "$to_name <$to_address>" : $to_address; |
| 21 | 21 | |
| 22 | - if (defined('_LOG_SENT_MAIL') && _LOG_SENT_MAIL) |
|
| 23 | - Logger::get()->log("Sending mail from $from_combined to $to_combined [$subject]: $message"); |
|
| 22 | + if (defined('_LOG_SENT_MAIL') && _LOG_SENT_MAIL) { |
|
| 23 | + Logger::get()->log("Sending mail from $from_combined to $to_combined [$subject]: $message"); |
|
| 24 | + } |
|
| 24 | 25 | |
| 25 | 26 | // HOOK_SEND_MAIL plugin instructions: |
| 26 | 27 | // 1. return 1 or true if mail is handled |
@@ -31,11 +32,13 @@ discard block |
||
| 31 | 32 | foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_SEND_MAIL) as $p) { |
| 32 | 33 | $rc = $p->hook_send_mail($this, $params); |
| 33 | 34 | |
| 34 | - if ($rc == 1) |
|
| 35 | - return $rc; |
|
| 35 | + if ($rc == 1) { |
|
| 36 | + return $rc; |
|
| 37 | + } |
|
| 36 | 38 | |
| 37 | - if ($rc == -1) |
|
| 38 | - return 0; |
|
| 39 | + if ($rc == -1) { |
|
| 40 | + return 0; |
|
| 41 | + } |
|
| 39 | 42 | } |
| 40 | 43 | |
| 41 | 44 | $headers = [ "From: $from_combined", "Content-Type: text/plain; charset=UTF-8" ]; |
@@ -218,16 +218,16 @@ discard block |
||
| 218 | 218 | |
| 219 | 219 | $override_order = false; |
| 220 | 220 | switch (clean($_REQUEST["order_by"])) { |
| 221 | - case "title": |
|
| 222 | - $override_order = "ttrss_entries.title, date_entered, updated"; |
|
| 223 | - break; |
|
| 224 | - case "date_reverse": |
|
| 225 | - $override_order = "score DESC, date_entered, updated"; |
|
| 226 | - $skip_first_id_check = true; |
|
| 227 | - break; |
|
| 228 | - case "feed_dates": |
|
| 229 | - $override_order = "updated DESC"; |
|
| 230 | - break; |
|
| 221 | + case "title": |
|
| 222 | + $override_order = "ttrss_entries.title, date_entered, updated"; |
|
| 223 | + break; |
|
| 224 | + case "date_reverse": |
|
| 225 | + $override_order = "score DESC, date_entered, updated"; |
|
| 226 | + $skip_first_id_check = true; |
|
| 227 | + break; |
|
| 228 | + case "feed_dates": |
|
| 229 | + $override_order = "updated DESC"; |
|
| 230 | + break; |
|
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | /* do not rely on params below */ |
@@ -259,32 +259,32 @@ discard block |
||
| 259 | 259 | $set_to = ""; |
| 260 | 260 | |
| 261 | 261 | switch ($field_raw) { |
| 262 | - case 0: |
|
| 263 | - $field = "marked"; |
|
| 264 | - $additional_fields = ",last_marked = NOW()"; |
|
| 265 | - break; |
|
| 266 | - case 1: |
|
| 267 | - $field = "published"; |
|
| 268 | - $additional_fields = ",last_published = NOW()"; |
|
| 269 | - break; |
|
| 270 | - case 2: |
|
| 271 | - $field = "unread"; |
|
| 272 | - $additional_fields = ",last_read = NOW()"; |
|
| 273 | - break; |
|
| 274 | - case 3: |
|
| 275 | - $field = "note"; |
|
| 262 | + case 0: |
|
| 263 | + $field = "marked"; |
|
| 264 | + $additional_fields = ",last_marked = NOW()"; |
|
| 265 | + break; |
|
| 266 | + case 1: |
|
| 267 | + $field = "published"; |
|
| 268 | + $additional_fields = ",last_published = NOW()"; |
|
| 269 | + break; |
|
| 270 | + case 2: |
|
| 271 | + $field = "unread"; |
|
| 272 | + $additional_fields = ",last_read = NOW()"; |
|
| 273 | + break; |
|
| 274 | + case 3: |
|
| 275 | + $field = "note"; |
|
| 276 | 276 | }; |
| 277 | 277 | |
| 278 | 278 | switch ($mode) { |
| 279 | - case 1: |
|
| 280 | - $set_to = "true"; |
|
| 281 | - break; |
|
| 282 | - case 0: |
|
| 283 | - $set_to = "false"; |
|
| 284 | - break; |
|
| 285 | - case 2: |
|
| 286 | - $set_to = "NOT $field"; |
|
| 287 | - break; |
|
| 279 | + case 1: |
|
| 280 | + $set_to = "true"; |
|
| 281 | + break; |
|
| 282 | + case 0: |
|
| 283 | + $set_to = "false"; |
|
| 284 | + break; |
|
| 285 | + case 2: |
|
| 286 | + $set_to = "NOT $field"; |
|
| 287 | + break; |
|
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | if ($field == "note") $set_to = $this->pdo->quote($data); |
@@ -57,7 +57,9 @@ discard block |
||
| 57 | 57 | $password = clean($_REQUEST["password"]); |
| 58 | 58 | $password_base64 = base64_decode(clean($_REQUEST["password"])); |
| 59 | 59 | |
| 60 | - if (SINGLE_USER_MODE) $login = "admin"; |
|
| 60 | + if (SINGLE_USER_MODE) { |
|
| 61 | + $login = "admin"; |
|
| 62 | + } |
|
| 61 | 63 | |
| 62 | 64 | $sth = $this->pdo->prepare("SELECT id FROM ttrss_users WHERE login = ?"); |
| 63 | 65 | $sth->execute([$login]); |
@@ -134,10 +136,11 @@ discard block |
||
| 134 | 136 | |
| 135 | 137 | // TODO do not return empty categories, return Uncategorized and standard virtual cats |
| 136 | 138 | |
| 137 | - if ($enable_nested) |
|
| 138 | - $nested_qpart = "parent_cat IS NULL"; |
|
| 139 | - else |
|
| 140 | - $nested_qpart = "true"; |
|
| 139 | + if ($enable_nested) { |
|
| 140 | + $nested_qpart = "parent_cat IS NULL"; |
|
| 141 | + } else { |
|
| 142 | + $nested_qpart = "true"; |
|
| 143 | + } |
|
| 141 | 144 | |
| 142 | 145 | $sth = $this->pdo->prepare("SELECT |
| 143 | 146 | id, title, order_id, (SELECT COUNT(id) FROM |
@@ -156,8 +159,9 @@ discard block |
||
| 156 | 159 | if ($include_empty || $line["num_feeds"] > 0 || $line["num_cats"] > 0) { |
| 157 | 160 | $unread = getFeedUnread($line["id"], true); |
| 158 | 161 | |
| 159 | - if ($enable_nested) |
|
| 160 | - $unread += Feeds::getCategoryChildrenUnread($line["id"]); |
|
| 162 | + if ($enable_nested) { |
|
| 163 | + $unread += Feeds::getCategoryChildrenUnread($line["id"]); |
|
| 164 | + } |
|
| 161 | 165 | |
| 162 | 166 | if ($unread || !$unread_only) { |
| 163 | 167 | array_push($cats, array("id" => $line["id"], |
@@ -188,11 +192,15 @@ discard block |
||
| 188 | 192 | $feed_id = clean($_REQUEST["feed_id"]); |
| 189 | 193 | if ($feed_id !== "") { |
| 190 | 194 | |
| 191 | - if (is_numeric($feed_id)) $feed_id = (int) $feed_id; |
|
| 195 | + if (is_numeric($feed_id)) { |
|
| 196 | + $feed_id = (int) $feed_id; |
|
| 197 | + } |
|
| 192 | 198 | |
| 193 | 199 | $limit = (int)clean($_REQUEST["limit"]); |
| 194 | 200 | |
| 195 | - if (!$limit || $limit >= 200) $limit = 200; |
|
| 201 | + if (!$limit || $limit >= 200) { |
|
| 202 | + $limit = 200; |
|
| 203 | + } |
|
| 196 | 204 | |
| 197 | 205 | $offset = (int)clean($_REQUEST["skip"]); |
| 198 | 206 | $filter = clean($_REQUEST["filter"]); |
@@ -287,7 +295,9 @@ discard block |
||
| 287 | 295 | break; |
| 288 | 296 | } |
| 289 | 297 | |
| 290 | - if ($field == "note") $set_to = $this->pdo->quote($data); |
|
| 298 | + if ($field == "note") { |
|
| 299 | + $set_to = $this->pdo->quote($data); |
|
| 300 | + } |
|
| 291 | 301 | |
| 292 | 302 | if ($field && $set_to && count($article_ids) > 0) { |
| 293 | 303 | |
@@ -443,10 +453,11 @@ discard block |
||
| 443 | 453 | WHERE owner_uid = ? ORDER BY caption"); |
| 444 | 454 | $sth->execute([$_SESSION['uid']]); |
| 445 | 455 | |
| 446 | - if ($article_id) |
|
| 447 | - $article_labels = Article::get_article_labels($article_id); |
|
| 448 | - else |
|
| 449 | - $article_labels = array(); |
|
| 456 | + if ($article_id) { |
|
| 457 | + $article_labels = Article::get_article_labels($article_id); |
|
| 458 | + } else { |
|
| 459 | + $article_labels = array(); |
|
| 460 | + } |
|
| 450 | 461 | |
| 451 | 462 | while ($line = $sth->fetch()) { |
| 452 | 463 | |
@@ -483,10 +494,11 @@ discard block |
||
| 483 | 494 | |
| 484 | 495 | foreach ($article_ids as $id) { |
| 485 | 496 | |
| 486 | - if ($assign) |
|
| 487 | - Labels::add_article($id, $label, $_SESSION["uid"]); |
|
| 488 | - else |
|
| 489 | - Labels::remove_article($id, $label, $_SESSION["uid"]); |
|
| 497 | + if ($assign) { |
|
| 498 | + Labels::add_article($id, $label, $_SESSION["uid"]); |
|
| 499 | + } else { |
|
| 500 | + Labels::remove_article($id, $label, $_SESSION["uid"]); |
|
| 501 | + } |
|
| 490 | 502 | |
| 491 | 503 | ++$num_updated; |
| 492 | 504 | |
@@ -738,14 +750,17 @@ discard block |
||
| 738 | 750 | $label_cache = json_decode($label_cache, true); |
| 739 | 751 | |
| 740 | 752 | if ($label_cache) { |
| 741 | - if ($label_cache["no-labels"] == 1) |
|
| 742 | - $labels = array(); |
|
| 743 | - else |
|
| 744 | - $labels = $label_cache; |
|
| 753 | + if ($label_cache["no-labels"] == 1) { |
|
| 754 | + $labels = array(); |
|
| 755 | + } else { |
|
| 756 | + $labels = $label_cache; |
|
| 757 | + } |
|
| 745 | 758 | } |
| 746 | 759 | } |
| 747 | 760 | |
| 748 | - if (!is_array($labels)) $labels = Article::get_article_labels($line["id"]); |
|
| 761 | + if (!is_array($labels)) { |
|
| 762 | + $labels = Article::get_article_labels($line["id"]); |
|
| 763 | + } |
|
| 749 | 764 | |
| 750 | 765 | $headline_row = array( |
| 751 | 766 | "id" => (int)$line["id"], |
@@ -763,11 +778,13 @@ discard block |
||
| 763 | 778 | |
| 764 | 779 | $enclosures = Article::get_article_enclosures($line['id']); |
| 765 | 780 | |
| 766 | - if ($include_attachments) |
|
| 767 | - $headline_row['attachments'] = $enclosures; |
|
| 781 | + if ($include_attachments) { |
|
| 782 | + $headline_row['attachments'] = $enclosures; |
|
| 783 | + } |
|
| 768 | 784 | |
| 769 | - if ($show_excerpt) |
|
| 770 | - $headline_row["excerpt"] = $line["content_preview"]; |
|
| 785 | + if ($show_excerpt) { |
|
| 786 | + $headline_row["excerpt"] = $line["content_preview"]; |
|
| 787 | + } |
|
| 771 | 788 | |
| 772 | 789 | if ($show_content) { |
| 773 | 790 | |
@@ -782,7 +799,9 @@ discard block |
||
| 782 | 799 | } |
| 783 | 800 | |
| 784 | 801 | // unify label output to ease parsing |
| 785 | - if ($labels["no-labels"] == 1) $labels = array(); |
|
| 802 | + if ($labels["no-labels"] == 1) { |
|
| 803 | + $labels = array(); |
|
| 804 | + } |
|
| 786 | 805 | |
| 787 | 806 | $headline_row["labels"] = $labels; |
| 788 | 807 | |
@@ -126,14 +126,14 @@ |
||
| 126 | 126 | $tmp = ''; |
| 127 | 127 | foreach (str_split($keys[$i]) as $c) { |
| 128 | 128 | switch ($c) { |
| 129 | - case '*': |
|
| 130 | - $tmp .= __('Shift') . '+'; |
|
| 131 | - break; |
|
| 132 | - case '^': |
|
| 133 | - $tmp .= __('Ctrl') . '+'; |
|
| 134 | - break; |
|
| 135 | - default: |
|
| 136 | - $tmp .= $c; |
|
| 129 | + case '*': |
|
| 130 | + $tmp .= __('Shift') . '+'; |
|
| 131 | + break; |
|
| 132 | + case '^': |
|
| 133 | + $tmp .= __('Ctrl') . '+'; |
|
| 134 | + break; |
|
| 135 | + default: |
|
| 136 | + $tmp .= $c; |
|
| 137 | 137 | } |
| 138 | 138 | } |
| 139 | 139 | $keys[$i] = $tmp; |
@@ -30,7 +30,9 @@ discard block |
||
| 30 | 30 | $omap = array(); |
| 31 | 31 | |
| 32 | 32 | foreach ($imap[1] as $sequence => $action) { |
| 33 | - if (!isset($omap[$action])) $omap[$action] = array(); |
|
| 33 | + if (!isset($omap[$action])) { |
|
| 34 | + $omap[$action] = array(); |
|
| 35 | + } |
|
| 34 | 36 | |
| 35 | 37 | array_push($omap[$action], $sequence); |
| 36 | 38 | } |
@@ -40,7 +42,9 @@ discard block |
||
| 40 | 42 | $cur_section = ""; |
| 41 | 43 | foreach ($info as $section => $hotkeys) { |
| 42 | 44 | |
| 43 | - if ($cur_section) print "<li> </li>"; |
|
| 45 | + if ($cur_section) { |
|
| 46 | + print "<li> </li>"; |
|
| 47 | + } |
|
| 44 | 48 | print "<li><h3>" . $section . "</h3></li>"; |
| 45 | 49 | $cur_section = $section; |
| 46 | 50 | |
@@ -170,22 +170,22 @@ |
||
| 170 | 170 | $value = $_POST[$pref_name]; |
| 171 | 171 | |
| 172 | 172 | switch ($pref_name) { |
| 173 | - case 'DIGEST_PREFERRED_TIME': |
|
| 174 | - if (get_pref('DIGEST_PREFERRED_TIME') != $value) { |
|
| 173 | + case 'DIGEST_PREFERRED_TIME': |
|
| 174 | + if (get_pref('DIGEST_PREFERRED_TIME') != $value) { |
|
| 175 | 175 | |
| 176 | - $sth = $this->pdo->prepare("UPDATE ttrss_users SET |
|
| 176 | + $sth = $this->pdo->prepare("UPDATE ttrss_users SET |
|
| 177 | 177 | last_digest_sent = NULL WHERE id = ?"); |
| 178 | - $sth->execute([$_SESSION['uid']]); |
|
| 178 | + $sth->execute([$_SESSION['uid']]); |
|
| 179 | 179 | |
| 180 | - } |
|
| 181 | - break; |
|
| 182 | - case 'USER_LANGUAGE': |
|
| 183 | - if (!$need_reload) $need_reload = $_SESSION["language"] != $value; |
|
| 184 | - break; |
|
| 185 | - |
|
| 186 | - case 'USER_CSS_THEME': |
|
| 187 | - if (!$need_reload) $need_reload = get_pref($pref_name) != $value; |
|
| 188 | - break; |
|
| 180 | + } |
|
| 181 | + break; |
|
| 182 | + case 'USER_LANGUAGE': |
|
| 183 | + if (!$need_reload) $need_reload = $_SESSION["language"] != $value; |
|
| 184 | + break; |
|
| 185 | + |
|
| 186 | + case 'USER_CSS_THEME': |
|
| 187 | + if (!$need_reload) $need_reload = get_pref($pref_name) != $value; |
|
| 188 | + break; |
|
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | set_pref($pref_name, $value); |
@@ -160,7 +160,9 @@ discard block |
||
| 160 | 160 | $boolean_prefs = explode(",", clean($_POST["boolean_prefs"])); |
| 161 | 161 | |
| 162 | 162 | foreach ($boolean_prefs as $pref) { |
| 163 | - if (!isset($_POST[$pref])) $_POST[$pref] = 'false'; |
|
| 163 | + if (!isset($_POST[$pref])) { |
|
| 164 | + $_POST[$pref] = 'false'; |
|
| 165 | + } |
|
| 164 | 166 | } |
| 165 | 167 | |
| 166 | 168 | $need_reload = false; |
@@ -180,11 +182,15 @@ discard block |
||
| 180 | 182 | } |
| 181 | 183 | break; |
| 182 | 184 | case 'USER_LANGUAGE': |
| 183 | - if (!$need_reload) $need_reload = $_SESSION["language"] != $value; |
|
| 185 | + if (!$need_reload) { |
|
| 186 | + $need_reload = $_SESSION["language"] != $value; |
|
| 187 | + } |
|
| 184 | 188 | break; |
| 185 | 189 | |
| 186 | 190 | case 'USER_CSS_THEME': |
| 187 | - if (!$need_reload) $need_reload = get_pref($pref_name) != $value; |
|
| 191 | + if (!$need_reload) { |
|
| 192 | + $need_reload = get_pref($pref_name) != $value; |
|
| 193 | + } |
|
| 188 | 194 | break; |
| 189 | 195 | } |
| 190 | 196 | |
@@ -616,8 +622,9 @@ discard block |
||
| 616 | 622 | $pref_name = $line["pref_name"]; |
| 617 | 623 | $short_desc = $this->getShortDesc($pref_name); |
| 618 | 624 | |
| 619 | - if (!$short_desc) |
|
| 620 | - continue; |
|
| 625 | + if (!$short_desc) { |
|
| 626 | + continue; |
|
| 627 | + } |
|
| 621 | 628 | |
| 622 | 629 | $prefs_available[$pref_name] = [ |
| 623 | 630 | 'type_name' => $line["type_name"], |
@@ -669,7 +676,9 @@ discard block |
||
| 669 | 676 | $themes = array_filter($themes, "theme_exists"); |
| 670 | 677 | asort($themes); |
| 671 | 678 | |
| 672 | - if (!theme_exists($value)) $value = "default.php"; |
|
| 679 | + if (!theme_exists($value)) { |
|
| 680 | + $value = "default.php"; |
|
| 681 | + } |
|
| 673 | 682 | |
| 674 | 683 | print "<select name='$pref_name' id='$pref_name' dojoType='fox.form.Select'>"; |
| 675 | 684 | |
@@ -728,14 +737,15 @@ discard block |
||
| 728 | 737 | $disabled = ""; |
| 729 | 738 | } |
| 730 | 739 | |
| 731 | - if ($type_name == 'integer') |
|
| 732 | - print "<input dojoType=\"dijit.form.NumberSpinner\" |
|
| 740 | + if ($type_name == 'integer') { |
|
| 741 | + print "<input dojoType=\"dijit.form.NumberSpinner\" |
|
| 733 | 742 | required='1' $disabled |
| 734 | 743 | name=\"$pref_name\" value=\"$value\">"; |
| 735 | - else |
|
| 736 | - print "<input dojoType=\"dijit.form.TextBox\" |
|
| 744 | + } else { |
|
| 745 | + print "<input dojoType=\"dijit.form.TextBox\" |
|
| 737 | 746 | required='1' $regexp $disabled |
| 738 | 747 | name=\"$pref_name\" value=\"$value\">"; |
| 748 | + } |
|
| 739 | 749 | |
| 740 | 750 | } else if ($pref_name == "SSL_CERT_SERIAL") { |
| 741 | 751 | |
@@ -770,8 +780,9 @@ discard block |
||
| 770 | 780 | print "<input dojoType=\"dijit.form.ValidationTextBox\" $regexp name=\"$pref_name\" value=\"$value\">"; |
| 771 | 781 | } |
| 772 | 782 | |
| 773 | - if ($item['help_text']) |
|
| 774 | - print "<div class='help-text text-muted'><label for='CB_$pref_name'>".$item['help_text']."</label></div>"; |
|
| 783 | + if ($item['help_text']) { |
|
| 784 | + print "<div class='help-text text-muted'><label for='CB_$pref_name'>".$item['help_text']."</label></div>"; |
|
| 785 | + } |
|
| 775 | 786 | |
| 776 | 787 | print "</fieldset>"; |
| 777 | 788 | } |
@@ -1108,10 +1119,11 @@ discard block |
||
| 1108 | 1119 | } |
| 1109 | 1120 | |
| 1110 | 1121 | public function setplugins() { |
| 1111 | - if (is_array(clean($_REQUEST["plugins"]))) |
|
| 1112 | - $plugins = join(",", clean($_REQUEST["plugins"])); |
|
| 1113 | - else |
|
| 1114 | - $plugins = ""; |
|
| 1122 | + if (is_array(clean($_REQUEST["plugins"]))) { |
|
| 1123 | + $plugins = join(",", clean($_REQUEST["plugins"])); |
|
| 1124 | + } else { |
|
| 1125 | + $plugins = ""; |
|
| 1126 | + } |
|
| 1115 | 1127 | |
| 1116 | 1128 | set_pref("_ENABLED_PLUGINS", $plugins); |
| 1117 | 1129 | } |
@@ -1066,70 +1066,70 @@ |
||
| 1066 | 1066 | $qpart = ""; |
| 1067 | 1067 | |
| 1068 | 1068 | switch ($k) { |
| 1069 | - case "title": |
|
| 1070 | - $qpart = "title = " . $this->pdo->quote($feed_title); |
|
| 1071 | - break; |
|
| 1072 | - |
|
| 1073 | - case "feed_url": |
|
| 1074 | - $qpart = "feed_url = " . $this->pdo->quote($feed_url); |
|
| 1075 | - break; |
|
| 1076 | - |
|
| 1077 | - case "update_interval": |
|
| 1078 | - $qpart = "update_interval = " . $this->pdo->quote($upd_intl); |
|
| 1079 | - break; |
|
| 1080 | - |
|
| 1081 | - case "purge_interval": |
|
| 1082 | - $qpart = "purge_interval =" . $this->pdo->quote($purge_intl); |
|
| 1083 | - break; |
|
| 1084 | - |
|
| 1085 | - case "auth_login": |
|
| 1086 | - $qpart = "auth_login = " . $this->pdo->quote($auth_login); |
|
| 1087 | - break; |
|
| 1088 | - |
|
| 1089 | - case "auth_pass": |
|
| 1090 | - $qpart = "auth_pass =" . $this->pdo->quote($auth_pass). ", auth_pass_encrypted = false"; |
|
| 1091 | - break; |
|
| 1092 | - |
|
| 1093 | - case "private": |
|
| 1094 | - $qpart = "private = " . $this->pdo->quote($private); |
|
| 1095 | - break; |
|
| 1096 | - |
|
| 1097 | - case "include_in_digest": |
|
| 1098 | - $qpart = "include_in_digest = " . $this->pdo->quote($include_in_digest); |
|
| 1099 | - break; |
|
| 1100 | - |
|
| 1101 | - case "always_display_enclosures": |
|
| 1102 | - $qpart = "always_display_enclosures = " . $this->pdo->quote($always_display_enclosures); |
|
| 1103 | - break; |
|
| 1104 | - |
|
| 1105 | - case "mark_unread_on_update": |
|
| 1106 | - $qpart = "mark_unread_on_update = " . $this->pdo->quote($mark_unread_on_update); |
|
| 1107 | - break; |
|
| 1108 | - |
|
| 1109 | - case "cache_images": |
|
| 1110 | - $qpart = "cache_images = " . $this->pdo->quote($cache_images); |
|
| 1111 | - break; |
|
| 1112 | - |
|
| 1113 | - case "hide_images": |
|
| 1114 | - $qpart = "hide_images = " . $this->pdo->quote($hide_images); |
|
| 1115 | - break; |
|
| 1116 | - |
|
| 1117 | - case "cat_id": |
|
| 1118 | - if (get_pref('ENABLE_FEED_CATS')) { |
|
| 1119 | - if ($cat_id) { |
|
| 1120 | - $qpart = "cat_id = " . $this->pdo->quote($cat_id); |
|
| 1121 | - } else { |
|
| 1122 | - $qpart = 'cat_id = NULL'; |
|
| 1123 | - } |
|
| 1069 | + case "title": |
|
| 1070 | + $qpart = "title = " . $this->pdo->quote($feed_title); |
|
| 1071 | + break; |
|
| 1072 | + |
|
| 1073 | + case "feed_url": |
|
| 1074 | + $qpart = "feed_url = " . $this->pdo->quote($feed_url); |
|
| 1075 | + break; |
|
| 1076 | + |
|
| 1077 | + case "update_interval": |
|
| 1078 | + $qpart = "update_interval = " . $this->pdo->quote($upd_intl); |
|
| 1079 | + break; |
|
| 1080 | + |
|
| 1081 | + case "purge_interval": |
|
| 1082 | + $qpart = "purge_interval =" . $this->pdo->quote($purge_intl); |
|
| 1083 | + break; |
|
| 1084 | + |
|
| 1085 | + case "auth_login": |
|
| 1086 | + $qpart = "auth_login = " . $this->pdo->quote($auth_login); |
|
| 1087 | + break; |
|
| 1088 | + |
|
| 1089 | + case "auth_pass": |
|
| 1090 | + $qpart = "auth_pass =" . $this->pdo->quote($auth_pass). ", auth_pass_encrypted = false"; |
|
| 1091 | + break; |
|
| 1092 | + |
|
| 1093 | + case "private": |
|
| 1094 | + $qpart = "private = " . $this->pdo->quote($private); |
|
| 1095 | + break; |
|
| 1096 | + |
|
| 1097 | + case "include_in_digest": |
|
| 1098 | + $qpart = "include_in_digest = " . $this->pdo->quote($include_in_digest); |
|
| 1099 | + break; |
|
| 1100 | + |
|
| 1101 | + case "always_display_enclosures": |
|
| 1102 | + $qpart = "always_display_enclosures = " . $this->pdo->quote($always_display_enclosures); |
|
| 1103 | + break; |
|
| 1104 | + |
|
| 1105 | + case "mark_unread_on_update": |
|
| 1106 | + $qpart = "mark_unread_on_update = " . $this->pdo->quote($mark_unread_on_update); |
|
| 1107 | + break; |
|
| 1108 | + |
|
| 1109 | + case "cache_images": |
|
| 1110 | + $qpart = "cache_images = " . $this->pdo->quote($cache_images); |
|
| 1111 | + break; |
|
| 1112 | + |
|
| 1113 | + case "hide_images": |
|
| 1114 | + $qpart = "hide_images = " . $this->pdo->quote($hide_images); |
|
| 1115 | + break; |
|
| 1116 | + |
|
| 1117 | + case "cat_id": |
|
| 1118 | + if (get_pref('ENABLE_FEED_CATS')) { |
|
| 1119 | + if ($cat_id) { |
|
| 1120 | + $qpart = "cat_id = " . $this->pdo->quote($cat_id); |
|
| 1124 | 1121 | } else { |
| 1125 | - $qpart = ""; |
|
| 1122 | + $qpart = 'cat_id = NULL'; |
|
| 1126 | 1123 | } |
| 1124 | + } else { |
|
| 1125 | + $qpart = ""; |
|
| 1126 | + } |
|
| 1127 | 1127 | |
| 1128 | - break; |
|
| 1128 | + break; |
|
| 1129 | 1129 | |
| 1130 | - case "feed_language": |
|
| 1131 | - $qpart = "feed_language = " . $this->pdo->quote($feed_language); |
|
| 1132 | - break; |
|
| 1130 | + case "feed_language": |
|
| 1131 | + $qpart = "feed_language = " . $this->pdo->quote($feed_language); |
|
| 1132 | + break; |
|
| 1133 | 1133 | |
| 1134 | 1134 | } |
| 1135 | 1135 | |
@@ -42,10 +42,11 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | private function get_category_items($cat_id) { |
| 44 | 44 | |
| 45 | - if (clean($_REQUEST['mode']) != 2) |
|
| 46 | - $search = $_SESSION["prefs_feed_search"]; |
|
| 47 | - else |
|
| 48 | - $search = ""; |
|
| 45 | + if (clean($_REQUEST['mode']) != 2) { |
|
| 46 | + $search = $_SESSION["prefs_feed_search"]; |
|
| 47 | + } else { |
|
| 48 | + $search = ""; |
|
| 49 | + } |
|
| 49 | 50 | |
| 50 | 51 | // first one is set by API |
| 51 | 52 | $show_empty_cats = clean($_REQUEST['force_show_empty']) || |
@@ -76,8 +77,9 @@ discard block |
||
| 76 | 77 | $num_children = $this->calculate_children_count($cat); |
| 77 | 78 | $cat['param'] = vsprintf(_ngettext('(%d feed)', '(%d feeds)', (int) $num_children), $num_children); |
| 78 | 79 | |
| 79 | - if ($num_children > 0 || $show_empty_cats) |
|
| 80 | - array_push($items, $cat); |
|
| 80 | + if ($num_children > 0 || $show_empty_cats) { |
|
| 81 | + array_push($items, $cat); |
|
| 82 | + } |
|
| 81 | 83 | |
| 82 | 84 | } |
| 83 | 85 | |
@@ -117,10 +119,11 @@ discard block |
||
| 117 | 119 | |
| 118 | 120 | public function makefeedtree() { |
| 119 | 121 | |
| 120 | - if (clean($_REQUEST['mode']) != 2) |
|
| 121 | - $search = $_SESSION["prefs_feed_search"]; |
|
| 122 | - else |
|
| 123 | - $search = ""; |
|
| 122 | + if (clean($_REQUEST['mode']) != 2) { |
|
| 123 | + $search = $_SESSION["prefs_feed_search"]; |
|
| 124 | + } else { |
|
| 125 | + $search = ""; |
|
| 126 | + } |
|
| 124 | 127 | |
| 125 | 128 | $root = array(); |
| 126 | 129 | $root['id'] = 'root'; |
@@ -231,8 +234,9 @@ discard block |
||
| 231 | 234 | $num_children = $this->calculate_children_count($cat); |
| 232 | 235 | $cat['param'] = vsprintf(_ngettext('(%d feed)', '(%d feeds)', (int) $num_children), $num_children); |
| 233 | 236 | |
| 234 | - if ($num_children > 0 || $show_empty_cats) |
|
| 235 | - array_push($root['items'], $cat); |
|
| 237 | + if ($num_children > 0 || $show_empty_cats) { |
|
| 238 | + array_push($root['items'], $cat); |
|
| 239 | + } |
|
| 236 | 240 | |
| 237 | 241 | $root['param'] += count($cat['items']); |
| 238 | 242 | } |
@@ -279,8 +283,9 @@ discard block |
||
| 279 | 283 | |
| 280 | 284 | $cat['param'] = vsprintf(_ngettext('(%d feed)', '(%d feeds)', count($cat['items'])), count($cat['items'])); |
| 281 | 285 | |
| 282 | - if (count($cat['items']) > 0 || $show_empty_cats) |
|
| 283 | - array_push($root['items'], $cat); |
|
| 286 | + if (count($cat['items']) > 0 || $show_empty_cats) { |
|
| 287 | + array_push($root['items'], $cat); |
|
| 288 | + } |
|
| 284 | 289 | |
| 285 | 290 | $num_children = $this->calculate_children_count($root); |
| 286 | 291 | $root['param'] = vsprintf(_ngettext('(%d feed)', '(%d feeds)', (int) $num_children), $num_children); |
@@ -343,8 +348,9 @@ discard block |
||
| 343 | 348 | private function process_category_order(&$data_map, $item_id, $parent_id = false, $nest_level = 0) { |
| 344 | 349 | |
| 345 | 350 | $prefix = ""; |
| 346 | - for ($i = 0; $i < $nest_level; $i++) |
|
| 347 | - $prefix .= " "; |
|
| 351 | + for ($i = 0; $i < $nest_level; $i++) { |
|
| 352 | + $prefix .= " "; |
|
| 353 | + } |
|
| 348 | 354 | |
| 349 | 355 | Debug::log("$prefix C: $item_id P: $parent_id"); |
| 350 | 356 | |
@@ -409,8 +415,9 @@ discard block |
||
| 409 | 415 | #file_put_contents("/tmp/saveorder.json", clean($_POST['payload'])); |
| 410 | 416 | #$data = json_decode(file_get_contents("/tmp/saveorder.json"), true); |
| 411 | 417 | |
| 412 | - if (!is_array($data['items'])) |
|
| 413 | - $data['items'] = json_decode($data['items'], true); |
|
| 418 | + if (!is_array($data['items'])) { |
|
| 419 | + $data['items'] = json_decode($data['items'], true); |
|
| 420 | + } |
|
| 414 | 421 | |
| 415 | 422 | # print_r($data['items']); |
| 416 | 423 | |
@@ -494,7 +501,9 @@ discard block |
||
| 494 | 501 | } |
| 495 | 502 | } |
| 496 | 503 | |
| 497 | - if (is_file($icon_file)) @unlink($icon_file); |
|
| 504 | + if (is_file($icon_file)) { |
|
| 505 | + @unlink($icon_file); |
|
| 506 | + } |
|
| 498 | 507 | |
| 499 | 508 | print $rc; |
| 500 | 509 | return; |
@@ -590,8 +599,9 @@ discard block |
||
| 590 | 599 | if (DB_TYPE == "pgsql") { |
| 591 | 600 | $feed_language = $row["feed_language"]; |
| 592 | 601 | |
| 593 | - if (!$feed_language) |
|
| 594 | - $feed_language = get_pref('DEFAULT_SEARCH_LANGUAGE'); |
|
| 602 | + if (!$feed_language) { |
|
| 603 | + $feed_language = get_pref('DEFAULT_SEARCH_LANGUAGE'); |
|
| 604 | + } |
|
| 595 | 605 | |
| 596 | 606 | print "<fieldset>"; |
| 597 | 607 | |
@@ -1404,11 +1414,13 @@ discard block |
||
| 1404 | 1414 | $obj = array(); |
| 1405 | 1415 | $feed_id = (int) $feed_id; |
| 1406 | 1416 | |
| 1407 | - if (!$title) |
|
| 1408 | - $title = Feeds::getFeedTitle($feed_id, false); |
|
| 1417 | + if (!$title) { |
|
| 1418 | + $title = Feeds::getFeedTitle($feed_id, false); |
|
| 1419 | + } |
|
| 1409 | 1420 | |
| 1410 | - if ($unread === false) |
|
| 1411 | - $unread = getFeedUnread($feed_id, false); |
|
| 1421 | + if ($unread === false) { |
|
| 1422 | + $unread = getFeedUnread($feed_id, false); |
|
| 1423 | + } |
|
| 1412 | 1424 | |
| 1413 | 1425 | $obj['id'] = 'FEED:' . $feed_id; |
| 1414 | 1426 | $obj['name'] = $title; |
@@ -1738,7 +1750,9 @@ discard block |
||
| 1738 | 1750 | |
| 1739 | 1751 | |
| 1740 | 1752 | private function update_feed_access_key($feed_id, $is_cat, $owner_uid = false) { |
| 1741 | - if (!$owner_uid) $owner_uid = $_SESSION["uid"]; |
|
| 1753 | + if (!$owner_uid) { |
|
| 1754 | + $owner_uid = $_SESSION["uid"]; |
|
| 1755 | + } |
|
| 1742 | 1756 | |
| 1743 | 1757 | // clear old value and generate new one |
| 1744 | 1758 | $sth = $this->pdo->prepare("DELETE FROM ttrss_access_keys |
@@ -1349,35 +1349,35 @@ |
||
| 1349 | 1349 | continue; |
| 1350 | 1350 | |
| 1351 | 1351 | switch ($rule["type"]) { |
| 1352 | - case "title": |
|
| 1353 | - $match = @preg_match("/$reg_exp/iu", $title); |
|
| 1354 | - break; |
|
| 1355 | - case "content": |
|
| 1356 | - // we don't need to deal with multiline regexps |
|
| 1357 | - $content = preg_replace("/[\r\n\t]/", "", $content); |
|
| 1352 | + case "title": |
|
| 1353 | + $match = @preg_match("/$reg_exp/iu", $title); |
|
| 1354 | + break; |
|
| 1355 | + case "content": |
|
| 1356 | + // we don't need to deal with multiline regexps |
|
| 1357 | + $content = preg_replace("/[\r\n\t]/", "", $content); |
|
| 1358 | 1358 | |
| 1359 | - $match = @preg_match("/$reg_exp/iu", $content); |
|
| 1360 | - break; |
|
| 1361 | - case "both": |
|
| 1362 | - // we don't need to deal with multiline regexps |
|
| 1363 | - $content = preg_replace("/[\r\n\t]/", "", $content); |
|
| 1359 | + $match = @preg_match("/$reg_exp/iu", $content); |
|
| 1360 | + break; |
|
| 1361 | + case "both": |
|
| 1362 | + // we don't need to deal with multiline regexps |
|
| 1363 | + $content = preg_replace("/[\r\n\t]/", "", $content); |
|
| 1364 | 1364 | |
| 1365 | - $match = (@preg_match("/$reg_exp/iu", $title) || @preg_match("/$reg_exp/iu", $content)); |
|
| 1366 | - break; |
|
| 1367 | - case "link": |
|
| 1368 | - $match = @preg_match("/$reg_exp/iu", $link); |
|
| 1369 | - break; |
|
| 1370 | - case "author": |
|
| 1371 | - $match = @preg_match("/$reg_exp/iu", $author); |
|
| 1372 | - break; |
|
| 1373 | - case "tag": |
|
| 1374 | - foreach ($tags as $tag) { |
|
| 1375 | - if (@preg_match("/$reg_exp/iu", $tag)) { |
|
| 1376 | - $match = true; |
|
| 1377 | - break; |
|
| 1378 | - } |
|
| 1365 | + $match = (@preg_match("/$reg_exp/iu", $title) || @preg_match("/$reg_exp/iu", $content)); |
|
| 1366 | + break; |
|
| 1367 | + case "link": |
|
| 1368 | + $match = @preg_match("/$reg_exp/iu", $link); |
|
| 1369 | + break; |
|
| 1370 | + case "author": |
|
| 1371 | + $match = @preg_match("/$reg_exp/iu", $author); |
|
| 1372 | + break; |
|
| 1373 | + case "tag": |
|
| 1374 | + foreach ($tags as $tag) { |
|
| 1375 | + if (@preg_match("/$reg_exp/iu", $tag)) { |
|
| 1376 | + $match = true; |
|
| 1377 | + break; |
|
| 1379 | 1378 | } |
| 1380 | - break; |
|
| 1379 | + } |
|
| 1380 | + break; |
|
| 1381 | 1381 | } |
| 1382 | 1382 | |
| 1383 | 1383 | if ($rule_inverse) $match = !$match; |
@@ -80,7 +80,9 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | // Update the least recently updated feeds first |
| 82 | 82 | $query_order = "ORDER BY last_updated"; |
| 83 | - if (DB_TYPE == "pgsql") $query_order .= " NULLS FIRST"; |
|
| 83 | + if (DB_TYPE == "pgsql") { |
|
| 84 | + $query_order .= " NULLS FIRST"; |
|
| 85 | + } |
|
| 84 | 86 | |
| 85 | 87 | $query = "SELECT DISTINCT ttrss_feeds.feed_url, ttrss_feeds.last_updated |
| 86 | 88 | FROM |
@@ -139,8 +141,9 @@ discard block |
||
| 139 | 141 | if ($tline = $usth->fetch()) { |
| 140 | 142 | Debug::log(" => " . $tline["last_updated"] . ", " . $tline["id"] . " " . $tline["owner_uid"]); |
| 141 | 143 | |
| 142 | - if (array_search($tline["owner_uid"], $batch_owners) === FALSE) |
|
| 143 | - array_push($batch_owners, $tline["owner_uid"]); |
|
| 144 | + if (array_search($tline["owner_uid"], $batch_owners) === FALSE) { |
|
| 145 | + array_push($batch_owners, $tline["owner_uid"]); |
|
| 146 | + } |
|
| 144 | 147 | |
| 145 | 148 | $fstarted = microtime(true); |
| 146 | 149 | |
@@ -311,11 +314,13 @@ discard block |
||
| 311 | 314 | |
| 312 | 315 | $feed_language = mb_strtolower($row["feed_language"]); |
| 313 | 316 | |
| 314 | - if (!$feed_language) |
|
| 315 | - $feed_language = mb_strtolower(get_pref('DEFAULT_SEARCH_LANGUAGE', $owner_uid)); |
|
| 317 | + if (!$feed_language) { |
|
| 318 | + $feed_language = mb_strtolower(get_pref('DEFAULT_SEARCH_LANGUAGE', $owner_uid)); |
|
| 319 | + } |
|
| 316 | 320 | |
| 317 | - if (!$feed_language) |
|
| 318 | - $feed_language = 'simple'; |
|
| 321 | + if (!$feed_language) { |
|
| 322 | + $feed_language = 'simple'; |
|
| 323 | + } |
|
| 319 | 324 | |
| 320 | 325 | } else { |
| 321 | 326 | return false; |
@@ -514,8 +519,9 @@ discard block |
||
| 514 | 519 | RSSUtils::check_feed_favicon($site_url, $feed); |
| 515 | 520 | $favicon_modified_new = @filemtime($favicon_file); |
| 516 | 521 | |
| 517 | - if ($favicon_modified_new > $favicon_modified) |
|
| 518 | - $favicon_avg_color = ''; |
|
| 522 | + if ($favicon_modified_new > $favicon_modified) { |
|
| 523 | + $favicon_avg_color = ''; |
|
| 524 | + } |
|
| 519 | 525 | |
| 520 | 526 | $favicon_colorstring = ""; |
| 521 | 527 | if (file_exists($favicon_file) && function_exists("imagecreatefromstring") && $favicon_avg_color == '') { |
@@ -578,8 +584,12 @@ discard block |
||
| 578 | 584 | } |
| 579 | 585 | |
| 580 | 586 | $entry_guid = strip_tags($item->get_id()); |
| 581 | - if (!$entry_guid) $entry_guid = strip_tags($item->get_link()); |
|
| 582 | - if (!$entry_guid) $entry_guid = RSSUtils::make_guid_from_title($item->get_title()); |
|
| 587 | + if (!$entry_guid) { |
|
| 588 | + $entry_guid = strip_tags($item->get_link()); |
|
| 589 | + } |
|
| 590 | + if (!$entry_guid) { |
|
| 591 | + $entry_guid = RSSUtils::make_guid_from_title($item->get_title()); |
|
| 592 | + } |
|
| 583 | 593 | |
| 584 | 594 | if (!$entry_guid) { |
| 585 | 595 | $pdo->commit(); |
@@ -606,10 +616,15 @@ discard block |
||
| 606 | 616 | Debug::log("link $entry_link", Debug::$LOG_VERBOSE); |
| 607 | 617 | Debug::log("language $entry_language", Debug::$LOG_VERBOSE); |
| 608 | 618 | |
| 609 | - if (!$entry_title) $entry_title = date("Y-m-d H:i:s", $entry_timestamp);; |
|
| 619 | + if (!$entry_title) { |
|
| 620 | + $entry_title = date("Y-m-d H:i:s", $entry_timestamp); |
|
| 621 | + } |
|
| 622 | + ; |
|
| 610 | 623 | |
| 611 | 624 | $entry_content = $item->get_content(); |
| 612 | - if (!$entry_content) $entry_content = $item->get_description(); |
|
| 625 | + if (!$entry_content) { |
|
| 626 | + $entry_content = $item->get_description(); |
|
| 627 | + } |
|
| 613 | 628 | |
| 614 | 629 | if (Debug::get_loglevel() >= 3) { |
| 615 | 630 | print "content: "; |
@@ -824,8 +839,9 @@ discard block |
||
| 824 | 839 | |
| 825 | 840 | Debug::log("force catchup: $entry_force_catchup", Debug::$LOG_VERBOSE); |
| 826 | 841 | |
| 827 | - if ($cache_images) |
|
| 828 | - RSSUtils::cache_media($entry_content, $site_url); |
|
| 842 | + if ($cache_images) { |
|
| 843 | + RSSUtils::cache_media($entry_content, $site_url); |
|
| 844 | + } |
|
| 829 | 845 | |
| 830 | 846 | $csth = $pdo->prepare("SELECT id FROM ttrss_entries |
| 831 | 847 | WHERE guid = ? OR guid = ?"); |
@@ -951,16 +967,18 @@ discard block |
||
| 951 | 967 | |
| 952 | 968 | $sth->execute([$ref_id, $owner_uid, $feed]); |
| 953 | 969 | |
| 954 | - if ($row = $sth->fetch()) |
|
| 955 | - $entry_int_id = $row['int_id']; |
|
| 970 | + if ($row = $sth->fetch()) { |
|
| 971 | + $entry_int_id = $row['int_id']; |
|
| 972 | + } |
|
| 956 | 973 | } |
| 957 | 974 | |
| 958 | 975 | Debug::log("resulting RID: $entry_ref_id, IID: $entry_int_id", Debug::$LOG_VERBOSE); |
| 959 | 976 | |
| 960 | - if (DB_TYPE == "pgsql") |
|
| 961 | - $tsvector_qpart = "tsvector_combined = to_tsvector(:ts_lang, :ts_content),"; |
|
| 962 | - else |
|
| 963 | - $tsvector_qpart = ""; |
|
| 977 | + if (DB_TYPE == "pgsql") { |
|
| 978 | + $tsvector_qpart = "tsvector_combined = to_tsvector(:ts_lang, :ts_content),"; |
|
| 979 | + } else { |
|
| 980 | + $tsvector_qpart = ""; |
|
| 981 | + } |
|
| 964 | 982 | |
| 965 | 983 | $sth = $pdo->prepare("UPDATE ttrss_entries |
| 966 | 984 | SET title = :title, |
@@ -1049,8 +1067,9 @@ discard block |
||
| 1049 | 1067 | } |
| 1050 | 1068 | } |
| 1051 | 1069 | |
| 1052 | - if ($cache_images) |
|
| 1053 | - RSSUtils::cache_enclosures($enclosures, $site_url); |
|
| 1070 | + if ($cache_images) { |
|
| 1071 | + RSSUtils::cache_enclosures($enclosures, $site_url); |
|
| 1072 | + } |
|
| 1054 | 1073 | |
| 1055 | 1074 | if (Debug::get_loglevel() >= Debug::$LOG_EXTENDED) { |
| 1056 | 1075 | Debug::log("article enclosures:", Debug::$LOG_VERBOSE); |
@@ -1345,8 +1364,9 @@ discard block |
||
| 1345 | 1364 | $reg_exp = str_replace('/', '\/', $rule["reg_exp"]); |
| 1346 | 1365 | $rule_inverse = $rule["inverse"]; |
| 1347 | 1366 | |
| 1348 | - if (!$reg_exp) |
|
| 1349 | - continue; |
|
| 1367 | + if (!$reg_exp) { |
|
| 1368 | + continue; |
|
| 1369 | + } |
|
| 1350 | 1370 | |
| 1351 | 1371 | switch ($rule["type"]) { |
| 1352 | 1372 | case "title": |
@@ -1380,7 +1400,9 @@ discard block |
||
| 1380 | 1400 | break; |
| 1381 | 1401 | } |
| 1382 | 1402 | |
| 1383 | - if ($rule_inverse) $match = !$match; |
|
| 1403 | + if ($rule_inverse) { |
|
| 1404 | + $match = !$match; |
|
| 1405 | + } |
|
| 1384 | 1406 | |
| 1385 | 1407 | if ($match_any_rule) { |
| 1386 | 1408 | if ($match) { |
@@ -1395,17 +1417,25 @@ discard block |
||
| 1395 | 1417 | } |
| 1396 | 1418 | } |
| 1397 | 1419 | |
| 1398 | - if ($inverse) $filter_match = !$filter_match; |
|
| 1420 | + if ($inverse) { |
|
| 1421 | + $filter_match = !$filter_match; |
|
| 1422 | + } |
|
| 1399 | 1423 | |
| 1400 | 1424 | if ($filter_match) { |
| 1401 | - if (is_array($matched_rules)) array_push($matched_rules, $rule); |
|
| 1402 | - if (is_array($matched_filters)) array_push($matched_filters, $filter); |
|
| 1425 | + if (is_array($matched_rules)) { |
|
| 1426 | + array_push($matched_rules, $rule); |
|
| 1427 | + } |
|
| 1428 | + if (is_array($matched_filters)) { |
|
| 1429 | + array_push($matched_filters, $filter); |
|
| 1430 | + } |
|
| 1403 | 1431 | |
| 1404 | 1432 | foreach ($filter["actions"] AS $action) { |
| 1405 | 1433 | array_push($matches, $action); |
| 1406 | 1434 | |
| 1407 | 1435 | // if Stop action encountered, perform no further processing |
| 1408 | - if (isset($action["type"]) && $action["type"] == "stop") return $matches; |
|
| 1436 | + if (isset($action["type"]) && $action["type"] == "stop") { |
|
| 1437 | + return $matches; |
|
| 1438 | + } |
|
| 1409 | 1439 | } |
| 1410 | 1440 | } |
| 1411 | 1441 | } |
@@ -1531,24 +1561,19 @@ discard block |
||
| 1531 | 1561 | if (preg_match('/^\x00\x00\x01\x00/', $contents)) { |
| 1532 | 1562 | // 0 string \000\000\001\000 MS Windows icon resource |
| 1533 | 1563 | //error_log("check_feed_favicon: favicon_url=$favicon_url isa MS Windows icon resource"); |
| 1534 | - } |
|
| 1535 | - elseif (preg_match('/^GIF8/', $contents)) { |
|
| 1564 | + } elseif (preg_match('/^GIF8/', $contents)) { |
|
| 1536 | 1565 | // 0 string GIF8 GIF image data |
| 1537 | 1566 | //error_log("check_feed_favicon: favicon_url=$favicon_url isa GIF image"); |
| 1538 | - } |
|
| 1539 | - elseif (preg_match('/^\x89PNG\x0d\x0a\x1a\x0a/', $contents)) { |
|
| 1567 | + } elseif (preg_match('/^\x89PNG\x0d\x0a\x1a\x0a/', $contents)) { |
|
| 1540 | 1568 | // 0 string \x89PNG\x0d\x0a\x1a\x0a PNG image data |
| 1541 | 1569 | //error_log("check_feed_favicon: favicon_url=$favicon_url isa PNG image"); |
| 1542 | - } |
|
| 1543 | - elseif (preg_match('/^\xff\xd8/', $contents)) { |
|
| 1570 | + } elseif (preg_match('/^\xff\xd8/', $contents)) { |
|
| 1544 | 1571 | // 0 beshort 0xffd8 JPEG image data |
| 1545 | 1572 | //error_log("check_feed_favicon: favicon_url=$favicon_url isa JPG image"); |
| 1546 | - } |
|
| 1547 | - elseif (preg_match('/^BM/', $contents)) { |
|
| 1573 | + } elseif (preg_match('/^BM/', $contents)) { |
|
| 1548 | 1574 | // 0 string BM PC bitmap (OS2, Windows BMP files) |
| 1549 | 1575 | //error_log("check_feed_favicon, favicon_url=$favicon_url isa BMP image"); |
| 1550 | - } |
|
| 1551 | - else { |
|
| 1576 | + } else { |
|
| 1552 | 1577 | //error_log("check_feed_favicon: favicon_url=$favicon_url isa UNKNOWN type"); |
| 1553 | 1578 | $contents = ""; |
| 1554 | 1579 | } |
@@ -1579,10 +1604,11 @@ discard block |
||
| 1579 | 1604 | $feed_id = (int) $feed_id; |
| 1580 | 1605 | $cat_id = (int)Feeds::getFeedCategory($feed_id); |
| 1581 | 1606 | |
| 1582 | - if ($cat_id == 0) |
|
| 1583 | - $null_cat_qpart = "cat_id IS NULL OR"; |
|
| 1584 | - else |
|
| 1585 | - $null_cat_qpart = ""; |
|
| 1607 | + if ($cat_id == 0) { |
|
| 1608 | + $null_cat_qpart = "cat_id IS NULL OR"; |
|
| 1609 | + } else { |
|
| 1610 | + $null_cat_qpart = ""; |
|
| 1611 | + } |
|
| 1586 | 1612 | |
| 1587 | 1613 | $pdo = Db::pdo(); |
| 1588 | 1614 | |
@@ -1718,8 +1744,9 @@ discard block |
||
| 1718 | 1744 | } |
| 1719 | 1745 | } |
| 1720 | 1746 | |
| 1721 | - if (!$favicon_url) |
|
| 1722 | - $favicon_url = rewrite_relative_url($url, "/favicon.ico"); |
|
| 1747 | + if (!$favicon_url) { |
|
| 1748 | + $favicon_url = rewrite_relative_url($url, "/favicon.ico"); |
|
| 1749 | + } |
|
| 1723 | 1750 | |
| 1724 | 1751 | return $favicon_url; |
| 1725 | 1752 | } |
@@ -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); |