Example #1
0
 function getBody($mid)
 {
     global $cfg;
     if ($cfg->isHtmlThreadEnabled()) {
         if ($html = $this->getPart($mid, 'text/html', $this->charset)) {
             $body = new HtmlThreadBody($html);
         } elseif ($text = $this->getPart($mid, 'text/plain', $this->charset)) {
             $body = new TextThreadBody($text);
         }
     } elseif ($text = $this->getPart($mid, 'text/plain', $this->charset)) {
         $body = new TextThreadBody($text);
     } elseif ($html = $this->getPart($mid, 'text/html', $this->charset)) {
         $body = new TextThreadBody(Format::html2text(Format::safe_html($html), 100, false));
     }
     if (!isset($body)) {
         $body = new TextThreadBody('');
     }
     if ($cfg->stripQuotedReply()) {
         $body->stripQuotedReply($cfg->getReplySeparator());
     }
     return $body;
 }
 function setBody($body)
 {
     global $cfg;
     if (!$body instanceof ThreadBody) {
         if ($cfg->isHtmlThreadEnabled()) {
             $body = new HtmlThreadBody($body);
         } else {
             $body = new TextThreadBody($body);
         }
     }
     $sql = 'UPDATE ' . TICKET_THREAD_TABLE . ' SET updated=NOW()' . ',format=' . db_input($body->getType()) . ',body=' . db_input((string) $body) . ' WHERE id=' . db_input($this->getId());
     return db_query($sql) && db_affected_rows();
 }