add constant to disable theme file writing

This commit is contained in:
祁宁 2014-04-20 17:21:54 +08:00
parent 77088e226f
commit 18acb3cb27
2 changed files with 4 additions and 2 deletions

View File

@ -84,7 +84,8 @@ class Widget_Themes_Edit extends Widget_Abstract_Options implements Widget_Inter
{
$path = __TYPECHO_ROOT_DIR__ . __TYPECHO_THEME_DIR__ . '/' . trim($theme, './') . '/' . trim($file, './');
if (file_exists($path) && is_writeable($path) && !Typecho_Common::isAppEngine()) {
if (file_exists($path) && is_writeable($path) && !Typecho_Common::isAppEngine()
&& (!defined('__TYPECHO_THEME_WRITEABLE__') || __TYPECHO_THEME_WRITEABLE__)) {
$handle = fopen($path, 'wb');
if ($handle && fwrite($handle, $this->request->content)) {
fclose($handle);

View File

@ -107,7 +107,8 @@ class Widget_Themes_Files extends Typecho_Widget
public function currentIsWriteable()
{
return is_writeable(__TYPECHO_ROOT_DIR__ . __TYPECHO_THEME_DIR__ . '/' .
$this->_currentTheme . '/' . $this->_currentFile) && !Typecho_Common::isAppEngine();
$this->_currentTheme . '/' . $this->_currentFile) && !Typecho_Common::isAppEngine()
&& (!defined('__TYPECHO_THEME_WRITEABLE__') || __TYPECHO_THEME_WRITEABLE__);
}
/**