@@ -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 |
@@ -446,7 +446,7 @@ discard block |
||
446 | 446 | $sth->execute([$feed_id, $_SESSION['uid']]); |
447 | 447 | |
448 | 448 | if ($sth->fetch()) { |
449 | - @unlink(ICONS_DIR . "/$feed_id.ico"); |
|
449 | + @unlink(ICONS_DIR."/$feed_id.ico"); |
|
450 | 450 | |
451 | 451 | $sth = $this->pdo->prepare("UPDATE ttrss_feeds SET favicon_avg_color = NULL where id = ?"); |
452 | 452 | $sth->execute([$feed_id]); |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | header("Content-type: text/html"); |
458 | 458 | |
459 | 459 | if (is_uploaded_file($_FILES['icon_file']['tmp_name'])) { |
460 | - $tmp_file = tempnam(CACHE_DIR . '/upload', 'icon'); |
|
460 | + $tmp_file = tempnam(CACHE_DIR.'/upload', 'icon'); |
|
461 | 461 | |
462 | 462 | $result = move_uploaded_file($_FILES['icon_file']['tmp_name'], |
463 | 463 | $tmp_file); |
@@ -480,8 +480,8 @@ discard block |
||
480 | 480 | $sth->execute([$feed_id, $_SESSION['uid']]); |
481 | 481 | |
482 | 482 | if ($sth->fetch()) { |
483 | - @unlink(ICONS_DIR . "/$feed_id.ico"); |
|
484 | - if (rename($icon_file, ICONS_DIR . "/$feed_id.ico")) { |
|
483 | + @unlink(ICONS_DIR."/$feed_id.ico"); |
|
484 | + if (rename($icon_file, ICONS_DIR."/$feed_id.ico")) { |
|
485 | 485 | |
486 | 486 | $sth = $this->pdo->prepare("UPDATE ttrss_feeds SET favicon_avg_color = '' WHERE id = ?"); |
487 | 487 | $sth->execute([$feed_id]); |
@@ -540,7 +540,7 @@ discard block |
||
540 | 540 | |
541 | 541 | print "<fieldset>"; |
542 | 542 | |
543 | - print "<label>" . __('URL:') . "</label> "; |
|
543 | + print "<label>".__('URL:')."</label> "; |
|
544 | 544 | print "<input dojoType='dijit.form.ValidationTextBox' required='1' |
545 | 545 | placeHolder=\"".__("Feed URL")."\" |
546 | 546 | regExp='^(http|https)://.*' style='width : 300px' |
@@ -563,7 +563,7 @@ discard block |
||
563 | 563 | |
564 | 564 | print "<fieldset>"; |
565 | 565 | |
566 | - print "<label>" . __('Place in category:') . "</label> "; |
|
566 | + print "<label>".__('Place in category:')."</label> "; |
|
567 | 567 | |
568 | 568 | print_feed_cat_select("cat_id", $cat_id, |
569 | 569 | 'dojoType="fox.form.Select"'); |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | |
578 | 578 | print "<fieldset>"; |
579 | 579 | |
580 | - print "<label>" . __('Site URL:') . "</label> "; |
|
580 | + print "<label>".__('Site URL:')."</label> "; |
|
581 | 581 | print "<input dojoType='dijit.form.ValidationTextBox' required='1' |
582 | 582 | placeHolder=\"".__("Site URL")."\" |
583 | 583 | regExp='^(http|https)://.*' style='width : 300px' |
@@ -595,7 +595,7 @@ discard block |
||
595 | 595 | |
596 | 596 | print "<fieldset>"; |
597 | 597 | |
598 | - print "<label>" . __('Language:') . "</label> "; |
|
598 | + print "<label>".__('Language:')."</label> "; |
|
599 | 599 | print_select("feed_language", $feed_language, $this::get_ts_languages(), |
600 | 600 | 'dojoType="fox.form.Select"'); |
601 | 601 | |
@@ -626,10 +626,10 @@ discard block |
||
626 | 626 | |
627 | 627 | print "<fieldset>"; |
628 | 628 | |
629 | - print "<label>" . __('Article purging:') . "</label> "; |
|
629 | + print "<label>".__('Article purging:')."</label> "; |
|
630 | 630 | |
631 | 631 | print_select_hash("purge_interval", $purge_interval, $purge_intervals, |
632 | - 'dojoType="fox.form.Select" ' . |
|
632 | + 'dojoType="fox.form.Select" '. |
|
633 | 633 | ((FORCE_ARTICLE_PURGE == 0) ? "" : 'disabled="1"')); |
634 | 634 | |
635 | 635 | print "</fieldset>"; |
@@ -736,7 +736,7 @@ discard block |
||
736 | 736 | print "<fieldset class='narrow'>"; |
737 | 737 | |
738 | 738 | print "<label class='checkbox'><input dojoType='dijit.form.CheckBox' type='checkbox' id='cache_images' |
739 | - name='cache_images' $checked> ". __('Cache media')."</label>"; |
|
739 | + name='cache_images' $checked> ".__('Cache media')."</label>"; |
|
740 | 740 | |
741 | 741 | print "</fieldset>"; |
742 | 742 | |
@@ -818,7 +818,7 @@ discard block |
||
818 | 818 | |
819 | 819 | print "<fieldset>"; |
820 | 820 | |
821 | - print "<label>" . __('Place in category:') . "</label> "; |
|
821 | + print "<label>".__('Place in category:')."</label> "; |
|
822 | 822 | |
823 | 823 | print_feed_cat_select("cat_id", false, |
824 | 824 | 'disabled="1" dojoType="fox.form.Select"'); |
@@ -833,7 +833,7 @@ discard block |
||
833 | 833 | if (DB_TYPE == "pgsql") { |
834 | 834 | print "<fieldset>"; |
835 | 835 | |
836 | - print "<label>" . __('Language:') . "</label> "; |
|
836 | + print "<label>".__('Language:')."</label> "; |
|
837 | 837 | print_select("feed_language", "", $this::get_ts_languages(), |
838 | 838 | 'disabled="1" dojoType="fox.form.Select"'); |
839 | 839 | |
@@ -866,7 +866,7 @@ discard block |
||
866 | 866 | |
867 | 867 | print "<fieldset>"; |
868 | 868 | |
869 | - print "<label>" . __('Article purging:') . "</label> "; |
|
869 | + print "<label>".__('Article purging:')."</label> "; |
|
870 | 870 | |
871 | 871 | print_select_hash("purge_interval", "", $purge_intervals, |
872 | 872 | 'disabled="1" dojoType="fox.form.Select"'); |
@@ -1026,12 +1026,12 @@ discard block |
||
1026 | 1026 | ":purge_intl" => $purge_intl, |
1027 | 1027 | ":auth_login" => $auth_login, |
1028 | 1028 | ":auth_pass" => $auth_pass, |
1029 | - ":private" => (int)$private, |
|
1030 | - ":cache_images" => (int)$cache_images, |
|
1031 | - ":hide_images" => (int)$hide_images, |
|
1032 | - ":include_in_digest" => (int)$include_in_digest, |
|
1033 | - ":always_display_enclosures" => (int)$always_display_enclosures, |
|
1034 | - ":mark_unread_on_update" => (int)$mark_unread_on_update, |
|
1029 | + ":private" => (int) $private, |
|
1030 | + ":cache_images" => (int) $cache_images, |
|
1031 | + ":hide_images" => (int) $hide_images, |
|
1032 | + ":include_in_digest" => (int) $include_in_digest, |
|
1033 | + ":always_display_enclosures" => (int) $always_display_enclosures, |
|
1034 | + ":mark_unread_on_update" => (int) $mark_unread_on_update, |
|
1035 | 1035 | ":feed_language" => $feed_language, |
1036 | 1036 | ":id" => $feed_id, |
1037 | 1037 | ":uid" => $_SESSION['uid']]); |
@@ -1062,57 +1062,57 @@ discard block |
||
1062 | 1062 | |
1063 | 1063 | switch ($k) { |
1064 | 1064 | case "title": |
1065 | - $qpart = "title = " . $this->pdo->quote($feed_title); |
|
1065 | + $qpart = "title = ".$this->pdo->quote($feed_title); |
|
1066 | 1066 | break; |
1067 | 1067 | |
1068 | 1068 | case "feed_url": |
1069 | - $qpart = "feed_url = " . $this->pdo->quote($feed_url); |
|
1069 | + $qpart = "feed_url = ".$this->pdo->quote($feed_url); |
|
1070 | 1070 | break; |
1071 | 1071 | |
1072 | 1072 | case "update_interval": |
1073 | - $qpart = "update_interval = " . $this->pdo->quote($upd_intl); |
|
1073 | + $qpart = "update_interval = ".$this->pdo->quote($upd_intl); |
|
1074 | 1074 | break; |
1075 | 1075 | |
1076 | 1076 | case "purge_interval": |
1077 | - $qpart = "purge_interval =" . $this->pdo->quote($purge_intl); |
|
1077 | + $qpart = "purge_interval =".$this->pdo->quote($purge_intl); |
|
1078 | 1078 | break; |
1079 | 1079 | |
1080 | 1080 | case "auth_login": |
1081 | - $qpart = "auth_login = " . $this->pdo->quote($auth_login); |
|
1081 | + $qpart = "auth_login = ".$this->pdo->quote($auth_login); |
|
1082 | 1082 | break; |
1083 | 1083 | |
1084 | 1084 | case "auth_pass": |
1085 | - $qpart = "auth_pass =" . $this->pdo->quote($auth_pass). ", auth_pass_encrypted = false"; |
|
1085 | + $qpart = "auth_pass =".$this->pdo->quote($auth_pass).", auth_pass_encrypted = false"; |
|
1086 | 1086 | break; |
1087 | 1087 | |
1088 | 1088 | case "private": |
1089 | - $qpart = "private = " . $this->pdo->quote($private); |
|
1089 | + $qpart = "private = ".$this->pdo->quote($private); |
|
1090 | 1090 | break; |
1091 | 1091 | |
1092 | 1092 | case "include_in_digest": |
1093 | - $qpart = "include_in_digest = " . $this->pdo->quote($include_in_digest); |
|
1093 | + $qpart = "include_in_digest = ".$this->pdo->quote($include_in_digest); |
|
1094 | 1094 | break; |
1095 | 1095 | |
1096 | 1096 | case "always_display_enclosures": |
1097 | - $qpart = "always_display_enclosures = " . $this->pdo->quote($always_display_enclosures); |
|
1097 | + $qpart = "always_display_enclosures = ".$this->pdo->quote($always_display_enclosures); |
|
1098 | 1098 | break; |
1099 | 1099 | |
1100 | 1100 | case "mark_unread_on_update": |
1101 | - $qpart = "mark_unread_on_update = " . $this->pdo->quote($mark_unread_on_update); |
|
1101 | + $qpart = "mark_unread_on_update = ".$this->pdo->quote($mark_unread_on_update); |
|
1102 | 1102 | break; |
1103 | 1103 | |
1104 | 1104 | case "cache_images": |
1105 | - $qpart = "cache_images = " . $this->pdo->quote($cache_images); |
|
1105 | + $qpart = "cache_images = ".$this->pdo->quote($cache_images); |
|
1106 | 1106 | break; |
1107 | 1107 | |
1108 | 1108 | case "hide_images": |
1109 | - $qpart = "hide_images = " . $this->pdo->quote($hide_images); |
|
1109 | + $qpart = "hide_images = ".$this->pdo->quote($hide_images); |
|
1110 | 1110 | break; |
1111 | 1111 | |
1112 | 1112 | case "cat_id": |
1113 | 1113 | if (get_pref('ENABLE_FEED_CATS')) { |
1114 | 1114 | if ($cat_id) { |
1115 | - $qpart = "cat_id = " . $this->pdo->quote($cat_id); |
|
1115 | + $qpart = "cat_id = ".$this->pdo->quote($cat_id); |
|
1116 | 1116 | } else { |
1117 | 1117 | $qpart = 'cat_id = NULL'; |
1118 | 1118 | } |
@@ -1123,7 +1123,7 @@ discard block |
||
1123 | 1123 | break; |
1124 | 1124 | |
1125 | 1125 | case "feed_language": |
1126 | - $qpart = "feed_language = " . $this->pdo->quote($feed_language); |
|
1126 | + $qpart = "feed_language = ".$this->pdo->quote($feed_language); |
|
1127 | 1127 | break; |
1128 | 1128 | |
1129 | 1129 | } |
@@ -1184,14 +1184,14 @@ discard block |
||
1184 | 1184 | |
1185 | 1185 | $error_button = "<button dojoType=\"dijit.form.Button\" |
1186 | 1186 | onclick=\"CommonDialogs.showFeedsWithErrors()\" id=\"errorButton\">" . |
1187 | - __("Feeds with errors") . "</button>"; |
|
1187 | + __("Feeds with errors")."</button>"; |
|
1188 | 1188 | } |
1189 | 1189 | |
1190 | 1190 | $inactive_button = "<button dojoType=\"dijit.form.Button\" |
1191 | 1191 | id=\"pref_feeds_inactive_btn\" |
1192 | 1192 | style=\"display : none\" |
1193 | 1193 | onclick=\"dijit.byId('feedTree').showInactiveFeeds()\">" . |
1194 | - __("Inactive feeds") . "</button>"; |
|
1194 | + __("Inactive feeds")."</button>"; |
|
1195 | 1195 | |
1196 | 1196 | $feed_search = clean($_REQUEST["search"]); |
1197 | 1197 | |
@@ -1213,7 +1213,7 @@ discard block |
||
1213 | 1213 | </div>"; |
1214 | 1214 | |
1215 | 1215 | print "<div dojoType=\"fox.form.DropDownButton\">". |
1216 | - "<span>" . __('Select')."</span>"; |
|
1216 | + "<span>".__('Select')."</span>"; |
|
1217 | 1217 | print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">"; |
1218 | 1218 | print "<div onclick=\"dijit.byId('feedTree').model.setAllChecked(true)\" |
1219 | 1219 | dojoType=\"dijit.MenuItem\">".__('All')."</div>"; |
@@ -1222,7 +1222,7 @@ discard block |
||
1222 | 1222 | print "</div></div>"; |
1223 | 1223 | |
1224 | 1224 | print "<div dojoType=\"fox.form.DropDownButton\">". |
1225 | - "<span>" . __('Feeds')."</span>"; |
|
1225 | + "<span>".__('Feeds')."</span>"; |
|
1226 | 1226 | print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">"; |
1227 | 1227 | print "<div onclick=\"CommonDialogs.quickAddFeed()\" |
1228 | 1228 | dojoType=\"dijit.MenuItem\">".__('Subscribe to feed')."</div>"; |
@@ -1238,7 +1238,7 @@ discard block |
||
1238 | 1238 | |
1239 | 1239 | if (get_pref('ENABLE_FEED_CATS')) { |
1240 | 1240 | print "<div dojoType=\"fox.form.DropDownButton\">". |
1241 | - "<span>" . __('Categories')."</span>"; |
|
1241 | + "<span>".__('Categories')."</span>"; |
|
1242 | 1242 | print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">"; |
1243 | 1243 | print "<div onclick=\"dijit.byId('feedTree').createCategory()\" |
1244 | 1244 | dojoType=\"dijit.MenuItem\">".__('Add category')."</div>"; |
@@ -1305,7 +1305,7 @@ discard block |
||
1305 | 1305 | print "<div dojoType='dijit.layout.AccordionPane' |
1306 | 1306 | title='<i class=\"material-icons\">import_export</i> ".__('OPML')."'>"; |
1307 | 1307 | |
1308 | - print "<h3>" . __("Using OPML you can export and import your feeds, filters, labels and Tiny Tiny RSS settings.") . "</h3>"; |
|
1308 | + print "<h3>".__("Using OPML you can export and import your feeds, filters, labels and Tiny Tiny RSS settings.")."</h3>"; |
|
1309 | 1309 | |
1310 | 1310 | print_notice("Only main settings profile can be migrated using OPML."); |
1311 | 1311 | |
@@ -1322,7 +1322,7 @@ discard block |
||
1322 | 1322 | <input type='hidden' name='op' value='dlg'> |
1323 | 1323 | <input type='hidden' name='method' value='importOpml'> |
1324 | 1324 | <button dojoType='dijit.form.Button' class='alt-primary' onclick=\"return Helpers.OPML.import();\" type=\"submit\">" . |
1325 | - __('Import OPML') . "</button>"; |
|
1325 | + __('Import OPML')."</button>"; |
|
1326 | 1326 | |
1327 | 1327 | print "</form>"; |
1328 | 1328 | |
@@ -1330,22 +1330,22 @@ discard block |
||
1330 | 1330 | |
1331 | 1331 | print "<button dojoType='dijit.form.Button' |
1332 | 1332 | onclick='Helpers.OPML.export()' >" . |
1333 | - __('Export OPML') . "</button>"; |
|
1333 | + __('Export OPML')."</button>"; |
|
1334 | 1334 | |
1335 | 1335 | print " <label class='checkbox'>"; |
1336 | 1336 | print_checkbox("include_settings", true, "1", ""); |
1337 | - print " " . __("Include settings"); |
|
1337 | + print " ".__("Include settings"); |
|
1338 | 1338 | print "</label>"; |
1339 | 1339 | |
1340 | 1340 | print "</form>"; |
1341 | 1341 | |
1342 | 1342 | print "<p/>"; |
1343 | 1343 | |
1344 | - print "<h2>" . __("Published OPML") . "</h2>"; |
|
1344 | + print "<h2>".__("Published OPML")."</h2>"; |
|
1345 | 1345 | |
1346 | - print "<p>" . __('Your OPML can be published publicly and can be subscribed by anyone who knows the URL below.') . |
|
1347 | - " " . |
|
1348 | - __("Published OPML does not include your Tiny Tiny RSS settings, feeds that require authentication or feeds hidden from Popular feeds.") . "</p>"; |
|
1346 | + print "<p>".__('Your OPML can be published publicly and can be subscribed by anyone who knows the URL below.'). |
|
1347 | + " ". |
|
1348 | + __("Published OPML does not include your Tiny Tiny RSS settings, feeds that require authentication or feeds hidden from Popular feeds.")."</p>"; |
|
1349 | 1349 | |
1350 | 1350 | print "<button dojoType='dijit.form.Button' class='alt-primary' onclick=\"return App.displayDlg('".__("Public OPML URL")."','pubOPMLUrl')\">". |
1351 | 1351 | __('Display published OPML URL')."</button> "; |
@@ -1358,10 +1358,10 @@ discard block |
||
1358 | 1358 | print "<div dojoType=\"dijit.layout.AccordionPane\" |
1359 | 1359 | title=\"<i class='material-icons'>share</i> ".__('Published & shared articles / Generated feeds')."\">"; |
1360 | 1360 | |
1361 | - print "<h3>" . __('Published articles can be subscribed by anyone who knows the following URL:') . "</h3>"; |
|
1361 | + print "<h3>".__('Published articles can be subscribed by anyone who knows the following URL:')."</h3>"; |
|
1362 | 1362 | |
1363 | - $rss_url = '-2::' . htmlspecialchars(get_self_url_prefix() . |
|
1364 | - "/public.php?op=rss&id=-2&view-mode=all_articles");; |
|
1363 | + $rss_url = '-2::'.htmlspecialchars(get_self_url_prefix(). |
|
1364 | + "/public.php?op=rss&id=-2&view-mode=all_articles"); ; |
|
1365 | 1365 | |
1366 | 1366 | print "<button dojoType='dijit.form.Button' class='alt-primary' onclick=\"return App.displayDlg('".__("Show as feed")."','generatedFeed', '$rss_url')\">". |
1367 | 1367 | __('Display URL')."</button> "; |
@@ -1390,7 +1390,7 @@ discard block |
||
1390 | 1390 | $cat_unread = Feeds::getCategoryUnread($cat_id); |
1391 | 1391 | } |
1392 | 1392 | |
1393 | - $obj['id'] = 'CAT:' . $cat_id; |
|
1393 | + $obj['id'] = 'CAT:'.$cat_id; |
|
1394 | 1394 | $obj['items'] = array(); |
1395 | 1395 | $obj['name'] = Feeds::getCategoryTitle($cat_id); |
1396 | 1396 | $obj['type'] = 'category'; |
@@ -1410,7 +1410,7 @@ discard block |
||
1410 | 1410 | if ($unread === false) |
1411 | 1411 | $unread = getFeedUnread($feed_id, false); |
1412 | 1412 | |
1413 | - $obj['id'] = 'FEED:' . $feed_id; |
|
1413 | + $obj['id'] = 'FEED:'.$feed_id; |
|
1414 | 1414 | $obj['name'] = $title; |
1415 | 1415 | $obj['unread'] = (int) $unread; |
1416 | 1416 | $obj['type'] = 'feed'; |
@@ -1446,7 +1446,7 @@ discard block |
||
1446 | 1446 | |
1447 | 1447 | print "<div dojoType='fox.Toolbar'>"; |
1448 | 1448 | print "<div dojoType='fox.form.DropDownButton'>". |
1449 | - "<span>" . __('Select')."</span>"; |
|
1449 | + "<span>".__('Select')."</span>"; |
|
1450 | 1450 | print "<div dojoType='dijit.Menu' style='display: none'>"; |
1451 | 1451 | print "<div onclick=\"Tables.select('inactive-feeds-list', true)\" |
1452 | 1452 | dojoType='dijit.MenuItem'>".__('All')."</div>"; |
@@ -1503,7 +1503,7 @@ discard block |
||
1503 | 1503 | |
1504 | 1504 | print "<div dojoType=\"fox.Toolbar\">"; |
1505 | 1505 | print "<div dojoType=\"fox.form.DropDownButton\">". |
1506 | - "<span>" . __('Select')."</span>"; |
|
1506 | + "<span>".__('Select')."</span>"; |
|
1507 | 1507 | print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">"; |
1508 | 1508 | print "<div onclick=\"Tables.select('error-feeds-list', true)\" |
1509 | 1509 | dojoType=\"dijit.MenuItem\">".__('All')."</div>"; |
@@ -1567,7 +1567,7 @@ discard block |
||
1567 | 1567 | |
1568 | 1568 | static function remove_feed($id, $owner_uid) { |
1569 | 1569 | foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_UNSUBSCRIBE_FEED) as $p) { |
1570 | - if (! $p->hook_unsubscribe_feed($id, $owner_uid)) { |
|
1570 | + if (!$p->hook_unsubscribe_feed($id, $owner_uid)) { |
|
1571 | 1571 | user_error("Feed $id (owner: $owner_uid) not removed due to plugin error (HOOK_UNSUBSCRIBE_FEED).", E_USER_WARNING); |
1572 | 1572 | return; |
1573 | 1573 | } |
@@ -1599,7 +1599,7 @@ discard block |
||
1599 | 1599 | $res = $pdo->query("SELECT MAX(id) AS id FROM ttrss_archived_feeds"); |
1600 | 1600 | $row = $res->fetch(); |
1601 | 1601 | |
1602 | - $new_feed_id = (int)$row['id'] + 1; |
|
1602 | + $new_feed_id = (int) $row['id'] + 1; |
|
1603 | 1603 | |
1604 | 1604 | $sth = $pdo->prepare("INSERT INTO ttrss_archived_feeds |
1605 | 1605 | (id, owner_uid, title, feed_url, site_url, created) |
@@ -1631,8 +1631,8 @@ discard block |
||
1631 | 1631 | |
1632 | 1632 | $pdo->commit(); |
1633 | 1633 | |
1634 | - if (file_exists(ICONS_DIR . "/$id.ico")) { |
|
1635 | - unlink(ICONS_DIR . "/$id.ico"); |
|
1634 | + if (file_exists(ICONS_DIR."/$id.ico")) { |
|
1635 | + unlink(ICONS_DIR."/$id.ico"); |
|
1636 | 1636 | } |
1637 | 1637 | |
1638 | 1638 | CCache::remove($id, $owner_uid); |
@@ -1656,7 +1656,7 @@ discard block |
||
1656 | 1656 | |
1657 | 1657 | if (get_pref('ENABLE_FEED_CATS')) { |
1658 | 1658 | print "<fieldset>"; |
1659 | - print "<label>" . __('Place in category:') . "</label> "; |
|
1659 | + print "<label>".__('Place in category:')."</label> "; |
|
1660 | 1660 | print_feed_cat_select("cat", false, 'dojoType="fox.form.Select"'); |
1661 | 1661 | print "</fieldset>"; |
1662 | 1662 | } |
@@ -1665,7 +1665,7 @@ discard block |
||
1665 | 1665 | |
1666 | 1666 | print "<div id='feedDlg_loginContainer' style='display : none'>"; |
1667 | 1667 | |
1668 | - print "<header>" . __("Authentication") . "</header>"; |
|
1668 | + print "<header>".__("Authentication")."</header>"; |
|
1669 | 1669 | print "<section>"; |
1670 | 1670 | |
1671 | 1671 | print "<input dojoType='dijit.form.TextBox' name='login' placeHolder=\"".__("Login")."\"> |
@@ -1784,12 +1784,12 @@ discard block |
||
1784 | 1784 | $sth->execute([$_SESSION['uid']]); |
1785 | 1785 | |
1786 | 1786 | if ($row = $sth->fetch()) { |
1787 | - print (int)$row["num_inactive"]; |
|
1787 | + print (int) $row["num_inactive"]; |
|
1788 | 1788 | } |
1789 | 1789 | } |
1790 | 1790 | |
1791 | 1791 | static function subscribe_to_feed_url() { |
1792 | - $url_path = get_self_url_prefix() . |
|
1792 | + $url_path = get_self_url_prefix(). |
|
1793 | 1793 | "/public.php?op=subscribe&feed_url=%s"; |
1794 | 1794 | return $url_path; |
1795 | 1795 | } |
@@ -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 | |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | foreach ($info as $section => $hotkeys) { |
42 | 42 | |
43 | 43 | if ($cur_section) print "<li> </li>"; |
44 | - print "<li><h3>" . $section . "</h3></li>"; |
|
44 | + print "<li><h3>".$section."</h3></li>"; |
|
45 | 45 | $cur_section = $section; |
46 | 46 | |
47 | 47 | foreach ($hotkeys as $action => $description) { |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | foreach ($omap[$action] as $sequence) { |
51 | 51 | if (strpos($sequence, "|") !== FALSE) { |
52 | 52 | $sequence = substr($sequence, |
53 | - strpos($sequence, "|")+1, |
|
53 | + strpos($sequence, "|") + 1, |
|
54 | 54 | strlen($sequence)); |
55 | 55 | } else { |
56 | 56 | $keys = explode(" ", $sequence); |
@@ -61,10 +61,10 @@ discard block |
||
61 | 61 | foreach (str_split($keys[$i]) as $c) { |
62 | 62 | switch ($c) { |
63 | 63 | case '*': |
64 | - $tmp .= __('Shift') . '+'; |
|
64 | + $tmp .= __('Shift').'+'; |
|
65 | 65 | break; |
66 | 66 | case '^': |
67 | - $tmp .= __('Ctrl') . '+'; |
|
67 | + $tmp .= __('Ctrl').'+'; |
|
68 | 68 | break; |
69 | 69 | default: |
70 | 70 | $tmp .= $c; |
@@ -30,7 +30,9 @@ discard block |
||
30 | 30 | $omap = array(); |
31 | 31 | |
32 | 32 | foreach ($imap[1] as $sequence => $action) { |
33 | - if (!isset($omap[$action])) $omap[$action] = array(); |
|
33 | + if (!isset($omap[$action])) { |
|
34 | + $omap[$action] = array(); |
|
35 | + } |
|
34 | 36 | |
35 | 37 | array_push($omap[$action], $sequence); |
36 | 38 | } |
@@ -40,7 +42,9 @@ discard block |
||
40 | 42 | $cur_section = ""; |
41 | 43 | foreach ($info as $section => $hotkeys) { |
42 | 44 | |
43 | - if ($cur_section) print "<li> </li>"; |
|
45 | + if ($cur_section) { |
|
46 | + print "<li> </li>"; |
|
47 | + } |
|
44 | 48 | print "<li><h3>" . $section . "</h3></li>"; |
45 | 49 | $cur_section = $section; |
46 | 50 |
@@ -398,21 +398,21 @@ discard block |
||
398 | 398 | $message = $query_error_override; |
399 | 399 | } else { |
400 | 400 | switch ($view_mode) { |
401 | - case "unread": |
|
402 | - $message = __("No unread articles found to display."); |
|
403 | - break; |
|
404 | - case "updated": |
|
405 | - $message = __("No updated articles found to display."); |
|
406 | - break; |
|
407 | - case "marked": |
|
408 | - $message = __("No starred articles found to display."); |
|
409 | - break; |
|
410 | - default: |
|
411 | - if ($feed < LABEL_BASE_INDEX) { |
|
412 | - $message = __("No articles found to display. You can assign articles to labels manually from article header context menu (applies to all selected articles) or use a filter."); |
|
413 | - } else { |
|
414 | - $message = __("No articles found to display."); |
|
415 | - } |
|
401 | + case "unread": |
|
402 | + $message = __("No unread articles found to display."); |
|
403 | + break; |
|
404 | + case "updated": |
|
405 | + $message = __("No updated articles found to display."); |
|
406 | + break; |
|
407 | + case "marked": |
|
408 | + $message = __("No starred articles found to display."); |
|
409 | + break; |
|
410 | + default: |
|
411 | + if ($feed < LABEL_BASE_INDEX) { |
|
412 | + $message = __("No articles found to display. You can assign articles to labels manually from article header context menu (applies to all selected articles) or use a filter."); |
|
413 | + } else { |
|
414 | + $message = __("No articles found to display."); |
|
415 | + } |
|
416 | 416 | } |
417 | 417 | } |
418 | 418 | |
@@ -874,29 +874,29 @@ discard block |
||
874 | 874 | // TODO: all this interval stuff needs some generic generator function |
875 | 875 | |
876 | 876 | switch ($mode) { |
877 | - case "1day": |
|
878 | - if (DB_TYPE == "pgsql") { |
|
879 | - $date_qpart = "date_entered < NOW() - INTERVAL '1 day' "; |
|
880 | - } else { |
|
881 | - $date_qpart = "date_entered < DATE_SUB(NOW(), INTERVAL 1 DAY) "; |
|
882 | - } |
|
883 | - break; |
|
884 | - case "1week": |
|
885 | - if (DB_TYPE == "pgsql") { |
|
886 | - $date_qpart = "date_entered < NOW() - INTERVAL '1 week' "; |
|
887 | - } else { |
|
888 | - $date_qpart = "date_entered < DATE_SUB(NOW(), INTERVAL 1 WEEK) "; |
|
889 | - } |
|
890 | - break; |
|
891 | - case "2week": |
|
892 | - if (DB_TYPE == "pgsql") { |
|
893 | - $date_qpart = "date_entered < NOW() - INTERVAL '2 week' "; |
|
894 | - } else { |
|
895 | - $date_qpart = "date_entered < DATE_SUB(NOW(), INTERVAL 2 WEEK) "; |
|
896 | - } |
|
897 | - break; |
|
898 | - default: |
|
899 | - $date_qpart = "true"; |
|
877 | + case "1day": |
|
878 | + if (DB_TYPE == "pgsql") { |
|
879 | + $date_qpart = "date_entered < NOW() - INTERVAL '1 day' "; |
|
880 | + } else { |
|
881 | + $date_qpart = "date_entered < DATE_SUB(NOW(), INTERVAL 1 DAY) "; |
|
882 | + } |
|
883 | + break; |
|
884 | + case "1week": |
|
885 | + if (DB_TYPE == "pgsql") { |
|
886 | + $date_qpart = "date_entered < NOW() - INTERVAL '1 week' "; |
|
887 | + } else { |
|
888 | + $date_qpart = "date_entered < DATE_SUB(NOW(), INTERVAL 1 WEEK) "; |
|
889 | + } |
|
890 | + break; |
|
891 | + case "2week": |
|
892 | + if (DB_TYPE == "pgsql") { |
|
893 | + $date_qpart = "date_entered < NOW() - INTERVAL '2 week' "; |
|
894 | + } else { |
|
895 | + $date_qpart = "date_entered < DATE_SUB(NOW(), INTERVAL 2 WEEK) "; |
|
896 | + } |
|
897 | + break; |
|
898 | + default: |
|
899 | + $date_qpart = "true"; |
|
900 | 900 | } |
901 | 901 | |
902 | 902 | if (is_numeric($feed)) { |
@@ -1212,28 +1212,28 @@ discard block |
||
1212 | 1212 | |
1213 | 1213 | static function getFeedIcon($id) { |
1214 | 1214 | switch ($id) { |
1215 | - case 0: |
|
1216 | - return "archive"; |
|
1217 | - case -1: |
|
1218 | - return "star"; |
|
1219 | - case -2: |
|
1220 | - return "rss_feed"; |
|
1221 | - case -3: |
|
1222 | - return "whatshot"; |
|
1223 | - case -4: |
|
1224 | - return "inbox"; |
|
1225 | - case -6: |
|
1226 | - return "restore"; |
|
1227 | - default: |
|
1228 | - if ($id < LABEL_BASE_INDEX) { |
|
1229 | - return "label"; |
|
1230 | - } else { |
|
1231 | - $icon = self::getIconFile($id); |
|
1215 | + case 0: |
|
1216 | + return "archive"; |
|
1217 | + case -1: |
|
1218 | + return "star"; |
|
1219 | + case -2: |
|
1220 | + return "rss_feed"; |
|
1221 | + case -3: |
|
1222 | + return "whatshot"; |
|
1223 | + case -4: |
|
1224 | + return "inbox"; |
|
1225 | + case -6: |
|
1226 | + return "restore"; |
|
1227 | + default: |
|
1228 | + if ($id < LABEL_BASE_INDEX) { |
|
1229 | + return "label"; |
|
1230 | + } else { |
|
1231 | + $icon = self::getIconFile($id); |
|
1232 | 1232 | |
1233 | 1233 | if ($icon && file_exists($icon)) { |
1234 | - return ICONS_URL . "/" . basename($icon) . "?" . filemtime($icon); |
|
1235 | - } |
|
1234 | + return ICONS_URL . "/" . basename($icon) . "?" . filemtime($icon); |
|
1236 | 1235 | } |
1236 | + } |
|
1237 | 1237 | } |
1238 | 1238 | |
1239 | 1239 | return false; |
@@ -2201,102 +2201,102 @@ discard block |
||
2201 | 2201 | $commandpair = explode(":", mb_strtolower($k), 2); |
2202 | 2202 | |
2203 | 2203 | switch ($commandpair[0]) { |
2204 | - case "title": |
|
2205 | - if ($commandpair[1]) { |
|
2206 | - array_push($query_keywords, "($not (LOWER(ttrss_entries.title) LIKE ". |
|
2207 | - $pdo->quote('%' . mb_strtolower($commandpair[1]) . '%') ."))"); |
|
2208 | - } else { |
|
2209 | - array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER('%$k%') |
|
2204 | + case "title": |
|
2205 | + if ($commandpair[1]) { |
|
2206 | + array_push($query_keywords, "($not (LOWER(ttrss_entries.title) LIKE ". |
|
2207 | + $pdo->quote('%' . mb_strtolower($commandpair[1]) . '%') ."))"); |
|
2208 | + } else { |
|
2209 | + array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER('%$k%') |
|
2210 | 2210 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
2211 | - array_push($search_words, $k); |
|
2212 | - } |
|
2213 | - break; |
|
2214 | - case "author": |
|
2215 | - if ($commandpair[1]) { |
|
2216 | - array_push($query_keywords, "($not (LOWER(author) LIKE ". |
|
2217 | - $pdo->quote('%' . mb_strtolower($commandpair[1]) . '%')."))"); |
|
2218 | - } else { |
|
2219 | - array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER('%$k%') |
|
2211 | + array_push($search_words, $k); |
|
2212 | + } |
|
2213 | + break; |
|
2214 | + case "author": |
|
2215 | + if ($commandpair[1]) { |
|
2216 | + array_push($query_keywords, "($not (LOWER(author) LIKE ". |
|
2217 | + $pdo->quote('%' . mb_strtolower($commandpair[1]) . '%')."))"); |
|
2218 | + } else { |
|
2219 | + array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER('%$k%') |
|
2220 | 2220 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
2221 | - array_push($search_words, $k); |
|
2222 | - } |
|
2223 | - break; |
|
2224 | - case "note": |
|
2225 | - if ($commandpair[1]) { |
|
2226 | - if ($commandpair[1] == "true") |
|
2227 | - array_push($query_keywords, "($not (note IS NOT NULL AND note != ''))"); |
|
2228 | - else if ($commandpair[1] == "false") |
|
2229 | - array_push($query_keywords, "($not (note IS NULL OR note = ''))"); |
|
2230 | - else |
|
2231 | - array_push($query_keywords, "($not (LOWER(note) LIKE ". |
|
2232 | - $pdo->quote('%' . mb_strtolower($commandpair[1]) . '%')."))"); |
|
2233 | - } else { |
|
2234 | - array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").") |
|
2221 | + array_push($search_words, $k); |
|
2222 | + } |
|
2223 | + break; |
|
2224 | + case "note": |
|
2225 | + if ($commandpair[1]) { |
|
2226 | + if ($commandpair[1] == "true") |
|
2227 | + array_push($query_keywords, "($not (note IS NOT NULL AND note != ''))"); |
|
2228 | + else if ($commandpair[1] == "false") |
|
2229 | + array_push($query_keywords, "($not (note IS NULL OR note = ''))"); |
|
2230 | + else |
|
2231 | + array_push($query_keywords, "($not (LOWER(note) LIKE ". |
|
2232 | + $pdo->quote('%' . mb_strtolower($commandpair[1]) . '%')."))"); |
|
2233 | + } else { |
|
2234 | + array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").") |
|
2235 | 2235 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
2236 | - if (!$not) array_push($search_words, $k); |
|
2237 | - } |
|
2238 | - break; |
|
2239 | - case "star": |
|
2236 | + if (!$not) array_push($search_words, $k); |
|
2237 | + } |
|
2238 | + break; |
|
2239 | + case "star": |
|
2240 | 2240 | |
2241 | - if ($commandpair[1]) { |
|
2242 | - if ($commandpair[1] == "true") |
|
2243 | - array_push($query_keywords, "($not (marked = true))"); |
|
2244 | - else |
|
2245 | - array_push($query_keywords, "($not (marked = false))"); |
|
2246 | - } else { |
|
2247 | - array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").") |
|
2241 | + if ($commandpair[1]) { |
|
2242 | + if ($commandpair[1] == "true") |
|
2243 | + array_push($query_keywords, "($not (marked = true))"); |
|
2244 | + else |
|
2245 | + array_push($query_keywords, "($not (marked = false))"); |
|
2246 | + } else { |
|
2247 | + array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").") |
|
2248 | 2248 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
2249 | - if (!$not) array_push($search_words, $k); |
|
2250 | - } |
|
2251 | - break; |
|
2252 | - case "pub": |
|
2253 | - if ($commandpair[1]) { |
|
2254 | - if ($commandpair[1] == "true") |
|
2255 | - array_push($query_keywords, "($not (published = true))"); |
|
2256 | - else |
|
2257 | - array_push($query_keywords, "($not (published = false))"); |
|
2249 | + if (!$not) array_push($search_words, $k); |
|
2250 | + } |
|
2251 | + break; |
|
2252 | + case "pub": |
|
2253 | + if ($commandpair[1]) { |
|
2254 | + if ($commandpair[1] == "true") |
|
2255 | + array_push($query_keywords, "($not (published = true))"); |
|
2256 | + else |
|
2257 | + array_push($query_keywords, "($not (published = false))"); |
|
2258 | 2258 | |
2259 | - } else { |
|
2260 | - array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER('%$k%') |
|
2259 | + } else { |
|
2260 | + array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER('%$k%') |
|
2261 | 2261 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
2262 | - if (!$not) array_push($search_words, $k); |
|
2263 | - } |
|
2264 | - break; |
|
2265 | - case "unread": |
|
2266 | - if ($commandpair[1]) { |
|
2267 | - if ($commandpair[1] == "true") |
|
2268 | - array_push($query_keywords, "($not (unread = true))"); |
|
2269 | - else |
|
2270 | - array_push($query_keywords, "($not (unread = false))"); |
|
2262 | + if (!$not) array_push($search_words, $k); |
|
2263 | + } |
|
2264 | + break; |
|
2265 | + case "unread": |
|
2266 | + if ($commandpair[1]) { |
|
2267 | + if ($commandpair[1] == "true") |
|
2268 | + array_push($query_keywords, "($not (unread = true))"); |
|
2269 | + else |
|
2270 | + array_push($query_keywords, "($not (unread = false))"); |
|
2271 | 2271 | |
2272 | - } else { |
|
2273 | - array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").") |
|
2272 | + } else { |
|
2273 | + array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").") |
|
2274 | 2274 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
2275 | - if (!$not) array_push($search_words, $k); |
|
2276 | - } |
|
2277 | - break; |
|
2278 | - default: |
|
2279 | - if (strpos($k, "@") === 0) { |
|
2275 | + if (!$not) array_push($search_words, $k); |
|
2276 | + } |
|
2277 | + break; |
|
2278 | + default: |
|
2279 | + if (strpos($k, "@") === 0) { |
|
2280 | 2280 | |
2281 | - $user_tz_string = get_pref('USER_TIMEZONE', $_SESSION['uid']); |
|
2282 | - $orig_ts = strtotime(substr($k, 1)); |
|
2283 | - $k = date("Y-m-d", convert_timestamp($orig_ts, $user_tz_string, 'UTC')); |
|
2281 | + $user_tz_string = get_pref('USER_TIMEZONE', $_SESSION['uid']); |
|
2282 | + $orig_ts = strtotime(substr($k, 1)); |
|
2283 | + $k = date("Y-m-d", convert_timestamp($orig_ts, $user_tz_string, 'UTC')); |
|
2284 | 2284 | |
2285 | - //$k = date("Y-m-d", strtotime(substr($k, 1))); |
|
2285 | + //$k = date("Y-m-d", strtotime(substr($k, 1))); |
|
2286 | 2286 | |
2287 | - array_push($query_keywords, "(".SUBSTRING_FOR_DATE."(updated,1,LENGTH('$k')) $not = '$k')"); |
|
2288 | - } else { |
|
2287 | + array_push($query_keywords, "(".SUBSTRING_FOR_DATE."(updated,1,LENGTH('$k')) $not = '$k')"); |
|
2288 | + } else { |
|
2289 | 2289 | |
2290 | - if (DB_TYPE == "pgsql") { |
|
2291 | - $k = mb_strtolower($k); |
|
2292 | - array_push($search_query_leftover, $not ? "!$k" : $k); |
|
2293 | - } else { |
|
2294 | - array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").") |
|
2290 | + if (DB_TYPE == "pgsql") { |
|
2291 | + $k = mb_strtolower($k); |
|
2292 | + array_push($search_query_leftover, $not ? "!$k" : $k); |
|
2293 | + } else { |
|
2294 | + array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").") |
|
2295 | 2295 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
2296 | - } |
|
2297 | - |
|
2298 | - if (!$not) array_push($search_words, $k); |
|
2299 | 2296 | } |
2297 | + |
|
2298 | + if (!$not) array_push($search_words, $k); |
|
2299 | + } |
|
2300 | 2300 | } |
2301 | 2301 | } |
2302 | 2302 |
@@ -2,8 +2,8 @@ discard block |
||
2 | 2 | require_once "colors.php"; |
3 | 3 | |
4 | 4 | class Feeds extends Handler_Protected { |
5 | - const NEVER_GROUP_FEEDS = [ -6, 0 ]; |
|
6 | - const NEVER_GROUP_BY_DATE = [ -2, -1, -3 ]; |
|
5 | + const NEVER_GROUP_FEEDS = [ -6, 0]; |
|
6 | + const NEVER_GROUP_BY_DATE = [ -2, -1, -3]; |
|
7 | 7 | |
8 | 8 | private $params; |
9 | 9 | |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | |
28 | 28 | $reply = ""; |
29 | 29 | |
30 | - $rss_link = htmlspecialchars(get_self_url_prefix() . |
|
30 | + $rss_link = htmlspecialchars(get_self_url_prefix(). |
|
31 | 31 | "/public.php?op=rss&id=$feed_id$cat_q$search_q"); |
32 | 32 | |
33 | 33 | $reply .= "<span class='left'>"; |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | } |
50 | 50 | |
51 | 51 | if ($error) |
52 | - $reply .= " <i title=\"" . htmlspecialchars($error) . "\" class='material-icons icon-error'>error</i>"; |
|
52 | + $reply .= " <i title=\"".htmlspecialchars($error)."\" class='material-icons icon-error'>error</i>"; |
|
53 | 53 | |
54 | 54 | $reply .= "</span>"; |
55 | 55 | $reply .= "<span id='feed_current_unread' style='display: none'></span>"; |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | $sth->execute([$feed]); |
140 | 140 | } |
141 | 141 | |
142 | - if ($method_split[0] == "MarkAllReadGR") { |
|
142 | + if ($method_split[0] == "MarkAllReadGR") { |
|
143 | 143 | $this->catchup_feed($method_split[1], false); |
144 | 144 | } |
145 | 145 | |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | if (!get_pref('SHOW_CONTENT_PREVIEW')) { |
244 | 244 | $line["content_preview"] = ""; |
245 | 245 | } else { |
246 | - $line["content_preview"] = "— " . truncate_string(strip_tags($line["content"]), 250); |
|
246 | + $line["content_preview"] = "— ".truncate_string(strip_tags($line["content"]), 250); |
|
247 | 247 | |
248 | 248 | foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_QUERY_HEADLINES) as $p) { |
249 | 249 | $line = $p->hook_query_headlines($line, 250, false); |
@@ -322,10 +322,10 @@ discard block |
||
322 | 322 | if (!get_pref("CDM_EXPANDED")) { |
323 | 323 | $line["cdm_excerpt"] = "<span class='collapse'> |
324 | 324 | <i class='material-icons' onclick='return Article.cdmUnsetActive(event)' |
325 | - title=\"" . __("Collapse article") . "\">remove_circle</i></span>"; |
|
325 | + title=\"" . __("Collapse article")."\">remove_circle</i></span>"; |
|
326 | 326 | |
327 | 327 | if (get_pref('SHOW_CONTENT_PREVIEW')) { |
328 | - $line["cdm_excerpt"] .= "<span class='excerpt'>" . $line["content_preview"] . "</span>"; |
|
328 | + $line["cdm_excerpt"] .= "<span class='excerpt'>".$line["content_preview"]."</span>"; |
|
329 | 329 | } |
330 | 330 | } |
331 | 331 | |
@@ -339,11 +339,11 @@ discard block |
||
339 | 339 | $ofgh->execute([$line["orig_feed_id"], $_SESSION['uid']]); |
340 | 340 | |
341 | 341 | if ($tmp_line = $ofgh->fetch()) { |
342 | - $line["orig_feed"] = [ $tmp_line["title"], $tmp_line["site_url"], $tmp_line["feed_url"] ]; |
|
342 | + $line["orig_feed"] = [$tmp_line["title"], $tmp_line["site_url"], $tmp_line["feed_url"]]; |
|
343 | 343 | } |
344 | 344 | } |
345 | 345 | |
346 | - $line["updated_long"] = make_local_datetime($line["updated"],true); |
|
346 | + $line["updated_long"] = make_local_datetime($line["updated"], true); |
|
347 | 347 | $line["updated"] = make_local_datetime($line["updated"], false, false, false, true); |
348 | 348 | |
349 | 349 | |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | } |
378 | 378 | |
379 | 379 | if (isset($rgba_cache[$feed_id])) { |
380 | - $line['feed_bg_color'] = 'rgba(' . implode(",", $rgba_cache[$feed_id]) . ',0.3)'; |
|
380 | + $line['feed_bg_color'] = 'rgba('.implode(",", $rgba_cache[$feed_id]).',0.3)'; |
|
381 | 381 | } |
382 | 382 | |
383 | 383 | /* we don't need those */ |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | |
422 | 422 | $reply['content'] .= "<p><span class=\"text-muted\">"; |
423 | 423 | |
424 | - $sth = $this->pdo->prepare("SELECT " . SUBSTRING_FOR_DATE . "(MAX(last_updated), 1, 19) AS last_updated FROM ttrss_feeds |
|
424 | + $sth = $this->pdo->prepare("SELECT ".SUBSTRING_FOR_DATE."(MAX(last_updated), 1, 19) AS last_updated FROM ttrss_feeds |
|
425 | 425 | WHERE owner_uid = ?"); |
426 | 426 | $sth->execute([$_SESSION['uid']]); |
427 | 427 | $row = $sth->fetch(); |
@@ -439,8 +439,8 @@ discard block |
||
439 | 439 | |
440 | 440 | if ($num_errors > 0) { |
441 | 441 | $reply['content'] .= "<br/>"; |
442 | - $reply['content'] .= "<a class=\"text-muted\" href=\"#\" onclick=\"CommonDialogs.showFeedsWithErrors()\">" . |
|
443 | - __('Some feeds have update errors (click for details)') . "</a>"; |
|
442 | + $reply['content'] .= "<a class=\"text-muted\" href=\"#\" onclick=\"CommonDialogs.showFeedsWithErrors()\">". |
|
443 | + __('Some feeds have update errors (click for details)')."</a>"; |
|
444 | 444 | } |
445 | 445 | $reply['content'] .= "</span></p></div>"; |
446 | 446 | |
@@ -635,7 +635,7 @@ discard block |
||
635 | 635 | $reply['headlines']['is_cat'] = false; |
636 | 636 | |
637 | 637 | $reply['headlines']['toolbar'] = ''; |
638 | - $reply['headlines']['content'] = "<div class='whiteBox'>". $error . "</div>"; |
|
638 | + $reply['headlines']['content'] = "<div class='whiteBox'>".$error."</div>"; |
|
639 | 639 | |
640 | 640 | $reply['headlines-info'] = array("count" => 0, |
641 | 641 | "unread" => 0, |
@@ -669,7 +669,7 @@ discard block |
||
669 | 669 | print "<fieldset>"; |
670 | 670 | |
671 | 671 | if (get_pref('ENABLE_FEED_CATS')) { |
672 | - print "<label class='inline'>" . __('Place in category:') . "</label> "; |
|
672 | + print "<label class='inline'>".__('Place in category:')."</label> "; |
|
673 | 673 | print_feed_cat_select("cat", false, 'dojoType="fox.form.Select"'); |
674 | 674 | } |
675 | 675 | |
@@ -678,7 +678,7 @@ discard block |
||
678 | 678 | print "</section>"; |
679 | 679 | |
680 | 680 | print '<div id="feedDlg_feedsContainer" style="display : none"> |
681 | - <header>' . __('Available feeds') . '</header> |
|
681 | + <header>' . __('Available feeds').'</header> |
|
682 | 682 | <section> |
683 | 683 | <fieldset> |
684 | 684 | <select id="feedDlg_feedContainerSelect" |
@@ -743,7 +743,7 @@ discard block |
||
743 | 743 | |
744 | 744 | if (DB_TYPE == "pgsql") { |
745 | 745 | print "<fieldset>"; |
746 | - print "<label class='inline'>" . __("Language:") . "</label>"; |
|
746 | + print "<label class='inline'>".__("Language:")."</label>"; |
|
747 | 747 | print_select("search_language", get_pref('DEFAULT_SEARCH_LANGUAGE'), Pref_Feeds::get_ts_languages(), |
748 | 748 | "dojoType='fox.form.Select' title=\"".__('Used for word stemming')."\""); |
749 | 749 | print "</fieldset>"; |
@@ -772,7 +772,7 @@ discard block |
||
772 | 772 | Debug::set_enabled(true); |
773 | 773 | Debug::set_loglevel($_REQUEST["xdebug"]); |
774 | 774 | |
775 | - $feed_id = (int)$_REQUEST["feed_id"]; |
|
775 | + $feed_id = (int) $_REQUEST["feed_id"]; |
|
776 | 776 | @$do_update = $_REQUEST["action"] == "do_update"; |
777 | 777 | $csrf_token = $_REQUEST["csrf_token"]; |
778 | 778 | |
@@ -811,7 +811,7 @@ discard block |
||
811 | 811 | </script> |
812 | 812 | |
813 | 813 | <div class="container"> |
814 | - <h1>Feed Debugger: <?php echo "$feed_id: " . $this->getFeedTitle($feed_id) ?></h1> |
|
814 | + <h1>Feed Debugger: <?php echo "$feed_id: ".$this->getFeedTitle($feed_id) ?></h1> |
|
815 | 815 | <div class="content"> |
816 | 816 | <form method="GET" action=""> |
817 | 817 | <input type="hidden" name="op" value="feeds"> |
@@ -1074,7 +1074,7 @@ discard block |
||
1074 | 1074 | } else if ($n_feed >= 0) { |
1075 | 1075 | |
1076 | 1076 | if ($n_feed != 0) { |
1077 | - $match_part = "feed_id = " . (int)$n_feed; |
|
1077 | + $match_part = "feed_id = ".(int) $n_feed; |
|
1078 | 1078 | } else { |
1079 | 1079 | $match_part = "feed_id IS NULL"; |
1080 | 1080 | } |
@@ -1184,7 +1184,7 @@ discard block |
||
1184 | 1184 | (owner_uid,feed_url,title,cat_id, auth_login,auth_pass,update_method,auth_pass_encrypted) |
1185 | 1185 | VALUES (?, ?, ?, ?, ?, ?, 0, false)"); |
1186 | 1186 | |
1187 | - $sth->execute([$_SESSION['uid'], $url, "[Unknown]", $cat_id, (string)$auth_login, (string)$auth_pass]); |
|
1187 | + $sth->execute([$_SESSION['uid'], $url, "[Unknown]", $cat_id, (string) $auth_login, (string) $auth_pass]); |
|
1188 | 1188 | |
1189 | 1189 | $sth = $pdo->prepare("SELECT id FROM ttrss_feeds WHERE feed_url = ? |
1190 | 1190 | AND owner_uid = ?"); |
@@ -1203,11 +1203,11 @@ discard block |
||
1203 | 1203 | } |
1204 | 1204 | |
1205 | 1205 | static function getIconFile($feed_id) { |
1206 | - return ICONS_DIR . "/$feed_id.ico"; |
|
1206 | + return ICONS_DIR."/$feed_id.ico"; |
|
1207 | 1207 | } |
1208 | 1208 | |
1209 | 1209 | static function feedHasIcon($id) { |
1210 | - return is_file(ICONS_DIR . "/$id.ico") && filesize(ICONS_DIR . "/$id.ico") > 0; |
|
1210 | + return is_file(ICONS_DIR."/$id.ico") && filesize(ICONS_DIR."/$id.ico") > 0; |
|
1211 | 1211 | } |
1212 | 1212 | |
1213 | 1213 | static function getFeedIcon($id) { |
@@ -1231,7 +1231,7 @@ discard block |
||
1231 | 1231 | $icon = self::getIconFile($id); |
1232 | 1232 | |
1233 | 1233 | if ($icon && file_exists($icon)) { |
1234 | - return ICONS_URL . "/" . basename($icon) . "?" . filemtime($icon); |
|
1234 | + return ICONS_URL."/".basename($icon)."?".filemtime($icon); |
|
1235 | 1235 | } |
1236 | 1236 | } |
1237 | 1237 | } |
@@ -1303,7 +1303,7 @@ discard block |
||
1303 | 1303 | |
1304 | 1304 | $cat_feeds = array(); |
1305 | 1305 | while ($line = $sth->fetch()) { |
1306 | - array_push($cat_feeds, "feed_id = " . (int)$line["id"]); |
|
1306 | + array_push($cat_feeds, "feed_id = ".(int) $line["id"]); |
|
1307 | 1307 | } |
1308 | 1308 | |
1309 | 1309 | if (count($cat_feeds) == 0) return 0; |
@@ -1517,7 +1517,7 @@ discard block |
||
1517 | 1517 | } |
1518 | 1518 | |
1519 | 1519 | if ($limit > 0) { |
1520 | - $limit_query_part = "LIMIT " . (int)$limit; |
|
1520 | + $limit_query_part = "LIMIT ".(int) $limit; |
|
1521 | 1521 | } |
1522 | 1522 | |
1523 | 1523 | $allow_archived = false; |
@@ -1544,7 +1544,7 @@ discard block |
||
1544 | 1544 | implode(",", $subcats).")"; |
1545 | 1545 | |
1546 | 1546 | } else { |
1547 | - $query_strategy_part = "cat_id = " . $pdo->quote($feed); |
|
1547 | + $query_strategy_part = "cat_id = ".$pdo->quote($feed); |
|
1548 | 1548 | } |
1549 | 1549 | |
1550 | 1550 | } else { |
@@ -1554,7 +1554,7 @@ discard block |
||
1554 | 1554 | $vfeed_query_part = "ttrss_feeds.title AS feed_title,"; |
1555 | 1555 | |
1556 | 1556 | } else { |
1557 | - $query_strategy_part = "feed_id = " . $pdo->quote($feed); |
|
1557 | + $query_strategy_part = "feed_id = ".$pdo->quote($feed); |
|
1558 | 1558 | } |
1559 | 1559 | } else if ($feed == 0 && !$cat_view) { // archive virtual feed |
1560 | 1560 | $query_strategy_part = "feed_id IS NULL"; |
@@ -1676,7 +1676,7 @@ discard block |
||
1676 | 1676 | $content_query_part = "content, "; |
1677 | 1677 | |
1678 | 1678 | if ($limit_query_part) { |
1679 | - $offset_query_part = "OFFSET " . (int)$offset; |
|
1679 | + $offset_query_part = "OFFSET ".(int) $offset; |
|
1680 | 1680 | } else { |
1681 | 1681 | $offset_query_part = ""; |
1682 | 1682 | } |
@@ -1765,7 +1765,7 @@ discard block |
||
1765 | 1765 | $res = $pdo->query($query); |
1766 | 1766 | |
1767 | 1767 | if ($row = $res->fetch()) { |
1768 | - $first_id = (int)$row["id"]; |
|
1768 | + $first_id = (int) $row["id"]; |
|
1769 | 1769 | |
1770 | 1770 | if ($offset > 0 && $first_id && $check_first_id && $first_id != $check_first_id) { |
1771 | 1771 | return array(-1, $feed_title, $feed_site_url, $last_error, $last_updated, $search_words, $first_id, $vfeed_query_part != "", $query_error_override); |
@@ -1912,9 +1912,9 @@ discard block |
||
1912 | 1912 | } |
1913 | 1913 | |
1914 | 1914 | function color_of($name) { |
1915 | - $colormap = [ "#1cd7d7","#d91111","#1212d7","#8e16e5","#7b7b7b", |
|
1916 | - "#39f110","#0bbea6","#ec0e0e","#1534f2","#b9e416", |
|
1917 | - "#479af2","#f36b14","#10c7e9","#1e8fe7","#e22727" ]; |
|
1915 | + $colormap = ["#1cd7d7", "#d91111", "#1212d7", "#8e16e5", "#7b7b7b", |
|
1916 | + "#39f110", "#0bbea6", "#ec0e0e", "#1534f2", "#b9e416", |
|
1917 | + "#479af2", "#f36b14", "#10c7e9", "#1e8fe7", "#e22727"]; |
|
1918 | 1918 | |
1919 | 1919 | $sum = 0; |
1920 | 1920 | |
@@ -1978,13 +1978,13 @@ discard block |
||
1978 | 1978 | |
1979 | 1979 | // support schema-less urls |
1980 | 1980 | if (strpos($url, '//') === 0) { |
1981 | - $url = 'https:' . $url; |
|
1981 | + $url = 'https:'.$url; |
|
1982 | 1982 | } |
1983 | 1983 | |
1984 | 1984 | if (strpos($url, '://') === false) { |
1985 | - $url = 'http://' . $url; |
|
1985 | + $url = 'http://'.$url; |
|
1986 | 1986 | } else if (substr($url, 0, 5) == 'feed:') { |
1987 | - $url = 'http:' . substr($url, 5); |
|
1987 | + $url = 'http:'.substr($url, 5); |
|
1988 | 1988 | } |
1989 | 1989 | |
1990 | 1990 | //prepend slash if the URL has no slash in it |
@@ -2034,7 +2034,7 @@ discard block |
||
2034 | 2034 | |
2035 | 2035 | $sth = $pdo->prepare("INSERT INTO ttrss_feed_categories (owner_uid,title,parent_cat,order_id) |
2036 | 2036 | VALUES (?, ?, ?, ?)"); |
2037 | - $sth->execute([$_SESSION['uid'], $feed_cat, $parent_cat_id, (int)$order_id]); |
|
2037 | + $sth->execute([$_SESSION['uid'], $feed_cat, $parent_cat_id, (int) $order_id]); |
|
2038 | 2038 | |
2039 | 2039 | if (!$tr_in_progress) $pdo->commit(); |
2040 | 2040 | |
@@ -2134,7 +2134,7 @@ discard block |
||
2134 | 2134 | $sth->execute([$feed_id]); |
2135 | 2135 | |
2136 | 2136 | } else { |
2137 | - $sth = $pdo->prepare("DELETE FROM ttrss_user_entries |
|
2137 | + $sth = $pdo->prepare("DELETE FROM ttrss_user_entries |
|
2138 | 2138 | USING ttrss_user_entries, ttrss_entries |
2139 | 2139 | WHERE ttrss_entries.id = ref_id AND |
2140 | 2140 | marked = false AND |
@@ -2204,7 +2204,7 @@ discard block |
||
2204 | 2204 | case "title": |
2205 | 2205 | if ($commandpair[1]) { |
2206 | 2206 | array_push($query_keywords, "($not (LOWER(ttrss_entries.title) LIKE ". |
2207 | - $pdo->quote('%' . mb_strtolower($commandpair[1]) . '%') ."))"); |
|
2207 | + $pdo->quote('%'.mb_strtolower($commandpair[1]).'%')."))"); |
|
2208 | 2208 | } else { |
2209 | 2209 | array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER('%$k%') |
2210 | 2210 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
@@ -2214,7 +2214,7 @@ discard block |
||
2214 | 2214 | case "author": |
2215 | 2215 | if ($commandpair[1]) { |
2216 | 2216 | array_push($query_keywords, "($not (LOWER(author) LIKE ". |
2217 | - $pdo->quote('%' . mb_strtolower($commandpair[1]) . '%')."))"); |
|
2217 | + $pdo->quote('%'.mb_strtolower($commandpair[1]).'%')."))"); |
|
2218 | 2218 | } else { |
2219 | 2219 | array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER('%$k%') |
2220 | 2220 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
@@ -2229,7 +2229,7 @@ discard block |
||
2229 | 2229 | array_push($query_keywords, "($not (note IS NULL OR note = ''))"); |
2230 | 2230 | else |
2231 | 2231 | array_push($query_keywords, "($not (LOWER(note) LIKE ". |
2232 | - $pdo->quote('%' . mb_strtolower($commandpair[1]) . '%')."))"); |
|
2232 | + $pdo->quote('%'.mb_strtolower($commandpair[1]).'%')."))"); |
|
2233 | 2233 | } else { |
2234 | 2234 | array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").") |
2235 | 2235 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
@@ -2306,7 +2306,7 @@ discard block |
||
2306 | 2306 | |
2307 | 2307 | // if there's no joiners consider this a "simple" search and |
2308 | 2308 | // concatenate everything with &, otherwise don't try to mess with tsquery syntax |
2309 | - if (preg_match("/[&|]/", implode(" " , $search_query_leftover))) { |
|
2309 | + if (preg_match("/[&|]/", implode(" ", $search_query_leftover))) { |
|
2310 | 2310 | $tsquery = $pdo->quote(implode(" ", $search_query_leftover)); |
2311 | 2311 | } else { |
2312 | 2312 | $tsquery = $pdo->quote(implode(" & ", $search_query_leftover)); |
@@ -17,7 +17,9 @@ discard block |
||
17 | 17 | $feed_id, $is_cat, $search, |
18 | 18 | $error, $feed_last_updated) { |
19 | 19 | |
20 | - if ($is_cat) $cat_q = "&is_cat=$is_cat"; |
|
20 | + if ($is_cat) { |
|
21 | + $cat_q = "&is_cat=$is_cat"; |
|
22 | + } |
|
21 | 23 | |
22 | 24 | if ($search) { |
23 | 25 | $search_q = "&q=$search"; |
@@ -48,8 +50,9 @@ discard block |
||
48 | 50 | $reply .= strip_tags($feed_title); |
49 | 51 | } |
50 | 52 | |
51 | - if ($error) |
|
52 | - $reply .= " <i title=\"" . htmlspecialchars($error) . "\" class='material-icons icon-error'>error</i>"; |
|
53 | + if ($error) { |
|
54 | + $reply .= " <i title=\"" . htmlspecialchars($error) . "\" class='material-icons icon-error'>error</i>"; |
|
55 | + } |
|
53 | 56 | |
54 | 57 | $reply .= "</span>"; |
55 | 58 | $reply .= "<span id='feed_current_unread' style='display: none'></span>"; |
@@ -127,8 +130,12 @@ discard block |
||
127 | 130 | $rgba_cache = array(); |
128 | 131 | $topmost_article_ids = array(); |
129 | 132 | |
130 | - if (!$offset) $offset = 0; |
|
131 | - if ($method == "undefined") $method = ""; |
|
133 | + if (!$offset) { |
|
134 | + $offset = 0; |
|
135 | + } |
|
136 | + if ($method == "undefined") { |
|
137 | + $method = ""; |
|
138 | + } |
|
132 | 139 | |
133 | 140 | $method_split = explode(":", $method); |
134 | 141 | |
@@ -274,14 +281,17 @@ discard block |
||
274 | 281 | $label_cache = json_decode($label_cache, true); |
275 | 282 | |
276 | 283 | if ($label_cache) { |
277 | - if ($label_cache["no-labels"] == 1) |
|
278 | - $labels = array(); |
|
279 | - else |
|
280 | - $labels = $label_cache; |
|
284 | + if ($label_cache["no-labels"] == 1) { |
|
285 | + $labels = array(); |
|
286 | + } else { |
|
287 | + $labels = $label_cache; |
|
288 | + } |
|
281 | 289 | } |
282 | 290 | } |
283 | 291 | |
284 | - if (!is_array($labels)) $labels = Article::get_article_labels($id); |
|
292 | + if (!is_array($labels)) { |
|
293 | + $labels = Article::get_article_labels($id); |
|
294 | + } |
|
285 | 295 | |
286 | 296 | $labels_str = "<span class=\"HLLCTR-$id\">"; |
287 | 297 | $labels_str .= Article::format_article_labels($labels); |
@@ -293,7 +303,9 @@ discard block |
||
293 | 303 | array_push($topmost_article_ids, $id); |
294 | 304 | } |
295 | 305 | |
296 | - if (!$line["feed_title"]) $line["feed_title"] = ""; |
|
306 | + if (!$line["feed_title"]) { |
|
307 | + $line["feed_title"] = ""; |
|
308 | + } |
|
297 | 309 | |
298 | 310 | $line["buttons_left"] = ""; |
299 | 311 | foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_ARTICLE_LEFT_BUTTON) as $p) { |
@@ -314,10 +326,11 @@ discard block |
||
314 | 326 | |
315 | 327 | $line['content'] = DiskCache::rewriteUrls($line['content']); |
316 | 328 | |
317 | - if ($line['note']) |
|
318 | - $line['note'] = Article::format_article_note($id, $line['note']); |
|
319 | - else |
|
320 | - $line['note'] = ""; |
|
329 | + if ($line['note']) { |
|
330 | + $line['note'] = Article::format_article_note($id, $line['note']); |
|
331 | + } else { |
|
332 | + $line['note'] = ""; |
|
333 | + } |
|
321 | 334 | |
322 | 335 | if (!get_pref("CDM_EXPANDED")) { |
323 | 336 | $line["cdm_excerpt"] = "<span class='collapse'> |
@@ -350,10 +363,11 @@ discard block |
||
350 | 363 | $line['imported'] = T_sprintf("Imported at %s", |
351 | 364 | make_local_datetime($line["date_entered"], false)); |
352 | 365 | |
353 | - if ($line["tag_cache"]) |
|
354 | - $tags = explode(",", $line["tag_cache"]); |
|
355 | - else |
|
356 | - $tags = false; |
|
366 | + if ($line["tag_cache"]) { |
|
367 | + $tags = explode(",", $line["tag_cache"]); |
|
368 | + } else { |
|
369 | + $tags = false; |
|
370 | + } |
|
357 | 371 | |
358 | 372 | $line["tags_str"] = Article::format_tags_string($tags); |
359 | 373 | |
@@ -383,8 +397,9 @@ discard block |
||
383 | 397 | /* we don't need those */ |
384 | 398 | |
385 | 399 | foreach (["date_entered", "guid", "last_published", "last_marked", "tag_cache", "favicon_avg_color", |
386 | - "uuid", "label_cache", "yyiw"] as $k) |
|
387 | - unset($line[$k]); |
|
400 | + "uuid", "label_cache", "yyiw"] as $k) { |
|
401 | + unset($line[$k]); |
|
402 | + } |
|
388 | 403 | |
389 | 404 | array_push($reply['content'], $line); |
390 | 405 | } |
@@ -474,7 +489,9 @@ discard block |
||
474 | 489 | $order_by = $_REQUEST["order_by"]; |
475 | 490 | $check_first_id = $_REQUEST["fid"]; |
476 | 491 | |
477 | - if (is_numeric($feed)) $feed = (int) $feed; |
|
492 | + if (is_numeric($feed)) { |
|
493 | + $feed = (int) $feed; |
|
494 | + } |
|
478 | 495 | |
479 | 496 | /* Feed -5 is a special case: it is used to display auxiliary information |
480 | 497 | * when there's nothing to load - e.g. no stuff in fresh feed */ |
@@ -562,10 +579,11 @@ discard block |
||
562 | 579 | $disable_cache = $ret[3]; |
563 | 580 | $reply['headlines'] = $ret[4]; |
564 | 581 | |
565 | - if (!$next_unread_feed) |
|
566 | - $reply['headlines']['id'] = $feed; |
|
567 | - else |
|
568 | - $reply['headlines']['id'] = $next_unread_feed; |
|
582 | + if (!$next_unread_feed) { |
|
583 | + $reply['headlines']['id'] = $feed; |
|
584 | + } else { |
|
585 | + $reply['headlines']['id'] = $next_unread_feed; |
|
586 | + } |
|
569 | 587 | |
570 | 588 | $reply['headlines']['is_cat'] = (bool) $cat_view; |
571 | 589 | |
@@ -851,7 +869,9 @@ discard block |
||
851 | 869 | |
852 | 870 | static function catchup_feed($feed, $cat_view, $owner_uid = false, $mode = 'all', $search = false) { |
853 | 871 | |
854 | - if (!$owner_uid) $owner_uid = $_SESSION['uid']; |
|
872 | + if (!$owner_uid) { |
|
873 | + $owner_uid = $_SESSION['uid']; |
|
874 | + } |
|
855 | 875 | |
856 | 876 | $pdo = Db::pdo(); |
857 | 877 | |
@@ -1026,7 +1046,9 @@ discard block |
||
1026 | 1046 | |
1027 | 1047 | $pdo = Db::pdo(); |
1028 | 1048 | |
1029 | - if (!$owner_uid) $owner_uid = $_SESSION["uid"]; |
|
1049 | + if (!$owner_uid) { |
|
1050 | + $owner_uid = $_SESSION["uid"]; |
|
1051 | + } |
|
1030 | 1052 | |
1031 | 1053 | if ($unread_only) { |
1032 | 1054 | $unread_qpart = "unread = true"; |
@@ -1142,7 +1164,9 @@ discard block |
||
1142 | 1164 | |
1143 | 1165 | $url = Feeds::fix_url($url); |
1144 | 1166 | |
1145 | - if (!$url || !Feeds::validate_feed_url($url)) return array("code" => 2); |
|
1167 | + if (!$url || !Feeds::validate_feed_url($url)) { |
|
1168 | + return array("code" => 2); |
|
1169 | + } |
|
1146 | 1170 | |
1147 | 1171 | $contents = @fetch_file_contents($url, false, $auth_login, $auth_pass); |
1148 | 1172 | |
@@ -1170,7 +1194,9 @@ discard block |
||
1170 | 1194 | $url = key($feedUrls); |
1171 | 1195 | } |
1172 | 1196 | |
1173 | - if (!$cat_id) $cat_id = null; |
|
1197 | + if (!$cat_id) { |
|
1198 | + $cat_id = null; |
|
1199 | + } |
|
1174 | 1200 | |
1175 | 1201 | $sth = $pdo->prepare("SELECT id FROM ttrss_feeds |
1176 | 1202 | WHERE feed_url = ? AND owner_uid = ?"); |
@@ -1287,13 +1313,17 @@ discard block |
||
1287 | 1313 | |
1288 | 1314 | static function getCategoryUnread($cat, $owner_uid = false) { |
1289 | 1315 | |
1290 | - if (!$owner_uid) $owner_uid = $_SESSION["uid"]; |
|
1316 | + if (!$owner_uid) { |
|
1317 | + $owner_uid = $_SESSION["uid"]; |
|
1318 | + } |
|
1291 | 1319 | |
1292 | 1320 | $pdo = Db::pdo(); |
1293 | 1321 | |
1294 | 1322 | if ($cat >= 0) { |
1295 | 1323 | |
1296 | - if (!$cat) $cat = null; |
|
1324 | + if (!$cat) { |
|
1325 | + $cat = null; |
|
1326 | + } |
|
1297 | 1327 | |
1298 | 1328 | $sth = $pdo->prepare("SELECT id FROM ttrss_feeds |
1299 | 1329 | WHERE (cat_id = :cat OR (:cat IS NULL AND cat_id IS NULL)) |
@@ -1306,7 +1336,9 @@ discard block |
||
1306 | 1336 | array_push($cat_feeds, "feed_id = " . (int)$line["id"]); |
1307 | 1337 | } |
1308 | 1338 | |
1309 | - if (count($cat_feeds) == 0) return 0; |
|
1339 | + if (count($cat_feeds) == 0) { |
|
1340 | + return 0; |
|
1341 | + } |
|
1310 | 1342 | |
1311 | 1343 | $match_part = implode(" OR ", $cat_feeds); |
1312 | 1344 | |
@@ -1341,7 +1373,9 @@ discard block |
||
1341 | 1373 | |
1342 | 1374 | // only accepts real cats (>= 0) |
1343 | 1375 | static function getCategoryChildrenUnread($cat, $owner_uid = false) { |
1344 | - if (!$owner_uid) $owner_uid = $_SESSION["uid"]; |
|
1376 | + if (!$owner_uid) { |
|
1377 | + $owner_uid = $_SESSION["uid"]; |
|
1378 | + } |
|
1345 | 1379 | |
1346 | 1380 | $pdo = Db::pdo(); |
1347 | 1381 | |
@@ -1361,7 +1395,9 @@ discard block |
||
1361 | 1395 | |
1362 | 1396 | static function getGlobalUnread($user_id = false) { |
1363 | 1397 | |
1364 | - if (!$user_id) $user_id = $_SESSION["uid"]; |
|
1398 | + if (!$user_id) { |
|
1399 | + $user_id = $_SESSION["uid"]; |
|
1400 | + } |
|
1365 | 1401 | |
1366 | 1402 | $pdo = Db::pdo(); |
1367 | 1403 | |
@@ -1396,7 +1432,9 @@ discard block |
||
1396 | 1432 | } |
1397 | 1433 | |
1398 | 1434 | static function getLabelUnread($label_id, $owner_uid = false) { |
1399 | - if (!$owner_uid) $owner_uid = $_SESSION["uid"]; |
|
1435 | + if (!$owner_uid) { |
|
1436 | + $owner_uid = $_SESSION["uid"]; |
|
1437 | + } |
|
1400 | 1438 | |
1401 | 1439 | $pdo = Db::pdo(); |
1402 | 1440 | |
@@ -1491,8 +1529,9 @@ discard block |
||
1491 | 1529 | |
1492 | 1530 | $unread = getFeedUnread($feed, $cat_view); |
1493 | 1531 | |
1494 | - if ($cat_view && $feed > 0 && $include_children) |
|
1495 | - $unread += Feeds::getCategoryChildrenUnread($feed); |
|
1532 | + if ($cat_view && $feed > 0 && $include_children) { |
|
1533 | + $unread += Feeds::getCategoryChildrenUnread($feed); |
|
1534 | + } |
|
1496 | 1535 | |
1497 | 1536 | if ($unread > 0) { |
1498 | 1537 | $view_query_part = " unread = true AND "; |
@@ -1604,7 +1643,9 @@ discard block |
||
1604 | 1643 | $allow_archived = true; |
1605 | 1644 | $ignore_vfeed_group = true; |
1606 | 1645 | |
1607 | - if (!$override_order) $override_order = "last_read DESC"; |
|
1646 | + if (!$override_order) { |
|
1647 | + $override_order = "last_read DESC"; |
|
1648 | + } |
|
1608 | 1649 | |
1609 | 1650 | } else if ($feed == -3) { // fresh virtual feed |
1610 | 1651 | $query_strategy_part = "unread = true AND score >= 0"; |
@@ -1715,13 +1756,16 @@ discard block |
||
1715 | 1756 | LEFT JOIN ttrss_feeds ON (feed_id = ttrss_feeds.id)"; |
1716 | 1757 | } |
1717 | 1758 | |
1718 | - if ($vfeed_query_part) $vfeed_query_part .= "favicon_avg_color,"; |
|
1759 | + if ($vfeed_query_part) { |
|
1760 | + $vfeed_query_part .= "favicon_avg_color,"; |
|
1761 | + } |
|
1719 | 1762 | |
1720 | 1763 | $first_id = 0; |
1721 | 1764 | $first_id_query_strategy_part = $query_strategy_part; |
1722 | 1765 | |
1723 | - if ($feed == -3) |
|
1724 | - $first_id_query_strategy_part = "true"; |
|
1766 | + if ($feed == -3) { |
|
1767 | + $first_id_query_strategy_part = "true"; |
|
1768 | + } |
|
1725 | 1769 | |
1726 | 1770 | if (DB_TYPE == "pgsql") { |
1727 | 1771 | $sanity_interval_qpart = "date_entered >= NOW() - INTERVAL '1 hour' AND"; |
@@ -1853,7 +1897,9 @@ discard block |
||
1853 | 1897 | $query_strategy_part ORDER BY $order_by |
1854 | 1898 | $limit_query_part $offset_query_part"; |
1855 | 1899 | |
1856 | - if ($_REQUEST["debug"]) print $query; |
|
1900 | + if ($_REQUEST["debug"]) { |
|
1901 | + print $query; |
|
1902 | + } |
|
1857 | 1903 | |
1858 | 1904 | $res = $pdo->query($query); |
1859 | 1905 | } |
@@ -2003,18 +2049,23 @@ discard block |
||
2003 | 2049 | } |
2004 | 2050 | } |
2005 | 2051 | |
2006 | - if ($url != "http:///") |
|
2007 | - return $url; |
|
2008 | - else |
|
2009 | - return ''; |
|
2052 | + if ($url != "http:///") { |
|
2053 | + return $url; |
|
2054 | + } else { |
|
2055 | + return ''; |
|
2056 | + } |
|
2010 | 2057 | } |
2011 | 2058 | |
2012 | 2059 | static function add_feed_category($feed_cat, $parent_cat_id = false, $order_id = 0) { |
2013 | 2060 | |
2014 | - if (!$feed_cat) return false; |
|
2061 | + if (!$feed_cat) { |
|
2062 | + return false; |
|
2063 | + } |
|
2015 | 2064 | |
2016 | 2065 | $feed_cat = mb_substr($feed_cat, 0, 250); |
2017 | - if (!$parent_cat_id) $parent_cat_id = null; |
|
2066 | + if (!$parent_cat_id) { |
|
2067 | + $parent_cat_id = null; |
|
2068 | + } |
|
2018 | 2069 | |
2019 | 2070 | $pdo = Db::pdo(); |
2020 | 2071 | $tr_in_progress = false; |
@@ -2036,7 +2087,9 @@ discard block |
||
2036 | 2087 | VALUES (?, ?, ?, ?)"); |
2037 | 2088 | $sth->execute([$_SESSION['uid'], $feed_cat, $parent_cat_id, (int)$order_id]); |
2038 | 2089 | |
2039 | - if (!$tr_in_progress) $pdo->commit(); |
|
2090 | + if (!$tr_in_progress) { |
|
2091 | + $pdo->commit(); |
|
2092 | + } |
|
2040 | 2093 | |
2041 | 2094 | return true; |
2042 | 2095 | } |
@@ -2048,7 +2101,9 @@ discard block |
||
2048 | 2101 | |
2049 | 2102 | static function get_feed_access_key($feed_id, $is_cat, $owner_uid = false) { |
2050 | 2103 | |
2051 | - if (!$owner_uid) $owner_uid = $_SESSION["uid"]; |
|
2104 | + if (!$owner_uid) { |
|
2105 | + $owner_uid = $_SESSION["uid"]; |
|
2106 | + } |
|
2052 | 2107 | |
2053 | 2108 | $is_cat = bool_to_sql_bool($is_cat); |
2054 | 2109 | |
@@ -2086,7 +2141,9 @@ discard block |
||
2086 | 2141 | */ |
2087 | 2142 | static function purge_feed($feed_id, $purge_interval) { |
2088 | 2143 | |
2089 | - if (!$purge_interval) $purge_interval = Feeds::feed_purge_interval($feed_id); |
|
2144 | + if (!$purge_interval) { |
|
2145 | + $purge_interval = Feeds::feed_purge_interval($feed_id); |
|
2146 | + } |
|
2090 | 2147 | |
2091 | 2148 | $pdo = Db::pdo(); |
2092 | 2149 | |
@@ -2106,7 +2163,9 @@ discard block |
||
2106 | 2163 | return; |
2107 | 2164 | } |
2108 | 2165 | |
2109 | - if (!$owner_uid) return; |
|
2166 | + if (!$owner_uid) { |
|
2167 | + return; |
|
2168 | + } |
|
2110 | 2169 | |
2111 | 2170 | if (FORCE_ARTICLE_PURGE == 0) { |
2112 | 2171 | $purge_unread = get_pref("PURGE_UNREAD_ARTICLES", |
@@ -2116,10 +2175,11 @@ discard block |
||
2116 | 2175 | $purge_interval = FORCE_ARTICLE_PURGE; |
2117 | 2176 | } |
2118 | 2177 | |
2119 | - if (!$purge_unread) |
|
2120 | - $query_limit = " unread = false AND "; |
|
2121 | - else |
|
2122 | - $query_limit = ""; |
|
2178 | + if (!$purge_unread) { |
|
2179 | + $query_limit = " unread = false AND "; |
|
2180 | + } else { |
|
2181 | + $query_limit = ""; |
|
2182 | + } |
|
2123 | 2183 | |
2124 | 2184 | $purge_interval = (int) $purge_interval; |
2125 | 2185 | |
@@ -2166,8 +2226,10 @@ discard block |
||
2166 | 2226 | $purge_interval = $row["purge_interval"]; |
2167 | 2227 | $owner_uid = $row["owner_uid"]; |
2168 | 2228 | |
2169 | - if ($purge_interval == 0) $purge_interval = get_pref( |
|
2229 | + if ($purge_interval == 0) { |
|
2230 | + $purge_interval = get_pref( |
|
2170 | 2231 | 'PURGE_OLD_DAYS', $owner_uid); |
2232 | + } |
|
2171 | 2233 | |
2172 | 2234 | return $purge_interval; |
2173 | 2235 | |
@@ -2185,10 +2247,11 @@ discard block |
||
2185 | 2247 | |
2186 | 2248 | $pdo = Db::pdo(); |
2187 | 2249 | |
2188 | - if ($search_language) |
|
2189 | - $search_language = $pdo->quote(mb_strtolower($search_language)); |
|
2190 | - else |
|
2191 | - $search_language = $pdo->quote("english"); |
|
2250 | + if ($search_language) { |
|
2251 | + $search_language = $pdo->quote(mb_strtolower($search_language)); |
|
2252 | + } else { |
|
2253 | + $search_language = $pdo->quote("english"); |
|
2254 | + } |
|
2192 | 2255 | |
2193 | 2256 | foreach ($keywords as $k) { |
2194 | 2257 | if (strpos($k, "-") === 0) { |
@@ -2223,56 +2286,68 @@ discard block |
||
2223 | 2286 | break; |
2224 | 2287 | case "note": |
2225 | 2288 | if ($commandpair[1]) { |
2226 | - if ($commandpair[1] == "true") |
|
2227 | - array_push($query_keywords, "($not (note IS NOT NULL AND note != ''))"); |
|
2228 | - else if ($commandpair[1] == "false") |
|
2229 | - array_push($query_keywords, "($not (note IS NULL OR note = ''))"); |
|
2230 | - else |
|
2231 | - array_push($query_keywords, "($not (LOWER(note) LIKE ". |
|
2289 | + if ($commandpair[1] == "true") { |
|
2290 | + array_push($query_keywords, "($not (note IS NOT NULL AND note != ''))"); |
|
2291 | + } else if ($commandpair[1] == "false") { |
|
2292 | + array_push($query_keywords, "($not (note IS NULL OR note = ''))"); |
|
2293 | + } else { |
|
2294 | + array_push($query_keywords, "($not (LOWER(note) LIKE ". |
|
2232 | 2295 | $pdo->quote('%' . mb_strtolower($commandpair[1]) . '%')."))"); |
2296 | + } |
|
2233 | 2297 | } else { |
2234 | 2298 | array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").") |
2235 | 2299 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
2236 | - if (!$not) array_push($search_words, $k); |
|
2300 | + if (!$not) { |
|
2301 | + array_push($search_words, $k); |
|
2302 | + } |
|
2237 | 2303 | } |
2238 | 2304 | break; |
2239 | 2305 | case "star": |
2240 | 2306 | |
2241 | 2307 | if ($commandpair[1]) { |
2242 | - if ($commandpair[1] == "true") |
|
2243 | - array_push($query_keywords, "($not (marked = true))"); |
|
2244 | - else |
|
2245 | - array_push($query_keywords, "($not (marked = false))"); |
|
2308 | + if ($commandpair[1] == "true") { |
|
2309 | + array_push($query_keywords, "($not (marked = true))"); |
|
2310 | + } else { |
|
2311 | + array_push($query_keywords, "($not (marked = false))"); |
|
2312 | + } |
|
2246 | 2313 | } else { |
2247 | 2314 | array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").") |
2248 | 2315 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
2249 | - if (!$not) array_push($search_words, $k); |
|
2316 | + if (!$not) { |
|
2317 | + array_push($search_words, $k); |
|
2318 | + } |
|
2250 | 2319 | } |
2251 | 2320 | break; |
2252 | 2321 | case "pub": |
2253 | 2322 | if ($commandpair[1]) { |
2254 | - if ($commandpair[1] == "true") |
|
2255 | - array_push($query_keywords, "($not (published = true))"); |
|
2256 | - else |
|
2257 | - array_push($query_keywords, "($not (published = false))"); |
|
2323 | + if ($commandpair[1] == "true") { |
|
2324 | + array_push($query_keywords, "($not (published = true))"); |
|
2325 | + } else { |
|
2326 | + array_push($query_keywords, "($not (published = false))"); |
|
2327 | + } |
|
2258 | 2328 | |
2259 | 2329 | } else { |
2260 | 2330 | array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER('%$k%') |
2261 | 2331 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
2262 | - if (!$not) array_push($search_words, $k); |
|
2332 | + if (!$not) { |
|
2333 | + array_push($search_words, $k); |
|
2334 | + } |
|
2263 | 2335 | } |
2264 | 2336 | break; |
2265 | 2337 | case "unread": |
2266 | 2338 | if ($commandpair[1]) { |
2267 | - if ($commandpair[1] == "true") |
|
2268 | - array_push($query_keywords, "($not (unread = true))"); |
|
2269 | - else |
|
2270 | - array_push($query_keywords, "($not (unread = false))"); |
|
2339 | + if ($commandpair[1] == "true") { |
|
2340 | + array_push($query_keywords, "($not (unread = true))"); |
|
2341 | + } else { |
|
2342 | + array_push($query_keywords, "($not (unread = false))"); |
|
2343 | + } |
|
2271 | 2344 | |
2272 | 2345 | } else { |
2273 | 2346 | array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").") |
2274 | 2347 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
2275 | - if (!$not) array_push($search_words, $k); |
|
2348 | + if (!$not) { |
|
2349 | + array_push($search_words, $k); |
|
2350 | + } |
|
2276 | 2351 | } |
2277 | 2352 | break; |
2278 | 2353 | default: |
@@ -2295,7 +2370,9 @@ discard block |
||
2295 | 2370 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
2296 | 2371 | } |
2297 | 2372 | |
2298 | - if (!$not) array_push($search_words, $k); |
|
2373 | + if (!$not) { |
|
2374 | + array_push($search_words, $k); |
|
2375 | + } |
|
2299 | 2376 | } |
2300 | 2377 | } |
2301 | 2378 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | static function create_published_article($title, $url, $content, $labels_str, |
94 | 94 | $owner_uid) { |
95 | 95 | |
96 | - $guid = 'SHA1:' . sha1("ttshared:" . $url . $owner_uid); // include owner_uid to prevent global GUID clash |
|
96 | + $guid = 'SHA1:'.sha1("ttshared:".$url.$owner_uid); // include owner_uid to prevent global GUID clash |
|
97 | 97 | |
98 | 98 | if (!$content) { |
99 | 99 | $pluginhost = new PluginHost(); |
@@ -148,12 +148,12 @@ discard block |
||
148 | 148 | content = ?, content_hash = ? WHERE id = ?"); |
149 | 149 | $sth->execute([$content, $content_hash, $ref_id]); |
150 | 150 | |
151 | - if (DB_TYPE == "pgsql"){ |
|
151 | + if (DB_TYPE == "pgsql") { |
|
152 | 152 | $sth = $pdo->prepare("UPDATE ttrss_entries |
153 | 153 | SET tsvector_combined = to_tsvector( :ts_content) |
154 | 154 | WHERE id = :id"); |
155 | 155 | $params = [ |
156 | - ":ts_content" => mb_substr(strip_tags($content ), 0, 900000), |
|
156 | + ":ts_content" => mb_substr(strip_tags($content), 0, 900000), |
|
157 | 157 | ":id" => $ref_id]; |
158 | 158 | $sth->execute($params); |
159 | 159 | } |
@@ -193,12 +193,12 @@ discard block |
||
193 | 193 | |
194 | 194 | if ($row = $sth->fetch()) { |
195 | 195 | $ref_id = $row["id"]; |
196 | - if (DB_TYPE == "pgsql"){ |
|
196 | + if (DB_TYPE == "pgsql") { |
|
197 | 197 | $sth = $pdo->prepare("UPDATE ttrss_entries |
198 | 198 | SET tsvector_combined = to_tsvector( :ts_content) |
199 | 199 | WHERE id = :id"); |
200 | 200 | $params = [ |
201 | - ":ts_content" => mb_substr(strip_tags($content ), 0, 900000), |
|
201 | + ":ts_content" => mb_substr(strip_tags($content), 0, 900000), |
|
202 | 202 | ":id" => $ref_id]; |
203 | 203 | $sth->execute($params); |
204 | 204 | } |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | print_hidden("op", "article"); |
237 | 237 | print_hidden("method", "setArticleTags"); |
238 | 238 | |
239 | - print "<header class='horizontal'>" . __("Tags for this article (separated by commas):")."</header>"; |
|
239 | + print "<header class='horizontal'>".__("Tags for this article (separated by commas):")."</header>"; |
|
240 | 240 | |
241 | 241 | print "<section>"; |
242 | 242 | print "<textarea dojoType='dijit.form.SimpleTextarea' rows='4' |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | |
258 | 258 | function setScore() { |
259 | 259 | $ids = explode(",", clean($_REQUEST['id'])); |
260 | - $score = (int)clean($_REQUEST['score']); |
|
260 | + $score = (int) clean($_REQUEST['score']); |
|
261 | 261 | |
262 | 262 | $ids_qmarks = arr_qmarks($ids); |
263 | 263 | |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | |
267 | 267 | $sth->execute(array_merge([$score], $ids, [$_SESSION['uid']])); |
268 | 268 | |
269 | - print json_encode(["id" => $ids, "score" => (int)$score]); |
|
269 | + print json_encode(["id" => $ids, "score" => (int) $score]); |
|
270 | 270 | } |
271 | 271 | |
272 | 272 | function getScore() { |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | |
279 | 279 | $score = $row['score']; |
280 | 280 | |
281 | - print json_encode(["id" => $id, "score" => (int)$score]); |
|
281 | + print json_encode(["id" => $id, "score" => (int) $score]); |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | |
357 | 357 | print "<ul>"; |
358 | 358 | while ($line = $sth->fetch()) { |
359 | - print "<li>" . $line["tag_name"] . "</li>"; |
|
359 | + print "<li>".$line["tag_name"]."</li>"; |
|
360 | 360 | } |
361 | 361 | print "</ul>"; |
362 | 362 | } |
@@ -495,21 +495,21 @@ discard block |
||
495 | 495 | if (!$hide_images) { |
496 | 496 | $encsize = ''; |
497 | 497 | if ($entry['height'] > 0) |
498 | - $encsize .= ' height="' . intval($entry['height']) . '"'; |
|
498 | + $encsize .= ' height="'.intval($entry['height']).'"'; |
|
499 | 499 | if ($entry['width'] > 0) |
500 | - $encsize .= ' width="' . intval($entry['width']) . '"'; |
|
500 | + $encsize .= ' width="'.intval($entry['width']).'"'; |
|
501 | 501 | $rv .= "<p><img |
502 | 502 | alt=\"".htmlspecialchars($entry["filename"])."\" |
503 | - src=\"" .htmlspecialchars($entry["url"]) . "\" |
|
504 | - " . $encsize . " /></p>"; |
|
503 | + src=\"" .htmlspecialchars($entry["url"])."\" |
|
504 | + " . $encsize." /></p>"; |
|
505 | 505 | } else { |
506 | 506 | $rv .= "<p><a target=\"_blank\" rel=\"noopener noreferrer\" |
507 | 507 | href=\"".htmlspecialchars($entry["url"])."\" |
508 | - >" .htmlspecialchars($entry["url"]) . "</a></p>"; |
|
508 | + >" .htmlspecialchars($entry["url"])."</a></p>"; |
|
509 | 509 | } |
510 | 510 | |
511 | 511 | if ($entry['title']) { |
512 | - $rv.= "<div class=\"enclosure_title\">${entry['title']}</div>"; |
|
512 | + $rv .= "<div class=\"enclosure_title\">${entry['title']}</div>"; |
|
513 | 513 | } |
514 | 514 | } |
515 | 515 | } |
@@ -524,13 +524,13 @@ discard block |
||
524 | 524 | } |
525 | 525 | |
526 | 526 | $rv .= "<div class=\"attachments\" dojoType=\"fox.form.DropDownButton\">". |
527 | - "<span>" . __('Attachments')."</span>"; |
|
527 | + "<span>".__('Attachments')."</span>"; |
|
528 | 528 | |
529 | 529 | $rv .= "<div dojoType=\"dijit.Menu\" style=\"display: none;\">"; |
530 | 530 | |
531 | 531 | foreach ($entries as $entry) { |
532 | 532 | if ($entry["title"]) |
533 | - $title = " — " . truncate_string($entry["title"], 30); |
|
533 | + $title = " — ".truncate_string($entry["title"], 30); |
|
534 | 534 | else |
535 | 535 | $title = ""; |
536 | 536 | |
@@ -540,7 +540,7 @@ discard block |
||
540 | 540 | $filename = ""; |
541 | 541 | |
542 | 542 | $rv .= "<div onclick='popupOpenUrl(\"".htmlspecialchars($entry["url"])."\")' |
543 | - dojoType=\"dijit.MenuItem\">".$filename . $title."</div>"; |
|
543 | + dojoType=\"dijit.MenuItem\">".$filename.$title."</div>"; |
|
544 | 544 | |
545 | 545 | }; |
546 | 546 | |
@@ -609,10 +609,10 @@ discard block |
||
609 | 609 | $tags_str = ""; |
610 | 610 | |
611 | 611 | for ($i = 0; $i < $maxtags; $i++) { |
612 | - $tags_str .= "<a class=\"tag\" href=\"#\" onclick=\"Feeds.open({feed:'".$tags[$i]."'})\">" . $tags[$i] . "</a>, "; |
|
612 | + $tags_str .= "<a class=\"tag\" href=\"#\" onclick=\"Feeds.open({feed:'".$tags[$i]."'})\">".$tags[$i]."</a>, "; |
|
613 | 613 | } |
614 | 614 | |
615 | - $tags_str = mb_substr($tags_str, 0, mb_strlen($tags_str)-2); |
|
615 | + $tags_str = mb_substr($tags_str, 0, mb_strlen($tags_str) - 2); |
|
616 | 616 | |
617 | 617 | if (count($tags) > $maxtags) |
618 | 618 | $tags_str .= ", …"; |
@@ -804,7 +804,7 @@ discard block |
||
804 | 804 | if (!$article_image && !$article_stream) { |
805 | 805 | $tmpdoc = new DOMDocument(); |
806 | 806 | |
807 | - if (@$tmpdoc->loadHTML('<?xml encoding="UTF-8">' . mb_substr($content, 0, 131070))) { |
|
807 | + if (@$tmpdoc->loadHTML('<?xml encoding="UTF-8">'.mb_substr($content, 0, 131070))) { |
|
808 | 808 | $tmpxpath = new DOMXPath($tmpdoc); |
809 | 809 | $elems = $tmpxpath->query('(//img[@src]|//video[@poster]|//iframe[contains(@src , "youtube.com/embed/")])'); |
810 | 810 | |
@@ -812,8 +812,8 @@ discard block |
||
812 | 812 | if ($e->nodeName == "iframe") { |
813 | 813 | $matches = []; |
814 | 814 | if (preg_match("/\/embed\/([\w-]+)/", $e->getAttribute("src"), $matches)) { |
815 | - $article_image = "https://img.youtube.com/vi/" . $matches[1] . "/hqdefault.jpg"; |
|
816 | - $article_stream = "https://youtu.be/" . $matches[1]; |
|
815 | + $article_image = "https://img.youtube.com/vi/".$matches[1]."/hqdefault.jpg"; |
|
816 | + $article_stream = "https://youtu.be/".$matches[1]; |
|
817 | 817 | break; |
818 | 818 | } |
819 | 819 | } else if ($e->nodeName == "video") { |
@@ -120,10 +120,16 @@ discard block |
||
120 | 120 | |
121 | 121 | $rc = false; |
122 | 122 | |
123 | - if (!$title) $title = $url; |
|
124 | - if (!$title && !$url) return false; |
|
123 | + if (!$title) { |
|
124 | + $title = $url; |
|
125 | + } |
|
126 | + if (!$title && !$url) { |
|
127 | + return false; |
|
128 | + } |
|
125 | 129 | |
126 | - if (filter_var($url, FILTER_VALIDATE_URL) === FALSE) return false; |
|
130 | + if (filter_var($url, FILTER_VALIDATE_URL) === FALSE) { |
|
131 | + return false; |
|
132 | + } |
|
127 | 133 | |
128 | 134 | $pdo = Db::pdo(); |
129 | 135 | |
@@ -334,7 +340,9 @@ discard block |
||
334 | 340 | $tags_str = $this->format_tags_string($tags); |
335 | 341 | $tags_str_full = join(", ", $tags); |
336 | 342 | |
337 | - if (!$tags_str_full) $tags_str_full = __("no tags"); |
|
343 | + if (!$tags_str_full) { |
|
344 | + $tags_str_full = __("no tags"); |
|
345 | + } |
|
338 | 346 | |
339 | 347 | print json_encode([ |
340 | 348 | "id" => (int) $id, |
@@ -383,10 +391,11 @@ discard block |
||
383 | 391 | |
384 | 392 | foreach ($ids as $id) { |
385 | 393 | |
386 | - if ($assign) |
|
387 | - Labels::add_article($id, $label, $_SESSION["uid"]); |
|
388 | - else |
|
389 | - Labels::remove_article($id, $label, $_SESSION["uid"]); |
|
394 | + if ($assign) { |
|
395 | + Labels::add_article($id, $label, $_SESSION["uid"]); |
|
396 | + } else { |
|
397 | + Labels::remove_article($id, $label, $_SESSION["uid"]); |
|
398 | + } |
|
390 | 399 | |
391 | 400 | $labels = $this->get_article_labels($id, $_SESSION["uid"]); |
392 | 401 | |
@@ -447,14 +456,18 @@ discard block |
||
447 | 456 | $width = $line["width"]; |
448 | 457 | $height = $line["height"]; |
449 | 458 | |
450 | - if (!$ctype) $ctype = __("unknown type"); |
|
459 | + if (!$ctype) { |
|
460 | + $ctype = __("unknown type"); |
|
461 | + } |
|
451 | 462 | |
452 | 463 | //$filename = substr($url, strrpos($url, "/")+1); |
453 | 464 | $filename = basename($url); |
454 | 465 | |
455 | 466 | $player = format_inline_player($url, $ctype); |
456 | 467 | |
457 | - if ($player) array_push($entries_inline, $player); |
|
468 | + if ($player) { |
|
469 | + array_push($entries_inline, $player); |
|
470 | + } |
|
458 | 471 | |
459 | 472 | # $entry .= " <a target=\"_blank\" href=\"" . htmlspecialchars($url) . "\" rel=\"noopener noreferrer\">" . |
460 | 473 | # $filename . " (" . $ctype . ")" . "</a>"; |
@@ -482,8 +495,9 @@ discard block |
||
482 | 495 | |
483 | 496 | foreach ($entries as $entry) { |
484 | 497 | |
485 | - foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_RENDER_ENCLOSURE) as $plugin) |
|
486 | - $retval = $plugin->hook_render_enclosure($entry, $hide_images); |
|
498 | + foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_RENDER_ENCLOSURE) as $plugin) { |
|
499 | + $retval = $plugin->hook_render_enclosure($entry, $hide_images); |
|
500 | + } |
|
487 | 501 | |
488 | 502 | |
489 | 503 | if ($retval) { |
@@ -494,10 +508,12 @@ discard block |
||
494 | 508 | |
495 | 509 | if (!$hide_images) { |
496 | 510 | $encsize = ''; |
497 | - if ($entry['height'] > 0) |
|
498 | - $encsize .= ' height="' . intval($entry['height']) . '"'; |
|
499 | - if ($entry['width'] > 0) |
|
500 | - $encsize .= ' width="' . intval($entry['width']) . '"'; |
|
511 | + if ($entry['height'] > 0) { |
|
512 | + $encsize .= ' height="' . intval($entry['height']) . '"'; |
|
513 | + } |
|
514 | + if ($entry['width'] > 0) { |
|
515 | + $encsize .= ' width="' . intval($entry['width']) . '"'; |
|
516 | + } |
|
501 | 517 | $rv .= "<p><img |
502 | 518 | alt=\"".htmlspecialchars($entry["filename"])."\" |
503 | 519 | src=\"" .htmlspecialchars($entry["url"]) . "\" |
@@ -529,15 +545,17 @@ discard block |
||
529 | 545 | $rv .= "<div dojoType=\"dijit.Menu\" style=\"display: none;\">"; |
530 | 546 | |
531 | 547 | foreach ($entries as $entry) { |
532 | - if ($entry["title"]) |
|
533 | - $title = " — " . truncate_string($entry["title"], 30); |
|
534 | - else |
|
535 | - $title = ""; |
|
548 | + if ($entry["title"]) { |
|
549 | + $title = " — " . truncate_string($entry["title"], 30); |
|
550 | + } else { |
|
551 | + $title = ""; |
|
552 | + } |
|
536 | 553 | |
537 | - if ($entry["filename"]) |
|
538 | - $filename = truncate_middle(htmlspecialchars($entry["filename"]), 60); |
|
539 | - else |
|
540 | - $filename = ""; |
|
554 | + if ($entry["filename"]) { |
|
555 | + $filename = truncate_middle(htmlspecialchars($entry["filename"]), 60); |
|
556 | + } else { |
|
557 | + $filename = ""; |
|
558 | + } |
|
541 | 559 | |
542 | 560 | $rv .= "<div onclick='popupOpenUrl(\"".htmlspecialchars($entry["url"])."\")' |
543 | 561 | dojoType=\"dijit.MenuItem\">".$filename . $title."</div>"; |
@@ -555,7 +573,9 @@ discard block |
||
555 | 573 | |
556 | 574 | $a_id = $id; |
557 | 575 | |
558 | - if (!$owner_uid) $owner_uid = $_SESSION["uid"]; |
|
576 | + if (!$owner_uid) { |
|
577 | + $owner_uid = $_SESSION["uid"]; |
|
578 | + } |
|
559 | 579 | |
560 | 580 | $pdo = Db::pdo(); |
561 | 581 | |
@@ -573,7 +593,9 @@ discard block |
||
573 | 593 | WHERE ref_id = ? AND owner_uid = ?"); |
574 | 594 | $csth->execute([$id, $owner_uid]); |
575 | 595 | |
576 | - if ($row = $csth->fetch()) $tag_cache = $row["tag_cache"]; |
|
596 | + if ($row = $csth->fetch()) { |
|
597 | + $tag_cache = $row["tag_cache"]; |
|
598 | + } |
|
577 | 599 | } |
578 | 600 | |
579 | 601 | if ($tag_cache) { |
@@ -614,8 +636,9 @@ discard block |
||
614 | 636 | |
615 | 637 | $tags_str = mb_substr($tags_str, 0, mb_strlen($tags_str)-2); |
616 | 638 | |
617 | - if (count($tags) > $maxtags) |
|
618 | - $tags_str .= ", …"; |
|
639 | + if (count($tags) > $maxtags) { |
|
640 | + $tags_str .= ", …"; |
|
641 | + } |
|
619 | 642 | |
620 | 643 | return $tags_str; |
621 | 644 | } |
@@ -623,7 +646,9 @@ discard block |
||
623 | 646 | |
624 | 647 | static function format_article_labels($labels) { |
625 | 648 | |
626 | - if (!is_array($labels)) return ''; |
|
649 | + if (!is_array($labels)) { |
|
650 | + return ''; |
|
651 | + } |
|
627 | 652 | |
628 | 653 | $labels_str = ""; |
629 | 654 | |
@@ -681,10 +706,11 @@ discard block |
||
681 | 706 | |
682 | 707 | // purge orphaned posts in main content table |
683 | 708 | |
684 | - if (DB_TYPE == "mysql") |
|
685 | - $limit_qpart = "LIMIT 5000"; |
|
686 | - else |
|
687 | - $limit_qpart = ""; |
|
709 | + if (DB_TYPE == "mysql") { |
|
710 | + $limit_qpart = "LIMIT 5000"; |
|
711 | + } else { |
|
712 | + $limit_qpart = ""; |
|
713 | + } |
|
688 | 714 | |
689 | 715 | $pdo = Db::pdo(); |
690 | 716 | $res = $pdo->query("DELETE FROM ttrss_entries WHERE |
@@ -698,7 +724,9 @@ discard block |
||
698 | 724 | |
699 | 725 | static function catchupArticlesById($ids, $cmode, $owner_uid = false) { |
700 | 726 | |
701 | - if (!$owner_uid) $owner_uid = $_SESSION["uid"]; |
|
727 | + if (!$owner_uid) { |
|
728 | + $owner_uid = $_SESSION["uid"]; |
|
729 | + } |
|
702 | 730 | |
703 | 731 | $pdo = Db::pdo(); |
704 | 732 | |
@@ -748,7 +776,9 @@ discard block |
||
748 | 776 | static function get_article_labels($id, $owner_uid = false) { |
749 | 777 | $rv = array(); |
750 | 778 | |
751 | - if (!$owner_uid) $owner_uid = $_SESSION["uid"]; |
|
779 | + if (!$owner_uid) { |
|
780 | + $owner_uid = $_SESSION["uid"]; |
|
781 | + } |
|
752 | 782 | |
753 | 783 | $pdo = Db::pdo(); |
754 | 784 | |
@@ -762,10 +792,11 @@ discard block |
||
762 | 792 | if ($label_cache) { |
763 | 793 | $tmp = json_decode($label_cache, true); |
764 | 794 | |
765 | - if (!$tmp || $tmp["no-labels"] == 1) |
|
766 | - return $rv; |
|
767 | - else |
|
768 | - return $tmp; |
|
795 | + if (!$tmp || $tmp["no-labels"] == 1) { |
|
796 | + return $rv; |
|
797 | + } else { |
|
798 | + return $tmp; |
|
799 | + } |
|
769 | 800 | } |
770 | 801 | } |
771 | 802 | |
@@ -784,10 +815,11 @@ discard block |
||
784 | 815 | array_push($rv, $rk); |
785 | 816 | } |
786 | 817 | |
787 | - if (count($rv) > 0) |
|
788 | - Labels::update_cache($owner_uid, $id, $rv); |
|
789 | - else |
|
790 | - Labels::update_cache($owner_uid, $id, array("no-labels" => 1)); |
|
818 | + if (count($rv) > 0) { |
|
819 | + Labels::update_cache($owner_uid, $id, $rv); |
|
820 | + } else { |
|
821 | + Labels::update_cache($owner_uid, $id, array("no-labels" => 1)); |
|
822 | + } |
|
791 | 823 | |
792 | 824 | return $rv; |
793 | 825 | } |
@@ -835,28 +867,33 @@ discard block |
||
835 | 867 | } |
836 | 868 | } |
837 | 869 | |
838 | - if (!$article_image) |
|
839 | - foreach ($enclosures as $enc) { |
|
870 | + if (!$article_image) { |
|
871 | + foreach ($enclosures as $enc) { |
|
840 | 872 | if (strpos($enc["content_type"], "image/") !== FALSE) { |
841 | 873 | $article_image = $enc["content_url"]; |
874 | + } |
|
842 | 875 | break; |
843 | 876 | } |
844 | 877 | } |
845 | 878 | |
846 | - if ($article_image) |
|
847 | - $article_image = rewrite_relative_url($site_url, $article_image); |
|
879 | + if ($article_image) { |
|
880 | + $article_image = rewrite_relative_url($site_url, $article_image); |
|
881 | + } |
|
848 | 882 | |
849 | - if ($article_stream) |
|
850 | - $article_stream = rewrite_relative_url($site_url, $article_stream); |
|
883 | + if ($article_stream) { |
|
884 | + $article_stream = rewrite_relative_url($site_url, $article_stream); |
|
885 | + } |
|
851 | 886 | } |
852 | 887 | |
853 | 888 | $cache = new DiskCache("images"); |
854 | 889 | |
855 | - if ($article_image && $cache->exists(sha1($article_image))) |
|
856 | - $article_image = $cache->getUrl(sha1($article_image)); |
|
890 | + if ($article_image && $cache->exists(sha1($article_image))) { |
|
891 | + $article_image = $cache->getUrl(sha1($article_image)); |
|
892 | + } |
|
857 | 893 | |
858 | - if ($article_stream && $cache->exists(sha1($article_stream))) |
|
859 | - $article_stream = $cache->getUrl(sha1($article_stream)); |
|
894 | + if ($article_stream && $cache->exists(sha1($article_stream))) { |
|
895 | + $article_stream = $cache->getUrl(sha1($article_stream)); |
|
896 | + } |
|
860 | 897 | |
861 | 898 | return [$article_image, $article_stream]; |
862 | 899 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | function hook_house_keeping() { |
36 | 36 | /* since HOOK_UPDATE_TASK is not available to user plugins, this hook is a next best thing */ |
37 | 37 | |
38 | - Debug::log("caching media of starred articles for user " . $this->host->get_owner_uid() . "..."); |
|
38 | + Debug::log("caching media of starred articles for user ".$this->host->get_owner_uid()."..."); |
|
39 | 39 | |
40 | 40 | $sth = $this->pdo->prepare("SELECT content, ttrss_entries.title, |
41 | 41 | ttrss_user_entries.owner_uid, link, site_url, ttrss_entries.id, plugin_data |
@@ -53,13 +53,13 @@ discard block |
||
53 | 53 | $usth = $this->pdo->prepare("UPDATE ttrss_entries SET plugin_data = ? WHERE id = ?"); |
54 | 54 | |
55 | 55 | while ($line = $sth->fetch()) { |
56 | - Debug::log("processing article " . $line["title"], Debug::$LOG_VERBOSE); |
|
56 | + Debug::log("processing article ".$line["title"], Debug::$LOG_VERBOSE); |
|
57 | 57 | |
58 | 58 | if ($line["site_url"]) { |
59 | 59 | $success = $this->cache_article_images($line["content"], $line["site_url"], $line["owner_uid"], $line["id"]); |
60 | 60 | |
61 | 61 | if ($success) { |
62 | - $plugin_data = "starred_cache_images,${line['owner_uid']}:" . $line["plugin_data"]; |
|
62 | + $plugin_data = "starred_cache_images,${line['owner_uid']}:".$line["plugin_data"]; |
|
63 | 63 | |
64 | 64 | $usth->execute([$plugin_data, $line['id']]); |
65 | 65 | } |
@@ -69,9 +69,9 @@ discard block |
||
69 | 69 | |
70 | 70 | /* actual housekeeping */ |
71 | 71 | |
72 | - Debug::log("expiring " . $this->cache->getDir() . "..."); |
|
72 | + Debug::log("expiring ".$this->cache->getDir()."..."); |
|
73 | 73 | |
74 | - $files = glob($this->cache->getDir() . "/*.{png,mp4,status}", GLOB_BRACE); |
|
74 | + $files = glob($this->cache->getDir()."/*.{png,mp4,status}", GLOB_BRACE); |
|
75 | 75 | |
76 | 76 | $last_article_id = 0; |
77 | 77 | $article_exists = 1; |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | } |
96 | 96 | |
97 | 97 | function hook_enclosure_entry($enc, $article_id) { |
98 | - $local_filename = $article_id . "-" . sha1($enc["content_url"]); |
|
98 | + $local_filename = $article_id."-".sha1($enc["content_url"]); |
|
99 | 99 | |
100 | 100 | if ($this->cache->exists($local_filename)) { |
101 | 101 | $enc["content_url"] = $this->cache->getUrl($local_filename); |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | if ($entry->hasAttribute('src')) { |
115 | 115 | $src = rewrite_relative_url($site_url, $entry->getAttribute('src')); |
116 | 116 | |
117 | - $local_filename = $article_id . "-" . sha1($src); |
|
117 | + $local_filename = $article_id."-".sha1($src); |
|
118 | 118 | |
119 | 119 | if ($this->cache->exists($local_filename)) { |
120 | 120 | $entry->setAttribute("src", $this->cache->getUrl($local_filename)); |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | } |
129 | 129 | |
130 | 130 | private function cache_url($article_id, $url) { |
131 | - $local_filename = $article_id . "-" . sha1($url); |
|
131 | + $local_filename = $article_id."-".sha1($url); |
|
132 | 132 | |
133 | 133 | if (!$this->cache->exists($local_filename)) { |
134 | 134 | Debug::log("cache_images: downloading: $url to $local_filename", Debug::$LOG_VERBOSE); |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | $data = fetch_file_contents(["url" => $url, "max_size" => MAX_CACHE_FILE_SIZE]); |
137 | 137 | |
138 | 138 | if ($data) |
139 | - return $this->cache->put($local_filename, $data);; |
|
139 | + return $this->cache->put($local_filename, $data); ; |
|
140 | 140 | |
141 | 141 | } else { |
142 | 142 | //Debug::log("cache_images: local file exists for $url", Debug::$LOG_VERBOSE); |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | } |
149 | 149 | |
150 | 150 | private function cache_article_images($content, $site_url, $owner_uid, $article_id) { |
151 | - $status_filename = $article_id . "-" . sha1($site_url) . ".status"; |
|
151 | + $status_filename = $article_id."-".sha1($site_url).".status"; |
|
152 | 152 | |
153 | 153 | /* housekeeping might run as a separate user, in this case status/media might not be writable */ |
154 | 154 | if (!$this->cache->isWritable($status_filename)) { |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | $has_images = false; |
182 | 182 | $success = false; |
183 | 183 | |
184 | - if ($doc->loadHTML('<?xml encoding="UTF-8">' . $content)) { |
|
184 | + if ($doc->loadHTML('<?xml encoding="UTF-8">'.$content)) { |
|
185 | 185 | $xpath = new DOMXPath($doc); |
186 | 186 | $entries = $xpath->query('(//img[@src])|(//video/source[@src])'); |
187 | 187 |
@@ -79,11 +79,11 @@ discard block |
||
79 | 79 | return true; |
80 | 80 | } |
81 | 81 | |
82 | - function ttrss_open () { |
|
82 | + function ttrss_open() { |
|
83 | 83 | return true; |
84 | 84 | } |
85 | 85 | |
86 | - function ttrss_read ($id){ |
|
86 | + function ttrss_read($id) { |
|
87 | 87 | global $session_expire; |
88 | 88 | |
89 | 89 | $sth = Db::pdo()->prepare("SELECT data FROM ttrss_sessions WHERE id=?"); |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | |
105 | 105 | } |
106 | 106 | |
107 | - function ttrss_write ($id, $data) { |
|
107 | + function ttrss_write($id, $data) { |
|
108 | 108 | global $session_expire; |
109 | 109 | |
110 | 110 | $data = base64_encode($data); |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | return true; |
126 | 126 | } |
127 | 127 | |
128 | - function ttrss_close () { |
|
128 | + function ttrss_close() { |
|
129 | 129 | return true; |
130 | 130 | } |
131 | 131 | |
@@ -136,8 +136,8 @@ discard block |
||
136 | 136 | return true; |
137 | 137 | } |
138 | 138 | |
139 | - function ttrss_gc () { |
|
140 | - Db::pdo()->query("DELETE FROM ttrss_sessions WHERE expire < " . time()); |
|
139 | + function ttrss_gc() { |
|
140 | + Db::pdo()->query("DELETE FROM ttrss_sessions WHERE expire < ".time()); |
|
141 | 141 | |
142 | 142 | return true; |
143 | 143 | } |