$form->addElement($ele); // Adjuntar Archivos if ($forum->attachments() && $forum->isAllowed($xoopsUser ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS, 'attach')) { $forma = new RMForm('<a name="attachments"></a>' . __('Attached Files', 'bxpress'), 'frmAttach', 'edit.php'); $forma->addElement(new RMFormSubTitle(sprintf(__('You can upload new files to this post. You have a limit of <strong>%s</strong> attachment per post.', 'bxpress'), $xoopsModuleConfig['attachlimit']), 1, 'even')); if ($post->totalAttachments() < $xoopsModuleConfig['attachlimit']) { $ele = new RMFormFile(__('Attach File:', 'bxpress'), 'attach', 45, $xoopsModuleConfig['maxfilesize'] * 1024); $ele->setDescription(sprintf(__('Allowed File Types: %s', 'bxpress'), implode(',', $forum->extensions()))); $forma->addElement($ele, true); $forma->setExtra('enctype="multipart/form-data"'); } // Lista de Archivos Adjuntos $list = new RMFormCheck(__('Cuerrent Attachments', 'bxpress')); $list->asTable(1); foreach ($post->attachments() as $file) { $list->addOption("<img src='" . $file->getIcon() . "' align='absmiddle' /> " . $file->name() . " (" . RMUtilities::formatBytesSize($file->size()) . ")", 'files[]', $file->id()); } $forma->addElement($list); $ele = new RMFormButtonGroup(); if ($post->totalAttachments() < $xoopsModuleConfig['attachlimit']) { $ele->addButton('upload', __('Upload File', 'bxpress'), 'submit'); } $ele->addButton('delete', __('Delete File(s)', 'bxpress'), 'button', 'onclick="document.forms[\'frmAttach\'].op.value=\'delete\'; submit();"'); $ele->addButton('cancel', __('Cancel', 'bxpress'), 'button', 'onclick="window.location = \'topic.php?pid=' . $post->id() . '#p' . $post->id() . '\'";'); $forma->addElement($ele); $forma->addElement(new RMFormHidden('op', 'upload')); $forma->addElement(new RMFormHidden('id', $id)); } $tpl->assign('topic_form', $form->render() . "<br />" . $forma->render()); $tpl->assign('lang_topicreview', __('Topic Review (Newest First)', 'bxpress')); include 'footer.php';
* @desc Archivo para procesar la entrega de archivos adjuntos */ define('BB_LOCATION', 'files'); include '../../mainfile.php'; $id = rmc_server_var($_GET, 'id', 0); $topic = rmc_server_var($_GET, 'topic', 0); if ($id <= 0) { redirect_header('topic.php?id=' . $topic, 2, __('No topic has been specified!', 'bxpress')); die; } $attach = new bXAttachment($id); if ($attach->isNew()) { redirect_header('topic.php?id=' . $topic, 2, __('Specified file does not exists!', 'bxpress')); die; } if (!file_exists(XOOPS_UPLOAD_PATH . '/bxpress/' . $attach->file())) { redirect_header('topics.php', 2, __('Specified file does not exists!', 'bxpress')); die; } $ext = substr($attach->file(), strrpos($attach->file(), '.')); header('Content-type: ' . $attach->mime()); header('Cache-control: no-store'); header('Expires: 0'); header('Content-disposition: attachment; filename=' . urlencode($attach->name() . $ext)); header('Content-Transfer-Encoding: binary'); header('Content-Lenght: ' . filesize(XOOPS_UPLOAD_PATH . '/bxpress/' . $attach->file())); header('Last-Modified: ' . gmdate("D, d M Y H:i:s", filemtime(XOOPS_UPLOAD_PATH . '/bxpress/' . $attach->file())) . 'GMT'); ob_clean(); flush(); readfile(XOOPS_UPLOAD_PATH . '/bxpress/' . $attach->file()); exit;