Exemplo n.º 1
0
 $story->setIshtml(0);
 $story->setWeight(100);
 //$story->setGroupid($groupid);
 $story->setGroupid($groupid);
 $story->setNosmiley($nosmiley);
 $story->setPublished(0);
 $story->setExpired(0);
 $story->setNotifyPub($notifypub);
 echo $story->articleid;
 $story->setType('user');
 $upload = new uploadfile($HTTP_POST_VARS['filename']);
 $distfilename = $upload->doUploadToRandumFile(XOOPS_ROOT_PATH . "/" . $wfsConfig['filesbasepath']);
 if ($distfilename) {
     $article = new WfsArticle($story->articleid);
     $file = new WfsFiles();
     $file->setByUploadFile($HTTP_POST_VARS['filename']);
     if (empty($HTTP_POST_VARS['downloadfilename'])) {
         $file->setFileShowName($HTTP_POST_VARS['filename']);
     } else {
         $file->setFileShowName($HTTP_POST_VARS['$downloadfilename']);
     }
     $article->addFile($HTTP_POST_VARS['filename']);
 }
 if ($wfsConfig['autoapprove'] == 1) {
     $approve = 1;
     $story->setApproved($approve);
     $story->setPublished(time());
     $story->setExpired(0);
 }
 $result = $story->store();
 if ($result) {
Exemplo n.º 2
0
function file_upload($articleid)
{
	global $wfsConfig;
	global $wfsUploadSize;

	if ($articleid == 0) return 21;

	$error = check_post_files('filename');
	if ($error != 0) return $error;

	$upload = new uploadfile('filename');
	$upload->loadPostVars();
	$upload->setMaxFilesize($wfsUploadSize);
	$upload->setMode($wfsConfig['wfsmode']);
	$distfilename = $upload->doUploadToRandumFile(XOOPS_ROOT_PATH."/".$wfsConfig['filesbasepath']);

	if (!$distfilename) return $upload->getErrorCode();

	$file = new WfsFiles();
	$file->setByUploadFile($upload);
	$file->setFiledescript($_POST['filedescript']);
//	$file->setFiletext($_POST['filetext']);
	$file->setgroupid($_POST['groupid']);

	if (empty($_POST['fileshowname'])) 
	{	$file->setFileShowName($upload->getOriginalName());	} 
	else 
	{   $file->setFileShowName($_POST['fileshowname']);	}

	$file->setArticleid($articleid);
	$ret = $file->store();

	if (!$ret)	return 22;

	return 0;
}
Exemplo n.º 3
0
     }
     break;
     // attached file
 // attached file
 case "fileup":
     global $wfsConfig;
     include_once XOOPS_ROOT_PATH . "/modules/" . $xoopsModule->dirname() . "/class/uploadfile.php";
     include_once XOOPS_ROOT_PATH . "/modules/" . $xoopsModule->dirname() . "/class/wfsfiles.php";
     $upload = new uploadfile();
     $upload->loadPostVars();
     $upload->setMode($wfsConfig['wfsmode']);
     $distfilename = $upload->doUploadToRandumFile(XOOPS_ROOT_PATH . "/" . $wfsConfig['filesbasepath']);
     if ($distfilename) {
         $article = new WfsArticle($HTTP_POST_VARS['articleid']);
         $file = new WfsFiles();
         $file->setByUploadFile($upload);
         $file->setFiledescript($HTTP_POST_VARS['textfiledescript']);
         $file->setFiletext($HTTP_POST_VARS['textfilesearch']);
         $file->setgroupid($HTTP_POST_VARS['groupid']);
         if (empty($HTTP_POST_VARS['fileshowname'])) {
             $file->setFileShowName($upload->getOriginalName());
         } else {
             $file->setFileShowName($HTTP_POST_VARS['fileshowname']);
         }
         $article->addFile($file);
         redirect_header("index.php?op=edit&articleid=" . $HTTP_POST_VARS['articleid'], 1, _AM_DBUPDATED);
         exit;
     } else {
         xoops_cp_header();
         echo "<table width='100%' border='0' cellspacing='1' class='outer'><tr><td class='odd'>";
         echo "<h4>" . _AM_UPDATEFAIL . "</h4>";