diff --git a/var/Typecho/Common.php b/var/Typecho/Common.php index de792af2..4ee00d8f 100644 --- a/var/Typecho/Common.php +++ b/var/Typecho/Common.php @@ -437,22 +437,6 @@ EOF; return false; } - /** - * 检测是否在app engine上运行,屏蔽某些功能 - * - * @static - * @access public - * @return boolean - */ - public static function isAppEngine() - { - return !empty($_SERVER['HTTP_APPNAME']) // SAE - || !!getenv('HTTP_BAE_ENV_APPID') // BAE - || !!getenv('HTTP_BAE_LOGID') // BAE 3.0 - || (isset($_SERVER['SERVER_SOFTWARE']) && strpos($_SERVER['SERVER_SOFTWARE'],'Google App Engine') !== false) // GAE - ; - } - /** * 抽取多维数组的某个元素,组成一个新数组,使这个数组变成一个扁平数组 * 使用方法: diff --git a/var/Widget/Options/Permalink.php b/var/Widget/Options/Permalink.php index 800617dc..64359181 100644 --- a/var/Widget/Options/Permalink.php +++ b/var/Widget/Options/Permalink.php @@ -122,7 +122,7 @@ class Widget_Options_Permalink extends Widget_Abstract_Options implements Widget $hasWrote = false; if (!file_exists(__TYPECHO_ROOT_DIR__ . '/.htaccess') - && !Typecho_Common::isAppEngine()) { + && strpos(php_sapi_name(), 'apache') !== false) { if (is_writeable(__TYPECHO_ROOT_DIR__)) { $parsed = parse_url($this->options->siteUrl); $basePath = empty($parsed['path']) ? '/' : $parsed['path']; diff --git a/var/Widget/Themes/Edit.php b/var/Widget/Themes/Edit.php index 17c11644..abd6a13d 100644 --- a/var/Widget/Themes/Edit.php +++ b/var/Widget/Themes/Edit.php @@ -84,7 +84,7 @@ class Widget_Themes_Edit extends Widget_Abstract_Options implements Widget_Inter { $path = $this->options->themeFile($theme, $file); - if (file_exists($path) && is_writeable($path) && !Typecho_Common::isAppEngine() + if (file_exists($path) && is_writeable($path) && (!defined('__TYPECHO_THEME_WRITEABLE__') || __TYPECHO_THEME_WRITEABLE__)) { $handle = fopen($path, 'wb'); if ($handle && fwrite($handle, $this->request->content)) { diff --git a/var/Widget/Themes/Files.php b/var/Widget/Themes/Files.php index f7b1a15c..1782b72f 100644 --- a/var/Widget/Themes/Files.php +++ b/var/Widget/Themes/Files.php @@ -112,7 +112,7 @@ class Widget_Themes_Files extends Typecho_Widget public function currentIsWriteable() { return is_writeable($this->widget('Widget_Options') - ->themeFile($this->_currentTheme, $this->_currentFile)) && !Typecho_Common::isAppEngine() + ->themeFile($this->_currentTheme, $this->_currentFile)) && (!defined('__TYPECHO_THEME_WRITEABLE__') || __TYPECHO_THEME_WRITEABLE__); } diff --git a/var/Widget/Upload.php b/var/Widget/Upload.php index 2c3dcb83..970d9945 100644 --- a/var/Widget/Upload.php +++ b/var/Widget/Upload.php @@ -94,7 +94,7 @@ class Widget_Upload extends Widget_Abstract_Contents implements Widget_Interface $ext = self::getSafeName($file['name']); - if (!self::checkFileType($ext) || Typecho_Common::isAppEngine()) { + if (!self::checkFileType($ext)) { return false; } @@ -172,7 +172,7 @@ class Widget_Upload extends Widget_Abstract_Contents implements Widget_Interface $ext = self::getSafeName($file['name']); - if ($content['attachment']->type != $ext || Typecho_Common::isAppEngine()) { + if ($content['attachment']->type != $ext) { return false; } @@ -243,8 +243,7 @@ class Widget_Upload extends Widget_Abstract_Contents implements Widget_Interface return $result; } - return !Typecho_Common::isAppEngine() - && @unlink(__TYPECHO_ROOT_DIR__ . '/' . $content['attachment']->path); + return @unlink(__TYPECHO_ROOT_DIR__ . '/' . $content['attachment']->path); } /**