summaryrefslogtreecommitdiff
path: root/classes/pref
diff options
context:
space:
mode:
Diffstat (limited to 'classes/pref')
-rwxr-xr-xclasses/pref/feeds.php64
-rwxr-xr-xclasses/pref/filters.php17
-rw-r--r--classes/pref/labels.php4
-rw-r--r--classes/pref/prefs.php44
-rw-r--r--classes/pref/users.php4
5 files changed, 51 insertions, 82 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'>&nbsp;
</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
diff --git a/classes/pref/filters.php b/classes/pref/filters.php
index 43a625989..096ab826d 100755
--- a/classes/pref/filters.php
+++ b/classes/pref/filters.php
@@ -3,7 +3,7 @@ class Pref_Filters extends Handler_Protected {
function csrf_ignore($method) {
$csrf_ignored = array("index", "getfiltertree", "edit", "newfilter", "newrule",
- "newaction", "savefilterorder", "testfilterdlg");
+ "newaction", "savefilterorder");
return array_search($method, $csrf_ignored) !== false;
}
@@ -163,21 +163,6 @@ class Pref_Filters extends Handler_Protected {
print json_encode($rv);
}
- function testFilterDlg() {
- ?>
- <div>
- <img id='prefFilterLoadingIndicator' src='images/indicator_tiny.gif'>&nbsp;
- <span id='prefFilterProgressMsg'>Looking for articles...</span>
- </div>
-
- <ul class='panel panel-scrollable list list-unstyled' id='prefFilterTestResultList'></ul>
-
- <footer class='text-center'>
- <button dojoType='dijit.form.Button' onclick="dijit.byId('filterTestDlg').hide()"><?php echo __('Close this window') ?></button>
- </footer>
- <?php
- }
-
private function getfilterrules_list($filter_id) {
$sth = $this->pdo->prepare("SELECT reg_exp,
inverse,
diff --git a/classes/pref/labels.php b/classes/pref/labels.php
index 4f83ad16e..a7869c379 100644
--- a/classes/pref/labels.php
+++ b/classes/pref/labels.php
@@ -69,9 +69,9 @@ class Pref_Labels extends Handler_Protected {
print "</section>";
print "<footer>";
- print "<button dojoType='dijit.form.Button' type='submit' class='alt-primary' onclick=\"dijit.byId('labelEditDlg').execute()\">".
+ print "<button dojoType='dijit.form.Button' type='submit' class='alt-primary' onclick='App.dialogOf(this).execute()'>".
__('Save')."</button>";
- print "<button dojoType='dijit.form.Button' onclick=\"dijit.byId('labelEditDlg').hide()\">".
+ print "<button dojoType='dijit.form.Button' onclick='App.dialogOf(this).hide()'>".
__('Cancel')."</button>";
print "</footer>";
diff --git a/classes/pref/prefs.php b/classes/pref/prefs.php
index 50a1f39c8..45f9dc71e 100644
--- a/classes/pref/prefs.php
+++ b/classes/pref/prefs.php
@@ -8,7 +8,7 @@ class Pref_Prefs extends Handler_Protected {
private $profile_blacklist = [];
function csrf_ignore($method) {
- $csrf_ignored = array("index", "updateself", "customizecss", "editprefprofiles", "otpqrcode");
+ $csrf_ignored = array("index", "updateself", "editprefprofiles", "otpqrcode");
return array_search($method, $csrf_ignored) !== false;
}
@@ -1168,28 +1168,7 @@ class Pref_Prefs extends Handler_Protected {
$value = get_pref("USER_STYLESHEET");
$value = str_replace("<br/>", "\n", $value);
- print_notice(__("You can override colors, fonts and layout of your currently selected theme with custom CSS declarations here."));
-
- print_hidden("op", "rpc");
- print_hidden("method", "setpref");
- print_hidden("key", "USER_STYLESHEET");
-
- print "<div id='css_edit_apply_msg' style='display : none'>";
- print_warning(__("User CSS has been applied, you might need to reload the page to see all changes."));
- print "</div>";
-
- print "<textarea class='panel user-css-editor' dojoType='dijit.form.SimpleTextarea'
- style='font-size : 12px;' name='value'>$value</textarea>";
-
- print "<footer>";
- print "<button dojoType='dijit.form.Button' class='alt-success'
- onclick=\"dijit.byId('cssEditDlg').apply()\">".__('Apply')."</button> ";
- print "<button dojoType='dijit.form.Button' class='alt-primary'
- onclick=\"dijit.byId('cssEditDlg').execute()\">".__('Save and reload')."</button> ";
- print "<button dojoType='dijit.form.Button'
- onclick=\"dijit.byId('cssEditDlg').hide()\">".__('Cancel')."</button>";
- print "</footer>";
-
+ print json_encode(["value" => $value]);
}
function editPrefProfiles() {
@@ -1218,9 +1197,9 @@ class Pref_Prefs extends Handler_Protected {
WHERE owner_uid = ? ORDER BY title");
$sth->execute([$_SESSION['uid']]);
- print "<div class='panel panel-scrollable'>";
+ print "<form onsubmit='return false'>";
- print "<form id='profile_edit_form' onsubmit='return false'>";
+ print "<div class='panel panel-scrollable'>";
print "<table width='100%' id='pref-profiles-list'>";
@@ -1275,18 +1254,19 @@ class Pref_Prefs extends Handler_Protected {
}
print "</table>";
- print "</form>";
print "</div>";
print "<footer>
- <button style='float : left' class='alt-danger' dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('profileEditDlg').removeSelected()\">".
- __('Remove selected profiles')."</button>
- <button dojoType='dijit.form.Button' class='alt-primary' type='submit' onclick=\"dijit.byId('profileEditDlg').activateProfile()\">".
- __('Activate profile')."</button>
- <button dojoType='dijit.form.Button' onclick=\"dijit.byId('profileEditDlg').hide()\">".
- __('Cancel')."</button>";
+ <button style='float : left' class='alt-danger' dojoType='dijit.form.Button' onclick='App.dialogOf(this).removeSelected()'>".
+ __('Remove selected profiles')."</button>
+ <button dojoType='dijit.form.Button' class='alt-primary' type='submit' onclick='App.dialogOf(this).execute()'>".
+ __('Activate profile')."</button>
+ <button dojoType='dijit.form.Button' onclick='App.dialogOf(this).hide()'>".
+ __('Cancel')."</button>";
print "</footer>";
+ print "</form>";
+
}
private function getShortDesc($pref_name) {
diff --git a/classes/pref/users.php b/classes/pref/users.php
index 67daa884f..16c2d3142 100644
--- a/classes/pref/users.php
+++ b/classes/pref/users.php
@@ -110,9 +110,9 @@ class Pref_Users extends Handler_Protected {
print '</div>';
print "<footer>
- <button dojoType='dijit.form.Button' class='alt-primary' type='submit' onclick=\"dijit.byId('userEditDlg').execute()\">".
+ <button dojoType='dijit.form.Button' class='alt-primary' type='submit' onclick='App.dialogOf(this).execute()'>".
__('Save')."</button>
- <button dojoType='dijit.form.Button' onclick=\"dijit.byId('userEditDlg').hide()\">".
+ <button dojoType='dijit.form.Button' onclick='App.dialogOf(this).hide()'>".
__('Cancel')."</button>
</footer>";