Merge branch 'security/rve-2024-1' into develop

This commit is contained in:
Kijin Sung 2024-01-30 23:45:17 +09:00
commit 9eea71631a
4 changed files with 11 additions and 10 deletions

View file

@ -67,7 +67,7 @@
<li class="delicious link"><a href="https://delicious.com/">Delicious</a></li> <li class="delicious link"><a href="https://delicious.com/">Delicious</a></li>
</ul> </ul>
<script> <script>
var sTitle = '{str_ireplace(array('<script', '</script'), array("<scr'+'ipt", "</scr'+'ipt"), addslashes($oDocument->getTitleText()))}'; var sTitle = {json_encode($oDocument->getTitleText())};
jQuery(function($){ jQuery(function($){
$('.twitter>a').snspost({ $('.twitter>a').snspost({
type : 'twitter', type : 'twitter',

View file

@ -64,7 +64,7 @@
</li> </li>
</ul> </ul>
<script> <script>
var sTitle = '{$oDocument->getTitleText()}'; var sTitle = {json_encode($oDocument->getTitleText())};
jQuery(function($){ jQuery(function($){
$('.twitter').snspost({ $('.twitter').snspost({
type : 'twitter', type : 'twitter',

View file

@ -748,11 +748,11 @@ class DocumentController extends Document
// If the tile is empty, extract string from the contents. // If the tile is empty, extract string from the contents.
$obj->title = escape($obj->title, false); $obj->title = escape($obj->title, false);
if($obj->title == '') if ($obj->title === '')
{ {
$obj->title = cut_str(trim(strip_tags(nl2br($obj->content))),20,'...'); $obj->title = escape(cut_str(trim(utf8_normalize_spaces(strip_tags($obj->content))), 20, '...'), false);
} }
if($obj->title == '') if ($obj->title === '')
{ {
$obj->title = 'Untitled'; $obj->title = 'Untitled';
} }
@ -1047,11 +1047,11 @@ class DocumentController extends Document
// If the tile is empty, extract string from the contents. // If the tile is empty, extract string from the contents.
$obj->title = escape($obj->title, false); $obj->title = escape($obj->title, false);
if($obj->title == '') if ($obj->title === '')
{ {
$obj->title = cut_str(strip_tags($obj->content),20,'...'); $obj->title = escape(cut_str(trim(utf8_normalize_spaces(strip_tags($obj->content))), 20, '...'), false);
} }
if($obj->title == '') if ($obj->title === '')
{ {
$obj->title = 'Untitled'; $obj->title = 'Untitled';
} }

View file

@ -495,7 +495,8 @@ class DocumentItem extends BaseObject
return; return;
} }
return $cut_size ? cut_str($this->get('title'), $cut_size, $tail) : $this->get('title'); $title = $cut_size ? cut_str($this->get('title'), $cut_size, $tail) : $this->get('title');
return escape($title, false);
} }
function getVoted() function getVoted()
@ -593,7 +594,7 @@ class DocumentItem extends BaseObject
return false; return false;
} }
$title = escape($this->getTitleText($cut_size, $tail), false); $title = $this->getTitleText($cut_size, $tail);
$this->add('title_color', trim($this->get('title_color') ?? '')); $this->add('title_color', trim($this->get('title_color') ?? ''));
$attrs = array(); $attrs = array();