mContentId = $_REQUEST['content_id']; } if (isset($_FILES['upload'])) { if (!$gContent->storeAttachments($_REQUEST, FALSE)) { $gBitSmarty->assign('errors', $gContent->mErrors); } elseif (empty($gContent->mContentId)) { // Fake it for preflight $gContent->mStorage[$_REQUEST['attachment_id']] = $gContent->getAttachment($_REQUEST['attachment_id']); } } // load the attachments up if (!empty($gContent->mContentId)) { $gContent->load(); } elseif (!empty($_REQUEST['existing_attachment_id'])) { // Fake it for preflight foreach( $_REQUEST['existing_attachment_id'] as $id) { if (!empty($id)) { $gContent->mStorage[$id] = $gContent->getAttachment($id); } } } // Make them come out in the right order if (!empty($gContent->mStorage)) { ksort($gContent->mStorage); } $gBitSmarty->assign('gContent', $gContent); $gBitSmarty->assign('libertyUploader', true); echo $gBitSmarty->display('bitpackage:liberty/attachment_uploader.tpl'); ?>