diff --git a/include/ajax.draft.php b/include/ajax.draft.php index 37df05f77be8841300f27835e45be0537af7abd5..0caaeeb7bb497cbd06ca7a4e83b860f16232ec0b 100644 --- a/include/ajax.draft.php +++ b/include/ajax.draft.php @@ -256,7 +256,7 @@ class DraftAjaxAPI extends AjaxController { $sql = 'SELECT distinct f.id, COALESCE(a.type, f.ft) FROM '.FILE_TABLE .' f LEFT JOIN '.ATTACHMENT_TABLE.' a ON (a.file_id = f.id) - WHERE (a.`type` IN (\'C\', \'F\', \'T\') OR f.ft = \'L\') + WHERE (a.`type` IN (\'C\', \'F\', \'T\', \'P\') OR f.ft = \'L\') AND f.`type` LIKE \'image/%\''; if (!($res = db_query($sql))) Http::response(500, 'Unable to lookup files'); @@ -267,6 +267,7 @@ class DraftAjaxAPI extends AjaxController { 'F' => 'FAQ Articles', 'T' => 'Email Templates', 'L' => 'Logos', + 'P' => 'Pages', ); while (list($id, $type) = db_fetch_row($res)) { $f = AttachmentFile::lookup($id); diff --git a/include/class.page.php b/include/class.page.php index c6e6329d57fb869f8668291ee9116f1ace4d90c1..f0ada9a6c077dfa1099a55d64867a82cb294c501 100644 --- a/include/class.page.php +++ b/include/class.page.php @@ -70,7 +70,7 @@ class Page { return $this->ht['body']; } function getBodyWithImages() { - return Format::viewableImages($this->getBody()); + return Format::viewableImages($this->getBody(), ROOT_PATH.'image.php'); } function getNotes() { diff --git a/scp/pages.php b/scp/pages.php index ee3af72dbe8d296200dd87f79d4acd8f420dff45..87b260d2371b259162a95b980b610e8d2e035799 100644 --- a/scp/pages.php +++ b/scp/pages.php @@ -28,8 +28,9 @@ if($_POST) { $msg='Page added successfully'; // Attach inline attachments from the editor if (isset($_POST['draft_id']) - && ($draft = Draft::lookup($_POST['draft_id']))) - $c->attachments->upload( + && ($draft = Draft::lookup($_POST['draft_id'])) + && ($page = Page::lookup($pageId))) + $page->attachments->upload( $draft->getAttachmentIds($_POST['response']), true); Draft::deleteForNamespace('page'); } elseif(!$errors['err'])