From 0db11ec513d138a1f63a520af446d492f20a22ed Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Wed, 16 Apr 2014 11:36:10 -0500
Subject: [PATCH] oops: Fixup incorrect inline attachment tagging

This occurs for attachments added via the staff or client web interfaces
---
 include/class.thread.php | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/class.thread.php b/include/class.thread.php
index 05d8f67b4..cd3f8f9cd 100644
--- a/include/class.thread.php
+++ b/include/class.thread.php
@@ -532,6 +532,8 @@ Class ThreadEntry {
         if(!($fileId=is_numeric($file)?$file:AttachmentFile::save($file)))
             return 0;
 
+        $inline = is_array($file) && @$file['inline'];
+
         // TODO: Add a unique index to TICKET_ATTACHMENT_TABLE (file_id,
         // ref_id), and remove this block
         if ($id = db_result(db_query('SELECT attach_id FROM '.TICKET_ATTACHMENT_TABLE
@@ -542,7 +544,7 @@ Class ThreadEntry {
         $sql ='INSERT IGNORE INTO '.TICKET_ATTACHMENT_TABLE.' SET created=NOW() '
              .' ,file_id='.db_input($fileId)
              .' ,ticket_id='.db_input($this->getTicketId())
-             .' ,inline='.db_input(@$file['inline'] ? 1 : 0)
+             .' ,inline='.db_input($inline ? 1 : 0)
              .' ,ref_id='.db_input($this->getId());
 
         return (db_query($sql) && ($id=db_insert_id()))?$id:0;
-- 
GitLab