]> git.wh0rd.org - tt-rss.git/commitdiff
i can haz cheeseburger - enable for CDM
authorAndrew Dolgov <fox@madoka.spb.ru>
Fri, 24 Oct 2008 04:49:22 +0000 (05:49 +0100)
committerAndrew Dolgov <fox@madoka.spb.ru>
Fri, 24 Oct 2008 04:49:22 +0000 (05:49 +0100)
functions.php

index 180654c08ab6fecb244498b9ffe3aadac37a078b..f9c78bee3e1c78580cd505d071debdb717a7ead1 100644 (file)
                                                post_id = '$id' AND content_url != ''");
 
                                        if (db_num_rows($e_result) > 0) {
-                               print "<div class=\"cdmEnclosures\">";
-
-                               if (db_num_rows($e_result) == 1) {
-                                       print __("Attachment:") . " ";
-                               } else {
-                                       print __("Attachments:") . " ";
-                               }
 
+                               $entries_html = array();
                                $entries = array();
 
                                while ($e_line = db_fetch_assoc($e_result)) {
                                        $entry .= "<a target=\"_blank\" href=\"" . htmlspecialchars($url) . "\">" .
                                                $filename . " (" . $ctype . ")" . "</a>";
 
+                                       array_push($entries_html, $entry);
+
+                                       $entry = array();
+
+                                       $entry["type"] = $ctype;
+                                       $entry["filename"] = $filename;
+                                       $entry["url"] = $url;
+
                                        array_push($entries, $entry);
                                }
 
-                               print join(", ", $entries);
+                               if (!preg_match("/img/i", $line["content"])) {
+                                       foreach ($entries as $entry) {
+                                               if (preg_match("/image/", $entry["type"])) {
+                                                       print "<p><img 
+                                                               alt=\"".htmlspecialchars($entry["filename"])."\"
+                                                               src=\"" .htmlspecialchars($entry["url"]) . "\"></p>";
+                                               }
+                                       }
+                               }
+
+                               print "<div class=\"cdmEnclosures\">";
+
+                               if (db_num_rows($e_result) == 1) {
+                                       print __("Attachment:") . " ";
+                               } else {
+                                       print __("Attachments:") . " ";
+                               }
+
+                               print join(", ", $entries_html);
 
                                print "</div>";
                        }
 
+
                                        print "<br clear='both'>";
 //                                     print "</div>";