Browse Source

feed editor: expose site_url for editing

Andrew Dolgov 1 year ago
parent
commit
c9a5e5aa28
1 changed files with 20 additions and 7 deletions
  1. 20 7
      classes/pref/feeds.php

+ 20 - 7
classes/pref/feeds.php

@@ -565,6 +565,18 @@ class Pref_Feeds extends Handler_Protected {
 					'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 */
 
 			if (DB_TYPE == "pgsql") {
@@ -623,7 +635,6 @@ class Pref_Feeds extends Handler_Protected {
 			autocomplete=\"new-password\"
 			name=\"auth_login\" value=\"$auth_login\"><hr/>";
 
-
 			print "<input dojoType=\"dijit.form.TextBox\" type=\"password\" name=\"auth_pass\"
 			autocomplete=\"new-password\"
 			placeHolder=\"".__("Password")."\"
@@ -929,6 +940,7 @@ class Pref_Feeds extends Handler_Protected {
 
 		$feed_title = trim(clean($_POST["title"]));
 		$feed_url = trim(clean($_POST["feed_url"]));
+		$site_url = trim(clean($_POST["site_url"]));
 		$upd_intl = (int) clean($_POST["update_interval"]);
 		$purge_intl = (int) clean($_POST["purge_interval"]);
 		$feed_id = (int) clean($_POST["id"]); /* editSave */
@@ -957,17 +969,17 @@ class Pref_Feeds extends Handler_Protected {
 				$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]);
-			$row = $sth->fetch();
-			$orig_feed_url = $row["feed_url"];
+			$row = $sth->fetch();$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
 				cat_id = :cat_id,
 				title = :title, 
 				feed_url = :feed_url,
+				site_url = :site_url,
 				update_interval = :upd_intl,
 				purge_interval = :purge_intl,
 				auth_login = :auth_login,
@@ -985,6 +997,7 @@ class Pref_Feeds extends Handler_Protected {
 			$sth->execute([":title" => $feed_title,
 					":cat_id" => $cat_id ? $cat_id : null,
 					":feed_url" => $feed_url,
+					":site_url" => $site_url,
 					":upd_intl" => $upd_intl,
 					":purge_intl" => $purge_intl,
 					":auth_login" => $auth_login,
@@ -999,9 +1012,9 @@ class Pref_Feeds extends Handler_Protected {
 					":id" => $feed_id,
 					":uid" => $_SESSION['uid']]);
 
-			if ($reset_basic_info) {
+/*			if ($reset_basic_info) {
 				RSSUtils::set_basic_feed_info($feed_id);
-			}
+			} */
 
 			PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_SAVE_FEED,
 				"hook_prefs_save_feed", $feed_id);