else
$search = "";
- if ($search) $search_qpart = " AND LOWER(title) LIKE LOWER('%$search%')";
+ if ($search) $search_qpart = " AND (LOWER(title) LIKE LOWER('%$search%') OR LOWER(feed_url) LIKE LOWER('%$search%'))";
// first one is set by API
$show_empty_cats = $_REQUEST['force_show_empty'] ||
$cat['items'] = $this->get_category_items($line['id']);
$num_children = $this->calculate_children_count($cat);
- $cat['param'] = vsprintf(_ngettext('(%d feed)', '(%d feeds)', $num_children), $num_children);
+ $cat['param'] = vsprintf(_ngettext('(%d feed)', '(%d feeds)', (int) $num_children), $num_children);
if ($num_children > 0 || $show_empty_cats)
array_push($items, $cat);
$feed['checkbox'] = false;
$feed['unread'] = 0;
$feed['error'] = $feed_line['last_error'];
- $feed['icon'] = getFeedIcon($feed_line['id']);
+ $feed['icon'] = Feeds::getFeedIcon($feed_line['id']);
$feed['param'] = make_local_datetime(
$feed_line['last_updated'], true);
while ($line = $this->dbh->fetch_assoc($result)) {
- $label_id = label_to_feed_id($line['id']);
+ $label_id = Labels::label_to_feed_id($line['id']);
$feed = $this->feedlist_init_feed($label_id, false, 0);
$cat['items'] = $this->get_category_items($line['id']);
$num_children = $this->calculate_children_count($cat);
- $cat['param'] = vsprintf(_ngettext('(%d feed)', '(%d feeds)', $num_children), $num_children);
+ $cat['param'] = vsprintf(_ngettext('(%d feed)', '(%d feeds)', (int) $num_children), $num_children);
if ($num_children > 0 || $show_empty_cats)
array_push($root['items'], $cat);
$feed['name'] = $feed_line['title'];
$feed['checkbox'] = false;
$feed['error'] = $feed_line['last_error'];
- $feed['icon'] = getFeedIcon($feed_line['id']);
+ $feed['icon'] = Feeds::getFeedIcon($feed_line['id']);
$feed['param'] = make_local_datetime(
$feed_line['last_updated'], true);
$feed['unread'] = 0;
array_push($root['items'], $cat);
$num_children = $this->calculate_children_count($root);
- $root['param'] = vsprintf(_ngettext('(%d feed)', '(%d feeds)', $num_children), $num_children);
+ $root['param'] = vsprintf(_ngettext('(%d feed)', '(%d feeds)', (int) $num_children), $num_children);
} else {
$feed_result = $this->dbh->query("SELECT id, title, last_error,
$feed['name'] = $feed_line['title'];
$feed['checkbox'] = false;
$feed['error'] = $feed_line['last_error'];
- $feed['icon'] = getFeedIcon($feed_line['id']);
+ $feed['icon'] = Feeds::getFeedIcon($feed_line['id']);
$feed['param'] = make_local_datetime(
$feed_line['last_updated'], true);
$feed['unread'] = 0;
if ($_REQUEST['mode'] != 2) {
$fl['items'] = array($root);
} else {
- $fl['items'] =& $root['items'];
+ $fl['items'] = $root['items'];
}
return $fl;
if ($debug) _debug("$prefix C: $item_id P: $parent_id");
- $bare_item_id = substr($item_id, strpos($item_id, ':')+1);
+ $bare_item_id = $this->dbh->escape_string(substr($item_id, strpos($item_id, ':')+1));
if ($item_id != 'root') {
if ($parent_id && $parent_id != 'root') {
if ($cat && is_array($cat)) {
foreach ($cat as $item) {
$id = $item['_reference'];
- $bare_id = substr($id, strpos($id, ':')+1);
+ $bare_id = $this->dbh->escape_string(substr($id, strpos($id, ':')+1));
if ($debug) _debug("$prefix [$order_id] $id/$bare_id");
if (isset($item['items']['_reference'])) {
$data_map[$item['id']] = array($item['items']);
} else {
- $data_map[$item['id']] =& $item['items'];
+ $data_map[$item['id']] = $item['items'];
}
}
if ($item['id'] == 'root') {
$title = htmlspecialchars($this->dbh->fetch_result($result,
0, "title"));
- print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"id\" value=\"$feed_id\">";
- print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pref-feeds\">";
- print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"editSave\">";
+ print_hidden("id", "$feed_id");
+ print_hidden("op", "pref-feeds");
+ print_hidden("method", "editSave");
print "<div class=\"dlgSec\">".__("Feed")."</div>";
print "<div class=\"dlgSecCont\">";
print "<input dojoType=\"dijit.form.TextBox\" id=\"feedEditDlg_login\"
placeHolder=\"".__("Login")."\"
+ autocomplete=\"new-password\"
name=\"auth_login\" value=\"$auth_login\"><hr/>";
$auth_pass = $this->dbh->fetch_result($result, 0, "auth_pass");
- if ($auth_pass_encrypted) {
+ if ($auth_pass_encrypted && function_exists("mcrypt_decrypt")) {
require_once "crypt.php";
$auth_pass = decrypt_string($auth_pass);
}
$auth_pass = htmlspecialchars($auth_pass);
print "<input dojoType=\"dijit.form.TextBox\" type=\"password\" name=\"auth_pass\"
+ autocomplete=\"new-password\"
placeHolder=\"".__("Password")."\"
value=\"$auth_pass\">";
print "<hr/><input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" id=\"cache_images\"
name=\"cache_images\"
$checked> <label for=\"cache_images\">".
- __('Cache images locally')."</label>";
+ __('Cache media')."</label>";
$mark_unread_on_update = sql_bool_to_bool($this->dbh->fetch_result($result, 0, "mark_unread_on_update"));
<button class=\"danger\" dojoType=\"dijit.form.Button\" onclick='return unsubscribeFeed($feed_id, \"$title\")'>".
__('Unsubscribe')."</button>";
- if (PUBSUBHUBBUB_ENABLED) {
- $pubsub_state = $this->dbh->fetch_result($result, 0, "pubsub_state");
- $pubsub_btn_disabled = ($pubsub_state == 2) ? "" : "disabled=\"1\"";
-
- print "<button dojoType=\"dijit.form.Button\" id=\"pubsubReset_Btn\" $pubsub_btn_disabled
- onclick='return resetPubSub($feed_id, \"$title\")'>".__('Resubscribe to push updates').
- "</button>";
- }
-
print "</div>";
- print "<div dojoType=\"dijit.Tooltip\" connectId=\"pubsubReset_Btn\" position=\"below\">".
- __('Resets PubSubHubbub subscription status for push-enabled feeds.')."</div>";
-
print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('feedEditDlg').execute()\">".__('Save')."</button>
<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('feedEditDlg').hide()\">".__('Cancel')."</button>
</div>";
print "<p>";
- print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"ids\" value=\"$feed_ids\">";
- print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pref-feeds\">";
- print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"batchEditSave\">";
+ print_hidden("ids", "$feed_ids");
+ print_hidden("op", "pref-feeds");
+ print_hidden("method", "batchEditSave");
print "<div class=\"dlgSec\">".__("Feed")."</div>";
print "<div class=\"dlgSecCont\">";
print "<input dojoType=\"dijit.form.TextBox\"
placeHolder=\"".__("Login")."\" disabled=\"1\"
+ autocomplete=\"new-password\"
name=\"auth_login\" value=\"\">";
$this->batch_edit_cbox("auth_login");
print "<hr/> <input dojoType=\"dijit.form.TextBox\" type=\"password\" name=\"auth_pass\"
+ autocomplete=\"new-password\"
placeHolder=\"".__("Password")."\" disabled=\"1\"
value=\"\">";
name=\"cache_images\"
dojoType=\"dijit.form.CheckBox\"> <label class='insensitive' id=\"cache_images_l\"
for=\"cache_images\">".
- __('Cache images locally')."</label>";
+ __('Cache media')."</label>";
print " "; $this->batch_edit_cbox("cache_images", "cache_images_l");
$feed_language = $this->dbh->escape_string(trim($_POST["feed_language"]));
- if (strlen(FEED_CRYPT_KEY) > 0) {
- require_once "crypt.php";
- $auth_pass = substr(encrypt_string($auth_pass), 0, 250);
- $auth_pass_encrypted = 'true';
- } else {
- $auth_pass_encrypted = 'false';
- }
-
+ $auth_pass_encrypted = 'false';
$auth_pass = $this->dbh->escape_string($auth_pass);
if (get_pref('ENABLE_FEED_CATS')) {
WHERE id = '$feed_id' AND owner_uid = " . $_SESSION["uid"]);
if ($reset_basic_info) {
- require_once "rssfuncs.php";
-
- set_basic_feed_info($feed_id);
+ RSSUtils::set_basic_feed_info($feed_id);
}
PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_SAVE_FEED,
return;
}
- function resetPubSub() {
-
- $ids = $this->dbh->escape_string($_REQUEST["ids"]);
-
- $this->dbh->query("UPDATE ttrss_feeds SET pubsub_state = 0 WHERE id IN ($ids)
- AND owner_uid = " . $_SESSION["uid"]);
-
- return;
- }
-
function remove() {
$ids = explode(",", $this->dbh->escape_string($_REQUEST["ids"]));
}
function rescore() {
- require_once "rssfuncs.php";
-
$ids = explode(",", $this->dbh->escape_string($_REQUEST["ids"]));
foreach ($ids as $id) {
while ($line = $this->dbh->fetch_assoc($result)) {
- $tags = get_article_tags($line["ref_id"]);
+ $tags = Article::get_article_tags($line["ref_id"]);
- $article_filters = get_article_filters($filters, $line['title'],
+ $article_filters = RSSUtils::get_article_filters($filters, $line['title'],
$line['content'], $line['link'], strtotime($line['updated']),
$line['author'], $tags);
- $new_score = calculate_article_score($article_filters);
+ $new_score = RSSUtils::calculate_article_score($article_filters);
if (!$scores[$new_score]) $scores[$new_score] = array();
while ($line = $this->dbh->fetch_assoc($tmp_result)) {
- $tags = get_article_tags($line["ref_id"]);
+ $tags = Article::get_article_tags($line["ref_id"]);
- $article_filters = get_article_filters($filters, $line['title'],
+ $article_filters = RSSUtils::get_article_filters($filters, $line['title'],
$line['content'], $line['link'], strtotime($line['updated']),
$line['author'], $tags);
- $new_score = calculate_article_score($article_filters);
+ $new_score = RSSUtils::calculate_article_score($article_filters);
if (!$scores[$new_score]) $scores[$new_score] = array();
<div dojoType=\"fox.PrefFeedTree\" id=\"feedTree\"
dndController=\"dijit.tree.dndSource\"
betweenThreshold=\"5\"
+ autoExpand='true'
model=\"feedModel\" openOnClick=\"false\">
<script type=\"dojo/method\" event=\"onClick\" args=\"item\">
var id = String(item.id);
print "<hr>";
+ $opml_export_filename = "TinyTinyRSS_".date("Y-m-d").".opml";
+
print "<p>" . __('Filename:') .
- " <input type=\"text\" id=\"filename\" value=\"TinyTinyRSS.opml\" /> " .
+ " <input type=\"text\" id=\"filename\" value=\"$opml_export_filename\" /> " .
__('Include settings') . "<input type=\"checkbox\" id=\"settings\" checked=\"1\"/>";
print "</p><button dojoType=\"dijit.form.Button\"
print "<button onclick='window.navigator.registerContentHandler(" .
"\"application/vnd.mozilla.maybe.feed\", " .
- "\"" . add_feed_url() . "\", " . " \"Tiny Tiny RSS\")'>" .
+ "\"" . $this->subscribe_to_feed_url() . "\", " . " \"Tiny Tiny RSS\")'>" .
__('Click here to register this site as a feed reader.') .
"</button>";
$cat_id = (int) $cat_id;
if ($cat_id > 0) {
- $cat_unread = ccache_find($cat_id, $_SESSION["uid"], true);
+ $cat_unread = CCache::find($cat_id, $_SESSION["uid"], true);
} else if ($cat_id == 0 || $cat_id == -2) {
- $cat_unread = getCategoryUnread($cat_id);
+ $cat_unread = Feeds::getCategoryUnread($cat_id);
}
$obj['id'] = 'CAT:' . $cat_id;
$obj['items'] = array();
- $obj['name'] = getCategoryTitle($cat_id);
+ $obj['name'] = Feeds::getCategoryTitle($cat_id);
$obj['type'] = 'category';
$obj['unread'] = (int) $cat_unread;
$obj['bare_id'] = $cat_id;
$feed_id = (int) $feed_id;
if (!$title)
- $title = getFeedTitle($feed_id, false);
+ $title = Feeds::getFeedTitle($feed_id, false);
if ($unread === false)
$unread = getFeedUnread($feed_id, false);
$obj['type'] = 'feed';
$obj['error'] = $error;
$obj['updated'] = $updated;
- $obj['icon'] = getFeedIcon($feed_id);
+ $obj['icon'] = Feeds::getFeedIcon($feed_id);
$obj['bare_id'] = $feed_id;
$obj['auxcounter'] = 0;
$result = $this->dbh->query("DELETE FROM ttrss_entries WHERE
(SELECT COUNT(int_id) FROM ttrss_user_entries WHERE ref_id = id) = 0");
- ccache_update($id, $_SESSION['uid']);
+ CCache::update($id, $_SESSION['uid']);
} // function clear_feed_articles
private function remove_feed_category($id, $owner_uid) {
$this->dbh->query("DELETE FROM ttrss_feed_categories
WHERE id = '$id' AND owner_uid = $owner_uid");
- ccache_remove($id, $owner_uid, true);
+ CCache::remove($id, $owner_uid, true);
}
static function remove_feed($id, $owner_uid) {
unlink(ICONS_DIR . "/$id.ico");
}
- ccache_remove($id, $owner_uid);
+ CCache::remove($id, $owner_uid);
} else {
- label_remove(feed_to_label_id($id), $owner_uid);
- //ccache_remove($id, $owner_uid); don't think labels are cached
+ Labels::remove(Labels::feed_to_label_id($id), $owner_uid);
+ //CCache::remove($id, $owner_uid); don't think labels are cached
}
}
function batchSubscribe() {
- print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pref-feeds\">";
- print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"batchaddfeeds\">";
+ print_hidden("op", "pref-feeds");
+ print_hidden("method", "batchaddfeeds");
print "<table width='100%'><tr><td>
".__("Add one valid RSS feed per line (no feed detection is done)")."
" <input
placeHolder=\"".__("Password")."\"
dojoType=\"dijit.form.TextBox\" type='password'
+ autocomplete=\"new-password\"
style=\"width : 10em;\" name='pass'\">".
"</div>";
"SELECT id FROM ttrss_feeds
WHERE feed_url = '$feed' AND owner_uid = ".$_SESSION["uid"]);
- if (strlen(FEED_CRYPT_KEY) > 0) {
- require_once "crypt.php";
- $pass = substr(encrypt_string($pass), 0, 250);
- $auth_pass_encrypted = 'true';
- } else {
- $auth_pass_encrypted = 'false';
- }
-
+ $auth_pass_encrypted = 'false';
$pass = $this->dbh->escape_string($pass);
if ($this->dbh->num_rows($result) == 0) {
print (int) $this->dbh->fetch_result($result, 0, "num_inactive");
}
-}
-?>
+
+ static function subscribe_to_feed_url() {
+ $url_path = get_self_url_prefix() .
+ "/public.php?op=subscribe&feed_url=%s";
+ return $url_path;
+ }
+
+}
\ No newline at end of file