$news->votes=$votes['cpt']; $approved = $article['published']>0 ? true : false; $news->approved=$approved; $news->store($approved); echo '<br> This story was imported : '.$news->title(); $news_newsid=$news->storyid(); // ******************** // The files $result4 = $db->query('SELECT * FROM '.$ams_files.' WHERE storyid='.$ams_newsid); while ( $file = $db->fetchArray($result4) ) { $sfile = new nw_sFiles(); $sfile->setFileRealName($file['filerealname']); $sfile->setStoryid($news_newsid); $sfile->date=$file['date']; $sfile->setMimetype($file['mimetype']); $sfile->setDownloadname($file['downloadname']); $sfile->counter=$file['counter']; $sfile->store(); echo '<br> This file was imported : '.$sfile->getDownloadname(); $news_fileid=$sfile->fileid; } // The ratings $result5 = $db->query('SELECT * FROM '.$ams_rating.' WHERE storyid='.$ams_newsid); while ( $ratings = $db->fetchArray($result5) ) { $result6 = $db->queryF('INSERT INTO '.$news_stories_votedata." (storyid, ratinguser, rating, ratinghostname, ratingtimestamp) VALUES (".$news_newsid.','.$ratings['ratinguser'].','.$ratings['rating'].','.$ratings['ratinghostname'].','.$ratings['ratingtimestamp'].')'); } // The comments $comments =& $comment_handler->getByItemId($ams_mid, $ams_newsid, 'ASC'); if(is_array($comments) && count($comments)>0) {
if(xoops_trim($fldname!='')) { $sfiles = new nw_sFiles(); $destname=$sfiles->createUploadName(NW_ATTACHED_FILES_PATH,$fldname); /** * You can attach files to your news */ $permittedtypes = explode("\n",str_replace("\r",'',nw_getmoduleoption('mimetypes', NW_MODULE_DIR_NAME))); array_walk($permittedtypes, 'trim'); $uploader = new XoopsMediaUploader( NW_ATTACHED_FILES_PATH, $permittedtypes, $xoopsModuleConfig['maxuploadsize']); $uploader->setTargetFileName($destname); if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) { if ($uploader->upload()) { $sfiles->setFileRealName($uploader->getMediaName()); $sfiles->setStoryid($story->storyid()); $sfiles->setMimetype($sfiles->giveMimetype(NW_ATTACHED_FILES_PATH.'/'.$uploader->getMediaName())); $sfiles->setDownloadname($destname); if(!$sfiles->store()) { echo _AM_NW_UPLOAD_DBERROR_SAVE; } } else { echo _AM_NW_UPLOAD_ERROR. ' ' . $uploader->getErrors(); } } else { echo $uploader->getErrors(); } } } } } else { echo _ERRORS; }