From ce9340aef87c1f96f943555f3ca502eb8d2a408c Mon Sep 17 00:00:00 2001 From: wangyidong Date: Wed, 15 Mar 2023 15:36:16 +0800 Subject: [PATCH] * fix bug #32946. --- module/editor/lang/de.php | 3 ++- module/editor/lang/en.php | 3 ++- module/editor/lang/fr.php | 3 ++- module/editor/lang/zh-cn.php | 3 ++- module/editor/model.php | 3 ++- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/module/editor/lang/de.php b/module/editor/lang/de.php index cdca827ca2..159fa032f5 100644 --- a/module/editor/lang/de.php +++ b/module/editor/lang/de.php @@ -34,7 +34,8 @@ $lang->editor->noticeOkFile = 'Aus Sicherheitsgründen muss Ihr Adminkonto best $lang->editor->editFileError = 'Sie können nur ZenTao Dateien verändern!'; $lang->editor->turnOff = "If you don't use the editor function, you can turn it off here."; -$lang->editor->notWritable = "Nicht beschreibbar. Berechtigung erforderlich. Bitte versuchen Sie chmod 777 -R "; +$lang->editor->notExists = "Not exists. Please create it. Try mkdir -p %s"; +$lang->editor->notWritable = "Nicht beschreibbar. Berechtigung erforderlich. Bitte versuchen Sie chmod 777 -R %s"; $lang->editor->notDelete = 'Kann nicht gelöscht werden. Bitte prüfen Sie Ihre Berechtigungen!'; $lang->editor->emptyFileName = 'Bitte geben Sie einen Dateinamen an!'; $lang->editor->onlyLocalVisit = "This feature only works when the IP is 127.0.0.1. Help"; diff --git a/module/editor/lang/en.php b/module/editor/lang/en.php index 2d3a1bfd2d..d9052c4cc2 100644 --- a/module/editor/lang/en.php +++ b/module/editor/lang/en.php @@ -34,7 +34,8 @@ $lang->editor->noticeOkFile = 'For security reasons, your Admin account has to $lang->editor->editFileError = 'You can only modify ZenTao files!'; $lang->editor->turnOff = "If you don't use the editor function, you can turn it off here."; -$lang->editor->notWritable = "Not wirtable. Permission is required. Please try chmod 777 -R "; +$lang->editor->notExists = "Not exists. Please create it. Try mkdir -p %s"; +$lang->editor->notWritable = "Not wirtable. Permission is required. Please try chmod 777 -R %s"; $lang->editor->notDelete = 'Cannot be deleted. Please check your permissions!'; $lang->editor->emptyFileName = 'Please enter a File Name!'; $lang->editor->onlyLocalVisit = "This feature only works when the IP is 127.0.0.1 for security. Help"; diff --git a/module/editor/lang/fr.php b/module/editor/lang/fr.php index 3c4db8b0e5..7ab003a543 100644 --- a/module/editor/lang/fr.php +++ b/module/editor/lang/fr.php @@ -34,7 +34,8 @@ $lang->editor->noticeOkFile = 'Pour des raisons de s?curit?, votre compte admin $lang->editor->editFileError = 'Vous pouvez seulement modifier les fichiers ZenTao !'; $lang->editor->turnOff = "If you don't use the editor function, you can turn it off here."; -$lang->editor->notWritable = "Non inscriptible. Permission requise. Essayez chmod 777 -R "; +$lang->editor->notExists = "Not exists. Please create it. Try mkdir -p %s"; +$lang->editor->notWritable = "Non inscriptible. Permission requise. Essayez chmod 777 -R %s"; $lang->editor->notDelete = 'Ne peut pas ?tre supprim?. V?rifiez les permissions !'; $lang->editor->emptyFileName = 'Entrez un nom de fichier !'; $lang->editor->onlyLocalVisit = "Cette fonctionnalit? ne fonctionne que pour une IP 127.0.0.1. Aide"; diff --git a/module/editor/lang/zh-cn.php b/module/editor/lang/zh-cn.php index 6936539032..2d2d06d868 100644 --- a/module/editor/lang/zh-cn.php +++ b/module/editor/lang/zh-cn.php @@ -34,7 +34,8 @@ $lang->editor->noticeOkFile = '为了安全起见,系统需要确认您的管 $lang->editor->editFileError = '只能修改禅道文件!'; $lang->editor->turnOff = '如不使用编辑器功能,可在此关闭。'; -$lang->editor->notWritable = "无法写入,可能没有权限。请尝试执行 chmod 777 -R "; +$lang->editor->notExists = "不存在该目录,请先创建。请尝试执行 mkdir -p %s"; +$lang->editor->notWritable = "无法写入,可能没有权限。请尝试执行 chmod 777 -R %s"; $lang->editor->notDelete = '无法删除,请检查权限!'; $lang->editor->emptyFileName = '请写入一个文件名!'; $lang->editor->onlyLocalVisit = "该功能只能在IP:127.0.0.1下访问。说明文档"; diff --git a/module/editor/model.php b/module/editor/model.php index bf0a9eb96a..27da542a8d 100644 --- a/module/editor/model.php +++ b/module/editor/model.php @@ -336,7 +336,8 @@ class editorModel extends model $dirPath = dirname($filePath); $extFilePath = substr($filePath, 0, strpos($filePath, DS . 'ext' . DS) + 4); if(!is_dir($dirPath) and is_writable($extFilePath)) mkdir($dirPath, 0777, true); - if(!is_dir($dirPath) or !is_writable($dirPath)) return print(js::alert($this->lang->editor->notWritable . $extFilePath)); + if(!is_dir($dirPath)) return print(js::alert(sprintf($this->lang->editor->notExists, $extFilePath)); + if(!is_writable($dirPath)) return print(js::alert(sprintf($this->lang->editor->notWritable, $extFilePath)); if(strpos(strtolower(realpath($dirPath)), strtolower($this->app->getBasePath())) !== 0) return print(js::alert($this->lang->editor->editFileError)); $fileContent = $this->post->fileContent;