summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
Diffstat (limited to 'classes')
-rwxr-xr-xclasses/article.php35
-rw-r--r--classes/db/prefs.php4
-rw-r--r--classes/feedparser.php58
-rwxr-xr-xclasses/feeds.php97
-rwxr-xr-xclasses/logger/sql.php5
-rwxr-xr-xclasses/pluginhost.php1
-rwxr-xr-xclasses/pref/feeds.php71
-rwxr-xr-xclasses/pref/filters.php28
-rw-r--r--classes/pref/labels.php4
-rw-r--r--classes/pref/prefs.php22
-rw-r--r--classes/pref/users.php8
-rwxr-xr-xclasses/rssutils.php11
12 files changed, 187 insertions, 157 deletions
diff --git a/classes/article.php b/classes/article.php
index ff83143d6..c23a1b820 100755
--- a/classes/article.php
+++ b/classes/article.php
@@ -100,15 +100,12 @@ class Article extends Handler_Protected {
$pluginhost->load_all(PluginHost::KIND_ALL, $owner_uid);
$pluginhost->load_data();
- $af_readability = $pluginhost->get_plugin("Af_Readability");
+ foreach ($pluginhost->get_hooks(PluginHost::HOOK_GET_FULL_TEXT) as $p) {
+ $extracted_content = $p->hook_get_full_text($url);
- if ($af_readability) {
- $enable_share_anything = $pluginhost->get($af_readability, "enable_share_anything");
-
- if ($enable_share_anything) {
- $extracted_content = $af_readability->extract_content($url);
-
- if ($extracted_content) $content = $extracted_content;
+ if ($extracted_content) {
+ $content = $extracted_content;
+ break;
}
}
}
@@ -151,6 +148,16 @@ class Article extends Handler_Protected {
content = ?, content_hash = ? WHERE id = ?");
$sth->execute([$content, $content_hash, $ref_id]);
+ if (DB_TYPE == "pgsql"){
+ $sth = $pdo->prepare("UPDATE ttrss_entries
+ SET tsvector_combined = to_tsvector( :ts_content)
+ WHERE id = :id");
+ $params = [
+ ":ts_content" => mb_substr(strip_tags($content ), 0, 900000),
+ ":id" => $ref_id];
+ $sth->execute($params);
+ }
+
$sth = $pdo->prepare("UPDATE ttrss_user_entries SET published = true,
last_published = NOW() WHERE
int_id = ? AND owner_uid = ?");
@@ -186,7 +193,15 @@ class Article extends Handler_Protected {
if ($row = $sth->fetch()) {
$ref_id = $row["id"];
-
+ if (DB_TYPE == "pgsql"){
+ $sth = $pdo->prepare("UPDATE ttrss_entries
+ SET tsvector_combined = to_tsvector( :ts_content)
+ WHERE id = :id");
+ $params = [
+ ":ts_content" => mb_substr(strip_tags($content ), 0, 900000),
+ ":id" => $ref_id];
+ $sth->execute($params);
+ }
$sth = $pdo->prepare("INSERT INTO ttrss_user_entries
(ref_id, uuid, feed_id, orig_feed_id, owner_uid, published, tag_cache, label_cache,
last_read, note, unread, last_published)
@@ -516,7 +531,7 @@ class Article extends Handler_Protected {
$rv .= "<br clear='both'/>";
}
- $rv .= "<div class=\"attachments\" dojoType=\"dijit.form.DropDownButton\">".
+ $rv .= "<div class=\"attachments\" dojoType=\"fox.form.DropDownButton\">".
"<span>" . __('Attachments')."</span>";
$rv .= "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
diff --git a/classes/db/prefs.php b/classes/db/prefs.php
index 1fddd27c5..fbe7e0eea 100644
--- a/classes/db/prefs.php
+++ b/classes/db/prefs.php
@@ -90,8 +90,10 @@ class Db_Prefs {
return $this->convert($value, $type_name);
+ } else if ($die_on_error) {
+ user_error("Fatal error, unknown preferences key: $pref_name (owner: $user_id)", E_USER_ERROR);
+ return null;
} else {
- user_error("Fatal error, unknown preferences key: $pref_name (owner: $user_id)", $die_on_error ? E_USER_ERROR : E_USER_WARNING);
return null;
}
}
diff --git a/classes/feedparser.php b/classes/feedparser.php
index dc67e204e..9677164d3 100644
--- a/classes/feedparser.php
+++ b/classes/feedparser.php
@@ -13,20 +13,6 @@ class FeedParser {
const FEED_RSS = 1;
const FEED_ATOM = 2;
- function normalize_encoding($data) {
- if (preg_match('/^(<\?xml[\t\n\r ].*?encoding[\t\n\r ]*=[\t\n\r ]*["\'])(.+?)(["\'].*?\?>)/s', $data, $matches) === 1) {
-
- $encoding = strtolower($matches[2]);
-
- if (in_array($encoding, array_map('strtolower', mb_list_encodings())))
- $data = mb_convert_encoding($data, 'UTF-8', $encoding);
-
- $data = preg_replace('/^<\?xml[\t\n\r ].*?\?>/s', $matches[1] . "UTF-8" . $matches[3] , $data);
- }
-
- return $data;
- }
-
function __construct($data) {
libxml_use_internal_errors(true);
libxml_clear_errors();
@@ -37,46 +23,6 @@ class FeedParser {
$error = libxml_get_last_error();
- // libxml compiled without iconv?
- if ($error && $error->code == 32) {
- $data = $this->normalize_encoding($data);
-
- if ($data) {
- libxml_clear_errors();
-
- $this->doc = new DOMDocument();
- $this->doc->loadXML($data);
-
- $error = libxml_get_last_error();
- }
- }
-
- // some terrible invalid unicode entity?
- if ($error) {
- foreach (libxml_get_errors() as $err) {
- if ($err->code == 9) {
- // if the source feed is not in utf8, next conversion will fail
- $data = $this->normalize_encoding($data);
-
- // remove dangling bytes
- $data = mb_convert_encoding($data, 'UTF-8', 'UTF-8');
-
- // apparently not all UTF-8 characters are valid for XML
- $data = preg_replace('/[^\x{0009}\x{000a}\x{000d}\x{0020}-\x{D7FF}\x{E000}-\x{FFFD}]+/u', ' ', $data);
-
- if ($data) {
- libxml_clear_errors();
-
- $this->doc = new DOMDocument();
- $this->doc->loadXML($data);
-
- $error = libxml_get_last_error();
- }
- break;
- }
- }
- }
-
if ($error) {
foreach (libxml_get_errors() as $error) {
if ($error->level == LIBXML_ERR_FATAL) {
@@ -237,10 +183,12 @@ class FeedParser {
}
}
+ // libxml may have invalid unicode data in error messages
function error() {
- return $this->error;
+ return UConverter::transcode($this->error, 'UTF-8', 'UTF-8');
}
+ // WARNING: may return invalid unicode data
function errors() {
return $this->libxml_errors;
}
diff --git a/classes/feeds.php b/classes/feeds.php
index 07677a8cd..86fa45ea7 100755
--- a/classes/feeds.php
+++ b/classes/feeds.php
@@ -54,7 +54,7 @@ class Feeds extends Handler_Protected {
$reply .= "<span class=\"right\">";
$reply .= "<span id='selected_prompt'></span>";
$reply .= "&nbsp;";
- $reply .= "<select dojoType=\"dijit.form.Select\"
+ $reply .= "<select dojoType=\"fox.form.Select\"
onchange=\"Headlines.onActionChanged(this)\">";
$reply .= "<option value=\"0\" disabled='1'>".__('Select...')."</option>";
@@ -210,6 +210,8 @@ class Feeds extends Handler_Protected {
$highlight_words = $qfh_ret[5];
$reply['first_id'] = $qfh_ret[6];
$reply['is_vfeed'] = $qfh_ret[7];
+ $query_error_override = $qfh_ret[8];
+
$reply['search_query'] = [$search, $search_language];
$reply['vfeed_group_enabled'] = $vfeed_group_enabled;
@@ -387,22 +389,26 @@ class Feeds extends Handler_Protected {
if (is_object($result)) {
- switch ($view_mode) {
- case "unread":
- $message = __("No unread articles found to display.");
- break;
- case "updated":
- $message = __("No updated articles found to display.");
- break;
- case "marked":
- $message = __("No starred articles found to display.");
- break;
- default:
- if ($feed < LABEL_BASE_INDEX) {
- $message = __("No articles found to display. You can assign articles to labels manually from article header context menu (applies to all selected articles) or use a filter.");
- } else {
- $message = __("No articles found to display.");
- }
+ if ($query_error_override) {
+ $message = $query_error_override;
+ } else {
+ switch ($view_mode) {
+ case "unread":
+ $message = __("No unread articles found to display.");
+ break;
+ case "updated":
+ $message = __("No updated articles found to display.");
+ break;
+ case "marked":
+ $message = __("No starred articles found to display.");
+ break;
+ default:
+ if ($feed < LABEL_BASE_INDEX) {
+ $message = __("No articles found to display. You can assign articles to labels manually from article header context menu (applies to all selected articles) or use a filter.");
+ } else {
+ $message = __("No articles found to display.");
+ }
+ }
}
if (!$offset && $message) {
@@ -659,7 +665,7 @@ class Feeds extends Handler_Protected {
if (get_pref('ENABLE_FEED_CATS')) {
print "<label class='inline'>" . __('Place in category:') . "</label> ";
- print_feed_cat_select("cat", false, 'dojoType="dijit.form.Select"');
+ print_feed_cat_select("cat", false, 'dojoType="fox.form.Select"');
}
print "</fieldset>";
@@ -671,7 +677,7 @@ class Feeds extends Handler_Protected {
<section>
<fieldset>
<select id="feedDlg_feedContainerSelect"
- dojoType="dijit.form.Select" size="3">
+ dojoType="fox.form.Select" size="3">
<script type="dojo/method" event="onChange" args="value">
dijit.byId("feedDlg_feedUrl").attr("value", value);
</script>
@@ -724,17 +730,17 @@ class Feeds extends Handler_Protected {
print "<section>";
print "<fieldset>";
- print "<input dojoType='dijit.form.ValidationTextBox'
+ print "<input dojoType='dijit.form.ValidationTextBox' id='search_query'
style='font-size : 16px; width : 540px;'
placeHolder=\"".T_sprintf("Search %s...", $this->getFeedTitle($active_feed_id, $is_cat))."\"
- required='1' name='query' type='search' value=''>";
+ name='query' type='search' value=''>";
print "</fieldset>";
if (DB_TYPE == "pgsql") {
print "<fieldset>";
print "<label class='inline'>" . __("Language:") . "</label>";
- print_select("search_language", "", Pref_Feeds::get_ts_languages(),
- "dojoType='dijit.form.Select' title=\"".__('Used for word stemming')."\"");
+ print_select("search_language", get_pref('DEFAULT_SEARCH_LANGUAGE'), Pref_Feeds::get_ts_languages(),
+ "dojoType='fox.form.Select' title=\"".__('Used for word stemming')."\"");
print "</fieldset>";
}
@@ -844,9 +850,23 @@ class Feeds extends Handler_Protected {
$pdo = Db::pdo();
- // Todo: all this interval stuff needs some generic generator function
+ if (is_array($search) && $search[0]) {
+ $search_qpart = "";
- $search_qpart = is_array($search) && $search[0] ? search_to_sql($search[0], $search[1])[0] : 'true';
+ foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_SEARCH) as $plugin) {
+ list($search_qpart, $search_words) = $plugin->hook_search($search[0]);
+ break;
+ }
+
+ // fall back in case of no plugins
+ if (!$search_qpart) {
+ list($search_qpart, $search_words) = search_to_sql($search[0], $search[1]);
+ }
+ } else {
+ $search_qpart = "true";
+ }
+
+ // TODO: all this interval stuff needs some generic generator function
switch ($mode) {
case "1day":
@@ -1111,6 +1131,7 @@ class Feeds extends Handler_Protected {
global $fetch_last_error;
global $fetch_last_error_content;
+ global $fetch_last_content_type;
$pdo = Db::pdo();
@@ -1132,7 +1153,7 @@ class Feeds extends Handler_Protected {
return array("code" => 5, "message" => $fetch_last_error);
}
- if (is_html($contents)) {
+ if (mb_strpos($fetch_last_content_type, "html") !== FALSE && is_html($contents)) {
$feedUrls = get_feeds_from_html($url, $contents);
if (count($feedUrls) == 0) {
@@ -1421,10 +1442,13 @@ class Feeds extends Handler_Protected {
$ext_tables_part = "";
$limit_query_part = "";
+ $query_error_override = "";
- $search_words = array();
+ $search_words = [];
if ($search) {
+ $search_query_part = "";
+
foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_SEARCH) as $plugin) {
list($search_query_part, $search_words) = $plugin->hook_search($search);
break;
@@ -1434,6 +1458,21 @@ class Feeds extends Handler_Protected {
if (!$search_query_part) {
list($search_query_part, $search_words) = search_to_sql($search, $search_language);
}
+
+ if (DB_TYPE == "pgsql") {
+ $test_sth = $pdo->prepare("select $search_query_part
+ FROM ttrss_entries, ttrss_user_entries WHERE id = ref_id limit 1");
+
+ try {
+ $test_sth->execute();
+ } catch (PDOException $e) {
+ // looks like tsquery syntax is invalid
+ $search_query_part = "false";
+
+ $query_error_override = T_sprintf("Incorrect search syntax: %s.", implode(" ", $search_words));
+ }
+ }
+
$search_query_part .= " AND ";
} else {
$search_query_part = "";
@@ -1725,7 +1764,7 @@ class Feeds extends Handler_Protected {
$first_id = (int)$row["id"];
if ($offset > 0 && $first_id && $check_first_id && $first_id != $check_first_id) {
- return array(-1, $feed_title, $feed_site_url, $last_error, $last_updated, $search_words, $first_id, $vfeed_query_part != "");
+ return array(-1, $feed_title, $feed_site_url, $last_error, $last_updated, $search_words, $first_id, $vfeed_query_part != "", $query_error_override);
}
}
}
@@ -1814,7 +1853,7 @@ class Feeds extends Handler_Protected {
$res = $pdo->query($query);
}
- return array($res, $feed_title, $feed_site_url, $last_error, $last_updated, $search_words, $first_id, $vfeed_query_part != "");
+ return array($res, $feed_title, $feed_site_url, $last_error, $last_updated, $search_words, $first_id, $vfeed_query_part != "", $query_error_override);
}
diff --git a/classes/logger/sql.php b/classes/logger/sql.php
index a2f4cd32c..352d71324 100755
--- a/classes/logger/sql.php
+++ b/classes/logger/sql.php
@@ -15,6 +15,11 @@ class Logger_SQL {
if (DB_TYPE == "mysql")
$context = substr($context, 0, 65534);
+ // passed error message may contain invalid unicode characters, failing to insert an error here
+ // would break the execution entirely by generating an actual fatal error instead of a E_WARNING etc
+ $errstr = UConverter::transcode($errstr, 'UTF-8', 'UTF-8');
+ $context = UConverter::transcode($context, 'UTF-8', 'UTF-8');
+
$sth = $this->pdo->prepare("INSERT INTO ttrss_error_log
(errno, errstr, filename, lineno, context, owner_uid, created_at) VALUES
(?, ?, ?, ?, ?, ?, NOW())");
diff --git a/classes/pluginhost.php b/classes/pluginhost.php
index f0dc0286c..a3c12ecae 100755
--- a/classes/pluginhost.php
+++ b/classes/pluginhost.php
@@ -58,6 +58,7 @@ class PluginHost {
const HOOK_UNSUBSCRIBE_FEED = 38;
const HOOK_SEND_MAIL = 39;
const HOOK_FILTER_TRIGGERED = 40;
+ const HOOK_GET_FULL_TEXT = 41;
const KIND_ALL = 1;
const KIND_SYSTEM = 2;
diff --git a/classes/pref/feeds.php b/classes/pref/feeds.php
index 40bbc7ef3..6cbf15a58 100755
--- a/classes/pref/feeds.php
+++ b/classes/pref/feeds.php
@@ -66,9 +66,9 @@ class Pref_Feeds extends Handler_Protected {
$cat['items'] = array();
$cat['checkbox'] = false;
$cat['type'] = 'category';
- $cat['unread'] = 0;
- $cat['child_unread'] = 0;
- $cat['auxcounter'] = 0;
+ $cat['unread'] = -1;
+ $cat['child_unread'] = -1;
+ $cat['auxcounter'] = -1;
$cat['parent_id'] = $cat_id;
$cat['items'] = $this->get_category_items($line['id']);
@@ -95,10 +95,10 @@ class Pref_Feeds extends Handler_Protected {
$feed = array();
$feed['id'] = 'FEED:' . $feed_line['id'];
$feed['bare_id'] = (int)$feed_line['id'];
- $feed['auxcounter'] = 0;
+ $feed['auxcounter'] = -1;
$feed['name'] = $feed_line['title'];
$feed['checkbox'] = false;
- $feed['unread'] = 0;
+ $feed['unread'] = -1;
$feed['error'] = $feed_line['last_error'];
$feed['icon'] = Feeds::getFeedIcon($feed_line['id']);
$feed['param'] = make_local_datetime(
@@ -153,14 +153,14 @@ class Pref_Feeds extends Handler_Protected {
$item = array();
$item['id'] = 'FEED:' . $feed_id;
$item['bare_id'] = (int)$feed_id;
- $item['auxcounter'] = 0;
+ $item['auxcounter'] = -1;
$item['name'] = $feed['title'];
$item['checkbox'] = false;
$item['error'] = '';
$item['icon'] = $feed['icon'];
$item['param'] = '';
- $item['unread'] = 0; //$feed['sender']->get_unread($feed['id']);
+ $item['unread'] = -1;
$item['type'] = 'feed';
array_push($cat['items'], $item);
@@ -218,13 +218,13 @@ class Pref_Feeds extends Handler_Protected {
$cat = array();
$cat['id'] = 'CAT:' . $line['id'];
$cat['bare_id'] = (int)$line['id'];
- $cat['auxcounter'] = 0;
+ $cat['auxcounter'] = -1;
$cat['name'] = $line['title'];
$cat['items'] = array();
$cat['checkbox'] = false;
$cat['type'] = 'category';
- $cat['unread'] = 0;
- $cat['child_unread'] = 0;
+ $cat['unread'] = -1;
+ $cat['child_unread'] = -1;
$cat['items'] = $this->get_category_items($line['id']);
@@ -242,13 +242,13 @@ class Pref_Feeds extends Handler_Protected {
$cat = array();
$cat['id'] = 'CAT:0';
$cat['bare_id'] = 0;
- $cat['auxcounter'] = 0;
+ $cat['auxcounter'] = -1;
$cat['name'] = __("Uncategorized");
$cat['items'] = array();
$cat['type'] = 'category';
$cat['checkbox'] = false;
- $cat['unread'] = 0;
- $cat['child_unread'] = 0;
+ $cat['unread'] = -1;
+ $cat['child_unread'] = -1;
$fsth = $this->pdo->prepare("SELECT id, title,last_error,
".SUBSTRING_FOR_DATE."(last_updated,1,19) AS last_updated, update_interval
@@ -263,14 +263,14 @@ class Pref_Feeds extends Handler_Protected {
$feed = array();
$feed['id'] = 'FEED:' . $feed_line['id'];
$feed['bare_id'] = (int)$feed_line['id'];
- $feed['auxcounter'] = 0;
+ $feed['auxcounter'] = -1;
$feed['name'] = $feed_line['title'];
$feed['checkbox'] = false;
$feed['error'] = $feed_line['last_error'];
$feed['icon'] = Feeds::getFeedIcon($feed_line['id']);
$feed['param'] = make_local_datetime(
$feed_line['last_updated'], true);
- $feed['unread'] = 0;
+ $feed['unread'] = -1;
$feed['type'] = 'feed';
$feed['updates_disabled'] = (int)($feed_line['update_interval'] < 0);
@@ -298,14 +298,14 @@ class Pref_Feeds extends Handler_Protected {
$feed = array();
$feed['id'] = 'FEED:' . $feed_line['id'];
$feed['bare_id'] = (int)$feed_line['id'];
- $feed['auxcounter'] = 0;
+ $feed['auxcounter'] = -1;
$feed['name'] = $feed_line['title'];
$feed['checkbox'] = false;
$feed['error'] = $feed_line['last_error'];
$feed['icon'] = Feeds::getFeedIcon($feed_line['id']);
$feed['param'] = make_local_datetime(
$feed_line['last_updated'], true);
- $feed['unread'] = 0;
+ $feed['unread'] = -1;
$feed['type'] = 'feed';
$feed['updates_disabled'] = (int)($feed_line['update_interval'] < 0);
@@ -571,7 +571,7 @@ class Pref_Feeds extends Handler_Protected {
print "<label>" . __('Place in category:') . "</label> ";
print_feed_cat_select("cat_id", $cat_id,
- 'dojoType="dijit.form.Select"');
+ 'dojoType="fox.form.Select"');
print "</fieldset>";
}
@@ -595,11 +595,14 @@ class Pref_Feeds extends Handler_Protected {
if (DB_TYPE == "pgsql") {
$feed_language = $row["feed_language"];
+ if (!$feed_language)
+ $feed_language = get_pref('DEFAULT_SEARCH_LANGUAGE');
+
print "<fieldset>";
print "<label>" . __('Language:') . "</label> ";
print_select("feed_language", $feed_language, $this::get_ts_languages(),
- 'dojoType="dijit.form.Select"');
+ 'dojoType="fox.form.Select"');
print "</fieldset>";
}
@@ -618,7 +621,7 @@ class Pref_Feeds extends Handler_Protected {
print "<label>".__("Interval:")."</label> ";
print_select_hash("update_interval", $update_interval, $update_intervals,
- 'dojoType="dijit.form.Select"');
+ 'dojoType="fox.form.Select"');
print "</fieldset>";
@@ -631,7 +634,7 @@ class Pref_Feeds extends Handler_Protected {
print "<label>" . __('Article purging:') . "</label> ";
print_select_hash("purge_interval", $purge_interval, $purge_intervals,
- 'dojoType="dijit.form.Select" ' .
+ 'dojoType="fox.form.Select" ' .
((FORCE_ARTICLE_PURGE == 0) ? "" : 'disabled="1"'));
print "</fieldset>";
@@ -823,7 +826,7 @@ class Pref_Feeds extends Handler_Protected {
print "<label>" . __('Place in category:') . "</label> ";
print_feed_cat_select("cat_id", false,
- 'disabled="1" dojoType="dijit.form.Select"');
+ 'disabled="1" dojoType="fox.form.Select"');
$this->batch_edit_cbox("cat_id");
@@ -837,7 +840,7 @@ class Pref_Feeds extends Handler_Protected {
print "<label>" . __('Language:') . "</label> ";
print_select("feed_language", "", $this::get_ts_languages(),
- 'disabled="1" dojoType="dijit.form.Select"');
+ 'disabled="1" dojoType="fox.form.Select"');
$this->batch_edit_cbox("feed_language");
@@ -856,7 +859,7 @@ class Pref_Feeds extends Handler_Protected {
print "<label>".__("Interval:")."</label> ";
print_select_hash("update_interval", "", $update_intervals,
- 'disabled="1" dojoType="dijit.form.Select"');
+ 'disabled="1" dojoType="fox.form.Select"');
$this->batch_edit_cbox("update_interval");
@@ -871,7 +874,7 @@ class Pref_Feeds extends Handler_Protected {
print "<label>" . __('Article purging:') . "</label> ";
print_select_hash("purge_interval", "", $purge_intervals,
- 'disabled="1" dojoType="dijit.form.Select"');
+ 'disabled="1" dojoType="fox.form.Select"');
$this->batch_edit_cbox("purge_interval");
@@ -1205,7 +1208,7 @@ class Pref_Feeds extends Handler_Protected {
print '<div dojoType="dijit.layout.BorderContainer" gutters="false">';
- print "<div region='top' dojoType=\"dijit.Toolbar\">"; #toolbar
+ print "<div region='top' dojoType=\"fox.Toolbar\">"; #toolbar
print "<div style='float : right; padding-right : 4px;'>
<input dojoType=\"dijit.form.TextBox\" id=\"feed_search\" size=\"20\" type=\"search\"
@@ -1214,7 +1217,7 @@ class Pref_Feeds extends Handler_Protected {
__('Search')."</button>
</div>";
- print "<div dojoType=\"dijit.form.DropDownButton\">".
+ print "<div dojoType=\"fox.form.DropDownButton\">".
"<span>" . __('Select')."</span>";
print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
print "<div onclick=\"dijit.byId('feedTree').model.setAllChecked(true)\"
@@ -1223,7 +1226,7 @@ class Pref_Feeds extends Handler_Protected {
dojoType=\"dijit.MenuItem\">".__('None')."</div>";
print "</div></div>";
- print "<div dojoType=\"dijit.form.DropDownButton\">".
+ print "<div dojoType=\"fox.form.DropDownButton\">".
"<span>" . __('Feeds')."</span>";
print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
print "<div onclick=\"CommonDialogs.quickAddFeed()\"
@@ -1239,7 +1242,7 @@ class Pref_Feeds extends Handler_Protected {
print "</div></div>";
if (get_pref('ENABLE_FEED_CATS')) {
- print "<div dojoType=\"dijit.form.DropDownButton\">".
+ print "<div dojoType=\"fox.form.DropDownButton\">".
"<span>" . __('Categories')."</span>";
print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
print "<div onclick=\"dijit.byId('feedTree').createCategory()\"
@@ -1446,8 +1449,8 @@ class Pref_Feeds extends Handler_Protected {
ORDER BY last_article");
$sth->execute([$_SESSION['uid']]);
- print "<div dojoType='dijit.Toolbar'>";
- print "<div dojoType='dijit.form.DropDownButton'>".
+ print "<div dojoType='fox.Toolbar'>";
+ print "<div dojoType='fox.form.DropDownButton'>".
"<span>" . __('Select')."</span>";
print "<div dojoType='dijit.Menu' style='display: none'>";
print "<div onclick=\"Tables.select('inactive-feeds-list', true)\"
@@ -1503,8 +1506,8 @@ class Pref_Feeds extends Handler_Protected {
FROM ttrss_feeds WHERE last_error != '' AND owner_uid = ?");
$sth->execute([$_SESSION['uid']]);
- print "<div dojoType=\"dijit.Toolbar\">";
- print "<div dojoType=\"dijit.form.DropDownButton\">".
+ print "<div dojoType=\"fox.Toolbar\">";
+ print "<div dojoType=\"fox.form.DropDownButton\">".
"<span>" . __('Select')."</span>";
print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
print "<div onclick=\"Tables.select('error-feeds-list', true)\"
@@ -1659,7 +1662,7 @@ class Pref_Feeds extends Handler_Protected {
if (get_pref('ENABLE_FEED_CATS')) {
print "<fieldset>";
print "<label>" . __('Place in category:') . "</label> ";
- print_feed_cat_select("cat", false, 'dojoType="dijit.form.Select"');
+ print_feed_cat_select("cat", false, 'dojoType="fox.form.Select"');
print "</fieldset>";
}
diff --git a/classes/pref/filters.php b/classes/pref/filters.php
index 37a7236ee..041951b35 100755
--- a/classes/pref/filters.php
+++ b/classes/pref/filters.php
@@ -354,9 +354,9 @@ class Pref_Filters extends Handler_Protected {
print "<header class='horizontal'>".__("Match")."</header>";
print "<section>";
- print "<div dojoType=\"dijit.Toolbar\">";
+ print "<div dojoType=\"fox.Toolbar\">";
- print "<div dojoType=\"dijit.form.DropDownButton\">".
+ print "<div dojoType=\"fox.form.DropDownButton\">".
"<span>" . __('Select')."</span>";
print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
print "<div onclick=\"dijit.byId('filterEditDlg').selectRules(true)\"
@@ -414,9 +414,9 @@ class Pref_Filters extends Handler_Protected {
print "<section>";
- print "<div dojoType=\"dijit.Toolbar\">";
+ print "<div dojoType=\"fox.Toolbar\">";
- print "<div dojoType=\"dijit.form.DropDownButton\">".
+ print "<div dojoType=\"fox.form.DropDownButton\">".
"<span>" . __('Select')."</span>";
print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
print "<div onclick=\"dijit.byId('filterEditDlg').selectActions(true)\"
@@ -757,7 +757,7 @@ class Pref_Filters extends Handler_Protected {
print "<div dojoType='dijit.layout.BorderContainer' gutters='false'>";
print "<div style='padding : 0px' dojoType='dijit.layout.ContentPane' region='top'>";
- print "<div dojoType='dijit.Toolbar'>";
+ print "<div dojoType='fox.Toolbar'>";
if (array_key_exists("search", $_REQUEST)) {
$_SESSION["prefs_filter_search"] = $filter_search;
@@ -772,7 +772,7 @@ class Pref_Filters extends Handler_Protected {
__('Search')."</button>
</div>";
- print "<div dojoType=\"dijit.form.DropDownButton\">".
+ print "<div dojoType=\"fox.form.DropDownButton\">".
"<span>" . __('Select')."</span>";
print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
print "<div onclick=\"dijit.byId('filterTree').model.setAllChecked(true)\"
@@ -856,9 +856,9 @@ class Pref_Filters extends Handler_Protected {
print "<header class='horizontal'>".__("Match")."</header >";
print "<section>";
- print "<div dojoType='dijit.Toolbar'>";
+ print "<div dojoType='fox.Toolbar'>";
- print "<div dojoType='dijit.form.DropDownButton'>".
+ print "<div dojoType='fox.form.DropDownButton'>".
"<span>" . __('Select')."</span>";
print "<div dojoType='dijit.Menu' style='display: none'>";
print "<div onclick=\"dijit.byId('filterEditDlg').selectRules(true)\"
@@ -885,9 +885,9 @@ class Pref_Filters extends Handler_Protected {
print "<section>";
- print "<div dojoType='dijit.Toolbar'>";
+ print "<div dojoType='fox.Toolbar'>";
- print "<div dojoType='dijit.form.DropDownButton'>".
+ print "<div dojoType='fox.form.DropDownButton'>".
"<span>" . __('Select')."</span>";
print "<div dojoType='dijit.Menu' style='display: none'>";
print "<div onclick=\"dijit.byId('filterEditDlg').selectActions(true)\"
@@ -993,7 +993,7 @@ class Pref_Filters extends Handler_Protected {
print "<fieldset>";
print "<label style='display : inline'>". __("on field") . "</label> ";
print_select_hash("filter_type", $filter_type, $filter_types,
- 'dojoType="dijit.form.Select"');
+ 'dojoType="fox.form.Select"');
print "<label style='padding-left : 10px; display : inline'>" . __("in") . "</label> ";
print "</fieldset>";
@@ -1042,7 +1042,7 @@ class Pref_Filters extends Handler_Protected {
print "<section>";
- print "<select name='action_id' dojoType='dijit.form.Select'
+ print "<select name='action_id' dojoType='fox.form.Select'
onchange='Filters.filterDlgCheckAction(this)'>";
$res = $this->pdo->query("SELECT id,description FROM ttrss_filter_actions
@@ -1073,7 +1073,7 @@ class Pref_Filters extends Handler_Protected {
print_label_select("action_param_label", $action_param,
"id='filterDlg_actionParamLabel' style=\"$label_param_hidden\"
- dojoType='dijit.form.Select'");
+ dojoType='fox.form.Select'");
$filter_actions = PluginHost::getInstance()->get_filter_actions();
$filter_action_hash = array();
@@ -1096,7 +1096,7 @@ class Pref_Filters extends Handler_Protected {
}
print_select_hash("filterDlg_actionParamPlugin", $action_param, $filter_action_hash,
- "style=\"$plugin_param_hidden\" dojoType='dijit.form.Select' $filter_plugin_disabled",
+ "style=\"$plugin_param_hidden\" dojoType='fox.form.Select' $filter_plugin_disabled",
"action_param_plugin");
print "</span>";
diff --git a/classes/pref/labels.php b/classes/pref/labels.php
index 5dadddab4..ec9667441 100644
--- a/classes/pref/labels.php
+++ b/classes/pref/labels.php
@@ -251,9 +251,9 @@ class Pref_Labels extends Handler_Protected {
print "<div dojoType='dijit.layout.BorderContainer' gutters='false'>";
print "<div style='padding : 0px' dojoType='dijit.layout.ContentPane' region='top'>";
- print "<div dojoType='dijit.Toolbar'>";
+ print "<div dojoType='fox.Toolbar'>";
- print "<div dojoType='dijit.form.DropDownButton'>".
+ print "<div dojoType='fox.form.DropDownButton'>".
"<span>" . __('Select')."</span>";
print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
print "<div onclick=\"dijit.byId('labelTree').model.setAllChecked(true)\"
diff --git a/classes/pref/prefs.php b/classes/pref/prefs.php
index cb10e2322..cb19998ce 100644
--- a/classes/pref/prefs.php
+++ b/classes/pref/prefs.php
@@ -28,6 +28,7 @@ class Pref_Prefs extends Handler_Protected {
__('Feeds') => [
'DEFAULT_UPDATE_INTERVAL',
'FRESH_ARTICLE_MAX_AGE',
+ 'DEFAULT_SEARCH_LANGUAGE',
'BLOCK_SEPARATOR',
'ENABLE_FEED_CATS',
'BLOCK_SEPARATOR',
@@ -68,6 +69,7 @@ class Pref_Prefs extends Handler_Protected {
$this->pref_help = [
"ALLOW_DUPLICATE_POSTS" => array(__("Allow duplicate articles"), ""),
"BLACKLISTED_TAGS" => array(__("Blacklisted tags"), __("Never apply these tags automatically (comma-separated list).")),
+ "DEFAULT_SEARCH_LANGUAGE" => array(__("Default language"), __("Used for full-text search")),
"CDM_AUTO_CATCHUP" => array(__("Mark read on scroll"), __("Mark articles as read as you scroll past them")),
"CDM_EXPANDED" => array(__("Always expand articles")),
"COMBINED_DISPLAY_MODE" => array(__("Combined mode"), __("Show flat list of articles instead of separate panels")),
@@ -560,6 +562,10 @@ class Pref_Prefs extends Handler_Protected {
continue;
}
+ if ($pref_name == "DEFAULT_SEARCH_LANGUAGE" && DB_TYPE != "pgsql") {
+ continue;
+ }
+
if ($item = $prefs_available[$pref_name]) {
print "<fieldset class='prefs'>";
@@ -573,7 +579,7 @@ class Pref_Prefs extends Handler_Protected {
if ($pref_name == "USER_LANGUAGE") {
print_select_hash($pref_name, $value, get_translations(),
- "style='width : 220px; margin : 0px' dojoType='dijit.form.Select'");
+ "style='width : 220px; margin : 0px' dojoType='fox.form.Select'");
} else if ($pref_name == "USER_TIMEZONE") {
@@ -589,7 +595,7 @@ class Pref_Prefs extends Handler_Protected {
if (!theme_exists($value)) $value = "default.php";
- print "<select name='$pref_name' id='$pref_name' dojoType='dijit.form.Select'>";
+ print "<select name='$pref_name' id='$pref_name' dojoType='fox.form.Select'>";
$issel = $value == "default.php" ? "selected='selected'" : "";
print "<option $issel value='default.php'>".__("default")."</option>";
@@ -612,7 +618,11 @@ class Pref_Prefs extends Handler_Protected {
global $update_intervals_nodefault;
print_select_hash($pref_name, $value, $update_intervals_nodefault,
- 'dojoType="dijit.form.Select"');
+ 'dojoType="fox.form.Select"');
+ } else if ($pref_name == "DEFAULT_SEARCH_LANGUAGE") {
+
+ print_select($pref_name, $value, Pref_Feeds::get_ts_languages(),
+ 'dojoType="fox.form.Select"');
} else if ($type_name == "bool") {
@@ -705,7 +715,7 @@ class Pref_Prefs extends Handler_Protected {
print_hidden("op", "pref-prefs");
print_hidden("method", "saveconfig");
- print "<div dojoType=\"dijit.form.ComboButton\" type=\"submit\" class=\"alt-primary\">
+ print "<div dojoType=\"fox.form.ComboButton\" type=\"submit\" class=\"alt-primary\">
<span>".__('Save configuration')."</span>
<div dojoType=\"dijit.DropDownMenu\">
<div dojoType=\"dijit.MenuItem\"
@@ -1011,9 +1021,9 @@ class Pref_Prefs extends Handler_Protected {
}
function editPrefProfiles() {
- print "<div dojoType='dijit.Toolbar'>";
+ print "<div dojoType='fox.Toolbar'>";
- print "<div dojoType='dijit.form.DropDownButton'>".
+ print "<div dojoType='fox.form.DropDownButton'>".
"<span>" . __('Select')."</span>";
print "<div dojoType='dijit.Menu' style='display: none'>";
print "<div onclick=\"Tables.select('pref-profiles-list', true)\"
diff --git a/classes/pref/users.php b/classes/pref/users.php
index 7b75bb872..680290b74 100644
--- a/classes/pref/users.php
+++ b/classes/pref/users.php
@@ -69,10 +69,10 @@ class Pref_Users extends Handler_Protected {
if (!$sel_disabled) {
print_select_hash("access_level", $access_level, $access_level_names,
- "dojoType=\"dijit.form.Select\" $sel_disabled");
+ "dojoType=\"fox.form.Select\" $sel_disabled");
} else {
print_select_hash("", $access_level, $access_level_names,
- "dojoType=\"dijit.form.Select\" $sel_disabled");
+ "dojoType=\"fox.form.Select\" $sel_disabled");
print_hidden("access_level", "$access_level");
}
@@ -313,7 +313,7 @@ class Pref_Users extends Handler_Protected {
print "<div dojoType='dijit.layout.BorderContainer' gutters='false'>";
print "<div style='padding : 0px' dojoType='dijit.layout.ContentPane' region='top'>";
- print "<div dojoType='dijit.Toolbar'>";
+ print "<div dojoType='fox.Toolbar'>";
$user_search = trim(clean($_REQUEST["search"]));
@@ -336,7 +336,7 @@ class Pref_Users extends Handler_Protected {
$sort = "login";
}
- print "<div dojoType='dijit.form.DropDownButton'>".
+ print "<div dojoType='fox.form.DropDownButton'>".
"<span>" . __('Select')."</span>";
print "<div dojoType='dijit.Menu' style='display: none'>";
print "<div onclick=\"Tables.select('prefUserList', true)\"
diff --git a/classes/rssutils.php b/classes/rssutils.php
index 5aff2f8a3..68e0255ed 100755
--- a/classes/rssutils.php
+++ b/classes/rssutils.php
@@ -308,7 +308,12 @@ class RSSUtils {
$fetch_url = $row["feed_url"];
$feed_language = mb_strtolower($row["feed_language"]);
- if (!$feed_language) $feed_language = 'english';
+
+ if (!$feed_language)
+ $feed_language = mb_strtolower(get_pref('DEFAULT_SEARCH_LANGUAGE', $owner_uid));
+
+ if (!$feed_language)
+ $feed_language = 'simple';
} else {
return false;
@@ -1165,10 +1170,12 @@ class RSSUtils {
$sth->execute([$error_msg, $feed]);
unset($rss);
+
+ Debug::log("update failed.", Debug::$LOG_VERBOSE);
return false;
}
- Debug::log("done", Debug::$LOG_VERBOSE);
+ Debug::log("update done.", Debug::$LOG_VERBOSE);
return true;
}