@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | |
| 15 | 15 | return $this->link; |
| 16 | 16 | } else { |
| 17 | - print("Unable to connect to database (as $user to $host, database $db): " . mysqli_connect_error()); |
|
| 17 | + print("Unable to connect to database (as $user to $host, database $db): ".mysqli_connect_error()); |
|
| 18 | 18 | exit(102); |
| 19 | 19 | } |
| 20 | 20 | } |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | $this->last_error = @mysqli_error($this->link); |
| 32 | 32 | |
| 33 | 33 | @mysqli_query($this->link, "ROLLBACK"); |
| 34 | - user_error("Query $query failed: " . ($this->link ? $this->last_error : "No connection"), |
|
| 34 | + user_error("Query $query failed: ".($this->link ? $this->last_error : "No connection"), |
|
| 35 | 35 | $die_on_error ? E_USER_ERROR : E_USER_WARNING); |
| 36 | 36 | } |
| 37 | 37 | |
@@ -4,10 +4,11 @@ discard block |
||
| 4 | 4 | private $last_error; |
| 5 | 5 | |
| 6 | 6 | function connect($host, $user, $pass, $db, $port) { |
| 7 | - if ($port) |
|
| 8 | - $this->link = mysqli_connect($host, $user, $pass, $db, $port); |
|
| 9 | - else |
|
| 10 | - $this->link = mysqli_connect($host, $user, $pass, $db); |
|
| 7 | + if ($port) { |
|
| 8 | + $this->link = mysqli_connect($host, $user, $pass, $db, $port); |
|
| 9 | + } else { |
|
| 10 | + $this->link = mysqli_connect($host, $user, $pass, $db); |
|
| 11 | + } |
|
| 11 | 12 | |
| 12 | 13 | if ($this->link) { |
| 13 | 14 | $this->init(); |
@@ -20,7 +21,9 @@ discard block |
||
| 20 | 21 | } |
| 21 | 22 | |
| 22 | 23 | function escape_string($s, $strip_tags = true) { |
| 23 | - if ($strip_tags) $s = strip_tags($s); |
|
| 24 | + if ($strip_tags) { |
|
| 25 | + $s = strip_tags($s); |
|
| 26 | + } |
|
| 24 | 27 | |
| 25 | 28 | return mysqli_real_escape_string($this->link, $s); |
| 26 | 29 | } |
@@ -15,13 +15,13 @@ discard block |
||
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | if (is_numeric($port) && $port > 0) { |
| 18 | - $string = "$string port=" . $port; |
|
| 18 | + $string = "$string port=".$port; |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | $this->link = pg_connect($string); |
| 22 | 22 | |
| 23 | 23 | if (!$this->link) { |
| 24 | - print("Unable to connect to database (as $user to $host, database $db):" . pg_last_error()); |
|
| 24 | + print("Unable to connect to database (as $user to $host, database $db):".pg_last_error()); |
|
| 25 | 25 | exit(102); |
| 26 | 26 | } |
| 27 | 27 | |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | @pg_query($this->link, "ROLLBACK"); |
| 46 | 46 | $query = htmlspecialchars($query); // just in case |
| 47 | - user_error("Query $query failed: " . ($this->link ? $this->last_error : "No connection"), |
|
| 47 | + user_error("Query $query failed: ".($this->link ? $this->last_error : "No connection"), |
|
| 48 | 48 | $die_on_error ? E_USER_ERROR : E_USER_WARNING); |
| 49 | 49 | } |
| 50 | 50 | return $result; |
@@ -31,7 +31,9 @@ |
||
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | function escape_string($s, $strip_tags = true) { |
| 34 | - if ($strip_tags) $s = strip_tags($s); |
|
| 34 | + if ($strip_tags) { |
|
| 35 | + $s = strip_tags($s); |
|
| 36 | + } |
|
| 35 | 37 | |
| 36 | 38 | return pg_escape_string($s); |
| 37 | 39 | } |
@@ -597,7 +597,7 @@ |
||
| 597 | 597 | "title" => $line["title"], |
| 598 | 598 | "unread" => $unread, |
| 599 | 599 | "is_cat" => true, |
| 600 | - "order_id" => (int) $line["order_id"] |
|
| 600 | + "order_id" => (int) $line["order_id"] |
|
| 601 | 601 | ); |
| 602 | 602 | array_push($feeds, $row); |
| 603 | 603 | } |
@@ -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); |
@@ -74,11 +74,11 @@ discard block |
||
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | if (get_pref("ENABLE_API_ACCESS", $uid)) { |
| 77 | - if (authenticate_user($login, $password, false, Auth_Base::AUTH_SERVICE_API)) { // try login with normal password |
|
| 77 | + if (authenticate_user($login, $password, false, Auth_Base::AUTH_SERVICE_API)) { // try login with normal password |
|
| 78 | 78 | $this->wrap(self::STATUS_OK, array("session_id" => session_id(), |
| 79 | 79 | "api_level" => self::API_LEVEL)); |
| 80 | 80 | } else if (authenticate_user($login, $password_base64, false, Auth_Base::AUTH_SERVICE_API)) { // else try with base64_decoded password |
| 81 | - $this->wrap(self::STATUS_OK, array("session_id" => session_id(), |
|
| 81 | + $this->wrap(self::STATUS_OK, array("session_id" => session_id(), |
|
| 82 | 82 | "api_level" => self::API_LEVEL)); |
| 83 | 83 | } else { // else we are not logged in |
| 84 | 84 | user_error("Failed login attempt for $login from {$_SERVER['REMOTE_ADDR']}", E_USER_WARNING); |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | } |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | - foreach (array(-2,-1,0) as $cat_id) { |
|
| 172 | + foreach (array(-2, -1, 0) as $cat_id) { |
|
| 173 | 173 | if ($include_empty || !$this->isCategoryEmpty($cat_id)) { |
| 174 | 174 | $unread = getFeedUnread($cat_id, true); |
| 175 | 175 | |
@@ -190,11 +190,11 @@ discard block |
||
| 190 | 190 | |
| 191 | 191 | if (is_numeric($feed_id)) $feed_id = (int) $feed_id; |
| 192 | 192 | |
| 193 | - $limit = (int)clean($_REQUEST["limit"]); |
|
| 193 | + $limit = (int) clean($_REQUEST["limit"]); |
|
| 194 | 194 | |
| 195 | 195 | if (!$limit || $limit >= 200) $limit = 200; |
| 196 | 196 | |
| 197 | - $offset = (int)clean($_REQUEST["skip"]); |
|
| 197 | + $offset = (int) clean($_REQUEST["skip"]); |
|
| 198 | 198 | $filter = clean($_REQUEST["filter"]); |
| 199 | 199 | $is_cat = API::param_to_bool(clean($_REQUEST["is_cat"])); |
| 200 | 200 | $show_excerpt = API::param_to_bool(clean($_REQUEST["show_excerpt"])); |
@@ -202,14 +202,14 @@ discard block |
||
| 202 | 202 | /* all_articles, unread, adaptive, marked, updated */ |
| 203 | 203 | $view_mode = clean($_REQUEST["view_mode"]); |
| 204 | 204 | $include_attachments = API::param_to_bool(clean($_REQUEST["include_attachments"])); |
| 205 | - $since_id = (int)clean($_REQUEST["since_id"]); |
|
| 205 | + $since_id = (int) clean($_REQUEST["since_id"]); |
|
| 206 | 206 | $include_nested = API::param_to_bool(clean($_REQUEST["include_nested"])); |
| 207 | 207 | $sanitize_content = !isset($_REQUEST["sanitize"]) || |
| 208 | 208 | API::param_to_bool($_REQUEST["sanitize"]); |
| 209 | 209 | $force_update = API::param_to_bool(clean($_REQUEST["force_update"])); |
| 210 | 210 | $has_sandbox = API::param_to_bool(clean($_REQUEST["has_sandbox"])); |
| 211 | - $excerpt_length = (int)clean($_REQUEST["excerpt_length"]); |
|
| 212 | - $check_first_id = (int)clean($_REQUEST["check_first_id"]); |
|
| 211 | + $excerpt_length = (int) clean($_REQUEST["excerpt_length"]); |
|
| 212 | + $check_first_id = (int) clean($_REQUEST["check_first_id"]); |
|
| 213 | 213 | $include_header = API::param_to_bool(clean($_REQUEST["include_header"])); |
| 214 | 214 | |
| 215 | 215 | $_SESSION['hasSandbox'] = $has_sandbox; |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | $article_ids = explode(",", clean($_REQUEST["article_ids"])); |
| 254 | 254 | $mode = (int) clean($_REQUEST["mode"]); |
| 255 | 255 | $data = clean($_REQUEST["data"]); |
| 256 | - $field_raw = (int)clean($_REQUEST["field"]); |
|
| 256 | + $field_raw = (int) clean($_REQUEST["field"]); |
|
| 257 | 257 | |
| 258 | 258 | $field = ""; |
| 259 | 259 | $set_to = ""; |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | "updated" => (int) strtotime($line["updated"]), |
| 361 | 361 | "feed_id" => $line["feed_id"], |
| 362 | 362 | "attachments" => $attachments, |
| 363 | - "score" => (int)$line["score"], |
|
| 363 | + "score" => (int) $line["score"], |
|
| 364 | 364 | "feed_title" => $line["feed_title"], |
| 365 | 365 | "note" => $line["note"], |
| 366 | 366 | "lang" => $line["lang"] |
@@ -434,7 +434,7 @@ discard block |
||
| 434 | 434 | } |
| 435 | 435 | |
| 436 | 436 | function getLabels() { |
| 437 | - $article_id = (int)clean($_REQUEST['article_id']); |
|
| 437 | + $article_id = (int) clean($_REQUEST['article_id']); |
|
| 438 | 438 | |
| 439 | 439 | $rv = array(); |
| 440 | 440 | |
@@ -459,7 +459,7 @@ discard block |
||
| 459 | 459 | } |
| 460 | 460 | |
| 461 | 461 | array_push($rv, array( |
| 462 | - "id" => (int)Labels::label_to_feed_id($line['id']), |
|
| 462 | + "id" => (int) Labels::label_to_feed_id($line['id']), |
|
| 463 | 463 | "caption" => $line['caption'], |
| 464 | 464 | "fg_color" => $line['fg_color'], |
| 465 | 465 | "bg_color" => $line['bg_color'], |
@@ -644,10 +644,10 @@ discard block |
||
| 644 | 644 | $row = array( |
| 645 | 645 | "feed_url" => $line["feed_url"], |
| 646 | 646 | "title" => $line["title"], |
| 647 | - "id" => (int)$line["id"], |
|
| 648 | - "unread" => (int)$unread, |
|
| 647 | + "id" => (int) $line["id"], |
|
| 648 | + "unread" => (int) $unread, |
|
| 649 | 649 | "has_icon" => $has_icon, |
| 650 | - "cat_id" => (int)$line["cat_id"], |
|
| 650 | + "cat_id" => (int) $line["cat_id"], |
|
| 651 | 651 | "last_updated" => (int) strtotime($line["last_updated"]), |
| 652 | 652 | "order_id" => (int) $line["order_id"], |
| 653 | 653 | ); |
@@ -748,12 +748,12 @@ discard block |
||
| 748 | 748 | if (!is_array($labels)) $labels = Article::get_article_labels($line["id"]); |
| 749 | 749 | |
| 750 | 750 | $headline_row = array( |
| 751 | - "id" => (int)$line["id"], |
|
| 751 | + "id" => (int) $line["id"], |
|
| 752 | 752 | "guid" => $line["guid"], |
| 753 | 753 | "unread" => API::param_to_bool($line["unread"]), |
| 754 | 754 | "marked" => API::param_to_bool($line["marked"]), |
| 755 | 755 | "published" => API::param_to_bool($line["published"]), |
| 756 | - "updated" => (int)strtotime($line["updated"]), |
|
| 756 | + "updated" => (int) strtotime($line["updated"]), |
|
| 757 | 757 | "is_updated" => $is_updated, |
| 758 | 758 | "title" => $line["title"], |
| 759 | 759 | "link" => $line["link"], |
@@ -786,17 +786,16 @@ discard block |
||
| 786 | 786 | |
| 787 | 787 | $headline_row["labels"] = $labels; |
| 788 | 788 | |
| 789 | - $headline_row["feed_title"] = $line["feed_title"] ? $line["feed_title"] : |
|
| 790 | - $feed_title; |
|
| 789 | + $headline_row["feed_title"] = $line["feed_title"] ? $line["feed_title"] : $feed_title; |
|
| 791 | 790 | |
| 792 | - $headline_row["comments_count"] = (int)$line["num_comments"]; |
|
| 791 | + $headline_row["comments_count"] = (int) $line["num_comments"]; |
|
| 793 | 792 | $headline_row["comments_link"] = $line["comments"]; |
| 794 | 793 | |
| 795 | 794 | $headline_row["always_display_attachments"] = API::param_to_bool($line["always_display_enclosures"]); |
| 796 | 795 | |
| 797 | 796 | $headline_row["author"] = $line["author"]; |
| 798 | 797 | |
| 799 | - $headline_row["score"] = (int)$line["score"]; |
|
| 798 | + $headline_row["score"] = (int) $line["score"]; |
|
| 800 | 799 | $headline_row["note"] = $line["note"]; |
| 801 | 800 | $headline_row["lang"] = $line["lang"]; |
| 802 | 801 | |
@@ -858,7 +857,7 @@ discard block |
||
| 858 | 857 | $_REQUEST['mode'] = 2; |
| 859 | 858 | $_REQUEST['force_show_empty'] = $include_empty; |
| 860 | 859 | |
| 861 | - if ($pf){ |
|
| 860 | + if ($pf) { |
|
| 862 | 861 | $data = $pf->makefeedtree(); |
| 863 | 862 | $this->wrap(self::STATUS_OK, array("categories" => $data)); |
| 864 | 863 | } else { |
@@ -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; |
@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | class Backend extends Handler { |
| 3 | 3 | function loading() { |
| 4 | 4 | header("Content-type: text/html"); |
| 5 | - print __("Loading, please wait...") . " " . |
|
| 5 | + print __("Loading, please wait...")." ". |
|
| 6 | 6 | "<img src='images/indicator_tiny.gif'>"; |
| 7 | 7 | } |
| 8 | 8 | |
@@ -34,12 +34,12 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | print "<ul class='panel panel-scrollable hotkeys-help' style='height : 300px'>"; |
| 36 | 36 | |
| 37 | - print "<h2>" . __("Keyboard Shortcuts") . "</h2>"; |
|
| 37 | + print "<h2>".__("Keyboard Shortcuts")."</h2>"; |
|
| 38 | 38 | |
| 39 | 39 | foreach ($info as $section => $hotkeys) { |
| 40 | 40 | |
| 41 | 41 | print "<li><hr></li>"; |
| 42 | - print "<li><h3>" . $section . "</h3></li>"; |
|
| 42 | + print "<li><h3>".$section."</h3></li>"; |
|
| 43 | 43 | |
| 44 | 44 | foreach ($hotkeys as $action => $description) { |
| 45 | 45 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | foreach ($omap[$action] as $sequence) { |
| 48 | 48 | if (strpos($sequence, "|") !== FALSE) { |
| 49 | 49 | $sequence = substr($sequence, |
| 50 | - strpos($sequence, "|")+1, |
|
| 50 | + strpos($sequence, "|") + 1, |
|
| 51 | 51 | strlen($sequence)); |
| 52 | 52 | } else { |
| 53 | 53 | $keys = explode(" ", $sequence); |
@@ -58,10 +58,10 @@ discard block |
||
| 58 | 58 | foreach (str_split($keys[$i]) as $c) { |
| 59 | 59 | switch ($c) { |
| 60 | 60 | case '*': |
| 61 | - $tmp .= __('Shift') . '+'; |
|
| 61 | + $tmp .= __('Shift').'+'; |
|
| 62 | 62 | break; |
| 63 | 63 | case '^': |
| 64 | - $tmp .= __('Ctrl') . '+'; |
|
| 64 | + $tmp .= __('Ctrl').'+'; |
|
| 65 | 65 | break; |
| 66 | 66 | default: |
| 67 | 67 | $tmp .= $c; |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | foreach ($info as $section => $hotkeys) { |
| 108 | 108 | |
| 109 | 109 | if ($cur_section) print "<li> </li>"; |
| 110 | - print "<li><h3>" . $section . "</h3></li>"; |
|
| 110 | + print "<li><h3>".$section."</h3></li>"; |
|
| 111 | 111 | $cur_section = $section; |
| 112 | 112 | |
| 113 | 113 | foreach ($hotkeys as $action => $description) { |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | foreach ($omap[$action] as $sequence) { |
| 117 | 117 | if (strpos($sequence, "|") !== FALSE) { |
| 118 | 118 | $sequence = substr($sequence, |
| 119 | - strpos($sequence, "|")+1, |
|
| 119 | + strpos($sequence, "|") + 1, |
|
| 120 | 120 | strlen($sequence)); |
| 121 | 121 | } else { |
| 122 | 122 | $keys = explode(" ", $sequence); |
@@ -127,10 +127,10 @@ discard block |
||
| 127 | 127 | foreach (str_split($keys[$i]) as $c) { |
| 128 | 128 | switch ($c) { |
| 129 | 129 | case '*': |
| 130 | - $tmp .= __('Shift') . '+'; |
|
| 130 | + $tmp .= __('Shift').'+'; |
|
| 131 | 131 | break; |
| 132 | 132 | case '^': |
| 133 | - $tmp .= __('Ctrl') . '+'; |
|
| 133 | + $tmp .= __('Ctrl').'+'; |
|
| 134 | 134 | break; |
| 135 | 135 | default: |
| 136 | 136 | $tmp .= $c; |
@@ -27,7 +27,9 @@ discard block |
||
| 27 | 27 | $omap = array(); |
| 28 | 28 | |
| 29 | 29 | foreach ($imap[1] as $sequence => $action) { |
| 30 | - if (!isset($omap[$action])) $omap[$action] = array(); |
|
| 30 | + if (!isset($omap[$action])) { |
|
| 31 | + $omap[$action] = array(); |
|
| 32 | + } |
|
| 31 | 33 | |
| 32 | 34 | array_push($omap[$action], $sequence); |
| 33 | 35 | } |
@@ -96,7 +98,9 @@ discard block |
||
| 96 | 98 | $omap = array(); |
| 97 | 99 | |
| 98 | 100 | foreach ($imap[1] as $sequence => $action) { |
| 99 | - if (!isset($omap[$action])) $omap[$action] = array(); |
|
| 101 | + if (!isset($omap[$action])) { |
|
| 102 | + $omap[$action] = array(); |
|
| 103 | + } |
|
| 100 | 104 | |
| 101 | 105 | array_push($omap[$action], $sequence); |
| 102 | 106 | } |
@@ -106,7 +110,9 @@ discard block |
||
| 106 | 110 | $cur_section = ""; |
| 107 | 111 | foreach ($info as $section => $hotkeys) { |
| 108 | 112 | |
| 109 | - if ($cur_section) print "<li> </li>"; |
|
| 113 | + if ($cur_section) { |
|
| 114 | + print "<li> </li>"; |
|
| 115 | + } |
|
| 110 | 116 | print "<li><h3>" . $section . "</h3></li>"; |
| 111 | 117 | $cur_section = $section; |
| 112 | 118 | |
@@ -60,14 +60,14 @@ discard block |
||
| 60 | 60 | $line[$k] = htmlspecialchars($v); |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | - print "<td class='errno'>" . Logger::$errornames[$line["errno"]] . " (" . $line["errno"] . ")</td>"; |
|
| 64 | - print "<td class='filename'>" . $line["filename"] . ":" . $line["lineno"] . "</td>"; |
|
| 65 | - print "<td class='errstr'>" . $line["errstr"] . "<hr/>" . nl2br($line["context"]) . "</td>"; |
|
| 66 | - print "<td class='login'>" . $line["login"] . "</td>"; |
|
| 63 | + print "<td class='errno'>".Logger::$errornames[$line["errno"]]." (".$line["errno"].")</td>"; |
|
| 64 | + print "<td class='filename'>".$line["filename"].":".$line["lineno"]."</td>"; |
|
| 65 | + print "<td class='errstr'>".$line["errstr"]."<hr/>".nl2br($line["context"])."</td>"; |
|
| 66 | + print "<td class='login'>".$line["login"]."</td>"; |
|
| 67 | 67 | |
| 68 | - print "<td class='timestamp'>" . |
|
| 68 | + print "<td class='timestamp'>". |
|
| 69 | 69 | make_local_datetime( |
| 70 | - $line["created_at"], false) . "</td>"; |
|
| 70 | + $line["created_at"], false)."</td>"; |
|
| 71 | 71 | |
| 72 | 72 | print "</tr>"; |
| 73 | 73 | } |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | ob_end_clean(); |
| 91 | 91 | |
| 92 | 92 | print "<div class='phpinfo'>"; |
| 93 | - print preg_replace( '%^.*<body>(.*)</body>.*$%ms','$1', $info); |
|
| 93 | + print preg_replace('%^.*<body>(.*)</body>.*$%ms', '$1', $info); |
|
| 94 | 94 | print "</div>"; |
| 95 | 95 | |
| 96 | 96 | print "</div>"; |
@@ -1060,8 +1060,8 @@ |
||
| 1060 | 1060 | $authenticator = PluginHost::getInstance()->get_plugin($_SESSION["auth_module"]); |
| 1061 | 1061 | |
| 1062 | 1062 | if ($authenticator && |
| 1063 | - method_exists($authenticator, "check_password") && |
|
| 1064 | - $authenticator->check_password($_SESSION["uid"], "password")) { |
|
| 1063 | + method_exists($authenticator, "check_password") && |
|
| 1064 | + $authenticator->check_password($_SESSION["uid"], "password")) { |
|
| 1065 | 1065 | |
| 1066 | 1066 | return true; |
| 1067 | 1067 | } |
@@ -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); |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | "ENABLE_API_ACCESS" => array(__("Enable API"), __("Allows accessing this account through the API")), |
| 83 | 83 | "ENABLE_FEED_CATS" => array(__("Enable categories")), |
| 84 | 84 | "FEEDS_SORT_BY_UNREAD" => array(__("Sort feeds by unread articles count"), ""), |
| 85 | - "FRESH_ARTICLE_MAX_AGE" => array(__("Maximum age of fresh articles"), "<strong>" . __("hours") . "</strong>"), |
|
| 85 | + "FRESH_ARTICLE_MAX_AGE" => array(__("Maximum age of fresh articles"), "<strong>".__("hours")."</strong>"), |
|
| 86 | 86 | "HIDE_READ_FEEDS" => array(__("Hide read feeds")), |
| 87 | 87 | "HIDE_READ_SHOWS_SPECIAL" => array(__("Always show special feeds"), __("While hiding read feeds")), |
| 88 | 88 | "LONG_DATE_FORMAT" => array(__("Long date format"), __("Syntax is identical to PHP <a href='http://php.net/manual/function.date.php'>date()</a> function.")), |
@@ -403,7 +403,7 @@ discard block |
||
| 403 | 403 | |
| 404 | 404 | if ($_SESSION["auth_module"] == "auth_internal") { |
| 405 | 405 | |
| 406 | - print "<div dojoType='dijit.layout.ContentPane' title=\"" . __('App passwords') . "\">"; |
|
| 406 | + print "<div dojoType='dijit.layout.ContentPane' title=\"".__('App passwords')."\">"; |
|
| 407 | 407 | |
| 408 | 408 | print_notice("You can create separate passwords for API clients. Using one is required if you enable OTP."); |
| 409 | 409 | |
@@ -415,11 +415,11 @@ discard block |
||
| 415 | 415 | |
| 416 | 416 | print "<button style='float : left' class='alt-primary' dojoType='dijit.form.Button' |
| 417 | 417 | onclick=\"Helpers.AppPasswords.generate()\">" . |
| 418 | - __('Generate new password') . "</button> "; |
|
| 418 | + __('Generate new password')."</button> "; |
|
| 419 | 419 | |
| 420 | 420 | print "<button style='float : left' class='alt-danger' dojoType='dijit.form.Button' |
| 421 | 421 | onclick=\"Helpers.AppPasswords.removeSelected()\">" . |
| 422 | - __('Remove selected passwords') . "</button>"; |
|
| 422 | + __('Remove selected passwords')."</button>"; |
|
| 423 | 423 | |
| 424 | 424 | print "</div>"; # content pane |
| 425 | 425 | } |
@@ -474,13 +474,13 @@ discard block |
||
| 474 | 474 | print_notice("You will need to generate app passwords for the API clients if you enable OTP."); |
| 475 | 475 | |
| 476 | 476 | if (function_exists("imagecreatefromstring")) { |
| 477 | - print "<h3>" . __("Scan the following code by the Authenticator application or copy the key manually") . "</h3>"; |
|
| 477 | + print "<h3>".__("Scan the following code by the Authenticator application or copy the key manually")."</h3>"; |
|
| 478 | 478 | |
| 479 | 479 | $csrf_token = $_SESSION["csrf_token"]; |
| 480 | 480 | print "<img alt='otp qr-code' src='backend.php?op=pref-prefs&method=otpqrcode&csrf_token=$csrf_token'>"; |
| 481 | 481 | } else { |
| 482 | 482 | print_error("PHP GD functions are required to generate QR codes."); |
| 483 | - print "<h3>" . __("Use the following OTP key with a compatible Authenticator application") . "</h3>"; |
|
| 483 | + print "<h3>".__("Use the following OTP key with a compatible Authenticator application")."</h3>"; |
|
| 484 | 484 | } |
| 485 | 485 | |
| 486 | 486 | print "<form dojoType='dijit.form.Form' id='changeOtpForm'>"; |
@@ -647,7 +647,7 @@ discard block |
||
| 647 | 647 | print "<fieldset class='prefs'>"; |
| 648 | 648 | |
| 649 | 649 | print "<label for='CB_$pref_name'>"; |
| 650 | - print $item['short_desc'] . ":"; |
|
| 650 | + print $item['short_desc'].":"; |
|
| 651 | 651 | print "</label>"; |
| 652 | 652 | |
| 653 | 653 | $value = $item['value']; |
@@ -684,7 +684,7 @@ discard block |
||
| 684 | 684 | print "</select>"; |
| 685 | 685 | |
| 686 | 686 | print " <button dojoType=\"dijit.form.Button\" class='alt-info' |
| 687 | - onclick=\"Helpers.customizeCSS()\">" . __('Customize') . "</button>"; |
|
| 687 | + onclick=\"Helpers.customizeCSS()\">" . __('Customize')."</button>"; |
|
| 688 | 688 | |
| 689 | 689 | print " <button dojoType='dijit.form.Button' onclick='window.open(\"https://tt-rss.org/wiki/Themes\")'> |
| 690 | 690 | <i class='material-icons'>open_in_new</i> ".__("More themes...")."</button>"; |
@@ -747,12 +747,12 @@ discard block |
||
| 747 | 747 | $has_serial = ($cert_serial) ? "false" : "true"; |
| 748 | 748 | |
| 749 | 749 | print "<button dojoType='dijit.form.Button' disabled='$has_serial' |
| 750 | - onclick=\"dijit.byId('SSL_CERT_SERIAL').attr('value', '$cert_serial')\">" . |
|
| 751 | - __('Register') . "</button>"; |
|
| 750 | + onclick=\"dijit.byId('SSL_CERT_SERIAL').attr('value', '$cert_serial')\">". |
|
| 751 | + __('Register')."</button>"; |
|
| 752 | 752 | |
| 753 | 753 | print "<button dojoType='dijit.form.Button' class='alt-danger' |
| 754 | 754 | onclick=\"dijit.byId('SSL_CERT_SERIAL').attr('value', '')\">" . |
| 755 | - __('Clear') . "</button>"; |
|
| 755 | + __('Clear')."</button>"; |
|
| 756 | 756 | |
| 757 | 757 | print "<button dojoType='dijit.form.Button' class='alt-info' |
| 758 | 758 | onclick='window.open(\"https://tt-rss.org/wiki/SSL%20Certificate%20Authentication\")'> |
@@ -763,7 +763,7 @@ discard block |
||
| 763 | 763 | id=\"$pref_name\" regexp=\"[012]?\d:\d\d\" placeHolder=\"12:00\" |
| 764 | 764 | name=\"$pref_name\" value=\"$value\">"; |
| 765 | 765 | |
| 766 | - $item['help_text'] .= ". " . T_sprintf("Current server time: %s", date("H:i")); |
|
| 766 | + $item['help_text'] .= ". ".T_sprintf("Current server time: %s", date("H:i")); |
|
| 767 | 767 | } else { |
| 768 | 768 | $regexp = ($type_name == 'integer') ? 'regexp="^\d*$"' : ''; |
| 769 | 769 | |
@@ -849,7 +849,7 @@ discard block |
||
| 849 | 849 | print_warning("Your PHP configuration has open_basedir restrictions enabled. Some plugins relying on CURL for functionality may not work correctly."); |
| 850 | 850 | } |
| 851 | 851 | |
| 852 | - $feed_handler_whitelist = [ "Af_Comics" ]; |
|
| 852 | + $feed_handler_whitelist = ["Af_Comics"]; |
|
| 853 | 853 | |
| 854 | 854 | $feed_handlers = array_merge( |
| 855 | 855 | PluginHost::getInstance()->get_hooks(PluginHost::HOOK_FEED_FETCHED), |
@@ -861,9 +861,9 @@ discard block |
||
| 861 | 861 | |
| 862 | 862 | if (count($feed_handlers) > 0) { |
| 863 | 863 | print_error( |
| 864 | - T_sprintf("The following plugins use per-feed content hooks. This may cause excessive data usage and origin server load resulting in a ban of your instance: <b>%s</b>" , |
|
| 864 | + T_sprintf("The following plugins use per-feed content hooks. This may cause excessive data usage and origin server load resulting in a ban of your instance: <b>%s</b>", |
|
| 865 | 865 | implode(", ", array_map(function($plugin) { return get_class($plugin); }, $feed_handlers)) |
| 866 | - ) . " (<a href='https://tt-rss.org/wiki/FeedHandlerPlugins' target='_blank'>".__("More info...")."</a>)" |
|
| 866 | + )." (<a href='https://tt-rss.org/wiki/FeedHandlerPlugins' target='_blank'>".__("More info...")."</a>)" |
|
| 867 | 867 | ); |
| 868 | 868 | } |
| 869 | 869 | |
@@ -892,7 +892,7 @@ discard block |
||
| 892 | 892 | <label class='checkbox description text-muted' id='PLABEL-$name'> |
| 893 | 893 | <input disabled='1' |
| 894 | 894 | dojoType='dijit.form.CheckBox' $checked type='checkbox'> |
| 895 | - ".htmlspecialchars($about[1]). "</label>"; |
|
| 895 | + ".htmlspecialchars($about[1])."</label>"; |
|
| 896 | 896 | |
| 897 | 897 | if (@$about[4]) { |
| 898 | 898 | print "<button dojoType='dijit.form.Button' class='alt-info' |
@@ -1159,7 +1159,7 @@ discard block |
||
| 1159 | 1159 | print "<div dojoType='fox.Toolbar'>"; |
| 1160 | 1160 | |
| 1161 | 1161 | print "<div dojoType='fox.form.DropDownButton'>". |
| 1162 | - "<span>" . __('Select')."</span>"; |
|
| 1162 | + "<span>".__('Select')."</span>"; |
|
| 1163 | 1163 | print "<div dojoType='dijit.Menu' style='display: none'>"; |
| 1164 | 1164 | print "<div onclick=\"Tables.select('pref-profiles-list', true)\" |
| 1165 | 1165 | dojoType='dijit.MenuItem'>".__('All')."</div>"; |
@@ -1197,7 +1197,7 @@ discard block |
||
| 1197 | 1197 | $is_active = ""; |
| 1198 | 1198 | } |
| 1199 | 1199 | |
| 1200 | - print "<td width='100%'><span>" . __("Default profile") . " $is_active</span></td>"; |
|
| 1200 | + print "<td width='100%'><span>".__("Default profile")." $is_active</span></td>"; |
|
| 1201 | 1201 | |
| 1202 | 1202 | print "</tr>"; |
| 1203 | 1203 | |
@@ -1219,7 +1219,7 @@ discard block |
||
| 1219 | 1219 | |
| 1220 | 1220 | print "<td><span dojoType='dijit.InlineEditBox' |
| 1221 | 1221 | width='300px' autoSave='false' |
| 1222 | - profile-id='$profile_id'>" . $edit_title . |
|
| 1222 | + profile-id='$profile_id'>".$edit_title. |
|
| 1223 | 1223 | "<script type='dojo/method' event='onChange' args='item'> |
| 1224 | 1224 | var elem = this; |
| 1225 | 1225 | dojo.xhrPost({ |
@@ -1268,13 +1268,13 @@ discard block |
||
| 1268 | 1268 | |
| 1269 | 1269 | private function appPasswordList() { |
| 1270 | 1270 | print "<div dojoType='fox.Toolbar'>"; |
| 1271 | - print "<div dojoType='fox.form.DropDownButton'>" . |
|
| 1272 | - "<span>" . __('Select') . "</span>"; |
|
| 1271 | + print "<div dojoType='fox.form.DropDownButton'>". |
|
| 1272 | + "<span>".__('Select')."</span>"; |
|
| 1273 | 1273 | print "<div dojoType='dijit.Menu' style='display: none'>"; |
| 1274 | 1274 | print "<div onclick=\"Tables.select('app-password-list', true)\" |
| 1275 | - dojoType=\"dijit.MenuItem\">" . __('All') . "</div>"; |
|
| 1275 | + dojoType=\"dijit.MenuItem\">" . __('All')."</div>"; |
|
| 1276 | 1276 | print "<div onclick=\"Tables.select('app-password-list', false)\" |
| 1277 | - dojoType=\"dijit.MenuItem\">" . __('None') . "</div>"; |
|
| 1277 | + dojoType=\"dijit.MenuItem\">" . __('None')."</div>"; |
|
| 1278 | 1278 | print "</div></div>"; |
| 1279 | 1279 | print "</div>"; #toolbar |
| 1280 | 1280 | |
@@ -1299,7 +1299,7 @@ discard block |
||
| 1299 | 1299 | |
| 1300 | 1300 | print "<td align='center'> |
| 1301 | 1301 | <input onclick='Tables.onRowChecked(this)' dojoType='dijit.form.CheckBox' type='checkbox'></td>"; |
| 1302 | - print "<td>" . htmlspecialchars($row["title"]) . "</td>"; |
|
| 1302 | + print "<td>".htmlspecialchars($row["title"])."</td>"; |
|
| 1303 | 1303 | |
| 1304 | 1304 | print "<td align='right' class='text-muted'>"; |
| 1305 | 1305 | print make_local_datetime($row['created'], false); |
@@ -1319,7 +1319,7 @@ discard block |
||
| 1319 | 1319 | private function encryptAppPassword($password) { |
| 1320 | 1320 | $salt = substr(bin2hex(get_random_bytes(24)), 0, 24); |
| 1321 | 1321 | |
| 1322 | - return "SSHA-512:".hash('sha512', $salt . $password). ":$salt"; |
|
| 1322 | + return "SSHA-512:".hash('sha512', $salt.$password).":$salt"; |
|
| 1323 | 1323 | } |
| 1324 | 1324 | |
| 1325 | 1325 | function deleteAppPassword() { |
@@ -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 | } |
@@ -1113,10 +1124,11 @@ discard block |
||
| 1113 | 1124 | } |
| 1114 | 1125 | |
| 1115 | 1126 | function setplugins() { |
| 1116 | - if (is_array(clean($_REQUEST["plugins"]))) |
|
| 1117 | - $plugins = join(",", clean($_REQUEST["plugins"])); |
|
| 1118 | - else |
|
| 1119 | - $plugins = ""; |
|
| 1127 | + if (is_array(clean($_REQUEST["plugins"]))) { |
|
| 1128 | + $plugins = join(",", clean($_REQUEST["plugins"])); |
|
| 1129 | + } else { |
|
| 1130 | + $plugins = ""; |
|
| 1131 | + } |
|
| 1120 | 1132 | |
| 1121 | 1133 | set_pref("_ENABLED_PLUGINS", $plugins); |
| 1122 | 1134 | } |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | print "</section>"; |
| 37 | 37 | |
| 38 | - print "<header>" . __("Colors") . "</header>"; |
|
| 38 | + print "<header>".__("Colors")."</header>"; |
|
| 39 | 39 | print "<section>"; |
| 40 | 40 | |
| 41 | 41 | print "<table>"; |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | while ($line = $sth->fetch()) { |
| 95 | 95 | $label = array(); |
| 96 | - $label['id'] = 'LABEL:' . $line['id']; |
|
| 96 | + $label['id'] = 'LABEL:'.$line['id']; |
|
| 97 | 97 | $label['bare_id'] = $line['id']; |
| 98 | 98 | $label['name'] = $line['caption']; |
| 99 | 99 | $label['fg_color'] = $line['fg_color']; |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | print "<div dojoType='fox.Toolbar'>"; |
| 255 | 255 | |
| 256 | 256 | print "<div dojoType='fox.form.DropDownButton'>". |
| 257 | - "<span>" . __('Select')."</span>"; |
|
| 257 | + "<span>".__('Select')."</span>"; |
|
| 258 | 258 | print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">"; |
| 259 | 259 | print "<div onclick=\"dijit.byId('labelTree').model.setAllChecked(true)\" |
| 260 | 260 | dojoType=\"dijit.MenuItem\">".__('All')."</div>"; |
@@ -1573,8 +1573,8 @@ |
||
| 1573 | 1573 | static function remove_feed($id, $owner_uid) { |
| 1574 | 1574 | foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_UNSUBSCRIBE_FEED) as $p) { |
| 1575 | 1575 | if (! $p->hook_unsubscribe_feed($id, $owner_uid)) { |
| 1576 | - user_error("Feed $id (owner: $owner_uid) not removed due to plugin error (HOOK_UNSUBSCRIBE_FEED).", E_USER_WARNING); |
|
| 1577 | - return; |
|
| 1576 | + user_error("Feed $id (owner: $owner_uid) not removed due to plugin error (HOOK_UNSUBSCRIBE_FEED).", E_USER_WARNING); |
|
| 1577 | + return; |
|
| 1578 | 1578 | } |
| 1579 | 1579 | } |
| 1580 | 1580 | |
@@ -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 | |
@@ -60,8 +60,8 @@ discard block |
||
| 60 | 60 | while ($line = $sth->fetch()) { |
| 61 | 61 | |
| 62 | 62 | $cat = array(); |
| 63 | - $cat['id'] = 'CAT:' . $line['id']; |
|
| 64 | - $cat['bare_id'] = (int)$line['id']; |
|
| 63 | + $cat['id'] = 'CAT:'.$line['id']; |
|
| 64 | + $cat['bare_id'] = (int) $line['id']; |
|
| 65 | 65 | $cat['name'] = $line['title']; |
| 66 | 66 | $cat['items'] = array(); |
| 67 | 67 | $cat['checkbox'] = false; |
@@ -93,8 +93,8 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | while ($feed_line = $fsth->fetch()) { |
| 95 | 95 | $feed = array(); |
| 96 | - $feed['id'] = 'FEED:' . $feed_line['id']; |
|
| 97 | - $feed['bare_id'] = (int)$feed_line['id']; |
|
| 96 | + $feed['id'] = 'FEED:'.$feed_line['id']; |
|
| 97 | + $feed['bare_id'] = (int) $feed_line['id']; |
|
| 98 | 98 | $feed['auxcounter'] = -1; |
| 99 | 99 | $feed['name'] = $feed_line['title']; |
| 100 | 100 | $feed['checkbox'] = false; |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | $feed['icon'] = Feeds::getFeedIcon($feed_line['id']); |
| 104 | 104 | $feed['param'] = make_local_datetime( |
| 105 | 105 | $feed_line['last_updated'], true); |
| 106 | - $feed['updates_disabled'] = (int)($feed_line['update_interval'] < 0); |
|
| 106 | + $feed['updates_disabled'] = (int) ($feed_line['update_interval'] < 0); |
|
| 107 | 107 | |
| 108 | 108 | array_push($items, $feed); |
| 109 | 109 | } |
@@ -151,8 +151,8 @@ discard block |
||
| 151 | 151 | $feed_id = PluginHost::pfeed_to_feed_id($feed['id']); |
| 152 | 152 | |
| 153 | 153 | $item = array(); |
| 154 | - $item['id'] = 'FEED:' . $feed_id; |
|
| 155 | - $item['bare_id'] = (int)$feed_id; |
|
| 154 | + $item['id'] = 'FEED:'.$feed_id; |
|
| 155 | + $item['bare_id'] = (int) $feed_id; |
|
| 156 | 156 | $item['auxcounter'] = -1; |
| 157 | 157 | $item['name'] = $feed['title']; |
| 158 | 158 | $item['checkbox'] = false; |
@@ -216,8 +216,8 @@ discard block |
||
| 216 | 216 | |
| 217 | 217 | while ($line = $sth->fetch()) { |
| 218 | 218 | $cat = array(); |
| 219 | - $cat['id'] = 'CAT:' . $line['id']; |
|
| 220 | - $cat['bare_id'] = (int)$line['id']; |
|
| 219 | + $cat['id'] = 'CAT:'.$line['id']; |
|
| 220 | + $cat['bare_id'] = (int) $line['id']; |
|
| 221 | 221 | $cat['auxcounter'] = -1; |
| 222 | 222 | $cat['name'] = $line['title']; |
| 223 | 223 | $cat['items'] = array(); |
@@ -261,8 +261,8 @@ discard block |
||
| 261 | 261 | |
| 262 | 262 | while ($feed_line = $fsth->fetch()) { |
| 263 | 263 | $feed = array(); |
| 264 | - $feed['id'] = 'FEED:' . $feed_line['id']; |
|
| 265 | - $feed['bare_id'] = (int)$feed_line['id']; |
|
| 264 | + $feed['id'] = 'FEED:'.$feed_line['id']; |
|
| 265 | + $feed['bare_id'] = (int) $feed_line['id']; |
|
| 266 | 266 | $feed['auxcounter'] = -1; |
| 267 | 267 | $feed['name'] = $feed_line['title']; |
| 268 | 268 | $feed['checkbox'] = false; |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | $feed_line['last_updated'], true); |
| 273 | 273 | $feed['unread'] = -1; |
| 274 | 274 | $feed['type'] = 'feed'; |
| 275 | - $feed['updates_disabled'] = (int)($feed_line['update_interval'] < 0); |
|
| 275 | + $feed['updates_disabled'] = (int) ($feed_line['update_interval'] < 0); |
|
| 276 | 276 | |
| 277 | 277 | array_push($cat['items'], $feed); |
| 278 | 278 | } |
@@ -296,8 +296,8 @@ discard block |
||
| 296 | 296 | |
| 297 | 297 | while ($feed_line = $fsth->fetch()) { |
| 298 | 298 | $feed = array(); |
| 299 | - $feed['id'] = 'FEED:' . $feed_line['id']; |
|
| 300 | - $feed['bare_id'] = (int)$feed_line['id']; |
|
| 299 | + $feed['id'] = 'FEED:'.$feed_line['id']; |
|
| 300 | + $feed['bare_id'] = (int) $feed_line['id']; |
|
| 301 | 301 | $feed['auxcounter'] = -1; |
| 302 | 302 | $feed['name'] = $feed_line['title']; |
| 303 | 303 | $feed['checkbox'] = false; |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | $feed_line['last_updated'], true); |
| 308 | 308 | $feed['unread'] = -1; |
| 309 | 309 | $feed['type'] = 'feed'; |
| 310 | - $feed['updates_disabled'] = (int)($feed_line['update_interval'] < 0); |
|
| 310 | + $feed['updates_disabled'] = (int) ($feed_line['update_interval'] < 0); |
|
| 311 | 311 | |
| 312 | 312 | array_push($root['items'], $feed); |
| 313 | 313 | } |
@@ -348,11 +348,11 @@ discard block |
||
| 348 | 348 | |
| 349 | 349 | Debug::log("$prefix C: $item_id P: $parent_id"); |
| 350 | 350 | |
| 351 | - $bare_item_id = substr($item_id, strpos($item_id, ':')+1); |
|
| 351 | + $bare_item_id = substr($item_id, strpos($item_id, ':') + 1); |
|
| 352 | 352 | |
| 353 | 353 | if ($item_id != 'root') { |
| 354 | 354 | if ($parent_id && $parent_id != 'root') { |
| 355 | - $parent_bare_id = substr($parent_id, strpos($parent_id, ':')+1); |
|
| 355 | + $parent_bare_id = substr($parent_id, strpos($parent_id, ':') + 1); |
|
| 356 | 356 | $parent_qpart = $parent_bare_id; |
| 357 | 357 | } else { |
| 358 | 358 | $parent_qpart = null; |
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | if ($cat && is_array($cat)) { |
| 372 | 372 | foreach ($cat as $item) { |
| 373 | 373 | $id = $item['_reference']; |
| 374 | - $bare_id = substr($id, strpos($id, ':')+1); |
|
| 374 | + $bare_id = substr($id, strpos($id, ':') + 1); |
|
| 375 | 375 | |
| 376 | 376 | Debug::log("$prefix [$order_id] $id/$bare_id"); |
| 377 | 377 | |
@@ -389,7 +389,7 @@ discard block |
||
| 389 | 389 | |
| 390 | 390 | } else if (strpos($id, "CAT:") === 0) { |
| 391 | 391 | $this->process_category_order($data_map, $item['_reference'], $item_id, |
| 392 | - $nest_level+1); |
|
| 392 | + $nest_level + 1); |
|
| 393 | 393 | |
| 394 | 394 | $sth = $this->pdo->prepare("UPDATE ttrss_feed_categories |
| 395 | 395 | SET order_id = ? WHERE id = ? AND |
@@ -447,7 +447,7 @@ discard block |
||
| 447 | 447 | $sth->execute([$feed_id, $_SESSION['uid']]); |
| 448 | 448 | |
| 449 | 449 | if ($row = $sth->fetch()) { |
| 450 | - @unlink(ICONS_DIR . "/$feed_id.ico"); |
|
| 450 | + @unlink(ICONS_DIR."/$feed_id.ico"); |
|
| 451 | 451 | |
| 452 | 452 | $sth = $this->pdo->prepare("UPDATE ttrss_feeds SET favicon_avg_color = NULL |
| 453 | 453 | where id = ?"); |
@@ -459,7 +459,7 @@ discard block |
||
| 459 | 459 | header("Content-type: text/html"); |
| 460 | 460 | |
| 461 | 461 | if (is_uploaded_file($_FILES['icon_file']['tmp_name'])) { |
| 462 | - $tmp_file = tempnam(CACHE_DIR . '/upload', 'icon'); |
|
| 462 | + $tmp_file = tempnam(CACHE_DIR.'/upload', 'icon'); |
|
| 463 | 463 | |
| 464 | 464 | $result = move_uploaded_file($_FILES['icon_file']['tmp_name'], |
| 465 | 465 | $tmp_file); |
@@ -483,8 +483,8 @@ discard block |
||
| 483 | 483 | $sth->execute([$feed_id, $_SESSION['uid']]); |
| 484 | 484 | |
| 485 | 485 | if ($row = $sth->fetch()) { |
| 486 | - @unlink(ICONS_DIR . "/$feed_id.ico"); |
|
| 487 | - if (rename($icon_file, ICONS_DIR . "/$feed_id.ico")) { |
|
| 486 | + @unlink(ICONS_DIR."/$feed_id.ico"); |
|
| 487 | + if (rename($icon_file, ICONS_DIR."/$feed_id.ico")) { |
|
| 488 | 488 | |
| 489 | 489 | $sth = $this->pdo->prepare("UPDATE ttrss_feeds SET |
| 490 | 490 | favicon_avg_color = '' |
@@ -545,7 +545,7 @@ discard block |
||
| 545 | 545 | |
| 546 | 546 | print "<fieldset>"; |
| 547 | 547 | |
| 548 | - print "<label>" . __('URL:') . "</label> "; |
|
| 548 | + print "<label>".__('URL:')."</label> "; |
|
| 549 | 549 | print "<input dojoType='dijit.form.ValidationTextBox' required='1' |
| 550 | 550 | placeHolder=\"".__("Feed URL")."\" |
| 551 | 551 | regExp='^(http|https)://.*' style='width : 300px' |
@@ -568,7 +568,7 @@ discard block |
||
| 568 | 568 | |
| 569 | 569 | print "<fieldset>"; |
| 570 | 570 | |
| 571 | - print "<label>" . __('Place in category:') . "</label> "; |
|
| 571 | + print "<label>".__('Place in category:')."</label> "; |
|
| 572 | 572 | |
| 573 | 573 | print_feed_cat_select("cat_id", $cat_id, |
| 574 | 574 | 'dojoType="fox.form.Select"'); |
@@ -582,7 +582,7 @@ discard block |
||
| 582 | 582 | |
| 583 | 583 | print "<fieldset>"; |
| 584 | 584 | |
| 585 | - print "<label>" . __('Site URL:') . "</label> "; |
|
| 585 | + print "<label>".__('Site URL:')."</label> "; |
|
| 586 | 586 | print "<input dojoType='dijit.form.ValidationTextBox' required='1' |
| 587 | 587 | placeHolder=\"".__("Site URL")."\" |
| 588 | 588 | regExp='^(http|https)://.*' style='width : 300px' |
@@ -600,7 +600,7 @@ discard block |
||
| 600 | 600 | |
| 601 | 601 | print "<fieldset>"; |
| 602 | 602 | |
| 603 | - print "<label>" . __('Language:') . "</label> "; |
|
| 603 | + print "<label>".__('Language:')."</label> "; |
|
| 604 | 604 | print_select("feed_language", $feed_language, $this::get_ts_languages(), |
| 605 | 605 | 'dojoType="fox.form.Select"'); |
| 606 | 606 | |
@@ -631,10 +631,10 @@ discard block |
||
| 631 | 631 | |
| 632 | 632 | print "<fieldset>"; |
| 633 | 633 | |
| 634 | - print "<label>" . __('Article purging:') . "</label> "; |
|
| 634 | + print "<label>".__('Article purging:')."</label> "; |
|
| 635 | 635 | |
| 636 | 636 | print_select_hash("purge_interval", $purge_interval, $purge_intervals, |
| 637 | - 'dojoType="fox.form.Select" ' . |
|
| 637 | + 'dojoType="fox.form.Select" '. |
|
| 638 | 638 | ((FORCE_ARTICLE_PURGE == 0) ? "" : 'disabled="1"')); |
| 639 | 639 | |
| 640 | 640 | print "</fieldset>"; |
@@ -741,7 +741,7 @@ discard block |
||
| 741 | 741 | print "<fieldset class='narrow'>"; |
| 742 | 742 | |
| 743 | 743 | print "<label class='checkbox'><input dojoType='dijit.form.CheckBox' type='checkbox' id='cache_images' |
| 744 | - name='cache_images' $checked> ". __('Cache media')."</label>"; |
|
| 744 | + name='cache_images' $checked> ".__('Cache media')."</label>"; |
|
| 745 | 745 | |
| 746 | 746 | print "</fieldset>"; |
| 747 | 747 | |
@@ -823,7 +823,7 @@ discard block |
||
| 823 | 823 | |
| 824 | 824 | print "<fieldset>"; |
| 825 | 825 | |
| 826 | - print "<label>" . __('Place in category:') . "</label> "; |
|
| 826 | + print "<label>".__('Place in category:')."</label> "; |
|
| 827 | 827 | |
| 828 | 828 | print_feed_cat_select("cat_id", false, |
| 829 | 829 | 'disabled="1" dojoType="fox.form.Select"'); |
@@ -838,7 +838,7 @@ discard block |
||
| 838 | 838 | if (DB_TYPE == "pgsql") { |
| 839 | 839 | print "<fieldset>"; |
| 840 | 840 | |
| 841 | - print "<label>" . __('Language:') . "</label> "; |
|
| 841 | + print "<label>".__('Language:')."</label> "; |
|
| 842 | 842 | print_select("feed_language", "", $this::get_ts_languages(), |
| 843 | 843 | 'disabled="1" dojoType="fox.form.Select"'); |
| 844 | 844 | |
@@ -871,7 +871,7 @@ discard block |
||
| 871 | 871 | |
| 872 | 872 | print "<fieldset>"; |
| 873 | 873 | |
| 874 | - print "<label>" . __('Article purging:') . "</label> "; |
|
| 874 | + print "<label>".__('Article purging:')."</label> "; |
|
| 875 | 875 | |
| 876 | 876 | print_select_hash("purge_interval", "", $purge_intervals, |
| 877 | 877 | 'disabled="1" dojoType="fox.form.Select"'); |
@@ -1031,12 +1031,12 @@ discard block |
||
| 1031 | 1031 | ":purge_intl" => $purge_intl, |
| 1032 | 1032 | ":auth_login" => $auth_login, |
| 1033 | 1033 | ":auth_pass" => $auth_pass, |
| 1034 | - ":private" => (int)$private, |
|
| 1035 | - ":cache_images" => (int)$cache_images, |
|
| 1036 | - ":hide_images" => (int)$hide_images, |
|
| 1037 | - ":include_in_digest" => (int)$include_in_digest, |
|
| 1038 | - ":always_display_enclosures" => (int)$always_display_enclosures, |
|
| 1039 | - ":mark_unread_on_update" => (int)$mark_unread_on_update, |
|
| 1034 | + ":private" => (int) $private, |
|
| 1035 | + ":cache_images" => (int) $cache_images, |
|
| 1036 | + ":hide_images" => (int) $hide_images, |
|
| 1037 | + ":include_in_digest" => (int) $include_in_digest, |
|
| 1038 | + ":always_display_enclosures" => (int) $always_display_enclosures, |
|
| 1039 | + ":mark_unread_on_update" => (int) $mark_unread_on_update, |
|
| 1040 | 1040 | ":feed_language" => $feed_language, |
| 1041 | 1041 | ":id" => $feed_id, |
| 1042 | 1042 | ":uid" => $_SESSION['uid']]); |
@@ -1067,57 +1067,57 @@ discard block |
||
| 1067 | 1067 | |
| 1068 | 1068 | switch ($k) { |
| 1069 | 1069 | case "title": |
| 1070 | - $qpart = "title = " . $this->pdo->quote($feed_title); |
|
| 1070 | + $qpart = "title = ".$this->pdo->quote($feed_title); |
|
| 1071 | 1071 | break; |
| 1072 | 1072 | |
| 1073 | 1073 | case "feed_url": |
| 1074 | - $qpart = "feed_url = " . $this->pdo->quote($feed_url); |
|
| 1074 | + $qpart = "feed_url = ".$this->pdo->quote($feed_url); |
|
| 1075 | 1075 | break; |
| 1076 | 1076 | |
| 1077 | 1077 | case "update_interval": |
| 1078 | - $qpart = "update_interval = " . $this->pdo->quote($upd_intl); |
|
| 1078 | + $qpart = "update_interval = ".$this->pdo->quote($upd_intl); |
|
| 1079 | 1079 | break; |
| 1080 | 1080 | |
| 1081 | 1081 | case "purge_interval": |
| 1082 | - $qpart = "purge_interval =" . $this->pdo->quote($purge_intl); |
|
| 1082 | + $qpart = "purge_interval =".$this->pdo->quote($purge_intl); |
|
| 1083 | 1083 | break; |
| 1084 | 1084 | |
| 1085 | 1085 | case "auth_login": |
| 1086 | - $qpart = "auth_login = " . $this->pdo->quote($auth_login); |
|
| 1086 | + $qpart = "auth_login = ".$this->pdo->quote($auth_login); |
|
| 1087 | 1087 | break; |
| 1088 | 1088 | |
| 1089 | 1089 | case "auth_pass": |
| 1090 | - $qpart = "auth_pass =" . $this->pdo->quote($auth_pass). ", auth_pass_encrypted = false"; |
|
| 1090 | + $qpart = "auth_pass =".$this->pdo->quote($auth_pass).", auth_pass_encrypted = false"; |
|
| 1091 | 1091 | break; |
| 1092 | 1092 | |
| 1093 | 1093 | case "private": |
| 1094 | - $qpart = "private = " . $this->pdo->quote($private); |
|
| 1094 | + $qpart = "private = ".$this->pdo->quote($private); |
|
| 1095 | 1095 | break; |
| 1096 | 1096 | |
| 1097 | 1097 | case "include_in_digest": |
| 1098 | - $qpart = "include_in_digest = " . $this->pdo->quote($include_in_digest); |
|
| 1098 | + $qpart = "include_in_digest = ".$this->pdo->quote($include_in_digest); |
|
| 1099 | 1099 | break; |
| 1100 | 1100 | |
| 1101 | 1101 | case "always_display_enclosures": |
| 1102 | - $qpart = "always_display_enclosures = " . $this->pdo->quote($always_display_enclosures); |
|
| 1102 | + $qpart = "always_display_enclosures = ".$this->pdo->quote($always_display_enclosures); |
|
| 1103 | 1103 | break; |
| 1104 | 1104 | |
| 1105 | 1105 | case "mark_unread_on_update": |
| 1106 | - $qpart = "mark_unread_on_update = " . $this->pdo->quote($mark_unread_on_update); |
|
| 1106 | + $qpart = "mark_unread_on_update = ".$this->pdo->quote($mark_unread_on_update); |
|
| 1107 | 1107 | break; |
| 1108 | 1108 | |
| 1109 | 1109 | case "cache_images": |
| 1110 | - $qpart = "cache_images = " . $this->pdo->quote($cache_images); |
|
| 1110 | + $qpart = "cache_images = ".$this->pdo->quote($cache_images); |
|
| 1111 | 1111 | break; |
| 1112 | 1112 | |
| 1113 | 1113 | case "hide_images": |
| 1114 | - $qpart = "hide_images = " . $this->pdo->quote($hide_images); |
|
| 1114 | + $qpart = "hide_images = ".$this->pdo->quote($hide_images); |
|
| 1115 | 1115 | break; |
| 1116 | 1116 | |
| 1117 | 1117 | case "cat_id": |
| 1118 | 1118 | if (get_pref('ENABLE_FEED_CATS')) { |
| 1119 | 1119 | if ($cat_id) { |
| 1120 | - $qpart = "cat_id = " . $this->pdo->quote($cat_id); |
|
| 1120 | + $qpart = "cat_id = ".$this->pdo->quote($cat_id); |
|
| 1121 | 1121 | } else { |
| 1122 | 1122 | $qpart = 'cat_id = NULL'; |
| 1123 | 1123 | } |
@@ -1128,7 +1128,7 @@ discard block |
||
| 1128 | 1128 | break; |
| 1129 | 1129 | |
| 1130 | 1130 | case "feed_language": |
| 1131 | - $qpart = "feed_language = " . $this->pdo->quote($feed_language); |
|
| 1131 | + $qpart = "feed_language = ".$this->pdo->quote($feed_language); |
|
| 1132 | 1132 | break; |
| 1133 | 1133 | |
| 1134 | 1134 | } |
@@ -1189,14 +1189,14 @@ discard block |
||
| 1189 | 1189 | |
| 1190 | 1190 | $error_button = "<button dojoType=\"dijit.form.Button\" |
| 1191 | 1191 | onclick=\"CommonDialogs.showFeedsWithErrors()\" id=\"errorButton\">" . |
| 1192 | - __("Feeds with errors") . "</button>"; |
|
| 1192 | + __("Feeds with errors")."</button>"; |
|
| 1193 | 1193 | } |
| 1194 | 1194 | |
| 1195 | 1195 | $inactive_button = "<button dojoType=\"dijit.form.Button\" |
| 1196 | 1196 | id=\"pref_feeds_inactive_btn\" |
| 1197 | 1197 | style=\"display : none\" |
| 1198 | 1198 | onclick=\"dijit.byId('feedTree').showInactiveFeeds()\">" . |
| 1199 | - __("Inactive feeds") . "</button>"; |
|
| 1199 | + __("Inactive feeds")."</button>"; |
|
| 1200 | 1200 | |
| 1201 | 1201 | $feed_search = clean($_REQUEST["search"]); |
| 1202 | 1202 | |
@@ -1218,7 +1218,7 @@ discard block |
||
| 1218 | 1218 | </div>"; |
| 1219 | 1219 | |
| 1220 | 1220 | print "<div dojoType=\"fox.form.DropDownButton\">". |
| 1221 | - "<span>" . __('Select')."</span>"; |
|
| 1221 | + "<span>".__('Select')."</span>"; |
|
| 1222 | 1222 | print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">"; |
| 1223 | 1223 | print "<div onclick=\"dijit.byId('feedTree').model.setAllChecked(true)\" |
| 1224 | 1224 | dojoType=\"dijit.MenuItem\">".__('All')."</div>"; |
@@ -1227,7 +1227,7 @@ discard block |
||
| 1227 | 1227 | print "</div></div>"; |
| 1228 | 1228 | |
| 1229 | 1229 | print "<div dojoType=\"fox.form.DropDownButton\">". |
| 1230 | - "<span>" . __('Feeds')."</span>"; |
|
| 1230 | + "<span>".__('Feeds')."</span>"; |
|
| 1231 | 1231 | print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">"; |
| 1232 | 1232 | print "<div onclick=\"CommonDialogs.quickAddFeed()\" |
| 1233 | 1233 | dojoType=\"dijit.MenuItem\">".__('Subscribe to feed')."</div>"; |
@@ -1243,7 +1243,7 @@ discard block |
||
| 1243 | 1243 | |
| 1244 | 1244 | if (get_pref('ENABLE_FEED_CATS')) { |
| 1245 | 1245 | print "<div dojoType=\"fox.form.DropDownButton\">". |
| 1246 | - "<span>" . __('Categories')."</span>"; |
|
| 1246 | + "<span>".__('Categories')."</span>"; |
|
| 1247 | 1247 | print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">"; |
| 1248 | 1248 | print "<div onclick=\"dijit.byId('feedTree').createCategory()\" |
| 1249 | 1249 | dojoType=\"dijit.MenuItem\">".__('Add category')."</div>"; |
@@ -1310,7 +1310,7 @@ discard block |
||
| 1310 | 1310 | print "<div dojoType='dijit.layout.AccordionPane' |
| 1311 | 1311 | title='<i class=\"material-icons\">import_export</i> ".__('OPML')."'>"; |
| 1312 | 1312 | |
| 1313 | - print "<h3>" . __("Using OPML you can export and import your feeds, filters, labels and Tiny Tiny RSS settings.") . "</h3>"; |
|
| 1313 | + print "<h3>".__("Using OPML you can export and import your feeds, filters, labels and Tiny Tiny RSS settings.")."</h3>"; |
|
| 1314 | 1314 | |
| 1315 | 1315 | print_notice("Only main settings profile can be migrated using OPML."); |
| 1316 | 1316 | |
@@ -1327,7 +1327,7 @@ discard block |
||
| 1327 | 1327 | <input type='hidden' name='op' value='dlg'> |
| 1328 | 1328 | <input type='hidden' name='method' value='importOpml'> |
| 1329 | 1329 | <button dojoType='dijit.form.Button' class='alt-primary' onclick=\"return Helpers.OPML.import();\" type=\"submit\">" . |
| 1330 | - __('Import OPML') . "</button>"; |
|
| 1330 | + __('Import OPML')."</button>"; |
|
| 1331 | 1331 | |
| 1332 | 1332 | print "</form>"; |
| 1333 | 1333 | |
@@ -1335,22 +1335,22 @@ discard block |
||
| 1335 | 1335 | |
| 1336 | 1336 | print "<button dojoType='dijit.form.Button' |
| 1337 | 1337 | onclick='Helpers.OPML.export()' >" . |
| 1338 | - __('Export OPML') . "</button>"; |
|
| 1338 | + __('Export OPML')."</button>"; |
|
| 1339 | 1339 | |
| 1340 | 1340 | print " <label class='checkbox'>"; |
| 1341 | 1341 | print_checkbox("include_settings", true, "1", ""); |
| 1342 | - print " " . __("Include settings"); |
|
| 1342 | + print " ".__("Include settings"); |
|
| 1343 | 1343 | print "</label>"; |
| 1344 | 1344 | |
| 1345 | 1345 | print "</form>"; |
| 1346 | 1346 | |
| 1347 | 1347 | print "<p/>"; |
| 1348 | 1348 | |
| 1349 | - print "<h2>" . __("Published OPML") . "</h2>"; |
|
| 1349 | + print "<h2>".__("Published OPML")."</h2>"; |
|
| 1350 | 1350 | |
| 1351 | - print "<p>" . __('Your OPML can be published publicly and can be subscribed by anyone who knows the URL below.') . |
|
| 1352 | - " " . |
|
| 1353 | - __("Published OPML does not include your Tiny Tiny RSS settings, feeds that require authentication or feeds hidden from Popular feeds.") . "</p>"; |
|
| 1351 | + print "<p>".__('Your OPML can be published publicly and can be subscribed by anyone who knows the URL below.'). |
|
| 1352 | + " ". |
|
| 1353 | + __("Published OPML does not include your Tiny Tiny RSS settings, feeds that require authentication or feeds hidden from Popular feeds.")."</p>"; |
|
| 1354 | 1354 | |
| 1355 | 1355 | print "<button dojoType='dijit.form.Button' class='alt-primary' onclick=\"return App.displayDlg('".__("Public OPML URL")."','pubOPMLUrl')\">". |
| 1356 | 1356 | __('Display published OPML URL')."</button> "; |
@@ -1363,10 +1363,10 @@ discard block |
||
| 1363 | 1363 | print "<div dojoType=\"dijit.layout.AccordionPane\" |
| 1364 | 1364 | title=\"<i class='material-icons'>share</i> ".__('Published & shared articles / Generated feeds')."\">"; |
| 1365 | 1365 | |
| 1366 | - print "<h3>" . __('Published articles can be subscribed by anyone who knows the following URL:') . "</h3>"; |
|
| 1366 | + print "<h3>".__('Published articles can be subscribed by anyone who knows the following URL:')."</h3>"; |
|
| 1367 | 1367 | |
| 1368 | - $rss_url = '-2::' . htmlspecialchars(get_self_url_prefix() . |
|
| 1369 | - "/public.php?op=rss&id=-2&view-mode=all_articles");; |
|
| 1368 | + $rss_url = '-2::'.htmlspecialchars(get_self_url_prefix(). |
|
| 1369 | + "/public.php?op=rss&id=-2&view-mode=all_articles"); ; |
|
| 1370 | 1370 | |
| 1371 | 1371 | print "<button dojoType='dijit.form.Button' class='alt-primary' onclick=\"return App.displayDlg('".__("Show as feed")."','generatedFeed', '$rss_url')\">". |
| 1372 | 1372 | __('Display URL')."</button> "; |
@@ -1395,7 +1395,7 @@ discard block |
||
| 1395 | 1395 | $cat_unread = Feeds::getCategoryUnread($cat_id); |
| 1396 | 1396 | } |
| 1397 | 1397 | |
| 1398 | - $obj['id'] = 'CAT:' . $cat_id; |
|
| 1398 | + $obj['id'] = 'CAT:'.$cat_id; |
|
| 1399 | 1399 | $obj['items'] = array(); |
| 1400 | 1400 | $obj['name'] = Feeds::getCategoryTitle($cat_id); |
| 1401 | 1401 | $obj['type'] = 'category'; |
@@ -1415,7 +1415,7 @@ discard block |
||
| 1415 | 1415 | if ($unread === false) |
| 1416 | 1416 | $unread = getFeedUnread($feed_id, false); |
| 1417 | 1417 | |
| 1418 | - $obj['id'] = 'FEED:' . $feed_id; |
|
| 1418 | + $obj['id'] = 'FEED:'.$feed_id; |
|
| 1419 | 1419 | $obj['name'] = $title; |
| 1420 | 1420 | $obj['unread'] = (int) $unread; |
| 1421 | 1421 | $obj['type'] = 'feed'; |
@@ -1451,7 +1451,7 @@ discard block |
||
| 1451 | 1451 | |
| 1452 | 1452 | print "<div dojoType='fox.Toolbar'>"; |
| 1453 | 1453 | print "<div dojoType='fox.form.DropDownButton'>". |
| 1454 | - "<span>" . __('Select')."</span>"; |
|
| 1454 | + "<span>".__('Select')."</span>"; |
|
| 1455 | 1455 | print "<div dojoType='dijit.Menu' style='display: none'>"; |
| 1456 | 1456 | print "<div onclick=\"Tables.select('inactive-feeds-list', true)\" |
| 1457 | 1457 | dojoType='dijit.MenuItem'>".__('All')."</div>"; |
@@ -1508,7 +1508,7 @@ discard block |
||
| 1508 | 1508 | |
| 1509 | 1509 | print "<div dojoType=\"fox.Toolbar\">"; |
| 1510 | 1510 | print "<div dojoType=\"fox.form.DropDownButton\">". |
| 1511 | - "<span>" . __('Select')."</span>"; |
|
| 1511 | + "<span>".__('Select')."</span>"; |
|
| 1512 | 1512 | print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">"; |
| 1513 | 1513 | print "<div onclick=\"Tables.select('error-feeds-list', true)\" |
| 1514 | 1514 | dojoType=\"dijit.MenuItem\">".__('All')."</div>"; |
@@ -1572,7 +1572,7 @@ discard block |
||
| 1572 | 1572 | |
| 1573 | 1573 | static function remove_feed($id, $owner_uid) { |
| 1574 | 1574 | foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_UNSUBSCRIBE_FEED) as $p) { |
| 1575 | - if (! $p->hook_unsubscribe_feed($id, $owner_uid)) { |
|
| 1575 | + if (!$p->hook_unsubscribe_feed($id, $owner_uid)) { |
|
| 1576 | 1576 | user_error("Feed $id (owner: $owner_uid) not removed due to plugin error (HOOK_UNSUBSCRIBE_FEED).", E_USER_WARNING); |
| 1577 | 1577 | return; |
| 1578 | 1578 | } |
@@ -1604,7 +1604,7 @@ discard block |
||
| 1604 | 1604 | $res = $pdo->query("SELECT MAX(id) AS id FROM ttrss_archived_feeds"); |
| 1605 | 1605 | $row = $res->fetch(); |
| 1606 | 1606 | |
| 1607 | - $new_feed_id = (int)$row['id'] + 1; |
|
| 1607 | + $new_feed_id = (int) $row['id'] + 1; |
|
| 1608 | 1608 | |
| 1609 | 1609 | $sth = $pdo->prepare("INSERT INTO ttrss_archived_feeds |
| 1610 | 1610 | (id, owner_uid, title, feed_url, site_url, created) |
@@ -1636,8 +1636,8 @@ discard block |
||
| 1636 | 1636 | |
| 1637 | 1637 | $pdo->commit(); |
| 1638 | 1638 | |
| 1639 | - if (file_exists(ICONS_DIR . "/$id.ico")) { |
|
| 1640 | - unlink(ICONS_DIR . "/$id.ico"); |
|
| 1639 | + if (file_exists(ICONS_DIR."/$id.ico")) { |
|
| 1640 | + unlink(ICONS_DIR."/$id.ico"); |
|
| 1641 | 1641 | } |
| 1642 | 1642 | |
| 1643 | 1643 | CCache::remove($id, $owner_uid); |
@@ -1661,7 +1661,7 @@ discard block |
||
| 1661 | 1661 | |
| 1662 | 1662 | if (get_pref('ENABLE_FEED_CATS')) { |
| 1663 | 1663 | print "<fieldset>"; |
| 1664 | - print "<label>" . __('Place in category:') . "</label> "; |
|
| 1664 | + print "<label>".__('Place in category:')."</label> "; |
|
| 1665 | 1665 | print_feed_cat_select("cat", false, 'dojoType="fox.form.Select"'); |
| 1666 | 1666 | print "</fieldset>"; |
| 1667 | 1667 | } |
@@ -1670,7 +1670,7 @@ discard block |
||
| 1670 | 1670 | |
| 1671 | 1671 | print "<div id='feedDlg_loginContainer' style='display : none'>"; |
| 1672 | 1672 | |
| 1673 | - print "<header>" . __("Authentication") . "</header>"; |
|
| 1673 | + print "<header>".__("Authentication")."</header>"; |
|
| 1674 | 1674 | print "<section>"; |
| 1675 | 1675 | |
| 1676 | 1676 | print "<input dojoType='dijit.form.TextBox' name='login' placeHolder=\"".__("Login")."\"> |
@@ -1789,12 +1789,12 @@ discard block |
||
| 1789 | 1789 | $sth->execute([$_SESSION['uid']]); |
| 1790 | 1790 | |
| 1791 | 1791 | if ($row = $sth->fetch()) { |
| 1792 | - print (int)$row["num_inactive"]; |
|
| 1792 | + print (int) $row["num_inactive"]; |
|
| 1793 | 1793 | } |
| 1794 | 1794 | } |
| 1795 | 1795 | |
| 1796 | 1796 | static function subscribe_to_feed_url() { |
| 1797 | - $url_path = get_self_url_prefix() . |
|
| 1797 | + $url_path = get_self_url_prefix(). |
|
| 1798 | 1798 | "/public.php?op=subscribe&feed_url=%s"; |
| 1799 | 1799 | return $url_path; |
| 1800 | 1800 | } |
@@ -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 | 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 | |
@@ -499,7 +506,9 @@ discard block |
||
| 499 | 506 | } |
| 500 | 507 | } |
| 501 | 508 | |
| 502 | - if (is_file($icon_file)) @unlink($icon_file); |
|
| 509 | + if (is_file($icon_file)) { |
|
| 510 | + @unlink($icon_file); |
|
| 511 | + } |
|
| 503 | 512 | |
| 504 | 513 | print $rc; |
| 505 | 514 | return; |
@@ -595,8 +604,9 @@ discard block |
||
| 595 | 604 | if (DB_TYPE == "pgsql") { |
| 596 | 605 | $feed_language = $row["feed_language"]; |
| 597 | 606 | |
| 598 | - if (!$feed_language) |
|
| 599 | - $feed_language = get_pref('DEFAULT_SEARCH_LANGUAGE'); |
|
| 607 | + if (!$feed_language) { |
|
| 608 | + $feed_language = get_pref('DEFAULT_SEARCH_LANGUAGE'); |
|
| 609 | + } |
|
| 600 | 610 | |
| 601 | 611 | print "<fieldset>"; |
| 602 | 612 | |
@@ -1409,11 +1419,13 @@ discard block |
||
| 1409 | 1419 | $obj = array(); |
| 1410 | 1420 | $feed_id = (int) $feed_id; |
| 1411 | 1421 | |
| 1412 | - if (!$title) |
|
| 1413 | - $title = Feeds::getFeedTitle($feed_id, false); |
|
| 1422 | + if (!$title) { |
|
| 1423 | + $title = Feeds::getFeedTitle($feed_id, false); |
|
| 1424 | + } |
|
| 1414 | 1425 | |
| 1415 | - if ($unread === false) |
|
| 1416 | - $unread = getFeedUnread($feed_id, false); |
|
| 1426 | + if ($unread === false) { |
|
| 1427 | + $unread = getFeedUnread($feed_id, false); |
|
| 1428 | + } |
|
| 1417 | 1429 | |
| 1418 | 1430 | $obj['id'] = 'FEED:' . $feed_id; |
| 1419 | 1431 | $obj['name'] = $title; |
@@ -1743,7 +1755,9 @@ discard block |
||
| 1743 | 1755 | |
| 1744 | 1756 | |
| 1745 | 1757 | private function update_feed_access_key($feed_id, $is_cat, $owner_uid = false) { |
| 1746 | - if (!$owner_uid) $owner_uid = $_SESSION["uid"]; |
|
| 1758 | + if (!$owner_uid) { |
|
| 1759 | + $owner_uid = $_SESSION["uid"]; |
|
| 1760 | + } |
|
| 1747 | 1761 | |
| 1748 | 1762 | // clear old value and generate new one |
| 1749 | 1763 | $sth = $this->pdo->prepare("DELETE FROM ttrss_access_keys |
@@ -78,17 +78,17 @@ discard block |
||
| 78 | 78 | $scope_inner_qparts = []; |
| 79 | 79 | foreach ($rule["feed_id"] as $feed_id) { |
| 80 | 80 | |
| 81 | - if (strpos($feed_id, "CAT:") === 0) { |
|
| 82 | - $cat_id = (int) substr($feed_id, 4); |
|
| 83 | - array_push($scope_inner_qparts, "cat_id = " . $this->pdo->quote($cat_id)); |
|
| 84 | - } else if ($feed_id > 0) { |
|
| 85 | - array_push($scope_inner_qparts, "feed_id = " . $this->pdo->quote($feed_id)); |
|
| 86 | - } |
|
| 87 | - } |
|
| 88 | - |
|
| 89 | - if (count($scope_inner_qparts) > 0) { |
|
| 90 | - array_push($scope_qparts, "(" . implode(" OR ", $scope_inner_qparts) . ")"); |
|
| 91 | - } |
|
| 81 | + if (strpos($feed_id, "CAT:") === 0) { |
|
| 82 | + $cat_id = (int) substr($feed_id, 4); |
|
| 83 | + array_push($scope_inner_qparts, "cat_id = " . $this->pdo->quote($cat_id)); |
|
| 84 | + } else if ($feed_id > 0) { |
|
| 85 | + array_push($scope_inner_qparts, "feed_id = " . $this->pdo->quote($feed_id)); |
|
| 86 | + } |
|
| 87 | + } |
|
| 88 | + |
|
| 89 | + if (count($scope_inner_qparts) > 0) { |
|
| 90 | + array_push($scope_qparts, "(" . implode(" OR ", $scope_inner_qparts) . ")"); |
|
| 91 | + } |
|
| 92 | 92 | |
| 93 | 93 | array_push($filter["rules"], $rule); |
| 94 | 94 | |
@@ -196,32 +196,32 @@ discard block |
||
| 196 | 196 | |
| 197 | 197 | while ($line = $sth->fetch()) { |
| 198 | 198 | |
| 199 | - if ($line["match_on"]) { |
|
| 200 | - $feeds = json_decode($line["match_on"], true); |
|
| 201 | - $feeds_fmt = []; |
|
| 199 | + if ($line["match_on"]) { |
|
| 200 | + $feeds = json_decode($line["match_on"], true); |
|
| 201 | + $feeds_fmt = []; |
|
| 202 | 202 | |
| 203 | - foreach ($feeds as $feed_id) { |
|
| 203 | + foreach ($feeds as $feed_id) { |
|
| 204 | 204 | |
| 205 | - if (strpos($feed_id, "CAT:") === 0) { |
|
| 206 | - $feed_id = (int)substr($feed_id, 4); |
|
| 207 | - array_push($feeds_fmt, Feeds::getCategoryTitle($feed_id)); |
|
| 208 | - } else { |
|
| 209 | - if ($feed_id) |
|
| 210 | - array_push($feeds_fmt, Feeds::getFeedTitle((int)$feed_id)); |
|
| 211 | - else |
|
| 212 | - array_push($feeds_fmt, __("All feeds")); |
|
| 213 | - } |
|
| 214 | - } |
|
| 205 | + if (strpos($feed_id, "CAT:") === 0) { |
|
| 206 | + $feed_id = (int)substr($feed_id, 4); |
|
| 207 | + array_push($feeds_fmt, Feeds::getCategoryTitle($feed_id)); |
|
| 208 | + } else { |
|
| 209 | + if ($feed_id) |
|
| 210 | + array_push($feeds_fmt, Feeds::getFeedTitle((int)$feed_id)); |
|
| 211 | + else |
|
| 212 | + array_push($feeds_fmt, __("All feeds")); |
|
| 213 | + } |
|
| 214 | + } |
|
| 215 | 215 | |
| 216 | - $where = implode(", ", $feeds_fmt); |
|
| 216 | + $where = implode(", ", $feeds_fmt); |
|
| 217 | 217 | |
| 218 | - } else { |
|
| 218 | + } else { |
|
| 219 | 219 | |
| 220 | - $where = $line["cat_filter"] ? |
|
| 221 | - Feeds::getCategoryTitle($line["cat_id"]) : |
|
| 222 | - ($line["feed_id"] ? |
|
| 223 | - Feeds::getFeedTitle($line["feed_id"]) : __("All feeds")); |
|
| 224 | - } |
|
| 220 | + $where = $line["cat_filter"] ? |
|
| 221 | + Feeds::getCategoryTitle($line["cat_id"]) : |
|
| 222 | + ($line["feed_id"] ? |
|
| 223 | + Feeds::getFeedTitle($line["feed_id"]) : __("All feeds")); |
|
| 224 | + } |
|
| 225 | 225 | |
| 226 | 226 | # $where = $line["cat_id"] . "/" . $line["feed_id"]; |
| 227 | 227 | |
@@ -527,18 +527,18 @@ discard block |
||
| 527 | 527 | |
| 528 | 528 | foreach ($feeds as $feed_id) { |
| 529 | 529 | |
| 530 | - if (strpos($feed_id, "CAT:") === 0) { |
|
| 531 | - $feed_id = (int)substr($feed_id, 4); |
|
| 532 | - array_push($feeds_fmt, Feeds::getCategoryTitle($feed_id)); |
|
| 533 | - } else { |
|
| 534 | - if ($feed_id) |
|
| 535 | - array_push($feeds_fmt, Feeds::getFeedTitle((int)$feed_id)); |
|
| 536 | - else |
|
| 537 | - array_push($feeds_fmt, __("All feeds")); |
|
| 538 | - } |
|
| 539 | - } |
|
| 540 | - |
|
| 541 | - $feed = implode(", ", $feeds_fmt); |
|
| 530 | + if (strpos($feed_id, "CAT:") === 0) { |
|
| 531 | + $feed_id = (int)substr($feed_id, 4); |
|
| 532 | + array_push($feeds_fmt, Feeds::getCategoryTitle($feed_id)); |
|
| 533 | + } else { |
|
| 534 | + if ($feed_id) |
|
| 535 | + array_push($feeds_fmt, Feeds::getFeedTitle((int)$feed_id)); |
|
| 536 | + else |
|
| 537 | + array_push($feeds_fmt, __("All feeds")); |
|
| 538 | + } |
|
| 539 | + } |
|
| 540 | + |
|
| 541 | + $feed = implode(", ", $feeds_fmt); |
|
| 542 | 542 | |
| 543 | 543 | $sth = $this->pdo->prepare("SELECT description FROM ttrss_filter_types |
| 544 | 544 | WHERE id = ?"); |
@@ -80,14 +80,14 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | if (strpos($feed_id, "CAT:") === 0) { |
| 82 | 82 | $cat_id = (int) substr($feed_id, 4); |
| 83 | - array_push($scope_inner_qparts, "cat_id = " . $this->pdo->quote($cat_id)); |
|
| 83 | + array_push($scope_inner_qparts, "cat_id = ".$this->pdo->quote($cat_id)); |
|
| 84 | 84 | } else if ($feed_id > 0) { |
| 85 | - array_push($scope_inner_qparts, "feed_id = " . $this->pdo->quote($feed_id)); |
|
| 85 | + array_push($scope_inner_qparts, "feed_id = ".$this->pdo->quote($feed_id)); |
|
| 86 | 86 | } |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | if (count($scope_inner_qparts) > 0) { |
| 90 | - array_push($scope_qparts, "(" . implode(" OR ", $scope_inner_qparts) . ")"); |
|
| 90 | + array_push($scope_qparts, "(".implode(" OR ", $scope_inner_qparts).")"); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | array_push($filter["rules"], $rule); |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | |
| 101 | 101 | if (count($scope_qparts) == 0) $scope_qparts = ["true"]; |
| 102 | 102 | |
| 103 | - $glue = $filter['match_any_rule'] ? " OR " : " AND "; |
|
| 103 | + $glue = $filter['match_any_rule'] ? " OR " : " AND "; |
|
| 104 | 104 | $scope_qpart = join($glue, $scope_qparts); |
| 105 | 105 | |
| 106 | 106 | if (!$scope_qpart) $scope_qpart = "true"; |
@@ -146,9 +146,9 @@ discard block |
||
| 146 | 146 | |
| 147 | 147 | $content_preview = $line["content_preview"]; |
| 148 | 148 | |
| 149 | - $tmp = "<li><span class='title'>" . $line["title"] . "</span><br/>" . |
|
| 150 | - "<span class='feed'>" . $line['feed_title'] . "</span>, <span class='date'>" . mb_substr($line["date_entered"], 0, 16) . "</span>" . |
|
| 151 | - "<div class='preview text-muted'>" . $content_preview . "</div>" . |
|
| 149 | + $tmp = "<li><span class='title'>".$line["title"]."</span><br/>". |
|
| 150 | + "<span class='feed'>".$line['feed_title']."</span>, <span class='date'>".mb_substr($line["date_entered"], 0, 16)."</span>". |
|
| 151 | + "<div class='preview text-muted'>".$content_preview."</div>". |
|
| 152 | 152 | "</li>"; |
| 153 | 153 | |
| 154 | 154 | array_push($rv, $tmp); |
@@ -203,11 +203,11 @@ discard block |
||
| 203 | 203 | foreach ($feeds as $feed_id) { |
| 204 | 204 | |
| 205 | 205 | if (strpos($feed_id, "CAT:") === 0) { |
| 206 | - $feed_id = (int)substr($feed_id, 4); |
|
| 206 | + $feed_id = (int) substr($feed_id, 4); |
|
| 207 | 207 | array_push($feeds_fmt, Feeds::getCategoryTitle($feed_id)); |
| 208 | 208 | } else { |
| 209 | 209 | if ($feed_id) |
| 210 | - array_push($feeds_fmt, Feeds::getFeedTitle((int)$feed_id)); |
|
| 210 | + array_push($feeds_fmt, Feeds::getFeedTitle((int) $feed_id)); |
|
| 211 | 211 | else |
| 212 | 212 | array_push($feeds_fmt, __("All feeds")); |
| 213 | 213 | } |
@@ -218,8 +218,7 @@ discard block |
||
| 218 | 218 | } else { |
| 219 | 219 | |
| 220 | 220 | $where = $line["cat_filter"] ? |
| 221 | - Feeds::getCategoryTitle($line["cat_id"]) : |
|
| 222 | - ($line["feed_id"] ? |
|
| 221 | + Feeds::getCategoryTitle($line["cat_id"]) : ($line["feed_id"] ? |
|
| 223 | 222 | Feeds::getFeedTitle($line["feed_id"]) : __("All feeds")); |
| 224 | 223 | } |
| 225 | 224 | |
@@ -227,11 +226,11 @@ discard block |
||
| 227 | 226 | |
| 228 | 227 | $inverse = $line["inverse"] ? "inverse" : ""; |
| 229 | 228 | |
| 230 | - $rv .= "<li class='$inverse'>" . T_sprintf("%s on %s in %s %s", |
|
| 229 | + $rv .= "<li class='$inverse'>".T_sprintf("%s on %s in %s %s", |
|
| 231 | 230 | htmlspecialchars($line["reg_exp"]), |
| 232 | 231 | $line["field"], |
| 233 | 232 | $where, |
| 234 | - $line["inverse"] ? __("(inverse)") : "") . "</li>"; |
|
| 233 | + $line["inverse"] ? __("(inverse)") : "")."</li>"; |
|
| 235 | 234 | } |
| 236 | 235 | |
| 237 | 236 | return $rv; |
@@ -294,12 +293,12 @@ discard block |
||
| 294 | 293 | //$fg_color = $label_row["fg_color"]; |
| 295 | 294 | $bg_color = $label_row["bg_color"]; |
| 296 | 295 | |
| 297 | - $name[1] = "<i class=\"material-icons\" style='color : $bg_color; margin-right : 4px'>label</i>" . $name[1]; |
|
| 296 | + $name[1] = "<i class=\"material-icons\" style='color : $bg_color; margin-right : 4px'>label</i>".$name[1]; |
|
| 298 | 297 | } |
| 299 | 298 | } |
| 300 | 299 | |
| 301 | 300 | $filter = array(); |
| 302 | - $filter['id'] = 'FILTER:' . $line['id']; |
|
| 301 | + $filter['id'] = 'FILTER:'.$line['id']; |
|
| 303 | 302 | $filter['bare_id'] = $line['id']; |
| 304 | 303 | $filter['name'] = $name[0]; |
| 305 | 304 | $filter['param'] = $name[1]; |
@@ -357,7 +356,7 @@ discard block |
||
| 357 | 356 | print "<div dojoType=\"fox.Toolbar\">"; |
| 358 | 357 | |
| 359 | 358 | print "<div dojoType=\"fox.form.DropDownButton\">". |
| 360 | - "<span>" . __('Select')."</span>"; |
|
| 359 | + "<span>".__('Select')."</span>"; |
|
| 361 | 360 | print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">"; |
| 362 | 361 | print "<div onclick=\"dijit.byId('filterEditDlg').selectRules(true)\" |
| 363 | 362 | dojoType=\"dijit.MenuItem\">".__('All')."</div>"; |
@@ -384,12 +383,12 @@ discard block |
||
| 384 | 383 | $line["feed_id"] = json_decode($line["match_on"], true); |
| 385 | 384 | } else { |
| 386 | 385 | if ($line["cat_filter"]) { |
| 387 | - $feed_id = "CAT:" . (int)$line["cat_id"]; |
|
| 386 | + $feed_id = "CAT:".(int) $line["cat_id"]; |
|
| 388 | 387 | } else { |
| 389 | - $feed_id = (int)$line["feed_id"]; |
|
| 388 | + $feed_id = (int) $line["feed_id"]; |
|
| 390 | 389 | } |
| 391 | 390 | |
| 392 | - $line["feed_id"] = ["" . $feed_id]; // set item type to string for in_array() |
|
| 391 | + $line["feed_id"] = ["".$feed_id]; // set item type to string for in_array() |
|
| 393 | 392 | } |
| 394 | 393 | |
| 395 | 394 | unset($line["cat_filter"]); |
@@ -417,7 +416,7 @@ discard block |
||
| 417 | 416 | print "<div dojoType=\"fox.Toolbar\">"; |
| 418 | 417 | |
| 419 | 418 | print "<div dojoType=\"fox.form.DropDownButton\">". |
| 420 | - "<span>" . __('Select')."</span>"; |
|
| 419 | + "<span>".__('Select')."</span>"; |
|
| 421 | 420 | print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">"; |
| 422 | 421 | print "<div onclick=\"dijit.byId('filterEditDlg').selectActions(true)\" |
| 423 | 422 | dojoType=\"dijit.MenuItem\">".__('All')."</div>"; |
@@ -528,11 +527,11 @@ discard block |
||
| 528 | 527 | foreach ($feeds as $feed_id) { |
| 529 | 528 | |
| 530 | 529 | if (strpos($feed_id, "CAT:") === 0) { |
| 531 | - $feed_id = (int)substr($feed_id, 4); |
|
| 530 | + $feed_id = (int) substr($feed_id, 4); |
|
| 532 | 531 | array_push($feeds_fmt, Feeds::getCategoryTitle($feed_id)); |
| 533 | 532 | } else { |
| 534 | 533 | if ($feed_id) |
| 535 | - array_push($feeds_fmt, Feeds::getFeedTitle((int)$feed_id)); |
|
| 534 | + array_push($feeds_fmt, Feeds::getFeedTitle((int) $feed_id)); |
|
| 536 | 535 | else |
| 537 | 536 | array_push($feeds_fmt, __("All feeds")); |
| 538 | 537 | } |
@@ -542,7 +541,7 @@ discard block |
||
| 542 | 541 | |
| 543 | 542 | $sth = $this->pdo->prepare("SELECT description FROM ttrss_filter_types |
| 544 | 543 | WHERE id = ?"); |
| 545 | - $sth->execute([(int)$rule["filter_type"]]); |
|
| 544 | + $sth->execute([(int) $rule["filter_type"]]); |
|
| 546 | 545 | |
| 547 | 546 | if ($row = $sth->fetch()) { |
| 548 | 547 | $filter_type = $row["description"]; |
@@ -552,9 +551,9 @@ discard block |
||
| 552 | 551 | |
| 553 | 552 | $inverse = isset($rule["inverse"]) ? "inverse" : ""; |
| 554 | 553 | |
| 555 | - return "<span class='filterRule $inverse'>" . |
|
| 554 | + return "<span class='filterRule $inverse'>". |
|
| 556 | 555 | T_sprintf("%s on %s in %s %s", htmlspecialchars($rule["reg_exp"]), |
| 557 | - $filter_type, $feed, isset($rule["inverse"]) ? __("(inverse)") : "") . "</span>"; |
|
| 556 | + $filter_type, $feed, isset($rule["inverse"]) ? __("(inverse)") : "")."</span>"; |
|
| 558 | 557 | } |
| 559 | 558 | |
| 560 | 559 | function printRuleName() { |
@@ -564,7 +563,7 @@ discard block |
||
| 564 | 563 | private function getActionName($action) { |
| 565 | 564 | $sth = $this->pdo->prepare("SELECT description FROM |
| 566 | 565 | ttrss_filter_actions WHERE id = ?"); |
| 567 | - $sth->execute([(int)$action["action_id"]]); |
|
| 566 | + $sth->execute([(int) $action["action_id"]]); |
|
| 568 | 567 | |
| 569 | 568 | $title = ""; |
| 570 | 569 | |
@@ -574,7 +573,7 @@ discard block |
||
| 574 | 573 | |
| 575 | 574 | if ($action["action_id"] == 4 || $action["action_id"] == 6 || |
| 576 | 575 | $action["action_id"] == 7) |
| 577 | - $title .= ": " . $action["action_param"]; |
|
| 576 | + $title .= ": ".$action["action_param"]; |
|
| 578 | 577 | |
| 579 | 578 | if ($action["action_id"] == 9) { |
| 580 | 579 | list ($pfclass, $pfaction) = explode(":", $action["action_param"]); |
@@ -584,7 +583,7 @@ discard block |
||
| 584 | 583 | foreach ($filter_actions as $fclass => $factions) { |
| 585 | 584 | foreach ($factions as $faction) { |
| 586 | 585 | if ($pfaction == $faction["action"] && $pfclass == $fclass) { |
| 587 | - $title .= ": " . $fclass . ": " . $faction["description"]; |
|
| 586 | + $title .= ": ".$fclass.": ".$faction["description"]; |
|
| 588 | 587 | break; |
| 589 | 588 | } |
| 590 | 589 | } |
@@ -681,7 +680,7 @@ discard block |
||
| 681 | 680 | $reg_exp = trim($rule["reg_exp"]); |
| 682 | 681 | $inverse = isset($rule["inverse"]) ? 1 : 0; |
| 683 | 682 | |
| 684 | - $filter_type = (int)trim($rule["filter_type"]); |
|
| 683 | + $filter_type = (int) trim($rule["filter_type"]); |
|
| 685 | 684 | $match_on = json_encode($rule["feed_id"]); |
| 686 | 685 | |
| 687 | 686 | $rsth->execute([$filter_id, $reg_exp, $filter_type, $match_on, $inverse]); |
@@ -695,7 +694,7 @@ discard block |
||
| 695 | 694 | foreach ($actions as $action) { |
| 696 | 695 | if ($action) { |
| 697 | 696 | |
| 698 | - $action_id = (int)$action["action_id"]; |
|
| 697 | + $action_id = (int) $action["action_id"]; |
|
| 699 | 698 | $action_param = $action["action_param"]; |
| 700 | 699 | $action_param_label = $action["action_param_label"]; |
| 701 | 700 | |
@@ -704,7 +703,7 @@ discard block |
||
| 704 | 703 | } |
| 705 | 704 | |
| 706 | 705 | if ($action_id == 6) { |
| 707 | - $action_param = (int)str_replace("+", "", $action_param); |
|
| 706 | + $action_param = (int) str_replace("+", "", $action_param); |
|
| 708 | 707 | } |
| 709 | 708 | |
| 710 | 709 | $asth->execute([$filter_id, $action_id, $action_param]); |
@@ -773,7 +772,7 @@ discard block |
||
| 773 | 772 | </div>"; |
| 774 | 773 | |
| 775 | 774 | print "<div dojoType=\"fox.form.DropDownButton\">". |
| 776 | - "<span>" . __('Select')."</span>"; |
|
| 775 | + "<span>".__('Select')."</span>"; |
|
| 777 | 776 | print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">"; |
| 778 | 777 | print "<div onclick=\"dijit.byId('filterTree').model.setAllChecked(true)\" |
| 779 | 778 | dojoType=\"dijit.MenuItem\">".__('All')."</div>"; |
@@ -859,7 +858,7 @@ discard block |
||
| 859 | 858 | print "<div dojoType='fox.Toolbar'>"; |
| 860 | 859 | |
| 861 | 860 | print "<div dojoType='fox.form.DropDownButton'>". |
| 862 | - "<span>" . __('Select')."</span>"; |
|
| 861 | + "<span>".__('Select')."</span>"; |
|
| 863 | 862 | print "<div dojoType='dijit.Menu' style='display: none'>"; |
| 864 | 863 | print "<div onclick=\"dijit.byId('filterEditDlg').selectRules(true)\" |
| 865 | 864 | dojoType='dijit.MenuItem'>".__('All')."</div>"; |
@@ -888,7 +887,7 @@ discard block |
||
| 888 | 887 | print "<div dojoType='fox.Toolbar'>"; |
| 889 | 888 | |
| 890 | 889 | print "<div dojoType='fox.form.DropDownButton'>". |
| 891 | - "<span>" . __('Select')."</span>"; |
|
| 890 | + "<span>".__('Select')."</span>"; |
|
| 892 | 891 | print "<div dojoType='dijit.Menu' style='display: none'>"; |
| 893 | 892 | print "<div onclick=\"dijit.byId('filterEditDlg').selectActions(true)\" |
| 894 | 893 | dojoType='dijit.MenuItem'>".__('All')."</div>"; |
@@ -992,10 +991,10 @@ discard block |
||
| 992 | 991 | print "</fieldset>"; |
| 993 | 992 | |
| 994 | 993 | print "<fieldset>"; |
| 995 | - print "<label style='display : inline'>". __("on field") . "</label> "; |
|
| 994 | + print "<label style='display : inline'>".__("on field")."</label> "; |
|
| 996 | 995 | print_select_hash("filter_type", $filter_type, $filter_types, |
| 997 | 996 | 'dojoType="fox.form.Select"'); |
| 998 | - print "<label style='padding-left : 10px; display : inline'>" . __("in") . "</label> "; |
|
| 997 | + print "<label style='padding-left : 10px; display : inline'>".__("in")."</label> "; |
|
| 999 | 998 | |
| 1000 | 999 | print "</fieldset>"; |
| 1001 | 1000 | |
@@ -1031,7 +1030,7 @@ discard block |
||
| 1031 | 1030 | |
| 1032 | 1031 | if ($action) { |
| 1033 | 1032 | $action_param = $action["action_param"]; |
| 1034 | - $action_id = (int)$action["action_id"]; |
|
| 1033 | + $action_id = (int) $action["action_id"]; |
|
| 1035 | 1034 | } else { |
| 1036 | 1035 | $action_param = ""; |
| 1037 | 1036 | $action_id = 0; |
@@ -1062,8 +1061,8 @@ discard block |
||
| 1062 | 1061 | $param_hidden = ($action_id == 4 || $action_id == 6) ? |
| 1063 | 1062 | "" : "display : none"; |
| 1064 | 1063 | |
| 1065 | - $label_param_hidden = ($action_id == 7) ? "" : "display : none"; |
|
| 1066 | - $plugin_param_hidden = ($action_id == 9) ? "" : "display : none"; |
|
| 1064 | + $label_param_hidden = ($action_id == 7) ? "" : "display : none"; |
|
| 1065 | + $plugin_param_hidden = ($action_id == 9) ? "" : "display : none"; |
|
| 1067 | 1066 | |
| 1068 | 1067 | print "<span id='filterDlg_paramBox' style=\"$param_box_hidden\">"; |
| 1069 | 1068 | print " "; |
@@ -1082,8 +1081,8 @@ discard block |
||
| 1082 | 1081 | foreach ($filter_actions as $fclass => $factions) { |
| 1083 | 1082 | foreach ($factions as $faction) { |
| 1084 | 1083 | |
| 1085 | - $filter_action_hash[$fclass . ":" . $faction["action"]] = |
|
| 1086 | - $fclass . ": " . $faction["description"]; |
|
| 1084 | + $filter_action_hash[$fclass.":".$faction["action"]] = |
|
| 1085 | + $fclass.": ".$faction["description"]; |
|
| 1087 | 1086 | } |
| 1088 | 1087 | } |
| 1089 | 1088 | |
@@ -1153,8 +1152,8 @@ discard block |
||
| 1153 | 1152 | $num_actions -= 1; |
| 1154 | 1153 | } |
| 1155 | 1154 | |
| 1156 | - if ($match_any_rule) $title .= " (" . __("matches any rule") . ")"; |
|
| 1157 | - if ($inverse) $title .= " (" . __("inverse") . ")"; |
|
| 1155 | + if ($match_any_rule) $title .= " (".__("matches any rule").")"; |
|
| 1156 | + if ($inverse) $title .= " (".__("inverse").")"; |
|
| 1158 | 1157 | |
| 1159 | 1158 | if ($num_actions > 0) |
| 1160 | 1159 | $actions = sprintf(_ngettext("%s (+%d action)", "%s (+%d actions)", (int) $num_actions), $actions, $num_actions); |
@@ -21,8 +21,9 @@ discard block |
||
| 21 | 21 | #file_put_contents("/tmp/saveorder.json", clean($_POST['payload'])); |
| 22 | 22 | #$data = json_decode(file_get_contents("/tmp/saveorder.json"), true); |
| 23 | 23 | |
| 24 | - if (!is_array($data['items'])) |
|
| 25 | - $data['items'] = json_decode($data['items'], true); |
|
| 24 | + if (!is_array($data['items'])) { |
|
| 25 | + $data['items'] = json_decode($data['items'], true); |
|
| 26 | + } |
|
| 26 | 27 | |
| 27 | 28 | $index = 0; |
| 28 | 29 | |
@@ -98,12 +99,16 @@ discard block |
||
| 98 | 99 | } |
| 99 | 100 | } |
| 100 | 101 | |
| 101 | - if (count($scope_qparts) == 0) $scope_qparts = ["true"]; |
|
| 102 | + if (count($scope_qparts) == 0) { |
|
| 103 | + $scope_qparts = ["true"]; |
|
| 104 | + } |
|
| 102 | 105 | |
| 103 | 106 | $glue = $filter['match_any_rule'] ? " OR " : " AND "; |
| 104 | 107 | $scope_qpart = join($glue, $scope_qparts); |
| 105 | 108 | |
| 106 | - if (!$scope_qpart) $scope_qpart = "true"; |
|
| 109 | + if (!$scope_qpart) { |
|
| 110 | + $scope_qpart = "true"; |
|
| 111 | + } |
|
| 107 | 112 | |
| 108 | 113 | $rv = array(); |
| 109 | 114 | |
@@ -161,7 +166,9 @@ discard block |
||
| 161 | 166 | |
| 162 | 167 | function testFilter() { |
| 163 | 168 | |
| 164 | - if (isset($_REQUEST["offset"])) return $this->testFilterDo(); |
|
| 169 | + if (isset($_REQUEST["offset"])) { |
|
| 170 | + return $this->testFilterDo(); |
|
| 171 | + } |
|
| 165 | 172 | |
| 166 | 173 | //print __("Articles matching this filter:"); |
| 167 | 174 | |
@@ -206,10 +213,11 @@ discard block |
||
| 206 | 213 | $feed_id = (int)substr($feed_id, 4); |
| 207 | 214 | array_push($feeds_fmt, Feeds::getCategoryTitle($feed_id)); |
| 208 | 215 | } else { |
| 209 | - if ($feed_id) |
|
| 210 | - array_push($feeds_fmt, Feeds::getFeedTitle((int)$feed_id)); |
|
| 211 | - else |
|
| 212 | - array_push($feeds_fmt, __("All feeds")); |
|
| 216 | + if ($feed_id) { |
|
| 217 | + array_push($feeds_fmt, Feeds::getFeedTitle((int)$feed_id)); |
|
| 218 | + } else { |
|
| 219 | + array_push($feeds_fmt, __("All feeds")); |
|
| 220 | + } |
|
| 213 | 221 | } |
| 214 | 222 | } |
| 215 | 223 | |
@@ -396,7 +404,9 @@ discard block |
||
| 396 | 404 | unset($line["cat_id"]); |
| 397 | 405 | unset($line["filter_id"]); |
| 398 | 406 | unset($line["id"]); |
| 399 | - if (!$line["inverse"]) unset($line["inverse"]); |
|
| 407 | + if (!$line["inverse"]) { |
|
| 408 | + unset($line["inverse"]); |
|
| 409 | + } |
|
| 400 | 410 | unset($line["match_on"]); |
| 401 | 411 | |
| 402 | 412 | $data = htmlspecialchars(json_encode($line)); |
@@ -518,12 +528,16 @@ discard block |
||
| 518 | 528 | } |
| 519 | 529 | |
| 520 | 530 | private function getRuleName($rule) { |
| 521 | - if (!$rule) $rule = json_decode(clean($_REQUEST["rule"]), true); |
|
| 531 | + if (!$rule) { |
|
| 532 | + $rule = json_decode(clean($_REQUEST["rule"]), true); |
|
| 533 | + } |
|
| 522 | 534 | |
| 523 | 535 | $feeds = $rule["feed_id"]; |
| 524 | 536 | $feeds_fmt = []; |
| 525 | 537 | |
| 526 | - if (!is_array($feeds)) $feeds = [$feeds]; |
|
| 538 | + if (!is_array($feeds)) { |
|
| 539 | + $feeds = [$feeds]; |
|
| 540 | + } |
|
| 527 | 541 | |
| 528 | 542 | foreach ($feeds as $feed_id) { |
| 529 | 543 | |
@@ -531,10 +545,11 @@ discard block |
||
| 531 | 545 | $feed_id = (int)substr($feed_id, 4); |
| 532 | 546 | array_push($feeds_fmt, Feeds::getCategoryTitle($feed_id)); |
| 533 | 547 | } else { |
| 534 | - if ($feed_id) |
|
| 535 | - array_push($feeds_fmt, Feeds::getFeedTitle((int)$feed_id)); |
|
| 536 | - else |
|
| 537 | - array_push($feeds_fmt, __("All feeds")); |
|
| 548 | + if ($feed_id) { |
|
| 549 | + array_push($feeds_fmt, Feeds::getFeedTitle((int)$feed_id)); |
|
| 550 | + } else { |
|
| 551 | + array_push($feeds_fmt, __("All feeds")); |
|
| 552 | + } |
|
| 538 | 553 | } |
| 539 | 554 | } |
| 540 | 555 | |
@@ -573,8 +588,9 @@ discard block |
||
| 573 | 588 | $title = __($row["description"]); |
| 574 | 589 | |
| 575 | 590 | if ($action["action_id"] == 4 || $action["action_id"] == 6 || |
| 576 | - $action["action_id"] == 7) |
|
| 577 | - $title .= ": " . $action["action_param"]; |
|
| 591 | + $action["action_id"] == 7) { |
|
| 592 | + $title .= ": " . $action["action_param"]; |
|
| 593 | + } |
|
| 578 | 594 | |
| 579 | 595 | if ($action["action_id"] == 9) { |
| 580 | 596 | list ($pfclass, $pfaction) = explode(":", $action["action_param"]); |
@@ -644,8 +660,12 @@ discard block |
||
| 644 | 660 | $sth = $this->pdo->prepare("DELETE FROM ttrss_filters2_actions WHERE filter_id = ?"); |
| 645 | 661 | $sth->execute([$filter_id]); |
| 646 | 662 | |
| 647 | - if (!is_array(clean($_REQUEST["rule"]))) $_REQUEST["rule"] = []; |
|
| 648 | - if (!is_array(clean($_REQUEST["action"]))) $_REQUEST["action"] = []; |
|
| 663 | + if (!is_array(clean($_REQUEST["rule"]))) { |
|
| 664 | + $_REQUEST["rule"] = []; |
|
| 665 | + } |
|
| 666 | + if (!is_array(clean($_REQUEST["action"]))) { |
|
| 667 | + $_REQUEST["action"] = []; |
|
| 668 | + } |
|
| 649 | 669 | |
| 650 | 670 | if ($filter_id) { |
| 651 | 671 | /* create rules */ |
@@ -1137,7 +1157,9 @@ discard block |
||
| 1137 | 1157 | $match_any_rule = $row["match_any_rule"]; |
| 1138 | 1158 | $inverse = $row["inverse"]; |
| 1139 | 1159 | |
| 1140 | - if (!$title) $title = __("[No caption]"); |
|
| 1160 | + if (!$title) { |
|
| 1161 | + $title = __("[No caption]"); |
|
| 1162 | + } |
|
| 1141 | 1163 | |
| 1142 | 1164 | $title = sprintf(_ngettext("%s (%d rule)", "%s (%d rules)", (int) $num_rules), $title, $num_rules); |
| 1143 | 1165 | |
@@ -1153,11 +1175,16 @@ discard block |
||
| 1153 | 1175 | $num_actions -= 1; |
| 1154 | 1176 | } |
| 1155 | 1177 | |
| 1156 | - if ($match_any_rule) $title .= " (" . __("matches any rule") . ")"; |
|
| 1157 | - if ($inverse) $title .= " (" . __("inverse") . ")"; |
|
| 1178 | + if ($match_any_rule) { |
|
| 1179 | + $title .= " (" . __("matches any rule") . ")"; |
|
| 1180 | + } |
|
| 1181 | + if ($inverse) { |
|
| 1182 | + $title .= " (" . __("inverse") . ")"; |
|
| 1183 | + } |
|
| 1158 | 1184 | |
| 1159 | - if ($num_actions > 0) |
|
| 1160 | - $actions = sprintf(_ngettext("%s (+%d action)", "%s (+%d actions)", (int) $num_actions), $actions, $num_actions); |
|
| 1185 | + if ($num_actions > 0) { |
|
| 1186 | + $actions = sprintf(_ngettext("%s (+%d action)", "%s (+%d actions)", (int) $num_actions), $actions, $num_actions); |
|
| 1187 | + } |
|
| 1161 | 1188 | |
| 1162 | 1189 | return [$title, $actions]; |
| 1163 | 1190 | } |