} $error_upload = ''; if (isset($_FILES['userfile']['name']) && $_FILES['userfile']['name'] != '') { $maxfilesize = $forum_obj->getVar('attach_maxkb') * 1024; $uploaddir = XOOPS_CACHE_PATH; require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar("dirname", "n") . '/class/uploader.php'; $uploader = new newbb_uploader($uploaddir, $forum_obj->getVar('attach_ext'), $maxfilesize, 2400, 1800); $uploader->setCheckMediaTypeByExt(); if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) { $prefix = is_object($xoopsUser) ? strval($xoopsUser->uid()) . '_' : 'newbb_'; $uploader->setPrefix($prefix); if (!$uploader->upload()) { $error_message[] = $error_upload = $uploader->getErrors(); } else { if (is_file($uploader->getSavedDestination())) { $attachments_tmp[strval(time())] = array($uploader->getSavedFileName(), $uploader->getMediaName(), $uploader->getMediaType()); } } } else { $error_message[] = $error_upload = $uploader->getErrors(); } } } if (!empty($_POST['contents_preview']) || !empty($_GET['contents_preview'])) { if (!empty($_POST["attachments_tmp"])) { $attachments_tmp = unserialize(base64_decode($_POST["attachments_tmp"])); } $p_subject = $myts->htmlSpecialChars($myts->stripSlashesGPC($_POST['subject'])); $dosmiley = empty($_POST['dosmiley']) ? 0 : 1; $dohtml = empty($_POST['dohtml']) ? 0 : 1; $doxcode = empty($_POST['doxcode']) ? 0 : 1;
$forumpost->setAttachment(); $error_upload = ''; if (isset($_FILES['userfile']['name']) && $_FILES['userfile']['name'] != '') { $maxfilesize = $forum->getVar('attach_maxkb') * 1024; $uploaddir = XOOPS_ROOT_PATH . "/" . $xoopsModuleConfig['dir_attachments']; $url = XOOPS_URL . "/" . $xoopsModuleConfig['dir_attachments'] . "/" . $_FILES['userfile']['name']; $uploader = new newbb_uploader($uploaddir, $forum->getVar('attach_ext'), $maxfilesize); $uploader->setCheckMediaTypeByExt(); if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) { $prefix = is_object($xoopsUser) ? strval($xoopsUser->uid()) . '_' : 'newbb_'; $uploader->setPrefix($prefix); if (!$uploader->upload()) { $error_upload = $uploader->getErrors(); } else { if (is_file($uploader->getSavedDestination())) { $forumpost->setAttachment($uploader->getSavedFileName(), $uploader->getMediaName(), $uploader->getMediaType()); } } } else { $error_upload = $uploader->getErrors(); } } $postid = $post_handler->insert($forumpost); if (!$postid) { redirect_header('index.php', 2, _AM_NEWBB_POSTNOTSAVED); exit; } $message = _AM_NEWBB_POSTSAVED; if (isset($_POST['subject_pre'])) { $subject_pre = intval($_POST['subject_pre']); $sbj_res = $post_handler->insertnewsubject($topic_id, $subject_pre);