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 { ...@@ -180,9 +180,7 @@ class FAQ {
// Inline images (attached to the draft) // Inline images (attached to the draft)
$this->attachments->deleteInlines(); $this->attachments->deleteInlines();
if (isset($vars['draft_id']) && $vars['draft_id']) $this->attachments->upload(Draft::getAttachmentIds($vars['answer']));
if ($draft = Draft::lookup($vars['draft_id']))
$this->attachments->upload($draft->getAttachmentIds(), true);
$this->reload(); $this->reload();
......
...@@ -27,11 +27,9 @@ if($_POST) { ...@@ -27,11 +27,9 @@ if($_POST) {
$_REQUEST['a'] = null; $_REQUEST['a'] = null;
$msg='Page added successfully'; $msg='Page added successfully';
// Attach inline attachments from the editor // Attach inline attachments from the editor
if (isset($_POST['draft_id']) if ($page = Page::lookup($pageId))
&& ($draft = Draft::lookup($_POST['draft_id']))
&& ($page = Page::lookup($pageId)))
$page->attachments->upload( $page->attachments->upload(
$draft->getAttachmentIds($_POST['response']), true); Draft::getAttachmentIds($_POST['body']), true);
Draft::deleteForNamespace('page'); Draft::deleteForNamespace('page');
} elseif(!$errors['err']) } elseif(!$errors['err'])
$errors['err'] = 'Unable to add page. Try again!'; $errors['err'] = 'Unable to add page. Try again!';
...@@ -43,12 +41,10 @@ if($_POST) { ...@@ -43,12 +41,10 @@ if($_POST) {
$msg='Page updated successfully'; $msg='Page updated successfully';
$_REQUEST['a']=null; //Go back to view $_REQUEST['a']=null; //Go back to view
// Attach inline attachments from the editor // Attach inline attachments from the editor
if (isset($_POST['draft_id']) $page->attachments->deleteInlines();
&& ($draft = Draft::lookup($_POST['draft_id']))) { $page->attachments->upload(
$page->attachments->deleteInlines(); Draft::getAttachmentIds($_POST['body']),
$page->attachments->upload( true);
$draft->getAttachmentIds($_POST['response']),
true);
} }
Draft::deleteForNamespace('page.'.$page->getId()); Draft::deleteForNamespace('page.'.$page->getId());
} elseif(!$errors['err']) } elseif(!$errors['err'])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment