diff options
Diffstat (limited to 'classes/pref/feeds.php')
-rwxr-xr-x | classes/pref/feeds.php | 64 |
1 files changed, 34 insertions, 30 deletions
diff --git a/classes/pref/feeds.php b/classes/pref/feeds.php index 0b12bda13..659f7e183 100755 --- a/classes/pref/feeds.php +++ b/classes/pref/feeds.php @@ -809,8 +809,8 @@ class Pref_Feeds extends Handler_Protected { print "<footer> <button style='float : left' class='alt-danger' dojoType='dijit.form.Button' onclick='return CommonDialogs.unsubscribeFeed($feed_id, \"$title\")'>". __('Unsubscribe')."</button> - <button dojoType='dijit.form.Button' class='alt-primary' onclick=\"return dijit.byId('feedEditDlg').execute()\">".__('Save')."</button> - <button dojoType='dijit.form.Button' onclick=\"return dijit.byId('feedEditDlg').hide()\">".__('Cancel')."</button> + <button dojoType='dijit.form.Button' class='alt-primary' type='submit'>".__('Save')."</button> + <button dojoType='dijit.form.Button' onclick='App.dialogOf(this).hide()'>".__('Cancel')."</button> </footer>"; } } @@ -972,11 +972,10 @@ class Pref_Feeds extends Handler_Protected { print "</section>"; print "<footer> - <button dojoType='dijit.form.Button' type='submit' class='alt-primary' - onclick=\"return dijit.byId('feedEditDlg').execute()\">". + <button dojoType='dijit.form.Button' type='submit' class='alt-primary' type='submit'>". __('Save')."</button> <button dojoType='dijit.form.Button' - onclick=\"return dijit.byId('feedEditDlg').hide()\">". + onclick='App.dialogOf(this).hide()'>". __('Cancel')."</button> </footer>"; @@ -1194,6 +1193,11 @@ class Pref_Feeds extends Handler_Protected { Feeds::add_feed_category($feed_cat); } + function importOpml() { + $opml = new OPML($_REQUEST); + $opml->opml_import($_SESSION["uid"]); + } + function index() { print "<div dojoType='dijit.layout.AccordionContainer' region='center'>"; @@ -1340,17 +1344,11 @@ class Pref_Feeds extends Handler_Protected { print_notice("Only main settings profile can be migrated using OPML."); - print "<iframe id=\"upload_iframe\" - name=\"upload_iframe\" onload=\"Helpers.OPML.onImportComplete(this)\" - style=\"width: 400px; height: 100px; display: none;\"></iframe>"; - - print "<form name='opml_form' style='display : inline-block' target='upload_iframe' - enctype='multipart/form-data' method='POST' - action='backend.php'> + print "<form id='opml_import_form' method='post' enctype='multipart/form-data' > <label class='dijitButton'>".__("Choose file...")." <input style='display : none' id='opml_file' name='opml_file' type='file'> </label> - <input type='hidden' name='op' value='dlg'> + <input type='hidden' name='op' value='pref-feeds'> <input type='hidden' name='csrf_token' value='".$_SESSION['csrf_token']."'> <input type='hidden' name='method' value='importOpml'> <button dojoType='dijit.form.Button' class='alt-primary' onclick=\"return Helpers.OPML.import();\" type=\"submit\">" . @@ -1379,7 +1377,7 @@ class Pref_Feeds extends Handler_Protected { " " . __("Published OPML does not include your Tiny Tiny RSS settings, feeds that require authentication or feeds hidden from Popular feeds.") . "</p>"; - print "<button dojoType='dijit.form.Button' class='alt-primary' onclick=\"return App.displayDlg('".__("Public OPML URL")."','pubOPMLUrl')\">". + print "<button dojoType='dijit.form.Button' class='alt-primary' onclick=\"return CommonDialogs.publishedOPML()\">". __('Display published OPML URL')."</button> "; PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_TAB_SECTION, "prefFeedsOPML"); @@ -1391,10 +1389,10 @@ class Pref_Feeds extends Handler_Protected { print "<h3>" . __('Published articles can be subscribed by anyone who knows the following URL:') . "</h3>"; - $rss_url = '-2::' . htmlspecialchars(get_self_url_prefix() . + $rss_url = htmlspecialchars(get_self_url_prefix() . "/public.php?op=rss&id=-2&view-mode=all_articles");; - print "<button dojoType='dijit.form.Button' class='alt-primary' onclick=\"return App.displayDlg('".__("Show as feed")."','generatedFeed', '$rss_url')\">". + print "<button dojoType='dijit.form.Button' class='alt-primary' onclick='CommonDialogs.generatedFeed(-2, false, \"$rss_url\")'>". __('Display URL')."</button> "; print "<button class=\"alt-danger\" dojoType=\"dijit.form.Button\" onclick=\"return Helpers.clearFeedAccessKeys()\">". @@ -1511,9 +1509,9 @@ class Pref_Feeds extends Handler_Protected { print "</div>"; print "<footer> - <button style='float : left' class=\"alt-danger\" dojoType='dijit.form.Button' onclick=\"dijit.byId('inactiveFeedsDlg').removeSelected()\">" + <button style='float : left' class='alt-danger' dojoType='dijit.form.Button' onclick='App.dialogOf(this).removeSelected()'>" .__('Unsubscribe from selected feeds')."</button> - <button dojoType='dijit.form.Button' onclick=\"dijit.byId('inactiveFeedsDlg').hide()\">" + <button dojoType='dijit.form.Button' class='alt-primary' type='submit'>" .__('Close this window')."</button> </footer>"; @@ -1570,10 +1568,9 @@ class Pref_Feeds extends Handler_Protected { print "</div>"; print "<footer>"; - print "<button style='float : left' class=\"alt-danger\" dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('errorFeedsDlg').removeSelected()\">" + print "<button style='float : left' class='alt-danger' dojoType='dijit.form.Button' onclick='App.dialogOf(this).removeSelected()'>" .__('Unsubscribe from selected feeds')."</button> "; - - print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('errorFeedsDlg').hide()\">". + print "<button dojoType='dijit.form.Button' class='alt-primary' type='submit'>". __('Close this window')."</button>"; print "</footer>"; @@ -1667,9 +1664,9 @@ class Pref_Feeds extends Handler_Protected { print "</fieldset>"; print "<footer> - <button dojoType='dijit.form.Button' onclick=\"return dijit.byId('batchSubDlg').execute()\" type='submit' class='alt-primary'>". + <button dojoType='dijit.form.Button' onclick='App.dialogOf(this).execute()' type='submit' class='alt-primary'>". __('Subscribe')."</button> - <button dojoType='dijit.form.Button' onclick=\"return dijit.byId('batchSubDlg').hide()\">".__('Cancel')."</button> + <button dojoType='dijit.form.Button' onclick='App.dialogOf(this).hide()'>".__('Cancel')."</button> </footer>"; print "</form>"; @@ -1706,27 +1703,34 @@ class Pref_Feeds extends Handler_Protected { } } + function getOPMLKey() { + print json_encode(["link" => OPML::opml_publish_url()]); + } + function regenOPMLKey() { $this->update_feed_access_key('OPML:Publish', - false, $_SESSION["uid"]); - - $new_link = Opml::opml_publish_url(); + false, $_SESSION["uid"]); - print json_encode(array("link" => $new_link)); + print json_encode(["link" => OPML::opml_publish_url()]); } function regenFeedKey() { $feed_id = clean($_REQUEST['id']); $is_cat = clean($_REQUEST['is_cat']); - $new_key = $this->update_feed_access_key($feed_id, $is_cat); + $new_key = $this->update_feed_access_key($feed_id, $is_cat, $_SESSION["uid"]); print json_encode(["link" => $new_key]); } + function getFeedKey() { + $feed_id = clean($_REQUEST['id']); + $is_cat = clean($_REQUEST['is_cat']); + + print json_encode(["link" => Feeds::get_feed_access_key($feed_id, $is_cat, $_SESSION["uid"])]); + } - private function update_feed_access_key($feed_id, $is_cat, $owner_uid = false) { - if (!$owner_uid) $owner_uid = $_SESSION["uid"]; + private function update_feed_access_key($feed_id, $is_cat, $owner_uid) { // clear old value and generate new one $sth = $this->pdo->prepare("DELETE FROM ttrss_access_keys |