This commit is contained in:
Catouse
2015-05-08 14:48:30 +08:00
8 changed files with 44 additions and 3 deletions
+2 -3
View File
@@ -38,10 +38,9 @@ class common extends control
*/
public function checkUpgradeStatus()
{
$statusFile = $this->app->getAppRoot() . 'www' . $this->pathFix . 'ok.txt';
if(!file_exists($statusFile) or time() - filemtime($statusFile) > 3600)
$statusFile = $this->loadModel('upgrade')->checkSafeFile();
if($statusFile)
{
$this->app->loadLang('upgrade');
echo "<html><head><meta http-equiv='Content-Type' content='text/html; charset=utf-8' /></head><body>";
echo "<table align='center' style='margin-top:100px; border:1px solid gray; font-size:14px;'><tr><td>";
printf($this->lang->upgrade->setStatusFile, $statusFile, $statusFile, $statusFile);
+5
View File
@@ -134,6 +134,11 @@ class editor extends control
*/
public function save($filePath = '', $action = '')
{
$statusFile = $this->loadModel('upgrade')->checkSafeFile();
if($statusFile)
{
die(js::alert(sprintf($this->lang->editor->noticeOkFile, $statusFile, $statusFile, $statusFile)));
}
if($filePath and $_POST)
{
$filePath = helper::safe64Decode($filePath);
+1
View File
@@ -30,6 +30,7 @@ $lang->editor->deleteConfirm = 'Are you sure?';
$lang->editor->extendConfirm = 'Would you reuse the code.';
$lang->editor->repeatFile = 'File name repeat';
$lang->editor->repeatPage = 'This page has extisted. Is override?';
$lang->editor->noticeOkFile = 'The ok file does not exist or has expired\nFor safe, please re create the ok file\nYou can perform the following commands on the server: \nFor windows:echo ok > %s\nFor linux:touch %s;';
$lang->editor->notWritable = "Can not writable, maybe no power. please try chmod 777 -R ";
$lang->editor->notDelete = "Can not delete, please check power!";
+1
View File
@@ -30,6 +30,7 @@ $lang->editor->deleteConfirm = '是否要删除?';
$lang->editor->extendConfirm = '是否要重用原来代码?';
$lang->editor->repeatFile = '文件名重复';
$lang->editor->repeatPage = '已经有此页面。是否覆盖?';
$lang->editor->noticeOkFile = 'ok文件不存在或文件已过期\n为了系统的安全,请重新创建ok文件\n您可在服务器执行下面相应的命令:\nwindows: 打开命令行,执行 echo ok > %s\nlinux: touch %s;\n或者删掉 %s 这个文件 ,重新创建一个ok.txt文件,不需要内容。';
$lang->editor->notWritable = "无法写入,可能没有权限。请尝试执行 chmod 777 -R ";
$lang->editor->notDelete = '无法删除,请检查权限!';
+7
View File
@@ -120,6 +120,13 @@ class extension extends control
$this->view->upgrade = $upgrade;
$this->view->title = $installTitle . $extension;
$statusFile = $this->loadModel('upgrade')->checkSafeFile();
if($statusFile)
{
$this->view->error = sprintf($this->lang->extension->noticeOkFile, $statusFile, $statusFile, $statusFile);
die($this->display());
}
/* Get the package file name. */
$packageFile = $this->extension->getPackageFile($extension);
+8
View File
@@ -81,6 +81,14 @@ $lang->extension->viewInstalled = 'View installed extensions.';
$lang->extension->viewAvailable = 'View available extensions';
$lang->extension->viewDeactivated = 'View deactivated extensions';
$lang->extension->backDBFile = 'Plug-related data has been backed up to %s file!';
$lang->extension->noticeOkFile = '<h4>The ok file does not exist or has expired</h4>
<h4>For safe, please re create the ok file</h4>
<p>You can perform the following commands on the server: </p>
<ul>
<li>For linux:<strong>touch %s;</strong> </li>
<li>For windows:<strong>echo ok > %s</strong></li>
</ul> ';
$lang->extension->upgradeExt = 'Upgrade';
$lang->extension->installExt = 'Install';
+8
View File
@@ -81,6 +81,14 @@ $lang->extension->viewInstalled = '查看已安装插件';
$lang->extension->viewAvailable = '查看可安装插件';
$lang->extension->viewDeactivated = '查看已禁用插件';
$lang->extension->backDBFile = '插件相关数据已经备份到 %s 文件中!';
$lang->extension->noticeOkFile = '<h4>ok文件不存在或文件已过期</h4>
<h4>为了系统的安全,请重新创建ok文件</h4>
<p>您可在服务器执行下面相应的命令:</p>
<ul>
<li>windows: 打开命令行,执行<strong>echo ok &gt; %s</strong></li>
<li>linux: <strong>touch %s;</strong></li>
<li>或者删掉 <strong>"%s"</strong> 这个文件 ,重新创建一个ok.txt文件,不需要内容。</li>
</ul> ';
$lang->extension->upgradeExt = '升级';
$lang->extension->installExt = '安装';
+12
View File
@@ -960,4 +960,16 @@ class upgradeModel extends model
self::$errors = array();
return $errors;
}
/**
* Check safe file.
*
* @access public
* @return string|false
*/
public function checkSafeFile()
{
$statusFile = $this->app->getAppRoot() . 'www' . DIRECTORY_SEPARATOR . 'ok.txt';
return (!file_exists($statusFile) or time() - filemtime($statusFile) > 3600) ? $statusFile : false;
}
}