mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-03 16:51:40 +09:00
Fix undefined values in various modules
This commit is contained in:
parent
28de1335a7
commit
702eebaa92
6 changed files with 28 additions and 13 deletions
|
|
@ -574,7 +574,7 @@ function zgap($timestamp = null): int
|
||||||
*/
|
*/
|
||||||
function ztime($str): ?int
|
function ztime($str): ?int
|
||||||
{
|
{
|
||||||
$len = strlen($str);
|
$len = strlen($str ?? '');
|
||||||
if (!$len)
|
if (!$len)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ class BoardController extends Board
|
||||||
|
|
||||||
// Return error if content conains excessively large data URLs.
|
// Return error if content conains excessively large data URLs.
|
||||||
$inline_data_url_limit = $this->module_info->inline_data_url_limit * 1024;
|
$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)
|
foreach ($matches[1] as $match)
|
||||||
{
|
{
|
||||||
if (strlen($match) > $inline_data_url_limit)
|
if (strlen($match) > $inline_data_url_limit)
|
||||||
|
|
@ -116,7 +116,7 @@ class BoardController extends Board
|
||||||
$use_status = explode('|@|', $this->module_info->use_status);
|
$use_status = explode('|@|', $this->module_info->use_status);
|
||||||
|
|
||||||
// Set 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;
|
$obj->status = $secret_status;
|
||||||
}
|
}
|
||||||
|
|
@ -224,7 +224,14 @@ class BoardController extends Board
|
||||||
$obj->title_bold = $oDocument->get('title_bold');
|
$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
|
// Update
|
||||||
|
|
@ -495,7 +502,7 @@ class BoardController extends Board
|
||||||
|
|
||||||
// Return error if content conains excessively large data URLs.
|
// Return error if content conains excessively large data URLs.
|
||||||
$inline_data_url_limit = ($this->module_info->inline_data_url_limit ?: 64) * 1024;
|
$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)
|
foreach ($matches[1] as $match)
|
||||||
{
|
{
|
||||||
if (strlen($match) > $inline_data_url_limit)
|
if (strlen($match) > $inline_data_url_limit)
|
||||||
|
|
|
||||||
|
|
@ -1007,12 +1007,12 @@ class CommentController extends Comment
|
||||||
return new BaseObject(-1, 'msg_not_permitted');
|
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());
|
$obj->password = \Rhymix\Framework\Password::hashPassword($obj->password, \Rhymix\Framework\Password::getBackwardCompatibleAlgorithm());
|
||||||
}
|
}
|
||||||
|
|
||||||
if($obj->homepage)
|
if(!empty($obj->homepage))
|
||||||
{
|
{
|
||||||
$obj->homepage = escape($obj->homepage);
|
$obj->homepage = escape($obj->homepage);
|
||||||
if(!preg_match('/^[a-z]+:\/\//i',$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');
|
$obj->content = $source_obj->get('content');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1091,7 +1091,7 @@ class DocumentController extends Document
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hash the password if it exists
|
// 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());
|
$obj->password = \Rhymix\Framework\Password::hashPassword($obj->password, \Rhymix\Framework\Password::getBackwardCompatibleAlgorithm());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -779,7 +779,7 @@ class EditorModel extends Editor
|
||||||
// if not inserted converter, Get converter from skin
|
// if not inserted converter, Get converter from skin
|
||||||
if (!$converter)
|
if (!$converter)
|
||||||
{
|
{
|
||||||
$converter = self::getSkinConfig($skin)->converter;
|
$converter = self::getSkinConfig($skin)->converter ?? null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if not inserted converter, Check
|
// if not inserted converter, Check
|
||||||
|
|
@ -789,7 +789,7 @@ class EditorModel extends Editor
|
||||||
{
|
{
|
||||||
$converter = 'text';
|
$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';
|
$converter = 'text';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,11 @@ class SpamfilterController extends Spamfilter
|
||||||
*/
|
*/
|
||||||
function triggerInsertDocument(&$obj)
|
function triggerInsertDocument(&$obj)
|
||||||
{
|
{
|
||||||
if($_SESSION['avoid_log']) return;
|
if (!empty($_SESSION['avoid_log']))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Check the login status, login information, and permission
|
// Check the login status, login information, and permission
|
||||||
$is_logged = Context::get('is_logged');
|
$is_logged = Context::get('is_logged');
|
||||||
$logged_info = Context::get('logged_info');
|
$logged_info = Context::get('logged_info');
|
||||||
|
|
@ -98,7 +102,11 @@ class SpamfilterController extends Spamfilter
|
||||||
*/
|
*/
|
||||||
function triggerInsertComment(&$obj)
|
function triggerInsertComment(&$obj)
|
||||||
{
|
{
|
||||||
if($_SESSION['avoid_log']) return;
|
if (!empty($_SESSION['avoid_log']))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Check the login status, login information, and permission
|
// Check the login status, login information, and permission
|
||||||
$is_logged = Context::get('is_logged');
|
$is_logged = Context::get('is_logged');
|
||||||
$logged_info = Context::get('logged_info');
|
$logged_info = Context::get('logged_info');
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue