Fix miscellaneous errors in PHP 8.0

https://xetown.com/questions/1494606
This commit is contained in:
Kijin Sung 2020-12-21 01:01:26 +09:00
parent 7e54b3add5
commit 198bb1b079
4 changed files with 14 additions and 6 deletions

View file

@ -60,7 +60,7 @@ class fileAdminController extends file
function procFileAdminInsertUploadConfig() function procFileAdminInsertUploadConfig()
{ {
// Update configuration // Update configuration
$config = getModel('module')->getModuleConfig('file'); $config = getModel('module')->getModuleConfig('file') ?: new stdClass;
$config->allowed_filesize = Context::get('allowed_filesize'); $config->allowed_filesize = Context::get('allowed_filesize');
$config->allowed_attach_size = Context::get('allowed_attach_size'); $config->allowed_attach_size = Context::get('allowed_attach_size');
$config->allowed_filetypes = Context::get('allowed_filetypes'); $config->allowed_filetypes = Context::get('allowed_filetypes');
@ -126,7 +126,7 @@ class fileAdminController extends file
function procFileAdminInsertDownloadConfig() function procFileAdminInsertDownloadConfig()
{ {
// Update configuration // Update configuration
$config = getModel('module')->getModuleConfig('file'); $config = getModel('module')->getModuleConfig('file') ?: new stdClass;
$config->allow_outlink = Context::get('allow_outlink') === 'N' ? 'N' : 'Y'; $config->allow_outlink = Context::get('allow_outlink') === 'N' ? 'N' : 'Y';
$config->allow_outlink_format = Context::get('allow_outlink_format'); $config->allow_outlink_format = Context::get('allow_outlink_format');
$config->allow_outlink_site = Context::get('allow_outlink_site'); $config->allow_outlink_site = Context::get('allow_outlink_site');
@ -148,7 +148,7 @@ class fileAdminController extends file
function procFileAdminInsertOtherConfig() function procFileAdminInsertOtherConfig()
{ {
// Update configuration // Update configuration
$config = getModel('module')->getModuleConfig('file'); $config = getModel('module')->getModuleConfig('file') ?: new stdClass;
$config->save_changelog = Context::get('save_changelog') === 'Y' ? 'Y' : 'N'; $config->save_changelog = Context::get('save_changelog') === 'Y' ? 'Y' : 'N';
// Save and redirect // Save and redirect

View file

@ -1323,7 +1323,7 @@ class menuAdminController extends menu
$target->node = $srl; $target->node = $srl;
$target->child= array(); $target->child= array();
while(count($this->map[$srl])) while(count($this->map[$srl] ?? []))
{ {
$this->_setParent($srl, array_shift($this->map[$srl]), $target); $this->_setParent($srl, array_shift($this->map[$srl]), $target);
} }

View file

@ -93,7 +93,7 @@ class rssAdminController extends rss
} }
else else
{ {
$target_module_srls = array_keys($vars->open_rss); $target_module_srls = array_keys($vars->open_rss ?: []);
} }
if(!count($target_module_srls)) if(!count($target_module_srls))
@ -117,7 +117,7 @@ class rssAdminController extends rss
} }
else else
{ {
$config->open_rss = $vars->open_rss; $config->open_rss = $vars->open_rss ?: [];
$config->open_total_feed = $vars->open_total_feed; $config->open_total_feed = $vars->open_total_feed;
$config->feed_description = $vars->feed_description; $config->feed_description = $vars->feed_description;
$config->feed_copyright = $vars->feed_copyright; $config->feed_copyright = $vars->feed_copyright;

View file

@ -67,6 +67,14 @@ class spamfilterAdminController extends spamfilter
// Get updated values // Get updated values
$vars = Context::getRequestVars(); $vars = Context::getRequestVars();
if (!isset($vars->target_devices) || !is_array($vars->target_devices))
{
$vars->target_devices = [];
}
if (!isset($vars->target_actions) || !is_array($vars->target_actions))
{
$vars->target_actions = [];
}
// Check values // Check values
if (!isset($config->captcha)) if (!isset($config->captcha))