From 8956b3a607be2d0a28704713d6a5d915e6c82fd3 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 2 Apr 2013 14:36:00 +0400 Subject: remove obsolete checkDate stuff --- js/functions.js | 50 -------------------------------------------------- 1 file changed, 50 deletions(-) (limited to 'js/functions.js') diff --git a/js/functions.js b/js/functions.js index 0b39cc466..560742598 100644 --- a/js/functions.js +++ b/js/functions.js @@ -548,28 +548,6 @@ function fatalError(code, msg, ext_info) { } } -/* function filterDlgCheckType(sender) { - - try { - - var ftype = sender.value; - - // if selected filter type is 5 (Date) enable the modifier dropbox - if (ftype == 5) { - Element.show("filterDlg_dateModBox"); - Element.show("filterDlg_dateChkBox"); - } else { - Element.hide("filterDlg_dateModBox"); - Element.hide("filterDlg_dateChkBox"); - - } - - } catch (e) { - exception_error("filterDlgCheckType", e); - } - -} */ - function filterDlgCheckAction(sender) { try { @@ -603,34 +581,6 @@ function filterDlgCheckAction(sender) { } -function filterDlgCheckDate() { - try { - var dialog = dijit.byId("filterEditDlg"); - - var reg_exp = dialog.attr('value').reg_exp; - - var query = "?op=rpc&method=checkDate&date=" + reg_exp; - - new Ajax.Request("backend.php", { - parameters: query, - onComplete: function(transport) { - - var reply = JSON.parse(transport.responseText); - - if (reply['result'] == true) { - alert(__("Date syntax appears to be correct:") + " " + reply['date']); - return; - } else { - alert(__("Date syntax is incorrect.")); - } - - } }); - - - } catch (e) { - exception_error("filterDlgCheckDate", e); - } -} function explainError(code) { return displayDlg(__("Error explained"), "explainError", code); -- cgit v1.2.3-54-g00ecf From 195187c4903583846edbd58516809ae743bd110e Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 2 Apr 2013 14:47:43 +0400 Subject: rpc: move several feed-related calls to pref-feeds --- classes/pref/feeds.php | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ classes/rpc.php | 47 ----------------------------------------------- js/functions.js | 2 +- js/prefs.js | 4 ++-- 4 files changed, 52 insertions(+), 50 deletions(-) (limited to 'js/functions.js') diff --git a/classes/pref/feeds.php b/classes/pref/feeds.php index aa018ee10..7fb64623e 100644 --- a/classes/pref/feeds.php +++ b/classes/pref/feeds.php @@ -1834,5 +1834,54 @@ class Pref_Feeds extends Handler_Protected { } } + function regenOPMLKey() { + $this->update_feed_access_key($this->link, 'OPML:Publish', + false, $_SESSION["uid"]); + + $new_link = Opml::opml_publish_url($this->link); + + print json_encode(array("link" => $new_link)); + } + + function regenFeedKey() { + $feed_id = db_escape_string($this->link, $_REQUEST['id']); + $is_cat = db_escape_string($this->link, $_REQUEST['is_cat']) == "true"; + + $new_key = $this->update_feed_access_key($this->link, $feed_id, $is_cat); + + print json_encode(array("link" => $new_key)); + } + + + private function update_feed_access_key($link, $feed_id, $is_cat, $owner_uid = false) { + if (!$owner_uid) $owner_uid = $_SESSION["uid"]; + + $sql_is_cat = bool_to_sql_bool($is_cat); + + $result = db_query($link, "SELECT access_key FROM ttrss_access_keys + WHERE feed_id = '$feed_id' AND is_cat = $sql_is_cat + AND owner_uid = " . $owner_uid); + + if (db_num_rows($result) == 1) { + $key = db_escape_string($this->link, sha1(uniqid(rand(), true))); + + db_query($link, "UPDATE ttrss_access_keys SET access_key = '$key' + WHERE feed_id = '$feed_id' AND is_cat = $sql_is_cat + AND owner_uid = " . $owner_uid); + + return $key; + + } else { + return get_feed_access_key($link, $feed_id, $is_cat, $owner_uid); + } + } + + // Silent + function clearKeys() { + db_query($this->link, "DELETE FROM ttrss_access_keys WHERE + owner_uid = " . $_SESSION["uid"]); + } + + } ?> diff --git a/classes/rpc.php b/classes/rpc.php index d61b2891a..3593bd5d8 100644 --- a/classes/rpc.php +++ b/classes/rpc.php @@ -411,15 +411,6 @@ class RPC extends Handler_Protected { "content" => $tags_str, "content_full" => $tags_str_full)); } - function regenOPMLKey() { - $this->update_feed_access_key($this->link, 'OPML:Publish', - false, $_SESSION["uid"]); - - $new_link = Opml::opml_publish_url($this->link); - - print json_encode(array("link" => $new_link)); - } - function completeLabels() { $search = db_escape_string($this->link, $_REQUEST["search"]); @@ -609,21 +600,6 @@ class RPC extends Handler_Protected { print_feed_cat_select($this->link, "cat_id", $id); } - function regenFeedKey() { - $feed_id = db_escape_string($this->link, $_REQUEST['id']); - $is_cat = db_escape_string($this->link, $_REQUEST['is_cat']) == "true"; - - $new_key = $this->update_feed_access_key($this->link, $feed_id, $is_cat); - - print json_encode(array("link" => $new_key)); - } - - // Silent - function clearKeys() { - db_query($this->link, "DELETE FROM ttrss_access_keys WHERE - owner_uid = " . $_SESSION["uid"]); - } - // Silent function clearArticleKeys() { db_query($this->link, "UPDATE ttrss_user_entries SET uuid = '' WHERE @@ -716,29 +692,6 @@ class RPC extends Handler_Protected { } - function update_feed_access_key($link, $feed_id, $is_cat, $owner_uid = false) { - if (!$owner_uid) $owner_uid = $_SESSION["uid"]; - - $sql_is_cat = bool_to_sql_bool($is_cat); - - $result = db_query($link, "SELECT access_key FROM ttrss_access_keys - WHERE feed_id = '$feed_id' AND is_cat = $sql_is_cat - AND owner_uid = " . $owner_uid); - - if (db_num_rows($result) == 1) { - $key = db_escape_string($this->link, sha1(uniqid(rand(), true))); - - db_query($link, "UPDATE ttrss_access_keys SET access_key = '$key' - WHERE feed_id = '$feed_id' AND is_cat = $sql_is_cat - AND owner_uid = " . $owner_uid); - - return $key; - - } else { - return get_feed_access_key($link, $feed_id, $is_cat, $owner_uid); - } - } - private function markArticlesById($link, $ids, $cmode) { $tmp_ids = array(); diff --git a/js/functions.js b/js/functions.js index 560742598..4e4d03557 100644 --- a/js/functions.js +++ b/js/functions.js @@ -1357,7 +1357,7 @@ function genUrlChangeKey(feed, is_cat) { notify_progress("Trying to change address...", true); - var query = "?op=rpc&method=regenFeedKey&id=" + param_escape(feed) + + var query = "?op=pref-feeds&method=regenFeedKey&id=" + param_escape(feed) + "&is_cat=" + param_escape(is_cat); new Ajax.Request("backend.php", { diff --git a/js/prefs.js b/js/prefs.js index 358625e93..b4ecd2584 100644 --- a/js/prefs.js +++ b/js/prefs.js @@ -1221,7 +1221,7 @@ function opmlRegenKey() { notify_progress("Trying to change address...", true); - var query = "?op=rpc&method=regenOPMLKey"; + var query = "?op=pref-feeds&method=regenOPMLKey"; new Ajax.Request("backend.php", { parameters: query, @@ -1521,7 +1521,7 @@ function clearFeedAccessKeys() { if (ok) { notify_progress("Clearing URLs..."); - var query = "?op=rpc&method=clearKeys"; + var query = "?op=pref-feeds&method=clearKeys"; new Ajax.Request("backend.php", { parameters: query, -- cgit v1.2.3-54-g00ecf