Exemplo n.º 1
0
 $post = new bXPost();
 $post->setPid(0);
 $post->setTopic($topic->id());
 $post->setForum($forum->id());
 $post->setDate(time());
 $post->setUser($xoopsUser ? $xoopsUser->uid() : 0);
 $post->setUname($xoopsUser ? $xoopsUser->uname() : $name);
 $post->setIP($_SERVER['REMOTE_ADDR']);
 $post->setHTML(isset($dohtml) ? 1 : 0);
 $post->setBBCode(isset($doxcode) ? 1 : 0);
 $post->setSmiley(isset($dosmiley) ? 1 : 0);
 $post->setBR(isset($dobr) ? 1 : 0);
 $post->setImage(isset($doimg) ? 1 : 0);
 $post->setIcon('');
 $post->setApproved($forum->isAllowed($xoopsUser ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS, 'approve'));
 $post->setSignature(isset($sig) ? 1 : 0);
 $post->setText($msg);
 if (!$post->save() && $create) {
     $topic->delete();
     redirect_header($retlink, 2, __('Message could not be posted! Please try again', 'bxpress'));
     die;
 }
 if (!$topic->approved()) {
     bXFunctions::notifyAdmin($forum->moderators(), $forum, $topic, $post);
 }
 // Adjuntamos archivos si existen
 if ($forum->attachments() && $forum->isAllowed($xoopsUser ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS, 'attach')) {
     $folder = $xoopsModuleConfig['attachdir'];
     $exts = array();
     include_once RMCPATH . '/class/uploader.php';
     $up = new RMFileUploader($folder, $xoopsModuleConfig['maxfilesize'] * 1024, $forum->extensions());