From c23c9691032011442332800d42ae8003404515d7 Mon Sep 17 00:00:00 2001 From: Jared Hancock <jared@osticket.com> Date: Wed, 20 Nov 2013 23:34:04 -0600 Subject: [PATCH] Fix image corruption on FAQ save Fixes #198 --- include/ajax.kbase.php | 2 +- include/class.faq.php | 3 ++- include/client/faq.inc.php | 2 +- include/staff/faq-view.inc.php | 2 +- include/staff/faq.inc.php | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/include/ajax.kbase.php b/include/ajax.kbase.php index 1e642847b..c6bbd3156 100644 --- a/include/ajax.kbase.php +++ b/include/ajax.kbase.php @@ -78,7 +78,7 @@ class KbaseAjaxAPI extends AjaxController { <hr> <a href="faq.php?id=%d">View</a> | <a href="faq.php?id=%d">Attachments (%s)</a>', $faq->getQuestion(), - $faq->getAnswer(), + $faq->getAnswerWithImages(), Format::db_daydatetime($faq->getUpdateDate()), $faq->getId(), $faq->getId(), diff --git a/include/class.faq.php b/include/class.faq.php index 159a423bb..d009d58c3 100644 --- a/include/class.faq.php +++ b/include/class.faq.php @@ -59,7 +59,8 @@ class FAQ { function getHashtable() { return $this->ht; } function getKeywords() { return $this->ht['keywords']; } function getQuestion() { return $this->ht['question']; } - function getAnswer() { + function getAnswer() { return $this->ht['answer']; } + function getAnswerWithImages() { return Format::viewableImages($this->ht['answer'], ROOT_PATH.'image.php'); } function getNotes() { return $this->ht['notes']; } diff --git a/include/client/faq.inc.php b/include/client/faq.inc.php index a588eff5f..9dc70af78 100644 --- a/include/client/faq.inc.php +++ b/include/client/faq.inc.php @@ -15,7 +15,7 @@ $category=$faq->getCategory(); <div style="float:right;text-align:right;padding-top:5px;padding-right:5px;"></div> <div class="clear"></div> <p> -<?php echo Format::safe_html($faq->getAnswer()); ?> +<?php echo Format::safe_html($faq->getAnswerWithImages()); ?> </p> <p> <?php diff --git a/include/staff/faq-view.inc.php b/include/staff/faq-view.inc.php index 514eca3f0..f505e612f 100644 --- a/include/staff/faq-view.inc.php +++ b/include/staff/faq-view.inc.php @@ -24,7 +24,7 @@ if($thisstaff->canManageFAQ()) { </div> <div class="clear"></div> <div class="thread-body"> -<?php echo $faq->getAnswer(); ?> +<?php echo $faq->getAnswerWithImages(); ?> </div> <div class="clear"></div> <p> diff --git a/include/staff/faq.inc.php b/include/staff/faq.inc.php index e700bd429..476cf5b0a 100644 --- a/include/staff/faq.inc.php +++ b/include/staff/faq.inc.php @@ -9,7 +9,7 @@ if($faq){ $info=$faq->getHashtable(); $info['id']=$faq->getId(); $info['topics']=$faq->getHelpTopicsIds(); - $info['answer']=$faq->getAnswer(); + $info['answer']=Format::viewableImages($faq->getAnswer()); $info['notes']=Format::viewableImages($faq->getNotes()); $qstr='id='.$faq->getId(); }else { -- GitLab