Ejemplo n.º 1
0
     $up = new RMFileUploader($folder, $xoopsModuleConfig['maxfilesize'] * 1024, $forum->extensions());
     $errors = '';
     $filename = '';
     if ($up->fetchMedia('attach')) {
         if (!$up->upload()) {
             $errors .= $up->getErrors();
         } else {
             $filename = $up->getSavedFileName();
             $fullpath = $up->getSavedDestination();
             $attach = new bXAttachment();
             $attach->setPost($post->id());
             $attach->setFile($filename);
             $attach->setMime($up->getMediaType());
             $attach->setDate(time());
             $attach->downloads(0);
             $attach->setName($up->getMediaName());
             if (!$attach->save()) {
                 $errors .= $attach->getErrors();
             }
         }
     }
 }
 $topic->setLastPost($post->id());
 if (!$create) {
     $topic->addReply();
 }
 $topic->save();
 $forum->setPostId($post->id());
 $forum->addPost();
 if ($create) {
     $forum->addTopic();