mirror of
https://github.com/typecho/typecho.git
synced 2025-03-18 17:09:41 +01:00
Remove isAppEngine detector
This commit is contained in:
parent
12bd32babf
commit
7f3cd2b9e8
@ -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
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* 抽取多维数组的某个元素,组成一个新数组,使这个数组变成一个扁平数组
|
||||
* 使用方法:
|
||||
|
@ -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'];
|
||||
|
@ -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)) {
|
||||
|
@ -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__);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user