]> git.wh0rd.org Git - tt-rss.git/commitdiff
move url resolution before duplicate checks - otherwise we may get duplicates (refs...
authorChristian Weiske <cweiske@cweiske.de>
Tue, 9 Nov 2010 07:03:27 +0000 (08:03 +0100)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Wed, 10 Nov 2010 04:15:47 +0000 (07:15 +0300)
functions.php

index c4d033bc20a653cdb3a0ef198a06b4ee77a447cf..fa97d04f9bbe3cab314fee7abc362d4bbc158f54 100644 (file)
                $url = fix_url($url);
                if (!validate_feed_url($url)) return 2;
 
+               if (url_is_html($url)) {
+                       $feedUrls = get_feeds_from_html($url);
+                       if (count($feedUrls) != 1) {
+                               return 3;
+                       }
+                       //use feed url as new URL
+                       $url = key($feedUrls);
+               }
+
                if ($cat_id == "0" || !$cat_id) {
                        $cat_qpart = "NULL";
                } else {
                        WHERE feed_url = '$url' AND owner_uid = ".$_SESSION["uid"]);
        
                if (db_num_rows($result) == 0) {
-                       if (url_is_html($url)) {
-                               $feedUrls = get_feeds_from_html($url);
-                               if (count($feedUrls) != 1) {
-                                       return 3;
-                               }
-                               //use feed url as new URL
-                               $url = key($feedUrls);
-                       }
-                       
                        $result = db_query($link,
                                "INSERT INTO ttrss_feeds 
                                        (owner_uid,feed_url,title,cat_id, auth_login,auth_pass)