@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | print "</section>"; |
| 37 | 37 | |
| 38 | - print "<header>" . __("Colors") . "</header>"; |
|
| 38 | + print "<header>".__("Colors")."</header>"; |
|
| 39 | 39 | print "<section>"; |
| 40 | 40 | |
| 41 | 41 | print "<table>"; |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | while ($line = $sth->fetch()) { |
| 95 | 95 | $label = array(); |
| 96 | - $label['id'] = 'LABEL:' . $line['id']; |
|
| 96 | + $label['id'] = 'LABEL:'.$line['id']; |
|
| 97 | 97 | $label['bare_id'] = $line['id']; |
| 98 | 98 | $label['name'] = $line['caption']; |
| 99 | 99 | $label['fg_color'] = $line['fg_color']; |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | print "<div dojoType='fox.Toolbar'>"; |
| 255 | 255 | |
| 256 | 256 | print "<div dojoType='fox.form.DropDownButton'>". |
| 257 | - "<span>" . __('Select')."</span>"; |
|
| 257 | + "<span>".__('Select')."</span>"; |
|
| 258 | 258 | print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">"; |
| 259 | 259 | print "<div onclick=\"dijit.byId('labelTree').model.setAllChecked(true)\" |
| 260 | 260 | dojoType=\"dijit.MenuItem\">".__('All')."</div>"; |
@@ -1066,70 +1066,70 @@ |
||
| 1066 | 1066 | $qpart = ""; |
| 1067 | 1067 | |
| 1068 | 1068 | switch ($k) { |
| 1069 | - case "title": |
|
| 1070 | - $qpart = "title = " . $this->pdo->quote($feed_title); |
|
| 1071 | - break; |
|
| 1072 | - |
|
| 1073 | - case "feed_url": |
|
| 1074 | - $qpart = "feed_url = " . $this->pdo->quote($feed_url); |
|
| 1075 | - break; |
|
| 1076 | - |
|
| 1077 | - case "update_interval": |
|
| 1078 | - $qpart = "update_interval = " . $this->pdo->quote($upd_intl); |
|
| 1079 | - break; |
|
| 1080 | - |
|
| 1081 | - case "purge_interval": |
|
| 1082 | - $qpart = "purge_interval =" . $this->pdo->quote($purge_intl); |
|
| 1083 | - break; |
|
| 1084 | - |
|
| 1085 | - case "auth_login": |
|
| 1086 | - $qpart = "auth_login = " . $this->pdo->quote($auth_login); |
|
| 1087 | - break; |
|
| 1088 | - |
|
| 1089 | - case "auth_pass": |
|
| 1090 | - $qpart = "auth_pass =" . $this->pdo->quote($auth_pass). ", auth_pass_encrypted = false"; |
|
| 1091 | - break; |
|
| 1092 | - |
|
| 1093 | - case "private": |
|
| 1094 | - $qpart = "private = " . $this->pdo->quote($private); |
|
| 1095 | - break; |
|
| 1096 | - |
|
| 1097 | - case "include_in_digest": |
|
| 1098 | - $qpart = "include_in_digest = " . $this->pdo->quote($include_in_digest); |
|
| 1099 | - break; |
|
| 1100 | - |
|
| 1101 | - case "always_display_enclosures": |
|
| 1102 | - $qpart = "always_display_enclosures = " . $this->pdo->quote($always_display_enclosures); |
|
| 1103 | - break; |
|
| 1104 | - |
|
| 1105 | - case "mark_unread_on_update": |
|
| 1106 | - $qpart = "mark_unread_on_update = " . $this->pdo->quote($mark_unread_on_update); |
|
| 1107 | - break; |
|
| 1108 | - |
|
| 1109 | - case "cache_images": |
|
| 1110 | - $qpart = "cache_images = " . $this->pdo->quote($cache_images); |
|
| 1111 | - break; |
|
| 1112 | - |
|
| 1113 | - case "hide_images": |
|
| 1114 | - $qpart = "hide_images = " . $this->pdo->quote($hide_images); |
|
| 1115 | - break; |
|
| 1116 | - |
|
| 1117 | - case "cat_id": |
|
| 1118 | - if (get_pref('ENABLE_FEED_CATS')) { |
|
| 1119 | - if ($cat_id) { |
|
| 1120 | - $qpart = "cat_id = " . $this->pdo->quote($cat_id); |
|
| 1121 | - } else { |
|
| 1122 | - $qpart = 'cat_id = NULL'; |
|
| 1123 | - } |
|
| 1069 | + case "title": |
|
| 1070 | + $qpart = "title = " . $this->pdo->quote($feed_title); |
|
| 1071 | + break; |
|
| 1072 | + |
|
| 1073 | + case "feed_url": |
|
| 1074 | + $qpart = "feed_url = " . $this->pdo->quote($feed_url); |
|
| 1075 | + break; |
|
| 1076 | + |
|
| 1077 | + case "update_interval": |
|
| 1078 | + $qpart = "update_interval = " . $this->pdo->quote($upd_intl); |
|
| 1079 | + break; |
|
| 1080 | + |
|
| 1081 | + case "purge_interval": |
|
| 1082 | + $qpart = "purge_interval =" . $this->pdo->quote($purge_intl); |
|
| 1083 | + break; |
|
| 1084 | + |
|
| 1085 | + case "auth_login": |
|
| 1086 | + $qpart = "auth_login = " . $this->pdo->quote($auth_login); |
|
| 1087 | + break; |
|
| 1088 | + |
|
| 1089 | + case "auth_pass": |
|
| 1090 | + $qpart = "auth_pass =" . $this->pdo->quote($auth_pass). ", auth_pass_encrypted = false"; |
|
| 1091 | + break; |
|
| 1092 | + |
|
| 1093 | + case "private": |
|
| 1094 | + $qpart = "private = " . $this->pdo->quote($private); |
|
| 1095 | + break; |
|
| 1096 | + |
|
| 1097 | + case "include_in_digest": |
|
| 1098 | + $qpart = "include_in_digest = " . $this->pdo->quote($include_in_digest); |
|
| 1099 | + break; |
|
| 1100 | + |
|
| 1101 | + case "always_display_enclosures": |
|
| 1102 | + $qpart = "always_display_enclosures = " . $this->pdo->quote($always_display_enclosures); |
|
| 1103 | + break; |
|
| 1104 | + |
|
| 1105 | + case "mark_unread_on_update": |
|
| 1106 | + $qpart = "mark_unread_on_update = " . $this->pdo->quote($mark_unread_on_update); |
|
| 1107 | + break; |
|
| 1108 | + |
|
| 1109 | + case "cache_images": |
|
| 1110 | + $qpart = "cache_images = " . $this->pdo->quote($cache_images); |
|
| 1111 | + break; |
|
| 1112 | + |
|
| 1113 | + case "hide_images": |
|
| 1114 | + $qpart = "hide_images = " . $this->pdo->quote($hide_images); |
|
| 1115 | + break; |
|
| 1116 | + |
|
| 1117 | + case "cat_id": |
|
| 1118 | + if (get_pref('ENABLE_FEED_CATS')) { |
|
| 1119 | + if ($cat_id) { |
|
| 1120 | + $qpart = "cat_id = " . $this->pdo->quote($cat_id); |
|
| 1124 | 1121 | } else { |
| 1125 | - $qpart = ""; |
|
| 1122 | + $qpart = 'cat_id = NULL'; |
|
| 1126 | 1123 | } |
| 1124 | + } else { |
|
| 1125 | + $qpart = ""; |
|
| 1126 | + } |
|
| 1127 | 1127 | |
| 1128 | - break; |
|
| 1128 | + break; |
|
| 1129 | 1129 | |
| 1130 | - case "feed_language": |
|
| 1131 | - $qpart = "feed_language = " . $this->pdo->quote($feed_language); |
|
| 1132 | - break; |
|
| 1130 | + case "feed_language": |
|
| 1131 | + $qpart = "feed_language = " . $this->pdo->quote($feed_language); |
|
| 1132 | + break; |
|
| 1133 | 1133 | |
| 1134 | 1134 | } |
| 1135 | 1135 | |
@@ -1568,8 +1568,8 @@ |
||
| 1568 | 1568 | public static function remove_feed($id, $owner_uid) { |
| 1569 | 1569 | foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_UNSUBSCRIBE_FEED) as $p) { |
| 1570 | 1570 | if (! $p->hook_unsubscribe_feed($id, $owner_uid)) { |
| 1571 | - user_error("Feed $id (owner: $owner_uid) not removed due to plugin error (HOOK_UNSUBSCRIBE_FEED).", E_USER_WARNING); |
|
| 1572 | - return; |
|
| 1571 | + user_error("Feed $id (owner: $owner_uid) not removed due to plugin error (HOOK_UNSUBSCRIBE_FEED).", E_USER_WARNING); |
|
| 1572 | + return; |
|
| 1573 | 1573 | } |
| 1574 | 1574 | } |
| 1575 | 1575 | |
@@ -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 | public 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 | public 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 | } |
@@ -42,10 +42,11 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | private function get_category_items($cat_id) { |
| 44 | 44 | |
| 45 | - if (clean($_REQUEST['mode']) != 2) |
|
| 46 | - $search = $_SESSION["prefs_feed_search"]; |
|
| 47 | - else |
|
| 48 | - $search = ""; |
|
| 45 | + if (clean($_REQUEST['mode']) != 2) { |
|
| 46 | + $search = $_SESSION["prefs_feed_search"]; |
|
| 47 | + } else { |
|
| 48 | + $search = ""; |
|
| 49 | + } |
|
| 49 | 50 | |
| 50 | 51 | // first one is set by API |
| 51 | 52 | $show_empty_cats = clean($_REQUEST['force_show_empty']) || |
@@ -76,8 +77,9 @@ discard block |
||
| 76 | 77 | $num_children = $this->calculate_children_count($cat); |
| 77 | 78 | $cat['param'] = vsprintf(_ngettext('(%d feed)', '(%d feeds)', (int) $num_children), $num_children); |
| 78 | 79 | |
| 79 | - if ($num_children > 0 || $show_empty_cats) |
|
| 80 | - array_push($items, $cat); |
|
| 80 | + if ($num_children > 0 || $show_empty_cats) { |
|
| 81 | + array_push($items, $cat); |
|
| 82 | + } |
|
| 81 | 83 | |
| 82 | 84 | } |
| 83 | 85 | |
@@ -117,10 +119,11 @@ discard block |
||
| 117 | 119 | |
| 118 | 120 | public function makefeedtree() { |
| 119 | 121 | |
| 120 | - if (clean($_REQUEST['mode']) != 2) |
|
| 121 | - $search = $_SESSION["prefs_feed_search"]; |
|
| 122 | - else |
|
| 123 | - $search = ""; |
|
| 122 | + if (clean($_REQUEST['mode']) != 2) { |
|
| 123 | + $search = $_SESSION["prefs_feed_search"]; |
|
| 124 | + } else { |
|
| 125 | + $search = ""; |
|
| 126 | + } |
|
| 124 | 127 | |
| 125 | 128 | $root = array(); |
| 126 | 129 | $root['id'] = 'root'; |
@@ -231,8 +234,9 @@ discard block |
||
| 231 | 234 | $num_children = $this->calculate_children_count($cat); |
| 232 | 235 | $cat['param'] = vsprintf(_ngettext('(%d feed)', '(%d feeds)', (int) $num_children), $num_children); |
| 233 | 236 | |
| 234 | - if ($num_children > 0 || $show_empty_cats) |
|
| 235 | - array_push($root['items'], $cat); |
|
| 237 | + if ($num_children > 0 || $show_empty_cats) { |
|
| 238 | + array_push($root['items'], $cat); |
|
| 239 | + } |
|
| 236 | 240 | |
| 237 | 241 | $root['param'] += count($cat['items']); |
| 238 | 242 | } |
@@ -279,8 +283,9 @@ discard block |
||
| 279 | 283 | |
| 280 | 284 | $cat['param'] = vsprintf(_ngettext('(%d feed)', '(%d feeds)', count($cat['items'])), count($cat['items'])); |
| 281 | 285 | |
| 282 | - if (count($cat['items']) > 0 || $show_empty_cats) |
|
| 283 | - array_push($root['items'], $cat); |
|
| 286 | + if (count($cat['items']) > 0 || $show_empty_cats) { |
|
| 287 | + array_push($root['items'], $cat); |
|
| 288 | + } |
|
| 284 | 289 | |
| 285 | 290 | $num_children = $this->calculate_children_count($root); |
| 286 | 291 | $root['param'] = vsprintf(_ngettext('(%d feed)', '(%d feeds)', (int) $num_children), $num_children); |
@@ -343,8 +348,9 @@ discard block |
||
| 343 | 348 | private function process_category_order(&$data_map, $item_id, $parent_id = false, $nest_level = 0) { |
| 344 | 349 | |
| 345 | 350 | $prefix = ""; |
| 346 | - for ($i = 0; $i < $nest_level; $i++) |
|
| 347 | - $prefix .= " "; |
|
| 351 | + for ($i = 0; $i < $nest_level; $i++) { |
|
| 352 | + $prefix .= " "; |
|
| 353 | + } |
|
| 348 | 354 | |
| 349 | 355 | Debug::log("$prefix C: $item_id P: $parent_id"); |
| 350 | 356 | |
@@ -409,8 +415,9 @@ discard block |
||
| 409 | 415 | #file_put_contents("/tmp/saveorder.json", clean($_POST['payload'])); |
| 410 | 416 | #$data = json_decode(file_get_contents("/tmp/saveorder.json"), true); |
| 411 | 417 | |
| 412 | - if (!is_array($data['items'])) |
|
| 413 | - $data['items'] = json_decode($data['items'], true); |
|
| 418 | + if (!is_array($data['items'])) { |
|
| 419 | + $data['items'] = json_decode($data['items'], true); |
|
| 420 | + } |
|
| 414 | 421 | |
| 415 | 422 | # print_r($data['items']); |
| 416 | 423 | |
@@ -494,7 +501,9 @@ discard block |
||
| 494 | 501 | } |
| 495 | 502 | } |
| 496 | 503 | |
| 497 | - if (is_file($icon_file)) @unlink($icon_file); |
|
| 504 | + if (is_file($icon_file)) { |
|
| 505 | + @unlink($icon_file); |
|
| 506 | + } |
|
| 498 | 507 | |
| 499 | 508 | print $rc; |
| 500 | 509 | return; |
@@ -590,8 +599,9 @@ discard block |
||
| 590 | 599 | if (DB_TYPE == "pgsql") { |
| 591 | 600 | $feed_language = $row["feed_language"]; |
| 592 | 601 | |
| 593 | - if (!$feed_language) |
|
| 594 | - $feed_language = get_pref('DEFAULT_SEARCH_LANGUAGE'); |
|
| 602 | + if (!$feed_language) { |
|
| 603 | + $feed_language = get_pref('DEFAULT_SEARCH_LANGUAGE'); |
|
| 604 | + } |
|
| 595 | 605 | |
| 596 | 606 | print "<fieldset>"; |
| 597 | 607 | |
@@ -1404,11 +1414,13 @@ discard block |
||
| 1404 | 1414 | $obj = array(); |
| 1405 | 1415 | $feed_id = (int) $feed_id; |
| 1406 | 1416 | |
| 1407 | - if (!$title) |
|
| 1408 | - $title = Feeds::getFeedTitle($feed_id, false); |
|
| 1417 | + if (!$title) { |
|
| 1418 | + $title = Feeds::getFeedTitle($feed_id, false); |
|
| 1419 | + } |
|
| 1409 | 1420 | |
| 1410 | - if ($unread === false) |
|
| 1411 | - $unread = getFeedUnread($feed_id, false); |
|
| 1421 | + if ($unread === false) { |
|
| 1422 | + $unread = getFeedUnread($feed_id, false); |
|
| 1423 | + } |
|
| 1412 | 1424 | |
| 1413 | 1425 | $obj['id'] = 'FEED:' . $feed_id; |
| 1414 | 1426 | $obj['name'] = $title; |
@@ -1738,7 +1750,9 @@ discard block |
||
| 1738 | 1750 | |
| 1739 | 1751 | |
| 1740 | 1752 | private function update_feed_access_key($feed_id, $is_cat, $owner_uid = false) { |
| 1741 | - if (!$owner_uid) $owner_uid = $_SESSION["uid"]; |
|
| 1753 | + if (!$owner_uid) { |
|
| 1754 | + $owner_uid = $_SESSION["uid"]; |
|
| 1755 | + } |
|
| 1742 | 1756 | |
| 1743 | 1757 | // clear old value and generate new one |
| 1744 | 1758 | $sth = $this->pdo->prepare("DELETE FROM ttrss_access_keys |
@@ -78,17 +78,17 @@ discard block |
||
| 78 | 78 | $scope_inner_qparts = []; |
| 79 | 79 | foreach ($rule["feed_id"] as $feed_id) { |
| 80 | 80 | |
| 81 | - if (strpos($feed_id, "CAT:") === 0) { |
|
| 82 | - $cat_id = (int) substr($feed_id, 4); |
|
| 83 | - array_push($scope_inner_qparts, "cat_id = " . $this->pdo->quote($cat_id)); |
|
| 84 | - } else if ($feed_id > 0) { |
|
| 85 | - array_push($scope_inner_qparts, "feed_id = " . $this->pdo->quote($feed_id)); |
|
| 86 | - } |
|
| 87 | - } |
|
| 88 | - |
|
| 89 | - if (count($scope_inner_qparts) > 0) { |
|
| 90 | - array_push($scope_qparts, "(" . implode(" OR ", $scope_inner_qparts) . ")"); |
|
| 91 | - } |
|
| 81 | + if (strpos($feed_id, "CAT:") === 0) { |
|
| 82 | + $cat_id = (int) substr($feed_id, 4); |
|
| 83 | + array_push($scope_inner_qparts, "cat_id = " . $this->pdo->quote($cat_id)); |
|
| 84 | + } else if ($feed_id > 0) { |
|
| 85 | + array_push($scope_inner_qparts, "feed_id = " . $this->pdo->quote($feed_id)); |
|
| 86 | + } |
|
| 87 | + } |
|
| 88 | + |
|
| 89 | + if (count($scope_inner_qparts) > 0) { |
|
| 90 | + array_push($scope_qparts, "(" . implode(" OR ", $scope_inner_qparts) . ")"); |
|
| 91 | + } |
|
| 92 | 92 | |
| 93 | 93 | array_push($filter["rules"], $rule); |
| 94 | 94 | |
@@ -196,32 +196,32 @@ discard block |
||
| 196 | 196 | |
| 197 | 197 | while ($line = $sth->fetch()) { |
| 198 | 198 | |
| 199 | - if ($line["match_on"]) { |
|
| 200 | - $feeds = json_decode($line["match_on"], true); |
|
| 201 | - $feeds_fmt = []; |
|
| 199 | + if ($line["match_on"]) { |
|
| 200 | + $feeds = json_decode($line["match_on"], true); |
|
| 201 | + $feeds_fmt = []; |
|
| 202 | 202 | |
| 203 | - foreach ($feeds as $feed_id) { |
|
| 203 | + foreach ($feeds as $feed_id) { |
|
| 204 | 204 | |
| 205 | - if (strpos($feed_id, "CAT:") === 0) { |
|
| 206 | - $feed_id = (int)substr($feed_id, 4); |
|
| 207 | - array_push($feeds_fmt, Feeds::getCategoryTitle($feed_id)); |
|
| 208 | - } else { |
|
| 209 | - if ($feed_id) |
|
| 210 | - array_push($feeds_fmt, Feeds::getFeedTitle((int)$feed_id)); |
|
| 211 | - else |
|
| 212 | - array_push($feeds_fmt, __("All feeds")); |
|
| 213 | - } |
|
| 214 | - } |
|
| 205 | + if (strpos($feed_id, "CAT:") === 0) { |
|
| 206 | + $feed_id = (int)substr($feed_id, 4); |
|
| 207 | + array_push($feeds_fmt, Feeds::getCategoryTitle($feed_id)); |
|
| 208 | + } else { |
|
| 209 | + if ($feed_id) |
|
| 210 | + array_push($feeds_fmt, Feeds::getFeedTitle((int)$feed_id)); |
|
| 211 | + else |
|
| 212 | + array_push($feeds_fmt, __("All feeds")); |
|
| 213 | + } |
|
| 214 | + } |
|
| 215 | 215 | |
| 216 | - $where = implode(", ", $feeds_fmt); |
|
| 216 | + $where = implode(", ", $feeds_fmt); |
|
| 217 | 217 | |
| 218 | - } else { |
|
| 218 | + } else { |
|
| 219 | 219 | |
| 220 | - $where = $line["cat_filter"] ? |
|
| 221 | - Feeds::getCategoryTitle($line["cat_id"]) : |
|
| 222 | - ($line["feed_id"] ? |
|
| 223 | - Feeds::getFeedTitle($line["feed_id"]) : __("All feeds")); |
|
| 224 | - } |
|
| 220 | + $where = $line["cat_filter"] ? |
|
| 221 | + Feeds::getCategoryTitle($line["cat_id"]) : |
|
| 222 | + ($line["feed_id"] ? |
|
| 223 | + Feeds::getFeedTitle($line["feed_id"]) : __("All feeds")); |
|
| 224 | + } |
|
| 225 | 225 | |
| 226 | 226 | # $where = $line["cat_id"] . "/" . $line["feed_id"]; |
| 227 | 227 | |
@@ -527,18 +527,18 @@ discard block |
||
| 527 | 527 | |
| 528 | 528 | foreach ($feeds as $feed_id) { |
| 529 | 529 | |
| 530 | - if (strpos($feed_id, "CAT:") === 0) { |
|
| 531 | - $feed_id = (int)substr($feed_id, 4); |
|
| 532 | - array_push($feeds_fmt, Feeds::getCategoryTitle($feed_id)); |
|
| 533 | - } else { |
|
| 534 | - if ($feed_id) |
|
| 535 | - array_push($feeds_fmt, Feeds::getFeedTitle((int)$feed_id)); |
|
| 536 | - else |
|
| 537 | - array_push($feeds_fmt, __("All feeds")); |
|
| 538 | - } |
|
| 539 | - } |
|
| 540 | - |
|
| 541 | - $feed = implode(", ", $feeds_fmt); |
|
| 530 | + if (strpos($feed_id, "CAT:") === 0) { |
|
| 531 | + $feed_id = (int)substr($feed_id, 4); |
|
| 532 | + array_push($feeds_fmt, Feeds::getCategoryTitle($feed_id)); |
|
| 533 | + } else { |
|
| 534 | + if ($feed_id) |
|
| 535 | + array_push($feeds_fmt, Feeds::getFeedTitle((int)$feed_id)); |
|
| 536 | + else |
|
| 537 | + array_push($feeds_fmt, __("All feeds")); |
|
| 538 | + } |
|
| 539 | + } |
|
| 540 | + |
|
| 541 | + $feed = implode(", ", $feeds_fmt); |
|
| 542 | 542 | |
| 543 | 543 | $sth = $this->pdo->prepare("SELECT description FROM ttrss_filter_types |
| 544 | 544 | WHERE id = ?"); |
@@ -80,14 +80,14 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | if (strpos($feed_id, "CAT:") === 0) { |
| 82 | 82 | $cat_id = (int) substr($feed_id, 4); |
| 83 | - array_push($scope_inner_qparts, "cat_id = " . $this->pdo->quote($cat_id)); |
|
| 83 | + array_push($scope_inner_qparts, "cat_id = ".$this->pdo->quote($cat_id)); |
|
| 84 | 84 | } else if ($feed_id > 0) { |
| 85 | - array_push($scope_inner_qparts, "feed_id = " . $this->pdo->quote($feed_id)); |
|
| 85 | + array_push($scope_inner_qparts, "feed_id = ".$this->pdo->quote($feed_id)); |
|
| 86 | 86 | } |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | if (count($scope_inner_qparts) > 0) { |
| 90 | - array_push($scope_qparts, "(" . implode(" OR ", $scope_inner_qparts) . ")"); |
|
| 90 | + array_push($scope_qparts, "(".implode(" OR ", $scope_inner_qparts).")"); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | array_push($filter["rules"], $rule); |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | |
| 101 | 101 | if (count($scope_qparts) == 0) $scope_qparts = ["true"]; |
| 102 | 102 | |
| 103 | - $glue = $filter['match_any_rule'] ? " OR " : " AND "; |
|
| 103 | + $glue = $filter['match_any_rule'] ? " OR " : " AND "; |
|
| 104 | 104 | $scope_qpart = join($glue, $scope_qparts); |
| 105 | 105 | |
| 106 | 106 | if (!$scope_qpart) $scope_qpart = "true"; |
@@ -146,9 +146,9 @@ discard block |
||
| 146 | 146 | |
| 147 | 147 | $content_preview = $line["content_preview"]; |
| 148 | 148 | |
| 149 | - $tmp = "<li><span class='title'>" . $line["title"] . "</span><br/>" . |
|
| 150 | - "<span class='feed'>" . $line['feed_title'] . "</span>, <span class='date'>" . mb_substr($line["date_entered"], 0, 16) . "</span>" . |
|
| 151 | - "<div class='preview text-muted'>" . $content_preview . "</div>" . |
|
| 149 | + $tmp = "<li><span class='title'>".$line["title"]."</span><br/>". |
|
| 150 | + "<span class='feed'>".$line['feed_title']."</span>, <span class='date'>".mb_substr($line["date_entered"], 0, 16)."</span>". |
|
| 151 | + "<div class='preview text-muted'>".$content_preview."</div>". |
|
| 152 | 152 | "</li>"; |
| 153 | 153 | |
| 154 | 154 | array_push($rv, $tmp); |
@@ -203,11 +203,11 @@ discard block |
||
| 203 | 203 | foreach ($feeds as $feed_id) { |
| 204 | 204 | |
| 205 | 205 | if (strpos($feed_id, "CAT:") === 0) { |
| 206 | - $feed_id = (int)substr($feed_id, 4); |
|
| 206 | + $feed_id = (int) substr($feed_id, 4); |
|
| 207 | 207 | array_push($feeds_fmt, Feeds::getCategoryTitle($feed_id)); |
| 208 | 208 | } else { |
| 209 | 209 | if ($feed_id) |
| 210 | - array_push($feeds_fmt, Feeds::getFeedTitle((int)$feed_id)); |
|
| 210 | + array_push($feeds_fmt, Feeds::getFeedTitle((int) $feed_id)); |
|
| 211 | 211 | else |
| 212 | 212 | array_push($feeds_fmt, __("All feeds")); |
| 213 | 213 | } |
@@ -218,8 +218,7 @@ discard block |
||
| 218 | 218 | } else { |
| 219 | 219 | |
| 220 | 220 | $where = $line["cat_filter"] ? |
| 221 | - Feeds::getCategoryTitle($line["cat_id"]) : |
|
| 222 | - ($line["feed_id"] ? |
|
| 221 | + Feeds::getCategoryTitle($line["cat_id"]) : ($line["feed_id"] ? |
|
| 223 | 222 | Feeds::getFeedTitle($line["feed_id"]) : __("All feeds")); |
| 224 | 223 | } |
| 225 | 224 | |
@@ -227,11 +226,11 @@ discard block |
||
| 227 | 226 | |
| 228 | 227 | $inverse = $line["inverse"] ? "inverse" : ""; |
| 229 | 228 | |
| 230 | - $rv .= "<li class='$inverse'>" . T_sprintf("%s on %s in %s %s", |
|
| 229 | + $rv .= "<li class='$inverse'>".T_sprintf("%s on %s in %s %s", |
|
| 231 | 230 | htmlspecialchars($line["reg_exp"]), |
| 232 | 231 | $line["field"], |
| 233 | 232 | $where, |
| 234 | - $line["inverse"] ? __("(inverse)") : "") . "</li>"; |
|
| 233 | + $line["inverse"] ? __("(inverse)") : "")."</li>"; |
|
| 235 | 234 | } |
| 236 | 235 | |
| 237 | 236 | return $rv; |
@@ -294,12 +293,12 @@ discard block |
||
| 294 | 293 | //$fg_color = $label_row["fg_color"]; |
| 295 | 294 | $bg_color = $label_row["bg_color"]; |
| 296 | 295 | |
| 297 | - $name[1] = "<i class=\"material-icons\" style='color : $bg_color; margin-right : 4px'>label</i>" . $name[1]; |
|
| 296 | + $name[1] = "<i class=\"material-icons\" style='color : $bg_color; margin-right : 4px'>label</i>".$name[1]; |
|
| 298 | 297 | } |
| 299 | 298 | } |
| 300 | 299 | |
| 301 | 300 | $filter = array(); |
| 302 | - $filter['id'] = 'FILTER:' . $line['id']; |
|
| 301 | + $filter['id'] = 'FILTER:'.$line['id']; |
|
| 303 | 302 | $filter['bare_id'] = $line['id']; |
| 304 | 303 | $filter['name'] = $name[0]; |
| 305 | 304 | $filter['param'] = $name[1]; |
@@ -357,7 +356,7 @@ discard block |
||
| 357 | 356 | print "<div dojoType=\"fox.Toolbar\">"; |
| 358 | 357 | |
| 359 | 358 | print "<div dojoType=\"fox.form.DropDownButton\">". |
| 360 | - "<span>" . __('Select')."</span>"; |
|
| 359 | + "<span>".__('Select')."</span>"; |
|
| 361 | 360 | print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">"; |
| 362 | 361 | print "<div onclick=\"dijit.byId('filterEditDlg').selectRules(true)\" |
| 363 | 362 | dojoType=\"dijit.MenuItem\">".__('All')."</div>"; |
@@ -384,12 +383,12 @@ discard block |
||
| 384 | 383 | $line["feed_id"] = json_decode($line["match_on"], true); |
| 385 | 384 | } else { |
| 386 | 385 | if ($line["cat_filter"]) { |
| 387 | - $feed_id = "CAT:" . (int)$line["cat_id"]; |
|
| 386 | + $feed_id = "CAT:".(int) $line["cat_id"]; |
|
| 388 | 387 | } else { |
| 389 | - $feed_id = (int)$line["feed_id"]; |
|
| 388 | + $feed_id = (int) $line["feed_id"]; |
|
| 390 | 389 | } |
| 391 | 390 | |
| 392 | - $line["feed_id"] = ["" . $feed_id]; // set item type to string for in_array() |
|
| 391 | + $line["feed_id"] = ["".$feed_id]; // set item type to string for in_array() |
|
| 393 | 392 | } |
| 394 | 393 | |
| 395 | 394 | unset($line["cat_filter"]); |
@@ -417,7 +416,7 @@ discard block |
||
| 417 | 416 | print "<div dojoType=\"fox.Toolbar\">"; |
| 418 | 417 | |
| 419 | 418 | print "<div dojoType=\"fox.form.DropDownButton\">". |
| 420 | - "<span>" . __('Select')."</span>"; |
|
| 419 | + "<span>".__('Select')."</span>"; |
|
| 421 | 420 | print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">"; |
| 422 | 421 | print "<div onclick=\"dijit.byId('filterEditDlg').selectActions(true)\" |
| 423 | 422 | dojoType=\"dijit.MenuItem\">".__('All')."</div>"; |
@@ -528,11 +527,11 @@ discard block |
||
| 528 | 527 | foreach ($feeds as $feed_id) { |
| 529 | 528 | |
| 530 | 529 | if (strpos($feed_id, "CAT:") === 0) { |
| 531 | - $feed_id = (int)substr($feed_id, 4); |
|
| 530 | + $feed_id = (int) substr($feed_id, 4); |
|
| 532 | 531 | array_push($feeds_fmt, Feeds::getCategoryTitle($feed_id)); |
| 533 | 532 | } else { |
| 534 | 533 | if ($feed_id) |
| 535 | - array_push($feeds_fmt, Feeds::getFeedTitle((int)$feed_id)); |
|
| 534 | + array_push($feeds_fmt, Feeds::getFeedTitle((int) $feed_id)); |
|
| 536 | 535 | else |
| 537 | 536 | array_push($feeds_fmt, __("All feeds")); |
| 538 | 537 | } |
@@ -542,7 +541,7 @@ discard block |
||
| 542 | 541 | |
| 543 | 542 | $sth = $this->pdo->prepare("SELECT description FROM ttrss_filter_types |
| 544 | 543 | WHERE id = ?"); |
| 545 | - $sth->execute([(int)$rule["filter_type"]]); |
|
| 544 | + $sth->execute([(int) $rule["filter_type"]]); |
|
| 546 | 545 | |
| 547 | 546 | if ($row = $sth->fetch()) { |
| 548 | 547 | $filter_type = $row["description"]; |
@@ -552,9 +551,9 @@ discard block |
||
| 552 | 551 | |
| 553 | 552 | $inverse = isset($rule["inverse"]) ? "inverse" : ""; |
| 554 | 553 | |
| 555 | - return "<span class='filterRule $inverse'>" . |
|
| 554 | + return "<span class='filterRule $inverse'>". |
|
| 556 | 555 | T_sprintf("%s on %s in %s %s", htmlspecialchars($rule["reg_exp"]), |
| 557 | - $filter_type, $feed, isset($rule["inverse"]) ? __("(inverse)") : "") . "</span>"; |
|
| 556 | + $filter_type, $feed, isset($rule["inverse"]) ? __("(inverse)") : "")."</span>"; |
|
| 558 | 557 | } |
| 559 | 558 | |
| 560 | 559 | public function printRuleName() { |
@@ -564,7 +563,7 @@ discard block |
||
| 564 | 563 | private function getActionName($action) { |
| 565 | 564 | $sth = $this->pdo->prepare("SELECT description FROM |
| 566 | 565 | ttrss_filter_actions WHERE id = ?"); |
| 567 | - $sth->execute([(int)$action["action_id"]]); |
|
| 566 | + $sth->execute([(int) $action["action_id"]]); |
|
| 568 | 567 | |
| 569 | 568 | $title = ""; |
| 570 | 569 | |
@@ -574,7 +573,7 @@ discard block |
||
| 574 | 573 | |
| 575 | 574 | if ($action["action_id"] == 4 || $action["action_id"] == 6 || |
| 576 | 575 | $action["action_id"] == 7) |
| 577 | - $title .= ": " . $action["action_param"]; |
|
| 576 | + $title .= ": ".$action["action_param"]; |
|
| 578 | 577 | |
| 579 | 578 | if ($action["action_id"] == 9) { |
| 580 | 579 | list ($pfclass, $pfaction) = explode(":", $action["action_param"]); |
@@ -584,7 +583,7 @@ discard block |
||
| 584 | 583 | foreach ($filter_actions as $fclass => $factions) { |
| 585 | 584 | foreach ($factions as $faction) { |
| 586 | 585 | if ($pfaction == $faction["action"] && $pfclass == $fclass) { |
| 587 | - $title .= ": " . $fclass . ": " . $faction["description"]; |
|
| 586 | + $title .= ": ".$fclass.": ".$faction["description"]; |
|
| 588 | 587 | break; |
| 589 | 588 | } |
| 590 | 589 | } |
@@ -681,7 +680,7 @@ discard block |
||
| 681 | 680 | $reg_exp = trim($rule["reg_exp"]); |
| 682 | 681 | $inverse = isset($rule["inverse"]) ? 1 : 0; |
| 683 | 682 | |
| 684 | - $filter_type = (int)trim($rule["filter_type"]); |
|
| 683 | + $filter_type = (int) trim($rule["filter_type"]); |
|
| 685 | 684 | $match_on = json_encode($rule["feed_id"]); |
| 686 | 685 | |
| 687 | 686 | $rsth->execute([$filter_id, $reg_exp, $filter_type, $match_on, $inverse]); |
@@ -695,7 +694,7 @@ discard block |
||
| 695 | 694 | foreach ($actions as $action) { |
| 696 | 695 | if ($action) { |
| 697 | 696 | |
| 698 | - $action_id = (int)$action["action_id"]; |
|
| 697 | + $action_id = (int) $action["action_id"]; |
|
| 699 | 698 | $action_param = $action["action_param"]; |
| 700 | 699 | $action_param_label = $action["action_param_label"]; |
| 701 | 700 | |
@@ -704,7 +703,7 @@ discard block |
||
| 704 | 703 | } |
| 705 | 704 | |
| 706 | 705 | if ($action_id == 6) { |
| 707 | - $action_param = (int)str_replace("+", "", $action_param); |
|
| 706 | + $action_param = (int) str_replace("+", "", $action_param); |
|
| 708 | 707 | } |
| 709 | 708 | |
| 710 | 709 | $asth->execute([$filter_id, $action_id, $action_param]); |
@@ -773,7 +772,7 @@ discard block |
||
| 773 | 772 | </div>"; |
| 774 | 773 | |
| 775 | 774 | print "<div dojoType=\"fox.form.DropDownButton\">". |
| 776 | - "<span>" . __('Select')."</span>"; |
|
| 775 | + "<span>".__('Select')."</span>"; |
|
| 777 | 776 | print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">"; |
| 778 | 777 | print "<div onclick=\"dijit.byId('filterTree').model.setAllChecked(true)\" |
| 779 | 778 | dojoType=\"dijit.MenuItem\">".__('All')."</div>"; |
@@ -859,7 +858,7 @@ discard block |
||
| 859 | 858 | print "<div dojoType='fox.Toolbar'>"; |
| 860 | 859 | |
| 861 | 860 | print "<div dojoType='fox.form.DropDownButton'>". |
| 862 | - "<span>" . __('Select')."</span>"; |
|
| 861 | + "<span>".__('Select')."</span>"; |
|
| 863 | 862 | print "<div dojoType='dijit.Menu' style='display: none'>"; |
| 864 | 863 | print "<div onclick=\"dijit.byId('filterEditDlg').selectRules(true)\" |
| 865 | 864 | dojoType='dijit.MenuItem'>".__('All')."</div>"; |
@@ -888,7 +887,7 @@ discard block |
||
| 888 | 887 | print "<div dojoType='fox.Toolbar'>"; |
| 889 | 888 | |
| 890 | 889 | print "<div dojoType='fox.form.DropDownButton'>". |
| 891 | - "<span>" . __('Select')."</span>"; |
|
| 890 | + "<span>".__('Select')."</span>"; |
|
| 892 | 891 | print "<div dojoType='dijit.Menu' style='display: none'>"; |
| 893 | 892 | print "<div onclick=\"dijit.byId('filterEditDlg').selectActions(true)\" |
| 894 | 893 | dojoType='dijit.MenuItem'>".__('All')."</div>"; |
@@ -992,10 +991,10 @@ discard block |
||
| 992 | 991 | print "</fieldset>"; |
| 993 | 992 | |
| 994 | 993 | print "<fieldset>"; |
| 995 | - print "<label style='display : inline'>". __("on field") . "</label> "; |
|
| 994 | + print "<label style='display : inline'>".__("on field")."</label> "; |
|
| 996 | 995 | print_select_hash("filter_type", $filter_type, $filter_types, |
| 997 | 996 | 'dojoType="fox.form.Select"'); |
| 998 | - print "<label style='padding-left : 10px; display : inline'>" . __("in") . "</label> "; |
|
| 997 | + print "<label style='padding-left : 10px; display : inline'>".__("in")."</label> "; |
|
| 999 | 998 | |
| 1000 | 999 | print "</fieldset>"; |
| 1001 | 1000 | |
@@ -1031,7 +1030,7 @@ discard block |
||
| 1031 | 1030 | |
| 1032 | 1031 | if ($action) { |
| 1033 | 1032 | $action_param = $action["action_param"]; |
| 1034 | - $action_id = (int)$action["action_id"]; |
|
| 1033 | + $action_id = (int) $action["action_id"]; |
|
| 1035 | 1034 | } else { |
| 1036 | 1035 | $action_param = ""; |
| 1037 | 1036 | $action_id = 0; |
@@ -1062,8 +1061,8 @@ discard block |
||
| 1062 | 1061 | $param_hidden = ($action_id == 4 || $action_id == 6) ? |
| 1063 | 1062 | "" : "display : none"; |
| 1064 | 1063 | |
| 1065 | - $label_param_hidden = ($action_id == 7) ? "" : "display : none"; |
|
| 1066 | - $plugin_param_hidden = ($action_id == 9) ? "" : "display : none"; |
|
| 1064 | + $label_param_hidden = ($action_id == 7) ? "" : "display : none"; |
|
| 1065 | + $plugin_param_hidden = ($action_id == 9) ? "" : "display : none"; |
|
| 1067 | 1066 | |
| 1068 | 1067 | print "<span id='filterDlg_paramBox' style=\"$param_box_hidden\">"; |
| 1069 | 1068 | print " "; |
@@ -1082,8 +1081,8 @@ discard block |
||
| 1082 | 1081 | foreach ($filter_actions as $fclass => $factions) { |
| 1083 | 1082 | foreach ($factions as $faction) { |
| 1084 | 1083 | |
| 1085 | - $filter_action_hash[$fclass . ":" . $faction["action"]] = |
|
| 1086 | - $fclass . ": " . $faction["description"]; |
|
| 1084 | + $filter_action_hash[$fclass.":".$faction["action"]] = |
|
| 1085 | + $fclass.": ".$faction["description"]; |
|
| 1087 | 1086 | } |
| 1088 | 1087 | } |
| 1089 | 1088 | |
@@ -1153,8 +1152,8 @@ discard block |
||
| 1153 | 1152 | $num_actions -= 1; |
| 1154 | 1153 | } |
| 1155 | 1154 | |
| 1156 | - if ($match_any_rule) $title .= " (" . __("matches any rule") . ")"; |
|
| 1157 | - if ($inverse) $title .= " (" . __("inverse") . ")"; |
|
| 1155 | + if ($match_any_rule) $title .= " (".__("matches any rule").")"; |
|
| 1156 | + if ($inverse) $title .= " (".__("inverse").")"; |
|
| 1158 | 1157 | |
| 1159 | 1158 | if ($num_actions > 0) |
| 1160 | 1159 | $actions = sprintf(_ngettext("%s (+%d action)", "%s (+%d actions)", (int) $num_actions), $actions, $num_actions); |
@@ -21,8 +21,9 @@ discard block |
||
| 21 | 21 | #file_put_contents("/tmp/saveorder.json", clean($_POST['payload'])); |
| 22 | 22 | #$data = json_decode(file_get_contents("/tmp/saveorder.json"), true); |
| 23 | 23 | |
| 24 | - if (!is_array($data['items'])) |
|
| 25 | - $data['items'] = json_decode($data['items'], true); |
|
| 24 | + if (!is_array($data['items'])) { |
|
| 25 | + $data['items'] = json_decode($data['items'], true); |
|
| 26 | + } |
|
| 26 | 27 | |
| 27 | 28 | $index = 0; |
| 28 | 29 | |
@@ -98,12 +99,16 @@ discard block |
||
| 98 | 99 | } |
| 99 | 100 | } |
| 100 | 101 | |
| 101 | - if (count($scope_qparts) == 0) $scope_qparts = ["true"]; |
|
| 102 | + if (count($scope_qparts) == 0) { |
|
| 103 | + $scope_qparts = ["true"]; |
|
| 104 | + } |
|
| 102 | 105 | |
| 103 | 106 | $glue = $filter['match_any_rule'] ? " OR " : " AND "; |
| 104 | 107 | $scope_qpart = join($glue, $scope_qparts); |
| 105 | 108 | |
| 106 | - if (!$scope_qpart) $scope_qpart = "true"; |
|
| 109 | + if (!$scope_qpart) { |
|
| 110 | + $scope_qpart = "true"; |
|
| 111 | + } |
|
| 107 | 112 | |
| 108 | 113 | $rv = array(); |
| 109 | 114 | |
@@ -161,7 +166,9 @@ discard block |
||
| 161 | 166 | |
| 162 | 167 | public function testFilter() { |
| 163 | 168 | |
| 164 | - if (isset($_REQUEST["offset"])) return $this->testFilterDo(); |
|
| 169 | + if (isset($_REQUEST["offset"])) { |
|
| 170 | + return $this->testFilterDo(); |
|
| 171 | + } |
|
| 165 | 172 | |
| 166 | 173 | //print __("Articles matching this filter:"); |
| 167 | 174 | |
@@ -206,10 +213,11 @@ discard block |
||
| 206 | 213 | $feed_id = (int)substr($feed_id, 4); |
| 207 | 214 | array_push($feeds_fmt, Feeds::getCategoryTitle($feed_id)); |
| 208 | 215 | } else { |
| 209 | - if ($feed_id) |
|
| 210 | - array_push($feeds_fmt, Feeds::getFeedTitle((int)$feed_id)); |
|
| 211 | - else |
|
| 212 | - array_push($feeds_fmt, __("All feeds")); |
|
| 216 | + if ($feed_id) { |
|
| 217 | + array_push($feeds_fmt, Feeds::getFeedTitle((int)$feed_id)); |
|
| 218 | + } else { |
|
| 219 | + array_push($feeds_fmt, __("All feeds")); |
|
| 220 | + } |
|
| 213 | 221 | } |
| 214 | 222 | } |
| 215 | 223 | |
@@ -396,7 +404,9 @@ discard block |
||
| 396 | 404 | unset($line["cat_id"]); |
| 397 | 405 | unset($line["filter_id"]); |
| 398 | 406 | unset($line["id"]); |
| 399 | - if (!$line["inverse"]) unset($line["inverse"]); |
|
| 407 | + if (!$line["inverse"]) { |
|
| 408 | + unset($line["inverse"]); |
|
| 409 | + } |
|
| 400 | 410 | unset($line["match_on"]); |
| 401 | 411 | |
| 402 | 412 | $data = htmlspecialchars(json_encode($line)); |
@@ -518,12 +528,16 @@ discard block |
||
| 518 | 528 | } |
| 519 | 529 | |
| 520 | 530 | private function getRuleName($rule) { |
| 521 | - if (!$rule) $rule = json_decode(clean($_REQUEST["rule"]), true); |
|
| 531 | + if (!$rule) { |
|
| 532 | + $rule = json_decode(clean($_REQUEST["rule"]), true); |
|
| 533 | + } |
|
| 522 | 534 | |
| 523 | 535 | $feeds = $rule["feed_id"]; |
| 524 | 536 | $feeds_fmt = []; |
| 525 | 537 | |
| 526 | - if (!is_array($feeds)) $feeds = [$feeds]; |
|
| 538 | + if (!is_array($feeds)) { |
|
| 539 | + $feeds = [$feeds]; |
|
| 540 | + } |
|
| 527 | 541 | |
| 528 | 542 | foreach ($feeds as $feed_id) { |
| 529 | 543 | |
@@ -531,10 +545,11 @@ discard block |
||
| 531 | 545 | $feed_id = (int)substr($feed_id, 4); |
| 532 | 546 | array_push($feeds_fmt, Feeds::getCategoryTitle($feed_id)); |
| 533 | 547 | } else { |
| 534 | - if ($feed_id) |
|
| 535 | - array_push($feeds_fmt, Feeds::getFeedTitle((int)$feed_id)); |
|
| 536 | - else |
|
| 537 | - array_push($feeds_fmt, __("All feeds")); |
|
| 548 | + if ($feed_id) { |
|
| 549 | + array_push($feeds_fmt, Feeds::getFeedTitle((int)$feed_id)); |
|
| 550 | + } else { |
|
| 551 | + array_push($feeds_fmt, __("All feeds")); |
|
| 552 | + } |
|
| 538 | 553 | } |
| 539 | 554 | } |
| 540 | 555 | |
@@ -573,8 +588,9 @@ discard block |
||
| 573 | 588 | $title = __($row["description"]); |
| 574 | 589 | |
| 575 | 590 | if ($action["action_id"] == 4 || $action["action_id"] == 6 || |
| 576 | - $action["action_id"] == 7) |
|
| 577 | - $title .= ": " . $action["action_param"]; |
|
| 591 | + $action["action_id"] == 7) { |
|
| 592 | + $title .= ": " . $action["action_param"]; |
|
| 593 | + } |
|
| 578 | 594 | |
| 579 | 595 | if ($action["action_id"] == 9) { |
| 580 | 596 | list ($pfclass, $pfaction) = explode(":", $action["action_param"]); |
@@ -644,8 +660,12 @@ discard block |
||
| 644 | 660 | $sth = $this->pdo->prepare("DELETE FROM ttrss_filters2_actions WHERE filter_id = ?"); |
| 645 | 661 | $sth->execute([$filter_id]); |
| 646 | 662 | |
| 647 | - if (!is_array(clean($_REQUEST["rule"]))) $_REQUEST["rule"] = []; |
|
| 648 | - if (!is_array(clean($_REQUEST["action"]))) $_REQUEST["action"] = []; |
|
| 663 | + if (!is_array(clean($_REQUEST["rule"]))) { |
|
| 664 | + $_REQUEST["rule"] = []; |
|
| 665 | + } |
|
| 666 | + if (!is_array(clean($_REQUEST["action"]))) { |
|
| 667 | + $_REQUEST["action"] = []; |
|
| 668 | + } |
|
| 649 | 669 | |
| 650 | 670 | if ($filter_id) { |
| 651 | 671 | /* create rules */ |
@@ -1137,7 +1157,9 @@ discard block |
||
| 1137 | 1157 | $match_any_rule = $row["match_any_rule"]; |
| 1138 | 1158 | $inverse = $row["inverse"]; |
| 1139 | 1159 | |
| 1140 | - if (!$title) $title = __("[No caption]"); |
|
| 1160 | + if (!$title) { |
|
| 1161 | + $title = __("[No caption]"); |
|
| 1162 | + } |
|
| 1141 | 1163 | |
| 1142 | 1164 | $title = sprintf(_ngettext("%s (%d rule)", "%s (%d rules)", (int) $num_rules), $title, $num_rules); |
| 1143 | 1165 | |
@@ -1153,11 +1175,16 @@ discard block |
||
| 1153 | 1175 | $num_actions -= 1; |
| 1154 | 1176 | } |
| 1155 | 1177 | |
| 1156 | - if ($match_any_rule) $title .= " (" . __("matches any rule") . ")"; |
|
| 1157 | - if ($inverse) $title .= " (" . __("inverse") . ")"; |
|
| 1178 | + if ($match_any_rule) { |
|
| 1179 | + $title .= " (" . __("matches any rule") . ")"; |
|
| 1180 | + } |
|
| 1181 | + if ($inverse) { |
|
| 1182 | + $title .= " (" . __("inverse") . ")"; |
|
| 1183 | + } |
|
| 1158 | 1184 | |
| 1159 | - if ($num_actions > 0) |
|
| 1160 | - $actions = sprintf(_ngettext("%s (+%d action)", "%s (+%d actions)", (int) $num_actions), $actions, $num_actions); |
|
| 1185 | + if ($num_actions > 0) { |
|
| 1186 | + $actions = sprintf(_ngettext("%s (+%d action)", "%s (+%d actions)", (int) $num_actions), $actions, $num_actions); |
|
| 1187 | + } |
|
| 1161 | 1188 | |
| 1162 | 1189 | return [$title, $actions]; |
| 1163 | 1190 | } |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | print "<fieldset>"; |
| 55 | - print "<label>" . __("Login:") . "</label>"; |
|
| 55 | + print "<label>".__("Login:")."</label>"; |
|
| 56 | 56 | print "<input style='font-size : 16px' |
| 57 | 57 | dojoType='dijit.form.ValidationTextBox' required='1' |
| 58 | 58 | $sel_disabled name='login' value=\"$login\">"; |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | print "<fieldset>"; |
| 67 | 67 | |
| 68 | - print "<label>" . __('Access level: ') . "</label> "; |
|
| 68 | + print "<label>".__('Access level: ')."</label> "; |
|
| 69 | 69 | |
| 70 | 70 | if (!$sel_disabled) { |
| 71 | 71 | print_select_hash("access_level", $access_level, $access_level_names, |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | print "</fieldset>"; |
| 80 | 80 | print "<fieldset>"; |
| 81 | 81 | |
| 82 | - print "<label>" . __("New password:") . "</label> "; |
|
| 82 | + print "<label>".__("New password:")."</label> "; |
|
| 83 | 83 | print "<input dojoType='dijit.form.TextBox' type='password' size='20' placeholder='Change password' |
| 84 | 84 | name='password'>"; |
| 85 | 85 | |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | print "<section>"; |
| 92 | 92 | |
| 93 | 93 | print "<fieldset>"; |
| 94 | - print "<label>" . __("E-mail:") . "</label> "; |
|
| 94 | + print "<label>".__("E-mail:")."</label> "; |
|
| 95 | 95 | print "<input dojoType='dijit.form.TextBox' size='30' name='email' |
| 96 | 96 | value=\"$email\">"; |
| 97 | 97 | print "</fieldset>"; |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | } |
| 338 | 338 | |
| 339 | 339 | print "<div dojoType='fox.form.DropDownButton'>". |
| 340 | - "<span>" . __('Select')."</span>"; |
|
| 340 | + "<span>".__('Select')."</span>"; |
|
| 341 | 341 | print "<div dojoType='dijit.Menu' style='display: none'>"; |
| 342 | 342 | print "<div onclick=\"Tables.select('prefUserList', true)\" |
| 343 | 343 | dojoType='dijit.MenuItem'>".__('All')."</div>"; |
@@ -405,12 +405,12 @@ discard block |
||
| 405 | 405 | print "<td align='center'><input onclick='Tables.onRowChecked(this); event.stopPropagation();' |
| 406 | 406 | dojoType='dijit.form.CheckBox' type='checkbox'></td>"; |
| 407 | 407 | |
| 408 | - print "<td title='".__('Click to edit')."'><i class='material-icons'>person</i> " . $line["login"] . "</td>"; |
|
| 408 | + print "<td title='".__('Click to edit')."'><i class='material-icons'>person</i> ".$line["login"]."</td>"; |
|
| 409 | 409 | |
| 410 | - print "<td>" . $access_level_names[$line["access_level"]] . "</td>"; |
|
| 411 | - print "<td>" . $line["num_feeds"] . "</td>"; |
|
| 412 | - print "<td>" . $line["created"] . "</td>"; |
|
| 413 | - print "<td>" . $line["last_login"] . "</td>"; |
|
| 410 | + print "<td>".$access_level_names[$line["access_level"]]."</td>"; |
|
| 411 | + print "<td>".$line["num_feeds"]."</td>"; |
|
| 412 | + print "<td>".$line["created"]."</td>"; |
|
| 413 | + print "<td>".$line["last_login"]."</td>"; |
|
| 414 | 414 | |
| 415 | 415 | print "</tr>"; |
| 416 | 416 | |
@@ -235,7 +235,10 @@ discard block |
||
| 235 | 235 | $salt = substr(bin2hex(get_random_bytes(125)), 0, 250); |
| 236 | 236 | $pwd_hash = encrypt_password($tmp_user_pwd, $salt, true); |
| 237 | 237 | |
| 238 | - if (!$login) return; // no blank usernames |
|
| 238 | + if (!$login) { |
|
| 239 | + return; |
|
| 240 | + } |
|
| 241 | + // no blank usernames |
|
| 239 | 242 | |
| 240 | 243 | $sth = $this->pdo->prepare("SELECT id FROM ttrss_users WHERE |
| 241 | 244 | login = ?"); |
@@ -294,10 +297,11 @@ discard block |
||
| 294 | 297 | |
| 295 | 298 | $message = T_sprintf("Changed password of user %s to %s", "<strong>$login</strong>", "<strong>$tmp_user_pwd</strong>"); |
| 296 | 299 | |
| 297 | - if ($format_output) |
|
| 298 | - print_notice($message); |
|
| 299 | - else |
|
| 300 | - print $message; |
|
| 300 | + if ($format_output) { |
|
| 301 | + print_notice($message); |
|
| 302 | + } else { |
|
| 303 | + print $message; |
|
| 304 | + } |
|
| 301 | 305 | |
| 302 | 306 | } |
| 303 | 307 | } |
@@ -365,7 +369,9 @@ discard block |
||
| 365 | 369 | $sort = $this->validate_field($sort, |
| 366 | 370 | ["login", "access_level", "created", "num_feeds", "created", "last_login"], "login"); |
| 367 | 371 | |
| 368 | - if ($sort != "login") $sort = "$sort DESC"; |
|
| 372 | + if ($sort != "login") { |
|
| 373 | + $sort = "$sort DESC"; |
|
| 374 | + } |
|
| 369 | 375 | |
| 370 | 376 | $sth = $this->pdo->prepare("SELECT |
| 371 | 377 | tu.id, |
@@ -437,10 +443,11 @@ discard block |
||
| 437 | 443 | } |
| 438 | 444 | |
| 439 | 445 | public function validate_field($string, $allowed, $default = "") { |
| 440 | - if (in_array($string, $allowed)) |
|
| 441 | - return $string; |
|
| 442 | - else |
|
| 443 | - return $default; |
|
| 446 | + if (in_array($string, $allowed)) { |
|
| 447 | + return $string; |
|
| 448 | + } else { |
|
| 449 | + return $default; |
|
| 450 | + } |
|
| 444 | 451 | } |
| 445 | 452 | |
| 446 | 453 | } |
@@ -1,86 +1,86 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | class Debug { |
| 3 | 3 | public static $LOG_DISABLED = -1; |
| 4 | - public static $LOG_NORMAL = 0; |
|
| 5 | - public static $LOG_VERBOSE = 1; |
|
| 6 | - public static $LOG_EXTENDED = 2; |
|
| 4 | + public static $LOG_NORMAL = 0; |
|
| 5 | + public static $LOG_VERBOSE = 1; |
|
| 6 | + public static $LOG_EXTENDED = 2; |
|
| 7 | 7 | |
| 8 | - private static $enabled = false; |
|
| 9 | - private static $quiet = false; |
|
| 10 | - private static $logfile = false; |
|
| 11 | - private static $loglevel = 0; |
|
| 8 | + private static $enabled = false; |
|
| 9 | + private static $quiet = false; |
|
| 10 | + private static $logfile = false; |
|
| 11 | + private static $loglevel = 0; |
|
| 12 | 12 | |
| 13 | 13 | public static function set_logfile($logfile) { |
| 14 | - Debug::$logfile = $logfile; |
|
| 15 | - } |
|
| 14 | + Debug::$logfile = $logfile; |
|
| 15 | + } |
|
| 16 | 16 | |
| 17 | - public static function enabled() { |
|
| 18 | - return Debug::$enabled; |
|
| 19 | - } |
|
| 17 | + public static function enabled() { |
|
| 18 | + return Debug::$enabled; |
|
| 19 | + } |
|
| 20 | 20 | |
| 21 | - public static function set_enabled($enable) { |
|
| 22 | - Debug::$enabled = $enable; |
|
| 23 | - } |
|
| 21 | + public static function set_enabled($enable) { |
|
| 22 | + Debug::$enabled = $enable; |
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | - public static function set_quiet($quiet) { |
|
| 26 | - Debug::$quiet = $quiet; |
|
| 27 | - } |
|
| 25 | + public static function set_quiet($quiet) { |
|
| 26 | + Debug::$quiet = $quiet; |
|
| 27 | + } |
|
| 28 | 28 | |
| 29 | - public static function set_loglevel($level) { |
|
| 30 | - Debug::$loglevel = $level; |
|
| 31 | - } |
|
| 29 | + public static function set_loglevel($level) { |
|
| 30 | + Debug::$loglevel = $level; |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | - public static function get_loglevel() { |
|
| 34 | - return Debug::$loglevel; |
|
| 35 | - } |
|
| 33 | + public static function get_loglevel() { |
|
| 34 | + return Debug::$loglevel; |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | - public static function log($message, $level = 0) { |
|
| 37 | + public static function log($message, $level = 0) { |
|
| 38 | 38 | |
| 39 | - if (!Debug::$enabled || Debug::$loglevel < $level) return false; |
|
| 39 | + if (!Debug::$enabled || Debug::$loglevel < $level) return false; |
|
| 40 | 40 | |
| 41 | - $ts = strftime("%H:%M:%S", time()); |
|
| 42 | - if (function_exists('posix_getpid')) { |
|
| 43 | - $ts = "$ts/" . posix_getpid(); |
|
| 44 | - } |
|
| 41 | + $ts = strftime("%H:%M:%S", time()); |
|
| 42 | + if (function_exists('posix_getpid')) { |
|
| 43 | + $ts = "$ts/" . posix_getpid(); |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - if (Debug::$logfile) { |
|
| 47 | - $fp = fopen(Debug::$logfile, 'a+'); |
|
| 46 | + if (Debug::$logfile) { |
|
| 47 | + $fp = fopen(Debug::$logfile, 'a+'); |
|
| 48 | 48 | |
| 49 | - if ($fp) { |
|
| 50 | - $locked = false; |
|
| 49 | + if ($fp) { |
|
| 50 | + $locked = false; |
|
| 51 | 51 | |
| 52 | - if (function_exists("flock")) { |
|
| 53 | - $tries = 0; |
|
| 52 | + if (function_exists("flock")) { |
|
| 53 | + $tries = 0; |
|
| 54 | 54 | |
| 55 | - // try to lock logfile for writing |
|
| 56 | - while ($tries < 5 && !$locked = flock($fp, LOCK_EX | LOCK_NB)) { |
|
| 57 | - sleep(1); |
|
| 58 | - ++$tries; |
|
| 59 | - } |
|
| 55 | + // try to lock logfile for writing |
|
| 56 | + while ($tries < 5 && !$locked = flock($fp, LOCK_EX | LOCK_NB)) { |
|
| 57 | + sleep(1); |
|
| 58 | + ++$tries; |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | - if (!$locked) { |
|
| 62 | - fclose($fp); |
|
| 63 | - user_error("Unable to lock debugging log file: " . Debug::$logfile, E_USER_WARNING); |
|
| 64 | - return; |
|
| 65 | - } |
|
| 66 | - } |
|
| 61 | + if (!$locked) { |
|
| 62 | + fclose($fp); |
|
| 63 | + user_error("Unable to lock debugging log file: " . Debug::$logfile, E_USER_WARNING); |
|
| 64 | + return; |
|
| 65 | + } |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - fputs($fp, "[$ts] $message\n"); |
|
| 68 | + fputs($fp, "[$ts] $message\n"); |
|
| 69 | 69 | |
| 70 | - if (function_exists("flock")) { |
|
| 71 | - flock($fp, LOCK_UN); |
|
| 72 | - } |
|
| 70 | + if (function_exists("flock")) { |
|
| 71 | + flock($fp, LOCK_UN); |
|
| 72 | + } |
|
| 73 | 73 | |
| 74 | - fclose($fp); |
|
| 74 | + fclose($fp); |
|
| 75 | 75 | |
| 76 | - if (Debug::$quiet) |
|
| 77 | - return; |
|
| 76 | + if (Debug::$quiet) |
|
| 77 | + return; |
|
| 78 | 78 | |
| 79 | - } else { |
|
| 80 | - user_error("Unable to open debugging log file: " . Debug::$logfile, E_USER_WARNING); |
|
| 81 | - } |
|
| 82 | - } |
|
| 79 | + } else { |
|
| 80 | + user_error("Unable to open debugging log file: " . Debug::$logfile, E_USER_WARNING); |
|
| 81 | + } |
|
| 82 | + } |
|
| 83 | 83 | |
| 84 | - print "[$ts] $message\n"; |
|
| 85 | - } |
|
| 84 | + print "[$ts] $message\n"; |
|
| 85 | + } |
|
| 86 | 86 | } |
| 87 | 87 | \ No newline at end of file |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | $ts = strftime("%H:%M:%S", time()); |
| 42 | 42 | if (function_exists('posix_getpid')) { |
| 43 | - $ts = "$ts/" . posix_getpid(); |
|
| 43 | + $ts = "$ts/".posix_getpid(); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | if (Debug::$logfile) { |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | if (!$locked) { |
| 62 | 62 | fclose($fp); |
| 63 | - user_error("Unable to lock debugging log file: " . Debug::$logfile, E_USER_WARNING); |
|
| 63 | + user_error("Unable to lock debugging log file: ".Debug::$logfile, E_USER_WARNING); |
|
| 64 | 64 | return; |
| 65 | 65 | } |
| 66 | 66 | } |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | return; |
| 78 | 78 | |
| 79 | 79 | } else { |
| 80 | - user_error("Unable to open debugging log file: " . Debug::$logfile, E_USER_WARNING); |
|
| 80 | + user_error("Unable to open debugging log file: ".Debug::$logfile, E_USER_WARNING); |
|
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | 83 | |
@@ -36,7 +36,9 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | public static function log($message, $level = 0) { |
| 38 | 38 | |
| 39 | - if (!Debug::$enabled || Debug::$loglevel < $level) return false; |
|
| 39 | + if (!Debug::$enabled || Debug::$loglevel < $level) { |
|
| 40 | + return false; |
|
| 41 | + } |
|
| 40 | 42 | |
| 41 | 43 | $ts = strftime("%H:%M:%S", time()); |
| 42 | 44 | if (function_exists('posix_getpid')) { |
@@ -73,8 +75,9 @@ discard block |
||
| 73 | 75 | |
| 74 | 76 | fclose($fp); |
| 75 | 77 | |
| 76 | - if (Debug::$quiet) |
|
| 77 | - return; |
|
| 78 | + if (Debug::$quiet) { |
|
| 79 | + return; |
|
| 80 | + } |
|
| 78 | 81 | |
| 79 | 82 | } else { |
| 80 | 83 | user_error("Unable to open debugging log file: " . Debug::$logfile, E_USER_WARNING); |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | $priority = LOG_INFO; |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - $errname = Logger::$errornames[$errno] . " ($errno)"; |
|
| 27 | + $errname = Logger::$errornames[$errno]." ($errno)"; |
|
| 28 | 28 | |
| 29 | 29 | syslog($priority, "[tt-rss] $errname ($file:$line) $errstr"); |
| 30 | 30 | |
@@ -23,7 +23,7 @@ |
||
| 23 | 23 | |
| 24 | 24 | foreach ($server_params as $n => $p) { |
| 25 | 25 | if (isset($_SERVER[$p])) |
| 26 | - $context .= "\n$n: " . $_SERVER[$p]; |
|
| 26 | + $context .= "\n$n: ".$_SERVER[$p]; |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | // passed error message may contain invalid unicode characters, failing to insert an error here |
@@ -6,7 +6,9 @@ discard block |
||
| 6 | 6 | public function log_error($errno, $errstr, $file, $line, $context) { |
| 7 | 7 | |
| 8 | 8 | // separate PDO connection object is used for logging |
| 9 | - if (!$this->pdo) $this->pdo = Db::instance()->pdo_connect(); |
|
| 9 | + if (!$this->pdo) { |
|
| 10 | + $this->pdo = Db::instance()->pdo_connect(); |
|
| 11 | + } |
|
| 10 | 12 | |
| 11 | 13 | if ($this->pdo && get_schema_version() > 117) { |
| 12 | 14 | |
@@ -22,8 +24,9 @@ discard block |
||
| 22 | 24 | ]; |
| 23 | 25 | |
| 24 | 26 | foreach ($server_params as $n => $p) { |
| 25 | - if (isset($_SERVER[$p])) |
|
| 26 | - $context .= "\n$n: " . $_SERVER[$p]; |
|
| 27 | + if (isset($_SERVER[$p])) { |
|
| 28 | + $context .= "\n$n: " . $_SERVER[$p]; |
|
| 29 | + } |
|
| 27 | 30 | } |
| 28 | 31 | |
| 29 | 32 | // passed error message may contain invalid unicode characters, failing to insert an error here |
@@ -702,7 +702,7 @@ |
||
| 702 | 702 | $entry_plugin_data .= mb_strtolower(get_class($plugin)) . ","; |
| 703 | 703 | } |
| 704 | 704 | |
| 705 | - if (Debug::get_loglevel() >= 3) { |
|
| 705 | + if (Debug::get_loglevel() >= 3) { |
|
| 706 | 706 | print "processed content: "; |
| 707 | 707 | print htmlspecialchars($article["content"]); |
| 708 | 708 | print "\n"; |
@@ -1349,35 +1349,35 @@ |
||
| 1349 | 1349 | continue; |
| 1350 | 1350 | |
| 1351 | 1351 | switch ($rule["type"]) { |
| 1352 | - case "title": |
|
| 1353 | - $match = @preg_match("/$reg_exp/iu", $title); |
|
| 1354 | - break; |
|
| 1355 | - case "content": |
|
| 1356 | - // we don't need to deal with multiline regexps |
|
| 1357 | - $content = preg_replace("/[\r\n\t]/", "", $content); |
|
| 1352 | + case "title": |
|
| 1353 | + $match = @preg_match("/$reg_exp/iu", $title); |
|
| 1354 | + break; |
|
| 1355 | + case "content": |
|
| 1356 | + // we don't need to deal with multiline regexps |
|
| 1357 | + $content = preg_replace("/[\r\n\t]/", "", $content); |
|
| 1358 | 1358 | |
| 1359 | - $match = @preg_match("/$reg_exp/iu", $content); |
|
| 1360 | - break; |
|
| 1361 | - case "both": |
|
| 1362 | - // we don't need to deal with multiline regexps |
|
| 1363 | - $content = preg_replace("/[\r\n\t]/", "", $content); |
|
| 1359 | + $match = @preg_match("/$reg_exp/iu", $content); |
|
| 1360 | + break; |
|
| 1361 | + case "both": |
|
| 1362 | + // we don't need to deal with multiline regexps |
|
| 1363 | + $content = preg_replace("/[\r\n\t]/", "", $content); |
|
| 1364 | 1364 | |
| 1365 | - $match = (@preg_match("/$reg_exp/iu", $title) || @preg_match("/$reg_exp/iu", $content)); |
|
| 1366 | - break; |
|
| 1367 | - case "link": |
|
| 1368 | - $match = @preg_match("/$reg_exp/iu", $link); |
|
| 1369 | - break; |
|
| 1370 | - case "author": |
|
| 1371 | - $match = @preg_match("/$reg_exp/iu", $author); |
|
| 1372 | - break; |
|
| 1373 | - case "tag": |
|
| 1374 | - foreach ($tags as $tag) { |
|
| 1375 | - if (@preg_match("/$reg_exp/iu", $tag)) { |
|
| 1376 | - $match = true; |
|
| 1377 | - break; |
|
| 1378 | - } |
|
| 1365 | + $match = (@preg_match("/$reg_exp/iu", $title) || @preg_match("/$reg_exp/iu", $content)); |
|
| 1366 | + break; |
|
| 1367 | + case "link": |
|
| 1368 | + $match = @preg_match("/$reg_exp/iu", $link); |
|
| 1369 | + break; |
|
| 1370 | + case "author": |
|
| 1371 | + $match = @preg_match("/$reg_exp/iu", $author); |
|
| 1372 | + break; |
|
| 1373 | + case "tag": |
|
| 1374 | + foreach ($tags as $tag) { |
|
| 1375 | + if (@preg_match("/$reg_exp/iu", $tag)) { |
|
| 1376 | + $match = true; |
|
| 1377 | + break; |
|
| 1379 | 1378 | } |
| 1380 | - break; |
|
| 1379 | + } |
|
| 1380 | + break; |
|
| 1381 | 1381 | } |
| 1382 | 1382 | |
| 1383 | 1383 | if ($rule_inverse) $match = !$match; |
@@ -80,7 +80,9 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | // Update the least recently updated feeds first |
| 82 | 82 | $query_order = "ORDER BY last_updated"; |
| 83 | - if (DB_TYPE == "pgsql") $query_order .= " NULLS FIRST"; |
|
| 83 | + if (DB_TYPE == "pgsql") { |
|
| 84 | + $query_order .= " NULLS FIRST"; |
|
| 85 | + } |
|
| 84 | 86 | |
| 85 | 87 | $query = "SELECT DISTINCT ttrss_feeds.feed_url, ttrss_feeds.last_updated |
| 86 | 88 | FROM |
@@ -139,8 +141,9 @@ discard block |
||
| 139 | 141 | if ($tline = $usth->fetch()) { |
| 140 | 142 | Debug::log(" => " . $tline["last_updated"] . ", " . $tline["id"] . " " . $tline["owner_uid"]); |
| 141 | 143 | |
| 142 | - if (array_search($tline["owner_uid"], $batch_owners) === FALSE) |
|
| 143 | - array_push($batch_owners, $tline["owner_uid"]); |
|
| 144 | + if (array_search($tline["owner_uid"], $batch_owners) === FALSE) { |
|
| 145 | + array_push($batch_owners, $tline["owner_uid"]); |
|
| 146 | + } |
|
| 144 | 147 | |
| 145 | 148 | $fstarted = microtime(true); |
| 146 | 149 | |
@@ -311,11 +314,13 @@ discard block |
||
| 311 | 314 | |
| 312 | 315 | $feed_language = mb_strtolower($row["feed_language"]); |
| 313 | 316 | |
| 314 | - if (!$feed_language) |
|
| 315 | - $feed_language = mb_strtolower(get_pref('DEFAULT_SEARCH_LANGUAGE', $owner_uid)); |
|
| 317 | + if (!$feed_language) { |
|
| 318 | + $feed_language = mb_strtolower(get_pref('DEFAULT_SEARCH_LANGUAGE', $owner_uid)); |
|
| 319 | + } |
|
| 316 | 320 | |
| 317 | - if (!$feed_language) |
|
| 318 | - $feed_language = 'simple'; |
|
| 321 | + if (!$feed_language) { |
|
| 322 | + $feed_language = 'simple'; |
|
| 323 | + } |
|
| 319 | 324 | |
| 320 | 325 | } else { |
| 321 | 326 | return false; |
@@ -514,8 +519,9 @@ discard block |
||
| 514 | 519 | RSSUtils::check_feed_favicon($site_url, $feed); |
| 515 | 520 | $favicon_modified_new = @filemtime($favicon_file); |
| 516 | 521 | |
| 517 | - if ($favicon_modified_new > $favicon_modified) |
|
| 518 | - $favicon_avg_color = ''; |
|
| 522 | + if ($favicon_modified_new > $favicon_modified) { |
|
| 523 | + $favicon_avg_color = ''; |
|
| 524 | + } |
|
| 519 | 525 | |
| 520 | 526 | $favicon_colorstring = ""; |
| 521 | 527 | if (file_exists($favicon_file) && function_exists("imagecreatefromstring") && $favicon_avg_color == '') { |
@@ -578,8 +584,12 @@ discard block |
||
| 578 | 584 | } |
| 579 | 585 | |
| 580 | 586 | $entry_guid = strip_tags($item->get_id()); |
| 581 | - if (!$entry_guid) $entry_guid = strip_tags($item->get_link()); |
|
| 582 | - if (!$entry_guid) $entry_guid = RSSUtils::make_guid_from_title($item->get_title()); |
|
| 587 | + if (!$entry_guid) { |
|
| 588 | + $entry_guid = strip_tags($item->get_link()); |
|
| 589 | + } |
|
| 590 | + if (!$entry_guid) { |
|
| 591 | + $entry_guid = RSSUtils::make_guid_from_title($item->get_title()); |
|
| 592 | + } |
|
| 583 | 593 | |
| 584 | 594 | if (!$entry_guid) { |
| 585 | 595 | $pdo->commit(); |
@@ -606,10 +616,15 @@ discard block |
||
| 606 | 616 | Debug::log("link $entry_link", Debug::$LOG_VERBOSE); |
| 607 | 617 | Debug::log("language $entry_language", Debug::$LOG_VERBOSE); |
| 608 | 618 | |
| 609 | - if (!$entry_title) $entry_title = date("Y-m-d H:i:s", $entry_timestamp);; |
|
| 619 | + if (!$entry_title) { |
|
| 620 | + $entry_title = date("Y-m-d H:i:s", $entry_timestamp); |
|
| 621 | + } |
|
| 622 | + ; |
|
| 610 | 623 | |
| 611 | 624 | $entry_content = $item->get_content(); |
| 612 | - if (!$entry_content) $entry_content = $item->get_description(); |
|
| 625 | + if (!$entry_content) { |
|
| 626 | + $entry_content = $item->get_description(); |
|
| 627 | + } |
|
| 613 | 628 | |
| 614 | 629 | if (Debug::get_loglevel() >= 3) { |
| 615 | 630 | print "content: "; |
@@ -824,8 +839,9 @@ discard block |
||
| 824 | 839 | |
| 825 | 840 | Debug::log("force catchup: $entry_force_catchup", Debug::$LOG_VERBOSE); |
| 826 | 841 | |
| 827 | - if ($cache_images) |
|
| 828 | - RSSUtils::cache_media($entry_content, $site_url); |
|
| 842 | + if ($cache_images) { |
|
| 843 | + RSSUtils::cache_media($entry_content, $site_url); |
|
| 844 | + } |
|
| 829 | 845 | |
| 830 | 846 | $csth = $pdo->prepare("SELECT id FROM ttrss_entries |
| 831 | 847 | WHERE guid = ? OR guid = ?"); |
@@ -951,16 +967,18 @@ discard block |
||
| 951 | 967 | |
| 952 | 968 | $sth->execute([$ref_id, $owner_uid, $feed]); |
| 953 | 969 | |
| 954 | - if ($row = $sth->fetch()) |
|
| 955 | - $entry_int_id = $row['int_id']; |
|
| 970 | + if ($row = $sth->fetch()) { |
|
| 971 | + $entry_int_id = $row['int_id']; |
|
| 972 | + } |
|
| 956 | 973 | } |
| 957 | 974 | |
| 958 | 975 | Debug::log("resulting RID: $entry_ref_id, IID: $entry_int_id", Debug::$LOG_VERBOSE); |
| 959 | 976 | |
| 960 | - if (DB_TYPE == "pgsql") |
|
| 961 | - $tsvector_qpart = "tsvector_combined = to_tsvector(:ts_lang, :ts_content),"; |
|
| 962 | - else |
|
| 963 | - $tsvector_qpart = ""; |
|
| 977 | + if (DB_TYPE == "pgsql") { |
|
| 978 | + $tsvector_qpart = "tsvector_combined = to_tsvector(:ts_lang, :ts_content),"; |
|
| 979 | + } else { |
|
| 980 | + $tsvector_qpart = ""; |
|
| 981 | + } |
|
| 964 | 982 | |
| 965 | 983 | $sth = $pdo->prepare("UPDATE ttrss_entries |
| 966 | 984 | SET title = :title, |
@@ -1049,8 +1067,9 @@ discard block |
||
| 1049 | 1067 | } |
| 1050 | 1068 | } |
| 1051 | 1069 | |
| 1052 | - if ($cache_images) |
|
| 1053 | - RSSUtils::cache_enclosures($enclosures, $site_url); |
|
| 1070 | + if ($cache_images) { |
|
| 1071 | + RSSUtils::cache_enclosures($enclosures, $site_url); |
|
| 1072 | + } |
|
| 1054 | 1073 | |
| 1055 | 1074 | if (Debug::get_loglevel() >= Debug::$LOG_EXTENDED) { |
| 1056 | 1075 | Debug::log("article enclosures:", Debug::$LOG_VERBOSE); |
@@ -1345,8 +1364,9 @@ discard block |
||
| 1345 | 1364 | $reg_exp = str_replace('/', '\/', $rule["reg_exp"]); |
| 1346 | 1365 | $rule_inverse = $rule["inverse"]; |
| 1347 | 1366 | |
| 1348 | - if (!$reg_exp) |
|
| 1349 | - continue; |
|
| 1367 | + if (!$reg_exp) { |
|
| 1368 | + continue; |
|
| 1369 | + } |
|
| 1350 | 1370 | |
| 1351 | 1371 | switch ($rule["type"]) { |
| 1352 | 1372 | case "title": |
@@ -1380,7 +1400,9 @@ discard block |
||
| 1380 | 1400 | break; |
| 1381 | 1401 | } |
| 1382 | 1402 | |
| 1383 | - if ($rule_inverse) $match = !$match; |
|
| 1403 | + if ($rule_inverse) { |
|
| 1404 | + $match = !$match; |
|
| 1405 | + } |
|
| 1384 | 1406 | |
| 1385 | 1407 | if ($match_any_rule) { |
| 1386 | 1408 | if ($match) { |
@@ -1395,17 +1417,25 @@ discard block |
||
| 1395 | 1417 | } |
| 1396 | 1418 | } |
| 1397 | 1419 | |
| 1398 | - if ($inverse) $filter_match = !$filter_match; |
|
| 1420 | + if ($inverse) { |
|
| 1421 | + $filter_match = !$filter_match; |
|
| 1422 | + } |
|
| 1399 | 1423 | |
| 1400 | 1424 | if ($filter_match) { |
| 1401 | - if (is_array($matched_rules)) array_push($matched_rules, $rule); |
|
| 1402 | - if (is_array($matched_filters)) array_push($matched_filters, $filter); |
|
| 1425 | + if (is_array($matched_rules)) { |
|
| 1426 | + array_push($matched_rules, $rule); |
|
| 1427 | + } |
|
| 1428 | + if (is_array($matched_filters)) { |
|
| 1429 | + array_push($matched_filters, $filter); |
|
| 1430 | + } |
|
| 1403 | 1431 | |
| 1404 | 1432 | foreach ($filter["actions"] AS $action) { |
| 1405 | 1433 | array_push($matches, $action); |
| 1406 | 1434 | |
| 1407 | 1435 | // if Stop action encountered, perform no further processing |
| 1408 | - if (isset($action["type"]) && $action["type"] == "stop") return $matches; |
|
| 1436 | + if (isset($action["type"]) && $action["type"] == "stop") { |
|
| 1437 | + return $matches; |
|
| 1438 | + } |
|
| 1409 | 1439 | } |
| 1410 | 1440 | } |
| 1411 | 1441 | } |
@@ -1531,24 +1561,19 @@ discard block |
||
| 1531 | 1561 | if (preg_match('/^\x00\x00\x01\x00/', $contents)) { |
| 1532 | 1562 | // 0 string \000\000\001\000 MS Windows icon resource |
| 1533 | 1563 | //error_log("check_feed_favicon: favicon_url=$favicon_url isa MS Windows icon resource"); |
| 1534 | - } |
|
| 1535 | - elseif (preg_match('/^GIF8/', $contents)) { |
|
| 1564 | + } elseif (preg_match('/^GIF8/', $contents)) { |
|
| 1536 | 1565 | // 0 string GIF8 GIF image data |
| 1537 | 1566 | //error_log("check_feed_favicon: favicon_url=$favicon_url isa GIF image"); |
| 1538 | - } |
|
| 1539 | - elseif (preg_match('/^\x89PNG\x0d\x0a\x1a\x0a/', $contents)) { |
|
| 1567 | + } elseif (preg_match('/^\x89PNG\x0d\x0a\x1a\x0a/', $contents)) { |
|
| 1540 | 1568 | // 0 string \x89PNG\x0d\x0a\x1a\x0a PNG image data |
| 1541 | 1569 | //error_log("check_feed_favicon: favicon_url=$favicon_url isa PNG image"); |
| 1542 | - } |
|
| 1543 | - elseif (preg_match('/^\xff\xd8/', $contents)) { |
|
| 1570 | + } elseif (preg_match('/^\xff\xd8/', $contents)) { |
|
| 1544 | 1571 | // 0 beshort 0xffd8 JPEG image data |
| 1545 | 1572 | //error_log("check_feed_favicon: favicon_url=$favicon_url isa JPG image"); |
| 1546 | - } |
|
| 1547 | - elseif (preg_match('/^BM/', $contents)) { |
|
| 1573 | + } elseif (preg_match('/^BM/', $contents)) { |
|
| 1548 | 1574 | // 0 string BM PC bitmap (OS2, Windows BMP files) |
| 1549 | 1575 | //error_log("check_feed_favicon, favicon_url=$favicon_url isa BMP image"); |
| 1550 | - } |
|
| 1551 | - else { |
|
| 1576 | + } else { |
|
| 1552 | 1577 | //error_log("check_feed_favicon: favicon_url=$favicon_url isa UNKNOWN type"); |
| 1553 | 1578 | $contents = ""; |
| 1554 | 1579 | } |
@@ -1579,10 +1604,11 @@ discard block |
||
| 1579 | 1604 | $feed_id = (int) $feed_id; |
| 1580 | 1605 | $cat_id = (int)Feeds::getFeedCategory($feed_id); |
| 1581 | 1606 | |
| 1582 | - if ($cat_id == 0) |
|
| 1583 | - $null_cat_qpart = "cat_id IS NULL OR"; |
|
| 1584 | - else |
|
| 1585 | - $null_cat_qpart = ""; |
|
| 1607 | + if ($cat_id == 0) { |
|
| 1608 | + $null_cat_qpart = "cat_id IS NULL OR"; |
|
| 1609 | + } else { |
|
| 1610 | + $null_cat_qpart = ""; |
|
| 1611 | + } |
|
| 1586 | 1612 | |
| 1587 | 1613 | $pdo = Db::pdo(); |
| 1588 | 1614 | |
@@ -1718,8 +1744,9 @@ discard block |
||
| 1718 | 1744 | } |
| 1719 | 1745 | } |
| 1720 | 1746 | |
| 1721 | - if (!$favicon_url) |
|
| 1722 | - $favicon_url = rewrite_relative_url($url, "/favicon.ico"); |
|
| 1747 | + if (!$favicon_url) { |
|
| 1748 | + $favicon_url = rewrite_relative_url($url, "/favicon.ico"); |
|
| 1749 | + } |
|
| 1723 | 1750 | |
| 1724 | 1751 | return $favicon_url; |
| 1725 | 1752 | } |
@@ -7,11 +7,11 @@ discard block |
||
| 7 | 7 | if ($k != "feed" && isset($v)) { |
| 8 | 8 | $x = strip_tags(is_array($v) ? implode(",", $v) : $v); |
| 9 | 9 | |
| 10 | - $tmp .= sha1("$k:" . sha1($x)); |
|
| 10 | + $tmp .= sha1("$k:".sha1($x)); |
|
| 11 | 11 | } |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | - return sha1(implode(",", $pluginhost->get_plugin_names()) . $tmp); |
|
| 14 | + return sha1(implode(",", $pluginhost->get_plugin_names()).$tmp); |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | // Strips utf8mb4 characters (i.e. emoji) for mysql |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | //update_rss_feed($line["id"], true); |
| 138 | 138 | |
| 139 | 139 | if ($tline = $usth->fetch()) { |
| 140 | - Debug::log(" => " . $tline["last_updated"] . ", " . $tline["id"] . " " . $tline["owner_uid"]); |
|
| 140 | + Debug::log(" => ".$tline["last_updated"].", ".$tline["id"]." ".$tline["owner_uid"]); |
|
| 141 | 141 | |
| 142 | 142 | if (array_search($tline["owner_uid"], $batch_owners) === FALSE) |
| 143 | 143 | array_push($batch_owners, $tline["owner_uid"]); |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | |
| 324 | 324 | $date_feed_processed = date('Y-m-d H:i'); |
| 325 | 325 | |
| 326 | - $cache_filename = CACHE_DIR . "/feeds/" . sha1($fetch_url) . ".xml"; |
|
| 326 | + $cache_filename = CACHE_DIR."/feeds/".sha1($fetch_url).".xml"; |
|
| 327 | 327 | |
| 328 | 328 | $pluginhost = new PluginHost(); |
| 329 | 329 | $user_plugins = get_pref("_ENABLED_PLUGINS", $owner_uid); |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | Debug::log("running HOOK_FETCH_FEED handlers...", Debug::$LOG_VERBOSE); |
| 341 | 341 | |
| 342 | 342 | foreach ($pluginhost->get_hooks(PluginHost::HOOK_FETCH_FEED) as $plugin) { |
| 343 | - Debug::log("... " . get_class($plugin), Debug::$LOG_VERBOSE); |
|
| 343 | + Debug::log("... ".get_class($plugin), Debug::$LOG_VERBOSE); |
|
| 344 | 344 | $start = microtime(true); |
| 345 | 345 | $feed_data = $plugin->hook_fetch_feed($feed_data, $fetch_url, $owner_uid, $feed, 0, $auth_login, $auth_pass); |
| 346 | 346 | Debug::log(sprintf("=== %.4f (sec)", microtime(true) - $start), Debug::$LOG_VERBOSE); |
@@ -402,7 +402,7 @@ discard block |
||
| 402 | 402 | $feed_data = trim($feed_data); |
| 403 | 403 | |
| 404 | 404 | Debug::log("fetch done.", Debug::$LOG_VERBOSE); |
| 405 | - Debug::log("source last modified: " . $fetch_last_modified, Debug::$LOG_VERBOSE); |
|
| 405 | + Debug::log("source last modified: ".$fetch_last_modified, Debug::$LOG_VERBOSE); |
|
| 406 | 406 | |
| 407 | 407 | if ($feed_data && $fetch_last_modified != $stored_last_modified) { |
| 408 | 408 | $sth = $pdo->prepare("UPDATE ttrss_feeds SET last_modified = ? WHERE id = ?"); |
@@ -410,7 +410,7 @@ discard block |
||
| 410 | 410 | } |
| 411 | 411 | |
| 412 | 412 | // cache vanilla feed data for re-use |
| 413 | - if ($feed_data && !$auth_pass && !$auth_login && is_writable(CACHE_DIR . "/feeds")) { |
|
| 413 | + if ($feed_data && !$auth_pass && !$auth_login && is_writable(CACHE_DIR."/feeds")) { |
|
| 414 | 414 | $new_rss_hash = sha1($feed_data); |
| 415 | 415 | |
| 416 | 416 | if ($new_rss_hash != $rss_hash) { |
@@ -445,7 +445,7 @@ discard block |
||
| 445 | 445 | $feed_data_checksum = md5($feed_data); |
| 446 | 446 | |
| 447 | 447 | foreach ($pluginhost->get_hooks(PluginHost::HOOK_FEED_FETCHED) as $plugin) { |
| 448 | - Debug::log("... " . get_class($plugin), Debug::$LOG_VERBOSE); |
|
| 448 | + Debug::log("... ".get_class($plugin), Debug::$LOG_VERBOSE); |
|
| 449 | 449 | $start = microtime(true); |
| 450 | 450 | $feed_data = $plugin->hook_feed_fetched($feed_data, $fetch_url, $owner_uid, $feed); |
| 451 | 451 | Debug::log(sprintf("=== %.4f (sec)", microtime(true) - $start), Debug::$LOG_VERBOSE); |
@@ -467,7 +467,7 @@ discard block |
||
| 467 | 467 | // We use local pluginhost here because we need to load different per-user feed plugins |
| 468 | 468 | |
| 469 | 469 | foreach ($pluginhost->get_hooks(PluginHost::HOOK_FEED_PARSED) as $plugin) { |
| 470 | - Debug::log("... " . get_class($plugin), Debug::$LOG_VERBOSE); |
|
| 470 | + Debug::log("... ".get_class($plugin), Debug::$LOG_VERBOSE); |
|
| 471 | 471 | $start = microtime(true); |
| 472 | 472 | $plugin->hook_feed_parsed($rss); |
| 473 | 473 | Debug::log(sprintf("=== %.4f (sec)", microtime(true) - $start), Debug::$LOG_VERBOSE); |
@@ -499,14 +499,14 @@ discard block |
||
| 499 | 499 | $site_url = mb_substr(rewrite_relative_url($fetch_url, clean($rss->get_link())), 0, 245); |
| 500 | 500 | |
| 501 | 501 | Debug::log("site_url: $site_url", Debug::$LOG_VERBOSE); |
| 502 | - Debug::log("feed_title: " . clean($rss->get_title()), Debug::$LOG_VERBOSE); |
|
| 502 | + Debug::log("feed_title: ".clean($rss->get_title()), Debug::$LOG_VERBOSE); |
|
| 503 | 503 | |
| 504 | 504 | if ($favicon_needs_check || $force_refetch) { |
| 505 | 505 | |
| 506 | 506 | /* terrible hack: if we crash on floicon shit here, we won't check |
| 507 | 507 | * the icon avgcolor again (unless the icon got updated) */ |
| 508 | 508 | |
| 509 | - $favicon_file = ICONS_DIR . "/$feed.ico"; |
|
| 509 | + $favicon_file = ICONS_DIR."/$feed.ico"; |
|
| 510 | 510 | $favicon_modified = @filemtime($favicon_file); |
| 511 | 511 | |
| 512 | 512 | Debug::log("checking favicon...", Debug::$LOG_VERBOSE); |
@@ -527,7 +527,7 @@ discard block |
||
| 527 | 527 | |
| 528 | 528 | $favicon_color = calculate_avg_color($favicon_file); |
| 529 | 529 | |
| 530 | - $favicon_colorstring = ",favicon_avg_color = " . $pdo->quote($favicon_color); |
|
| 530 | + $favicon_colorstring = ",favicon_avg_color = ".$pdo->quote($favicon_color); |
|
| 531 | 531 | |
| 532 | 532 | } else if ($favicon_avg_color == 'fail') { |
| 533 | 533 | Debug::log("floicon failed on this file, not trying to recalculate avg color", Debug::$LOG_VERBOSE); |
@@ -546,7 +546,7 @@ discard block |
||
| 546 | 546 | print_r($filters); |
| 547 | 547 | } |
| 548 | 548 | |
| 549 | - Debug::log("" . count($filters) . " filters loaded.", Debug::$LOG_VERBOSE); |
|
| 549 | + Debug::log("".count($filters)." filters loaded.", Debug::$LOG_VERBOSE); |
|
| 550 | 550 | |
| 551 | 551 | $items = $rss->get_items(); |
| 552 | 552 | |
@@ -588,13 +588,13 @@ discard block |
||
| 588 | 588 | |
| 589 | 589 | $entry_guid = "$owner_uid,$entry_guid"; |
| 590 | 590 | |
| 591 | - $entry_guid_hashed = 'SHA1:' . sha1($entry_guid); |
|
| 591 | + $entry_guid_hashed = 'SHA1:'.sha1($entry_guid); |
|
| 592 | 592 | |
| 593 | 593 | Debug::log("guid $entry_guid / $entry_guid_hashed", Debug::$LOG_VERBOSE); |
| 594 | 594 | |
| 595 | - $entry_timestamp = (int)$item->get_date(); |
|
| 595 | + $entry_timestamp = (int) $item->get_date(); |
|
| 596 | 596 | |
| 597 | - Debug::log("orig date: " . $item->get_date(), Debug::$LOG_VERBOSE); |
|
| 597 | + Debug::log("orig date: ".$item->get_date(), Debug::$LOG_VERBOSE); |
|
| 598 | 598 | |
| 599 | 599 | $entry_title = strip_tags($item->get_title()); |
| 600 | 600 | |
@@ -606,7 +606,7 @@ discard block |
||
| 606 | 606 | Debug::log("link $entry_link", Debug::$LOG_VERBOSE); |
| 607 | 607 | Debug::log("language $entry_language", Debug::$LOG_VERBOSE); |
| 608 | 608 | |
| 609 | - if (!$entry_title) $entry_title = date("Y-m-d H:i:s", $entry_timestamp);; |
|
| 609 | + if (!$entry_title) $entry_title = date("Y-m-d H:i:s", $entry_timestamp); ; |
|
| 610 | 610 | |
| 611 | 611 | $entry_content = $item->get_content(); |
| 612 | 612 | if (!$entry_content) $entry_content = $item->get_description(); |
@@ -627,7 +627,7 @@ discard block |
||
| 627 | 627 | Debug::log("looking for tags...", Debug::$LOG_VERBOSE); |
| 628 | 628 | |
| 629 | 629 | $entry_tags = $item->get_categories(); |
| 630 | - Debug::log("tags found: " . join(", ", $entry_tags), Debug::$LOG_VERBOSE); |
|
| 630 | + Debug::log("tags found: ".join(", ", $entry_tags), Debug::$LOG_VERBOSE); |
|
| 631 | 631 | |
| 632 | 632 | Debug::log("done collecting data.", Debug::$LOG_VERBOSE); |
| 633 | 633 | |
@@ -692,14 +692,14 @@ discard block |
||
| 692 | 692 | Debug::log("hash differs, applying plugin filters:", Debug::$LOG_VERBOSE); |
| 693 | 693 | |
| 694 | 694 | foreach ($pluginhost->get_hooks(PluginHost::HOOK_ARTICLE_FILTER) as $plugin) { |
| 695 | - Debug::log("... " . get_class($plugin), Debug::$LOG_VERBOSE); |
|
| 695 | + Debug::log("... ".get_class($plugin), Debug::$LOG_VERBOSE); |
|
| 696 | 696 | |
| 697 | 697 | $start = microtime(true); |
| 698 | 698 | $article = $plugin->hook_article_filter($article); |
| 699 | 699 | |
| 700 | 700 | Debug::log(sprintf("=== %.4f (sec)", microtime(true) - $start), Debug::$LOG_VERBOSE); |
| 701 | 701 | |
| 702 | - $entry_plugin_data .= mb_strtolower(get_class($plugin)) . ","; |
|
| 702 | + $entry_plugin_data .= mb_strtolower(get_class($plugin)).","; |
|
| 703 | 703 | } |
| 704 | 704 | |
| 705 | 705 | if (Debug::get_loglevel() >= 3) { |
@@ -772,7 +772,7 @@ discard block |
||
| 772 | 772 | Debug::log("applying plugin filter actions...", Debug::$LOG_VERBOSE); |
| 773 | 773 | |
| 774 | 774 | foreach ($plugin_filter_names as $pfn) { |
| 775 | - list($pfclass,$pfaction) = explode(":", $pfn["param"]); |
|
| 775 | + list($pfclass, $pfaction) = explode(":", $pfn["param"]); |
|
| 776 | 776 | |
| 777 | 777 | if (isset($plugin_filter_actions[$pfclass])) { |
| 778 | 778 | $plugin = $pluginhost->get_plugin($pfclass); |
@@ -867,7 +867,7 @@ discard block |
||
| 867 | 867 | $entry_current_hash, |
| 868 | 868 | $date_feed_processed, |
| 869 | 869 | $entry_comments, |
| 870 | - (int)$num_comments, |
|
| 870 | + (int) $num_comments, |
|
| 871 | 871 | $entry_plugin_data, |
| 872 | 872 | "$entry_language", |
| 873 | 873 | "$entry_author"]); |
@@ -979,7 +979,7 @@ discard block |
||
| 979 | 979 | ":content" => "$entry_content", |
| 980 | 980 | ":content_hash" => $entry_current_hash, |
| 981 | 981 | ":updated" => $entry_timestamp_fmt, |
| 982 | - ":num_comments" => (int)$num_comments, |
|
| 982 | + ":num_comments" => (int) $num_comments, |
|
| 983 | 983 | ":plugin_data" => $entry_plugin_data, |
| 984 | 984 | ":author" => "$entry_author", |
| 985 | 985 | ":lang" => $entry_language, |
@@ -987,7 +987,7 @@ discard block |
||
| 987 | 987 | |
| 988 | 988 | if (DB_TYPE == "pgsql") { |
| 989 | 989 | $params[":ts_lang"] = $feed_language; |
| 990 | - $params[":ts_content"] = mb_substr(strip_tags($entry_title . " " . $entry_content), 0, 900000); |
|
| 990 | + $params[":ts_content"] = mb_substr(strip_tags($entry_title." ".$entry_content), 0, 900000); |
|
| 991 | 991 | } |
| 992 | 992 | |
| 993 | 993 | $sth->execute($params); |
@@ -1067,7 +1067,7 @@ discard block |
||
| 1067 | 1067 | foreach ($enclosures as $enc) { |
| 1068 | 1068 | $enc_url = $enc[0]; |
| 1069 | 1069 | $enc_type = $enc[1]; |
| 1070 | - $enc_dur = (int)$enc[2]; |
|
| 1070 | + $enc_dur = (int) $enc[2]; |
|
| 1071 | 1071 | $enc_title = $enc[3]; |
| 1072 | 1072 | $enc_width = intval($enc[4]); |
| 1073 | 1073 | $enc_height = intval($enc[5]); |
@@ -1075,7 +1075,7 @@ discard block |
||
| 1075 | 1075 | $esth->execute([$enc_url, $enc_type, $entry_ref_id]); |
| 1076 | 1076 | |
| 1077 | 1077 | if (!$esth->fetch()) { |
| 1078 | - $usth->execute([$enc_url, $enc_type, (string)$enc_title, $enc_dur, $entry_ref_id, $enc_width, $enc_height]); |
|
| 1078 | + $usth->execute([$enc_url, $enc_type, (string) $enc_title, $enc_dur, $entry_ref_id, $enc_width, $enc_height]); |
|
| 1079 | 1079 | } |
| 1080 | 1080 | } |
| 1081 | 1081 | |
@@ -1109,7 +1109,7 @@ discard block |
||
| 1109 | 1109 | $filtered_tags = array_unique($filtered_tags); |
| 1110 | 1110 | |
| 1111 | 1111 | if (Debug::get_loglevel() >= Debug::$LOG_VERBOSE) { |
| 1112 | - Debug::log("filtered tags: " . implode(", ", $filtered_tags), Debug::$LOG_VERBOSE); |
|
| 1112 | + Debug::log("filtered tags: ".implode(", ", $filtered_tags), Debug::$LOG_VERBOSE); |
|
| 1113 | 1113 | |
| 1114 | 1114 | } |
| 1115 | 1115 | |
@@ -1297,11 +1297,11 @@ discard block |
||
| 1297 | 1297 | $num_deleted = 0; |
| 1298 | 1298 | |
| 1299 | 1299 | if (is_writable(LOCK_DIRECTORY)) { |
| 1300 | - $files = glob(LOCK_DIRECTORY . "/*.lock"); |
|
| 1300 | + $files = glob(LOCK_DIRECTORY."/*.lock"); |
|
| 1301 | 1301 | |
| 1302 | 1302 | if ($files) { |
| 1303 | 1303 | foreach ($files as $file) { |
| 1304 | - if (!file_is_locked(basename($file)) && time() - filemtime($file) > 86400*2) { |
|
| 1304 | + if (!file_is_locked(basename($file)) && time() - filemtime($file) > 86400 * 2) { |
|
| 1305 | 1305 | unlink($file); |
| 1306 | 1306 | ++$num_deleted; |
| 1307 | 1307 | } |
@@ -1516,7 +1516,7 @@ discard block |
||
| 1516 | 1516 | public static function check_feed_favicon($site_url, $feed) { |
| 1517 | 1517 | # print "FAVICON [$site_url]: $favicon_url\n"; |
| 1518 | 1518 | |
| 1519 | - $icon_file = ICONS_DIR . "/$feed.ico"; |
|
| 1519 | + $icon_file = ICONS_DIR."/$feed.ico"; |
|
| 1520 | 1520 | |
| 1521 | 1521 | if (!file_exists($icon_file)) { |
| 1522 | 1522 | $favicon_url = RSSUtils::get_favicon_url($site_url); |
@@ -1570,14 +1570,14 @@ discard block |
||
| 1570 | 1570 | |
| 1571 | 1571 | public static function is_gzipped($feed_data) { |
| 1572 | 1572 | return strpos(substr($feed_data, 0, 3), |
| 1573 | - "\x1f" . "\x8b" . "\x08", 0) === 0; |
|
| 1573 | + "\x1f"."\x8b"."\x08", 0) === 0; |
|
| 1574 | 1574 | } |
| 1575 | 1575 | |
| 1576 | 1576 | public static function load_filters($feed_id, $owner_uid) { |
| 1577 | 1577 | $filters = array(); |
| 1578 | 1578 | |
| 1579 | 1579 | $feed_id = (int) $feed_id; |
| 1580 | - $cat_id = (int)Feeds::getFeedCategory($feed_id); |
|
| 1580 | + $cat_id = (int) Feeds::getFeedCategory($feed_id); |
|
| 1581 | 1581 | |
| 1582 | 1582 | if ($cat_id == 0) |
| 1583 | 1583 | $null_cat_qpart = "cat_id IS NULL OR"; |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | time() - $preferred_ts <= 7200 |
| 38 | 38 | ) { |
| 39 | 39 | |
| 40 | - Debug::log("Sending digest for UID:" . $line['id'] . " - " . $line["email"]); |
|
| 40 | + Debug::log("Sending digest for UID:".$line['id']." - ".$line["email"]); |
|
| 41 | 41 | |
| 42 | 42 | $do_catchup = get_pref('DIGEST_CATCHUP', $line['id'], false); |
| 43 | 43 | |
@@ -123,13 +123,13 @@ discard block |
||
| 123 | 123 | |
| 124 | 124 | $sth = $pdo->prepare("SELECT ttrss_entries.title, |
| 125 | 125 | ttrss_feeds.title AS feed_title, |
| 126 | - COALESCE(ttrss_feed_categories.title, '" . __('Uncategorized') . "') AS cat_title, |
|
| 126 | + COALESCE(ttrss_feed_categories.title, '" . __('Uncategorized')."') AS cat_title, |
|
| 127 | 127 | date_updated, |
| 128 | 128 | ttrss_user_entries.ref_id, |
| 129 | 129 | link, |
| 130 | 130 | score, |
| 131 | 131 | content, |
| 132 | - " . SUBSTRING_FOR_DATE . "(last_updated,1,19) AS last_updated |
|
| 132 | + " . SUBSTRING_FOR_DATE."(last_updated,1,19) AS last_updated |
|
| 133 | 133 | FROM |
| 134 | 134 | ttrss_user_entries,ttrss_entries,ttrss_feeds |
| 135 | 135 | LEFT JOIN |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | $user_id); |
| 166 | 166 | |
| 167 | 167 | if (get_pref('ENABLE_FEED_CATS', $user_id)) { |
| 168 | - $line['feed_title'] = $line['cat_title'] . " / " . $line['feed_title']; |
|
| 168 | + $line['feed_title'] = $line['cat_title']." / ".$line['feed_title']; |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | $article_labels = Article::get_article_labels($line["ref_id"], $user_id); |