feed editor: expose site_url for editing

This commit is contained in:
Andrew Dolgov 2018-03-01 15:43:40 +03:00
parent fc763c882e
commit c9a5e5aa28
1 changed files with 20 additions and 7 deletions

View File

@ -565,6 +565,18 @@ class Pref_Feeds extends Handler_Protected {
'dojoType="dijit.form.Select"'); 'dojoType="dijit.form.Select"');
} }
/* Site URL */
$site_url = htmlspecialchars($row["site_url"]);
print "<hr/>";
print __('Site URL:') . " ";
print "<input dojoType=\"dijit.form.ValidationTextBox\" required=\"1\"
placeHolder=\"".__("Site URL")."\"
regExp='^(http|https)://.*' style=\"width : 15em\"
name=\"site_url\" value=\"$site_url\">";
/* FTS Stemming Language */ /* FTS Stemming Language */
if (DB_TYPE == "pgsql") { if (DB_TYPE == "pgsql") {
@ -623,7 +635,6 @@ class Pref_Feeds extends Handler_Protected {
autocomplete=\"new-password\" autocomplete=\"new-password\"
name=\"auth_login\" value=\"$auth_login\"><hr/>"; name=\"auth_login\" value=\"$auth_login\"><hr/>";
print "<input dojoType=\"dijit.form.TextBox\" type=\"password\" name=\"auth_pass\" print "<input dojoType=\"dijit.form.TextBox\" type=\"password\" name=\"auth_pass\"
autocomplete=\"new-password\" autocomplete=\"new-password\"
placeHolder=\"".__("Password")."\" placeHolder=\"".__("Password")."\"
@ -929,6 +940,7 @@ class Pref_Feeds extends Handler_Protected {
$feed_title = trim(clean($_POST["title"])); $feed_title = trim(clean($_POST["title"]));
$feed_url = trim(clean($_POST["feed_url"])); $feed_url = trim(clean($_POST["feed_url"]));
$site_url = trim(clean($_POST["site_url"]));
$upd_intl = (int) clean($_POST["update_interval"]); $upd_intl = (int) clean($_POST["update_interval"]);
$purge_intl = (int) clean($_POST["purge_interval"]); $purge_intl = (int) clean($_POST["purge_interval"]);
$feed_id = (int) clean($_POST["id"]); /* editSave */ $feed_id = (int) clean($_POST["id"]); /* editSave */
@ -957,17 +969,17 @@ class Pref_Feeds extends Handler_Protected {
$auth_pass = ''; $auth_pass = '';
} }
$sth = $this->pdo->prepare("SELECT feed_url FROM ttrss_feeds WHERE id = ?"); /* $sth = $this->pdo->prepare("SELECT feed_url FROM ttrss_feeds WHERE id = ?");
$sth->execute([$feed_id]); $sth->execute([$feed_id]);
$row = $sth->fetch(); $row = $sth->fetch();$orig_feed_url = $row["feed_url"];
$orig_feed_url = $row["feed_url"];
$reset_basic_info = $orig_feed_url != $feed_url; $reset_basic_info = $orig_feed_url != $feed_url; */
$sth = $this->pdo->prepare("UPDATE ttrss_feeds SET $sth = $this->pdo->prepare("UPDATE ttrss_feeds SET
cat_id = :cat_id, cat_id = :cat_id,
title = :title, title = :title,
feed_url = :feed_url, feed_url = :feed_url,
site_url = :site_url,
update_interval = :upd_intl, update_interval = :upd_intl,
purge_interval = :purge_intl, purge_interval = :purge_intl,
auth_login = :auth_login, auth_login = :auth_login,
@ -985,6 +997,7 @@ class Pref_Feeds extends Handler_Protected {
$sth->execute([":title" => $feed_title, $sth->execute([":title" => $feed_title,
":cat_id" => $cat_id ? $cat_id : null, ":cat_id" => $cat_id ? $cat_id : null,
":feed_url" => $feed_url, ":feed_url" => $feed_url,
":site_url" => $site_url,
":upd_intl" => $upd_intl, ":upd_intl" => $upd_intl,
":purge_intl" => $purge_intl, ":purge_intl" => $purge_intl,
":auth_login" => $auth_login, ":auth_login" => $auth_login,
@ -999,9 +1012,9 @@ class Pref_Feeds extends Handler_Protected {
":id" => $feed_id, ":id" => $feed_id,
":uid" => $_SESSION['uid']]); ":uid" => $_SESSION['uid']]);
if ($reset_basic_info) { /* if ($reset_basic_info) {
RSSUtils::set_basic_feed_info($feed_id); RSSUtils::set_basic_feed_info($feed_id);
} } */
PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_SAVE_FEED, PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_SAVE_FEED,
"hook_prefs_save_feed", $feed_id); "hook_prefs_save_feed", $feed_id);