Fix undefined values in various modules

This commit is contained in:
Kijin Sung 2025-06-01 17:58:00 +09:00
parent 28de1335a7
commit 702eebaa92
6 changed files with 28 additions and 13 deletions

View file

@ -61,7 +61,7 @@ class BoardController extends Board
// Return error if content conains excessively large data URLs.
$inline_data_url_limit = $this->module_info->inline_data_url_limit * 1024;
preg_match_all('!src="\s*(data:[^,]*,[a-z0-9+/=%$!._-]+)!i', (string)$obj->content, $matches);
preg_match_all('!src="\s*(data:[^,]*,[a-z0-9+/=\%\$\!._-]+)!i', (string)$obj->content, $matches);
foreach ($matches[1] as $match)
{
if (strlen($match) > $inline_data_url_limit)
@ -116,7 +116,7 @@ class BoardController extends Board
$use_status = explode('|@|', $this->module_info->use_status);
// Set status
if(($obj->is_secret == 'Y' || $obj->status == $secret_status) && is_array($use_status) && in_array($secret_status, $use_status))
if((($obj->is_secret ?? 'N') == 'Y' || $obj->status == $secret_status) && is_array($use_status) && in_array($secret_status, $use_status))
{
$obj->status = $secret_status;
}
@ -224,7 +224,14 @@ class BoardController extends Board
$obj->title_bold = $oDocument->get('title_bold');
}
$obj->reason_update = escape($obj->reason_update);
if (isset($obj->reason_update))
{
$obj->reason_update = escape($obj->reason_update);
}
else
{
$obj->reason_update = '';
}
}
// Update
@ -495,7 +502,7 @@ class BoardController extends Board
// Return error if content conains excessively large data URLs.
$inline_data_url_limit = ($this->module_info->inline_data_url_limit ?: 64) * 1024;
preg_match_all('!src="\s*(data:[^,]*,[a-z0-9+/=%$!._-]+)!i', (string)$obj->content, $matches);
preg_match_all('!src="\s*(data:[^,]*,[a-z0-9+/=\%\$\!._-]+)!i', (string)$obj->content, $matches);
foreach ($matches[1] as $match)
{
if (strlen($match) > $inline_data_url_limit)

View file

@ -1007,12 +1007,12 @@ class CommentController extends Comment
return new BaseObject(-1, 'msg_not_permitted');
}
if($obj->password)
if(!empty($obj->password))
{
$obj->password = \Rhymix\Framework\Password::hashPassword($obj->password, \Rhymix\Framework\Password::getBackwardCompatibleAlgorithm());
}
if($obj->homepage)
if(!empty($obj->homepage))
{
$obj->homepage = escape($obj->homepage);
if(!preg_match('/^[a-z]+:\/\//i',$obj->homepage))
@ -1021,7 +1021,7 @@ class CommentController extends Comment
}
}
if(!$obj->content)
if(!isset($obj->content) || !$obj->content)
{
$obj->content = $source_obj->get('content');
}

View file

@ -1091,7 +1091,7 @@ class DocumentController extends Document
}
// Hash the password if it exists
if($obj->password)
if (!empty($obj->password))
{
$obj->password = \Rhymix\Framework\Password::hashPassword($obj->password, \Rhymix\Framework\Password::getBackwardCompatibleAlgorithm());
}

View file

@ -779,7 +779,7 @@ class EditorModel extends Editor
// if not inserted converter, Get converter from skin
if (!$converter)
{
$converter = self::getSkinConfig($skin)->converter;
$converter = self::getSkinConfig($skin)->converter ?? null;
}
// if not inserted converter, Check
@ -789,7 +789,7 @@ class EditorModel extends Editor
{
$converter = 'text';
}
elseif (strpos($type == 'comment' ? $config->sel_comment_editor_colorset : $config->sel_editor_colorset, 'nohtml') !== false)
elseif (strpos($type == 'comment' ? ($config->sel_comment_editor_colorset ?? '') : ($config->sel_editor_colorset ?? ''), 'nohtml') !== false)
{
$converter = 'text';
}

View file

@ -38,7 +38,11 @@ class SpamfilterController extends Spamfilter
*/
function triggerInsertDocument(&$obj)
{
if($_SESSION['avoid_log']) return;
if (!empty($_SESSION['avoid_log']))
{
return;
}
// Check the login status, login information, and permission
$is_logged = Context::get('is_logged');
$logged_info = Context::get('logged_info');
@ -98,7 +102,11 @@ class SpamfilterController extends Spamfilter
*/
function triggerInsertComment(&$obj)
{
if($_SESSION['avoid_log']) return;
if (!empty($_SESSION['avoid_log']))
{
return;
}
// Check the login status, login information, and permission
$is_logged = Context::get('is_logged');
$logged_info = Context::get('logged_info');