Fix escaping and userlang encoding of site keywords and description

This commit is contained in:
Kijin Sung 2016-05-08 23:29:47 +09:00
parent faf4b1ea54
commit f84715db5b
3 changed files with 7 additions and 6 deletions

View file

@ -2716,7 +2716,7 @@ class Context
foreach(self::$_instance->meta_tags as $key => $val)
{
list($name, $is_http_equiv) = explode("\t", $key);
$ret[] = array('name' => $name, 'is_http_equiv' => $is_http_equiv, 'content' => $val);
$ret[] = array('name' => $name, 'is_http_equiv' => $is_http_equiv, 'content' => escape($val, false));
}
return $ret;
@ -2732,6 +2732,7 @@ class Context
*/
public static function addMetaTag($name, $content, $is_http_equiv = FALSE)
{
getController('module')->replaceDefinedLangCode($content);
self::$_instance->meta_tags[$name . "\t" . ($is_http_equiv ? '1' : '0')] = $content;
}

View file

@ -299,20 +299,20 @@ class ModuleHandler extends Handler
$module_config = $oModuleModel->getModuleConfig('module');
if ($module_info->meta_keywords)
{
Context::addMetaTag('keywords', escape($module_info->meta_keywords));
Context::addMetaTag('keywords', $module_info->meta_keywords);
}
elseif($module_config->meta_keywords)
{
Context::addMetaTag('keywords', escape($module_config->meta_keywords));
Context::addMetaTag('keywords', $module_config->meta_keywords);
}
if ($module_info->meta_description)
{
Context::addMetaTag('description', escape($module_info->meta_description));
Context::addMetaTag('description', $module_info->meta_description);
}
elseif($module_config->meta_description)
{
Context::addMetaTag('description', escape($module_config->meta_description));
Context::addMetaTag('description', $module_config->meta_description);
}
$viewType = (Mobile::isFromMobilePhone()) ? 'M' : 'P';

View file

@ -1073,7 +1073,7 @@ class moduleController extends module
{
if($isReplaceLangCode)
{
$output = preg_replace_callback('!\$user_lang->([a-z0-9\_]+)!is', array($this,'_replaceLangCode'), $output);
$output = preg_replace_callback('!\$user_lang-(?:>|&(?:amp;)?gt;)([a-z0-9\_]+)!is', array($this,'_replaceLangCode'), $output);
}
}