mirror of
https://git.tt-rss.org/fox/tt-rss.git
synced 2025-11-29 10:01:21 +01:00
use self:: in some places to invoke static methods from the same class
This commit is contained in:
parent
b5710baf34
commit
6811d0bde2
@ -117,10 +117,10 @@ class API extends Handler {
|
|||||||
|
|
||||||
function getFeeds() {
|
function getFeeds() {
|
||||||
$cat_id = clean($_REQUEST["cat_id"]);
|
$cat_id = clean($_REQUEST["cat_id"]);
|
||||||
$unread_only = API::param_to_bool(clean($_REQUEST["unread_only"]));
|
$unread_only = self::param_to_bool(clean($_REQUEST["unread_only"]));
|
||||||
$limit = (int) clean($_REQUEST["limit"]);
|
$limit = (int) clean($_REQUEST["limit"]);
|
||||||
$offset = (int) clean($_REQUEST["offset"]);
|
$offset = (int) clean($_REQUEST["offset"]);
|
||||||
$include_nested = API::param_to_bool(clean($_REQUEST["include_nested"]));
|
$include_nested = self::param_to_bool(clean($_REQUEST["include_nested"]));
|
||||||
|
|
||||||
$feeds = $this->api_get_feeds($cat_id, $unread_only, $limit, $offset, $include_nested);
|
$feeds = $this->api_get_feeds($cat_id, $unread_only, $limit, $offset, $include_nested);
|
||||||
|
|
||||||
@ -128,9 +128,9 @@ class API extends Handler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getCategories() {
|
function getCategories() {
|
||||||
$unread_only = API::param_to_bool(clean($_REQUEST["unread_only"]));
|
$unread_only = self::param_to_bool(clean($_REQUEST["unread_only"]));
|
||||||
$enable_nested = API::param_to_bool(clean($_REQUEST["enable_nested"]));
|
$enable_nested = self::param_to_bool(clean($_REQUEST["enable_nested"]));
|
||||||
$include_empty = API::param_to_bool(clean($_REQUEST['include_empty']));
|
$include_empty = self::param_to_bool(clean($_REQUEST['include_empty']));
|
||||||
|
|
||||||
// TODO do not return empty categories, return Uncategorized and standard virtual cats
|
// TODO do not return empty categories, return Uncategorized and standard virtual cats
|
||||||
|
|
||||||
@ -196,21 +196,21 @@ class API extends Handler {
|
|||||||
|
|
||||||
$offset = (int)clean($_REQUEST["skip"]);
|
$offset = (int)clean($_REQUEST["skip"]);
|
||||||
$filter = clean($_REQUEST["filter"]);
|
$filter = clean($_REQUEST["filter"]);
|
||||||
$is_cat = API::param_to_bool(clean($_REQUEST["is_cat"]));
|
$is_cat = self::param_to_bool(clean($_REQUEST["is_cat"]));
|
||||||
$show_excerpt = API::param_to_bool(clean($_REQUEST["show_excerpt"]));
|
$show_excerpt = self::param_to_bool(clean($_REQUEST["show_excerpt"]));
|
||||||
$show_content = API::param_to_bool(clean($_REQUEST["show_content"]));
|
$show_content = self::param_to_bool(clean($_REQUEST["show_content"]));
|
||||||
/* all_articles, unread, adaptive, marked, updated */
|
/* all_articles, unread, adaptive, marked, updated */
|
||||||
$view_mode = clean($_REQUEST["view_mode"]);
|
$view_mode = clean($_REQUEST["view_mode"]);
|
||||||
$include_attachments = API::param_to_bool(clean($_REQUEST["include_attachments"]));
|
$include_attachments = self::param_to_bool(clean($_REQUEST["include_attachments"]));
|
||||||
$since_id = (int)clean($_REQUEST["since_id"]);
|
$since_id = (int)clean($_REQUEST["since_id"]);
|
||||||
$include_nested = API::param_to_bool(clean($_REQUEST["include_nested"]));
|
$include_nested = self::param_to_bool(clean($_REQUEST["include_nested"]));
|
||||||
$sanitize_content = !isset($_REQUEST["sanitize"]) ||
|
$sanitize_content = !isset($_REQUEST["sanitize"]) ||
|
||||||
API::param_to_bool($_REQUEST["sanitize"]);
|
self::param_to_bool($_REQUEST["sanitize"]);
|
||||||
$force_update = API::param_to_bool(clean($_REQUEST["force_update"]));
|
$force_update = self::param_to_bool(clean($_REQUEST["force_update"]));
|
||||||
$has_sandbox = API::param_to_bool(clean($_REQUEST["has_sandbox"]));
|
$has_sandbox = self::param_to_bool(clean($_REQUEST["has_sandbox"]));
|
||||||
$excerpt_length = (int)clean($_REQUEST["excerpt_length"]);
|
$excerpt_length = (int)clean($_REQUEST["excerpt_length"]);
|
||||||
$check_first_id = (int)clean($_REQUEST["check_first_id"]);
|
$check_first_id = (int)clean($_REQUEST["check_first_id"]);
|
||||||
$include_header = API::param_to_bool(clean($_REQUEST["include_header"]));
|
$include_header = self::param_to_bool(clean($_REQUEST["include_header"]));
|
||||||
|
|
||||||
$_SESSION['hasSandbox'] = $has_sandbox;
|
$_SESSION['hasSandbox'] = $has_sandbox;
|
||||||
|
|
||||||
@ -299,7 +299,7 @@ class API extends Handler {
|
|||||||
|
|
||||||
$article_ids = explode(",", clean($_REQUEST["article_id"]));
|
$article_ids = explode(",", clean($_REQUEST["article_id"]));
|
||||||
$sanitize_content = !isset($_REQUEST["sanitize"]) ||
|
$sanitize_content = !isset($_REQUEST["sanitize"]) ||
|
||||||
API::param_to_bool($_REQUEST["sanitize"]);
|
self::param_to_bool($_REQUEST["sanitize"]);
|
||||||
|
|
||||||
if ($article_ids) {
|
if ($article_ids) {
|
||||||
|
|
||||||
@ -328,9 +328,9 @@ class API extends Handler {
|
|||||||
"title" => $line["title"],
|
"title" => $line["title"],
|
||||||
"link" => $line["link"],
|
"link" => $line["link"],
|
||||||
"labels" => Article::get_article_labels($line['id']),
|
"labels" => Article::get_article_labels($line['id']),
|
||||||
"unread" => API::param_to_bool($line["unread"]),
|
"unread" => self::param_to_bool($line["unread"]),
|
||||||
"marked" => API::param_to_bool($line["marked"]),
|
"marked" => self::param_to_bool($line["marked"]),
|
||||||
"published" => API::param_to_bool($line["published"]),
|
"published" => self::param_to_bool($line["published"]),
|
||||||
"comments" => $line["comments"],
|
"comments" => $line["comments"],
|
||||||
"author" => $line["author"],
|
"author" => $line["author"],
|
||||||
"updated" => (int) strtotime($line["updated"]),
|
"updated" => (int) strtotime($line["updated"]),
|
||||||
@ -345,7 +345,7 @@ class API extends Handler {
|
|||||||
if ($sanitize_content) {
|
if ($sanitize_content) {
|
||||||
$article["content"] = Sanitizer::sanitize(
|
$article["content"] = Sanitizer::sanitize(
|
||||||
$line["content"],
|
$line["content"],
|
||||||
API::param_to_bool($line['hide_images']),
|
self::param_to_bool($line['hide_images']),
|
||||||
false, $line["site_url"], false, $line["id"]);
|
false, $line["site_url"], false, $line["id"]);
|
||||||
} else {
|
} else {
|
||||||
$article["content"] = $line["content"];
|
$article["content"] = $line["content"];
|
||||||
@ -449,7 +449,7 @@ class API extends Handler {
|
|||||||
|
|
||||||
$article_ids = explode(",", clean($_REQUEST["article_ids"]));
|
$article_ids = explode(",", clean($_REQUEST["article_ids"]));
|
||||||
$label_id = (int) clean($_REQUEST['label_id']);
|
$label_id = (int) clean($_REQUEST['label_id']);
|
||||||
$assign = API::param_to_bool(clean($_REQUEST['assign']));
|
$assign = self::param_to_bool(clean($_REQUEST['assign']));
|
||||||
|
|
||||||
$label = Labels::find_caption(Labels::feed_to_label_id($label_id), $_SESSION["uid"]);
|
$label = Labels::find_caption(Labels::feed_to_label_id($label_id), $_SESSION["uid"]);
|
||||||
|
|
||||||
@ -656,7 +656,7 @@ class API extends Handler {
|
|||||||
|
|
||||||
if ($row = $sth->fetch()) {
|
if ($row = $sth->fetch()) {
|
||||||
$last_updated = strtotime($row["last_updated"]);
|
$last_updated = strtotime($row["last_updated"]);
|
||||||
$cache_images = API::param_to_bool($row["cache_images"]);
|
$cache_images = self::param_to_bool($row["cache_images"]);
|
||||||
|
|
||||||
if (!$cache_images && time() - $last_updated > 120) {
|
if (!$cache_images && time() - $last_updated > 120) {
|
||||||
RSSUtils::update_rss_feed($feed_id, true);
|
RSSUtils::update_rss_feed($feed_id, true);
|
||||||
@ -726,9 +726,9 @@ class API extends Handler {
|
|||||||
$headline_row = array(
|
$headline_row = array(
|
||||||
"id" => (int)$line["id"],
|
"id" => (int)$line["id"],
|
||||||
"guid" => $line["guid"],
|
"guid" => $line["guid"],
|
||||||
"unread" => API::param_to_bool($line["unread"]),
|
"unread" => self::param_to_bool($line["unread"]),
|
||||||
"marked" => API::param_to_bool($line["marked"]),
|
"marked" => self::param_to_bool($line["marked"]),
|
||||||
"published" => API::param_to_bool($line["published"]),
|
"published" => self::param_to_bool($line["published"]),
|
||||||
"updated" => (int)strtotime($line["updated"]),
|
"updated" => (int)strtotime($line["updated"]),
|
||||||
"is_updated" => $is_updated,
|
"is_updated" => $is_updated,
|
||||||
"title" => $line["title"],
|
"title" => $line["title"],
|
||||||
@ -750,7 +750,7 @@ class API extends Handler {
|
|||||||
if ($sanitize_content) {
|
if ($sanitize_content) {
|
||||||
$headline_row["content"] = Sanitizer::sanitize(
|
$headline_row["content"] = Sanitizer::sanitize(
|
||||||
$line["content"],
|
$line["content"],
|
||||||
API::param_to_bool($line['hide_images']),
|
self::param_to_bool($line['hide_images']),
|
||||||
false, $line["site_url"], false, $line["id"]);
|
false, $line["site_url"], false, $line["id"]);
|
||||||
} else {
|
} else {
|
||||||
$headline_row["content"] = $line["content"];
|
$headline_row["content"] = $line["content"];
|
||||||
@ -768,7 +768,7 @@ class API extends Handler {
|
|||||||
$headline_row["comments_count"] = (int)$line["num_comments"];
|
$headline_row["comments_count"] = (int)$line["num_comments"];
|
||||||
$headline_row["comments_link"] = $line["comments"];
|
$headline_row["comments_link"] = $line["comments"];
|
||||||
|
|
||||||
$headline_row["always_display_attachments"] = API::param_to_bool($line["always_display_enclosures"]);
|
$headline_row["always_display_attachments"] = self::param_to_bool($line["always_display_enclosures"]);
|
||||||
|
|
||||||
$headline_row["author"] = $line["author"];
|
$headline_row["author"] = $line["author"];
|
||||||
|
|
||||||
@ -827,7 +827,7 @@ class API extends Handler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getFeedTree() {
|
function getFeedTree() {
|
||||||
$include_empty = API::param_to_bool(clean($_REQUEST['include_empty']));
|
$include_empty = self::param_to_bool(clean($_REQUEST['include_empty']));
|
||||||
|
|
||||||
$pf = new Pref_Feeds($_REQUEST);
|
$pf = new Pref_Feeds($_REQUEST);
|
||||||
|
|
||||||
|
|||||||
@ -159,7 +159,7 @@ class Article extends Handler_Protected {
|
|||||||
|
|
||||||
$param = clean($_REQUEST['param']);
|
$param = clean($_REQUEST['param']);
|
||||||
|
|
||||||
$tags = Article::get_article_tags($param);
|
$tags = self::get_article_tags($param);
|
||||||
|
|
||||||
$tags_str = join(", ", $tags);
|
$tags_str = join(", ", $tags);
|
||||||
|
|
||||||
@ -261,7 +261,7 @@ class Article extends Handler_Protected {
|
|||||||
|
|
||||||
$this->pdo->commit();
|
$this->pdo->commit();
|
||||||
|
|
||||||
$tags = Article::get_article_tags($id);
|
$tags = self::get_article_tags($id);
|
||||||
$tags_str = $this->format_tags_string($tags, $id);
|
$tags_str = $this->format_tags_string($tags, $id);
|
||||||
$tags_str_full = join(", ", $tags);
|
$tags_str_full = join(", ", $tags);
|
||||||
|
|
||||||
@ -344,7 +344,7 @@ class Article extends Handler_Protected {
|
|||||||
static function format_article_enclosures($id, $always_display_enclosures,
|
static function format_article_enclosures($id, $always_display_enclosures,
|
||||||
$article_content, $hide_images = false) {
|
$article_content, $hide_images = false) {
|
||||||
|
|
||||||
$result = Article::get_article_enclosures($id);
|
$result = self::get_article_enclosures($id);
|
||||||
$rv = '';
|
$rv = '';
|
||||||
|
|
||||||
foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_FORMAT_ENCLOSURES) as $plugin) {
|
foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_FORMAT_ENCLOSURES) as $plugin) {
|
||||||
|
|||||||
@ -2,12 +2,12 @@
|
|||||||
class Counters {
|
class Counters {
|
||||||
|
|
||||||
static function getAllCounters() {
|
static function getAllCounters() {
|
||||||
$data = Counters::getGlobalCounters();
|
$data = self::getGlobalCounters();
|
||||||
|
|
||||||
$data = array_merge($data, Counters::getVirtCounters());
|
$data = array_merge($data, self::getVirtCounters());
|
||||||
$data = array_merge($data, Counters::getLabelCounters());
|
$data = array_merge($data, self::getLabelCounters());
|
||||||
$data = array_merge($data, Counters::getFeedCounters());
|
$data = array_merge($data, self::getFeedCounters());
|
||||||
$data = array_merge($data, Counters::getCategoryCounters());
|
$data = array_merge($data, self::getCategoryCounters());
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
@ -23,7 +23,7 @@ class Counters {
|
|||||||
$marked = 0;
|
$marked = 0;
|
||||||
|
|
||||||
while ($line = $sth->fetch()) {
|
while ($line = $sth->fetch()) {
|
||||||
list ($tmp_unread, $tmp_marked) = Counters::getCategoryChildrenCounters($line["id"], $owner_uid);
|
list ($tmp_unread, $tmp_marked) = self::getCategoryChildrenCounters($line["id"], $owner_uid);
|
||||||
|
|
||||||
$unread += $tmp_unread + Feeds::getCategoryUnread($line["id"], $owner_uid);
|
$unread += $tmp_unread + Feeds::getCategoryUnread($line["id"], $owner_uid);
|
||||||
$marked += $tmp_marked + Feeds::getCategoryMarked($line["id"], $owner_uid);
|
$marked += $tmp_marked + Feeds::getCategoryMarked($line["id"], $owner_uid);
|
||||||
@ -68,7 +68,7 @@ class Counters {
|
|||||||
|
|
||||||
while ($line = $sth->fetch()) {
|
while ($line = $sth->fetch()) {
|
||||||
if ($line["num_children"] > 0) {
|
if ($line["num_children"] > 0) {
|
||||||
list ($child_counter, $child_marked_counter) = Counters::getCategoryChildrenCounters($line["id"], $_SESSION["uid"]);
|
list ($child_counter, $child_marked_counter) = self::getCategoryChildrenCounters($line["id"], $_SESSION["uid"]);
|
||||||
} else {
|
} else {
|
||||||
$child_counter = 0;
|
$child_counter = 0;
|
||||||
$child_marked_counter = 0;
|
$child_marked_counter = 0;
|
||||||
|
|||||||
@ -11,40 +11,40 @@ class Debug {
|
|||||||
private static $loglevel = 0;
|
private static $loglevel = 0;
|
||||||
|
|
||||||
public static function set_logfile($logfile) {
|
public static function set_logfile($logfile) {
|
||||||
Debug::$logfile = $logfile;
|
self::$logfile = $logfile;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function enabled() {
|
public static function enabled() {
|
||||||
return Debug::$enabled;
|
return self::$enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function set_enabled($enable) {
|
public static function set_enabled($enable) {
|
||||||
Debug::$enabled = $enable;
|
self::$enabled = $enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function set_quiet($quiet) {
|
public static function set_quiet($quiet) {
|
||||||
Debug::$quiet = $quiet;
|
self::$quiet = $quiet;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function set_loglevel($level) {
|
public static function set_loglevel($level) {
|
||||||
Debug::$loglevel = $level;
|
self::$loglevel = $level;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function get_loglevel() {
|
public static function get_loglevel() {
|
||||||
return Debug::$loglevel;
|
return self::$loglevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function log($message, $level = 0) {
|
public static function log($message, $level = 0) {
|
||||||
|
|
||||||
if (!Debug::$enabled || Debug::$loglevel < $level) return false;
|
if (!self::$enabled || self::$loglevel < $level) return false;
|
||||||
|
|
||||||
$ts = strftime("%H:%M:%S", time());
|
$ts = strftime("%H:%M:%S", time());
|
||||||
if (function_exists('posix_getpid')) {
|
if (function_exists('posix_getpid')) {
|
||||||
$ts = "$ts/" . posix_getpid();
|
$ts = "$ts/" . posix_getpid();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Debug::$logfile) {
|
if (self::$logfile) {
|
||||||
$fp = fopen(Debug::$logfile, 'a+');
|
$fp = fopen(self::$logfile, 'a+');
|
||||||
|
|
||||||
if ($fp) {
|
if ($fp) {
|
||||||
$locked = false;
|
$locked = false;
|
||||||
@ -60,7 +60,7 @@ class Debug {
|
|||||||
|
|
||||||
if (!$locked) {
|
if (!$locked) {
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
user_error("Unable to lock debugging log file: " . Debug::$logfile, E_USER_WARNING);
|
user_error("Unable to lock debugging log file: " . self::$logfile, E_USER_WARNING);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -73,14 +73,14 @@ class Debug {
|
|||||||
|
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
|
|
||||||
if (Debug::$quiet)
|
if (self::$quiet)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
user_error("Unable to open debugging log file: " . Debug::$logfile, E_USER_WARNING);
|
user_error("Unable to open debugging log file: " . self::$logfile, E_USER_WARNING);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print "[$ts] $message\n";
|
print "[$ts] $message\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -204,7 +204,7 @@ class Feeds extends Handler_Protected {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$vfeed_group_enabled = get_pref("VFEED_GROUP_BY_FEED") &&
|
$vfeed_group_enabled = get_pref("VFEED_GROUP_BY_FEED") &&
|
||||||
!(in_array($feed, Feeds::NEVER_GROUP_FEEDS) && !$cat_view);
|
!(in_array($feed, self::NEVER_GROUP_FEEDS) && !$cat_view);
|
||||||
|
|
||||||
$result = $qfh_ret[0]; // this could be either a PDO query result or a -1 if first id changed
|
$result = $qfh_ret[0]; // this could be either a PDO query result or a -1 if first id changed
|
||||||
$feed_title = $qfh_ret[1];
|
$feed_title = $qfh_ret[1];
|
||||||
@ -357,7 +357,7 @@ class Feeds extends Handler_Protected {
|
|||||||
|
|
||||||
$line["tags_str"] = Article::format_tags_string($tags, $id);
|
$line["tags_str"] = Article::format_tags_string($tags, $id);
|
||||||
|
|
||||||
if (feeds::feedHasIcon($feed_id)) {
|
if (self::feedHasIcon($feed_id)) {
|
||||||
$line['feed_icon'] = "<img class=\"icon\" src=\"".ICONS_URL."/$feed_id.ico\" alt=\"\">";
|
$line['feed_icon'] = "<img class=\"icon\" src=\"".ICONS_URL."/$feed_id.ico\" alt=\"\">";
|
||||||
} else {
|
} else {
|
||||||
$line['feed_icon'] = "<i class='icon-no-feed material-icons'>rss_feed</i>";
|
$line['feed_icon'] = "<i class='icon-no-feed material-icons'>rss_feed</i>";
|
||||||
@ -529,7 +529,7 @@ class Feeds extends Handler_Protected {
|
|||||||
|
|
||||||
$reply['headlines'] = [];
|
$reply['headlines'] = [];
|
||||||
|
|
||||||
list($override_order, $skip_first_id_check) = Feeds::order_to_override_query($order_by);
|
list($override_order, $skip_first_id_check) = self::order_to_override_query($order_by);
|
||||||
|
|
||||||
$ret = $this->format_headlines_list($feed, $method,
|
$ret = $this->format_headlines_list($feed, $method,
|
||||||
$view_mode, $limit, $cat_view, $offset,
|
$view_mode, $limit, $cat_view, $offset,
|
||||||
@ -851,7 +851,7 @@ class Feeds extends Handler_Protected {
|
|||||||
|
|
||||||
// fall back in case of no plugins
|
// fall back in case of no plugins
|
||||||
if (!$search_qpart) {
|
if (!$search_qpart) {
|
||||||
list($search_qpart, $search_words) = Feeds::search_to_sql($search[0], $search[1]);
|
list($search_qpart, $search_words) = self::search_to_sql($search[0], $search[1]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$search_qpart = "true";
|
$search_qpart = "true";
|
||||||
@ -891,7 +891,7 @@ class Feeds extends Handler_Protected {
|
|||||||
if ($feed >= 0) {
|
if ($feed >= 0) {
|
||||||
|
|
||||||
if ($feed > 0) {
|
if ($feed > 0) {
|
||||||
$children = Feeds::getChildCategories($feed, $owner_uid);
|
$children = self::getChildCategories($feed, $owner_uid);
|
||||||
array_push($children, $feed);
|
array_push($children, $feed);
|
||||||
$children = array_map("intval", $children);
|
$children = array_map("intval", $children);
|
||||||
|
|
||||||
@ -1021,7 +1021,7 @@ class Feeds extends Handler_Protected {
|
|||||||
$match_part = "";
|
$match_part = "";
|
||||||
|
|
||||||
if ($is_cat) {
|
if ($is_cat) {
|
||||||
return Feeds::getCategoryUnread($n_feed, $owner_uid);
|
return self::getCategoryUnread($n_feed, $owner_uid);
|
||||||
} else if ($n_feed == -6) {
|
} else if ($n_feed == -6) {
|
||||||
return 0;
|
return 0;
|
||||||
} else if ($feed != "0" && $n_feed == 0) {
|
} else if ($feed != "0" && $n_feed == 0) {
|
||||||
@ -1067,7 +1067,7 @@ class Feeds extends Handler_Protected {
|
|||||||
|
|
||||||
$label_id = Labels::feed_to_label_id($feed);
|
$label_id = Labels::feed_to_label_id($feed);
|
||||||
|
|
||||||
return Feeds::getLabelUnread($label_id, $owner_uid);
|
return self::getLabelUnread($label_id, $owner_uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($match_part) {
|
if ($match_part) {
|
||||||
@ -1142,8 +1142,8 @@ class Feeds extends Handler_Protected {
|
|||||||
return array("code" => 5, "message" => $fetch_last_error);
|
return array("code" => 5, "message" => $fetch_last_error);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mb_strpos($fetch_last_content_type, "html") !== false && Feeds::is_html($contents)) {
|
if (mb_strpos($fetch_last_content_type, "html") !== false && self::is_html($contents)) {
|
||||||
$feedUrls = Feeds::get_feeds_from_html($url, $contents);
|
$feedUrls = self::get_feeds_from_html($url, $contents);
|
||||||
|
|
||||||
if (count($feedUrls) == 0) {
|
if (count($feedUrls) == 0) {
|
||||||
return array("code" => 3);
|
return array("code" => 3);
|
||||||
@ -1234,7 +1234,7 @@ class Feeds extends Handler_Protected {
|
|||||||
$pdo = Db::pdo();
|
$pdo = Db::pdo();
|
||||||
|
|
||||||
if ($cat) {
|
if ($cat) {
|
||||||
return Feeds::getCategoryTitle($id);
|
return self::getCategoryTitle($id);
|
||||||
} else if ($id == -1) {
|
} else if ($id == -1) {
|
||||||
return __("Starred articles");
|
return __("Starred articles");
|
||||||
} else if ($id == -2) {
|
} else if ($id == -2) {
|
||||||
@ -1346,8 +1346,8 @@ class Feeds extends Handler_Protected {
|
|||||||
$unread = 0;
|
$unread = 0;
|
||||||
|
|
||||||
while ($line = $sth->fetch()) {
|
while ($line = $sth->fetch()) {
|
||||||
$unread += Feeds::getCategoryUnread($line["id"], $owner_uid);
|
$unread += self::getCategoryUnread($line["id"], $owner_uid);
|
||||||
$unread += Feeds::getCategoryChildrenUnread($line["id"], $owner_uid);
|
$unread += self::getCategoryChildrenUnread($line["id"], $owner_uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $unread;
|
return $unread;
|
||||||
@ -1450,7 +1450,7 @@ class Feeds extends Handler_Protected {
|
|||||||
|
|
||||||
// fall back in case of no plugins
|
// fall back in case of no plugins
|
||||||
if (!$search_query_part) {
|
if (!$search_query_part) {
|
||||||
list($search_query_part, $search_words) = Feeds::search_to_sql($search, $search_language);
|
list($search_query_part, $search_words) = self::search_to_sql($search, $search_language);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DB_TYPE == "pgsql") {
|
if (DB_TYPE == "pgsql") {
|
||||||
@ -1488,7 +1488,7 @@ class Feeds extends Handler_Protected {
|
|||||||
$unread = getFeedUnread($feed, $cat_view);
|
$unread = getFeedUnread($feed, $cat_view);
|
||||||
|
|
||||||
if ($cat_view && $feed > 0 && $include_children)
|
if ($cat_view && $feed > 0 && $include_children)
|
||||||
$unread += Feeds::getCategoryChildrenUnread($feed);
|
$unread += self::getCategoryChildrenUnread($feed);
|
||||||
|
|
||||||
if ($unread > 0) {
|
if ($unread > 0) {
|
||||||
$view_query_part = " unread = true AND ";
|
$view_query_part = " unread = true AND ";
|
||||||
@ -1532,7 +1532,7 @@ class Feeds extends Handler_Protected {
|
|||||||
if ($feed > 0) {
|
if ($feed > 0) {
|
||||||
if ($include_children) {
|
if ($include_children) {
|
||||||
# sub-cats
|
# sub-cats
|
||||||
$subcats = Feeds::getChildCategories($feed, $owner_uid);
|
$subcats = self::getChildCategories($feed, $owner_uid);
|
||||||
array_push($subcats, $feed);
|
array_push($subcats, $feed);
|
||||||
$subcats = array_map("intval", $subcats);
|
$subcats = array_map("intval", $subcats);
|
||||||
|
|
||||||
@ -1651,7 +1651,7 @@ class Feeds extends Handler_Protected {
|
|||||||
$feed_title = T_sprintf("Search results: %s", $search);
|
$feed_title = T_sprintf("Search results: %s", $search);
|
||||||
} else {
|
} else {
|
||||||
if ($cat_view) {
|
if ($cat_view) {
|
||||||
$feed_title = Feeds::getCategoryTitle($feed);
|
$feed_title = self::getCategoryTitle($feed);
|
||||||
} else {
|
} else {
|
||||||
if (is_numeric($feed) && $feed > 0) {
|
if (is_numeric($feed) && $feed > 0) {
|
||||||
$ssth = $pdo->prepare("SELECT title,site_url,last_error,last_updated
|
$ssth = $pdo->prepare("SELECT title,site_url,last_error,last_updated
|
||||||
@ -1664,7 +1664,7 @@ class Feeds extends Handler_Protected {
|
|||||||
$last_error = $row["last_error"];
|
$last_error = $row["last_error"];
|
||||||
$last_updated = $row["last_updated"];
|
$last_updated = $row["last_updated"];
|
||||||
} else {
|
} else {
|
||||||
$feed_title = Feeds::getFeedTitle($feed);
|
$feed_title = self::getFeedTitle($feed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1688,7 +1688,7 @@ class Feeds extends Handler_Protected {
|
|||||||
// proper override_order applied above
|
// proper override_order applied above
|
||||||
if ($vfeed_query_part && !$ignore_vfeed_group && get_pref('VFEED_GROUP_BY_FEED', $owner_uid)) {
|
if ($vfeed_query_part && !$ignore_vfeed_group && get_pref('VFEED_GROUP_BY_FEED', $owner_uid)) {
|
||||||
|
|
||||||
if (!(in_array($feed, Feeds::NEVER_GROUP_BY_DATE) && !$cat_view)) {
|
if (!(in_array($feed, self::NEVER_GROUP_BY_DATE) && !$cat_view)) {
|
||||||
$yyiw_desc = $order_by == "date_reverse" ? "" : "desc";
|
$yyiw_desc = $order_by == "date_reverse" ? "" : "desc";
|
||||||
$yyiw_order_qpart = "yyiw $yyiw_desc, ";
|
$yyiw_order_qpart = "yyiw $yyiw_desc, ";
|
||||||
} else {
|
} else {
|
||||||
@ -1869,7 +1869,7 @@ class Feeds extends Handler_Protected {
|
|||||||
|
|
||||||
while ($line = $sth->fetch()) {
|
while ($line = $sth->fetch()) {
|
||||||
array_push($rv, $line["parent_cat"]);
|
array_push($rv, $line["parent_cat"]);
|
||||||
$rv = array_merge($rv, Feeds::getParentCategories($line["parent_cat"], $owner_uid));
|
$rv = array_merge($rv, self::getParentCategories($line["parent_cat"], $owner_uid));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $rv;
|
return $rv;
|
||||||
@ -1886,7 +1886,7 @@ class Feeds extends Handler_Protected {
|
|||||||
|
|
||||||
while ($line = $sth->fetch()) {
|
while ($line = $sth->fetch()) {
|
||||||
array_push($rv, $line["id"]);
|
array_push($rv, $line["id"]);
|
||||||
$rv = array_merge($rv, Feeds::getChildCategories($line["id"], $owner_uid));
|
$rv = array_merge($rv, self::getChildCategories($line["id"], $owner_uid));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $rv;
|
return $rv;
|
||||||
@ -2032,7 +2032,7 @@ class Feeds extends Handler_Protected {
|
|||||||
*/
|
*/
|
||||||
static function purge_feed($feed_id, $purge_interval) {
|
static function purge_feed($feed_id, $purge_interval) {
|
||||||
|
|
||||||
if (!$purge_interval) $purge_interval = Feeds::feed_purge_interval($feed_id);
|
if (!$purge_interval) $purge_interval = self::feed_purge_interval($feed_id);
|
||||||
|
|
||||||
$pdo = Db::pdo();
|
$pdo = Db::pdo();
|
||||||
|
|
||||||
|
|||||||
@ -57,7 +57,7 @@ class Labels
|
|||||||
$pdo = Db::pdo();
|
$pdo = Db::pdo();
|
||||||
|
|
||||||
if ($force)
|
if ($force)
|
||||||
Labels::clear_cache($id);
|
self::clear_cache($id);
|
||||||
|
|
||||||
if (!$labels)
|
if (!$labels)
|
||||||
$labels = Article::get_article_labels($id);
|
$labels = Article::get_article_labels($id);
|
||||||
@ -82,7 +82,7 @@ class Labels
|
|||||||
|
|
||||||
static function remove_article($id, $label, $owner_uid) {
|
static function remove_article($id, $label, $owner_uid) {
|
||||||
|
|
||||||
$label_id = Labels::find_id($label, $owner_uid);
|
$label_id = self::find_id($label, $owner_uid);
|
||||||
|
|
||||||
if (!$label_id) return;
|
if (!$label_id) return;
|
||||||
|
|
||||||
@ -95,12 +95,12 @@ class Labels
|
|||||||
|
|
||||||
$sth->execute([$label_id, $id]);
|
$sth->execute([$label_id, $id]);
|
||||||
|
|
||||||
Labels::clear_cache($id);
|
self::clear_cache($id);
|
||||||
}
|
}
|
||||||
|
|
||||||
static function add_article($id, $label, $owner_uid) {
|
static function add_article($id, $label, $owner_uid) {
|
||||||
|
|
||||||
$label_id = Labels::find_id($label, $owner_uid);
|
$label_id = self::find_id($label, $owner_uid);
|
||||||
|
|
||||||
if (!$label_id) return;
|
if (!$label_id) return;
|
||||||
|
|
||||||
@ -123,7 +123,7 @@ class Labels
|
|||||||
$sth->execute([$label_id, $id]);
|
$sth->execute([$label_id, $id]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Labels::clear_cache($id);
|
self::clear_cache($id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -235,8 +235,8 @@ class PluginHost {
|
|||||||
|
|
||||||
$plugin_api = $plugin->api_version();
|
$plugin_api = $plugin->api_version();
|
||||||
|
|
||||||
if ($plugin_api < PluginHost::API_VERSION) {
|
if ($plugin_api < self::API_VERSION) {
|
||||||
user_error("Plugin $class is not compatible with current API version (need: " . PluginHost::API_VERSION . ", got: $plugin_api)", E_USER_WARNING);
|
user_error("Plugin $class is not compatible with current API version (need: " . self::API_VERSION . ", got: $plugin_api)", E_USER_WARNING);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1151,7 +1151,7 @@ class Pref_Feeds extends Handler_Protected {
|
|||||||
$ids = explode(",", clean($_REQUEST["ids"]));
|
$ids = explode(",", clean($_REQUEST["ids"]));
|
||||||
|
|
||||||
foreach ($ids as $id) {
|
foreach ($ids as $id) {
|
||||||
Pref_Feeds::remove_feed($id, $_SESSION["uid"]);
|
self::remove_feed($id, $_SESSION["uid"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -304,7 +304,7 @@ class Pref_Users extends Handler_Protected {
|
|||||||
|
|
||||||
function resetPass() {
|
function resetPass() {
|
||||||
$uid = clean($_REQUEST["id"]);
|
$uid = clean($_REQUEST["id"]);
|
||||||
Pref_Users::resetUserPassword($uid);
|
self::resetUserPassword($uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
function index() {
|
function index() {
|
||||||
|
|||||||
@ -514,7 +514,7 @@ class RPC extends Handler_Protected {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updaterandomfeed() {
|
function updaterandomfeed() {
|
||||||
RPC::updaterandomfeed_real();
|
self::updaterandomfeed_real();
|
||||||
}
|
}
|
||||||
|
|
||||||
private function markArticlesById($ids, $cmode) {
|
private function markArticlesById($ids, $cmode) {
|
||||||
|
|||||||
@ -154,7 +154,7 @@ class RSSUtils {
|
|||||||
$fstarted = microtime(true);
|
$fstarted = microtime(true);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
RSSUtils::update_rss_feed($tline["id"], true, false);
|
self::update_rss_feed($tline["id"], true, false);
|
||||||
} catch (PDOException $e) {
|
} catch (PDOException $e) {
|
||||||
Logger::get()->log_error(E_USER_NOTICE, $e->getMessage(), $e->getFile(), $e->getLine(), $e->getTraceAsString());
|
Logger::get()->log_error(E_USER_NOTICE, $e->getMessage(), $e->getFile(), $e->getLine(), $e->getTraceAsString());
|
||||||
|
|
||||||
@ -180,7 +180,7 @@ class RSSUtils {
|
|||||||
foreach ($batch_owners as $owner_uid) {
|
foreach ($batch_owners as $owner_uid) {
|
||||||
Debug::log("Running housekeeping tasks for user $owner_uid...");
|
Debug::log("Running housekeeping tasks for user $owner_uid...");
|
||||||
|
|
||||||
RSSUtils::housekeeping_user($owner_uid);
|
self::housekeeping_user($owner_uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send feed digests by email if needed.
|
// Send feed digests by email if needed.
|
||||||
@ -288,7 +288,7 @@ class RSSUtils {
|
|||||||
// this is not optimal currently as it fetches stuff separately TODO: optimize
|
// this is not optimal currently as it fetches stuff separately TODO: optimize
|
||||||
if ($title == "[Unknown]" || !$title || !$site_url) {
|
if ($title == "[Unknown]" || !$title || !$site_url) {
|
||||||
Debug::log("setting basic feed info for $feed [$title, $site_url]...");
|
Debug::log("setting basic feed info for $feed [$title, $site_url]...");
|
||||||
RSSUtils::set_basic_feed_info($feed);
|
self::set_basic_feed_info($feed);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sth = $pdo->prepare("SELECT id,update_interval,auth_login,
|
$sth = $pdo->prepare("SELECT id,update_interval,auth_login,
|
||||||
@ -522,7 +522,7 @@ class RSSUtils {
|
|||||||
|
|
||||||
Debug::log("checking favicon...", Debug::$LOG_VERBOSE);
|
Debug::log("checking favicon...", Debug::$LOG_VERBOSE);
|
||||||
|
|
||||||
RSSUtils::check_feed_favicon($site_url, $feed);
|
self::check_feed_favicon($site_url, $feed);
|
||||||
$favicon_modified_new = @filemtime($favicon_file);
|
$favicon_modified_new = @filemtime($favicon_file);
|
||||||
|
|
||||||
if ($favicon_modified_new > $favicon_modified)
|
if ($favicon_modified_new > $favicon_modified)
|
||||||
@ -551,7 +551,7 @@ class RSSUtils {
|
|||||||
|
|
||||||
Debug::log("loading filters & labels...", Debug::$LOG_VERBOSE);
|
Debug::log("loading filters & labels...", Debug::$LOG_VERBOSE);
|
||||||
|
|
||||||
$filters = RSSUtils::load_filters($feed, $owner_uid);
|
$filters = self::load_filters($feed, $owner_uid);
|
||||||
|
|
||||||
if (Debug::get_loglevel() >= Debug::$LOG_EXTENDED) {
|
if (Debug::get_loglevel() >= Debug::$LOG_EXTENDED) {
|
||||||
print_r($filters);
|
print_r($filters);
|
||||||
@ -590,7 +590,7 @@ class RSSUtils {
|
|||||||
|
|
||||||
$entry_guid = strip_tags($item->get_id());
|
$entry_guid = strip_tags($item->get_id());
|
||||||
if (!$entry_guid) $entry_guid = strip_tags($item->get_link());
|
if (!$entry_guid) $entry_guid = strip_tags($item->get_link());
|
||||||
if (!$entry_guid) $entry_guid = RSSUtils::make_guid_from_title($item->get_title());
|
if (!$entry_guid) $entry_guid = self::make_guid_from_title($item->get_title());
|
||||||
|
|
||||||
if (!$entry_guid) {
|
if (!$entry_guid) {
|
||||||
$pdo->commit();
|
$pdo->commit();
|
||||||
@ -682,7 +682,7 @@ class RSSUtils {
|
|||||||
if (DB_TYPE == "mysql" && MYSQL_CHARSET != "UTF8MB4") {
|
if (DB_TYPE == "mysql" && MYSQL_CHARSET != "UTF8MB4") {
|
||||||
for ($i = 0; $i < count($e_item); $i++) {
|
for ($i = 0; $i < count($e_item); $i++) {
|
||||||
if (is_string($e_item[$i])) {
|
if (is_string($e_item[$i])) {
|
||||||
$e_item[$i] = RSSUtils::strip_utf8mb4($e_item[$i]);
|
$e_item[$i] = self::strip_utf8mb4($e_item[$i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -713,7 +713,7 @@ class RSSUtils {
|
|||||||
);
|
);
|
||||||
|
|
||||||
$entry_plugin_data = "";
|
$entry_plugin_data = "";
|
||||||
$entry_current_hash = RSSUtils::calculate_article_hash($article, $pluginhost);
|
$entry_current_hash = self::calculate_article_hash($article, $pluginhost);
|
||||||
|
|
||||||
Debug::log("article hash: $entry_current_hash [stored=$entry_stored_hash]", Debug::$LOG_VERBOSE);
|
Debug::log("article hash: $entry_current_hash [stored=$entry_stored_hash]", Debug::$LOG_VERBOSE);
|
||||||
|
|
||||||
@ -759,7 +759,7 @@ class RSSUtils {
|
|||||||
foreach ($article as $k => $v) {
|
foreach ($article as $k => $v) {
|
||||||
// i guess we'll have to take the risk of 4byte unicode labels & tags here
|
// i guess we'll have to take the risk of 4byte unicode labels & tags here
|
||||||
if (is_string($article[$k])) {
|
if (is_string($article[$k])) {
|
||||||
$article[$k] = RSSUtils::strip_utf8mb4($v);
|
$article[$k] = self::strip_utf8mb4($v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -769,7 +769,7 @@ class RSSUtils {
|
|||||||
$matched_rules = [];
|
$matched_rules = [];
|
||||||
$matched_filters = [];
|
$matched_filters = [];
|
||||||
|
|
||||||
$article_filters = RSSUtils::get_article_filters($filters, $article["title"],
|
$article_filters = self::get_article_filters($filters, $article["title"],
|
||||||
$article["content"], $article["link"], $article["author"],
|
$article["content"], $article["link"], $article["author"],
|
||||||
$article["tags"], $matched_rules, $matched_filters);
|
$article["tags"], $matched_rules, $matched_filters);
|
||||||
|
|
||||||
@ -809,7 +809,7 @@ class RSSUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$plugin_filter_names = RSSUtils::find_article_filters($article_filters, "plugin");
|
$plugin_filter_names = self::find_article_filters($article_filters, "plugin");
|
||||||
$plugin_filter_actions = $pluginhost->get_filter_actions();
|
$plugin_filter_actions = $pluginhost->get_filter_actions();
|
||||||
|
|
||||||
if (count($plugin_filter_names) > 0) {
|
if (count($plugin_filter_names) > 0) {
|
||||||
@ -870,7 +870,7 @@ class RSSUtils {
|
|||||||
Debug::log("force catchup: $entry_force_catchup", Debug::$LOG_VERBOSE);
|
Debug::log("force catchup: $entry_force_catchup", Debug::$LOG_VERBOSE);
|
||||||
|
|
||||||
if ($cache_images)
|
if ($cache_images)
|
||||||
RSSUtils::cache_media($entry_content, $site_url);
|
self::cache_media($entry_content, $site_url);
|
||||||
|
|
||||||
$csth = $pdo->prepare("SELECT id FROM ttrss_entries
|
$csth = $pdo->prepare("SELECT id FROM ttrss_entries
|
||||||
WHERE guid IN (?, ?, ?)");
|
WHERE guid IN (?, ?, ?)");
|
||||||
@ -931,13 +931,13 @@ class RSSUtils {
|
|||||||
$ref_id = $row['id'];
|
$ref_id = $row['id'];
|
||||||
$entry_ref_id = $ref_id;
|
$entry_ref_id = $ref_id;
|
||||||
|
|
||||||
if (RSSUtils::find_article_filter($article_filters, "filter")) {
|
if (self::find_article_filter($article_filters, "filter")) {
|
||||||
Debug::log("article is filtered out, nothing to do.", Debug::$LOG_VERBOSE);
|
Debug::log("article is filtered out, nothing to do.", Debug::$LOG_VERBOSE);
|
||||||
$pdo->commit();
|
$pdo->commit();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$score = RSSUtils::calculate_article_score($article_filters) + $entry_score_modifier;
|
$score = self::calculate_article_score($article_filters) + $entry_score_modifier;
|
||||||
|
|
||||||
Debug::log("initial score: $score [including plugin modifier: $entry_score_modifier]", Debug::$LOG_VERBOSE);
|
Debug::log("initial score: $score [including plugin modifier: $entry_score_modifier]", Debug::$LOG_VERBOSE);
|
||||||
|
|
||||||
@ -957,7 +957,7 @@ class RSSUtils {
|
|||||||
|
|
||||||
Debug::log("user record not found, creating...", Debug::$LOG_VERBOSE);
|
Debug::log("user record not found, creating...", Debug::$LOG_VERBOSE);
|
||||||
|
|
||||||
if ($score >= -500 && !RSSUtils::find_article_filter($article_filters, 'catchup') && !$entry_force_catchup) {
|
if ($score >= -500 && !self::find_article_filter($article_filters, 'catchup') && !$entry_force_catchup) {
|
||||||
$unread = 1;
|
$unread = 1;
|
||||||
$last_read_qpart = null;
|
$last_read_qpart = null;
|
||||||
} else {
|
} else {
|
||||||
@ -965,13 +965,13 @@ class RSSUtils {
|
|||||||
$last_read_qpart = date("Y-m-d H:i"); // we can't use NOW() here because it gets quoted
|
$last_read_qpart = date("Y-m-d H:i"); // we can't use NOW() here because it gets quoted
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RSSUtils::find_article_filter($article_filters, 'mark') || $score > 1000) {
|
if (self::find_article_filter($article_filters, 'mark') || $score > 1000) {
|
||||||
$marked = 1;
|
$marked = 1;
|
||||||
} else {
|
} else {
|
||||||
$marked = 0;
|
$marked = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RSSUtils::find_article_filter($article_filters, 'publish')) {
|
if (self::find_article_filter($article_filters, 'publish')) {
|
||||||
$published = 1;
|
$published = 1;
|
||||||
} else {
|
} else {
|
||||||
$published = 0;
|
$published = 0;
|
||||||
@ -1044,7 +1044,7 @@ class RSSUtils {
|
|||||||
|
|
||||||
if ($mark_unread_on_update &&
|
if ($mark_unread_on_update &&
|
||||||
!$entry_force_catchup &&
|
!$entry_force_catchup &&
|
||||||
!RSSUtils::find_article_filter($article_filters, 'catchup')) {
|
!self::find_article_filter($article_filters, 'catchup')) {
|
||||||
|
|
||||||
Debug::log("article updated, marking unread as requested.", Debug::$LOG_VERBOSE);
|
Debug::log("article updated, marking unread as requested.", Debug::$LOG_VERBOSE);
|
||||||
|
|
||||||
@ -1064,11 +1064,11 @@ class RSSUtils {
|
|||||||
|
|
||||||
Debug::log("assigning labels [filters]...", Debug::$LOG_VERBOSE);
|
Debug::log("assigning labels [filters]...", Debug::$LOG_VERBOSE);
|
||||||
|
|
||||||
RSSUtils::assign_article_to_label_filters($entry_ref_id, $article_filters,
|
self::assign_article_to_label_filters($entry_ref_id, $article_filters,
|
||||||
$owner_uid, $article_labels);
|
$owner_uid, $article_labels);
|
||||||
|
|
||||||
if ($cache_images)
|
if ($cache_images)
|
||||||
RSSUtils::cache_enclosures($enclosures, $site_url);
|
self::cache_enclosures($enclosures, $site_url);
|
||||||
|
|
||||||
if (Debug::get_loglevel() >= Debug::$LOG_EXTENDED) {
|
if (Debug::get_loglevel() >= Debug::$LOG_EXTENDED) {
|
||||||
Debug::log("article enclosures:", Debug::$LOG_VERBOSE);
|
Debug::log("article enclosures:", Debug::$LOG_VERBOSE);
|
||||||
@ -1281,15 +1281,15 @@ class RSSUtils {
|
|||||||
foreach ($entries as $entry) {
|
foreach ($entries as $entry) {
|
||||||
foreach (array('src', 'poster') as $attr) {
|
foreach (array('src', 'poster') as $attr) {
|
||||||
if ($entry->hasAttribute($attr) && strpos($entry->getAttribute($attr), "data:") !== 0) {
|
if ($entry->hasAttribute($attr) && strpos($entry->getAttribute($attr), "data:") !== 0) {
|
||||||
RSSUtils::cache_media_url($cache, $entry->getAttribute($attr), $site_url);
|
self::cache_media_url($cache, $entry->getAttribute($attr), $site_url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($entry->hasAttribute("srcset")) {
|
if ($entry->hasAttribute("srcset")) {
|
||||||
$matches = RSSUtils::decode_srcset($entry->getAttribute('srcset'));
|
$matches = self::decode_srcset($entry->getAttribute('srcset'));
|
||||||
|
|
||||||
for ($i = 0; $i < count($matches); $i++) {
|
for ($i = 0; $i < count($matches); $i++) {
|
||||||
RSSUtils::cache_media_url($cache, $matches[$i]["url"], $site_url);
|
self::cache_media_url($cache, $matches[$i]["url"], $site_url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1492,7 +1492,7 @@ class RSSUtils {
|
|||||||
static function assign_article_to_label_filters($id, $filters, $owner_uid, $article_labels) {
|
static function assign_article_to_label_filters($id, $filters, $owner_uid, $article_labels) {
|
||||||
foreach ($filters as $f) {
|
foreach ($filters as $f) {
|
||||||
if ($f["type"] == "label") {
|
if ($f["type"] == "label") {
|
||||||
if (!RSSUtils::labels_contains_caption($article_labels, $f["param"])) {
|
if (!self::labels_contains_caption($article_labels, $f["param"])) {
|
||||||
Labels::add_article($id, $f["param"], $owner_uid);
|
Labels::add_article($id, $f["param"], $owner_uid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1523,13 +1523,13 @@ class RSSUtils {
|
|||||||
static function housekeeping_common() {
|
static function housekeeping_common() {
|
||||||
DiskCache::expire();
|
DiskCache::expire();
|
||||||
|
|
||||||
RSSUtils::expire_lock_files();
|
self::expire_lock_files();
|
||||||
RSSUtils::expire_error_log();
|
self::expire_error_log();
|
||||||
RSSUtils::expire_feed_archive();
|
self::expire_feed_archive();
|
||||||
RSSUtils::cleanup_feed_browser();
|
self::cleanup_feed_browser();
|
||||||
|
|
||||||
Article::purge_orphans();
|
Article::purge_orphans();
|
||||||
RSSUtils::cleanup_counters_cache();
|
self::cleanup_counters_cache();
|
||||||
|
|
||||||
PluginHost::getInstance()->run_hooks(PluginHost::HOOK_HOUSE_KEEPING, "hook_house_keeping", "");
|
PluginHost::getInstance()->run_hooks(PluginHost::HOOK_HOUSE_KEEPING, "hook_house_keeping", "");
|
||||||
}
|
}
|
||||||
@ -1540,7 +1540,7 @@ class RSSUtils {
|
|||||||
$icon_file = ICONS_DIR . "/$feed.ico";
|
$icon_file = ICONS_DIR . "/$feed.ico";
|
||||||
|
|
||||||
if (!file_exists($icon_file)) {
|
if (!file_exists($icon_file)) {
|
||||||
$favicon_url = RSSUtils::get_favicon_url($site_url);
|
$favicon_url = self::get_favicon_url($site_url);
|
||||||
|
|
||||||
if ($favicon_url) {
|
if ($favicon_url) {
|
||||||
// Limiting to "image" type misses those served with text/plain
|
// Limiting to "image" type misses those served with text/plain
|
||||||
|
|||||||
@ -124,7 +124,7 @@ class Sanitizer {
|
|||||||
|
|
||||||
$entries = $xpath->query('//iframe');
|
$entries = $xpath->query('//iframe');
|
||||||
foreach ($entries as $entry) {
|
foreach ($entries as $entry) {
|
||||||
if (!Sanitizer::iframe_whitelisted($entry)) {
|
if (!self::iframe_whitelisted($entry)) {
|
||||||
$entry->setAttribute('sandbox', 'allow-scripts');
|
$entry->setAttribute('sandbox', 'allow-scripts');
|
||||||
} else {
|
} else {
|
||||||
if (is_prefix_https()) {
|
if (is_prefix_https()) {
|
||||||
@ -163,7 +163,7 @@ class Sanitizer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$doc->removeChild($doc->firstChild); //remove doctype
|
$doc->removeChild($doc->firstChild); //remove doctype
|
||||||
$doc = Sanitizer::strip_harmful_tags($doc, $allowed_elements, $disallowed_attributes);
|
$doc = self::strip_harmful_tags($doc, $allowed_elements, $disallowed_attributes);
|
||||||
|
|
||||||
$entries = $xpath->query('//iframe');
|
$entries = $xpath->query('//iframe');
|
||||||
foreach ($entries as $entry) {
|
foreach ($entries as $entry) {
|
||||||
|
|||||||
@ -22,10 +22,10 @@ class UrlHelper {
|
|||||||
$rel_parts = parse_url($rel_url);
|
$rel_parts = parse_url($rel_url);
|
||||||
|
|
||||||
if ($rel_parts['host'] && $rel_parts['scheme']) {
|
if ($rel_parts['host'] && $rel_parts['scheme']) {
|
||||||
return UrlHelper::validate($rel_url);
|
return self::validate($rel_url);
|
||||||
} else if (strpos($rel_url, "//") === 0) {
|
} else if (strpos($rel_url, "//") === 0) {
|
||||||
# protocol-relative URL (rare but they exist)
|
# protocol-relative URL (rare but they exist)
|
||||||
return UrlHelper::validate("https:" . $rel_url);
|
return self::validate("https:" . $rel_url);
|
||||||
} else if (strpos($rel_url, "magnet:") === 0) {
|
} else if (strpos($rel_url, "magnet:") === 0) {
|
||||||
# allow magnet links
|
# allow magnet links
|
||||||
return $rel_url;
|
return $rel_url;
|
||||||
@ -41,7 +41,7 @@ class UrlHelper {
|
|||||||
$rel_parts['path'] = str_replace("/./", "/", $rel_parts['path']);
|
$rel_parts['path'] = str_replace("/./", "/", $rel_parts['path']);
|
||||||
$rel_parts['path'] = str_replace("//", "/", $rel_parts['path']);
|
$rel_parts['path'] = str_replace("//", "/", $rel_parts['path']);
|
||||||
|
|
||||||
return UrlHelper::validate(UrlHelper::build_url($rel_parts));
|
return self::validate(self::build_url($rel_parts));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,9 +127,9 @@ class UrlHelper {
|
|||||||
|
|
||||||
foreach($headers as $header) {
|
foreach($headers as $header) {
|
||||||
if (stripos($header, 'Location:') === 0) {
|
if (stripos($header, 'Location:') === 0) {
|
||||||
$url = UrlHelper::rewrite_relative($url, trim(substr($header, strlen('Location:'))));
|
$url = self::rewrite_relative($url, trim(substr($header, strlen('Location:'))));
|
||||||
|
|
||||||
return UrlHelper::resolve_redirects($url, $timeout, $nest + 1);
|
return self::resolve_redirects($url, $timeout, $nest + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -207,7 +207,7 @@ class UrlHelper {
|
|||||||
$url = ltrim($url, ' ');
|
$url = ltrim($url, ' ');
|
||||||
$url = str_replace(' ', '%20', $url);
|
$url = str_replace(' ', '%20', $url);
|
||||||
|
|
||||||
$url = UrlHelper::validate($url, true);
|
$url = self::validate($url, true);
|
||||||
|
|
||||||
if (!$url) {
|
if (!$url) {
|
||||||
$fetch_last_error = "Requested URL failed extended validation.";
|
$fetch_last_error = "Requested URL failed extended validation.";
|
||||||
@ -322,7 +322,7 @@ class UrlHelper {
|
|||||||
|
|
||||||
$fetch_effective_url = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
|
$fetch_effective_url = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
|
||||||
|
|
||||||
if (!UrlHelper::validate($fetch_effective_url, true)) {
|
if (!self::validate($fetch_effective_url, true)) {
|
||||||
$fetch_last_error = "URL received after redirection failed extended validation.";
|
$fetch_last_error = "URL received after redirection failed extended validation.";
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -413,9 +413,9 @@ class UrlHelper {
|
|||||||
|
|
||||||
$old_error = error_get_last();
|
$old_error = error_get_last();
|
||||||
|
|
||||||
$fetch_effective_url = UrlHelper::resolve_redirects($url, $timeout ? $timeout : FILE_FETCH_CONNECT_TIMEOUT);
|
$fetch_effective_url = self::resolve_redirects($url, $timeout ? $timeout : FILE_FETCH_CONNECT_TIMEOUT);
|
||||||
|
|
||||||
if (!UrlHelper::validate($fetch_effective_url, true)) {
|
if (!self::validate($fetch_effective_url, true)) {
|
||||||
$fetch_last_error = "URL received after redirection failed extended validation.";
|
$fetch_last_error = "URL received after redirection failed extended validation.";
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@ -91,18 +91,18 @@ class UserHelper {
|
|||||||
|
|
||||||
if (SINGLE_USER_MODE) {
|
if (SINGLE_USER_MODE) {
|
||||||
@session_start();
|
@session_start();
|
||||||
UserHelper::authenticate("admin", null);
|
self::authenticate("admin", null);
|
||||||
startup_gettext();
|
startup_gettext();
|
||||||
UserHelper::load_user_plugins($_SESSION["uid"]);
|
self::load_user_plugins($_SESSION["uid"]);
|
||||||
} else {
|
} else {
|
||||||
if (!validate_session()) $_SESSION["uid"] = false;
|
if (!validate_session()) $_SESSION["uid"] = false;
|
||||||
|
|
||||||
if (!$_SESSION["uid"]) {
|
if (!$_SESSION["uid"]) {
|
||||||
|
|
||||||
if (AUTH_AUTO_LOGIN && UserHelper::authenticate(null, null)) {
|
if (AUTH_AUTO_LOGIN && self::authenticate(null, null)) {
|
||||||
$_SESSION["ref_schema_version"] = get_schema_version(true);
|
$_SESSION["ref_schema_version"] = get_schema_version(true);
|
||||||
} else {
|
} else {
|
||||||
UserHelper::authenticate(null, null, true);
|
self::authenticate(null, null, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$_SESSION["uid"]) {
|
if (!$_SESSION["uid"]) {
|
||||||
@ -122,7 +122,7 @@ class UserHelper {
|
|||||||
|
|
||||||
if ($_SESSION["uid"]) {
|
if ($_SESSION["uid"]) {
|
||||||
startup_gettext();
|
startup_gettext();
|
||||||
UserHelper::load_user_plugins($_SESSION["uid"]);
|
self::load_user_plugins($_SESSION["uid"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user