From 1c9bda915bb8a734af27cc3a2d2dd1cc16f2d5fd Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 1 Apr 2013 11:14:27 +0400 Subject: move several methods from dlg; fix displayed tags not updated after editing --- classes/article.php | 35 ++++++++- classes/dlg.php | 214 ---------------------------------------------------- classes/feeds.php | 185 ++++++++++++++++++++++++++++++++++++++++++++- classes/rpc.php | 4 +- 4 files changed, 220 insertions(+), 218 deletions(-) (limited to 'classes') diff --git a/classes/article.php b/classes/article.php index b10766bf5..79c94f59b 100644 --- a/classes/article.php +++ b/classes/article.php @@ -2,7 +2,7 @@ class Article extends Handler_Protected { function csrf_ignore($method) { - $csrf_ignored = array("redirect"); + $csrf_ignored = array("redirect", "editarticletags"); return array_search($method, $csrf_ignored) !== false; } @@ -174,6 +174,39 @@ class Article extends Handler_Protected { return $rc; } + function editArticleTags() { + + print __("Tags for this article (separated by commas):")."
"; + + $param = db_escape_string($this->link, $_REQUEST['param']); + + $tags = get_article_tags($this->link, db_escape_string($this->link, $param)); + + $tags_str = join(", ", $tags); + + print ""; + print ""; + print ""; + + print "
"; + + print " +
"; + + print "
"; + + print "
"; + + print " "; + print ""; + print "
"; + + } } diff --git a/classes/dlg.php b/classes/dlg.php index 90b0d6d6e..75cbbd74d 100644 --- a/classes/dlg.php +++ b/classes/dlg.php @@ -213,220 +213,6 @@ class Dlg extends Handler_Protected { //return; } - function quickAddFeed() { - print ""; - print ""; - - print "
".__("Feed or site URL")."
"; - print "
"; - - print "
-
"; - - print ""; - - print "
"; - - if (get_pref($this->link, 'ENABLE_FEED_CATS')) { - print __('Place in category:') . " "; - print_feed_cat_select($this->link, "cat", false, 'dojoType="dijit.form.Select"'); - } - - print "
"; - - print ''; - - print ""; - - - print "
- -
"; - - print ""; - - print "
- "; - - if (!(defined('_DISABLE_FEED_BROWSER') && _DISABLE_FEED_BROWSER)) { - print ""; - } - - print " -
"; - - //return; - } - - function feedBrowser() { - if (defined('_DISABLE_FEED_BROWSER') && _DISABLE_FEED_BROWSER) return; - - $browser_search = db_escape_string($this->link, $_REQUEST["search"]); - - print ""; - print ""; - - print "
-
- - - -
"; - - print " "; - - print __("limit:"); - - print " "; - - print "
"; - - $owner_uid = $_SESSION["uid"]; - - require_once "feedbrowser.php"; - - print ""; - - print "
- - -
"; - - } - - function search() { - $this->params = explode(":", db_escape_string($this->link, $_REQUEST["param"]), 2); - - $active_feed_id = sprintf("%d", $this->params[0]); - $is_cat = $this->params[1] != "false"; - - print "
".__('Look for')."
"; - - print "
"; - - print ""; - - print "
".__('Limit search to:')." "; - - print ""; - - print "
"; - - print "
"; - - if (!SPHINX_ENABLED) { - print "
- Search syntax -
"; - } - - print " - -
"; - } - - function editArticleTags() { - - print __("Tags for this article (separated by commas):")."
"; - - $tags = get_article_tags($this->link, $this->param); - - $tags_str = join(", ", $tags); - - print "param\">"; - print ""; - print ""; - - print "
"; - - print " -
"; - - print "
"; - - print "
"; - - print " "; - print ""; - print "
"; - - } - function printTagCloud() { print "
"; diff --git a/classes/feeds.php b/classes/feeds.php index a80ae4b3c..d2df94108 100644 --- a/classes/feeds.php +++ b/classes/feeds.php @@ -4,7 +4,7 @@ require_once "colors.php"; class Feeds extends Handler_Protected { function csrf_ignore($method) { - $csrf_ignored = array("index"); + $csrf_ignored = array("index", "feedbrowser", "quickaddfeed", "search"); return array_search($method, $csrf_ignored) !== false; } @@ -968,5 +968,188 @@ class Feeds extends Handler_Protected { return $reply; } + function quickAddFeed() { + print ""; + print ""; + + print "
".__("Feed or site URL")."
"; + print "
"; + + print "
+
"; + + print ""; + + print "
"; + + if (get_pref($this->link, 'ENABLE_FEED_CATS')) { + print __('Place in category:') . " "; + print_feed_cat_select($this->link, "cat", false, 'dojoType="dijit.form.Select"'); + } + + print "
"; + + print ''; + + print ""; + + + print "
+ +
"; + + print ""; + + print "
+ "; + + if (!(defined('_DISABLE_FEED_BROWSER') && _DISABLE_FEED_BROWSER)) { + print ""; + } + + print " +
"; + + //return; + } + + function feedBrowser() { + if (defined('_DISABLE_FEED_BROWSER') && _DISABLE_FEED_BROWSER) return; + + $browser_search = db_escape_string($this->link, $_REQUEST["search"]); + + print ""; + print ""; + + print "
+
+ + + +
"; + + print " "; + + print __("limit:"); + + print " "; + + print "
"; + + $owner_uid = $_SESSION["uid"]; + + require_once "feedbrowser.php"; + + print ""; + + print "
+ + +
"; + + } + + function search() { + $this->params = explode(":", db_escape_string($this->link, $_REQUEST["param"]), 2); + + $active_feed_id = sprintf("%d", $this->params[0]); + $is_cat = $this->params[1] != "false"; + + print "
".__('Look for')."
"; + + print "
"; + + print ""; + + print "
".__('Limit search to:')." "; + + print ""; + + print "
"; + + print "
"; + + if (!SPHINX_ENABLED) { + print "
+ Search syntax +
"; + } + + print " + +
"; + } + + } ?> diff --git a/classes/rpc.php b/classes/rpc.php index 3a20db6f3..34f623b06 100644 --- a/classes/rpc.php +++ b/classes/rpc.php @@ -407,8 +407,8 @@ class RPC extends Handler_Protected { if (!$tags_str_full) $tags_str_full = __("no tags"); - print json_encode(array("tags_str" => array("id" => $id, - "content" => $tags_str, "content_full" => $tags_str_full))); + print json_encode(array("id" => (int)$id, + "content" => $tags_str, "content_full" => $tags_str_full)); } function regenOPMLKey() { -- cgit v1.2.3-54-g00ecf