$entry_content = $item["content:escaped"];
if (!$entry_content) $entry_content = $item["content:encoded"];
+ if (!$entry_content) $entry_content = $item["content"]["encoded"];
if (!$entry_content) $entry_content = $item["content"];
// Magpie bugs are getting ridiculous
if (!$entry_content) $entry_content = $item["atom_content"];
if (!$entry_content) $entry_content = $item["summary"];
- if (!$entry_content) $entry_content = $item["description"];
+
+ if (!$entry_content ||
+ strlen($entry_content) < strlen($item["description"])) {
+ $entry_content = $item["description"];
+ };
// WTF
if (is_array($entry_content)) {
}
} else {
+ // <enclosure>
+
$e_ctr = $item['enclosure#'];
if ($e_ctr > 0) {
}
}
+ // <media:content>
+ // can there be many of those? -fox
+
+ $m_ctr = $item['media']['content#'];
+
+ if ($m_ctr > 0) {
+ $e_item = array($item['media']['content@url'],
+ $item['media']['content@medium'],
+ $item['media']['content@length']);
+
+ array_push($enclosures, $e_item);
+ }
+
+ // FIXME: parse more of those, if needed.
}
# sanitize content
}
if (find_article_filter($article_filters, "filter")) {
+ db_query($link, "COMMIT"); // close transaction in progress
continue;
}
print "<span $rtl_tag id=\"FEEDN-$feed_id\">$feed</span>";
if ($unread != 0) {
- $fctr_class = "";
+ $fctr_class = "class=\"feedCtrHasUnread\"";
} else {
- $fctr_class = "class=\"invisible\"";
+ $fctr_class = "class=\"feedCtrNoUnread\"";
}
print " <span $rtl_tag $fctr_class id=\"FEEDCTR-$feed_id\">
$pwd_hash2 = encrypt_password($password, $login);
if (defined('ALLOW_REMOTE_USER_AUTH') && ALLOW_REMOTE_USER_AUTH
- && $_SERVER["REMOTE_USER"]) {
+ && $_SERVER["REMOTE_USER"] && $login != "admin") {
$login = db_escape_string($_SERVER["REMOTE_USER"]);
- $query = "SELECT id,login,access_level
+ $query = "SELECT id,login,access_level,pwd_hash
FROM ttrss_users WHERE
login = '$login'";
$_POST["password"] = "";
$_SESSION["language"] = $_POST["language"];
+ $_SESSION["bw_limit"] = !!$_POST["bw_limit"];
header("Location: " . $_SERVER["REQUEST_URI"]);
exit;
/* getting all counters is a resource intensive operation, so we
* rate limit it a little bit */
- if (time() - $_SESSION["get_all_counters_stamp"] > 5) {
+
+
+ if (get_pref($link, "SYNC_COUNTERS") ||
+ time() - $_SESSION["get_all_counters_stamp"] > 5) {
if (!$omode) $omode = "flc";
print "<param key=\"hide_feedlist\" value=\"" .
(int) get_pref($link, "HIDE_FEEDLIST") . "\"/>";
+ print "<param key=\"bw_limit\" value=\"".
+ (int) $_SESSION["bw_limit"]."\"/>";
+
+ print "<param key=\"sync_counters\" value=\"" .
+ (int) get_pref($link, "SYNC_COUNTERS") . "\"/>";
+
print "</init-params>";
}
if (get_pref($link, "STRIP_UNSAFE_TAGS") || $force_strip_tags) {
$res = strip_tags_long($res,
- "<p><a><i><em><b><strong><blockquote><br><img><div><span><ul><ol><li>");
+ "<p><a><i><em><b><strong><code><pre><blockquote><br><img><ul><ol><li>");
// $res = preg_replace("/\r\n|\n|\r/", "", $res);
// $res = strip_tags_long($res, "<p><a><i><em><b><strong><blockquote><br><img><div><span>");
}
+ if (get_pref($link, "STRIP_IMAGES")) {
+
+ $res = preg_replace('/<img[^>]+>/is', '', $res);
+
+ }
+
return $res;
}
} else {
return "New version of Tiny-Tiny RSS ($latest_version) is available:
<div class='milestoneDetails'>$content</div>
- Visit <a target=\"_new\" href=\"http://tt-rss.spb.ru/\">official site</a> for
+ Visit <a target=\"_blank\" href=\"http://tt-rss.spb.ru/\">official site</a> for
download and update information.";
}
$sel_all_link = "javascript:selectTableRowsByIdPrefix('headlinesList', 'RROW-', 'RCHK-', true, '', true)";
$sel_unread_link = "javascript:selectTableRowsByIdPrefix('headlinesList', 'RROW-', 'RCHK-', true, 'Unread', true)";
$sel_none_link = "javascript:selectTableRowsByIdPrefix('headlinesList', 'RROW-', 'RCHK-', false)";
+ $sel_inv_link = "javascript:invertHeadlineSelection()";
$tog_unread_link = "javascript:selectionToggleUnread()";
$tog_marked_link = "javascript:selectionToggleMarked()";
$sel_unread_link = "javascript:cdmSelectArticles('unread')";
$sel_none_link = "javascript:cdmSelectArticles('none')";
+ $sel_inv_link = "javascript:invertHeadlineSelection()";
+
$tog_unread_link = "javascript:selectionToggleUnread(true)";
$tog_marked_link = "javascript:selectionToggleMarked(true)";
$tog_published_link = "javascript:selectionTogglePublished(true)";
".__('Select:')."
<a href=\"$sel_all_link\">".__('All')."</a>,
<a href=\"$sel_unread_link\">".__('Unread')."</a>,
+ <a href=\"$sel_inv_link\">".__('Invert')."</a>,
<a href=\"$sel_none_link\">".__('None')."</a></li>
<li class=\"vsep\"> </li>
<li class=\"top\">".__('Actions...')."<ul>
if ($feed_site_url) {
if (!$bottom) {
- $target = "target=\"_new\"";
+ $target = "target=\"_blank\"";
}
print "<a $target href=\"$feed_site_url\">".
truncate_string($feed_title,30)."</a>";
if (!$bottom && !$disable_feed) {
print "
- <a target=\"_new\"
+ <a target=\"_blank\"
href=\"backend.php?op=rss&id=$feed_id&is_cat=$is_cat$search_q\">
<img class=\"noborder\"
alt=\"".__('Generated feed')."\" src=\"images/feed-icon-12x12.png\">
$catctr_class = ($cat_unread > 0) ? "catCtrHasUnread" : "catCtrNoUnread";
- print "<li class=\"feedCat\" id=\"FCAT-$cat_id\">
- <a id=\"FCATN-$cat_id\" href=\"javascript:toggleCollapseCat($cat_id)\">$tmp_category</a>";
-
if ($can_browse) {
- print "<a href=\"#\" onclick=\"javascript:viewCategory($cat_id)\" id=\"FCAP-$cat_id\">";
+ $browse_cat_link = "onclick=\"javascript:viewCategory($cat_id)\"";
+ $inner_title_class = "catTitle";
} else {
- print "<span id=\"FCAP-$cat_id\">";
+ $browse_cat_link = "";
+ $inner_title_class = "catTitleNL";
}
+ print "<li class=\"feedCat\" id=\"FCAT-$cat_id\">
+ <img onclick=\"toggleCollapseCat($cat_id)\" class=\"catCollapse\"
+ title=\"".__('Click to collapse category')."\"
+ src=\"images/cat-collapse.png\"><span class=\"$inner_title_class\"
+ id=\"FCATN-$cat_id\" $browse_cat_link
+ \">$tmp_category</span>";
+
+ print "<span id=\"FCAP-$cat_id\">";
+
print " <span id=\"FCATCTR-$cat_id\"
class=\"$catctr_class\">($cat_unread)</span> $ellipsis";
- if ($can_browse) {
- print "</a>";
- } else {
- print "</span>";
- }
+ print "</span>";
- print "</li>";
+ //print "</li>";
+
+ print "<ul class=\"feedCatList\" id=\"FCATLIST-$cat_id\" style='$holder_style'>";
- print "<li id=\"feedCatHolder\" class=\"$holder_class\"><ul class=\"feedCatList\" id=\"FCATLIST-$cat_id\" style='$holder_style'>";
}
function outputFeedList($link, $tags = false) {
$cat_hidden = false;
}
-# print "<li class=\"feedCat\">".__('Special')."</li>";
-# print "<li id=\"feedCatHolder\" class=\"feedCatHolder\"><ul class=\"feedCatList\">";
-# print "<li class=\"feedCat\">".
-# "<a id=\"FCATN--1\" href=\"javascript:toggleCollapseCat(-1)\">".
-# __('Special')."</a> <span id='FCAP--1'>$ellipsis</span></li>";
-#
-# print "<li id=\"feedCatHolder\" class=\"feedCatHolder\">
-# <ul class=\"feedCatList\" id='FCATLIST--1' style='$holder_style'>";
-
-# $cat_unread = getCategoryUnread($link, -1);
-# $tmp_category = __("Special");
-# $catctr_class = ($cat_unread > 0) ? "catCtrHasUnread" : "catCtrNoUnread";
-
printCategoryHeader($link, -1, $cat_hidden, false);
}
printCategoryHeader($link, -2, $cat_hidden, false);
-# print "<li class=\"feedCat\">".
-# "<a id=\"FCATN--2\" href=\"javascript:toggleCollapseCat(-2)\">".
-# __('Labels')."</a> <span id='FCAP--2'>$ellipsis</span></li>";
-#
-# print "<li id=\"feedCatHolder\" class=\"feedCatHolder\"><ul class=\"feedCatList\" id='FCATLIST--2' style='$holder_style'>";
} else {
print "<li><hr></li>";
}
if ($category != $tmp_category && get_pref($link, 'ENABLE_FEED_CATS')) {
if ($category) {
- print "</ul></li>";
+ print "</ul>";
}
$category = $tmp_category;
- $collapsed = $line["collapsed"];
+ $collapsed = sql_bool_to_bool($line["collapsed"]);
// workaround for NULL category
if ($category == __("Uncategorized")) {
}
}
- if ($collapsed == "t" || $collapsed == "1") {
- $holder_class = "feedCatHolder";
- $holder_style = "display:none;";
- $ellipsis = "…";
- } else {
- $holder_class = "feedCatHolder";
- $holder_style = "";
- $ellipsis = "";
- }
-
$cat_id = sprintf("%d", $cat_id);
- $cat_unread = getCategoryUnread($link, $cat_id);
-
- $catctr_class = ($cat_unread > 0) ? "catCtrHasUnread" : "catCtrNoUnread";
+ printCategoryHeader($link, $cat_id, $collapsed, true);
- print "<li class=\"feedCat\" id=\"FCAT-$cat_id\">
- <a id=\"FCATN-$cat_id\" href=\"javascript:toggleCollapseCat($cat_id)\">$tmp_category</a>
- <a href=\"#\" onclick=\"javascript:viewCategory($cat_id)\" id=\"FCAP-$cat_id\">
- <span id=\"FCATCTR-$cat_id\"
- class=\"$catctr_class\">($cat_unread)</span> $ellipsis
- </a></li>";
-
- print "<li id=\"feedCatHolder\" class=\"$holder_class\"><ul class=\"feedCatList\" id=\"FCATLIST-$cat_id\" style='$holder_style'>";
}
printFeedEntry($feed_id, $class, $feed, $unread,
if (get_pref($link, 'ENABLE_FEED_CATS')) {
print "<li class=\"feedCat\">".__('Tags')."</li>";
- print "<li id=\"feedCatHolder\"><ul class=\"feedCatList\">";
+ print "<ul class=\"feedCatList\">";
}
$age_qpart = getMaxAgeSubquery();
$link_target = "";
if (get_pref($link, 'OPEN_LINKS_IN_NEW_WINDOW')) {
- $link_target = "target=\"_new\"";
+ $link_target = "target=\"_blank\"";
}
$line = db_fetch_assoc($result);
$line["content"] = sanitize_rss($link, $line["content"]);
if (get_pref($link, 'OPEN_LINKS_IN_NEW_WINDOW')) {
- $line["content"] = preg_replace("/href=/i", "target=\"_new\" href=", $line["content"]);
+ $line["content"] = preg_replace("/href=/i", "target=\"_blank\" href=", $line["content"]);
}
print $line["content"];
$filename = substr($url, strrpos($url, "/")+1);
- $entry = "<a target=\"_blank\" href=\"" . htmlspecialchars($url) . "\">" .
+ $entry = "";
+
+ if (($ctype == __("audio/mpeg")) &&
+ (get_pref($link, "ENABLE_FLASH_PLAYER")) ) {
+
+ $entry .= "<object type=\"application/x-shockwave-flash\" data=\"extras/button/musicplayer.swf?song_url=$url\" width=\"17\" height=\"17\"> <param name=\"movie\" value=\"extras/button/musicplayer.swf?song_url=$url\" /> </object> ";
+
+ }
+
+ $entry .= "<a target=\"_blank\" href=\"" . htmlspecialchars($url) . "\">" .
$filename . " (" . $ctype . ")" . "</a>";
array_push($entries, $entry);
alt=\"Publish article\" onclick='javascript:tPub($id)'>";
}
-# $content_link = "<a target=\"_new\" href=\"".$line["link"]."\">" .
+# $content_link = "<a target=\"_blank\" href=\"".$line["link"]."\">" .
# $line["title"] . "</a>";
- $content_link = "<a href=\"javascript:view($id,$feed_id);\">" .
- $line["title"] . "</a>";
+# $content_link = "<a
+# href=\"" . htmlspecialchars($line["link"]) . "\"
+# onclick=\"view($id,$feed_id);\">" .
+# $line["title"] . "</a>";
# $content_link = "<a href=\"javascript:viewContentUrl('".$line["link"]."');\">" .
# $line["title"] . "</a>";
$entry_author = " - $entry_author";
}
+ $has_feed_icon = is_file(ICONS_DIR . "/$feed_id.ico");
+
+ if ($has_feed_icon) {
+ $feed_icon_img = "<img class=\"tinyFeedIcon\" src=\"".ICONS_URL."/$feed_id.ico\" alt=\"\">";
+ } else {
+ //$feed_icon_img = "<img class=\"tinyFeedIcon\" src=\"images/blank_icon.gif\" alt=\"\">";
+ }
+
if (!get_pref($link, 'COMBINED_DISPLAY_MODE')) {
if (get_pref($link, 'VFEED_GROUP_BY_FEED')) {
$cur_feed_title = htmlspecialchars($cur_feed_title);
- $vf_catchup_link = "(<a onclick='javascript:catchupFeedInGroup($feed_id, \"$cur_feed_title\");' href='#'>mark as read</a>)";
+ $vf_catchup_link = "(<a onclick='javascript:catchupFeedInGroup($feed_id);' href='#'>mark as read</a>)";
print "<tr class='feedTitle'><td colspan='7'>".
+ "<div style=\"float : right\">$feed_icon_img</div>".
"<a href=\"javascript:viewfeed($feed_id, '', false)\">".
- $line["feed_title"]."</a> $vf_catchup_link:</td></tr>";
+ $line["feed_title"]."</a> $vf_catchup_link</td></tr>";
}
}
# truncate_string($line["feed_title"],30)."</a> </td>";
# } else {
- print "<td onclick='javascript:view($id,$feed_id)' class='hlContent$hlc_suffix' valign='middle'>";
+ print "<td onclick='view($id,$feed_id)' class='hlContent$hlc_suffix' valign='middle'>";
- print "<a id=\"RTITLE-$id\" href=\"javascript:view($id,$feed_id);\">" .
+ print "<a id=\"RTITLE-$id\"
+ href=\"" . htmlspecialchars($line["link"]) . "\"
+ onclick=\"return view($id,$feed_id);\">" .
$line["title"];
if (get_pref($link, 'SHOW_CONTENT_PREVIEW')) {
</span>";
}
}
-
-
print "</td>";
-
+
# }
- print "<td class=\"hlUpdated\" onclick='javascript:view($id,$feed_id)'><nobr>$updated_fmt </nobr></td>";
+ print "<td class=\"hlUpdated\" onclick='view($id,$feed_id)'><nobr>$updated_fmt </nobr></td>";
print "<td class='hlMarkedPic'>$score_pic</td>";
-
+
+ if ($line["feed_title"] && !get_pref($link, 'VFEED_GROUP_BY_FEED')) {
+ print "<td onclick=\"viewfeed($feed_id)\" class=\"hlFeedIcon\">$feed_icon_img</td>";
+ }
+
print "</tr>";
} else {
$cur_feed_title = htmlspecialchars($cur_feed_title);
- $vf_catchup_link = "(<a onclick='javascript:catchupFeedInGroup($feed_id, \"$cur_feed_title\");' href='#'>mark as read</a>)";
+ $vf_catchup_link = "(<a onclick='javascript:catchupFeedInGroup($feed_id);' href='#'>mark as read</a>)";
+
+ $has_feed_icon = is_file(ICONS_DIR . "/$feed_id.ico");
+
+ if ($has_feed_icon) {
+ $feed_icon_img = "<img class=\"tinyFeedIcon\" src=\"".ICONS_URL."/$feed_id.ico\" alt=\"\">";
+ } else {
+ //$feed_icon_img = "<img class=\"tinyFeedIcon\" src=\"images/blank_icon.gif\" alt=\"\">";
+ }
print "<div class='cdmFeedTitle'>".
+ "<div style=\"float : right\">$feed_icon_img</div>".
"<a href=\"javascript:viewfeed($feed_id, '', false)\">".
$line["feed_title"]."</a> $vf_catchup_link</div>";
}
}
$expand_cdm = get_pref($link, 'CDM_EXPANDED');
+ $show_excerpt = false;
if ($expand_cdm && $score >= -100) {
$cdm_cstyle = "";
+ $show_excerpt = false;
} else {
$cdm_cstyle = "style=\"display : none\"";
+ $show_excerpt = true;
}
$mouseover_attrs = "onmouseover='postMouseIn($id)'
onmouseout='postMouseOut($id)'";
print "<div class=\"cdmArticle$add_class\"
- id=\"RROW-$id\"
- onclick='cdmClicked(this)'
+ id=\"RROW-$id\"
$mouseover_attrs'>";
print "<div class=\"cdmHeader\">";
- print "<div class=\"articleUpdated\">$updated_fmt $score_pic</div>";
+ if (!get_pref($link, "VFEED_GROUP_BY_FEED") || !$line["feed_title"]) {
+ $cdm_feed_icon = "<span style=\"cursor : pointer\" onclick=\"viewfeed($feed_id)\">$feed_icon_img</span>";
+ }
+
+ print "<div class=\"articleUpdated\">$updated_fmt $score_pic $cdm_feed_icon
+ </div>";
print "<span id=\"RTITLE-$id\" class=\"titleWrap$hlc_suffix\"><a class=\"title\"
onclick=\"javascript:toggleUnread($id, 0)\"
print $entry_author;
- if (!$expand_cdm || $score < -100) {
+/* if (!$expand_cdm || $score < -100) {
print " <a id=\"CICH-$id\"
href=\"javascript:cdmExpandArticle($id)\">
(".__('Show article').")</a>";
- }
+ } */
if (!get_pref($link, 'VFEED_GROUP_BY_FEED')) {
if (get_pref($link, 'OPEN_LINKS_IN_NEW_WINDOW')) {
$line["content_preview"] = preg_replace("/href=/i",
- "target=\"_new\" href=", $line["content_preview"]);
+ "target=\"_blank\" href=", $line["content_preview"]);
}
- print "<div class=\"cdmContent\" id=\"CICD-$id\" $cdm_cstyle>";
+ if ($show_excerpt) {
+ print "<div class=\"cdmExcerpt\" id=\"CEXC-$id\"
+ onclick=\"cdmExpandArticle($id)\"
+ title=\"".__('Click to expand article')."\">";
+ print truncate_string(strip_tags($line["content_preview"]), 100);
+ print "</div>";
+ }
+
+ print "<div class=\"cdmContent\"
+ onclick=\"cdmClicked($id)\"
+ id=\"CICD-$id\" $cdm_cstyle>";
// print "<div class=\"cdmInnerContent\" id=\"CICD-$id\" $cdm_cstyle>";
- print $line["content_preview"];
+ print sanitize_rss($link, $line["content_preview"]);
$e_result = db_query($link, "SELECT * FROM ttrss_enclosures WHERE
post_id = '$id' AND content_url != ''");
$filename = substr($url, strrpos($url, "/")+1);
- $entry = "<a target=\"_blank\" href=\"" . htmlspecialchars($url) . "\">" .
+ $entry = "";
+
+ if (($ctype == __("audio/mpeg")) &&
+ (get_pref($link, "ENABLE_FLASH_PLAYER")) ) {
+
+ $entry .= "<object type=\"application/x-shockwave-flash\" data=\"extras/button/musicplayer.swf?song_url=$url\" width=\"17\" height=\"17\"> <param name=\"movie\" value=\"extras/button/musicplayer.swf?song_url=$url\" /> </object> ";
+
+ }
+
+ $entry .= "<a target=\"_blank\" href=\"" . htmlspecialchars($url) . "\">" .
$filename . " (" . $ctype . ")" . "</a>";
array_push($entries, $entry);
function article_publish_url($link) {
- $url_path = ($_SERVER['HTTPS'] != "on" ? 'http://' : 'https://') . $_SERVER["HTTP_HOST"] . parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH);
+ $url_path = "";
+
+
+ if ($_SERVER['HTTPS'] != "on") {
+ $url_path = "http://";
+ } else {
+ $url_path = "https://";
+ }
- $url_path .= "?op=publish&key=" . get_pref($link, "_PREFS_PUBLISH_KEY");
+ $url_path .= $_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']);
+ $url_path .= "/backend.php?op=publish&key=" . get_pref($link, "_PREFS_PUBLISH_KEY");
return $url_path;
}
}
function get_score_pic($score) {
- if ($score > 0) {
+ if ($score > 100) {
return "score_high.png";
- } else if ($score < 0) {
+ } else if ($score > 0) {
+ return "score_half_high.png";
+ } else if ($score < -100) {
return "score_low.png";
+ } else if ($score < 0) {
+ return "score_half_low.png";
} else {
return "score_neutral.png";
}
print "</table>";
}
+ function print_label_dlg_common_examples() {
+
+ print __("Match ") . " ";
+
+/* print "<select name=\"label_andor\">";
+ print "<option value=\"and\">AND</option>";
+ print "<option value=\"or\">OR</option>";
+ print "</select>"; */
+
+ print "<select name=\"label_fields\" onchange=\"labelFieldsCheck(this)\">";
+ print "<option value=\"unread\">".__("Unread articles")."</option>";
+ print "<option value=\"updated\">".__("Updated articles")."</option>";
+ print "<option value=\"kw_title\">".__("Title contains")."</option>";
+ print "<option value=\"kw_content\">".__("Content contains")."</option>";
+ print "<option value=\"scoreE\">".__("Score equals")."</option>";
+ print "<option value=\"scoreG\">".__("Score is greater than")."</option>";
+ print "<option value=\"scoreL\">".__("Score is less than")."</option>";
+ print "<option value=\"newerH\">".__("Articles newer than X hours")."</option>";
+ print "<option value=\"newerD\">".__("Articles newer than X days")."</option>";
+
+ print "</select>";
+
+ print "<input style=\"display : none\" name=\"label_fields_param\"
+ size=\"10\">";
+
+ print " <input type=\"submit\"
+ onclick=\"return addLabelExample()\"
+ value=\"".__("Add")."\">";
+ }
?>