]> git.wh0rd.org Git - tt-rss.git/commitdiff
handle site_url in ttrss_feeds (and display in feed details)
authorAndrew Dolgov <fox@bah.spb.su>
Sun, 20 Nov 2005 07:38:10 +0000 (08:38 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Sun, 20 Nov 2005 07:38:10 +0000 (08:38 +0100)
backend.php
functions.php

index cd7d65c2d2a76f57c183ab5a857d9d0ccb1f49f3..9f328bf435ba0303a285743b9a0362cf08778f37 100644 (file)
 
                $result = db_query($link, 
                        "SELECT 
-                               title,feed_url,last_updated,icon_url,
+                               title,feed_url,last_updated,icon_url,site_url,
                                (SELECT COUNT(int_id) FROM ttrss_user_entries 
                                        WHERE feed_id = id) AS total,
                                (SELECT COUNT(int_id) FROM ttrss_user_entries 
                $total = db_fetch_result($result, 0, "total");
                $unread = db_fetch_result($result, 0, "unread");
                $marked = db_fetch_result($result, 0, "marked");
-
+               $site_url = db_fetch_result($result, 0, "site_url");
 
                $result = db_query($link, "SELECT COUNT(id) AS subscribed
                                        FROM ttrss_feeds WHERE feed_url = '$feed_url'");
 
                print "<table width='100%'>";
 
-               print "<tr><td width='30%'>Feed URL</td>
-                       <td><a href=\"$feed_url\">$feed_url</a></td></tr>";
+               if ($site_url) {
+                       print "<tr><td width='30%'>Link</td>
+                               <td><a href=\"$site_url\">$site_url</a>
+                               <a href=\"$feed_url\">(feed)</a></td>
+                               </td></tr>";
+               } else {
+                       print "<tr><td width='30%'>Feed URL</td>
+                               <td><a href=\"$feed_url\">$feed_url</a></td></tr>";
+               }
                print "<tr><td>Last updated</td><td>$last_updated</td></tr>";
                print "<tr><td>Total articles</td><td>$total</td></tr>";
                print "<tr><td>Unread articles</td><td>$unread</td></tr>";
index 37ad6c1d4ced94fb328faf4fa565ba8ab6b18dd0..77388106cf2098533a37a240915408c4721ecd1c 100644 (file)
                                check_feed_favicon($feed_url, $feed, $link);
                        }
                
-                       $result = db_query($link, "SELECT title,icon_url FROM ttrss_feeds WHERE id = '$feed'");
+                       $result = db_query($link, "SELECT title,icon_url,site_url 
+                               FROM ttrss_feeds WHERE id = '$feed'");
 
                        $registered_title = db_fetch_result($result, 0, "title");
                        $orig_icon_url = db_fetch_result($result, 0, "icon_url");
+                       $orig_site_url = db_fetch_result($result, 0, "site_url");
 
                        if (!$registered_title) {
                                $feed_title = db_escape_string($rss->channel["title"]);
-                               db_query($link, "UPDATE ttrss_feeds SET title = '$feed_title' WHERE id = '$feed'");
+                               db_query($link, "UPDATE ttrss_feeds SET 
+                                       title = '$feed_title' WHERE id = '$feed'");
+                       }
+
+                       if (!$orig_site_url && $rss->channel["link"]) {
+                               $site_url = db_escape_string($rss->channel["link"]);
+                               db_query($link, "UPDATE ttrss_feeds SET 
+                                       site_url = '$site_url' WHERE id = '$feed'");
                        }
 
 //                     print "I: " . $rss->channel["image"]["url"];