다국어 등 코드를 생성하여 만들어지는 cache 파일의 취약점 수정

- 관리자 메뉴, 사용자 지정 다국어 cache를 object cache로 변경
- xpressengine/xe-core#2182
This commit is contained in:
Kijin Sung 2017-11-30 22:50:36 +09:00
parent 999bc92753
commit e48179aa05
6 changed files with 73 additions and 97 deletions

View file

@ -864,14 +864,11 @@ class moduleAdminController extends module
}
$output = executeQueryArray('module.getLang', $args);
if(!$output->toBool() || !$output->data) return;
// Set the cache directory
$cache_path = _XE_PATH_.'files/cache/lang_defined/';
FileHandler::makeDir($cache_path);
$langMap = array();
foreach($output->data as $val)
foreach($output->data as $lang)
{
$langMap[$val->lang_code][$val->name] = $val->value;
$langMap[$lang->lang_code][$lang->name] = $lang->value;
}
$lang_supported = Context::loadLangSelected();
@ -904,17 +901,11 @@ class moduleAdminController extends module
$langMap[$langCode] += $langMap[$targetLangCode];
}
$buff = array("<?php if(!defined('__XE__')) exit();");
foreach($langMap[$langCode] as $code => $value)
{
$buff[] = sprintf('$lang[%s] = %s;', var_export(strval($code), true), var_export(strval($value), true));
}
if (!Rhymix\Framework\Storage::write(sprintf('%s/%d.%s.php', $cache_path, $args->site_srl, $langCode), implode(PHP_EOL, $buff)))
{
return;
}
Rhymix\Framework\Cache::set('site_and_module:user_defined_langs:' . $args->site_srl . ':' . $langCode, $langMap[$langCode], 0, true);
}
return $langMap[Context::getLangType()];
}
public function procModuleAdminSetDesignInfo()