Skip to content
Snippets Groups Projects
Commit c0115967 authored by Peter Rotich's avatar Peter Rotich
Browse files

Merge pull request #1288 from greezybacon/oops/page-images


pages: Fix incorrect lookup of inline images

Reviewed-By: default avatarPeter Rotich <peter@osticket.com>
parents b4ecec0e eb4d1b36
No related branches found
No related tags found
No related merge requests found
......@@ -180,9 +180,7 @@ class FAQ {
// Inline images (attached to the draft)
$this->attachments->deleteInlines();
if (isset($vars['draft_id']) && $vars['draft_id'])
if ($draft = Draft::lookup($vars['draft_id']))
$this->attachments->upload($draft->getAttachmentIds(), true);
$this->attachments->upload(Draft::getAttachmentIds($vars['answer']));
$this->reload();
......
......@@ -27,11 +27,9 @@ if($_POST) {
$_REQUEST['a'] = null;
$msg='Page added successfully';
// Attach inline attachments from the editor
if (isset($_POST['draft_id'])
&& ($draft = Draft::lookup($_POST['draft_id']))
&& ($page = Page::lookup($pageId)))
if ($page = Page::lookup($pageId))
$page->attachments->upload(
$draft->getAttachmentIds($_POST['response']), true);
Draft::getAttachmentIds($_POST['body']), true);
Draft::deleteForNamespace('page');
} elseif(!$errors['err'])
$errors['err'] = 'Unable to add page. Try again!';
......@@ -43,12 +41,10 @@ if($_POST) {
$msg='Page updated successfully';
$_REQUEST['a']=null; //Go back to view
// Attach inline attachments from the editor
if (isset($_POST['draft_id'])
&& ($draft = Draft::lookup($_POST['draft_id']))) {
$page->attachments->deleteInlines();
$page->attachments->upload(
$draft->getAttachmentIds($_POST['response']),
true);
$page->attachments->deleteInlines();
$page->attachments->upload(
Draft::getAttachmentIds($_POST['body']),
true);
}
Draft::deleteForNamespace('page.'.$page->getId());
} elseif(!$errors['err'])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment