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

This commit is contained in:
tianshujie
2023-03-15 15:41:11 +08:00
2 changed files with 4 additions and 8 deletions
+1 -1
View File
@@ -162,7 +162,7 @@ class editor extends control
if(strpos(strtolower($filePath), strtolower($this->app->getBasePath())) !== 0) return print($this->lang->editor->editFileError);
if($action != 'edit' and $action != 'newPage') $filePath = $this->editor->getSavePath($filePath, $action);
if($action != 'edit' and $action != 'newPage' and file_exists($filePath) and !$this->post->override) return print(js::error($this->lang->editor->repeatFile));
if(!$this->editor->save($filePath)) return;
if($this->editor->save($filePath)) return;
echo js::reload('parent.parent.extendWin');
return print(js::locate(inlink('edit', "filePath=" . helper::safe64Encode($filePath) . "&action=edit"), 'parent'));
}
+3 -7
View File
@@ -320,18 +320,14 @@ class editorModel extends model
*
* @param string $filePath
* @access public
* @return bool
* @return string
*/
public function save($filePath)
{
/* Reduce expiration time for check safe file. */
$this->config->safeFileTimeout = 15 * 60;
$statusFile = $this->loadModel('common')->checkSafeFile();
if($statusFile)
{
print(js::alert(sprintf($this->lang->editor->noticeOkFile, str_replace('\\', '/', $statusFile))));
return false;
}
if($statusFile) return print(js::alert(sprintf($this->lang->editor->noticeOkFile, str_replace('\\', '/', $statusFile))));
$dirPath = dirname($filePath);
$extFilePath = substr($filePath, 0, strpos($filePath, DS . 'ext' . DS) + 4);
@@ -346,7 +342,7 @@ class editorModel extends model
if(get_magic_quotes_gpc()) $fileContent = stripslashes($fileContent);
file_put_contents($filePath, $fileContent);
return true;
return '';
}
/**