}
}
- function subscribe2() {
- $feed_url = $this->dbh->escape_string(trim($_REQUEST["feed_url"]));
- $cat_id = $this->dbh->escape_string($_REQUEST["cat_id"]);
- /* $from = $this->dbh->escape_string($_REQUEST["from"]); */
- $feed_urls = array();
-
- /* only read authentication information from POST */
-
- $auth_login = $this->dbh->escape_string(trim($_POST["auth_login"]));
- $auth_pass = $this->dbh->escape_string(trim($_POST["auth_pass"]));
-
- $rc = subscribe_to_feed($feed_url, $cat_id, $auth_login, $auth_pass);
-
- switch ($rc) {
- case 1:
- print_notice(T_sprintf("Subscribed to <b>%s</b>.", $feed_url));
- break;
- case 2:
- print_error(T_sprintf("Could not subscribe to <b>%s</b>.", $feed_url));
- break;
- case 3:
- print_error(T_sprintf("No feeds found in <b>%s</b>.", $feed_url));
- break;
- case 0:
- print_warning(T_sprintf("Already subscribed to <b>%s</b>.", $feed_url));
- break;
- case 4:
- print_notice(__("Multiple feed URLs found."));
- $contents = @fetch_file_contents($url, false, $auth_login, $auth_pass);
- if (is_html($contents)) {
- $feed_urls = get_feeds_from_html($url, $contents);
- }
- break;
- case 5:
- print_error(T_sprintf("Could not subscribe to <b>%s</b>.<br>Can't download the Feed URL.", $feed_url));
- break;
- }
-
- if ($feed_urls) {
- print "<form action=\"backend.php\">";
- print "<input type=\"hidden\" name=\"op\" value=\"pref-feeds\">";
- print "<input type=\"hidden\" name=\"quiet\" value=\"1\">";
- print "<input type=\"hidden\" name=\"method\" value=\"add\">";
-
- print "<select name=\"feed_url\">";
-
- foreach ($feed_urls as $url => $name) {
- $url = htmlspecialchars($url);
- $name = htmlspecialchars($name);
- print "<option value=\"$url\">$name</option>";
- }
-
- print "<input type=\"submit\" value=\"".__("Subscribe to selected feed")."\">";
- print "</form>";
- }
-
- $tp_uri = get_self_url_prefix() . "/prefs.php";
- $tt_uri = get_self_url_prefix();
-
- if ($rc <= 2){
- $result = $this->dbh->query("SELECT id FROM ttrss_feeds WHERE
- feed_url = '$feed_url' AND owner_uid = " . $_SESSION["uid"]);
-
- $feed_id = $this->dbh->fetch_result($result, 0, "id");
- } else {
- $feed_id = 0;
- }
-
- print "<p>";
-
- if ($feed_id) {
- print "<form method=\"GET\" style='display: inline'
- action=\"$tp_uri\">
- <input type=\"hidden\" name=\"tab\" value=\"feedConfig\">
- <input type=\"hidden\" name=\"method\" value=\"editFeed\">
- <input type=\"hidden\" name=\"methodparam\" value=\"$feed_id\">
- <input type=\"submit\" value=\"".__("Edit subscription options")."\">
- </form>";
- }
-
- print "<form style='display: inline' method=\"GET\" action=\"$tt_uri\">
- <input type=\"submit\" value=\"".__("Return to Tiny Tiny RSS")."\">
- </form></p>";
-
- print "</body></html>";
- }
-
function index() {
header("Content-Type: text/plain");
print json_encode(array("error" => array("code" => 7)));