]> git.wh0rd.org - tt-rss.git/blobdiff - api/index.php
api: fix wrong sql syntax in getFeeds
[tt-rss.git] / api / index.php
index 60753e9caefa28c4bc53b3b00f0937832d806232..8e6400a008b0f3cc5ae020fb7e84c081be1c761a 100644 (file)
                                        id, feed_url, cat_id, title, ".
                                                SUBSTRING_FOR_DATE."(last_updated,1,19) AS last_updated
                                                FROM ttrss_feeds WHERE owner_uid = " . $_SESSION["uid"] . 
-                                               "ORDER BY cat_id, title " . $limit_qpart);
+                                               " ORDER BY cat_id, title " . $limit_qpart);
                        } else {
                                $result = db_query($link, "SELECT 
                                        id, feed_url, cat_id, title, ".
                                                SUBSTRING_FOR_DATE."(last_updated,1,19) AS last_updated
                                                FROM ttrss_feeds WHERE 
                                                cat_id = '$cat_id' AND owner_uid = " . $_SESSION["uid"] . 
-                                               "ORDER BY cat_id, title " . $limit_qpart);
+                                               " ORDER BY cat_id, title " . $limit_qpart);
                        }
 
                        $feeds = array();
                case "updateFeed":
                        $feed_id = db_escape_string($_REQUEST["feed_id"]);
 
-                       $result = db_query($link, 
-                               "SELECT feed_url FROM ttrss_feeds WHERE id = '$feed_id'
-                                       AND owner_uid = " . $_SESSION["uid"]);
-
-                       if (db_num_rows($result) > 0) {                 
-                               $feed_url = db_fetch_result($result, 0, "feed_url");
-                               update_rss_feed($link, $feed_url, $feed_id);
-                       }
+                       update_rss_feed($link, $feed_id, true);
 
                        print json_encode(array("status" => "OK"));