Merge branch '15.0.beta3' of https://gitlab.zcorp.cc/easycorp/zentaopms into 15.0.beta3

This commit is contained in:
hufangzhou
2021-04-27 16:57:35 +08:00
9 changed files with 13 additions and 33 deletions
+3 -2
View File
@@ -138,8 +138,9 @@ $config->features->checkClient = true;
/* 文件上传设置。 Upload settings. */
$config->file = new stdclass();
$config->file->dangers = 'php,php3,php4,phtml,php5,jsp,py,rb,asp,aspx,ashx,asa,cer,cdx,aspl,shtm,shtml,html,htm';
$config->file->allowed = 'txt,doc,docx,dot,wps,wri,pdf,ppt,pptx,xls,xlsx,ett,xlt,xlsm,csv,jpg,jpeg,png,psd,gif,ico,bmp,swf,avi,rmvb,rm,mp3,mp4,3gp,flv,mov,movie,rar,zip,bz,bz2,tar,gz,mpp,rp,pdm,vsdx,vsd,sql';
$config->file->dangers = 'php,php3,php4,phtml,php5,jsp,py,rb,asp,aspx,ashx,asa,cer,cdx,aspl,shtm,shtml,html,htm';
$config->file->allowed = 'txt,doc,docx,dot,wps,wri,pdf,ppt,pptx,xls,xlsx,ett,xlt,xlsm,csv,jpg,jpeg,png,psd,gif,ico,bmp,swf,avi,rmvb,rm,mp3,mp4,3gp,flv,mov,movie,rar,zip,bz,bz2,tar,gz,mpp,rp,pdm,vsdx,vsd,sql';
$config->file->storageType = 'fs'; // fs or s3
/* Upload settings. */
$config->allowedTags = '<p><span><h1><h2><h3><h4><h5><em><u><strong><br><ol><ul><li><img><a><b><font><hr><pre><div><table><td><th><tr><tbody><embed><style>';
-24
View File
@@ -228,30 +228,6 @@ class helper extends baseHelper
$version
);
}
/**
* Save file to storage: fs(www/data/upload) or s3(s3, oss, minio)
*
* @param string $tmpFile
* @param string $fileName
* @access public
* @return bool
*/
public static function saveFile($tmpFile, $filePath)
{
global $config;
if(!isset($config->storageType) or $config->storageType == 'fs')
{
return move_uploaded_file($tmpFile, $filePath);
}
else if(isset($config->storageType) and $config->storageType == 's3')
{
return move_uploaded_file($tmpFile, $filePath); // TODO
}
return false;
}
}
/**
+1 -1
View File
@@ -505,7 +505,7 @@ class caselib extends control
$file = $file[0];
$fileName = $this->file->savePath . $this->file->getSaveName($file['pathname']);
helper::saveFile($file['tmpname'], $fileName);
move_uploaded_file($file['tmpname'], $fileName);
$rows = $this->file->parseCSV($fileName);
$fields = $this->testcase->getImportFields($productID);
+1
View File
@@ -73,6 +73,7 @@ class executionModel extends model
{
global $lang;
$this->loadModel('execution');
$this->app->loadLang('project');
$lang->executionCommon = $lang->project->stage;
include $this->app->getModulePath('execution') . 'lang/' . $this->app->getClientLang() . '.php';
}
+2 -1
View File
@@ -431,7 +431,7 @@ class extension extends control
$tmpName = $_FILES['file']['tmp_name'];
$fileName = $_FILES['file']['name'];
$dest = $this->app->getTmpRoot() . "/extension/$fileName";
helper::saveFile($tmpName, $dest);
move_uploaded_file($tmpName, $dest);
$extension = basename($fileName, '.zip');
$return = $this->extension->extractPackage($extension);
@@ -455,6 +455,7 @@ class extension extends control
$link = $type == 'install' ? inlink('install', "extension=$extension") : inlink('upgrade', "extension=$extension");
die(js::locate($link, 'parent'));
}
$this->display();
}
+2 -2
View File
@@ -97,7 +97,7 @@ class fileModel extends model
foreach($files as $id => $file)
{
if($file['size'] == 0) continue;
if(!helper::saveFile($file['tmpname'], $this->savePath . $this->getSaveName($file['pathname']))) return false;
if(!move_uploaded_file($file['tmpname'], $this->savePath . $this->getSaveName($file['pathname']))) return false;
$file = $this->compressImage($file);
@@ -470,7 +470,7 @@ class fileModel extends model
$filePath = $this->dao->select('pathname')->from(TABLE_FILE)->where('id')->eq($fileID)->fetch();
$pathName = $filePath->pathname;
$realPathName = $this->savePath . $this->getRealPathName($pathName);
if(!is_dir(dirname($realPathName)))mkdir(dirname($realPathName));
if(!is_dir(dirname($realPathName))) mkdir(dirname($realPathName));
helper::saveFile($file['tmpname'], $realPathName);
$file['pathname'] = $pathName;
+2 -1
View File
@@ -17,8 +17,9 @@ $sessionString .= session_name() . '=' . session_id();
function deleteFile(fileID)
{
if(!fileID) return;
hiddenwin.location.href =createLink('file', 'delete', 'fileID=' + fileID);
hiddenwin.location.href = createLink('file', 'delete', 'fileID=' + fileID);
}
/* Download a file, append the mouse to the link. Thus we call decide to open the file in browser no download it. */
function downloadFile(fileID, extension, imageWidth, fileTitle)
{
+1 -1
View File
@@ -1523,7 +1523,7 @@ class testcase extends control
$file = $file[0];
$fileName = $this->file->savePath . $this->file->getSaveName($file['pathname']);
helper::saveFile($file['tmpname'], $fileName);
move_uploaded_file($file['tmpname'], $fileName);
$rows = $this->file->parseCSV($fileName);
$fields = $this->testcase->getImportFields($productID);
+1 -1
View File
@@ -1628,7 +1628,7 @@ class testtaskModel extends model
$file = $file[0];
$fileName = $this->file->savePath . $this->file->getSaveName($file['pathname']);
helper::saveFile($file['tmpname'], $fileName);
move_uploaded_file($file['tmpname'], $fileName);
if(simplexml_load_file($fileName) === false)
{
dao::$errors[] = $this->lang->testtask->cannotBeParsed;