define('SELF_USER_AGENT', 'Tiny Tiny RSS/' . VERSION . ' (http://tt-rss.org/)');
define('MAGPIE_USER_AGENT', SELF_USER_AGENT);
+ ini_set('user_agent', SELF_USER_AGENT);
+
require_once "lib/simplepie/simplepie.inc";
require_once "lib/magpierss/rss_fetch.inc";
require_once 'lib/magpierss/rss_utils.inc';
$sel .= " value=\"0\"";
}
- print "<input class=\"noborder\"
+ print "<input class=\"noborder\" dojoType=\"dijit.form.RadioButton\"
type=\"radio\" $sel $attributes name=\"$id\"> $v ";
}
}
if ($theme_path) {
- if (is_file("$t/theme.ini")) {
- $ini = parse_ini_file("$t/theme.ini", true);
- if ($ini['theme']['version'] > THEME_VERSION_REQUIRED) {
+ if (is_file("$theme_path/theme.ini")) {
+ $ini = parse_ini_file("$theme_path/theme.ini", true);
+ if ($ini['theme']['version'] >= THEME_VERSION_REQUIRED) {
return $theme_path;
}
}
return '';
}
+ function print_theme_includes($link) {
+
+ $t = get_user_theme_path($link);
+ $time = time();
+
+ if ($t) {
+ print "<link rel=\"stylesheet\" type=\"text/css\"
+ href=\"$t/theme.css?$time \">";
+ if (file_exists("$t/theme.js")) {
+ print "<script type=\"text/javascript\" src=\"$t/theme.js?$time\">
+ </script>";
+ }
+ }
+ }
function get_all_themes() {
$themes = glob("themes/*");
foreach ($themes as $t) {
if (is_file("$t/theme.ini")) {
$ini = parse_ini_file("$t/theme.ini", true);
- if ($ini['theme']['version'] > THEME_VERSION_REQUIRED &&
+ if ($ini['theme']['version'] >= THEME_VERSION_REQUIRED &&
!$ini['theme']['disabled']) {
$entry = array();
$entry["path"] = $t;
$line["id"], htmlspecialchars($line["title"]));
}
- print "<option value=\"ADD_CAT\">" .__("Add category...") . "</option>";
+# print "<option value=\"ADD_CAT\">" .__("Add category...") . "</option>";
print "</select>";
}
"</option>";
# print "<optgroup label=\"".__("Assign label:")."\">";
- print "<option>----------</option>";
-
- print_labels_headlines_dropdown($link, $feed_id);
+ //print "<option>----------</option>";
+ //print_labels_headlines_dropdown($link, $feed_id);
print "<option>----------</option>";
}
- function outputFeedList($link) {
+ function outputFeedList($link, $special = true) {
$feedlist = array();
/* virtual feeds */
- if ($enable_cats) {
- $cat_hidden = get_pref($link, "_COLLAPSED_SPECIAL");
- $cat = feedlist_init_cat($link, -1, $cat_hidden);
- } else {
- $cat['items'] = array();
- }
-
- foreach (array(-4, -3, -1, -2, 0) as $i) {
- array_push($cat['items'], feedlist_init_feed($link, $i));
- }
+ if ($special) {
- if ($enable_cats) {
- array_push($feedlist['items'], $cat);
- } else {
- $feedlist['items'] = array_merge($feedlist['items'], $cat['items']);
- }
-
- $result = db_query($link, "SELECT * FROM
- ttrss_labels2 WHERE owner_uid = '$owner_uid' ORDER by caption");
+ if ($enable_cats) {
+ $cat_hidden = get_pref($link, "_COLLAPSED_SPECIAL");
+ $cat = feedlist_init_cat($link, -1, $cat_hidden);
+ } else {
+ $cat['items'] = array();
+ }
- if (get_pref($link, 'ENABLE_FEED_CATS')) {
- $cat_hidden = get_pref($link, "_COLLAPSED_LABELS");
- $cat = feedlist_init_cat($link, -2, $cat_hidden);
- } else {
- $cat['items'] = array();
- }
-
- while ($line = db_fetch_assoc($result)) {
-
- $label_id = -$line['id'] - 11;
- $count = getFeedUnread($link, $label_id);
-
- array_push($cat['items'], feedlist_init_feed($link, $label_id,
- false, $count));
- }
+ foreach (array(-4, -3, -1, -2, 0) as $i) {
+ array_push($cat['items'], feedlist_init_feed($link, $i));
+ }
+
+ if ($enable_cats) {
+ array_push($feedlist['items'], $cat);
+ } else {
+ $feedlist['items'] = array_merge($feedlist['items'], $cat['items']);
+ }
+
+ $result = db_query($link, "SELECT * FROM
+ ttrss_labels2 WHERE owner_uid = '$owner_uid' ORDER by caption");
+
+ if (get_pref($link, 'ENABLE_FEED_CATS')) {
+ $cat_hidden = get_pref($link, "_COLLAPSED_LABELS");
+ $cat = feedlist_init_cat($link, -2, $cat_hidden);
+ } else {
+ $cat['items'] = array();
+ }
- if ($enable_cats) {
- array_push($feedlist['items'], $cat);
- } else {
- $feedlist['items'] = array_merge($feedlist['items'], $cat['items']);
+ while ($line = db_fetch_assoc($result)) {
+
+ $label_id = -$line['id'] - 11;
+ $count = getFeedUnread($link, $label_id);
+
+ array_push($cat['items'], feedlist_init_feed($link, $label_id,
+ false, $count));
+ }
+
+ if ($enable_cats) {
+ array_push($feedlist['items'], $cat);
+ } else {
+ $feedlist['items'] = array_merge($feedlist['items'], $cat['items']);
+ }
}
/* if (get_pref($link, 'ENABLE_FEED_CATS')) {
}
} */
+ /* real feeds */
+
if ($enable_cats)
- $order_by_qpart = "order_id,category,title";
+ $order_by_qpart = "ttrss_feed_categories.order_id,category,
+ ttrss_feeds.order_id,title";
else
$order_by_qpart = "title";
$actid = $_REQUEST["actid"];
- /* real feeds */
-
- $category = "";
-
- if (!$enable_cats)
- $cat['items'] = array();
- else
- $cat = false;
+ if (db_num_rows($result) > 0) {
- while ($line = db_fetch_assoc($result)) {
+ $category = "";
+
+ if (!$enable_cats)
+ $cat['items'] = array();
+ else
+ $cat = false;
+
+ while ($line = db_fetch_assoc($result)) {
+
+ $feed = htmlspecialchars(trim($line["title"]));
+
+ if (!$feed) $feed = "[Untitled]";
+
+ $feed_id = $line["id"];
+ $unread = $line["unread"];
+
+ $cat_id = $line["cat_id"];
+ $tmp_category = $line["category"];
+ if (!$tmp_category) $tmp_category = __("Uncategorized");
+
+ if ($category != $tmp_category && $enable_cats) {
- $feed = htmlspecialchars(trim($line["title"]));
-
- if (!$feed) $feed = "[Untitled]";
-
- $feed_id = $line["id"];
- $unread = $line["unread"];
-
- $cat_id = $line["cat_id"];
- $tmp_category = $line["category"];
- if (!$tmp_category) $tmp_category = __("Uncategorized");
-
- if ($category != $tmp_category && $enable_cats) {
+ $category = $tmp_category;
- $category = $tmp_category;
-
- $collapsed = sql_bool_to_bool($line["collapsed"]);
-
- // workaround for NULL category
- if ($category == __("Uncategorized")) {
- $collapsed = get_pref($link, "_COLLAPSED_UNCAT");
+ $collapsed = sql_bool_to_bool($line["collapsed"]);
+
+ // workaround for NULL category
+ if ($category == __("Uncategorized")) {
+ $collapsed = get_pref($link, "_COLLAPSED_UNCAT");
+ }
+
+ if ($cat) array_push($feedlist['items'], $cat);
+
+ $cat = feedlist_init_cat($link, $cat_id, $collapsed);
}
-
- if ($cat) array_push($feedlist['items'], $cat);
-
- $cat = feedlist_init_cat($link, $cat_id, $collapsed);
+
+ $updated = make_local_datetime($link, $line["updated_noms"], false);
+
+ array_push($cat['items'], feedlist_init_feed($link, $feed_id,
+ $feed, $unread, $line['last_error'], $updated));
+ }
+
+ if ($enable_cats) {
+ array_push($feedlist['items'], $cat);
+ } else {
+ $feedlist['items'] = array_merge($feedlist['items'], $cat['items']);
}
- $updated = make_local_datetime($link, $line["updated_noms"], false);
-
- array_push($cat['items'], feedlist_init_feed($link, $feed_id,
- $feed, $unread, $line['last_error'], $updated));
- }
-
- if ($enable_cats) {
- array_push($feedlist['items'], $cat);
- } else {
- $feedlist['items'] = array_merge($feedlist['items'], $cat['items']);
}
return $feedlist;
truncate_string(strip_tags($line['title']), 15) . "</div>";
print "<div class=\"postReply\" id=\"POST-$id\">";
- print "<div class=\"postHeader\">";
+
+ print "<div dojoType=\"dijit.Menu\" style=\"display: none;\"
+ targetNodeIds=\"POSTHDR-$id\">";
+ print "<div onclick=\"postOpenInNewTab(event, $id)\"
+ dojoType=\"dijit.MenuItem\">".__('View in a new tab')."</div>";
+ print "<div dojoType=\"dijit.MenuSeparator\"></div>";
+ print "<div onclick=\"openArticleInNewWindow($id)\"
+ dojoType=\"dijit.MenuItem\">".__('Open original article')."</div>";
+ print "</div>";
+
+ print "<div onclick=\"return postClicked(event, $id)\"
+ class=\"postHeader\" id=\"POSTHDR-$id\">";
$entry_author = $line["author"];
print "<div class=\"postDate$rtl_class\">$parsed_updated</div>";
if ($line["link"]) {
- print "<div clear='both'><a target='_blank' href=\"" . $line["link"] . "\">" .
- $line["title"] . "</a><span class='author'>$entry_author</span></div>";
+ print "<div clear='both'><a target='_blank' href=\"" .
+ $line["link"] . "\">" .
+ $line["title"] . "<span class='author'>$entry_author</span></a></div>";
} else {
print "<div clear='both'>" . $line["title"] . "$entry_author</div>";
}
print "<img src=\"".theme_image($link, 'images/art-zoom.png')."\"
class='tagsPic' style=\"cursor : pointer\"
- onclick=\"zoomToArticle($id)\"
+ onclick=\"postOpenInNewTab(event, $id)\"
alt='Zoom' title='".__('Open article in new tab')."'>";
$note_escaped = htmlspecialchars($line['note'], ENT_QUOTES);
print "</div>";
+
+
print "<div class=\"hlRight\">";
print "<span class=\"hlUpdated\">$updated_fmt</span>";
print $score_pic;
onclick=\"return cdmClicked(event, $id);\"
class=\"titleWrap$hlc_suffix\">
<a class=\"title\"
- target=\"_blank\" href=\"".$line["link"]."\">".$line["title"]."</a>
- $entry_author";
+ target=\"_blank\" href=\"".$line["link"]."\">".$line["title"].
+ " $entry_author</a>";
print $labels_str;
print "<div style=\"float : right\">";
print "<img src=\"images/art-zoom.png\"
- onclick=\"zoomToArticle($id)\"
+ onclick=\"zoomToArticle(event, $id)\"
style=\"cursor : pointer\"
alt='Zoom'
title='".__('Open article in new tab')."'>";
return true;
}
- function print_label_select($link, $name, $value, $style = "") {
+ function print_label_select($link, $name, $value, $attributes = "") {
$result = db_query($link, "SELECT caption FROM ttrss_labels2
WHERE owner_uid = '".$_SESSION["uid"]."' ORDER BY caption");
print "<select default=\"$value\" name=\"" . htmlspecialchars($name) .
- "\" style=\"$style\" onchange=\"labelSelectOnChange(this)\" >";
+ "\" $attributes onchange=\"labelSelectOnChange(this)\" >";
while ($line = db_fetch_assoc($result)) {
$issel = ($line["caption"] == $value) ? "selected=\"1\"" : "";
- print "<option $issel>" . htmlspecialchars($line["caption"]) . "</option>";
+ print "<option value=\"".htmlspecialchars($line["caption"])."\"
+ $issel>" . htmlspecialchars($line["caption"]) . "</option>";
}
- print "<option value=\"ADD_LABEL\">" .__("Add label...") . "</option>";
+# print "<option value=\"ADD_LABEL\">" .__("Add label...") . "</option>";
print "</select>";
$cat_unread = getCategoryUnread($link, $cat_id);
}
- $obj['id'] = 'CAT:' . ((int)$cat_id);
+ $obj['id'] = 'CAT:' . $cat_id;
$obj['items'] = array();
$obj['name'] = getCategoryTitle($link, $cat_id);
$obj['type'] = 'feed';
$obj['unread'] = (int) $cat_unread;
$obj['hidden'] = $hidden;
+ $obj['bare_id'] = $cat_id;
return $obj;
}
function feedlist_init_feed($link, $feed_id, $title = false, $unread = false, $error = '', $updated = '') {
$obj = array();
+ $feed_id = (int) $feed_id;
if (!$title)
$title = getFeedTitle($link, $feed_id, false);
- if (!$unread)
+ if ($unread === false)
$unread = getFeedUnread($link, $feed_id, false);
$obj['id'] = 'FEED:' . $feed_id;
$obj['error'] = $error;
$obj['updated'] = $updated;
$obj['icon'] = getFeedIcon($feed_id);
+ $obj['bare_id'] = $feed_id;
return $obj;
}