]> git.wh0rd.org Git - tt-rss.git/commitdiff
do not display empty attachments
authorAndrew Dolgov <fox@madoka.spb.ru>
Wed, 20 Feb 2008 05:52:07 +0000 (06:52 +0100)
committerAndrew Dolgov <fox@madoka.spb.ru>
Wed, 20 Feb 2008 05:52:07 +0000 (06:52 +0100)
functions.php

index 591819adf2a152c1ae4e644fce0b94dc4f60d5f3..3e6c0bcb1eb68992f343918cf3fdc0831a630cec 100644 (file)
                        print $line["content"];
 
                        $result = db_query($link, "SELECT * FROM ttrss_enclosures WHERE
-                               post_id = '$id'");
+                               post_id = '$id' AND content_url != ''");
 
                        if (db_num_rows($result) > 0) {
                                print "<div class=\"postEnclosures\">";
                                while ($line = db_fetch_assoc($result)) {
 
                                        $url = $line["content_url"];
+                                       $ctype = $line["content_type"];
+
+                                       if (!$ctype) $ctype = __("unknown type");
 
                                        $filename = substr($url, strrpos($url, "/")+1);
 
                                        $entry = "<a target=\"_blank\" href=\"" . htmlspecialchars($url) . "\">" .
-                                               $filename . " (" . $line["content_type"] . ")" . "</a>";
+                                               $filename . " (" . $ctype . ")" . "</a>";
 
                                        array_push($entries, $entry);
                                }
                                        print $line["content_preview"];
 
                                        $e_result = db_query($link, "SELECT * FROM ttrss_enclosures WHERE
-                                               post_id = '$id'");
+                                               post_id = '$id' AND content_url != ''");
 
                                        if (db_num_rows($e_result) > 0) {
                                print "<div class=\"cdmEnclosures\">";
                                while ($e_line = db_fetch_assoc($e_result)) {
 
                                        $url = $e_line["content_url"];
+                                       $ctype = $e_line["content_type"];
+                                       if (!$ctype) $ctype = __("unknown type");
 
                                        $filename = substr($url, strrpos($url, "/")+1);
 
                                        $entry = "<a target=\"_blank\" href=\"" . htmlspecialchars($url) . "\">" .
-                                               $filename . " (" . $e_line["content_type"] . ")" . "</a>";
+                                               $filename . " (" . $ctype . ")" . "</a>";
 
                                        array_push($entries, $entry);
                                }