1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2025-12-13 15:25:59 +00:00

search dialog fixes

pgsql: get FTS languages list from the database
This commit is contained in:
Andrew Dolgov
2019-02-20 15:12:37 +03:00
parent 063b4f535a
commit f8836ec080
2 changed files with 25 additions and 9 deletions

View File

@@ -1,8 +1,5 @@
<?php
class Pref_Feeds extends Handler_Protected {
public static $feed_languages = array("English", "Danish", "Dutch", "Finnish", "French", "German", "Hungarian", "Italian", "Norwegian",
"Portuguese", "Russian", "Spanish", "Swedish", "Turkish", "Simple");
function csrf_ignore($method) {
$csrf_ignored = array("index", "getfeedtree", "add", "editcats", "editfeed",
"savefeedorder", "uploadicon", "feedswitherrors", "inactivefeeds",
@@ -11,6 +8,22 @@ class Pref_Feeds extends Handler_Protected {
return array_search($method, $csrf_ignored) !== false;
}
public static function get_ts_languages() {
$rv = [];
if (DB_TYPE == "pgsql") {
$dbh = Db::pdo();
$res = $dbh->query("SELECT cfgname FROM pg_ts_config");
while ($row = $res->fetch()) {
array_push($rv, ucfirst($row['cfgname']));
}
}
return $rv;
}
function batch_edit_cbox($elem, $label = false) {
print "<input type=\"checkbox\" title=\"".__("Check to enable field")."\"
onchange=\"dijit.byId('feedEditDlg').toggleField(this, '$elem', '$label')\">";
@@ -590,7 +603,7 @@ class Pref_Feeds extends Handler_Protected {
print "<fieldset>";
print "<label>" . __('Language:') . "</label> ";
print_select("feed_language", $feed_language, $this::$feed_languages,
print_select("feed_language", $feed_language, $this::get_ts_languages(),
'dojoType="dijit.form.Select"');
print "</fieldset>";
@@ -859,7 +872,7 @@ class Pref_Feeds extends Handler_Protected {
print "<fieldset>";
print "<label>" . __('Language:') . "</label> ";
print_select("feed_language", "", $this::$feed_languages,
print_select("feed_language", "", $this::get_ts_languages(),
'disabled="1" dojoType="dijit.form.Select"');
$this->batch_edit_cbox("feed_language");