From: Andrew Dolgov Date: Fri, 24 Oct 2008 04:41:01 +0000 (+0100) Subject: i can haz cheeseburger (display linked image attachments inline when no images are... X-Git-Tag: 1.2.29~19 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=9c5ee7e11b1ee73c9b1622c508c7d483962c3d8e;p=tt-rss.git i can haz cheeseburger (display linked image attachments inline when no images are detected in the article) --- diff --git a/functions.php b/functions.php index 1708dad6..180654c0 100644 --- a/functions.php +++ b/functions.php @@ -4752,14 +4752,8 @@ post_id = '$id' AND content_url != ''"); if (db_num_rows($result) > 0) { - print "
"; - - if (db_num_rows($result) == 1) { - print __("Attachment:") . " "; - } else { - print __("Attachments:") . " "; - } + $entries_html = array(); $entries = array(); while ($line = db_fetch_assoc($result)) { @@ -4783,10 +4777,43 @@ $entry .= "" . $filename . " (" . $ctype . ")" . ""; + 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"]) && + preg_match("/image/", $entries[0]["type"])) { + + } + + print "
"; + + if (!preg_match("/img/i", $line["content"])) { + foreach ($entries as $entry) { + if (preg_match("/image/", $entry["type"])) { + print "

\"".htmlspecialchars($entry["filename"])."\"

"; + } + } + } + + print "
"; + + if (db_num_rows($result) == 1) { + print __("Attachment:") . " "; + } else { + print __("Attachments:") . " "; + } + + print join(", ", $entries_html); print "
"; }