class API extends Handler {
- const API_LEVEL = 12;
+ const API_LEVEL = 14;
const STATUS_OK = 0;
const STATUS_ERR = 1;
$_SESSION['hasSandbox'] = $has_sandbox;
+ $skip_first_id_check = false;
+
$override_order = false;
switch ($_REQUEST["order_by"]) {
case "title":
break;
case "date_reverse":
$override_order = "score DESC, date_entered, updated";
+ $skip_first_id_check = true;
break;
case "feed_dates":
$override_order = "updated DESC";
list($headlines, $headlines_header) = $this->api_get_headlines($feed_id, $limit, $offset,
$filter, $is_cat, $show_excerpt, $show_content, $view_mode, $override_order,
$include_attachments, $since_id, $search,
- $include_nested, $sanitize_content, $force_update, $excerpt_length, $check_first_id);
+ $include_nested, $sanitize_content, $force_update, $excerpt_length, $check_first_id, $skip_first_id_check);
if ($include_header) {
$this->wrap(self::STATUS_OK, array($headlines_header, $headlines));
function getArticle() {
$article_id = join(",", array_filter(explode(",", $this->dbh->escape_string($_REQUEST["article_id"])), is_numeric));
+ $sanitize_content = !isset($_REQUEST["sanitize"]) ||
+ sql_bool_to_bool($_REQUEST["sanitize"]);
if ($article_id) {
- $query = "SELECT id,title,link,content,feed_id,comments,int_id,
+ $query = "SELECT id,guid,title,link,content,feed_id,comments,int_id,
marked,unread,published,score,note,lang,
".SUBSTRING_FOR_DATE."(updated,1,16) as updated,
- author,(SELECT title FROM ttrss_feeds WHERE id = feed_id) AS feed_title
+ author,(SELECT title FROM ttrss_feeds WHERE id = feed_id) AS feed_title,
+ (SELECT site_url FROM ttrss_feeds WHERE id = feed_id) AS site_url,
+ (SELECT hide_images FROM ttrss_feeds WHERE id = feed_id) AS hide_images
FROM ttrss_entries,ttrss_user_entries
WHERE id IN ($article_id) AND ref_id = id AND owner_uid = " .
$_SESSION["uid"] ;
$article = array(
"id" => $line["id"],
+ "guid" => $line["guid"],
"title" => $line["title"],
"link" => $line["link"],
"labels" => get_article_labels($line['id']),
"comments" => $line["comments"],
"author" => $line["author"],
"updated" => (int) strtotime($line["updated"]),
- "content" => $line["content"],
"feed_id" => $line["feed_id"],
"attachments" => $attachments,
"score" => (int)$line["score"],
"lang" => $line["lang"]
);
+ if ($sanitize_content) {
+ $article["content"] = sanitize(
+ $line["content"],
+ sql_bool_to_bool($line['hide_images']),
+ false, $line["site_url"], false, $line["id"]);
+ } else {
+ $article["content"] = $line["content"];
+ }
+
foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_RENDER_ARTICLE_API) as $p) {
$article = $p->hook_render_article_api(array("article" => $article));
}
$feed_id = (int) $this->dbh->escape_string($_REQUEST["feed_id"]);
- update_rss_feed($feed_id, true);
+ if (!ini_get("open_basedir")) {
+ update_rss_feed($feed_id, true);
+ }
$this->wrap(self::STATUS_OK, array("status" => "OK"));
}
$filter, $is_cat, $show_excerpt, $show_content, $view_mode, $order,
$include_attachments, $since_id,
$search = "", $include_nested = false, $sanitize_content = true,
- $force_update = false, $excerpt_length = 100, $check_first_id = false) {
+ $force_update = false, $excerpt_length = 100, $check_first_id = false, $skip_first_id_check = false) {
if ($force_update && $feed_id > 0 && is_numeric($feed_id)) {
// Update the feed if required with some basic flood control
"offset" => $offset,
"since_id" => $since_id,
"include_children" => $include_nested,
- "check_first_id" => $check_first_id
+ "check_first_id" => $check_first_id,
+ "skip_first_id_check" => $skip_first_id_check
);
$qfh_ret = queryFeedHeadlines($params);
$headline_row = array(
"id" => (int)$line["id"],
+ "guid" => $line["guid"],
"unread" => sql_bool_to_bool($line["unread"]),
"marked" => sql_bool_to_bool($line["marked"]),
"published" => sql_bool_to_bool($line["published"]),