if ($action == 'upload') { global $wfsConfig; if (!is_dir($_POST['uploadpath']) ) { redirect_header("filemanager.php?rootpath=".$dirpath."",1,"No Dir selected"); exit; } if (!is_writeable($_POST['uploadpath']) ) { redirect_header("filemanager.php?rootpath=".$dirpath."",1,"Path Not writable"); exit; } $upload = new uploadfile(); $upload->loadPostVars(); $upload->setMode($wfsConfig['wfsmode']); $upload->setMaxImageHight($wfsConfig['imgheight']); $upload->setMaxImageWidth($wfsConfig['imgwidth']); $upload->setMaxFilesize($wfsConfig['filesize']); if (isset($_POST['imgname']) && !empty($_POST['imgname'])) $imgname = strtolower($_POST['imgname']); $distfilename = $upload->doUploadimage($_POST['uploadpath'], $imgname); if ( $distfilename ) { redirect_header("filemanager.php?rootpath=".$_POST['uploadpath']."",1,_AM_UPLOADED); exit(); } else { xoops_cp_header(); echo"<table width='100%' border='0' cellspacing='1' cellpadding = '2'><tr><td>";
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; }
$story->setCategoryid($id); $story->setNohtml($nohtml_db); $nosmiley = isset($nosmiley) ? intval($nosmiley) : 0; $notifypub = isset($notifypub) ? intval($notifypub) : 0; $story->setHtmlpage(""); $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);
} else { redirect_header("{$urlpath}?rootpath=" . $HTTP_POST_VARS['workpath'] . "", 1, "Error: File not Created"); } exit; } if ($action == 'upload') { global $HTTP_GET_VARS, $wfsConfig; if (!is_dir($HTTP_POST_VARS['uploadpath'])) { redirect_header("filemanager.php?rootpath=" . $dirpath . "", 1, "No Dir selected"); exit; } if (!is_writeable($HTTP_POST_VARS['uploadpath'])) { redirect_header("filemanager.php?rootpath=" . $dirpath . "", 1, "Path Not writable"); exit; } $upload = new uploadfile(); $upload->loadPostVars(); $upload->setMode($wfsConfig['wfsmode']); $upload->setMaxImageHight($wfsConfig['imgheight']); $upload->setMaxImageWidth($wfsConfig['imgwidth']); $upload->setMaxFilesize($wfsConfig['filesize']); if (isset($HTTP_POST_VARS['imgname']) && !empty($HTTP_POST_VARS['imgname'])) { $imgname = strtolower($HTTP_POST_VARS['imgname']); } $distfilename = $upload->doUploadimage($HTTP_POST_VARS['uploadpath'], $imgname); if ($distfilename) { redirect_header("filemanager.php?rootpath=" . $HTTP_POST_VARS['uploadpath'] . "", 1, _AM_UPLOADED); exit; } else { xoops_cp_header(); echo "<table width='100%' border='0' cellspacing='1' cellpadding = '2'><tr><td>";
$article->delete(); redirect_header(XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/admin/index.php", 1, _AM_DBUPDATED); exit; } else { xoops_cp_header(); echo ""; xoops_confirm(array('op' => 'delete', 'articleid' => $articleid, 'ok' => 1), 'index.php', _AM_RUSUREDEL); } 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']); }
// 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"); // error message $code = check_post_files('uploadfile'); if ($code == 0) { $upload = new uploadfile(); $upload->loadPostVars(); $upload->setMode($wfsConfig['wfsmode']); // error message // $distfilename = $upload->doUploadToRandumFile(XOOPS_ROOT_PATH."/".$wfsConfig['filesbasepath']); $filesbasepath = XOOPS_ROOT_PATH."/".$wfsConfig['filesbasepath']; $distfilename = $upload->doUploadToRandumFile($filesbasepath); $code = $upload->getErrorCode(); if ( $distfilename ) { $article = new WfsArticle($_POST['articleid']); $file = new WfsFiles(); $file->setByUploadFile($upload); $file->setFiledescript($_POST['textfiledescript']); $file->setFiletext($_POST['textfilesearch']);