]> git.wh0rd.org - tt-rss.git/blobdiff - modules/backend-rpc.php
replace old-style published feed with universal secretkey-based approach used for...
[tt-rss.git] / modules / backend-rpc.php
index 4a82a888bcd0b2d193c4bce50ec72b5185e3dd28..1bf41d29916feb31ba096e6ae13d566b988bfead 100644 (file)
                        return;
                }
 
-               if ($subop == "regenPubKey") {
-
-                       print "<rpc-reply>";
-
-                       set_pref($link, "_PREFS_PUBLISH_KEY", generate_publish_key(), $_SESSION["uid"]);
-
-                       $new_link = article_publish_url($link);         
-
-                       print "<link><![CDATA[$new_link]]></link>";
-
-                       print "</rpc-reply>";
-
-                       return;
-               }
-
                if ($subop == "regenOPMLKey") {
 
                        print "<rpc-reply>";
-                       set_pref($link, " _PREFS_OPML_PUBLISH_KEY", generate_publish_key(), $_SESSION["uid"]);
+                       set_pref($link, " _PREFS_OPML_PUBLISH_KEY", 
+                               sha1(uniqid(rand(), true)), $_SESSION["uid"]);
                        $new_link = opml_publish_url($link);            
                        print "<link><![CDATA[$new_link]]></link>";
                        print "</rpc-reply>";
                        return;
                }
 
+               if ($subop == "regenFeedKey") {
+                       $feed_id = db_escape_string($_REQUEST['id']);
+                       $is_cat = (bool) db_escape_string($_REQUEST['is_cat']);
+
+                       print "<rpc-reply>";
+
+                       $new_key = update_feed_access_key($link, $feed_id, $is_cat);
+
+                       print "<link><![CDATA[$new_key]]></link>";
+
+                       print "</rpc-reply>";
+
+                       return;
+               }
+
                print "<rpc-reply><error>Unknown method: $subop</error></rpc-reply>";
        }
 ?>